| @@ -0,0 +1,151 @@ | |||||
| package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.dto.WxBillPayDTO; | |||||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||||
| import com.iformall.domain.po.WxEnergyFees; | |||||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.domain.vo.AlipayOrWxStatistics; | |||||
| import com.iformall.enums.EnumBillAllType; | |||||
| import com.iformall.enums.EnumEnergyMeterType; | |||||
| import com.iformall.service.AliBusinessCircleOrderService; | |||||
| import com.iformall.service.WxEnergyService; | |||||
| import com.iformall.utils.Constant; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("energy") | |||||
| @Api(description = "能源相关接口") | |||||
| public class WxEnergyController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxEnergyService wxEnergyService; | |||||
| @ApiOperation("表类型") | |||||
| @GetMapping("meterTypeList") | |||||
| public ResultData meterTypeList() { | |||||
| Map retMap = new HashMap(); | |||||
| for (EnumEnergyMeterType mem : EnumEnergyMeterType.values()) { | |||||
| retMap.put(mem.getCode(), mem.getMessage()); | |||||
| } | |||||
| return new ResultData(retMap); | |||||
| } | |||||
| @ApiOperation("费用区间列表") | |||||
| @GetMapping("timeList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData timeList(@ModelAttribute WxEnergyFeesTime record, Integer pageNum, Integer pageSize) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||||
| PageInfo<WxEnergyFeesTime> page = wxEnergyService.timeListAsPage(record, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("费用区间列表") | |||||
| @PostMapping("saveTime") | |||||
| public ResultData saveTime(@RequestBody WxEnergyFeesTime record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| wxEnergyService.saveOrUpdateTime(record); | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("timeUpdateIsDel") | |||||
| public ResultData timeUpdateIsDel(@RequestBody WxEnergyFeesTime record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| wxEnergyService.setTimeIsDel(record); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("费用科目列表") | |||||
| @GetMapping("feesList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData feesList(@ModelAttribute WxEnergyFees record, Integer pageNum, Integer pageSize) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||||
| PageInfo<WxEnergyFees> page = wxEnergyService.feesListAsPage(record, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("费用区间列表") | |||||
| @PostMapping("saveFees") | |||||
| public ResultData saveFees(@RequestBody WxEnergyFees record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| wxEnergyService.saveOrUpdateFees(record); | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("feesUpdateIsDel") | |||||
| public ResultData feesUpdateIsDel(@RequestBody WxEnergyFees record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| wxEnergyService.setFeesIsDel(record); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("抄表数据分页列表接口") | |||||
| @GetMapping("readingList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData readingList(@ModelAttribute WxEnergyMeterReading record, Integer pageNum, Integer pageSize) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||||
| if(StringUtils.isNotBlank(record.getShopIdsStr())) { | |||||
| String[] shids = record.getShopIdsStr().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.setShopIds(sids); | |||||
| } | |||||
| } | |||||
| PageInfo<WxEnergyMeterReading> page = wxEnergyService.readingListAsPage(record, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("修改抄表数据") | |||||
| @PostMapping("saveReading") | |||||
| public ResultData saveReading(@RequestBody WxEnergyMeterReading record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| wxEnergyService.saveOrUpdateReading(record,this.getUser()); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,91 @@ | |||||
| CREATE TABLE `wx_energy_meter` ( | |||||
| `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, | |||||
| `is_del` int(1) NOT NULL DEFAULT '0', | |||||
| `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表名称', | |||||
| `type` int(3) NOT NULL COMMENT '表类型', | |||||
| `rate` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '倍率', | |||||
| `is_public` int(1) NOT NULL DEFAULT '0' COMMENT '用户表 0 , 总表1', | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||||
| CREATE TABLE `wx_energy_meter_user` ( | |||||
| `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, | |||||
| `user_id` bigint(20) NOT NULL COMMENT '使用者id,商铺id或者楼层id', | |||||
| `user_type` int(3) NOT NULL COMMENT '使用者类型', | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表使用者'; | |||||
| CREATE TABLE `wx_energy_meter_reading` ( | |||||
| `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, | |||||
| `cur_number` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '本次读数', | |||||
| `pre_number` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '上次度数', | |||||
| `pre_time` timestamp NULL DEFAULT NULL COMMENT '上次读数时间', | |||||
| `start_time` timestamp NULL DEFAULT NULL COMMENT '所属周期开始', | |||||
| `end_time` timestamp NULL DEFAULT NULL COMMENT '所属周期结束', | |||||
| `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, | |||||
| `time_id` bigint(20) NOT NULL COMMENT '区间ID', | |||||
| `meter_id` bigint(20) NOT NULL COMMENT '表ID', | |||||
| `meter_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '表名称', | |||||
| `is_public` int(3) NOT NULL COMMENT '是否总表', | |||||
| `shop_id` bigint(20) DEFAULT NULL COMMENT '店铺ID', | |||||
| `shop_number` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '店铺编号', | |||||
| `building_id` bigint(20) DEFAULT NULL COMMENT '楼座ID', | |||||
| `floor_id` bigint(20) DEFAULT NULL COMMENT '楼层ID', | |||||
| `price` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单价', | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表抄表'; | |||||
| CREATE TABLE `wx_energy_fees_time` ( | |||||
| `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, | |||||
| `is_del` int(1) NOT NULL DEFAULT '0', | |||||
| `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表名称', | |||||
| `type` int(3) NOT NULL COMMENT '表类型', | |||||
| `start_time` timestamp NULL DEFAULT NULL, | |||||
| `end_time` timestamp NULL DEFAULT NULL, | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||||
| CREATE TABLE `wx_energy_fees` ( | |||||
| `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, | |||||
| `is_del` int(1) NOT NULL DEFAULT '0', | |||||
| `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', | |||||
| `type` int(3) NOT NULL COMMENT '表类型', | |||||
| `is_public` int(1) NOT NULL DEFAULT '0' COMMENT '是否公摊', | |||||
| `price` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '单价', | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE KEY `id_UNIQUE` (`id`) | |||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='能耗表'; | |||||
| @@ -0,0 +1,81 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxEnergyFees; | |||||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.enums.EnumEnergyMeterType; | |||||
| import com.iformall.enums.EnumYesOrNo; | |||||
| import com.iformall.service.WxEnergyService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/api/energy") | |||||
| @Api(description = "能源相关接口") | |||||
| public class WxEnergyController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxEnergyService wxEnergyService; | |||||
| @ApiOperation("表类型") | |||||
| @GetMapping("meterList") | |||||
| public ResultData timeList() { | |||||
| Map retMap = new HashMap(); | |||||
| for (EnumEnergyMeterType mem : EnumEnergyMeterType.values()) { | |||||
| retMap.put(mem.getCode(), mem.getMessage()); | |||||
| } | |||||
| return new ResultData(retMap); | |||||
| } | |||||
| @ApiOperation("费用区间列表") | |||||
| @GetMapping("timeList") | |||||
| public ResultData timeList(@ModelAttribute WxEnergyFeesTime record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| record.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||||
| PageInfo<WxEnergyFeesTime> page = wxEnergyService.timeListAsPage(record, 1, 1000); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @PostMapping("commit") | |||||
| public ResultData feesUpdateIsDel(@RequestBody WxEnergyMeterReading record) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| wxEnergyService.commitReading(record,this.getLoginMallUserInfo()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("抄表数据分页列表接口") | |||||
| @GetMapping("readingList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData readingList(@ModelAttribute WxEnergyMeterReading record, Integer pageNum, Integer pageSize) { | |||||
| record.updateTenantInfo(getTenantInfo()); | |||||
| record.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||||
| PageInfo<WxEnergyMeterReading> page = wxEnergyService.readingListAsPage(record, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,44 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| /** | |||||
| */ | |||||
| @TableName(value = "wx_energy_fees") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxEnergyFees extends TenantEntity { | |||||
| private static final long serialVersionUID = 7009117540201976664L; | |||||
| @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; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否总表", name = "isPublic") | |||||
| private Integer isPublic; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "单价", name = "price") | |||||
| private String price; | |||||
| } | |||||
| @@ -0,0 +1,44 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| /** | |||||
| */ | |||||
| @TableName(value = "wx_energy_fees_time") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxEnergyFeesTime extends TenantEntity { | |||||
| private static final long serialVersionUID = 7009117540201976664L; | |||||
| @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; | |||||
| @io.swagger.annotations.ApiModelProperty(value="startTime",name="startTime") | |||||
| private Date startTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="endTime",name="endTime") | |||||
| private Date endTime; | |||||
| } | |||||
| @@ -0,0 +1,44 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| /** | |||||
| */ | |||||
| @TableName(value = "wx_energy_meter") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxEnergyMeter extends TenantEntity { | |||||
| private static final long serialVersionUID = 7009117540201976664L; | |||||
| @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; | |||||
| @io.swagger.annotations.ApiModelProperty(value="倍率",name="rate") | |||||
| private String rate; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否总表", name = "isPublic") | |||||
| private Integer isPublic; | |||||
| } | |||||
| @@ -0,0 +1,96 @@ | |||||
| 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 lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| @TableName(value = "wx_energy_meter_reading") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxEnergyMeterReading 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 = "curNumber") | |||||
| private String curNumber; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "上次读数", name = "preNumber") | |||||
| private String preNumber; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "上次读数时间", name = "preTime") | |||||
| private Date preTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "所属周期开始时间", name = "startTime") | |||||
| private Date startTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "所属周期结束时间", name = "endTime") | |||||
| private Date endTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="createBy",name="createBy") | |||||
| private Long createBy; | |||||
| @io.swagger.annotations.ApiModelProperty(value="createByName",name="createByName") | |||||
| private String createByName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="updateBy",name="updateBy") | |||||
| private Long updateBy; | |||||
| @io.swagger.annotations.ApiModelProperty(value="updateByName",name="updateByName") | |||||
| private String updateByName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | |||||
| private String remark; | |||||
| @io.swagger.annotations.ApiModelProperty(value="区间ID",name="timeId") | |||||
| private Long timeId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="表ID",name="meterId") | |||||
| private Long meterId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否总表",name="isPublic") | |||||
| private Integer isPublic; | |||||
| @io.swagger.annotations.ApiModelProperty(value="表名",name="meterName") | |||||
| private String meterName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="店铺ID",name="shopId") | |||||
| private Long shopId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="店铺号",name="shopNumber") | |||||
| private String shopNumber; | |||||
| @io.swagger.annotations.ApiModelProperty(value="楼座ID",name="buildingId") | |||||
| private Long buildingId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="楼层ID",name="floorId") | |||||
| private Long floorId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="楼层ID",name="floorId") | |||||
| private String price; | |||||
| @TableField(exist = false) | |||||
| private List<WxEnergyMeterReading> meterReadingList; | |||||
| @TableField(exist = false) | |||||
| private List<Long> shopIds; | |||||
| @TableField(exist = false) | |||||
| private String shopIdsStr; | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| /** | |||||
| */ | |||||
| @TableName(value = "wx_energy_meter_user") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxEnergyMeterUser extends TenantEntity { | |||||
| private static final long serialVersionUID = 7009117540201976664L; | |||||
| @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 = "userId", name = "userId") | |||||
| private Long userId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "EnumEnergyMeterUserType", name = "userType") | |||||
| private Integer userType; | |||||
| } | |||||
| @@ -0,0 +1,44 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| */ | |||||
| public enum EnumEnergyMeterType { | |||||
| WATER(1,"水表",EnumBillDailyType.WATER.getCode()), | |||||
| POWER(2,"电表",EnumBillDailyType.POWER.getCode()), | |||||
| AIR_CONDITIONING(3, "燃气表",EnumBillDailyType.AIR_CONDITIONING.getCode()), | |||||
| ; | |||||
| public static EnumEnergyMeterType getEnum(Integer code) { | |||||
| for (EnumEnergyMeterType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| private Integer billDailyType; | |||||
| EnumEnergyMeterType(Integer code, String message,Integer billDailyType) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| this.billDailyType = billDailyType; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| public Integer getBillDailyType() { | |||||
| return billDailyType; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,39 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| */ | |||||
| public enum EnumEnergyMeterUserType { | |||||
| SHOP(1,"店铺"), | |||||
| FLOOR(2,"楼层"), | |||||
| BUILDING(3, "楼座"), | |||||
| ; | |||||
| public static EnumEnergyMeterUserType getEnum(Integer code) { | |||||
| for (EnumEnergyMeterUserType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumEnergyMeterUserType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxEnergyFees; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| public interface WxEnergyFeesMapper extends CommonMapper<WxEnergyFees, Long> { | |||||
| List<WxEnergyFees> findList(WxEnergyFees wxBillRent); | |||||
| WxEnergyFees selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| public interface WxEnergyFeesTimeMapper extends CommonMapper<WxEnergyFeesTime, Long> { | |||||
| List<WxEnergyFeesTime> findList(WxEnergyFeesTime wxBillRent); | |||||
| WxEnergyFeesTime selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxEnergyMeter; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| public interface WxEnergyMeterMapper extends CommonMapper<WxEnergyMeter, Long> { | |||||
| List<WxEnergyMeter> findList(WxEnergyMeter wxBillRent); | |||||
| WxEnergyMeter selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| void setIsDel(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("isDel")Integer isDel); | |||||
| } | |||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| public interface WxEnergyMeterReadingMapper extends CommonMapper<WxEnergyMeterReading, Long> { | |||||
| List<WxEnergyMeterReading> findList(WxEnergyMeterReading wxBillRent); | |||||
| WxEnergyMeterReading selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| } | |||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxEnergyMeter; | |||||
| import com.iformall.domain.po.WxEnergyMeterUser; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| */ | |||||
| public interface WxEnergyMeterUserMapper extends CommonMapper<WxEnergyMeterUser, Long> { | |||||
| List<WxEnergyMeterUser> findList(WxEnergyMeterUser wxBillRent); | |||||
| } | |||||
| @@ -0,0 +1,55 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxEnergyFees; | |||||
| import com.iformall.domain.po.WxEnergyFeesTime; | |||||
| import com.iformall.domain.po.WxEnergyMeter; | |||||
| import com.iformall.domain.po.WxEnergyMeterReading; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| /** | |||||
| */ | |||||
| public interface WxEnergyService { | |||||
| //费用区间 | |||||
| PageInfo<WxEnergyFeesTime> timeListAsPage(WxEnergyFeesTime record, Integer pageIndex, Integer pageSize); | |||||
| void saveOrUpdateTime(WxEnergyFeesTime record); | |||||
| void setTimeIsDel(WxEnergyFeesTime record); | |||||
| //费用科目 | |||||
| PageInfo<WxEnergyFees> feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize); | |||||
| void saveOrUpdateFees(WxEnergyFees record); | |||||
| void setFeesIsDel(WxEnergyFees record); | |||||
| //抄表数据 | |||||
| PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, Integer pageSize); | |||||
| void saveOrUpdateReading(WxEnergyMeterReading record,MallUserInfo userInfo); | |||||
| void commitReading(WxEnergyMeterReading record,MallUserInfo userInfo); | |||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxEnergyMeter> listAsPage(WxEnergyMeter record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxEnergyMeter getById(TenantEntity tenantEntity,Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| * @param user | |||||
| */ | |||||
| void saveOrUpdate(WxEnergyMeter record); | |||||
| void updateIsDel(WxEnergyMeter record); | |||||
| } | |||||
| @@ -0,0 +1,221 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.*; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.*; | |||||
| /** | |||||
| */ | |||||
| @Service | |||||
| public class WxEnergyServiceImpl implements WxEnergyService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxEnergyMeterMapper wxEnergyMeterMapper; | |||||
| @Autowired | |||||
| WxEnergyMeterUserMapper wxEnergyMeterUserMapper; | |||||
| @Autowired | |||||
| WxEnergyMeterReadingMapper wxEnergyMeterReadingMapper; | |||||
| @Autowired | |||||
| WxEnergyFeesTimeMapper wxEnergyFeesTimeMapper; | |||||
| @Autowired | |||||
| WxEnergyFeesMapper wxEnergyFeesMapper; | |||||
| @Override | |||||
| public PageInfo<WxEnergyFeesTime> timeListAsPage(WxEnergyFeesTime record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesTimeMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdateTime(WxEnergyFeesTime record) { | |||||
| Date date = new Date(); | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateTime(date); | |||||
| record.setUpdateTime(date); | |||||
| try { | |||||
| wxEnergyFeesTimeMapper.insert(record); | |||||
| } catch (Exception e) { | |||||
| logger.error("保存租赁账单失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| } else { | |||||
| record.setUpdateTime(date); | |||||
| wxEnergyFeesTimeMapper.updateById(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void setTimeIsDel(WxEnergyFeesTime record) { | |||||
| wxEnergyFeesTimeMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<WxEnergyFees> feesListAsPage(WxEnergyFees record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyFeesMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdateFees(WxEnergyFees record) { | |||||
| Date date = new Date(); | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateTime(date); | |||||
| record.setUpdateTime(date); | |||||
| try { | |||||
| wxEnergyFeesMapper.insert(record); | |||||
| } catch (Exception e) { | |||||
| logger.error("保存租赁账单失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| } else { | |||||
| record.setUpdateTime(date); | |||||
| wxEnergyFeesMapper.updateById(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void setFeesIsDel(WxEnergyFees record) { | |||||
| wxEnergyFeesMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<WxEnergyMeterReading> readingListAsPage(WxEnergyMeterReading record, Integer pageIndex, | |||||
| Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyMeterReadingMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdateReading(WxEnergyMeterReading record,MallUserInfo userInfo) { | |||||
| Date date = new Date(); | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateTime(date); | |||||
| record.setCreateBy(userInfo.getId()); | |||||
| record.setCreateByName(userInfo.getName()); | |||||
| record.setUpdateTime(date); | |||||
| record.setUpdateBy(userInfo.getId()); | |||||
| record.setUpdateByName(userInfo.getName()); | |||||
| try { | |||||
| wxEnergyMeterReadingMapper.insert(record); | |||||
| } catch (Exception e) { | |||||
| logger.error("保存租赁账单失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| } else { | |||||
| record.setUpdateTime(date); | |||||
| record.setUpdateBy(userInfo.getId()); | |||||
| record.setUpdateByName(userInfo.getName()); | |||||
| wxEnergyMeterReadingMapper.updateById(record); | |||||
| } | |||||
| } | |||||
| private WxEnergyMeterReading findPre(WxEnergyMeterReading record) { | |||||
| //查询上次抄表的数据 | |||||
| record.setSortColumns("end_time desc"); | |||||
| PageInfo<WxEnergyMeterReading> page = readingListAsPage(record, 1, 1); | |||||
| if (null != page && null != page.getList() && page.getList().size() > 0 ) { | |||||
| return page.getList().get(0); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public void commitReading(WxEnergyMeterReading record, MallUserInfo userInfo) { | |||||
| if (null == record.getMeterReadingList()) { | |||||
| List<WxEnergyMeterReading> recordList = new ArrayList<WxEnergyMeterReading>(); | |||||
| for (int i = 0 ; i < record.getMeterReadingList().size(); i++) { | |||||
| WxEnergyMeterReading _mr = record.getMeterReadingList().get(i); | |||||
| WxEnergyMeterReading r = new WxEnergyMeterReading(); | |||||
| r.updateTenantInfo(record); | |||||
| r.setCurNumber(_mr.getCurNumber()); | |||||
| r.setTimeId(record.getTimeId()); | |||||
| r.setShopId(record.getShopId()); | |||||
| r.setShopNumber(record.getShopNumber()); | |||||
| r.setBuildingId(record.getBuildingId()); | |||||
| r.setFloorId(record.getFloorId()); | |||||
| r.setMeterId(_mr.getMeterId()); | |||||
| recordList.add(r); | |||||
| } | |||||
| if (recordList.size() > 0 ) { | |||||
| for (int i = 0 ; i < recordList.size(); i ++) { | |||||
| WxEnergyMeterReading r = recordList.get(i); | |||||
| //获取上一次的数据 | |||||
| WxEnergyMeterReading pre = findPre(r); | |||||
| if (null != pre) { | |||||
| r.setPreNumber(pre.getCurNumber()); | |||||
| r.setPreTime(pre.getCreateTime()); | |||||
| } | |||||
| //根据时间id获取时间周期 | |||||
| WxEnergyFeesTime time = wxEnergyFeesTimeMapper.selectById(r.getTimeId(), record.getTenantId()); | |||||
| r.setStartTime(time.getStartTime()); | |||||
| r.setEndTime(time.getEndTime()); | |||||
| //根据表id获取表名 | |||||
| WxEnergyMeter meter = wxEnergyMeterMapper.selectById(r.getMeterId(), record.getTenantId()); | |||||
| r.setMeterName(meter.getName()); | |||||
| r.setIsPublic(meter.getIsPublic()); | |||||
| saveOrUpdateReading(r, userInfo); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public PageInfo<WxEnergyMeter> listAsPage(WxEnergyMeter record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxEnergyMeterMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxEnergyMeter getById(TenantEntity tenantEntity,Long id) { | |||||
| return wxEnergyMeterMapper.selectById(id, tenantEntity.getTenantId()); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxEnergyMeter record) { | |||||
| Date date = new Date(); | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateTime(date); | |||||
| record.setUpdateTime(date); | |||||
| try { | |||||
| wxEnergyMeterMapper.insert(record); | |||||
| } catch (Exception e) { | |||||
| logger.error("保存租赁账单失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | |||||
| } else { | |||||
| record.setUpdateTime(date); | |||||
| wxEnergyMeterMapper.updateById(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void updateIsDel(WxEnergyMeter record) { | |||||
| wxEnergyMeterMapper.setIsDel(record.getId(), record.getTenantId(), record.getIsDel()); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,61 @@ | |||||
| <?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.WxEnergyFeesMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyFees"> | |||||
| <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="is_del" jdbcType="INTEGER" property="isDel"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| <result column="is_public" jdbcType="INTEGER" property="isPublic"/> | |||||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`is_public`,`price` | |||||
| </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 != 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 != 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=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxEnergyFees" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_fees | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_fees where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| <update id = "setIsDel" parameterType="HashMap"> | |||||
| update wx_energy_fees set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </update> | |||||
| </mapper> | |||||
| @@ -0,0 +1,60 @@ | |||||
| <?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.WxEnergyFeesTimeMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyFeesTime"> | |||||
| <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="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"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`start_time`,`end_time` | |||||
| </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 != isDel ">and `is_del` = #{isDel}</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=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxEnergyFeesTime" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_fees_time | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_fees_time where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| <update id = "setIsDel" parameterType="HashMap"> | |||||
| update wx_energy_fees_time set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </update> | |||||
| </mapper> | |||||
| @@ -0,0 +1,61 @@ | |||||
| <?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.WxEnergyMeterMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeter"> | |||||
| <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="is_del" jdbcType="INTEGER" property="isDel"/> | |||||
| <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"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`is_del`,`name`,`type`,`rate`,`is_public` | |||||
| </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 != 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 != 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=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxEnergyMeter" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_meter | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_meter where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| <update id = "setIsDel" parameterType="HashMap"> | |||||
| update wx_energy_meter set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </update> | |||||
| </mapper> | |||||
| @@ -0,0 +1,84 @@ | |||||
| <?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.WxEnergyMeterReadingMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeterReading"> | |||||
| <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="cur_number" jdbcType="VARCHAR" property="curNumber"/> | |||||
| <result column="pre_number" jdbcType="VARCHAR" property="preNumber"/> | |||||
| <result column="pre_time" jdbcType="TIMESTAMP" property="preTime"/> | |||||
| <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> | |||||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||||
| <result column="create_by" jdbcType="BIGINT" property="createBy"/> | |||||
| <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="meter_id" jdbcType="BIGINT" property="meterId"/> | |||||
| <result column="is_public" jdbcType="INTEGER" property="isPublic"/> | |||||
| <result column="meter_name" jdbcType="VARCHAR" property="meterName"/> | |||||
| <result column="shop_id" jdbcType="BIGINT" property="shopId"/> | |||||
| <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/> | |||||
| <result column="building_id" jdbcType="BIGINT" property="buildingId"/> | |||||
| <result column="floor_id" jdbcType="BIGINT" property="floorId"/> | |||||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`cur_number`,`pre_number`,`pre_time`,`start_time`,`end_time`,`create_by`,`create_by_name`, | |||||
| `update_by`,`update_by_name`,`remark`,`time_id`,`meter_id`,`is_public`,`meter_name`,`shop_id`,`shop_number`,`building_id`,`floor_id`,`price` | |||||
| </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 != createBy ">and `create_by` = #{createBy}</if> | |||||
| <if test=" null != timeId ">and `time_id` = #{timeId}</if> | |||||
| <if test=" null != meterId ">and `meter_id` = #{meterId}</if> | |||||
| <if test=" null != isPublic ">and `is_public` = #{isPublic}</if> | |||||
| <if test=" null != meterName and '' != meterName ">and meter_name like concat('%', #{meterName},'%')</if> | |||||
| <if test=" null != shopId ">and `shop_id` = #{shopId}</if> | |||||
| <if test=" null != shopNumber and '' != shopNumber ">and shop_number like concat('%', #{shopNumber},'%')</if> | |||||
| <if test=" null != buildingId ">and `building_id` = #{buildingId}</if> | |||||
| <if test=" null != floorId ">and `floor_id` = #{floorId}</if> | |||||
| <if test=" null != createByName and '' != createByName ">and create_by_name like concat('%', #{createByName},'%')</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.WxEnergyMeterReading" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_meter_reading | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_meter_reading where id = #{id} and `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,46 @@ | |||||
| <?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.WxEnergyMeterUserMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxEnergyMeterUser"> | |||||
| <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="user_id" jdbcType="BIGINT" property="userId"/> | |||||
| <result column="user_type" jdbcType="INTEGER" property="userType"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`user_id`,`user_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 != userId ">and `user_id` = #{userId}</if> | |||||
| <if test=" null != userType ">and `user_type` = #{userType}</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.WxEnergyMeterUser" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_energy_meter_user | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||