Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

zhengqiang 5 rokov pred
rodič
commit
7a7739d0d2

+ 1 - 1
src/main/java/com/jpsoft/smart/modules/base/controller/OwnerInfoController.java

@@ -204,7 +204,7 @@ public class OwnerInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("create_time","desc"));
 
         if (StringUtils.isNotEmpty(id)) {
             searchParams.put("id","%" + id + "%");

+ 470 - 0
src/main/java/com/jpsoft/smart/modules/base/controller/RechargeRecordWaterController.java

@@ -0,0 +1,470 @@
+package com.jpsoft.smart.modules.base.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.smart.modules.base.entity.*;
+import com.jpsoft.smart.modules.base.service.*;
+import com.jpsoft.smart.modules.business.service.RechargeService;
+import com.jpsoft.smart.modules.common.dto.MessageResult;
+import com.jpsoft.smart.modules.common.dto.Sort;
+import com.jpsoft.smart.modules.common.utils.StringUtils;
+import com.jpsoft.smart.modules.communication.server.protocol.MeterReceivePacket;
+import com.jpsoft.smart.modules.sys.entity.DataDictionary;
+import com.jpsoft.smart.modules.sys.service.DataDictionaryService;
+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.*;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+@RestController
+@RequestMapping("/base/rechargeRecordWater")
+public class RechargeRecordWaterController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private RechargeRecordWaterService rechargeRecordWaterService;
+    @Autowired
+    private ElectricClientInfoService electricClientInfoService;
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+    @Autowired
+    private RoomInfoService roomInfoService;
+    @Autowired
+    private TerminalInfoService terminalInfoService;
+    @Autowired
+    private ElectricMeterInfoService electricMeterInfoService;
+    @Autowired
+    private RechargeService rechargeService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<RechargeRecordWater> create(@RequestAttribute String subject){
+        MessageResult<RechargeRecordWater> msgResult = new MessageResult<>();
+
+        RechargeRecordWater rechargeRecordWater = new RechargeRecordWater();
+
+        msgResult.setData(rechargeRecordWater);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<RechargeRecordWater> add(@RequestBody RechargeRecordWater rechargeRecordWater,@RequestAttribute String subject){
+        MessageResult<RechargeRecordWater> msgResult = new MessageResult<>();
+
+        try {
+            rechargeRecordWater.setId(UUID.randomUUID().toString());
+            rechargeRecordWater.setDelFlag(false);
+            rechargeRecordWater.setCreateBy(subject);
+            rechargeRecordWater.setCreateTime(new Date());
+            
+            int affectCount = rechargeRecordWaterService.insert(rechargeRecordWater);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(rechargeRecordWater);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<RechargeRecordWater> edit(@PathVariable("id") String id){
+        MessageResult<RechargeRecordWater> msgResult = new MessageResult<>();
+
+        try {
+            RechargeRecordWater rechargeRecordWater = rechargeRecordWaterService.get(id);
+
+            if (rechargeRecordWater != null) {
+                msgResult.setResult(true);
+                msgResult.setData(rechargeRecordWater);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<RechargeRecordWater> update(@RequestBody RechargeRecordWater rechargeRecordWater,@RequestAttribute String subject){
+        MessageResult<RechargeRecordWater> msgResult = new MessageResult<>();
+
+        try {
+            rechargeRecordWater.setUpdateBy(subject);
+            rechargeRecordWater.setUpdateTime(new Date());
+            
+            int affectCount = rechargeRecordWaterService.update(rechargeRecordWater);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(rechargeRecordWater);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            RechargeRecordWater rechargeRecordWater = rechargeRecordWaterService.get(id);
+            rechargeRecordWater.setDelFlag(true);
+            rechargeRecordWater.setUpdateBy(subject);
+            rechargeRecordWater.setUpdateTime(new Date());
+
+            int affectCount = rechargeRecordWaterService.update(rechargeRecordWater);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                RechargeRecordWater rechargeRecordWater = rechargeRecordWaterService.get(id);
+                rechargeRecordWater.setDelFlag(true);
+                rechargeRecordWater.setUpdateBy(subject);
+                rechargeRecordWater.setUpdateTime(new Date());
+
+                affectCount += rechargeRecordWaterService.update(rechargeRecordWater);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(name = "type", defaultValue = "") String type,
+            @RequestParam(name = "buyType", defaultValue = "") String buyType,
+            @RequestParam(name = "paymentStatus", defaultValue = "") String paymentStatus,
+            @RequestParam(name = "areaId", defaultValue = "") String areaId,
+            @RequestParam(name = "buildingId", defaultValue = "") String buildingId,
+            @RequestParam(name = "roomsId", defaultValue = "") String roomsId,
+            @RequestParam(name="serialNumber",defaultValue = "") String serialNumber,
+            @RequestParam(name="pageIndex",defaultValue = "1") int pageIndex,
+            @RequestParam(name="pageSize",defaultValue = "10") int pageSize,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id","%" + id + "%");
+        }
+
+        if (StringUtils.isNotEmpty(serialNumber)) {
+            searchParams.put("serialNumber","%" + serialNumber + "%");
+        }
+
+        if (StringUtils.isNotEmpty(buyType)) {
+            searchParams.put("buyType", buyType);
+        }
+        if (StringUtils.isNotEmpty(paymentStatus)) {
+            searchParams.put("paymentStatus", paymentStatus);
+        }
+        if (StringUtils.isNotEmpty(type)) {
+            searchParams.put("type", type);
+        }
+
+        //先判断是否选择房间
+        if (StringUtils.isNotEmpty(roomsId)) {
+            //选择了房间
+            List<String> roomsIds = new ArrayList();
+            roomsIds.add(roomsId);
+            searchParams.put("roomsIds", roomsIds);
+        }else if (StringUtils.isNotEmpty(buildingId)) {
+            //没有选择房间,选择楼栋
+            List<String> buildingIds = new ArrayList();
+            buildingIds.add(buildingId);
+            List<String> roomsIds = roomInfoService.findIdByTypeAndParentIds("3",buildingIds);
+            if(roomsIds.size() < 1){
+                roomsIds.add("");
+            }
+            searchParams.put("roomsIds", roomsIds);
+        }else if (StringUtils.isNotEmpty(areaId)) {
+            //没有选择房间和楼栋,选择的园区
+            List<String> areaIds = new ArrayList();
+            areaIds.add(areaId);
+            List<String> buildingIds = roomInfoService.findIdByTypeAndParentIds("2",areaIds);
+            List<String> roomsIds = roomInfoService.findIdByTypeAndParentIds("3",buildingIds);
+            if(roomsIds.size() < 1){
+                roomsIds.add("");
+            }
+            searchParams.put("roomsIds", roomsIds);
+        }
+
+        Page<RechargeRecordWater> page = rechargeRecordWaterService.pageSearch(searchParams,pageIndex,pageSize,sortList);
+        List<RechargeRecordWater> resultRecordList = new ArrayList<>();
+        List<RechargeRecordWater> recordList = page.getResult();
+
+        for(RechargeRecordWater rechargeRecordWater :recordList){
+            RoomInfo room = roomInfoService.get(rechargeRecordWater.getRoomId());
+            RoomInfo building = new RoomInfo();
+            RoomInfo area = new RoomInfo();
+            if(room != null){
+                building = roomInfoService.get(room.getParentId());
+                if(building != null){
+                    area = roomInfoService.get(building.getParentId());
+                }
+            }
+
+            rechargeRecordWater.setRoom(room);
+            rechargeRecordWater.setBuilding(building);
+            rechargeRecordWater.setArea(area);
+            resultRecordList.add(rechargeRecordWater);
+        }
+
+        Map<String,Object> pageMap = new HashMap<>();
+        pageMap.put("recordsTotal",page.getTotal());
+        pageMap.put("recordsFiltered",page.getTotal());
+        pageMap.put("totalPage",page.getPages());
+        pageMap.put("pageNumber",page.getPageNum());
+        pageMap.put("pageSize",page.getPageSize());
+        pageMap.put("data", resultRecordList);
+
+        msgResult.setResult(true);
+        msgResult.setData(pageMap);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="保存电量")
+    @PostMapping("saveRecord")
+    public MessageResult<RechargeRecordWater> saveRecord(@RequestBody RechargeRecordWater rechargeRecordWater,@RequestAttribute String subject) throws  Exception {
+        MessageResult<RechargeRecordWater> msgResult = new MessageResult<>();
+        boolean isOk = true;
+        try {
+
+            ElectricClientInfo clientInfo = electricClientInfoService.get(rechargeRecordWater.getClientId());
+
+            if(clientInfo==null){
+                throw new Exception("该房间没有绑定电表!");
+            }
+
+            ElectricMeterInfo meterInfo = electricMeterInfoService.get(clientInfo.getMeterId());
+            TerminalInfo terminalInfo = terminalInfoService.get(meterInfo.getTerminalId());
+
+            if (terminalInfo==null){
+                throw new Exception("该房间绑定电表没有设置对应终端!");
+            }
+
+            //新增电量等信息补充到电表中
+            //BigDecimal buyAmount = rechargeRecordWater.getBuyAmount();//购买金额
+            Integer buyElectricity = rechargeRecordWater.getBuyElectricity();//购买电量
+
+            //充电
+            MeterReceivePacket meterReceivePacket = rechargeService.recharge(clientInfo.getRoomId(), buyElectricity, 10, TimeUnit.SECONDS);
+            //MeterReceivePacket meterReceivePacket = new MeterReceivePacket();
+            //meterReceivePacket.setValidateResult(true);
+            //MeterReceivePacket meterReceivePacket = null;
+            if (meterReceivePacket == null) {
+                rechargeRecordWater.setErrorLog("线下充电失败-返回null");
+                isOk = false;
+            } else {
+                if (meterReceivePacket.isValidateResult()) {
+                    rechargeRecordWater.setDumpEnergy(meterReceivePacket.getRemain()); //当前剩余电量
+
+                    Integer electricityTotal = clientInfo.getElectricityTotal();//原总电量
+
+                    if (electricityTotal == null) {
+                        electricityTotal = 0;
+                    }
+
+                    Integer newElectricityTotal = electricityTotal + buyElectricity;//总购电量
+
+                    clientInfo.setElectricityRemaining(meterReceivePacket.getRemain());
+                    clientInfo.setRechargeTimes(meterReceivePacket.getRechargeTimes());
+
+                    clientInfo.setActive(meterReceivePacket.getState()!=1);
+
+                    clientInfo.setElectricityTotal(newElectricityTotal);
+
+                    clientInfo.setUpdateBy(subject);
+                    clientInfo.setUpdateTime(new Date());
+                    electricClientInfoService.update(clientInfo);
+                } else {
+                    isOk = false;
+                    rechargeRecordWater.setErrorLog("线下充电失败-返回状态为false");
+                }
+            }
+
+            String serialNumber = StringUtils.getOutTradeNo();
+            rechargeRecordWater.setSerialNumber(serialNumber);
+            rechargeRecordWater.setId(UUID.randomUUID().toString());
+            rechargeRecordWater.setDelFlag(false);
+            rechargeRecordWater.setCreateBy(subject);
+            rechargeRecordWater.setCreateTime(new Date());
+            rechargeRecordWater.setBuyType("cash");
+
+            if(isOk){
+                rechargeRecordWater.setPaymentStatus("20");
+                rechargeRecordWater.setChargingStatus("20");
+            }else{
+                rechargeRecordWater.setPaymentStatus("30");
+                rechargeRecordWater.setChargingStatus("30");
+            }
+            rechargeRecordWater.setRoomId(clientInfo.getRoomId());
+            rechargeRecordWater.setPaymentTime(new Date());
+            rechargeRecordWater.setCustomerNo(clientInfo.getCustomerNo());
+
+            int affectCount = rechargeRecordWaterService.insert(rechargeRecordWater);
+            if (affectCount > 0) {
+                if(isOk){
+                    msgResult.setResult(true);
+                    msgResult.setData(rechargeRecordWater);
+                }else{
+                    msgResult.setResult(false);
+                    msgResult.setMessage(rechargeRecordWater.getErrorLog());
+                }
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="线下充值前查询房间信息")
+    @GetMapping("queryRoomMessage/{clientId}")
+    public MessageResult<Map<String,Object>> queryRoomMessage(@PathVariable("clientId") String clientId,@RequestAttribute String subject) throws Exception {
+        MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
+
+        ElectricClientInfo clientInfo = electricClientInfoService.getRoomMessage(clientId);        //充值类型
+
+        if (clientInfo==null){
+            throw new Exception("该房间绑定电表!");
+        }
+
+        RoomInfo roomInfo = roomInfoService.get(clientInfo.getRoomId());
+        DataDictionary dataDictionary = dataDictionaryService.get(roomInfo.getUseType());
+        if(dataDictionary == null){
+            throw new Exception("该房间没有绑定用电类型!");
+        }
+        Map<String,Object> resultMaps = new HashMap();
+        resultMaps.put("roomId",clientInfo.getRoomId());
+        resultMaps.put("useTypeN",dataDictionary.getName());//中文翻译
+        resultMaps.put("useTypeV",dataDictionary.getValue());//值
+        msgResult.setData(resultMaps);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="创建交易信息")
+    @GetMapping("createSerial")
+    public MessageResult<String> createSerial(@RequestAttribute String subject){
+        MessageResult<String> msgResult = new MessageResult<>();
+
+        String serialNumber = StringUtils.getOutTradeNo();
+
+        RechargeRecordWater rechargeRecordWater = new RechargeRecordWater();
+        rechargeRecordWater.setId(UUID.randomUUID().toString());
+        rechargeRecordWater.setDelFlag(false);
+        rechargeRecordWater.setCreateBy(subject);
+        rechargeRecordWater.setCreateTime(new Date());
+        rechargeRecordWater.setSerialNumber(serialNumber);
+        rechargeRecordWater.setPaymentStatus("10");//10为未支付 20为支付成功
+        rechargeRecordWater.setChargingStatus("10");//10为未充电 20为充电成功
+
+        int affectCount = rechargeRecordWaterService.insert(rechargeRecordWater);
+        if (affectCount > 0) {
+            msgResult.setResult(true);
+            msgResult.setData(serialNumber);
+        } else {
+            msgResult.setResult(false);
+            msgResult.setMessage("创建失败");
+        }
+        return msgResult;
+    }
+
+
+}

+ 20 - 0
src/main/java/com/jpsoft/smart/modules/base/dao/RechargeRecordWaterDAO.java

@@ -0,0 +1,20 @@
+package com.jpsoft.smart.modules.base.dao;
+
+import com.jpsoft.smart.modules.base.entity.RechargeRecordWater;
+import com.jpsoft.smart.modules.common.dto.Sort;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Repository
+public interface RechargeRecordWaterDAO {
+	int insert(RechargeRecordWater entity);
+	int update(RechargeRecordWater entity);
+	int exist(String id);
+	RechargeRecordWater get(String id);
+	int delete(String id);
+	RechargeRecordWater getBySerialNum(String erialNum);
+	List<RechargeRecordWater> list();
+	List<RechargeRecordWater> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 377 - 0
src/main/java/com/jpsoft/smart/modules/base/entity/RechargeRecordWater.java

@@ -0,0 +1,377 @@
+package com.jpsoft.smart.modules.base.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+  描述:base_recharge_record的实体类
+ */
+public class RechargeRecordWater {
+	private String id;
+	private String createBy;
+	private Date createTime;
+	private String updateBy;
+	private Date updateTime;
+	private Boolean delFlag;
+	private String serialNumber;
+	private BigDecimal buyAmount;
+	private Integer buyElectricity;
+	private String buyType;
+	private String roomId;
+	private RoomInfo room;
+	private RoomInfo building;
+	private RoomInfo area;
+	private String clientId;
+	private String customerNo;
+	private String transactionNumber;
+	private String productTheme;
+	private String paymentStatus;
+	private String chargingStatus;
+	private Date paymentTime;
+	private String openId;
+	private String errorLog;
+	private Integer dumpEnergy;
+	private String type;
+	
+		/**
+	 *获取
+	 */
+	public String getId(){
+		return id;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+		/**
+	 *获取
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+		/**
+	 *获取是否删除
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+	
+	/**
+	 *设置是否删除
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+		/**
+	 *获取流水号
+	 */
+	public String getSerialNumber(){
+		return serialNumber;
+	}
+	
+	/**
+	 *设置流水号
+	 */
+	public void setSerialNumber(String serialNumber){
+		this.serialNumber = serialNumber;
+	}
+		/**
+	 *获取充值金额
+	 */
+	public BigDecimal getBuyAmount(){
+		return buyAmount;
+	}
+	
+	/**
+	 *设置充值金额
+	 */
+	public void setBuyAmount(BigDecimal buyAmount){
+		this.buyAmount = buyAmount;
+	}
+		/**
+	 *获取充值度数
+	 */
+	public Integer getBuyElectricity(){
+		return buyElectricity;
+	}
+	
+	/**
+	 *设置充值度数
+	 */
+	public void setBuyElectricity(Integer buyElectricity){
+		this.buyElectricity = buyElectricity;
+	}
+		/**
+	 *获取支付类型:微信,支付宝,现金等
+	 */
+	public String getBuyType(){
+		return buyType;
+	}
+	
+	/**
+	 *设置支付类型:微信,支付宝,现金等
+	 */
+	public void setBuyType(String buyType){
+		this.buyType = buyType;
+	}
+
+	/**
+	 *获取
+	 */
+	public String getClientId(){
+		return clientId;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setClientId(String clientId){
+		this.clientId = clientId;
+	}
+	/**
+	 *获取户号
+	 */
+	public String getCustomerNo(){
+		return customerNo;
+	}
+
+	/**
+	 *设置户号
+	 */
+	public void setCustomerNo(String customerNo){
+		this.customerNo = customerNo;
+	}
+
+	/**
+	 *获取
+	 */
+	public String getRoomId(){
+		return roomId;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setRoomId(String roomId){
+		this.roomId = roomId;
+	}
+
+
+	/**
+	 *获取交易号
+	 */
+	public String getTransactionNumber(){
+		return transactionNumber;
+	}
+
+	/**
+	 *设置交易号
+	 */
+	public void setTransactionNumber(String transactionNumber){
+		this.transactionNumber = transactionNumber;
+	}
+
+	/**
+	 *获取商品主题
+	 */
+	public String getProductTheme(){
+		return productTheme;
+	}
+
+	/**
+	 *设置商品主题
+	 */
+	public void setProductTheme(String productTheme){
+		this.productTheme = productTheme;
+	}
+
+	/**
+	 *获取支付状态
+	 */
+	public String getPaymentStatus(){
+		return paymentStatus;
+	}
+
+	/**
+	 *设置支付状态
+	 */
+	public void setPaymentStatus(String paymentStatus){
+		this.paymentStatus = paymentStatus;
+	}
+
+	/**
+	 *获取充电状态
+	 */
+	public String getChargingStatus(){
+		return chargingStatus;
+	}
+
+	/**
+	 *设置充电状态
+	 */
+	public void setChargingStatus(String chargingStatus){
+		this.chargingStatus = chargingStatus;
+	}
+
+	/**
+	 *获取支付时间
+	 */
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	public Date getPaymentTime(){
+		return paymentTime;
+	}
+
+	/**
+	 *设置支付时间
+	 */
+	public void setPaymentTime(Date paymentTime){
+		this.paymentTime = paymentTime;
+	}
+
+	/**
+	 *获取
+	 */
+	public String getOpenId(){
+		return openId;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setOpenId(String openId){
+		this.openId = openId;
+	}
+
+	/**
+	 *获取错误日志
+	 */
+	public String getErrorLog(){
+		return errorLog;
+	}
+
+	/**
+	 *设置错误日志
+	 */
+	public void setErrorLog(String errorLog){
+		this.errorLog = errorLog;
+	}
+
+
+
+	/**
+	 *获取
+	 */
+	public RoomInfo getRoom(){
+		return room;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setRoom(RoomInfo room){
+		this.room = room;
+	}
+
+	/**
+	 *获取
+	 */
+	public RoomInfo getBuilding(){
+		return building;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setBuilding(RoomInfo building){
+		this.building = building;
+	}
+
+	/**
+	 *获取
+	 */
+	public RoomInfo getArea(){
+		return area;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setArea(RoomInfo area){
+		this.area = area;
+	}
+
+	public Integer getDumpEnergy() {
+		return dumpEnergy;
+	}
+
+	public void setDumpEnergy(Integer dumpEnergy) {
+		this.dumpEnergy = dumpEnergy;
+	}
+
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+}

+ 20 - 0
src/main/java/com/jpsoft/smart/modules/base/service/RechargeRecordWaterService.java

@@ -0,0 +1,20 @@
+package com.jpsoft.smart.modules.base.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.smart.modules.base.entity.RechargeRecordWater;
+import com.jpsoft.smart.modules.common.dto.Sort;
+
+import java.util.List;
+import java.util.Map;
+
+public interface RechargeRecordWaterService {
+	RechargeRecordWater get(String id);
+	boolean exist(String id);
+	int insert(RechargeRecordWater model);
+	int update(RechargeRecordWater model);
+	int delete(String id);
+	RechargeRecordWater getBySerialNum(String erialNum);
+	List<RechargeRecordWater> list();
+	Page<RechargeRecordWater> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, List<Sort> sortList);
+	Page<RechargeRecordWater> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList);
+}

+ 84 - 0
src/main/java/com/jpsoft/smart/modules/base/service/impl/RechargeRecordWaterServiceImpl.java

@@ -0,0 +1,84 @@
+package com.jpsoft.smart.modules.base.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.smart.modules.base.dao.RechargeRecordWaterDAO;
+import com.jpsoft.smart.modules.base.entity.RechargeRecordWater;
+import com.jpsoft.smart.modules.base.service.RechargeRecordWaterService;
+import com.jpsoft.smart.modules.common.dto.Sort;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Transactional
+@Component(value="rechargeRecordWaterService")
+public class RechargeRecordWaterServiceImpl implements RechargeRecordWaterService {
+	@Resource(name="rechargeRecordWaterDAO")
+	private RechargeRecordWaterDAO rechargeRecordWaterDAO;
+
+	@Override
+	public RechargeRecordWater get(String id) {
+		// TODO Auto-generated method stub
+		return rechargeRecordWaterDAO.get(id);
+	}
+
+	@Override
+	public int insert(RechargeRecordWater model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return rechargeRecordWaterDAO.insert(model);
+	}
+
+	@Override
+	public int update(RechargeRecordWater model) {
+		// TODO Auto-generated method stub
+		return rechargeRecordWaterDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return rechargeRecordWaterDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = rechargeRecordWaterDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public RechargeRecordWater getBySerialNum(String erialNum){
+		return rechargeRecordWaterDAO.getBySerialNum(erialNum);
+	}
+
+	@Override
+	public List<RechargeRecordWater> list() {
+		// TODO Auto-generated method stub
+		return rechargeRecordWaterDAO.list();
+	}
+		
+	@Override
+	public Page<RechargeRecordWater> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+		Page<RechargeRecordWater> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+			rechargeRecordWaterDAO.search(searchParams,sortList);
+		});
+
+		return page;
+	}
+
+	@Override
+	public Page<RechargeRecordWater> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+		Page<RechargeRecordWater> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+			rechargeRecordWaterDAO.search(searchParams,sortList);
+		});
+
+		return page;
+	}
+}

+ 4 - 3
src/main/resources/mapper/base/OwnerInfo.xml

@@ -121,19 +121,20 @@
 	where id_=#{id}
 	</update>
 	<select id="get" parameterType="string" resultMap="OwnerInfoMap">
-		select * from base_owner_info where id_=#{0}
+		select * from base_owner_info where id_=#{0} and del_flag = 0
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from base_owner_info where id_=#{0}
+		select count(*) from base_owner_info where id_=#{0} and del_flag = 0
 	</select>
 	<select id="list" resultMap="OwnerInfoMap">
-		select * from base_owner_info
+		select * from base_owner_info where del_flag = 0
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="OwnerInfoMap">
 		<![CDATA[
 			select * from base_owner_info
 		]]>
 		<where>
+			del_flag = 0
 			<if test="searchParams.id != null">
 				and ID_ like #{searchParams.id}
 			</if>

+ 192 - 0
src/main/resources/mapper/base/RechargeRecordWater.xml

@@ -0,0 +1,192 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.smart.modules.base.dao.RechargeRecordWaterDAO">
+	<resultMap id="RechargeRecordWaterMap" type="com.jpsoft.smart.modules.base.entity.RechargeRecordWater">
+		<id property="id" column="id_" />
+		<result property="createBy" column="create_by" />
+		<result property="createTime" column="create_time" />
+		<result property="updateBy" column="update_by" />
+		<result property="updateTime" column="update_time" />
+		<result property="delFlag" column="del_flag" />
+		<result property="serialNumber" column="serial_number" />
+		<result property="buyAmount" column="buy_amount" />
+		<result property="buyElectricity" column="buy_electricity" />
+		<result property="buyType" column="buy_type" />
+		<result property="clientId" column="client_id" />
+		<result property="customerNo" column="customer_no" />
+		<result property="roomId" column="room_id" />
+		<result property="transactionNumber" column="transaction_number" />
+		<result property="productTheme" column="product_theme" />
+		<result property="paymentStatus" column="payment_status" />
+		<result property="chargingStatus" column="charging_status" />
+		<result property="paymentTime" column="payment_time" />
+		<result property="openId" column="open_id" />
+		<result property="errorLog" column="error_log" />
+		<result property="dumpEnergy" column="dump_energy" />
+		<result property="type" column="type_" />
+	</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.RechargeRecordWater">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_recharge_record_water
+	    (id_,create_by,create_time,update_by,update_time,del_flag,serial_number,buy_amount,buy_electricity,buy_type,client_id,customer_no,
+	    room_id,transaction_number,product_theme,payment_status,charging_status,payment_time,open_id,error_log,dump_energy,type_
+	    )
+		values
+		(
+			#{id,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{serialNumber,jdbcType=VARCHAR}
+			,#{buyAmount,jdbcType= NUMERIC }
+			,#{buyElectricity,jdbcType= NUMERIC }
+			,#{buyType,jdbcType=VARCHAR}
+			,#{clientId,jdbcType=VARCHAR}
+			,#{customerNo,jdbcType=VARCHAR}
+			,#{roomId,jdbcType=VARCHAR}
+			,#{transactionNumber,jdbcType=VARCHAR}
+			,#{productTheme,jdbcType=VARCHAR}
+			,#{paymentStatus,jdbcType=VARCHAR}
+			,#{chargingStatus,jdbcType=VARCHAR}
+			,#{paymentTime,jdbcType=TIMESTAMP}
+			,#{openId,jdbcType=VARCHAR}
+			,#{errorLog,jdbcType=VARCHAR}
+			,#{dumpEnergy,jdbcType= NUMERIC}
+			,#{type,jdbcType=VARCHAR}
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_recharge_record_water where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.smart.modules.base.entity.RechargeRecordWater">
+		update base_recharge_record_water
+		<set>
+			<if test="createBy!=null">
+			create_by=#{createBy,jdbcType=VARCHAR},
+			</if>
+			<if test="createTime!=null">
+			create_time=#{createTime,jdbcType= TIMESTAMP },
+			</if>
+			<if test="updateBy!=null">
+			update_by=#{updateBy,jdbcType=VARCHAR},
+			</if>
+			<if test="updateTime!=null">
+			update_time=#{updateTime,jdbcType= TIMESTAMP },
+			</if>
+			<if test="delFlag!=null">
+			del_flag=#{delFlag,jdbcType= NUMERIC },
+			</if>
+			<if test="serialNumber!=null">
+			serial_number=#{serialNumber,jdbcType=VARCHAR},
+			</if>
+			<if test="buyAmount!=null">
+			buy_amount=#{buyAmount,jdbcType= NUMERIC },
+			</if>
+			<if test="buyElectricity!=null">
+			buy_electricity=#{buyElectricity,jdbcType= NUMERIC },
+			</if>
+			<if test="buyType!=null">
+			buy_type=#{buyType,jdbcType=VARCHAR},
+			</if>
+			<if test="clientId!=null">
+				client_id=#{clientId,jdbcType=VARCHAR},
+			</if>
+			<if test="customerNo!=null">
+				customer_no=#{customerNo,jdbcType=VARCHAR},
+			</if>
+
+			<if test="roomId!=null">
+				room_id=#{roomId,jdbcType=VARCHAR},
+			</if>
+			<if test="transactionNumber!=null">
+				transaction_number=#{transactionNumber,jdbcType=VARCHAR},
+			</if>
+			<if test="productTheme!=null">
+				product_theme=#{productTheme,jdbcType=VARCHAR},
+			</if>
+			<if test="paymentStatus!=null">
+				payment_status=#{paymentStatus,jdbcType=VARCHAR},
+			</if>
+			<if test="chargingStatus!=null">
+				charging_status=#{chargingStatus,jdbcType=VARCHAR},
+			</if>
+			<if test="paymentTime!=null">
+				payment_time=#{paymentTime,jdbcType=TIMESTAMP},
+			</if>
+			<if test="openId!=null">
+				open_id=#{openId,jdbcType=VARCHAR},
+			</if>
+			<if test="errorLog!=null">
+				error_log=#{errorLog,jdbcType=VARCHAR},
+			</if>
+			<if test="dumpEnergy!=null">
+				dump_energy=#{dumpEnergy,jdbcType=NUMERIC},
+			</if>
+			<if test="type!=null">
+				type_=#{type,jdbcType=VARCHAR},
+			</if>
+		</set>
+		where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="RechargeRecordWaterMap">
+		select a.* from base_recharge_record_water a where id_=#{0} and del_flag = 0
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_recharge_record_water where id_=#{0} and del_flag = 0
+	</select>
+	<select id="list" resultMap="RechargeRecordWaterMap">
+		select * from base_recharge_record_water where del_flag = 0 order by create_time desc
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="RechargeRecordWaterMap">
+		<![CDATA[
+			select * from base_recharge_record_water
+		]]>
+		<where>
+			del_flag = 0
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+			<if test="searchParams.serialNumber != null">
+				and serial_number like #{searchParams.serialNumber}
+			</if>
+			<if test="searchParams.roomId != null">
+				and room_id = #{searchParams.roomId}
+			</if>
+			<if test="searchParams.paymentStatus != null">
+				and payment_status = #{searchParams.paymentStatus}
+			</if>
+			<if test="searchParams.chargingStatus != null">
+				and charging_status = #{searchParams.chargingStatus}
+			</if>
+			<if test="searchParams.buyType != null">
+				and buy_type = #{searchParams.buyType}
+			</if>
+			<if test="searchParams.type != null">
+				and type_ = #{searchParams.type}
+			</if>
+			<if test="searchParams.roomsIds != null and searchParams.roomsIds.size() > 0">
+				and room_id in
+				<foreach item="rId" index="index" collection="searchParams.roomsIds" open="("  close=")" separator=",">
+					#{rId}
+				</foreach>
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+
+	<select id="getBySerialNum" resultMap="RechargeRecordWaterMap">
+		select * from base_recharge_record_water where serial_number=#{serialNum} and del_flag=0 limit 1
+	</select>
+</mapper>