winter 1 год назад
Родитель
Сommit
abd89d3809
11 измененных файлов: 144 добавлений и 141 удалений
  1. +5
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java
  2. +24
    -37
      mallinkAdmin/src/main/resources/db/migration/V202408000000005.sql
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java
  4. +1
    -13
      mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcute.java
  5. +38
    -6
      mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcuteResult.java
  6. +1
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxShop.java
  7. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxEnergyService.java
  8. +1
    -1
      mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java
  9. +68
    -69
      mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java
  10. +1
    -3
      mallinkService/src/main/resources/mapper/WxEnergyReadingCalcuteMapper.xml
  11. +3
    -4
      mallinkService/src/main/resources/mapper/WxEnergyReadingCalcuteResultMapper.xml

+ 5
- 5
mallinkAdmin/src/main/java/com/iformall/controller/market/WxEnergyController.java Просмотреть файл

@@ -206,6 +206,7 @@ public class WxEnergyController extends BaseController {
WxEnergyMeter meter = list.get(i); WxEnergyMeter meter = list.get(i);
WxShop s = new WxShop(); WxShop s = new WxShop();
s.setId(meter.getId()); s.setId(meter.getId());
s.setTreeType(meter.getTreeType());
s.setShopNumber(meter.getName()); s.setShopNumber(meter.getName());
s.setTreeParentId(record.getFloor()); s.setTreeParentId(record.getFloor());
s.setTreeParentType("floor"); s.setTreeParentType("floor");
@@ -280,7 +281,7 @@ public class WxEnergyController extends BaseController {
} }
return new ResultData(list); return new ResultData(list);
} }
return new ResultData();
return new ResultData(new ArrayList<WxEnergyMeter>());
} }
@ApiOperation("用户能源表新增修改") @ApiOperation("用户能源表新增修改")
@@ -663,10 +664,9 @@ public class WxEnergyController extends BaseController {
@ApiOperation("生成账单") @ApiOperation("生成账单")
@PostMapping("createBill") @PostMapping("createBill")
public ResultData createBill(@RequestBody WxEnergyReadingCalcute record) { public ResultData createBill(@RequestBody WxEnergyReadingCalcute record) {
// record.updateTenantInfo(getTenantInfo());
// Integer number = wxEnergyService.calcuteReading(wrc, getUser());
// return new ResultData(number);
return null;
record.updateTenantInfo(getTenantInfo());
wxEnergyService.createBill(record, getUser());
return new ResultData();
} }
@PostMapping("calcuteIsDel") @PostMapping("calcuteIsDel")


+ 24
- 37
mallinkAdmin/src/main/resources/db/migration/V202408000000005.sql Просмотреть файл

@@ -675,42 +675,6 @@ CREATE TABLE `wx_energy_fees_time_shop` (
KEY `T_P_S` (`tenant_id`,`shop_id`,`period`) KEY `T_P_S` (`tenant_id`,`shop_id`,`period`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表';


CREATE TABLE `wx_energy_reading_calcute_shop` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID',
`parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID',
`create_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL,
`calcute_id` bigint(20) NOT NULL COMMENT '费用计算ID',
`shop_id` bigint(20) NOT NULL COMMENT '店铺ID',
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `T_T_F` (`tenant_id`,`calcute_id`,`shop_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表抄表';

drop TABLE wx_energy_reading_calcute;
CREATE TABLE `wx_energy_reading_calcute` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID',
`parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID',
`create_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL,
`create_by` bigint(20) DEFAULT NULL,
`create_by_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`update_by` bigint(20) DEFAULT NULL,
`update_by_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`remark` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`period` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '所属年月',
`fees_id` bigint(20) NOT NULL COMMENT '科目ID',
`is_calcuted` int(1) NOT NULL DEFAULT '0' COMMENT '是否已计算过',
`calcute_success` int(1) DEFAULT '0' COMMENT '计算是否成功',
`is_del` int(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
`shop_size` int(6) NOT NULL DEFAULT '0' COMMENT '店铺数量',
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `T_P_F` (`tenant_id`,`period`,`fees_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表抄表';



alter table wx_energy_meter_reading_0 add column building_name varchar(100) comment '所属楼栋,有可能会是多个'; alter table wx_energy_meter_reading_0 add column building_name varchar(100) comment '所属楼栋,有可能会是多个';
alter table wx_energy_meter_reading_1 add column building_name varchar(100) comment '所属楼栋,有可能会是多个'; alter table wx_energy_meter_reading_1 add column building_name varchar(100) comment '所属楼栋,有可能会是多个';
@@ -1320,6 +1284,29 @@ alter table wx_energy_fees_97 add column is_public int(1) not null default
alter table wx_energy_fees_98 add column is_public int(1) not null default 0 comment '是否公摊'; alter table wx_energy_fees_98 add column is_public int(1) not null default 0 comment '是否公摊';
alter table wx_energy_fees_99 add column is_public int(1) not null default 0 comment '是否公摊'; alter table wx_energy_fees_99 add column is_public int(1) not null default 0 comment '是否公摊';


drop TABLE wx_energy_reading_calcute;
CREATE TABLE `wx_energy_reading_calcute` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID',
`parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID',
`create_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL,
`create_by` bigint(20) DEFAULT NULL,
`create_by_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`update_by` bigint(20) DEFAULT NULL,
`update_by_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`remark` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`period` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '所属年月',
`fees_id` bigint(20) NOT NULL COMMENT '科目ID',
`is_calcuted` int(1) NOT NULL DEFAULT '0' COMMENT '是否已计算过',
`is_del` int(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
`shop_size` int(6) NOT NULL DEFAULT '0' COMMENT '店铺数量',
`shop` text COLLATE utf8mb4_unicode_ci COMMENT '店铺编号',
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `T_P_F` (`tenant_id`,`period`,`fees_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表抄表';



CREATE TABLE `wx_energy_reading_calcute_result` ( CREATE TABLE `wx_energy_reading_calcute_result` (
`id` bigint(20) NOT NULL COMMENT '主键ID', `id` bigint(20) NOT NULL COMMENT '主键ID',
@@ -1331,9 +1318,9 @@ CREATE TABLE `wx_energy_reading_calcute_result` (
`shop_id` bigint(20) NOT NULL COMMENT '店铺ID', `shop_id` bigint(20) NOT NULL COMMENT '店铺ID',
`fees_id` bigint(20) NOT NULL COMMENT '科目编号', `fees_id` bigint(20) NOT NULL COMMENT '科目编号',
`fees_shop_id` bigint(20) NOT NULL COMMENT '店铺科目编号', `fees_shop_id` bigint(20) NOT NULL COMMENT '店铺科目编号',
`meter_id` bigint(20) DEFAULT NULL COMMENT '表编号',
`money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '金额', `money` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '金额',
`period` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '所属年月', `period` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '所属年月',
`money_deail` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细说明',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`), UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `T_T_F` (`tenant_id`,`calcute_id`,`shop_id`) UNIQUE KEY `T_T_F` (`tenant_id`,`calcute_id`,`shop_id`)


+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java Просмотреть файл

@@ -260,7 +260,7 @@ public class WxAllBill extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "能源抄表计算ID", name = "energyReadingCalcuteId") @io.swagger.annotations.ApiModelProperty(value = "能源抄表计算ID", name = "energyReadingCalcuteId")
private Long energyReadingCalcuteId; private Long energyReadingCalcuteId;
@io.swagger.annotations.ApiModelProperty(value = "能源抄表ID", name = "energyReadingId")
@io.swagger.annotations.ApiModelProperty(value = "WxEnergyReadingCalcuteResult的id", name = "energyReadingId")
private Long energyReadingId; private Long energyReadingId;
@io.swagger.annotations.ApiModelProperty(value = "账单额外生成来源EnumBillExtraCreateFrom", name = "extraCreateFrom") @io.swagger.annotations.ApiModelProperty(value = "账单额外生成来源EnumBillExtraCreateFrom", name = "extraCreateFrom")


+ 1
- 13
mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcute.java Просмотреть файл

@@ -59,21 +59,9 @@ public class WxEnergyReadingCalcute extends TenantEntity {
@TableField(exist = false) @TableField(exist = false)
private String feesPhysicsTypeName; private String feesPhysicsTypeName;
@io.swagger.annotations.ApiModelProperty(value = "isCalcuted", name = "isCalcuted")
@io.swagger.annotations.ApiModelProperty(value = "是否已生成账单", name = "isCalcuted")
private Integer isCalcuted; private Integer isCalcuted;
@io.swagger.annotations.ApiModelProperty(value = "importSuccess", name = "importSuccess")
private Integer calcuteSuccess;
@TableField(exist = false)
private String calcuteSuccessName;
private String getCalcuteSuccessName() {
if (null != calcuteSuccess && calcuteSuccess.intValue() == EnumYesOrNo.YES.getCode().intValue()) {
return "成功";
}else {
return "未完成计算";
}
}
@io.swagger.annotations.ApiModelProperty(value = "是否删除", name = "isDel") @io.swagger.annotations.ApiModelProperty(value = "是否删除", name = "isDel")
private Integer isDel; private Integer isDel;


+ 38
- 6
mallinkService/src/main/java/com/iformall/domain/po/WxEnergyReadingCalcuteResult.java Просмотреть файл

@@ -2,7 +2,9 @@ package com.iformall.domain.po;


import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumBillAllType;
import com.iformall.enums.EnumYesOrNo; import com.iformall.enums.EnumYesOrNo;
import com.iformall.utils.DateUtils; import com.iformall.utils.DateUtils;


@@ -65,17 +67,47 @@ public class WxEnergyReadingCalcuteResult extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="费用标准ID",name="feesCalcuteId") @io.swagger.annotations.ApiModelProperty(value="费用标准ID",name="feesCalcuteId")
private Long feesShopId; private Long feesShopId;
@io.swagger.annotations.ApiModelProperty(value="表ID",name="meterId")
private Long meterId;
@Excel(name = "表号", width = 20, orderNum = "7")
@TableField(exist = false)
private String meterName;
@Excel(name = "金额", width = 20, orderNum = "8") @Excel(name = "金额", width = 20, orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="金额",name="money") @io.swagger.annotations.ApiModelProperty(value="金额",name="money")
private String money; private String money;
@Excel(name = "详细说明", width = 20, orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="详细说明",name="moneyDeail")
private String moneyDeail;
@TableField(exist = false) @TableField(exist = false)
private List<Long> shopIds; private List<Long> shopIds;
public WxAllBill generateBill(WxEnergyReadingCalcute calcute,WxMerchant merchant,WxShop shop,MallUserInfo user,String needPay,String detail,String remark) {
WxAllBill daily = new WxAllBill();
final IdWorker idWorker = IdWorker.get();
daily.setId(idWorker.nextId());
daily.updateTenantInfo(this);
daily.setMerchantId(merchant.getId());
daily.setRentShopType(merchant.getType());
daily.setCreatetime(new Date());
daily.setCreateBy(user.getId());
daily.setCreateByName(user.getName());
daily.setUpdateBy(user.getId());
daily.setUpdateByName(user.getName());
daily.setUpdatetime(new Date());
daily.setReceivePay(needPay);
daily.setNeedPay(needPay);
daily.setPay("0");
daily.setStarttime(DateUtils.getDayBegin(new Date()));
daily.setEndtime(DateUtils.getDayEnd(new Date()));
daily.setOwe(needPay);
daily.setShopId(this.shopId);
daily.setShopNumber(shop.getShopNumber());
daily.setBillType(EnumBillAllType.DAILY.getCode());
daily.setEnergyFeesId(calcute.getFeesId());
daily.setPriceDetail(detail);
daily.setServiceChargePay("0");
daily.setBillRemark(remark);
daily.setIsPreview(EnumYesOrNo.NO.getCode());
daily.setEnergyReadingCalcuteId(calcute.getId());
daily.setEnergyReadingId(id);
return daily;
}
} }

+ 1
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxShop.java Просмотреть файл

@@ -116,7 +116,7 @@ public class WxShop extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="管理人电话",name="managerPhone") @io.swagger.annotations.ApiModelProperty(value="管理人电话",name="managerPhone")
private String managerPhone; private String managerPhone;


@io.swagger.annotations.ApiModelProperty(value = "类型", name = "type")
@io.swagger.annotations.ApiModelProperty(value = "类型EnumRentShopType", name = "type")
private Integer type; private Integer type;






+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxEnergyService.java Просмотреть файл

@@ -80,7 +80,7 @@ public interface WxEnergyService {
void saveOrUpdateReadingCalcute(WxEnergyReadingCalcute record,MallUserInfo userInfo); void saveOrUpdateReadingCalcute(WxEnergyReadingCalcute record,MallUserInfo userInfo);
PageInfo<WxEnergyReadingCalcuteResult> readingCalcuteResultListAsPage(WxEnergyReadingCalcuteResult record, Integer pageIndex, Integer pageSize); PageInfo<WxEnergyReadingCalcuteResult> readingCalcuteResultListAsPage(WxEnergyReadingCalcuteResult record, Integer pageIndex, Integer pageSize);
void exportReadingCalcuteResult(WxEnergyReadingCalcuteResult record,HttpServletRequest request, HttpServletResponse response); void exportReadingCalcuteResult(WxEnergyReadingCalcuteResult record,HttpServletRequest request, HttpServletResponse response);
Integer calcuteReading(WxEnergyReadingCalcute record, MallUserInfo user);
void createBill(WxEnergyReadingCalcute record, MallUserInfo user);
void setReadingCalcuteIsDel(WxEnergyReadingCalcute record); void setReadingCalcuteIsDel(WxEnergyReadingCalcute record);
List<String> getReadingCalcuteShopNumber(WxEnergyReadingCalcute record); List<String> getReadingCalcuteShopNumber(WxEnergyReadingCalcute record);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/helper/WxEnergyHelper.java Просмотреть файл

@@ -45,7 +45,7 @@ public class WxEnergyHelper {
return m; return m;
} }
public static String calcuteMoney(WxEnergyFeesTime time,WxEnergyMeter meter,WxEnergyFeesShop shopfee) {
public static String calcuteMoney(StringBuffer sb,WxEnergyFeesTime time,List<WxEnergyMeter> meterList,WxEnergyFeesShop shopfee) {
return "0"; return "0";
} }


+ 68
- 69
mallinkService/src/main/java/com/iformall/service/impl/WxEnergyServiceImpl.java Просмотреть файл

@@ -943,22 +943,23 @@ public class WxEnergyServiceImpl implements WxEnergyService {
//循环店铺科目, //循环店铺科目,
for (int j = 0 ; j < shopFeesList.size() ; j ++) { for (int j = 0 ; j < shopFeesList.size() ; j ++) {
WxEnergyFeesShop shopfee = shopFeesList.get(j); WxEnergyFeesShop shopfee = shopFeesList.get(j);
WxEnergyReadingCalcuteResult cs = new WxEnergyReadingCalcuteResult();
cs.updateTenantInfo(record);
cs.setId(idWorker.nextId());
cs.setCalcuteId(record.getId());
cs.setShopId(shopId);
cs.setCreateTime(new Date());
cs.setUpdateTime(new Date());
cs.setFeesId(shopfee.getFeesId());
cs.setFeesShopId(shopfee.getId());
StringBuffer sb = new StringBuffer();
cs.setMoney(WxEnergyHelper.calcuteMoney(sb,time, meterList, shopfee));
cs.setPeriod(record.getPeriod());
cs.setMoney(sb.toString());
resultList.add(cs);
//查询每一个表的抄表数据,求和 //查询每一个表的抄表数据,求和
for (int k = 0 ; k < meterList.size() ; k++) { for (int k = 0 ; k < meterList.size() ; k++) {
WxEnergyReadingCalcuteResult cs = new WxEnergyReadingCalcuteResult();
cs.updateTenantInfo(record);
cs.setId(idWorker.nextId());
cs.setCalcuteId(record.getId());
cs.setShopId(shopId);
cs.setCreateTime(new Date());
cs.setUpdateTime(new Date());
cs.setFeesId(shopfee.getFeesId());
cs.setFeesShopId(shopfee.getId());
WxEnergyMeter meter = meterList.get(k);
cs.setMeterId(meter.getId());
cs.setMoney(WxEnergyHelper.calcuteMoney(time, meter, shopfee));
cs.setPeriod(record.getPeriod());
resultList.add(cs);
} }
} }
} }
@@ -977,7 +978,6 @@ public class WxEnergyServiceImpl implements WxEnergyService {
Map<Long, WxEnergyFees> fessMap = this.getFeesMap(fq); Map<Long, WxEnergyFees> fessMap = this.getFeesMap(fq);
Map<Long, String> floorMap = wxMallFloorService.getFloorMap(record); Map<Long, String> floorMap = wxMallFloorService.getFloorMap(record);
Map<Long, String> buildingMap = wxMallBuildingService.getBuildingMap(record); Map<Long, String> buildingMap = wxMallBuildingService.getBuildingMap(record);
List<Long> meterIdList = new ArrayList<Long>();
List<Long> shopIdList = new ArrayList<Long>(); List<Long> shopIdList = new ArrayList<Long>();
for (int i = 0 ; i < page.getList().size(); i++) { for (int i = 0 ; i < page.getList().size(); i++) {
WxEnergyReadingCalcuteResult c = page.getList().get(i); WxEnergyReadingCalcuteResult c = page.getList().get(i);
@@ -987,19 +987,8 @@ public class WxEnergyServiceImpl implements WxEnergyService {
c.setFeesName(fees.getName()); c.setFeesName(fees.getName());
} }
} }
if (null != c.getMeterId()) {
meterIdList.add(c.getMeterId());
}
shopIdList.add(c.getShopId()); shopIdList.add(c.getShopId());
} }
Map<Long, WxEnergyMeter> meterMap = null;
if (meterIdList.size() > 0 ) {
WxEnergyMeter mq = new WxEnergyMeter();
mq.updateTenantInfo(record);
mq.setIds(meterIdList);
meterMap = this.getMeterMap(mq);
}
Map<Long, WxShop> shopMap = null; Map<Long, WxShop> shopMap = null;
if (shopIdList.size() > 0 ) { if (shopIdList.size() > 0 ) {
WxShop sq = new WxShop(); WxShop sq = new WxShop();
@@ -1009,12 +998,6 @@ public class WxEnergyServiceImpl implements WxEnergyService {
} }
for (int i = 0 ; i < page.getList().size(); i++) { for (int i = 0 ; i < page.getList().size(); i++) {
WxEnergyReadingCalcuteResult c = page.getList().get(i); WxEnergyReadingCalcuteResult c = page.getList().get(i);
if (null != meterMap && null != c.getMeterId()) {
WxEnergyMeter m = meterMap.get(c.getMeterId());
if (null != m) {
c.setMeterName(m.getName());
}
}
if (null != shopMap && null != c.getShopId()) { if (null != shopMap && null != c.getShopId()) {
WxShop s = shopMap.get(c.getShopId()); WxShop s = shopMap.get(c.getShopId());
if (null != s) { if (null != s) {
@@ -1129,45 +1112,61 @@ public class WxEnergyServiceImpl implements WxEnergyService {
@Override @Override
public Integer calcuteReading(WxEnergyReadingCalcute record, MallUserInfo user) {
public void createBill(WxEnergyReadingCalcute record, MallUserInfo user) {
WxEnergyReadingCalcute calcute = wxEnergyReadingCalcuteMapper.selectById(record.getId(), record.getTenantId());
WxEnergyReadingCalcuteResult crq = new WxEnergyReadingCalcuteResult();
crq.updateTenantInfo(record);
crq.setCalcuteId(calcute.getId());
List<Long> shopIdList = wxEnergyReadingCalcuteResultMapper.findShopIdList(crq);
Map<Long, WxShop> shopMap = null;
Map<Long, WxMerchant> merchantMap = null;
if (shopIdList.size() > 0 ) {
WxShop sq = new WxShop();
sq.updateTenantInfo(record);
sq.setIds(shopIdList);
shopMap = wxShopService.findShopMap(sq);
merchantMap = wxMerchantService.getShopMerchantMap(sq);
}
// //用户表列表
// List<WxEnergyMeterReading> readingList = wxEnergyMeterReadingMapper.findList(reading);
// if (null != readingList && readingList.size() > 0 ) {
//
//
// boolean allSuccess = true;
// if (billList.size() > 0 ) {
// try {
// //先把之前的未付的账单全部删除掉,已支付的账单先不处理
// WxAllBill delDaily = new WxAllBill();
// delDaily.updateTenantInfo(record);
// delDaily.setEnergyReadingCalcuteId(record.getId());
// wxAllBillService.deleteEnergyReadingBills(delDaily);
// wxAllBillService.insertBills(record.getTenantId(), billList);
// }catch(Exception e) {
// logger.error("insert bills error.",e);
// allSuccess = false;
// }
// WxEnergyReadingCalcute c = new WxEnergyReadingCalcute();
// c.updateTenantInfo(record);
// c.setId(record.getId());
// c.setIsCalcuted(EnumYesOrNo.YES.getCode());
// c.setUpdateTime(new Date());
// c.setUpdateBy(user.getId());
// c.setUpdateByName(user.getName());
// c.setRemark(record.getRemark());
// if (allSuccess) {
// c.setCalcuteSuccess(EnumYesOrNo.YES.getCode());
// }else {
// c.setCalcuteSuccess(EnumYesOrNo.NO.getCode());
// }
// wxEnergyReadingCalcuteMapper.updateById(c);
// return billList.size();
// }
// }
return 0;
List<WxEnergyReadingCalcuteResult> resultList = wxEnergyReadingCalcuteResultMapper.findList(crq);
if (null != resultList && resultList.size() > 0 ) {
List<WxAllBill> billList = new ArrayList<WxAllBill>();
for (int i = 0 ; i < resultList.size(); i++) {
WxEnergyReadingCalcuteResult result = resultList.get(i);
WxShop shop = null;
if (null != shopMap) {
shop = shopMap.get(result.getShopId());
}
WxMerchant merchant = null;
if (null != merchantMap) {
merchant = merchantMap.get(result.getShopId());
}
WxAllBill bill = result.generateBill(calcute, merchant, shop, user, result.getMoney(), result.getMoneyDeail(), "能源计算自动生成");
billList.add(bill);
}
try {
//先把之前的未付的账单全部删除掉,已支付的账单先不处理
WxAllBill delDaily = new WxAllBill();
delDaily.updateTenantInfo(record);
delDaily.setEnergyReadingCalcuteId(record.getId());
wxAllBillService.deleteEnergyReadingBills(delDaily);
wxAllBillService.insertBills(record.getTenantId(), billList);
}catch(Exception e) {
logger.error("insert bills error.",e);
}
WxEnergyReadingCalcute c = new WxEnergyReadingCalcute();
c.updateTenantInfo(record);
c.setId(record.getId());
c.setIsCalcuted(EnumYesOrNo.YES.getCode());
c.setUpdateTime(new Date());
c.setUpdateBy(user.getId());
c.setUpdateByName(user.getName());
c.setRemark(record.getRemark());
wxEnergyReadingCalcuteMapper.updateById(c);
}
} }


@Override @Override


+ 1
- 3
mallinkService/src/main/resources/mapper/WxEnergyReadingCalcuteMapper.xml Просмотреть файл

@@ -15,7 +15,6 @@
<result column="period" jdbcType="VARCHAR" property="period"/> <result column="period" jdbcType="VARCHAR" property="period"/>
<result column="fees_id" jdbcType="BIGINT" property="feesId"/> <result column="fees_id" jdbcType="BIGINT" property="feesId"/>
<result column="is_calcuted" jdbcType="INTEGER" property="isCalcuted"/> <result column="is_calcuted" jdbcType="INTEGER" property="isCalcuted"/>
<result column="calcute_success" jdbcType="INTEGER" property="calcuteSuccess"/>
<result column="is_del" jdbcType="INTEGER" property="isDel"/> <result column="is_del" jdbcType="INTEGER" property="isDel"/>
<result column="shop_size" jdbcType="INTEGER" property="shopSize"/> <result column="shop_size" jdbcType="INTEGER" property="shopSize"/>
<result column="shop" jdbcType="VARCHAR" property="shop"/> <result column="shop" jdbcType="VARCHAR" property="shop"/>
@@ -23,7 +22,7 @@


<sql id="allColumns"> <sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`create_by`,`create_by_name`, `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`create_by`,`create_by_name`,
`update_by`,`update_by_name`,`remark`,`period`,`fees_id`,`is_calcuted`,`calcute_success`,`is_del`,`shop_size`,`shop`
`update_by`,`update_by_name`,`remark`,`period`,`fees_id`,`is_calcuted`,`is_del`,`shop_size`,`shop`
</sql> </sql>


<sql id="dynamicWhereConditions"> <sql id="dynamicWhereConditions">
@@ -41,7 +40,6 @@
<if test=" null != createBy ">and `create_by` = #{createBy}</if> <if test=" null != createBy ">and `create_by` = #{createBy}</if>
<if test=" null != feesId ">and `fees_id` = #{feesId}</if> <if test=" null != feesId ">and `fees_id` = #{feesId}</if>
<if test=" null != isCalcuted ">and `is_calcuted` = #{isCalcuted}</if> <if test=" null != isCalcuted ">and `is_calcuted` = #{isCalcuted}</if>
<if test=" null != calcuteSuccess ">and `calcute_success` = #{calcuteSuccess}</if>
<if test=" null != isDel ">and `is_del` = #{isDel}</if> <if test=" null != isDel ">and `is_del` = #{isDel}</if>
<if test=" null != feesIds "> <if test=" null != feesIds ">
and fees_id in and fees_id in


+ 3
- 4
mallinkService/src/main/resources/mapper/WxEnergyReadingCalcuteResultMapper.xml Просмотреть файл

@@ -11,13 +11,13 @@
<result column="shop_id" jdbcType="BIGINT" property="shopId"/> <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
<result column="fees_id" jdbcType="BIGINT" property="feesId"/> <result column="fees_id" jdbcType="BIGINT" property="feesId"/>
<result column="fees_shop_id" jdbcType="BIGINT" property="feesShopId"/> <result column="fees_shop_id" jdbcType="BIGINT" property="feesShopId"/>
<result column="meter_id" jdbcType="BIGINT" property="meterId"/>
<result column="money" jdbcType="VARCHAR" property="money" /> <result column="money" jdbcType="VARCHAR" property="money" />
<result column="period" jdbcType="VARCHAR" property="period" /> <result column="period" jdbcType="VARCHAR" property="period" />
<result column="money_deail" jdbcType="VARCHAR" property="moneyDeail" />
</resultMap> </resultMap>


<sql id="allColumns"> <sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`calcute_id`,`shop_id`,`fees_id`,`fees_shop_id`,`meter_id`,`money`,`period`
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`calcute_id`,`shop_id`,`fees_id`,`fees_shop_id`,`money`,`period`,`money_deail`
</sql> </sql>


<sql id="dynamicWhereConditions"> <sql id="dynamicWhereConditions">
@@ -36,7 +36,6 @@
<if test=" null != shopId ">and `shop_id` = #{shopId}</if> <if test=" null != shopId ">and `shop_id` = #{shopId}</if>
<if test=" null != feesId ">and `fees_id` = #{feesId}</if> <if test=" null != feesId ">and `fees_id` = #{feesId}</if>
<if test=" null != feesShopId ">and `fees_shop_id` = #{feesShopId}</if> <if test=" null != feesShopId ">and `fees_shop_id` = #{feesShopId}</if>
<if test=" null != meterId ">and `meter_id` = #{meterId}</if>
<if test=" null != ids "> <if test=" null != ids ">
and id in and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -73,7 +72,7 @@
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
#{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createTime},#{item.updateTime},#{item.calcuteId}, #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createTime},#{item.updateTime},#{item.calcuteId},
#{item.shopId},#{item.feesId},#{item.feesShopId},#{item.meterId},#{item.money},#{item.period}
#{item.shopId},#{item.feesId},#{item.feesShopId},#{item.money},#{item.period},#{item.moneyDeail}
) )
</foreach> </foreach>
</insert> </insert>


Загрузка…
Отмена
Сохранить