| @@ -45,6 +45,19 @@ public class WxMallBuildingController extends BaseController { | |||
| } | |||
| return wxMallBuildingService.getBuildingFloorList(wxMallBuilding,this.getUser()); | |||
| } | |||
| @ApiOperation("获取楼层楼座数据") | |||
| @GetMapping("getbuildinglist") | |||
| public ResultData getbuildinglist(WxMallBuilding wxMallBuilding) { | |||
| wxMallBuilding.updateTenantInfo(getTenantInfo()); | |||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||
| if (null != dataRule) { | |||
| wxMallBuilding.setFloorForRule(dataRule.getFloorIds()); | |||
| wxMallBuilding.setBusinessForRule(dataRule.getBussinessIds()); | |||
| wxMallBuilding.setShopTypeForRule(dataRule.getShopTypes()); | |||
| } | |||
| return wxMallBuildingService.getBuildingFloorList(wxMallBuilding,this.getUser()); | |||
| } | |||
| @ApiOperation("保存楼层楼座地图") | |||
| @PostMapping("saveFloorImg") | |||
| @@ -232,6 +232,7 @@ public class WxCouponController extends BaseController { | |||
| CouponCacheUtils.removeOnlyCouponCache(redisTemplate, wxCoupon.getId()); | |||
| CouponCacheUtils.removeOldDetailCache(redisTemplate); | |||
| CouponCacheUtils.removeOldDetailHtmlCache(redisTemplate); | |||
| CouponCacheUtils.removeOldCouponOrderHtmlCache(redisTemplate); | |||
| return new ResultData(); | |||
| } | |||
| @@ -6,13 +6,20 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxEnergyFeesCalcute; | |||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||
| import com.iformall.domain.po.WxEnergyMeter; | |||
| 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.WxMallFloor; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.po.WxUserDataRule; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumEnergyPublicCalcuteRule; | |||
| import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | |||
| @@ -20,6 +27,9 @@ import com.iformall.enums.EnumFeesStandardsTimeUnit; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxEnergyService; | |||
| import com.iformall.service.WxMallFloorService; | |||
| import com.iformall.service.WxShopService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -52,6 +62,12 @@ public class WxEnergyController extends BaseController { | |||
| @Autowired | |||
| private WxEnergyService wxEnergyService; | |||
| @Autowired | |||
| private WxMallFloorService wxMallFloorService; | |||
| @Autowired | |||
| private WxShopService wxShopService; | |||
| @ApiOperation("表类型") | |||
| @GetMapping("meterTypeList") | |||
| public ResultData meterTypeList() { | |||
| @@ -62,6 +78,30 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(retMap); | |||
| } | |||
| @ApiOperation("表分组") | |||
| @GetMapping("meterPhysicsTypeTypeList") | |||
| public ResultData meterPhysicsTypeTypeList() { | |||
| Map<Integer,String> retMap = new HashMap<Integer,String>(); | |||
| for (EnumEnergyMeterPhysicsType mem : EnumEnergyMeterPhysicsType.values()) { | |||
| if (mem != EnumEnergyMeterPhysicsType.SUMMARY) { | |||
| retMap.put(mem.getCode(), mem.getMessage()); | |||
| } | |||
| } | |||
| return new ResultData(retMap); | |||
| } | |||
| @ApiOperation("计算费用的表分组") | |||
| @GetMapping("meterFeesPhysicsTypeTypeList") | |||
| public ResultData meterFeesPhysicsTypeTypeList() { | |||
| Map<Integer,String> retMap = new HashMap<Integer,String>(); | |||
| for (EnumEnergyMeterPhysicsType mem : EnumEnergyMeterPhysicsType.values()) { | |||
| if (mem != EnumEnergyMeterPhysicsType.PUBLIC) { | |||
| retMap.put(mem.getCode(), mem.getMessage()); | |||
| } | |||
| } | |||
| return new ResultData(retMap); | |||
| } | |||
| @ApiOperation("公摊计费规则") | |||
| @GetMapping("publicCalcuteRules") | |||
| public ResultData publicCalcuteRules() { | |||
| @@ -79,19 +119,178 @@ public class WxEnergyController extends BaseController { | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData meterList(@ModelAttribute WxEnergyMeter record, Integer pageNum, Integer pageSize) { | |||
| WxUserDataRule dataRule = this.getCurrentDataFloors(); | |||
| if (null != dataRule) { | |||
| record.setFloorForRule(dataRule.getFloorIds()); | |||
| record.setBusinessForRule(dataRule.getBussinessIds()); | |||
| record.setShopTypeForRule(dataRule.getShopTypes()); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| PageInfo<WxEnergyMeter> page = wxEnergyService.meterListAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("能源表新增修改") | |||
| @ApiOperation("根据楼座查询楼层和能源表") | |||
| @GetMapping("floorAndMeterList") | |||
| public ResultData floorAndMeterList(@ModelAttribute WxEnergyMeter record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxMallFloor> retList = new ArrayList<WxMallFloor>(); | |||
| //根据楼座查询楼层 | |||
| WxMallFloor mfq = new WxMallFloor(); | |||
| mfq.updateTenantInfo(record); | |||
| mfq.setBuildingId(record.getBuilding()); | |||
| PageInfo<WxMallFloor> floorPage = wxMallFloorService.listAsPage(mfq, 1,1000); | |||
| if (null != floorPage && null != floorPage.getList() && floorPage.getList().size() > 0 ) { | |||
| retList.addAll(floorPage.getList()); | |||
| } | |||
| //根据楼错查询关联的公共表 | |||
| WxEnergyMeterShopFloor msf = new WxEnergyMeterShopFloor(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setType(EnumEnergyMeterShopFloorType.BUILDING.getCode()); | |||
| msf.setAliseId(record.getBuilding()); | |||
| List<Long> meterids = wxEnergyService.getMeterIdList(msf); | |||
| if (null != meterids && meterids.size() > 0 ) { | |||
| WxEnergyMeter mq = new WxEnergyMeter(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setIds(meterids); | |||
| List<Integer> ptylist = new ArrayList<Integer>(); | |||
| if (null != record.getIsRealMeter() && EnumYesOrNo.YES.getCode() == record.getIsRealMeter()) { | |||
| ptylist.add(EnumEnergyMeterPhysicsType.PUBLIC.getCode()); | |||
| ptylist.add(EnumEnergyMeterPhysicsType.USER.getCode()); | |||
| }else { | |||
| ptylist.add(EnumEnergyMeterPhysicsType.SUMMARY.getCode()); | |||
| } | |||
| mq.setPhysicsTypeList(ptylist); | |||
| PageInfo<WxEnergyMeter> page = wxEnergyService.meterListAsPage(mq,1,1000); | |||
| if (null != page && null != page.getList()) { | |||
| for (int i = 0 ; i < page.getList().size() ; i ++) { | |||
| WxEnergyMeter m = page.getList().get(i); | |||
| WxMallFloor f = new WxMallFloor(); | |||
| f.setId(m.getId()); | |||
| f.setBuildingId(record.getBuilding()); | |||
| f.setFloorName(m.getName()); | |||
| f.setTreeType(m.getTreeType()); | |||
| retList.add(f); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(retList); | |||
| } | |||
| @ApiOperation("根据楼层查询能源表和店铺") | |||
| @GetMapping("floorMeterList") | |||
| public ResultData shopAndMeterList(@ModelAttribute WxEnergyMeter record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxShop> retList = new ArrayList<WxShop>(); | |||
| if (null != record.getHasShop() && record.getHasShop() == EnumYesOrNo.YES.getCode()) { | |||
| //根据楼座查询楼层 | |||
| WxShop mfq = new WxShop(); | |||
| mfq.updateTenantInfo(record); | |||
| mfq.setFloor(record.getFloor()); | |||
| PageInfo<WxShop> floorPage = wxShopService.listAsPage(mfq, 1,1000); | |||
| if (null != floorPage && null != floorPage.getList() && floorPage.getList().size() > 0 ) { | |||
| retList.addAll(floorPage.getList()); | |||
| } | |||
| } | |||
| //根据楼错查询关联的公共表 | |||
| WxEnergyMeterShopFloor msf = new WxEnergyMeterShopFloor(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setType(EnumEnergyMeterShopFloorType.FLOOR.getCode()); | |||
| msf.setAliseId(record.getFloor()); | |||
| List<Long> meterids = wxEnergyService.getMeterIdList(msf); | |||
| if (null != meterids && meterids.size() > 0 ) { | |||
| WxEnergyMeter mq = new WxEnergyMeter(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setIds(meterids); | |||
| List<Integer> ptylist = new ArrayList<Integer>(); | |||
| if (null != record.getIsRealMeter() && EnumYesOrNo.YES.getCode() == record.getIsRealMeter()) { | |||
| ptylist.add(EnumEnergyMeterPhysicsType.PUBLIC.getCode()); | |||
| ptylist.add(EnumEnergyMeterPhysicsType.USER.getCode()); | |||
| }else { | |||
| ptylist.add(EnumEnergyMeterPhysicsType.SUMMARY.getCode()); | |||
| } | |||
| mq.setPhysicsTypeList(ptylist); | |||
| PageInfo<WxEnergyMeter> page = wxEnergyService.meterListAsPage(mq,1,1000); | |||
| if (null == page || null == page.getList() ) { | |||
| return new ResultData(); | |||
| } | |||
| List<WxEnergyMeter> list = page.getList(); | |||
| for (int i = 0 ; i < list.size() ; i ++) { | |||
| WxEnergyMeter meter = list.get(i); | |||
| WxShop s = new WxShop(); | |||
| s.setId(meter.getId()); | |||
| s.setShopNumber(meter.getName()); | |||
| s.setTreeParentId(record.getFloor()); | |||
| s.setTreeParentType("floor"); | |||
| retList.add(s); | |||
| } | |||
| return new ResultData(retList); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据店铺查询能源表") | |||
| @GetMapping("shopMeterList") | |||
| public ResultData shopMeterList(@ModelAttribute WxEnergyMeter record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<WxShop> retList = new ArrayList<WxShop>(); | |||
| //根据楼错查询关联的公共表 | |||
| WxEnergyMeterShopFloor msf = new WxEnergyMeterShopFloor(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setType(EnumEnergyMeterShopFloorType.SHOP.getCode()); | |||
| msf.setAliseId(record.getShopId()); | |||
| List<Long> meterids = wxEnergyService.getMeterIdList(msf); | |||
| if (null != meterids && meterids.size() > 0 ) { | |||
| WxEnergyMeter mq = new WxEnergyMeter(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setIds(meterids); | |||
| List<Integer> ptylist = new ArrayList<Integer>(); | |||
| if (null != record.getIsRealMeter() && EnumYesOrNo.YES.getCode() == record.getIsRealMeter()) { | |||
| ptylist.add(EnumEnergyMeterPhysicsType.PUBLIC.getCode()); | |||
| ptylist.add(EnumEnergyMeterPhysicsType.USER.getCode()); | |||
| }else { | |||
| ptylist.add(EnumEnergyMeterPhysicsType.SUMMARY.getCode()); | |||
| } | |||
| mq.setPhysicsTypeList(ptylist); | |||
| PageInfo<WxEnergyMeter> page = wxEnergyService.meterListAsPage(mq,1,1000); | |||
| if (null == page || null == page.getList() ) { | |||
| return new ResultData(); | |||
| } | |||
| List<WxEnergyMeter> list = page.getList(); | |||
| for (int i = 0 ; i < list.size() ; i ++) { | |||
| WxEnergyMeter meter = list.get(i); | |||
| WxShop s = new WxShop(); | |||
| s.setId(meter.getId()); | |||
| s.setShopNumber(meter.getName()); | |||
| s.setTreeParentId(record.getShopId()); | |||
| s.setTreeParentType("shop"); | |||
| retList.add(s); | |||
| } | |||
| return new ResultData(retList); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据子表") | |||
| @GetMapping("childMeterList") | |||
| public ResultData childMeterList(@ModelAttribute WxEnergyMeterChild record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| List<Long> meterids = wxEnergyService.getChildMeterIdList(record); | |||
| if (null != meterids && meterids.size() > 0 ) { | |||
| WxEnergyMeter mq = new WxEnergyMeter(); | |||
| mq.updateTenantInfo(record); | |||
| mq.setIds(meterids); | |||
| PageInfo<WxEnergyMeter> page = wxEnergyService.meterListAsPage(mq,1,1000); | |||
| if (null == page || null == page.getList() ) { | |||
| return new ResultData(); | |||
| } | |||
| List<WxEnergyMeter> list = page.getList(); | |||
| for (int i = 0 ; i < list.size() ; i ++) { | |||
| WxEnergyMeter meter = list.get(i); | |||
| meter.setTreeParentId(record.getParentMeterId()); | |||
| meter.setTreeParentType("meter"); | |||
| } | |||
| return new ResultData(list); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("用户能源表新增修改") | |||
| @PostMapping("saveMeter") | |||
| public ResultData saveMeter(@RequestBody WxEnergyMeter record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| @@ -99,49 +298,106 @@ public class WxEnergyController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("meterUpdateIsDel") | |||
| public ResultData meterUpdateIsDel(@RequestBody WxEnergyMeter record) { | |||
| @ApiOperation("用户能源表新增修改") | |||
| @PostMapping("aliasMeter") | |||
| public ResultData aliasMeter(@RequestBody WxEnergyMeterShopFloor record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxEnergyService.updateMeterIsDel(record); | |||
| wxEnergyService.createMeterAlias(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("能源表关联店铺") | |||
| @PostMapping("setMeterShop") | |||
| public ResultData setMeterShop(@RequestBody WxEnergyMeter record) { | |||
| @ApiOperation("用户能源表新增修改") | |||
| @PostMapping("aliasChildMeter") | |||
| public ResultData aliasChildMeter(@RequestBody WxEnergyMeterChild record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| if (null == record.getId() || null == record.getShopId()) { | |||
| return new ResultData(Result.ERROR,"参数错误"); | |||
| } | |||
| WxEnergyMeter meter = wxEnergyService.getMeterById(record, record.getId()); | |||
| if (null == meter) { | |||
| return new ResultData(Result.ERROR,"能源表未查询到"); | |||
| WxEnergyMeter meter = wxEnergyService.getMeterById(record, record.getParentMeterId()); | |||
| if (null == meter || meter.getPhysicsType() != EnumEnergyMeterPhysicsType.SUMMARY.getCode()) { | |||
| return new ResultData(Result.ERROR,"该节点不能绑定子表"); | |||
| } | |||
| if (meter.getIsPublic().intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| return new ResultData(Result.ERROR,"总表不能关联店铺"); | |||
| wxEnergyService.createChildMeterAlias(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("用户能源表新增修改") | |||
| @PostMapping("deleteAliasMeter") | |||
| public ResultData deleteAliasMeter(@RequestBody WxEnergyMeterShopFloor record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| if (null == record.getId()) { | |||
| return new ResultData(Result.ERROR,"请选择一个"); | |||
| } | |||
| wxEnergyService.setMeterShop(record); | |||
| wxEnergyService.deleteMeterAlias(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("能源表关联楼层") | |||
| @PostMapping("setMeterFloor") | |||
| public ResultData setMeterFloor(@RequestBody WxEnergyMeter record) { | |||
| @ApiOperation("用户能源表新增修改") | |||
| @PostMapping("deleteChildMeter") | |||
| public ResultData deleteChildMeter(@RequestBody WxEnergyMeterChild record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| if (null == record.getId() || null == record.getFloorId()) { | |||
| return new ResultData(Result.ERROR,"参数错误"); | |||
| if (null == record.getId()) { | |||
| return new ResultData(Result.ERROR,"请选择一个关联"); | |||
| } | |||
| WxEnergyMeter meter = wxEnergyService.getMeterById(record, record.getId()); | |||
| if (null == meter) { | |||
| return new ResultData(Result.ERROR,"能源表未查询到"); | |||
| wxEnergyService.deleteChildMeterAlias(record); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("meterUpdateIsDel") | |||
| public ResultData meterUpdateIsDel(@RequestBody WxEnergyMeter record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxEnergyService.updateMeterIsDel(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("店铺费用列表") | |||
| @GetMapping("feesCalcuteList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData shopFeesList(@ModelAttribute WxEnergyFeesCalcute record, Integer pageNum, Integer pageSize) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| if (StringUtils.isNotBlank(record.getFeesIdsStr())) { | |||
| String[] fss = record.getFeesIdsStr().split(","); | |||
| if (null != fss && fss.length > 0 ) { | |||
| List<Long> feesIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < fss.length ; i ++) { | |||
| feesIdList.add(Long.parseLong(fss[i])); | |||
| } | |||
| record.setFeesIds(feesIdList); | |||
| } | |||
| } | |||
| if (meter.getIsPublic().intValue() == EnumYesOrNo.NO.getCode().intValue()) { | |||
| return new ResultData(Result.ERROR,"用户表不能关联楼层"); | |||
| PageInfo<WxEnergyFeesCalcute> list = wxEnergyService.shopFeesListAsPage(record,pageNum,pageSize); | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("计算公式组件") | |||
| @GetMapping("feesCalcuteComponentList") | |||
| public ResultData shopFeesList(@ModelAttribute WxEnergyFeesCalcute record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| if (StringUtils.isNotBlank(record.getFeesIdsStr())) { | |||
| String[] fss = record.getFeesIdsStr().split(","); | |||
| if (null != fss && fss.length > 0 ) { | |||
| List<Long> feesIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < fss.length ; i ++) { | |||
| feesIdList.add(Long.parseLong(fss[i])); | |||
| } | |||
| record.setFeesIds(feesIdList); | |||
| } | |||
| } | |||
| wxEnergyService.setMeterFloor(record); | |||
| PageInfo<WxEnergyFeesCalcute> list = wxEnergyService.shopFeesListAsPage(record,pageNum,pageSize); | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("用户能源表新增修改") | |||
| @PostMapping("saveFeesCalcute") | |||
| public ResultData saveFeesCalcute(@RequestBody WxEnergyFeesCalcute record) { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxEnergyService.createMeterAlias(record); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("费用区间列表") | |||
| @GetMapping("timeList") | |||
| @ApiImplicitParams({ | |||
| @@ -0,0 +1,54 @@ | |||
| alter table wx_energy_meter drop COLUMN floor_id; | |||
| alter table wx_energy_meter drop COLUMN shop_id; | |||
| alter table wx_energy_meter drop COLUMN building_id; | |||
| alter table wx_energy_meter drop COLUMN is_public; | |||
| ALTER TABLE wx_energy_meter ADD COLUMN physics_type INT(1) NOT NULL COMMENT '表物理类型'; | |||
| CREATE TABLE `wx_energy_meter_shop_floor` ( | |||
| `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, | |||
| `type` int(3) NOT NULL COMMENT '表类型', | |||
| `meter_id` bigint(20) NOT NULL COMMENT '表编号', | |||
| `alise_id` bigint(20) NOT NULL COMMENT '关联的id', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`), | |||
| UNIQUE KEY `T_T_M_A` (`tenant_id`,`type`,`meter_id`,`alise_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| CREATE TABLE `wx_energy_meter_child` ( | |||
| `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, | |||
| `parent_meter_id` bigint(20) NOT NULL COMMENT '表编号', | |||
| `child_meter_id` bigint(20) NOT NULL COMMENT '关联的id', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`), | |||
| UNIQUE KEY `P_C` (`parent_meter_id`,`child_meter_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| CREATE TABLE `wx_energy_fees_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, | |||
| `fees_id` bigint(20) NOT NULL COMMENT '科目', | |||
| `price` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '价格', | |||
| `physics_type` int(1) NOT NULL COMMENT '用户表,公摊总表', | |||
| `formula` text COLLATE utf8mb4_unicode_ci COMMENT '计算公式', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `id_UNIQUE` (`id`), | |||
| UNIQUE KEY `T_F` (`tenant_id`,`fees_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.dto; | |||
| import java.util.List; | |||
| import com.iformall.enums.EnumEnergyMeterShopFloorType; | |||
| import lombok.Data; | |||
| /** | |||
| */ | |||
| @Data | |||
| public class FloorBuildingIdDTO { | |||
| private EnumEnergyMeterShopFloorType type; | |||
| private List<Long> ids; | |||
| } | |||
| @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumContractReceivePeriodUnit; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumEnergyPublicCalcuteRule; | |||
| import com.iformall.enums.EnumFeesStandardsCalcuteUnit; | |||
| import com.iformall.enums.EnumFeesStandardsTimeUnit; | |||
| @@ -71,6 +72,14 @@ public class WxEnergyFees extends TenantEntity { | |||
| @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 = "所属账单类型EnumBillAllType", name = "billType") | |||
| private Integer billType; | |||
| @@ -0,0 +1,77 @@ | |||
| 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.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_energy_fees_calcute") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxEnergyFeesCalcute 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="feesId") | |||
| private Long feesId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "表分组EnumEnergyMeterPhysicsType", name = "physicsType") | |||
| private Integer physicsType; | |||
| @TableField(exist = false) | |||
| private String physicsTypeName; | |||
| public String getPhysicsTypeName() { | |||
| if (null != physicsType) { | |||
| return EnumEnergyMeterPhysicsType.getEnum(physicsType).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "单价", name = "price") | |||
| private String price; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺编号", name = "shopId") | |||
| private Long shopId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "公摊计算公司", name = "formula") | |||
| private String formula; | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| @TableField(exist = false) | |||
| private List<Long> feesIds; | |||
| @TableField(exist = false) | |||
| private String feesName; | |||
| @TableField(exist = false) | |||
| private Integer feesType; | |||
| @TableField(exist = false) | |||
| private String feesTypeName; | |||
| @TableField(exist = false) | |||
| private String fixedPriceName; | |||
| @TableField(exist = false) | |||
| private String calcuteUnitName; | |||
| @TableField(exist = false) | |||
| private String timeUnitName; | |||
| @TableField(exist = false) | |||
| private String feesIdsStr; | |||
| } | |||
| @@ -3,7 +3,9 @@ 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.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -47,32 +49,54 @@ public class WxEnergyMeter extends TenantEntity { | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="倍率",name="rate") | |||
| private String rate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否总表", name = "isPublic") | |||
| private Integer isPublic; | |||
| @io.swagger.annotations.ApiModelProperty(value = "表分组EnumEnergyMeterPhysicsType", name = "physicsType") | |||
| private Integer physicsType; | |||
| @TableField(exist = false) | |||
| private String physicsTypeName; | |||
| public String getPhysicsTypeName() { | |||
| if (null != physicsType) { | |||
| return EnumEnergyMeterPhysicsType.getEnum(physicsType).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺类型EnumRentShopType", name = "shopType") | |||
| private Integer shopType; | |||
| @io.swagger.annotations.ApiModelProperty(value = "楼栋ID", name = "buildingId") | |||
| private Long buildingId; | |||
| @TableField(exist = false) | |||
| private String buildingName; | |||
| private String shopTypeName; | |||
| public String getShopTypeName() { | |||
| if (null != shopType) { | |||
| return EnumRentShopType.getEnum(shopType).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "楼层ID", name = "floorId") | |||
| private Long floorId; | |||
| @TableField(exist = false) | |||
| private String floorName; | |||
| private String treeType="meter"; | |||
| @TableField(exist = false) | |||
| private Long treeParentId; | |||
| @TableField(exist = false) | |||
| private String treeParentType; | |||
| @io.swagger.annotations.ApiModelProperty(value = "店铺", name = "shopId") | |||
| @TableField(exist = false) | |||
| private Long aliasId; | |||
| @TableField(exist = false) | |||
| private Integer aliasType; | |||
| @TableField(exist = false) | |||
| private Long building; | |||
| @TableField(exist = false) | |||
| private Long floor; | |||
| @TableField(exist = false) | |||
| private Long shopId; | |||
| @TableField(exist = false) | |||
| private String shopNumber; | |||
| private List<Integer> physicsTypeList; | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| private Integer isRealMeter; | |||
| @TableField(exist = false) | |||
| private Integer isValid; | |||
| @TableField(exist = false) | |||
| private Integer hasShop; | |||
| } | |||
| @@ -0,0 +1,47 @@ | |||
| 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.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_energy_meter_child") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxEnergyMeterChild 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="parentMeterId") | |||
| private Long parentMeterId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "关联的编号", name = "childMeterId") | |||
| private Long childMeterId; | |||
| @TableField(exist = false) | |||
| private List<Long> childMeterIdList; | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| 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.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumEnergyMeterType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| @TableName(value = "wx_energy_meter_shop_floor") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxEnergyMeterShopFloor 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 = "表类型EnumEnergyMeterShopFloorType", name = "type") | |||
| private Integer type; | |||
| @TableField(exist = false) | |||
| private String typeName; | |||
| public String getTypeName() { | |||
| if (null != type) { | |||
| return EnumEnergyMeterShopFloorType.getEnum(type).getMessage(); | |||
| } | |||
| return null; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="表编号",name="meterId") | |||
| private Long meterId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "关联的编号", name = "aliseId") | |||
| private Long aliseId; | |||
| @TableField(exist = false) | |||
| private List<Long> shopIds; | |||
| @TableField(exist = false) | |||
| private List<Long> floorIds; | |||
| @TableField(exist = false) | |||
| private List<Long> buildingIds; | |||
| @TableField(exist = false) | |||
| private Integer physicsType; | |||
| @TableField(exist = false) | |||
| private List<Integer> typeList; | |||
| @TableField(exist = false) | |||
| private Long parentId; | |||
| @TableField(exist = false) | |||
| private String parentType; | |||
| } | |||
| @@ -33,6 +33,12 @@ public class WxMallBuilding extends TenantEntity { | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @TableField(exist = false) | |||
| private String treeType="building"; | |||
| @TableField(exist = false) | |||
| private Long treeParentId = 0L; | |||
| @TableField(exist = false) | |||
| private String treeParentType=""; | |||
| public void setBuildingName(String buildingName){ | |||
| this.buildingName = buildingName; | |||
| @@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -39,6 +40,17 @@ public class WxMallFloor extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="地图",name="floorMap") | |||
| private String floorMap; | |||
| @TableField(exist = false) | |||
| private String treeType="floor"; | |||
| @TableField(exist = false) | |||
| private Long treeParentId; | |||
| public Long getTreeParentId() { | |||
| treeParentId = this.getBuildingId(); | |||
| return treeParentId; | |||
| } | |||
| @TableField(exist = false) | |||
| private String treeParentType="building"; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="") | |||
| @@ -53,4 +65,6 @@ public class WxMallFloor extends TenantEntity { | |||
| return floorMaps; | |||
| } | |||
| @TableField(exist = false) | |||
| private List<Long> buildingIdList; | |||
| } | |||
| @@ -149,6 +149,14 @@ public class WxShop extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "租金单位", name = "rentUnit") | |||
| private Integer rentUnit; | |||
| @io.swagger.annotations.ApiModelProperty(value = "树里面的类型", name = "treeType") | |||
| @TableField(exist = false) | |||
| private String treeType = "shop"; | |||
| @TableField(exist = false) | |||
| private Long treeParentId; | |||
| @TableField(exist = false) | |||
| private String treeParentType="floor"; | |||
| @TableField(exist = false) | |||
| private Integer rent_unit; | |||
| @@ -18,7 +18,8 @@ public enum EnumCacheKey { | |||
| COUPON_CHANNEL_STOCK(7, "couponChannelStock:couponChannelStock_"), | |||
| DOUYIN_LIVE_PAGE_LIST(8,"douyinLiveList"), | |||
| OLD_DETAIL(9,"cc:"), | |||
| OLD_DETAIL_HTML(10,"ch:") | |||
| OLD_DETAIL_HTML(10,"ch:"), | |||
| OLD_COUPORDER_HTML(11,"cd:") | |||
| ; | |||
| private static Map<Integer,EnumCacheKey> map = new HashMap<Integer,EnumCacheKey>(); | |||
| static { | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| */ | |||
| public enum EnumEnergyMeterPhysicsType { | |||
| USER(1,"用户表"), | |||
| PUBLIC(2,"公共表"), | |||
| SUMMARY(3, "分摊总表"), | |||
| ; | |||
| public static EnumEnergyMeterPhysicsType getEnum(Integer code) { | |||
| for (EnumEnergyMeterPhysicsType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumEnergyMeterPhysicsType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| */ | |||
| public enum EnumEnergyMeterShopFloorType { | |||
| SHOP(1,"店铺"), | |||
| FLOOR(2,"楼层"), | |||
| BUILDING(3, "楼座"), | |||
| ; | |||
| public static EnumEnergyMeterShopFloorType getEnum(Integer code) { | |||
| for (EnumEnergyMeterShopFloorType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumEnergyMeterShopFloorType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxEnergyFeesCalcute; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxEnergyFeesCalcuteMapper extends CommonMapper<WxEnergyFeesCalcute, Long> { | |||
| List<WxEnergyFeesCalcute> findList(WxEnergyFeesCalcute wxBillRent); | |||
| List<Long> findFeesIdList(WxEnergyFeesCalcute wxBillRent); | |||
| WxEnergyFeesCalcute selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxEnergyMeterChild; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxEnergyMeterChildMapper extends CommonMapper<WxEnergyMeterChild, Long> { | |||
| List<WxEnergyMeterChild> findList(WxEnergyMeterChild wxBillRent); | |||
| WxEnergyMeterChild selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<Long> findChildMeterIdList(WxEnergyMeterChild wxBillRent); | |||
| void deleteByCondition(WxEnergyMeterChild wxBillRent); | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxEnergyMeterShopFloor; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| */ | |||
| public interface WxEnergyMeterShopFloorMapper extends CommonMapper<WxEnergyMeterShopFloor, Long> { | |||
| List<WxEnergyMeterShopFloor> findList(WxEnergyMeterShopFloor wxBillRent); | |||
| WxEnergyMeterShopFloor selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<Long> findAliasIdList(WxEnergyMeterShopFloor wxBillRent); | |||
| List<Long> findMeterIdList(WxEnergyMeterShopFloor wxBillRent); | |||
| void deleteByConditon(WxEnergyMeterShopFloor wxBillRent); | |||
| } | |||
| @@ -9,6 +9,7 @@ public interface WxMallBuildingMapper extends CommonMapper<WxMallBuilding, Strin | |||
| List<WxMallBuilding> findList(WxMallBuilding wxMallBuilding); | |||
| List<Long> findIdList(WxMallBuilding wxMallBuilding); | |||
| void deleteByTenantId(String tenantId); | |||
| @@ -9,6 +9,8 @@ import java.util.Map; | |||
| public interface WxMallFloorMapper extends CommonMapper<WxMallFloor, String> { | |||
| List<WxMallFloor> findList(WxMallFloor wxMallFloor); | |||
| List<Long> getFloorIds(WxMallFloor wxMallFloor); | |||
| int deleteByBuildingId(Long buildingId); | |||
| @@ -13,9 +13,12 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxEnergyFeesSetoff; | |||
| import com.iformall.domain.po.WxEnergyFeesCalcute; | |||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||
| import com.iformall.domain.po.WxEnergyMeter; | |||
| 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.base.TenantEntity; | |||
| /** | |||
| @@ -26,10 +29,15 @@ public interface WxEnergyService { | |||
| PageInfo<WxEnergyMeter> meterListAsPage(WxEnergyMeter record, Integer pageIndex, Integer pageSize); | |||
| WxEnergyMeter getMeterById(TenantEntity tenantEntity,Long id); | |||
| void saveOrUpdateMeter(WxEnergyMeter record); | |||
| void createMeterAlias(WxEnergyMeterShopFloor record); | |||
| void createChildMeterAlias(WxEnergyMeterChild record); | |||
| void deleteMeterAlias(WxEnergyMeterShopFloor record); | |||
| void deleteChildMeterAlias(WxEnergyMeterChild record); | |||
| void updateMeterIsDel(WxEnergyMeter record); | |||
| Map<Long,WxEnergyMeter> getMeterMap(WxEnergyMeter record); | |||
| void setMeterShop(WxEnergyMeter record); | |||
| void setMeterFloor(WxEnergyMeter record); | |||
| List<Long> getMeterIdList(WxEnergyMeterShopFloor record); | |||
| List<Long> getChildMeterIdList(WxEnergyMeterChild record); | |||
| //费用区间 | |||
| PageInfo<WxEnergyFeesTime> timeListAsPage(WxEnergyFeesTime record, Integer pageIndex, Integer pageSize); | |||
| @@ -40,6 +48,9 @@ public interface WxEnergyService { | |||
| //费用科目 | |||
| PageInfo<WxEnergyFees> feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize,boolean isSetOff); | |||
| PageInfo<WxEnergyFeesCalcute> feesCalcuteListAsPage(WxEnergyFeesCalcute record, Integer pageIndex, Integer pageSize); | |||
| List<Map> getFeesCalcuteComponentList(WxEnergyFeesCalcute record); | |||
| void createShopFees(WxEnergyFeesCalcute record); | |||
| void saveOrUpdateFees(WxEnergyFees record); | |||
| WxEnergyFees getFeesById(WxEnergyFees record); | |||
| void setFeesIsDel(WxEnergyFees record); | |||
| @@ -8,6 +8,7 @@ import com.iformall.domain.po.WxMallBuilding; | |||
| import com.iformall.domain.po.WxMallFloor; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxMallBuildingService { | |||
| @@ -56,6 +57,8 @@ public interface WxMallBuildingService { | |||
| ResultData getBuildingList(TenantEntity tenantEntity); | |||
| ResultData getBuildingFloorList(WxMallBuilding wxMallBuilding,MallUserInfo mallUser); | |||
| ResultData getBuildingList(WxMallBuilding wxMallBuilding,MallUserInfo mallUser); | |||
| /** | |||
| * 新增楼层楼座 | |||
| @@ -76,4 +79,6 @@ public interface WxMallBuildingService { | |||
| void saveFloorImg(WxMallFloor floor); | |||
| Map<Long, String> getBuildingMap(TenantEntity tenantInfo); | |||
| List<Long> getBuildingIdList(WxMallBuilding wxMallBuilding); | |||
| } | |||
| @@ -5,6 +5,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMallFloor; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxMallFloorService { | |||
| @@ -43,6 +44,8 @@ public interface WxMallFloorService { | |||
| ResultData getFloorList(TenantEntity tenantEntity, Long buildingId); | |||
| List<Long> getFloorIdList(WxMallFloor record); | |||
| void deleteByBuildingId(Long buildingId); | |||
| @@ -7,9 +7,12 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.domain.dto.FloorBuildingIdDTO; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumEnergyMeterPhysicsType; | |||
| import com.iformall.enums.EnumEnergyMeterShopFloorType; | |||
| import com.iformall.enums.EnumEnergyPublicCalcuteRule; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -45,6 +48,12 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Autowired | |||
| WxEnergyMeterMapper wxEnergyMeterMapper; | |||
| @Autowired | |||
| WxEnergyMeterShopFloorMapper wxEnergyMeterShopFloorMapper; | |||
| @Autowired | |||
| WxEnergyMeterChildMapper wxEnergyMeterChildMapper; | |||
| @Autowired | |||
| WxEnergyFeesCalcuteMapper wxEnergyFeesCalcuteMapper; | |||
| @Autowired | |||
| WxEnergyMeterReadingMapper wxEnergyMeterReadingMapper; | |||
| @Autowired | |||
| WxEnergyFeesTimeMapper wxEnergyFeesTimeMapper; | |||
| @@ -81,43 +90,19 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| @Override | |||
| public PageInfo<WxEnergyMeter> meterListAsPage(WxEnergyMeter record, Integer pageIndex, Integer pageSize) { | |||
| String shopNumber = StringUtils.trimToNull(record.getShopNumber()); | |||
| if (StringUtils.isNotBlank(shopNumber)) { | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| sq.setShopNumber(shopNumber); | |||
| List<Long> shopIds = wxShopService.getShopIds(sq); | |||
| if (null == shopIds || shopIds.size() <= 0) { | |||
| if (null != record.getAliasId()) { | |||
| WxEnergyMeterShopFloor msf = new WxEnergyMeterShopFloor(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setType(record.getAliasType()); | |||
| msf.setAliseId(record.getAliasId()); | |||
| List<Long> aliseIdList = wxEnergyMeterShopFloorMapper.findAliasIdList(msf); | |||
| if (null == aliseIdList || aliseIdList.size() <= 0 ) { | |||
| record.setId(-1L); | |||
| }else { | |||
| record.setShopIds(shopIds); | |||
| record.setIds(aliseIdList); | |||
| } | |||
| } | |||
| PageInfo<WxEnergyMeter> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyMeterMapper.findList(record)); | |||
| if (null != page && null != page.getList()) { | |||
| WxShop sq = new WxShop(); | |||
| sq.updateTenantInfo(record); | |||
| Map<Long, WxShop> shopMap = wxShopService.findShopMap(sq); | |||
| Map<Long, String> buildingMap = wxMallBuildingService.getBuildingMap(record); | |||
| Map<Long, String> floorMap = wxMallFloorService.getFloorMap(record); | |||
| for (int i = 0 ; i < page.getList().size(); i++) { | |||
| WxEnergyMeter m = page.getList().get(i); | |||
| if (null != shopMap && null != m.getShopId()) { | |||
| WxShop shop = shopMap.get(m.getShopId()); | |||
| if (null != shop) { | |||
| m.setShopNumber(shop.getShopNumber()); | |||
| } | |||
| } | |||
| if (null != buildingMap && null != m.getBuildingId()) { | |||
| String buildingName = buildingMap.get(m.getBuildingId()); | |||
| m.setBuildingName(buildingName); | |||
| } | |||
| if (null != floorMap && null != m.getFloorId()) { | |||
| String floorName = floorMap.get(m.getFloorId()); | |||
| m.setFloorName(floorName); | |||
| } | |||
| } | |||
| } | |||
| return page; | |||
| } | |||
| @@ -145,6 +130,99 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| wxEnergyMeterMapper.updateById(record); | |||
| } | |||
| } | |||
| private FloorBuildingIdDTO getFloorBuildingIds(TenantEntity tenantEntity,List<Long> floorIds,List<Long> buildingIds) { | |||
| //如果楼层是全选了的,则代表的是楼座。 | |||
| //根据楼座id查询楼层 | |||
| WxMallFloor fq = new WxMallFloor(); | |||
| fq.updateTenantInfo(tenantEntity); | |||
| fq.setBuildingIdList(buildingIds); | |||
| List<Long> bfloorIds = wxMallFloorService.getFloorIdList(fq); | |||
| if (null == bfloorIds || bfloorIds.size() != floorIds.size() || (!floorIds.containsAll(bfloorIds))) { | |||
| FloorBuildingIdDTO dto = new FloorBuildingIdDTO(); | |||
| dto.setType(EnumEnergyMeterShopFloorType.FLOOR); | |||
| dto.setIds(floorIds); | |||
| return dto; | |||
| }else { | |||
| FloorBuildingIdDTO dto = new FloorBuildingIdDTO(); | |||
| dto.setType(EnumEnergyMeterShopFloorType.BUILDING); | |||
| dto.setIds(buildingIds); | |||
| return dto; | |||
| } | |||
| } | |||
| @Override | |||
| public void createMeterAlias(WxEnergyMeterShopFloor record) { | |||
| //新增关联 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Date date = new Date(); | |||
| List<Long> aliasIds = null; | |||
| if (record.getPhysicsType() == EnumEnergyMeterPhysicsType.USER.getCode()) { | |||
| record.setType(EnumEnergyMeterShopFloorType.SHOP.getCode()); | |||
| aliasIds = record.getShopIds(); | |||
| if (null == aliasIds || aliasIds.size() <= 0 ) { | |||
| 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(); | |||
| List<Long> buildindIds = record.getBuildingIds(); | |||
| FloorBuildingIdDTO dto = getFloorBuildingIds(record, floorIds, buildindIds); | |||
| record.setType(dto.getType().getCode()); | |||
| aliasIds = record.getIds(); | |||
| if (null == aliasIds || aliasIds.size() <= 0 ) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择有效的楼层楼座"); | |||
| } | |||
| } | |||
| for (int i = 0 ; i < aliasIds.size(); i ++) { | |||
| Long shopId = aliasIds.get(i); | |||
| WxEnergyMeterShopFloor msf = new WxEnergyMeterShopFloor(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setId(idWorker.nextId()); | |||
| msf.setCreateTime(date); | |||
| msf.setUpdateTime(date); | |||
| msf.setMeterId(record.getMeterId()); | |||
| msf.setType(record.getType()); | |||
| msf.setAliseId(shopId); | |||
| wxEnergyMeterShopFloorMapper.insert(msf); | |||
| } | |||
| } | |||
| @Override | |||
| public void createChildMeterAlias(WxEnergyMeterChild record) { | |||
| //新增关联 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Date date = new Date(); | |||
| for (int i = 0 ; i < record.getChildMeterIdList().size(); i ++) { | |||
| Long childMeterId = record.getChildMeterIdList().get(i); | |||
| WxEnergyMeterChild msf = new WxEnergyMeterChild(); | |||
| msf.updateTenantInfo(record); | |||
| msf.setId(idWorker.nextId()); | |||
| msf.setCreateTime(date); | |||
| msf.setUpdateTime(date); | |||
| msf.setParentMeterId(record.getParentMeterId()); | |||
| msf.setChildMeterId(childMeterId); | |||
| wxEnergyMeterChildMapper.insert(msf); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteMeterAlias(WxEnergyMeterShopFloor record) { | |||
| if ("floor".equals(record.getParentType())) { | |||
| record.setType(EnumEnergyMeterShopFloorType.FLOOR.getCode()); | |||
| }else if ("building".equals(record.getParentType())) { | |||
| record.setType(EnumEnergyMeterShopFloorType.BUILDING.getCode()); | |||
| }else if ("shop".equals(record.getParentType())) { | |||
| record.setType(EnumEnergyMeterShopFloorType.SHOP.getCode()); | |||
| } | |||
| record.setMeterId(record.getId()); | |||
| record.setAliseId(record.getParentId()); | |||
| wxEnergyMeterShopFloorMapper.deleteByConditon(record); | |||
| } | |||
| @Override | |||
| public void deleteChildMeterAlias(WxEnergyMeterChild record) { | |||
| wxEnergyMeterChildMapper.deleteByCondition(record); | |||
| } | |||
| @Override | |||
| public void updateMeterIsDel(WxEnergyMeter record) { | |||
| @@ -165,34 +243,16 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| return null; | |||
| } | |||
| @Override | |||
| public void setMeterShop(WxEnergyMeter record) { | |||
| WxShop shop = wxShopService.getById(record.getShopId()); | |||
| record.setShopId(shop.getId()); | |||
| record.setBuildingId(shop.getBuilding()); | |||
| record.setFloorId(shop.getFloor()); | |||
| record.setUpdateTime(new Date()); | |||
| wxEnergyMeterMapper.updateById(record); | |||
| public List<Long> getMeterIdList(WxEnergyMeterShopFloor record) { | |||
| return wxEnergyMeterShopFloorMapper.findMeterIdList(record); | |||
| } | |||
| @Override | |||
| public void setMeterFloor(WxEnergyMeter record) { | |||
| WxMallFloor floor = wxMallFloorService.getById(record.getFloorId()); | |||
| // record.setBuildingId(floor.getBuildingId()); | |||
| // record.setFloorId(floor.getId()); | |||
| // record.setUpdateTime(new Date()); | |||
| // record.setShopId(null); | |||
| // wxEnergyMeterMapper.updateById(record); | |||
| //属性为空如何处理 | |||
| wxEnergyMeterMapper.update(record, new UpdateWrapper<WxEnergyMeter>().lambda().eq(WxEnergyMeter::getId, record.getId()) | |||
| .set(WxEnergyMeter::getShopId, null) | |||
| .set(WxEnergyMeter::getBuildingId, floor.getBuildingId()) | |||
| .set(WxEnergyMeter::getFloorId, floor.getId()) | |||
| .set(WxEnergyMeter::getUpdateTime, new Date())); | |||
| public List<Long> getChildMeterIdList(WxEnergyMeterChild record) { | |||
| return wxEnergyMeterChildMapper.findChildMeterIdList(record); | |||
| } | |||
| @Override | |||
| public PageInfo<WxEnergyFeesTime> timeListAsPage(WxEnergyFeesTime record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesTimeMapper.findList(record)); | |||
| @@ -267,6 +327,93 @@ public class WxEnergyServiceImpl implements WxEnergyService { | |||
| } | |||
| return page; | |||
| } | |||
| @Override | |||
| public PageInfo<WxEnergyFeesCalcute> feesCalcuteListAsPage(WxEnergyFeesCalcute record, Integer pageIndex, Integer pageSize) { | |||
| PageInfo<WxEnergyFeesCalcute> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesCalcuteMapper.findList(record)); | |||
| if (null != page && null != page.getList() && page.getList().size() > 0 ) { | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| fq.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| Map<Long, WxEnergyFees> feesMap = this.getFeesMap(fq); | |||
| for (int i = 0 ; i < page.getList().size() ; i++) { | |||
| WxEnergyFeesCalcute fs = page.getList().get(i); | |||
| if (null != feesMap && null != fs.getFeesId()) { | |||
| WxEnergyFees fee = feesMap.get(fs.getFeesId()); | |||
| if (null != fee) { | |||
| fs.setFeesName(fee.getName()); | |||
| fs.setFeesType(fee.getType()); | |||
| fs.setFeesTypeName(fee.getTypeName()); | |||
| fs.setFixedPriceName(fee.getFixedPriceName()); | |||
| fs.setCalcuteUnitName(fee.getCalcuteUnitName()); | |||
| fs.setTimeUnitName(fee.getTimeUnitName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return page; | |||
| } | |||
| @Override | |||
| public List<Map> getFeesCalcuteComponentList(WxEnergyFeesCalcute record) { | |||
| PageInfo<WxEnergyFeesCalcute> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesCalcuteMapper.findList(record)); | |||
| if (null != page && null != page.getList() && page.getList().size() > 0 ) { | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| fq.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| Map<Long, WxEnergyFees> feesMap = this.getFeesMap(fq); | |||
| for (int i = 0 ; i < page.getList().size() ; i++) { | |||
| WxEnergyFeesCalcute fs = page.getList().get(i); | |||
| if (null != feesMap && null != fs.getFeesId()) { | |||
| WxEnergyFees fee = feesMap.get(fs.getFeesId()); | |||
| if (null != fee) { | |||
| fs.setFeesName(fee.getName()); | |||
| fs.setFeesType(fee.getType()); | |||
| fs.setFeesTypeName(fee.getTypeName()); | |||
| fs.setFixedPriceName(fee.getFixedPriceName()); | |||
| fs.setCalcuteUnitName(fee.getCalcuteUnitName()); | |||
| fs.setTimeUnitName(fee.getTimeUnitName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return page; | |||
| } | |||
| @Override | |||
| public void createShopFees(WxEnergyFeesCalcute record) { | |||
| for (int i = 0 ; i < record.getShopIds().size(); i++) { | |||
| Long shopId = record.getShopIds().get(i); | |||
| for (int j = 0 ; j < record.getFeesIds().size() ; j++) { | |||
| Long feesId = record.getFeesIds().get(j); | |||
| WxEnergyFeesCalcute fs = new WxEnergyFeesCalcute(); | |||
| fs.updateTenantInfo(record); | |||
| fs.setFeesId(feesId); | |||
| fs.setShopId(shopId); | |||
| } | |||
| } | |||
| List<WxEnergyFeesCalcute> shopFeesList = wxEnergyFeesCalcuteMapper.findList(record); | |||
| if (null != shopFeesList && shopFeesList.size() > 0 ) { | |||
| List<WxEnergyFees> retList = new ArrayList<WxEnergyFees>(); | |||
| WxEnergyFees fq = new WxEnergyFees(); | |||
| fq.updateTenantInfo(record); | |||
| fq.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| Map<Long, WxEnergyFees> feesMap = this.getFeesMap(fq); | |||
| for (int i = 0 ; i < shopFeesList.size() ; i++) { | |||
| WxEnergyFeesCalcute fs = shopFeesList.get(i); | |||
| WxEnergyFees fe = new WxEnergyFees(); | |||
| fe.setId(fs.getFeesId()); | |||
| if (null != feesMap && null != fs.getFeesId()) { | |||
| WxEnergyFees fee = feesMap.get(fs.getFeesId()); | |||
| if (null != fee) { | |||
| fe.setName(fee.getName()); | |||
| fe.setType(fee.getType()); | |||
| retList.add(fe); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public void saveOrUpdateFees(WxEnergyFees record) { | |||
| @@ -183,6 +183,33 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| return new ResultData(wxMallBuildings); | |||
| } | |||
| @Override | |||
| public ResultData getBuildingList(WxMallBuilding wxMallBuilding,MallUserInfo mallUser) { | |||
| List<WxMallBuilding> wxMallBuildings = new ArrayList<WxMallBuilding>(); | |||
| if (null != mallUser && null != wxMallBuilding.getFloorForRule()) { | |||
| WxMallFloor wf = new WxMallFloor(); | |||
| wf.updateTenantInfo(mallUser); | |||
| wf.setFloorForRule(wxMallBuilding.getFloorForRule()); | |||
| List<Long> bids = wxMallFloorMapper.getBuildindIds(wf); | |||
| if (null == bids || bids.size() <= 0 ) { | |||
| wxMallBuilding.setId(-1L); | |||
| }else { | |||
| wxMallBuilding.setIds(bids); | |||
| } | |||
| } | |||
| List<WxMallBuilding> buildings = wxMallBuildingMapper.findList(wxMallBuilding); | |||
| wxMallBuildings = buildings.stream().map(b -> { | |||
| WxMallBuilding tempb = new WxMallBuilding(); | |||
| tempb.setId(b.getId()); | |||
| tempb.setTenantId(b.getTenantId()); | |||
| tempb.setParentTenantId(b.getParentTenantId()); | |||
| tempb.setName(b.getName()); | |||
| tempb.setBuildingName(b.getBuildingName()); | |||
| return tempb; | |||
| }).collect(Collectors.toList()); | |||
| return new ResultData(wxMallBuildings); | |||
| } | |||
| @Override | |||
| public void addBuildingAndFloors(WxMallBuildingFloorDto record) { | |||
| @@ -257,5 +284,9 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| return maps; | |||
| } | |||
| @Override | |||
| public List<Long> getBuildingIdList(WxMallBuilding wxMallBuilding) { | |||
| return wxMallBuildingMapper.findIdList(wxMallBuilding); | |||
| } | |||
| } | |||
| @@ -69,6 +69,11 @@ public class WxMallFloorServiceImpl implements WxMallFloorService { | |||
| List<WxMallFloor> list = wxMallFloorMapper.findList(wxMallFloor); | |||
| return new ResultData(list); | |||
| } | |||
| @Override | |||
| public List<Long> getFloorIdList(WxMallFloor record) { | |||
| return wxMallFloorMapper.getFloorIds(record); | |||
| } | |||
| @Override | |||
| public void deleteByBuildingId(Long buildingId) { | |||
| @@ -182,4 +182,9 @@ public class CouponCacheUtils { | |||
| return RedisCacheUtils.getCacheObject(template, key,WxCouponCVo.class); | |||
| } | |||
| public static void removeOldCouponOrderHtmlCache(RedisTemplate<String, Object> template) { | |||
| String key = EnumCacheKey.OLD_COUPORDER_HTML.getMessage(); | |||
| RedisCacheUtils.removeCachePrefix(template, key); | |||
| } | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| <?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.WxEnergyFeesCalcuteMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyFeesCalcute"> | |||
| <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="fees_id" jdbcType="BIGINT" property="feesId"/> | |||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||
| <result column="physics_type" jdbcType="INTEGER" property="physicsType"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="formula" jdbcType="VARCHAR" property="formula"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`fees_id`,`price`,`physics_type`,`shop_id`,`formula` | |||
| </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 != feesId ">and `fees_id` = #{feesId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != physicsType ">and `physics_type` = #{physicsType}</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=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxEnergyFeesCalcute" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_fees_calcute | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_fees_calcute where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findFeesIdList" parameterType="com.iformall.domain.po.WxEnergyFeesCalcute" resultType="Long"> | |||
| select distinct fees_id | |||
| from wx_energy_fees_calcute | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,62 @@ | |||
| <?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.WxEnergyMeterChildMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeterChild"> | |||
| <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="parent_meter_id" jdbcType="BIGINT" property="parentMeterId"/> | |||
| <result column="child_meter_id" jdbcType="BIGINT" property="childMeterId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`parent_meter_id`,`child_meter_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 != parentMeterId ">and `parent_meter_id` = #{parentMeterId}</if> | |||
| <if test=" null != childMeterId ">and `child_meter_id` = #{childMeterId}</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.WxEnergyMeterChild" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_meter_child | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_meter_child where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findChildMeterIdList" parameterType="com.iformall.domain.po.WxEnergyMeterChild" resultType="Long"> | |||
| select distinct child_meter_id | |||
| from wx_energy_meter_child | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <delete id = "deleteByCondition" parameterType="com.iformall.domain.po.WxEnergyMeterChild" > | |||
| delete from wx_energy_meter_child where `tenant_id` = #{tenantId} and `parent_meter_id` = #{parentMeterId} and `child_meter_id` = #{childMeterId} | |||
| </delete> | |||
| </mapper> | |||
| @@ -11,15 +11,12 @@ | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="rate" jdbcType="VARCHAR" property="rate"/> | |||
| <result column="is_public" jdbcType="INTEGER" property="isPublic"/> | |||
| <result column="building_id" jdbcType="BIGINT" property="buildingId"/> | |||
| <result column="floor_id" jdbcType="BIGINT" property="floorId"/> | |||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||
| <result column="physics_type" jdbcType="INTEGER" property="physicsType"/> | |||
| <result column="shop_type" jdbcType="INTEGER" property="shopType"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`rate`,`is_public`,`building_id`,`floor_id`,`shop_id`,`shop_type` | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`rate`,`physics_type`,`shop_type` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -33,24 +30,15 @@ | |||
| </if> | |||
| <if test=" null != isDel ">and `is_del` = #{isDel}</if> | |||
| <if test=" null != type ">and `type` = #{type}</if> | |||
| <if test=" null != isPublic ">and `is_public` = #{isPublic}</if> | |||
| <if test=" null != buildingId ">and `building_id` = #{buildingId}</if> | |||
| <if test=" null != floorId ">and `floor_id` = #{floorId}</if> | |||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||
| <if test=" null != physicsType ">and `physics_type` = #{physicsType}</if> | |||
| <if test=" null != shopType ">and `shop_type` = #{shopType}</if> | |||
| <if test=" null != name and '' != name ">and name like concat('%', #{name},'%')</if> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and `floor_id` in (${floorForRule}) | |||
| </if> | |||
| <if test=" null != shopTypeForRule and '' != shopTypeForRule "> | |||
| and `shop_type` in (${shopTypeForRule}) | |||
| </if> | |||
| <if test=" null != shopIds "> | |||
| and shop_id in | |||
| <foreach collection="shopIds" index="index" item="sidItem" open="(" separator="," close=")"> | |||
| #{sidItem} | |||
| <if test=" null != physicsTypeList "> | |||
| and physics_type in | |||
| <foreach collection="physicsTypeList" index="index" item="ptidItem" open="(" separator="," close=")"> | |||
| #{ptidItem} | |||
| </foreach> | |||
| </if> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -0,0 +1,76 @@ | |||
| <?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.WxEnergyMeterShopFloorMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeterShopFloor"> | |||
| <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="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="meter_id" jdbcType="BIGINT" property="meterId"/> | |||
| <result column="alise_id" jdbcType="BIGINT" property="aliseId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`type`,`meter_id`,`alise_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 != type ">and `type` = #{type}</if> | |||
| <if test=" null != meterId ">and `meter_id` = #{meterId}</if> | |||
| <if test=" null != aliseId ">and `alise_id` = #{aliseId}</if> | |||
| <if test=" null != typeList "> | |||
| and type in | |||
| <foreach collection="typeList" index="index" item="tidItem" open="(" separator="," close=")"> | |||
| #{tidItem} | |||
| </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.WxEnergyMeterShopFloor" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_meter_shop_floor | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_energy_meter_shop_floor where id = #{id} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findAliasIdList" parameterType="com.iformall.domain.po.WxEnergyMeterShopFloor" resultType="Long"> | |||
| select distinct alise_id | |||
| from wx_energy_meter_shop_floor | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findAliasIdList" parameterType="com.iformall.domain.po.WxEnergyMeterShopFloor" resultType="Long"> | |||
| select distinct meter_id | |||
| from wx_energy_meter_shop_floor | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <delete id="deleteByConditon" parameterType="com.iformall.domain.po.WxEnergyMeterShopFloor" > | |||
| delete from wx_energy_meter_shop_floor where `tenant_id` = #{tenantId} and type = #{type} and alise_id = #{aliseId} and meter_id = #{meterId} | |||
| </delete> | |||
| </mapper> | |||
| @@ -73,7 +73,12 @@ | |||
| from wx_mall_building | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxMallBuilding" resultType="Long"> | |||
| select id | |||
| from wx_mall_building | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <delete id="deleteByTenantId"> | |||
| delete from wx_mall_building where `tenant_id` = #{tenantId} | |||
| @@ -63,7 +63,12 @@ | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and `id` in (${floorForRule}) | |||
| </if> | |||
| <if test=" null != buildingIdList "> | |||
| and building_id in | |||
| <foreach collection="buildingIdList" index="index" item="bidItem" open="(" separator="," close=")"> | |||
| #{bidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -79,6 +84,12 @@ | |||
| from wx_mall_floor | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="getFloorIds" parameterType="com.iformall.domain.po.WxMallFloor" resultType="Long"> | |||
| select id | |||
| from wx_mall_floor | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <delete id="deleteByBuildingId"> | |||