| @@ -14,6 +14,7 @@ import com.iformall.domain.po.WxEnergyMeterChild; | |||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||
| import com.iformall.domain.po.WxEnergyMeterShopFloor; | |||
| import com.iformall.domain.po.WxEnergyReadingCalcute; | |||
| import com.iformall.domain.po.WxEnergyReadingCalcuteShop; | |||
| import com.iformall.domain.po.WxMallFloor; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.WxUserDataRule; | |||
| @@ -30,6 +31,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxMallFloorService; | |||
| import com.iformall.service.WxShopService; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -50,6 +52,7 @@ import org.springframework.web.multipart.MultipartFile; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -258,6 +261,7 @@ public class WxEnergyController extends BaseController { | |||
| WxShop s = new WxShop(); | |||
| s.setId(meter.getId()); | |||
| s.setShopNumber(meter.getName()); | |||
| s.setTreeType(meter.getTreeType()); | |||
| s.setTreeParentId(record.getShopId()); | |||
| s.setTreeParentType("shop"); | |||
| retList.add(s); | |||
| @@ -435,6 +439,19 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("费用区间所属年月") | |||
| @GetMapping("periodList") | |||
| public ResultData periodList() { | |||
| Calendar calendar = Calendar.getInstance(); | |||
| int year = calendar.get(Calendar.YEAR); | |||
| String[] months = new String[] {"01","02","03","04","05","06","07","08","09","10","11","12"}; | |||
| String[] peroids = new String[months.length+1]; | |||
| peroids[0] = (year-1)+"12"; | |||
| for (int i = 0 ; i < months.length; i++) { | |||
| peroids[i+1]=year+months[i]; | |||
| } | |||
| return new ResultData(peroids); | |||
| } | |||
| @ApiOperation("费用区间列表") | |||
| @GetMapping("timeList") | |||
| @@ -449,6 +466,12 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("费用区间自动时间") | |||
| @GetMapping("periodAutoTimes") | |||
| public ResultData periodAutoTimes(@ModelAttribute WxEnergyFeesTime record) { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("费用区间列表") | |||
| @PostMapping("saveTime") | |||
| public ResultData saveTime(@RequestBody WxEnergyFeesTime record) { | |||
| @@ -457,13 +480,20 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("timeUpdateIsDel") | |||
| @PostMapping("timeDel") | |||
| public ResultData timeUpdateIsDel(@RequestBody WxEnergyFeesTime record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxEnergyService.setTimeIsDel(record); | |||
| wxEnergyService.timeDel(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("区间店铺列表") | |||
| @GetMapping("timeShopList") | |||
| public ResultData timeShopList(@ModelAttribute WxEnergyFeesTime record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(wxEnergyService.getTimeShopNumber(record)); | |||
| } | |||
| @ApiOperation("能源科目列表") | |||
| @GetMapping("feesList") | |||
| @ApiImplicitParams({ | |||
| @@ -592,10 +622,27 @@ public class WxEnergyController extends BaseController { | |||
| public ResultData readingCalcuteList(@ModelAttribute WxEnergyReadingCalcute record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| if(StringUtils.isNotBlank(record.getFeesIdsStr())) { | |||
| String[] shids = record.getFeesIdsStr().split(","); | |||
| if (null != shids ) { | |||
| List<Long> sids = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < shids.length ; i ++) { | |||
| sids.add(Long.parseLong(shids[i])); | |||
| } | |||
| record.setFeesIds(sids); | |||
| } | |||
| } | |||
| PageInfo<WxEnergyReadingCalcute> page = wxEnergyService.readingCalcuteListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("科目抄表计算店铺列表") | |||
| @GetMapping("readingCalcuteShopList") | |||
| public ResultData readingCalcuteShopList(@ModelAttribute WxEnergyReadingCalcute record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(wxEnergyService.getReadingCalcuteShopNumber(record)); | |||
| } | |||
| @ApiOperation("科目抄表计算记录导出") | |||
| @GetMapping("readingCalcuteExport") | |||
| public void readingCalcuteExport(@ModelAttribute WxEnergyReadingCalcute record, HttpServletRequest request, HttpServletResponse response) { | |||
| @@ -628,9 +675,6 @@ public class WxEnergyController extends BaseController { | |||
| if (null == wrc) { | |||
| return new ResultData(Result.ERROR,"id错误"); | |||
| } | |||
| if (null == wrc.getImportSuccess() || wrc.getImportSuccess().intValue() != EnumYesOrNo.YES.getCode().intValue()) { | |||
| return new ResultData(Result.ERROR,"导入未完全成功,不能计算!"); | |||
| } | |||
| Integer number = wxEnergyService.calcuteReading(wrc, getUser()); | |||
| return new ResultData(number); | |||
| } | |||
| @@ -675,6 +675,62 @@ alter table wx_energy_meter_reading_98 drop column floor_id; | |||
| alter table wx_energy_meter_reading_99 drop column floor_id; | |||
| ALTER TABLE `wx_energy_reading_calcute` ADD COLUMN shop_size INT(6) NOT NULL DEFAULT 0 COMMENT '店铺数量'; | |||
| ALTER TABLE wx_energy_fees_time DROP COLUMN NAME; | |||
| ALTER TABLE wx_energy_fees_time ADD COLUMN PERIOD VARCHAR(10) NOT NULL COMMENT '所属年月'; | |||
| ALTER TABLE wx_energy_fees_time ADD COLUMN shop_size INT(6) NOT NULL DEFAULT 0 COMMENT '店铺数量'; | |||
| ALTER TABLE wx_energy_fees_time DROP COLUMN is_del; | |||
| CREATE TABLE `wx_energy_fees_time_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, | |||
| `time_id` bigint(20) NOT NULL COMMENT '时间区间id', | |||
| `shop_id` bigint(20) NOT NULL COMMENT '店铺编号', | |||
| `period` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '所属年月', | |||
| `type` int(1) NOT NULL COMMENT '表类型', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`), | |||
| KEY `T_P_S` (`tenant_id`,`shop_id`,`period`) | |||
| ) 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='能耗表抄表'; | |||
| @@ -351,7 +351,6 @@ public class WxMallAdminController extends BaseController { | |||
| @GetMapping("timeList") | |||
| public ResultData timeList(@ModelAttribute WxEnergyFeesTime record) { | |||
| setQueryDataRule(record); | |||
| record.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| PageInfo<WxEnergyFeesTime> page = wxEnergyService.timeListAsPage(record, 1, 1000); | |||
| return new ResultData(page); | |||
| @@ -1,11 +1,15 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @@ -20,20 +24,28 @@ public class WxEnergyFeesTime extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="name",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "isDel", name = "isDel") | |||
| private Integer isDel; | |||
| @io.swagger.annotations.ApiModelProperty(value = "表类型EnumEnergyMeterType", name = "type") | |||
| private Integer type; | |||
| @TableField(exist = false) | |||
| private String typeName; | |||
| public String getTypeName() { | |||
| if (null != type) { | |||
| return EnumEnergyMeterType.getEnum(type).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "所属年月", name = "period") | |||
| private String period; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺数量", name = "shopSize") | |||
| private Integer shopSize; | |||
| @io.swagger.annotations.ApiModelProperty(value="startTime",name="startTime") | |||
| private Date startTime; | |||
| @@ -41,4 +53,7 @@ public class WxEnergyFeesTime extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="endTime",name="endTime") | |||
| private Date endTime; | |||
| @TableField(exist = false) | |||
| List<Long> shopIds; | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_energy_fees_time_shop") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxEnergyFeesTimeShop extends TenantEntity { | |||
| private static final long serialVersionUID = 7009117540201976664L; | |||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "所属年月", name = "period") | |||
| private String period; | |||
| @io.swagger.annotations.ApiModelProperty(value = "表类型EnumEnergyMeterType", name = "type") | |||
| private Integer type; | |||
| @TableField(exist = false) | |||
| private String typeName; | |||
| public String getTypeName() { | |||
| if (null != type) { | |||
| return EnumEnergyMeterType.getEnum(type).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "时间区间编号", name = "timeId") | |||
| private Long timeId; | |||
| @io.swagger.annotations.ApiModelProperty(value="店铺编号",name="shopId") | |||
| private Long shopId; | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| } | |||
| @@ -49,30 +49,15 @@ public class WxEnergyReadingCalcute extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | |||
| private String remark; | |||
| @io.swagger.annotations.ApiModelProperty(value="区间ID",name="timeId") | |||
| private Long timeId; | |||
| @TableField(exist = false) | |||
| private String timeName; | |||
| @io.swagger.annotations.ApiModelProperty(value="所属年月",name="period") | |||
| private String period; | |||
| @io.swagger.annotations.ApiModelProperty(value="科目ID",name="feesId") | |||
| private Long feesId; | |||
| @TableField(exist = false) | |||
| private String feesName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "isImported", name = "isImported") | |||
| private Integer isImported; | |||
| @io.swagger.annotations.ApiModelProperty(value = "importSuccess", name = "importSuccess") | |||
| private Integer importSuccess; | |||
| @TableField(exist = false) | |||
| private String importSuccessName; | |||
| public String getImportSuccessName() { | |||
| if (null != importSuccess && importSuccess.intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| return "成功"; | |||
| }else { | |||
| return "未完成导入"; | |||
| } | |||
| } | |||
| private String feesPhysicsTypeName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "isCalcuted", name = "isCalcuted") | |||
| private Integer isCalcuted; | |||
| @@ -97,5 +82,9 @@ public class WxEnergyReadingCalcute extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| @TableField(exist = false) | |||
| private List<Long> feesIds; | |||
| @TableField(exist = false) | |||
| private String feesIdsStr; | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.utils.DateUtils; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.LinkedHashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_energy_reading_calcute_shop") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxEnergyReadingCalcuteShop extends TenantEntity { | |||
| private static final long serialVersionUID = 7009117540201976664L; | |||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="createTime",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="updateTime",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="计算ID",name="calcuteId") | |||
| private Long calcuteId; | |||
| @io.swagger.annotations.ApiModelProperty(value="店铺ID",name="shopId") | |||
| private Long shopId; | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxEnergyFeesTimeShop; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxEnergyFeesTimeShopMapper extends CommonMapper<WxEnergyFeesTimeShop, Long> { | |||
| List<WxEnergyFeesTimeShop> findList(WxEnergyFeesTimeShop wxBillRent); | |||
| Integer findCount(WxEnergyFeesTimeShop wxBillRent); | |||
| WxEnergyFeesTimeShop selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| void deleteByTimeId(@Param("timeId")Long timeId,@Param("tenantId")String tenantId); | |||
| List<Long> findShopIdList(WxEnergyFeesTimeShop wxBillRent); | |||
| } | |||
| @@ -17,9 +17,5 @@ public interface WxEnergyMeterReadingMapper extends CommonMapper<WxEnergyMeterRe | |||
| String findAllSumMoney(WxEnergyMeterReading wxBillRent); | |||
| List<Map> findBuildingSumMoney(WxEnergyMeterReading wxBillRent); | |||
| List<Map> findFloorSumMoney(WxEnergyMeterReading wxBillRent); | |||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxEnergyReadingCalcuteShop; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxEnergyReadingCalcuteShopMapper extends CommonMapper<WxEnergyReadingCalcuteShop, Long> { | |||
| List<WxEnergyReadingCalcuteShop> findList(WxEnergyReadingCalcuteShop wxBillRent); | |||
| List<Long> findShopIdList(WxEnergyReadingCalcuteShop wxBillRent); | |||
| WxEnergyReadingCalcuteShop selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| } | |||
| @@ -56,4 +56,6 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> { | |||
| * @return {@link List}<{@link CountShopByStatusDTO}> | |||
| */ | |||
| List<CountShopByStatusDTO> countShopByStatus(@Param("tenantIds") List<String> tenantIds); | |||
| List<String> findShopNumberList(WxShop wxShop); | |||
| } | |||
| @@ -21,6 +21,7 @@ import com.iformall.domain.po.WxEnergyMeterChild; | |||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||
| import com.iformall.domain.po.WxEnergyMeterShopFloor; | |||
| import com.iformall.domain.po.WxEnergyReadingCalcute; | |||
| import com.iformall.domain.po.WxEnergyReadingCalcuteShop; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| /** | |||
| */ | |||
| @@ -44,7 +45,8 @@ public interface WxEnergyService { | |||
| void saveOrUpdateTime(WxEnergyFeesTime record); | |||
| WxEnergyFeesTime getFeesTimeById(WxEnergyFeesTime record); | |||
| Map<Long,WxEnergyFeesTime> getTimeMap(WxEnergyFeesTime record); | |||
| void setTimeIsDel(WxEnergyFeesTime record); | |||
| void timeDel(WxEnergyFeesTime record); | |||
| List<String> getTimeShopNumber(WxEnergyFeesTime record); | |||
| //费用科目 | |||
| PageInfo<WxEnergyFees> feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize,boolean isSetOff); | |||
| @@ -83,4 +85,6 @@ public interface WxEnergyService { | |||
| void importReadingCalcute(MultipartFile mFile, MallUserInfo user, HttpServletRequest request, HttpServletResponse response); | |||
| Integer calcuteReading(WxEnergyReadingCalcute record, MallUserInfo user); | |||
| void setReadingCalcuteIsDel(WxEnergyReadingCalcute record); | |||
| List<String> getReadingCalcuteShopNumber(WxEnergyReadingCalcute record); | |||
| } | |||
| @@ -116,5 +116,7 @@ public interface WxShopService { | |||
| List<Long> getFloorBuildShopIds(TenantEntity tenantEntity,String floorRule,Long building,Long floor,Integer shopDel) ; | |||
| List<Long> getMerchantIds(WxShop wxShop); | |||
| List<String> getShopNumberList(WxShop wxShop); | |||
| } | |||
| @@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.File; | |||
| @@ -61,6 +63,8 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Autowired | |||
| WxEnergyFeesTimeMapper wxEnergyFeesTimeMapper; | |||
| @Autowired | |||
| WxEnergyFeesTimeShopMapper wxEnergyFeesTimeShopMapper; | |||
| @Autowired | |||
| WxEnergyFeesMapper wxEnergyFeesMapper; | |||
| @Autowired | |||
| WxEnergyFeesCalcuteShopMapper wxEnergyFeesCalcuteShopMapper; | |||
| @@ -68,6 +72,8 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| WxEnergyFeesSetoffMapper wxEnergyFeesSetoffMapper; | |||
| @Autowired | |||
| WxEnergyReadingCalcuteMapper wxEnergyReadingCalcuteMapper; | |||
| @Autowired | |||
| WxEnergyReadingCalcuteShopMapper wxEnergyReadingCalcuteShopMapper; | |||
| @Lazy | |||
| @Autowired | |||
| @@ -166,7 +172,7 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| record.setType(EnumEnergyMeterShopFloorType.SHOP.getCode()); | |||
| aliasIds = record.getShopIds(); | |||
| if (null == aliasIds || aliasIds.size() <= 0 ) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择有效的店铺"); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"用户表类型,必须选择店铺"); | |||
| } | |||
| }else if (record.getPhysicsType() == EnumEnergyMeterPhysicsType.PUBLIC.getCode() || record.getPhysicsType() == EnumEnergyMeterPhysicsType.SUMMARY.getCode()) { | |||
| List<Long> floorIds = record.getFloorIds(); | |||
| @@ -263,16 +269,43 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesTimeMapper.findList(record)); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void saveOrUpdateTime(WxEnergyFeesTime record) { | |||
| if (null == record.getShopIds() || record.getShopIds().size() <= 0 ) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择店铺"); | |||
| } | |||
| Date date = new Date(); | |||
| if (record.getId() == null) { | |||
| //查询是不是已经有了 | |||
| WxEnergyFeesTimeShop tsq = new WxEnergyFeesTimeShop(); | |||
| tsq.setPeriod(record.getPeriod()); | |||
| tsq.setShopIds(record.getShopIds()); | |||
| tsq.setType(record.getType()); | |||
| Integer scount = wxEnergyFeesTimeShopMapper.findCount(tsq); | |||
| if (null != scount && scount > 0 ) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"所选店铺已存在该年月的"+record.getTypeName()+"区间"); | |||
| } | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateTime(date); | |||
| record.setUpdateTime(date); | |||
| try { | |||
| wxEnergyFeesTimeMapper.insert(record); | |||
| for (int i = 0 ; i < record.getShopIds().size(); i ++) { | |||
| Long shopId = record.getShopIds().get(i); | |||
| WxEnergyFeesTimeShop ts = new WxEnergyFeesTimeShop(); | |||
| ts.updateTenantInfo(record); | |||
| ts.setId(idWorker.nextId()); | |||
| ts.setTimeId(record.getId()); | |||
| ts.setShopId(shopId); | |||
| ts.setPeriod(record.getPeriod()); | |||
| ts.setType(record.getType()); | |||
| wxEnergyFeesTimeShopMapper.insert(ts); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("保存租赁账单失败,e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| @@ -305,8 +338,25 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public void setTimeIsDel(WxEnergyFeesTime record) { | |||
| wxEnergyFeesTimeMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||
| public void timeDel(WxEnergyFeesTime record) { | |||
| //TODO 如果是已经有过计算的,不让删除 | |||
| wxEnergyFeesTimeMapper.deleteById(record.getId()); | |||
| wxEnergyFeesTimeShopMapper.deleteByTimeId(record.getId(),record.getTenantId()); | |||
| } | |||
| @Override | |||
| public List<String> getTimeShopNumber(WxEnergyFeesTime record) { | |||
| WxEnergyFeesTimeShop ts = new WxEnergyFeesTimeShop(); | |||
| ts.updateTenantInfo(record); | |||
| ts.setTimeId(record.getId()); | |||
| List<Long> shopIds = wxEnergyFeesTimeShopMapper.findShopIdList(ts); | |||
| if (null == shopIds || shopIds.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| sq.setIds(shopIds); | |||
| return wxShopService.getShopNumberList(sq); | |||
| } | |||
| @@ -741,22 +791,16 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| if (null != page && null != page.getList()) { | |||
| WxEnergyFeesTime tq = new WxEnergyFeesTime(); | |||
| tq.updateTenantInfo(record); | |||
| Map<Long, WxEnergyFeesTime> timeMap = this.getTimeMap(tq); | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| Map<Long, WxEnergyFees> fessMap = this.getFeesMap(fq); | |||
| for (int i = 0 ; i < page.getList().size(); i++) { | |||
| WxEnergyReadingCalcute c = page.getList().get(i); | |||
| if (null != timeMap) { | |||
| WxEnergyFeesTime time = timeMap.get(c.getTimeId()); | |||
| if (null != time) { | |||
| c.setTimeName(time.getName()); | |||
| } | |||
| } | |||
| if (null != fessMap) { | |||
| WxEnergyFees fees = fessMap.get(c.getFeesId()); | |||
| if (null != fees) { | |||
| c.setFeesName(fees.getName()); | |||
| c.setFeesPhysicsTypeName(null); | |||
| } | |||
| } | |||
| } | |||
| @@ -806,37 +850,37 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public void exportReadingCalcute(WxEnergyReadingCalcute record, HttpServletRequest request, HttpServletResponse response) { | |||
| WxEnergyFeesTime tq = new WxEnergyFeesTime(); | |||
| tq.updateTenantInfo(record); | |||
| tq.setId(record.getTimeId()); | |||
| WxEnergyFeesTime time = this.getFeesTimeById(tq); | |||
| if (null == time) { | |||
| return; | |||
| } | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| fq.setId(record.getFeesId()); | |||
| WxEnergyFees fees = this.getFeesById(fq); | |||
| if (null == fees) { | |||
| return; | |||
| } | |||
| Map<Long, String> buildingMap = wxMallBuildingService.getBuildingMap(record); | |||
| Map<Long, String> floorMap = wxMallFloorService.getFloorMap(record); | |||
| List<Map<String,Object>> execlList = new ArrayList<Map<String,Object>>(); | |||
| WxEnergyMeterReading rq = new WxEnergyMeterReading(); | |||
| rq.updateTenantInfo(record); | |||
| //rq.setTimeId(tq.getId()); | |||
| PageInfo<WxEnergyMeterReading> page = this.readingListAsPage(rq, 1, 10000); | |||
| if (null != page && null != page.getList()) { | |||
| for (int i = 0 ; i < page.getList().size(); i++) { | |||
| WxEnergyMeterReading r = page.getList().get(i); | |||
| execlList.add(r.generateExcelData(buildingMap, floorMap, time, fees, record)); | |||
| } | |||
| } | |||
| excelService.exportExcel(WxEnergyMeterReading.generateExcelTitle(),execlList, "科目抄表_"+time.getName()+"_"+fees.getName()+".xlsx","sheet1", response); | |||
| // WxEnergyFeesTime tq = new WxEnergyFeesTime(); | |||
| // tq.updateTenantInfo(record); | |||
| // tq.setId(record.getTimeId()); | |||
| // WxEnergyFeesTime time = this.getFeesTimeById(tq); | |||
| // if (null == time) { | |||
| // return; | |||
| // } | |||
| // | |||
| // WxEnergyFees fq = new WxEnergyFees(); | |||
| // fq.updateTenantInfo(record); | |||
| // fq.setId(record.getFeesId()); | |||
| // WxEnergyFees fees = this.getFeesById(fq); | |||
| // if (null == fees) { | |||
| // return; | |||
| // } | |||
| // | |||
| // Map<Long, String> buildingMap = wxMallBuildingService.getBuildingMap(record); | |||
| // Map<Long, String> floorMap = wxMallFloorService.getFloorMap(record); | |||
| // | |||
| // List<Map<String,Object>> execlList = new ArrayList<Map<String,Object>>(); | |||
| // WxEnergyMeterReading rq = new WxEnergyMeterReading(); | |||
| // rq.updateTenantInfo(record); | |||
| // //rq.setTimeId(tq.getId()); | |||
| // PageInfo<WxEnergyMeterReading> page = this.readingListAsPage(rq, 1, 10000); | |||
| // if (null != page && null != page.getList()) { | |||
| // for (int i = 0 ; i < page.getList().size(); i++) { | |||
| // WxEnergyMeterReading r = page.getList().get(i); | |||
| // execlList.add(r.generateExcelData(buildingMap, floorMap, time, fees, record)); | |||
| // } | |||
| // } | |||
| // excelService.exportExcel(WxEnergyMeterReading.generateExcelTitle(),execlList, "科目抄表_"+time.getName()+"_"+fees.getName()+".xlsx","sheet1", response); | |||
| } | |||
| private File handlerImportFile(MultipartFile mFile,String fileNamePre) { | |||
| @@ -930,83 +974,83 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public void importReadingCalcute(MultipartFile mFile, MallUserInfo user, HttpServletRequest request, | |||
| HttpServletResponse response) { | |||
| File file = handlerImportFile(mFile,"energyReading"); | |||
| // 需要验证 | |||
| Map<String,String> excelTitle = WxEnergyMeterReading.generateExcelTitle(); | |||
| String[] needFields = new String[excelTitle.size()]; | |||
| int index = 0; | |||
| for (Iterator<String> it = excelTitle.keySet().iterator(); it.hasNext();) { | |||
| String fi = excelTitle.get(it.next()); | |||
| needFields[index] = fi; | |||
| index = index + 1; | |||
| } | |||
| ExcelImportResult<Map> datalist = handleImportFile(file,Map.class,needFields,needFields,new ReadingExcelHandler()); | |||
| if (null == datalist) { | |||
| return ; | |||
| } | |||
| List<Map> successList = datalist.getList(); | |||
| if(successList.size() > 0) { | |||
| boolean allSuccess = true; | |||
| String cuteId = (String)successList.get(0).get("编码"); | |||
| try { | |||
| successList.parallelStream().forEach(reading -> { | |||
| String id = (String) reading.get("抄表数据编码"); | |||
| WxEnergyMeterReading r = new WxEnergyMeterReading(); | |||
| r.updateTenantInfo(user); | |||
| r.setId(Long.parseLong(id)); | |||
| r.setPrice((String)reading.get("单价(*)")); | |||
| r.setCurNumber((String)reading.get("本次抄表数")); | |||
| r.setUpdateBy(user.getId()); | |||
| r.setUpdateByName(user.getName()); | |||
| r.setUpdateTime(new Date()); | |||
| wxEnergyMeterReadingMapper.updateById(r); | |||
| }); | |||
| } catch (Exception e) { | |||
| logger.error("导入模板失败:"+e.getMessage(),e); | |||
| allSuccess = false; | |||
| } | |||
| if (StringUtils.isNotBlank(cuteId)) { | |||
| WxEnergyReadingCalcute c= new WxEnergyReadingCalcute(); | |||
| c.updateTenantInfo(user); | |||
| c.setId(Long.parseLong(cuteId)); | |||
| c.setIsImported(EnumYesOrNo.YES.getCode()); | |||
| c.setUpdateTime(new Date()); | |||
| c.setUpdateBy(user.getId()); | |||
| c.setUpdateByName(user.getName()); | |||
| if (allSuccess) { | |||
| c.setImportSuccess(EnumYesOrNo.YES.getCode()); | |||
| }else { | |||
| c.setImportSuccess(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| wxEnergyReadingCalcuteMapper.updateById(c); | |||
| } | |||
| } | |||
| // File file = handlerImportFile(mFile,"energyReading"); | |||
| // // 需要验证 | |||
| // Map<String,String> excelTitle = WxEnergyMeterReading.generateExcelTitle(); | |||
| // String[] needFields = new String[excelTitle.size()]; | |||
| // int index = 0; | |||
| // for (Iterator<String> it = excelTitle.keySet().iterator(); it.hasNext();) { | |||
| // String fi = excelTitle.get(it.next()); | |||
| // needFields[index] = fi; | |||
| // index = index + 1; | |||
| // } | |||
| // ExcelImportResult<Map> datalist = handleImportFile(file,Map.class,needFields,needFields,new ReadingExcelHandler()); | |||
| // if (null == datalist) { | |||
| // return ; | |||
| // } | |||
| // | |||
| // List<Map> successList = datalist.getList(); | |||
| // if(successList.size() > 0) { | |||
| // boolean allSuccess = true; | |||
| // String cuteId = (String)successList.get(0).get("编码"); | |||
| // try { | |||
| // successList.parallelStream().forEach(reading -> { | |||
| // String id = (String) reading.get("抄表数据编码"); | |||
| // WxEnergyMeterReading r = new WxEnergyMeterReading(); | |||
| // r.updateTenantInfo(user); | |||
| // r.setId(Long.parseLong(id)); | |||
| // r.setPrice((String)reading.get("单价(*)")); | |||
| // r.setCurNumber((String)reading.get("本次抄表数")); | |||
| // r.setUpdateBy(user.getId()); | |||
| // r.setUpdateByName(user.getName()); | |||
| // r.setUpdateTime(new Date()); | |||
| // wxEnergyMeterReadingMapper.updateById(r); | |||
| // }); | |||
| // } catch (Exception e) { | |||
| // logger.error("导入模板失败:"+e.getMessage(),e); | |||
| // allSuccess = false; | |||
| // } | |||
| // if (StringUtils.isNotBlank(cuteId)) { | |||
| // WxEnergyReadingCalcute c= new WxEnergyReadingCalcute(); | |||
| // c.updateTenantInfo(user); | |||
| // c.setId(Long.parseLong(cuteId)); | |||
| // c.setIsImported(EnumYesOrNo.YES.getCode()); | |||
| // c.setUpdateTime(new Date()); | |||
| // c.setUpdateBy(user.getId()); | |||
| // c.setUpdateByName(user.getName()); | |||
| // if (allSuccess) { | |||
| // c.setImportSuccess(EnumYesOrNo.YES.getCode()); | |||
| // }else { | |||
| // c.setImportSuccess(EnumYesOrNo.NO.getCode()); | |||
| // } | |||
| // wxEnergyReadingCalcuteMapper.updateById(c); | |||
| // } | |||
| // | |||
| // } | |||
| } | |||
| private Map<Long,String> getFloorBuildingMoney(WxEnergyMeterReading reading,boolean isFloor) { | |||
| List<Map> list = null; | |||
| if (isFloor) { | |||
| list = wxEnergyMeterReadingMapper.findFloorSumMoney(reading); | |||
| }else { | |||
| wxEnergyMeterReadingMapper.findBuildingSumMoney(reading); | |||
| } | |||
| if (null != list && list.size() > 0 ) { | |||
| Map<Long, String> buildinMap = new HashMap<Long, String>(); | |||
| for (int i = 0 ; i < list.size() ; i++) { | |||
| Map bup = list.get(i); | |||
| BigDecimal are = (BigDecimal)bup.get("money"); | |||
| if (null != are) { | |||
| buildinMap.put((Long)bup.get("building_id"), are.toPlainString()); | |||
| }else { | |||
| buildinMap.put((Long)bup.get("building_id"), "0"); | |||
| } | |||
| } | |||
| return buildinMap; | |||
| } | |||
| // List<Map> list = null; | |||
| // if (isFloor) { | |||
| // list = wxEnergyMeterReadingMapper.findFloorSumMoney(reading); | |||
| // }else { | |||
| // wxEnergyMeterReadingMapper.findBuildingSumMoney(reading); | |||
| // } | |||
| // | |||
| // if (null != list && list.size() > 0 ) { | |||
| // Map<Long, String> buildinMap = new HashMap<Long, String>(); | |||
| // for (int i = 0 ; i < list.size() ; i++) { | |||
| // Map bup = list.get(i); | |||
| // BigDecimal are = (BigDecimal)bup.get("money"); | |||
| // if (null != are) { | |||
| // buildinMap.put((Long)bup.get("building_id"), are.toPlainString()); | |||
| // }else { | |||
| // buildinMap.put((Long)bup.get("building_id"), "0"); | |||
| // } | |||
| // | |||
| // } | |||
| // return buildinMap; | |||
| // } | |||
| return null; | |||
| } | |||
| @@ -1219,4 +1263,19 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| wxEnergyReadingCalcuteMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||
| } | |||
| @Override | |||
| public List<String> getReadingCalcuteShopNumber(WxEnergyReadingCalcute record) { | |||
| WxEnergyReadingCalcuteShop ts = new WxEnergyReadingCalcuteShop(); | |||
| ts.updateTenantInfo(record); | |||
| ts.setCalcuteId(record.getId()); | |||
| List<Long> shopIds = wxEnergyReadingCalcuteShopMapper.findShopIdList(ts); | |||
| if (null == shopIds || shopIds.size() <= 0 ) { | |||
| return null; | |||
| } | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| sq.setIds(shopIds); | |||
| return wxShopService.getShopNumberList(sq); | |||
| } | |||
| } | |||
| @@ -798,4 +798,9 @@ public class WxShopServiceImpl implements WxShopService { | |||
| merchantShopQ.setShopIdList(shopIds); | |||
| return wxMerchantShopMapper.findMerchantIdList(merchantShopQ); | |||
| } | |||
| @Override | |||
| public List<String> getShopNumberList(WxShop wxShop) { | |||
| return wxShopMapper.findShopNumberList(wxShop); | |||
| } | |||
| } | |||
| @@ -7,15 +7,15 @@ | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| <result column="period" jdbcType="VARCHAR" property="period"/> | |||
| <result column="shop_size" jdbcType="INTEGER" property="shopSize"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`start_time`,`end_time` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`type`,`start_time`,`end_time`,`period`,`shop_size` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -27,9 +27,10 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != period and '' != period"> | |||
| and `period` = #{period} | |||
| </if> | |||
| <if test=" null != type ">and `type` = #{type}</if> | |||
| <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -0,0 +1,80 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxEnergyFeesTimeShopMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyFeesTimeShop"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="period" jdbcType="VARCHAR" property="period"/> | |||
| <result column="time_id" jdbcType="BIGINT" property="timeId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`period`,`time_id`,`shop_id`,`type` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != period and '' != period"> | |||
| and `period` = #{period} | |||
| </if> | |||
| <if test=" null != type ">and `type` = #{type}</if> | |||
| <if test=" null != timeId ">and `time_id` = #{timeId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != shopIds "> | |||
| and shop_id in | |||
| <foreach collection="shopIds" index="index" item="sidItem" open="(" separator="," close=")"> | |||
| #{sidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxEnergyFeesTimeShop" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_fees_time_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findCount" parameterType="com.iformall.domain.po.WxEnergyFeesTimeShop" resultType="Integer"> | |||
| select count(1) | |||
| from wx_energy_fees_time_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_fees_time_shop where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <delete id="deleteByTimeId" parameterType="HashMap"> | |||
| delete from wx_energy_fees_time_shop where `tenant_id` = #{tenantId} and `time_id` = #{timeId} | |||
| </delete> | |||
| <select id="findShopIdList" parameterType="com.iformall.domain.po.WxEnergyFeesTimeShop" resultType="Long"> | |||
| select distinct shop_id | |||
| from wx_energy_fees_time_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -81,20 +81,6 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findBuildingSumMoney" parameterType="com.iformall.domain.po.WxEnergyMeterReading" resultType="hashmap"> | |||
| select building_id, sum((CAST(cur_number AS DECIMAL(20,4)) - CAST(pre_number AS DECIMAL(20,4)))*(CAST(price AS DECIMAL(20,4))) / (CAST(meter_rate AS DECIMAL(20,4)))) as money | |||
| from wx_energy_meter_reading | |||
| <include refid="dynamicWhereConditions"/> | |||
| group by building_id | |||
| </select> | |||
| <select id="findFloorSumMoney" parameterType="com.iformall.domain.po.WxEnergyMeterReading" resultType="hashmap"> | |||
| select floor_id, sum((CAST(cur_number AS DECIMAL(20,4)) - CAST(pre_number AS DECIMAL(20,4)))*(CAST(price AS DECIMAL(20,4))) / (CAST(meter_rate AS DECIMAL(20,4)))) as money | |||
| from wx_energy_meter_reading | |||
| <include refid="dynamicWhereConditions"/> | |||
| group by floor_id | |||
| </select> | |||
| <update id = "setIsDel" parameterType="HashMap"> | |||
| update wx_energy_meter_reading set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||
| </update> | |||
| @@ -11,12 +11,10 @@ | |||
| <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/> | |||
| <result column="update_by" jdbcType="BIGINT" property="updateBy"/> | |||
| <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="time_id" jdbcType="BIGINT" property="timeId"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="period" jdbcType="VARCHAR" property="period"/> | |||
| <result column="fees_id" jdbcType="BIGINT" property="feesId"/> | |||
| <result column="is_calcuted" jdbcType="INTEGER" property="isCalcuted"/> | |||
| <result column="is_imported" jdbcType="INTEGER" property="isImported"/> | |||
| <result column="import_success" jdbcType="INTEGER" property="importSuccess"/> | |||
| <result column="calcute_success" jdbcType="INTEGER" property="calcuteSuccess"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| <result column="shop_size" jdbcType="INTEGER" property="shopSize"/> | |||
| @@ -24,7 +22,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`create_by`,`create_by_name`, | |||
| `update_by`,`update_by_name`,`remark`,`time_id`,`fees_id`,`is_calcuted`,`is_imported`,`import_success`,`calcute_success`,`is_del`,`shop_size` | |||
| `update_by`,`update_by_name`,`remark`,`period`,`fees_id`,`is_calcuted`,`calcute_success`,`is_del`,`shop_size` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -36,14 +34,20 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != period and '' != period"> | |||
| and `period` = #{period} | |||
| </if> | |||
| <if test=" null != createBy ">and `create_by` = #{createBy}</if> | |||
| <if test=" null != timeId ">and `time_id` = #{timeId}</if> | |||
| <if test=" null != feesId ">and `fees_id` = #{feesId}</if> | |||
| <if test=" null != isCalcuted ">and `is_calcuted` = #{isCalcuted}</if> | |||
| <if test=" null != isImported ">and `is_imported` = #{isImported}</if> | |||
| <if test=" null != importSuccess ">and `import_success` = #{importSuccess}</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 "> | |||
| and fees_id in | |||
| <foreach collection="feesIds" index="index" item="fidItem" open="(" separator="," close=")"> | |||
| #{fidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -0,0 +1,58 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxEnergyReadingCalcuteShopMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyReadingCalcuteShop"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||
| <result column="calcute_id" jdbcType="BIGINT" property="calcuteId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`calcute_id`,`shop_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id ">and `id` = #{id}</if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != calcuteId ">and `calcute_id` = #{calcuteId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxEnergyReadingCalcuteShop" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_reading_calcute_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_reading_calcute_shop where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findShopIdList" parameterType="com.iformall.domain.po.WxEnergyReadingCalcuteShop" resultType="Long"> | |||
| select distinct shop_id | |||
| from wx_energy_reading_calcute_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -677,5 +677,10 @@ | |||
| GROUP BY | |||
| `status`; | |||
| </select> | |||
| <select id="findShopNumberList" parameterType="com.iformall.domain.po.WxShop" resultType="String"> | |||
| select shop_number from wx_shop | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||