作者 shenhailong

近期丢失的所有

正在显示 32 个修改的文件 包含 886 行增加56 行删除
@@ -79,11 +79,19 @@ @@ -79,11 +79,19 @@
79 <artifactId>spring-boot-starter-test</artifactId> 79 <artifactId>spring-boot-starter-test</artifactId>
80 <scope>test</scope> 80 <scope>test</scope>
81 </dependency> 81 </dependency>
  82 +<<<<<<< Updated upstream
82 <dependency> 83 <dependency>
83 <groupId>com.tianbo</groupId> 84 <groupId>com.tianbo</groupId>
84 <artifactId>util</artifactId> 85 <artifactId>util</artifactId>
85 <version>1.0-SNAPSHOT</version> 86 <version>1.0-SNAPSHOT</version>
86 </dependency> 87 </dependency>
  88 +=======
  89 + <!--<dependency>-->
  90 + <!--<groupId>com.tianbo</groupId>-->
  91 + <!--<artifactId>util</artifactId>-->
  92 + <!--<version>1.0-SNAPSHOT</version>-->
  93 + <!--</dependency>-->
  94 +>>>>>>> Stashed changes
87 <dependency> 95 <dependency>
88 <groupId>net.sf.json-lib</groupId> 96 <groupId>net.sf.json-lib</groupId>
89 <artifactId>json-lib</artifactId> 97 <artifactId>json-lib</artifactId>
  1 +package com.sunyo.energy.location.controller;
  2 +
  3 +import com.sunyo.energy.location.controller.response.ResultJson;
  4 +import org.springframework.stereotype.Controller;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +
  7 +@Controller
  8 +@RequestMapping("/electricity")
  9 +public class ElectricityMeterController {
  10 +
  11 +//
  12 +// public ResultJson electricityPay(){
  13 +//
  14 +// }
  15 +
  16 +}
  1 +package com.sunyo.energy.location.controller;
  2 +
  3 +
  4 +import com.github.pagehelper.Page;
  5 +import com.github.pagehelper.PageHelper;
  6 +import com.github.pagehelper.PageInfo;
  7 +import com.sunyo.energy.location.controller.response.ResultJson;
  8 +import com.sunyo.energy.location.dao.LocationMapper;
  9 +import com.sunyo.energy.location.model.Location;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.apache.ibatis.annotations.Param;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.util.StringUtils;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import java.util.HashMap;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +
  20 +@RestController
  21 +@RequestMapping("/location")
  22 +public class LocationController {
  23 +
  24 + @Autowired
  25 + private LocationMapper locationMapper;
  26 +
  27 + @ApiOperation(value = "查询楼层")
  28 + @RequestMapping(value="/list",method= RequestMethod.GET)
  29 + public ResultJson startActivityDemo(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
  30 + int pageNum,
  31 + @RequestParam(value = "pageSize",required = false,defaultValue = "5")
  32 + int pageSize,
  33 + @RequestParam(value = "processName", required = false)
  34 + String adrname){
  35 + Page<Location> page = PageHelper.startPage(pageNum,pageSize);
  36 + List<Location> list = null;
  37 + if (StringUtils.isEmpty(adrname)) {
  38 + list= locationMapper.selectAll(0);
  39 + }else {
  40 + list= locationMapper.selectAllAdrName(adrname);
  41 + }
  42 +
  43 + PageInfo<Location> result = new PageInfo<Location>(list);
  44 + return new ResultJson("200","success",result);
  45 + }
  46 +
  47 + @ApiOperation(value = "新增楼层")
  48 + @PostMapping(value = "/add")
  49 + public ResultJson addLocation(@RequestParam("adrName") String adrName,
  50 + @RequestParam("parent") Integer parent,
  51 + @RequestParam("type") Integer type){
  52 +
  53 + ResultJson resultJson = new ResultJson();
  54 + Location location = new Location();
  55 + Map map = new HashMap();
  56 + map.put("adrName", adrName);
  57 + map.put("parent", parent);
  58 + if (locationMapper.countAdrName(map) > 0){
  59 + resultJson.setCode("201");
  60 + } else {
  61 +
  62 + location.setParent(parent);
  63 + location.setType(type);
  64 + location.setAdrname(adrName);
  65 +
  66 + if (locationMapper.insertSelective(location)>0){
  67 + resultJson.setCode("200");
  68 + }else {
  69 + resultJson.setCode("202");
  70 + }
  71 + }
  72 +
  73 + return resultJson;
  74 + }
  75 +
  76 + @ApiOperation(value = "删除楼层")
  77 + @DeleteMapping(value = "/del")
  78 + public ResultJson delLocation(@RequestBody Location location){
  79 +
  80 + ResultJson resultJson = new ResultJson();
  81 +
  82 + if (locationMapper.countParent(location.getId()) > 0) {
  83 + resultJson.setCode("201");
  84 + return resultJson;
  85 + }else {
  86 +
  87 + if (locationMapper.deleteByPrimaryKey(location.getId())>0){
  88 + resultJson.setCode("200");
  89 + return resultJson;
  90 + }else {
  91 + resultJson.setCode("201");
  92 + return resultJson;
  93 + }
  94 + }
  95 + }
  96 +
  97 + @ApiOperation(value = "修改楼层")
  98 + @PutMapping(value = "/edit")
  99 + public ResultJson editLocation(@RequestBody Location location){
  100 +
  101 + ResultJson resultJson = new ResultJson();
  102 +
  103 + if (locationMapper.updateByPrimaryKeySelective(location)>0){
  104 + resultJson.setCode("200");
  105 + }else {
  106 + resultJson.setCode("201");
  107 + }
  108 +
  109 + return resultJson;
  110 + }
  111 +}
1 package com.sunyo.energy.location.controller; 1 package com.sunyo.energy.location.controller;
2 2
3 import com.github.pagehelper.PageInfo; 3 import com.github.pagehelper.PageInfo;
  4 +import com.sunyo.energy.location.controller.response.ResultJson;
  5 +import com.sunyo.energy.location.dao.LocationMapper;
4 import com.sunyo.energy.location.model.PayRecords; 6 import com.sunyo.energy.location.model.PayRecords;
5 import com.sunyo.energy.location.model.WaterElectricityParameter; 7 import com.sunyo.energy.location.model.WaterElectricityParameter;
  8 +import com.sunyo.energy.location.service.LocationService;
6 import com.sunyo.energy.location.service.WaterElectricityParameterService; 9 import com.sunyo.energy.location.service.WaterElectricityParameterService;
  10 +import com.sunyo.energy.location.service.WaterMeterService;
7 import io.swagger.annotations.Api; 11 import io.swagger.annotations.Api;
8 import io.swagger.annotations.ApiOperation; 12 import io.swagger.annotations.ApiOperation;
9 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.web.bind.annotation.PostMapping;
10 import org.springframework.web.bind.annotation.RequestMapping; 15 import org.springframework.web.bind.annotation.RequestMapping;
11 import org.springframework.web.bind.annotation.RequestParam; 16 import org.springframework.web.bind.annotation.RequestParam;
12 import org.springframework.web.bind.annotation.RestController; 17 import org.springframework.web.bind.annotation.RestController;
@@ -19,14 +24,26 @@ import java.util.List; @@ -19,14 +24,26 @@ import java.util.List;
19 public class UserPayController { 24 public class UserPayController {
20 25
21 @Autowired 26 @Autowired
22 - private WaterElectricityParameterService waterElectricityParameterService; 27 + private LocationService locationService;
  28 +
  29 + @Autowired
  30 + private WaterMeterService waterMeterService;
23 31
24 @ApiOperation(value = "查询缴费订单") 32 @ApiOperation(value = "查询缴费订单")
25 @RequestMapping("/list") 33 @RequestMapping("/list")
26 public List userPayList(@RequestParam(value = "roomNumber", required = false) String roomNumber ){ 34 public List userPayList(@RequestParam(value = "roomNumber", required = false) String roomNumber ){
27 35
  36 + return locationService.userPayList(roomNumber);
  37 + }
  38 +
  39 + @ApiOperation(value = "充值水费")
  40 + @PostMapping("/add")
  41 + public ResultJson payWater(@RequestParam(value = "payFees", required = false) String payFees,
  42 + @RequestParam(value = "wmId", required = false) String wmId,
  43 + @RequestParam(value = "userId", required = false) String userId,
  44 + @RequestParam(value = "realName", required = false) String realName){
28 45
29 - return waterElectricityParameterService.userPayList(roomNumber); 46 + return waterMeterService.payWater(payFees, wmId, userId, realName);
30 } 47 }
31 48
32 } 49 }
@@ -3,6 +3,7 @@ package com.sunyo.energy.location.controller; @@ -3,6 +3,7 @@ package com.sunyo.energy.location.controller;
3 import com.sunyo.energy.location.controller.response.ResultJson; 3 import com.sunyo.energy.location.controller.response.ResultJson;
4 import com.sunyo.energy.location.model.WaterElectricityParameter; 4 import com.sunyo.energy.location.model.WaterElectricityParameter;
5 import com.sunyo.energy.location.service.WaterElectricityParameterService; 5 import com.sunyo.energy.location.service.WaterElectricityParameterService;
  6 +import io.swagger.annotations.ApiOperation;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Controller; 8 import org.springframework.stereotype.Controller;
8 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,10 +20,8 @@ public class WaterElectricityParameterController { @@ -19,10 +20,8 @@ public class WaterElectricityParameterController {
19 private WaterElectricityParameterService waterElectricityParameterService; 20 private WaterElectricityParameterService waterElectricityParameterService;
20 21
21 22
22 - /**  
23 - * 电表参数配置  
24 - *  
25 - */ 23 +
  24 + @ApiOperation(value = "电表参数配置")
26 @RequestMapping("/add") 25 @RequestMapping("/add")
27 @ResponseBody 26 @ResponseBody
28 public ResultJson eetParam(ResultJson resultJson, WaterElectricityParameter waterElectricityParameter){ 27 public ResultJson eetParam(ResultJson resultJson, WaterElectricityParameter waterElectricityParameter){
@@ -53,9 +52,7 @@ public class WaterElectricityParameterController { @@ -53,9 +52,7 @@ public class WaterElectricityParameterController {
53 52
54 } 53 }
55 54
56 - /**  
57 - * 电表参数查询  
58 - */ 55 + @ApiOperation(value = "电表参数查询")
59 @RequestMapping("/getEEModel") 56 @RequestMapping("/getEEModel")
60 @ResponseBody 57 @ResponseBody
61 public WaterElectricityParameter getEEModel(@RequestParam(value = "eeId", required = false) String eeId){ 58 public WaterElectricityParameter getEEModel(@RequestParam(value = "eeId", required = false) String eeId){
@@ -65,9 +62,7 @@ public class WaterElectricityParameterController { @@ -65,9 +62,7 @@ public class WaterElectricityParameterController {
65 62
66 } 63 }
67 64
68 - /**  
69 - * 电表参数编辑  
70 - */ 65 + @ApiOperation(value = "电表参数编辑")
71 @RequestMapping("/edit") 66 @RequestMapping("/edit")
72 @ResponseBody 67 @ResponseBody
73 public ResultJson edit(ResultJson resultJson, WaterElectricityParameter waterElectricityParameter){ 68 public ResultJson edit(ResultJson resultJson, WaterElectricityParameter waterElectricityParameter){
1 package com.sunyo.energy.location.controller; 1 package com.sunyo.energy.location.controller;
2 2
  3 +import com.github.pagehelper.Page;
  4 +import com.github.pagehelper.PageHelper;
  5 +import com.github.pagehelper.PageInfo;
3 import com.sunyo.energy.location.controller.response.ResultJson; 6 import com.sunyo.energy.location.controller.response.ResultJson;
  7 +import com.sunyo.energy.location.dao.WaterMeterMapper;
  8 +import com.sunyo.energy.location.model.Location;
4 import com.sunyo.energy.location.model.WaterElectricityParameter; 9 import com.sunyo.energy.location.model.WaterElectricityParameter;
5 import com.sunyo.energy.location.model.WaterMeter; 10 import com.sunyo.energy.location.model.WaterMeter;
6 import com.sunyo.energy.location.service.WaterMeterService; 11 import com.sunyo.energy.location.service.WaterMeterService;
  12 +import io.swagger.annotations.ApiOperation;
7 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Controller; 14 import org.springframework.stereotype.Controller;
9 import org.springframework.web.bind.annotation.RequestMapping; 15 import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RequestMethod;
10 import org.springframework.web.bind.annotation.RequestParam; 17 import org.springframework.web.bind.annotation.RequestParam;
11 import org.springframework.web.bind.annotation.ResponseBody; 18 import org.springframework.web.bind.annotation.ResponseBody;
12 19
  20 +import java.util.List;
  21 +
13 @Controller 22 @Controller
14 @RequestMapping("/water_meter") 23 @RequestMapping("/water_meter")
15 public class WaterMeterController { 24 public class WaterMeterController {
@@ -17,29 +26,8 @@ public class WaterMeterController { @@ -17,29 +26,8 @@ public class WaterMeterController {
17 @Autowired 26 @Autowired
18 private WaterMeterService waterMeterService; 27 private WaterMeterService waterMeterService;
19 28
20 -// /**  
21 -// * 水表实施信息入库  
22 -// * @param resultJson  
23 -// * @return  
24 -// */  
25 -// @RequestMapping("/realTime")  
26 -// @ResponseBody  
27 -// public ResultJson realTime(ResultJson resultJson){  
28 -// int i = waterMeterService.realTime();  
29 -// if (i>0){  
30 -// resultJson.setCode("200");  
31 -// resultJson.setMsg("操作成功");  
32 -// }else {  
33 -// resultJson.setCode("500");  
34 -// resultJson.setMsg("操作失败");  
35 -// }  
36 -//  
37 -// return resultJson;  
38 -// }  
39 29
40 - /**  
41 - * 水表单个实施信息查询  
42 - */ 30 + @ApiOperation(value = "水表单个实施信息查询")
43 @RequestMapping("/findRealTime") 31 @RequestMapping("/findRealTime")
44 @ResponseBody 32 @ResponseBody
45 public WaterMeter findRealTime(@RequestParam(value = "wmId", required = false) String wmId){ 33 public WaterMeter findRealTime(@RequestParam(value = "wmId", required = false) String wmId){
@@ -47,4 +35,12 @@ public class WaterMeterController { @@ -47,4 +35,12 @@ public class WaterMeterController {
47 return waterMeterService.findRealTime(wmId); 35 return waterMeterService.findRealTime(wmId);
48 } 36 }
49 37
  38 +
  39 +// @RequestMapping("/findRealTimes")
  40 +// @ResponseBody
  41 +// public void findRealTimes(){
  42 +//
  43 +// waterMeterService.realTime();
  44 +// }
  45 +
50 } 46 }
  1 +package com.sunyo.energy.location.dao;
  2 +
  3 +import com.sunyo.energy.location.model.Location;
  4 +import io.swagger.models.auth.In;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +public interface LocationMapper {
  11 + int deleteByPrimaryKey(Integer id);
  12 +
  13 + int insert(Location record);
  14 +
  15 + int insertSelective(Location record);
  16 +
  17 + List<Location> selectByPrimaryKey(Integer id);
  18 +
  19 + List<Location> selectAll(Integer id);
  20 +
  21 + List<Location> selectAllAdrName(String adrName);
  22 +
  23 + int updateByPrimaryKeySelective(Location record);
  24 +
  25 + int updateByPrimaryKey(Location record);
  26 +
  27 + Map<String, Object> userPayList(String roomNumber);
  28 +
  29 + String selectRoomNumber(String roomNumber);
  30 +
  31 + int countAdrName(Map<String, Object> map);
  32 +
  33 + int countParent(Integer id);
  34 +
  35 +}
@@ -21,5 +21,5 @@ public interface WaterElectricityParameterMapper { @@ -21,5 +21,5 @@ public interface WaterElectricityParameterMapper {
21 21
22 WaterElectricityParameter findOneElectricity(String eeId); 22 WaterElectricityParameter findOneElectricity(String eeId);
23 23
24 - List<WaterElectricityParameter> userPayList(String roomNumber); 24 +
25 } 25 }
1 package com.sunyo.energy.location.dao; 1 package com.sunyo.energy.location.dao;
2 2
3 import com.sunyo.energy.location.model.WaterMeter; 3 import com.sunyo.energy.location.model.WaterMeter;
  4 +import org.apache.ibatis.annotations.Param;
  5 +
  6 +import java.util.List;
4 7
5 public interface WaterMeterMapper { 8 public interface WaterMeterMapper {
6 int insert(WaterMeter record); 9 int insert(WaterMeter record);
7 10
8 int insertSelective(WaterMeter record); 11 int insertSelective(WaterMeter record);
  12 +
  13 + List<WaterMeter> selectAll();
  14 +
  15 + String findOneWmSacc(String wmId);
  16 +
  17 + int update(@Param(value = "wmId") String wmId,
  18 + @Param(value = "allSacc") String allSacc);
9 } 19 }
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +/**
  4 + * 获取电表余额/实时数据1
  5 + */
  6 +
  7 +import lombok.Data;
  8 +
  9 +@Data
  10 +public class ElectricityBalanceOne {
  11 +
  12 + private String errcode;
  13 +
  14 + private String errmessage;
  15 +
  16 + private ElectricityBalanceTwo data;
  17 +
  18 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 获取电表余额/实时数据3
  7 + */
  8 +@Data
  9 +public class ElectricityBalanceThree {
  10 +
  11 + private Integer deviceId;
  12 +
  13 + private Number totalEnergy;
  14 +
  15 + private Number tipEnergy;
  16 +
  17 + private Number peakEnergy;
  18 +
  19 + private Number valleyEnergy;
  20 +
  21 + private Number flatEnergy;
  22 +
  23 + private Number balance;
  24 +
  25 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 获取电表余额/实时数据2
  9 + */
  10 +@Data
  11 +public class ElectricityBalanceTwo {
  12 +
  13 + private Number actionTime;
  14 +
  15 + private List<ElectricityBalanceThree> datas;
  16 +
  17 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 获取设备实施通电状态 1
  7 + */
  8 +@Data
  9 +public class ElectricityDeviceOnAndOffOne {
  10 +
  11 + private String errcode;
  12 +
  13 + private String errmessage;
  14 +
  15 + private ElectricityDeviceOnAndOffTwo data;
  16 +
  17 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 获取设备实施通电状态 3
  7 + */
  8 +@Data
  9 +public class ElectricityDeviceOnAndOffThree {
  10 +
  11 + private Integer deviceId;
  12 +
  13 + // 0 未查询到 1:通电 2:断电
  14 + private Integer onAndOff;
  15 +
  16 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 获取设备实施通电状态 2
  9 + */
  10 +@Data
  11 +public class ElectricityDeviceOnAndOffTwo {
  12 +
  13 + private Number actionTime;
  14 +
  15 + private List<ElectricityDeviceOnAndOffThree> datas;
  16 +
  17 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 获取房间与楼层信息 1
  7 + */
  8 +@Data
  9 +public class ElectricityRoomDeviceOne {
  10 +
  11 + private String errcode;
  12 +
  13 + private String errmessage;
  14 +
  15 + private ElectricityRoomDeviceTwo data;
  16 +
  17 +
  18 +
  19 +
  20 +
  21 +
  22 +
  23 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 获取房间与楼层信息 3
  7 + */
  8 +@Data
  9 +public class ElectricityRoomDeviceThree {
  10 +
  11 + // 房间id
  12 + private Integer roomId;
  13 + // 房间名称
  14 + private String roomName;
  15 + // 设备id
  16 + private String deviceId;
  17 + // 设备名称
  18 + private String deviceName;
  19 + // 安装时间
  20 + private String startDate;
  21 +
  22 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 获取房间与楼层信息 2
  9 + */
  10 +@Data
  11 +public class ElectricityRoomDeviceTwo {
  12 +
  13 + private List<ElectricityRoomDeviceThree> datas;
  14 +}
  1 +package com.sunyo.energy.location.service;
  2 +
  3 +import java.util.List;
  4 +
  5 +public interface LocationService {
  6 +
  7 + List userPayList(String roomNumber);
  8 +
  9 +}
@@ -14,6 +14,5 @@ public interface WaterElectricityParameterService { @@ -14,6 +14,5 @@ public interface WaterElectricityParameterService {
14 14
15 WaterElectricityParameter findOneElectricity(String eeId); 15 WaterElectricityParameter findOneElectricity(String eeId);
16 16
17 - List userPayList(String roomNumber);  
18 17
19 } 18 }
1 package com.sunyo.energy.location.service; 1 package com.sunyo.energy.location.service;
2 2
3 3
  4 +import com.sunyo.energy.location.controller.response.ResultJson;
4 import com.sunyo.energy.location.model.WaterMeter; 5 import com.sunyo.energy.location.model.WaterMeter;
5 6
6 public interface WaterMeterService { 7 public interface WaterMeterService {
@@ -9,5 +10,7 @@ public interface WaterMeterService { @@ -9,5 +10,7 @@ public interface WaterMeterService {
9 10
10 WaterMeter findRealTime(String wmId); 11 WaterMeter findRealTime(String wmId);
11 12
  13 + ResultJson payWater(String payFees, String wmId, String userId, String realName);
  14 +
12 15
13 } 16 }
  1 +package com.sunyo.energy.location.service.imp;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.sunyo.energy.location.model.*;
  5 +import com.sunyo.energy.location.utils.HttpsUtils;
  6 +
  7 +import java.util.HashMap;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +public class ElectricityMeterServiceImp {
  12 +
  13 + // 获取房间与设备信息
  14 + private final static String electricityUrl = "/api/emcs/getRoomAndDevice";
  15 + // 获取所有电表实时通断电状态
  16 + private final static String electricityStatus = "/api/emcs/getAllDeviceControlStatus";
  17 + // 获取电表实时数据/余额
  18 + private final static String electricityBanlance = " /api/emcs/getEnergyInfoForRealTime";
  19 +
  20 + /**
  21 + * 电费查询
  22 + */
  23 + public Map<String, Object> electricityInfo(String roomNumber){
  24 + try {
  25 +
  26 + Map<String, Object> map = new HashMap<>();
  27 + // 获取设备id
  28 + String deviceId = deviceId(roomNumber);
  29 + // 获取设备 通电状态
  30 + Number onAndOff = onAndOff(deviceId);
  31 + // 获取设备余额
  32 + Number balance = balance(deviceId);
  33 +
  34 + map.put("deviceId", deviceId);
  35 + map.put("onAndOff", onAndOff);
  36 + map.put("balance", balance);
  37 +
  38 + return map;
  39 + }catch (Exception e){
  40 + e.printStackTrace();
  41 + return null;
  42 + }
  43 + }
  44 +
  45 + /**
  46 + * 获取设备id
  47 + * @param roomNumber
  48 + * @return
  49 + */
  50 + public String deviceId(String roomNumber){
  51 +
  52 + // 获取电表id
  53 + String electricityInfo = HttpsUtils.sendPostHttpRequest(electricityUrl, roomNumber);
  54 + // 所有电表房间与电表设备id
  55 + ElectricityRoomDeviceOne electricityTemporary = JSON.parseObject(electricityInfo, ElectricityRoomDeviceOne.class);
  56 + ElectricityRoomDeviceTwo electricityData = electricityTemporary.getData();
  57 + List<ElectricityRoomDeviceThree> electricityList = electricityData.getDatas();
  58 + for (ElectricityRoomDeviceThree electricity: electricityList){
  59 + if (roomNumber.equals(electricity.getRoomName())){
  60 + return electricity.getDeviceId();
  61 + }
  62 + }
  63 + return "";
  64 + }
  65 +
  66 + /**
  67 + * 获取电表实时通电状态
  68 + * @return
  69 + */
  70 + public Number onAndOff(String deviceId){
  71 + // 获取电表通电状态
  72 + String s = HttpsUtils.sendPostHttpRequest(electricityStatus, "");
  73 + ElectricityDeviceOnAndOffOne electricityDevice = JSON.parseObject(s, ElectricityDeviceOnAndOffOne.class);
  74 + ElectricityDeviceOnAndOffTwo data = electricityDevice.getData();
  75 + List<ElectricityDeviceOnAndOffThree> onAndOffStatus = data.getDatas();
  76 + for (ElectricityDeviceOnAndOffThree electricityOnAndOffStatus: onAndOffStatus){
  77 + if (deviceId.equals(electricityOnAndOffStatus.getDeviceId())){
  78 + return electricityOnAndOffStatus.getOnAndOff();
  79 + }
  80 + }
  81 + return 0;
  82 + }
  83 +
  84 + /**
  85 + * 获取设备余额
  86 + * @param deviceId
  87 + * @return
  88 + */
  89 + public Number balance(String deviceId){
  90 +
  91 + // 获取电表余额
  92 + String s1 = HttpsUtils.sendPostHttpRequest(electricityBanlance, "");
  93 + ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(s1, ElectricityBalanceOne.class);
  94 + ElectricityBalanceTwo data1 = electricityBalanceOne.getData();
  95 + List<ElectricityBalanceThree> electricityBalanceThreeList = data1.getDatas();
  96 + for (ElectricityBalanceThree electricityBalanceThree: electricityBalanceThreeList){
  97 + if (deviceId.equals(electricityBalanceThree.getDeviceId())){
  98 + return electricityBalanceThree.getBalance();
  99 + }
  100 + }
  101 + return 0;
  102 + }
  103 +
  104 +}
  1 +package com.sunyo.energy.location.service.imp;
  2 +
  3 +import com.sunyo.energy.location.dao.LocationMapper;
  4 +import com.sunyo.energy.location.service.LocationService;
  5 +import com.sunyo.energy.location.utils.AllUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +import org.springframework.util.StringUtils;
  9 +
  10 +import java.util.ArrayList;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
  14 +@Service
  15 +public class LocationServiceImp implements LocationService {
  16 +
  17 + @Autowired
  18 + private LocationMapper locationMapper;
  19 +
  20 + @Override
  21 + public List userPayList(String roomNumber) {
  22 +
  23 + try {
  24 + // 房间号如果为null 跳过
  25 + if (!StringUtils.isEmpty(roomNumber)){
  26 + List<Map<String, Object>> list = new ArrayList<>();
  27 + /**
  28 + * 水费查询
  29 + */
  30 + // 查询房间号 水表实施查询list
  31 + Map<String, Object> waterMap = locationMapper.userPayList(roomNumber);
  32 +
  33 + if (!StringUtils.isEmpty(waterMap.get("wmSacc").toString()) && !StringUtils.isEmpty( waterMap.get("wmLacc").toString())){
  34 + // 计算剩余量 充值量 减去 消费量 参数1 减去 参数2
  35 + String subtraction = AllUtils.nubmerSubtraction(waterMap.get("wmSacc").toString(), waterMap.get("wmLacc").toString());
  36 + // 余量
  37 + waterMap.put("subtraction", subtraction);
  38 + }
  39 + /**
  40 + * 电费查询
  41 + */
  42 +// ElectricityMeterServiceImp electricityMeterServiceImp = new ElectricityMeterServiceImp();
  43 +// // 获取 设备id 通电状态 余额
  44 +// Map<String, Object> electricityMap = electricityMeterServiceImp.electricityInfo(roomNumber);
  45 +//
  46 +// list.add(electricityMap);
  47 + list.add(waterMap);
  48 + return list;
  49 + }
  50 + return null;
  51 + }catch (Exception e){
  52 + e.printStackTrace();
  53 + return null;
  54 + }
  55 + }
  56 +}
@@ -45,9 +45,4 @@ public class WaterElectricityParameterServiceImp implements WaterElectricityPara @@ -45,9 +45,4 @@ public class WaterElectricityParameterServiceImp implements WaterElectricityPara
45 } 45 }
46 } 46 }
47 47
48 - @Override  
49 - public List userPayList(String roomNumber) {  
50 -  
51 - return waterElectricityParameterMapper.userPayList(roomNumber);  
52 - }  
53 } 48 }
@@ -2,13 +2,25 @@ package com.sunyo.energy.location.service.imp; @@ -2,13 +2,25 @@ package com.sunyo.energy.location.service.imp;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
  5 +import com.alibaba.fastjson.JSONObject;
  6 +import com.sun.xml.internal.ws.message.stream.PayloadStreamReaderMessage;
  7 +import com.sunyo.energy.location.controller.response.ResultJson;
  8 +import com.sunyo.energy.location.dao.LocationMapper;
  9 +import com.sunyo.energy.location.dao.PayRecordsMapper;
5 import com.sunyo.energy.location.dao.WaterMeterMapper; 10 import com.sunyo.energy.location.dao.WaterMeterMapper;
  11 +import com.sunyo.energy.location.model.PayRecords;
6 import com.sunyo.energy.location.model.WaterMeter; 12 import com.sunyo.energy.location.model.WaterMeter;
7 import com.sunyo.energy.location.service.WaterMeterService; 13 import com.sunyo.energy.location.service.WaterMeterService;
  14 +import com.sunyo.energy.location.utils.AllUtils;
8 import com.sunyo.energy.location.utils.HttpsUtils; 15 import com.sunyo.energy.location.utils.HttpsUtils;
  16 +import com.sunyo.energy.location.utils.PropertiesLoader;
  17 +import org.apache.catalina.loader.ParallelWebappClassLoader;
9 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.scheduling.annotation.Scheduled; 19 import org.springframework.scheduling.annotation.Scheduled;
11 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
  21 +
  22 +import javax.servlet.http.HttpSession;
  23 +import java.math.BigDecimal;
12 import java.util.Date; 24 import java.util.Date;
13 import java.util.HashMap; 25 import java.util.HashMap;
14 import java.util.Map; 26 import java.util.Map;
@@ -20,17 +32,29 @@ public class WaterMeterServiceImp implements WaterMeterService { @@ -20,17 +32,29 @@ public class WaterMeterServiceImp implements WaterMeterService {
20 @Autowired 32 @Autowired
21 private WaterMeterMapper waterMeterMapper; 33 private WaterMeterMapper waterMeterMapper;
22 34
  35 + @Autowired
  36 + private PayRecordsMapper payRecordsMapper;
  37 +
  38 + @Autowired
  39 + private LocationMapper locationMapper;
  40 + // 查询所有水表
  41 + private static final String selectUrl = "http://123.56.159.203:8023/nowwmrd/getSelectNowwmrdbyMtId";
  42 +
  43 + private static final String payUrl = "http://123.56.159.203:8023/mtfmset/allWMadd";
  44 +
  45 + private static final String addUrl = "http://123.56.159.203:8023/nowwmrd/getSelectNowwmrdbyProjectID";
  46 +
23 47
24 @Override 48 @Override
25 - @Scheduled(cron = "0 0 10 * * ?" ) 49 + @Scheduled(cron = "0 0 03 * * ?" )
26 public int realTime() { 50 public int realTime() {
27 51
28 try { 52 try {
29 - // 调用远程接口  
30 - String url = "http://123.56.159.203:8023/nowwmrd/getSelectNowwmrdbyProjectID"; 53 +
31 Map<String, Object> datas = new HashMap<>(); 54 Map<String, Object> datas = new HashMap<>();
32 datas.put("ProjectID", "33-99-00-00-00-00-01"); 55 datas.put("ProjectID", "33-99-00-00-00-00-01");
33 - String s = HttpsUtils.httpRequest(url, datas); 56 + // 远程调用
  57 + String s = HttpsUtils.httpRequest(addUrl, datas);
34 JSONArray jsonArray = JSON.parseArray(s); 58 JSONArray jsonArray = JSON.parseArray(s);
35 for (Object jsonObject:jsonArray){ 59 for (Object jsonObject:jsonArray){
36 WaterMeter waterMeter= new WaterMeter(); 60 WaterMeter waterMeter= new WaterMeter();
@@ -45,6 +69,7 @@ public class WaterMeterServiceImp implements WaterMeterService { @@ -45,6 +69,7 @@ public class WaterMeterServiceImp implements WaterMeterService {
45 waterMeter.setWmSignalpower(map.get("wm_signalpower").toString()); 69 waterMeter.setWmSignalpower(map.get("wm_signalpower").toString());
46 waterMeter.setWmVoltage(map.get("wm_voltage").toString()); 70 waterMeter.setWmVoltage(map.get("wm_voltage").toString());
47 waterMeter.setCreattime(new Date()); 71 waterMeter.setCreattime(new Date());
  72 + waterMeter.setReamke1(map.get("wm_sacc").toString());
48 waterMeterMapper.insertSelective(waterMeter); 73 waterMeterMapper.insertSelective(waterMeter);
49 }else { 74 }else {
50 if ("0".equals(map.get("state").toString())){ 75 if ("0".equals(map.get("state").toString())){
@@ -63,12 +88,10 @@ public class WaterMeterServiceImp implements WaterMeterService { @@ -63,12 +88,10 @@ public class WaterMeterServiceImp implements WaterMeterService {
63 @Override 88 @Override
64 public WaterMeter findRealTime(String wmId) { 89 public WaterMeter findRealTime(String wmId) {
65 try { 90 try {
66 - // 调用远程接口http://123.56.159.203:8023/nowwmrd/getSelectNowwmrdbyMtId?MtId=68-74-40-34-05-29-55  
67 - String url = "http://123.56.159.203:8023/nowwmrd/getSelectNowwmrdbyMtId";  
68 Map<String, Object> datas = new HashMap<>(); 91 Map<String, Object> datas = new HashMap<>();
69 datas.put("MtId", wmId); 92 datas.put("MtId", wmId);
70 93
71 - String s = HttpsUtils.httpRequest(url, datas); 94 + String s = HttpsUtils.httpRequest(selectUrl, datas);
72 JSONArray jsonArray = JSON.parseArray(s); 95 JSONArray jsonArray = JSON.parseArray(s);
73 WaterMeter waterMeter= new WaterMeter(); 96 WaterMeter waterMeter= new WaterMeter();
74 for (Object jsonObject:jsonArray){ 97 for (Object jsonObject:jsonArray){
@@ -91,4 +114,94 @@ public class WaterMeterServiceImp implements WaterMeterService { @@ -91,4 +114,94 @@ public class WaterMeterServiceImp implements WaterMeterService {
91 return new WaterMeter(); 114 return new WaterMeter();
92 } 115 }
93 } 116 }
  117 +
  118 + /**
  119 + * 水费充值 换算总水量 生成订单
  120 + * @param payFees
  121 + * @param wmId
  122 + * @param userId
  123 + * @param realName
  124 + * @return
  125 + */
  126 + @Override
  127 + public ResultJson payWater(String payFees, String wmId, String userId, String realName) {
  128 +
  129 + ResultJson<Object> resultJson = new ResultJson<>();
  130 + try {
  131 + // 得到请求接口 返回值 和总水量
  132 + Map<String, Object> map = allWater(payFees, wmId);
  133 +
  134 + Map hashMap = JSON.parseObject(map.get("status").toString(), HashMap.class);
  135 + if ("0".equals(hashMap.get("state").toString())){
  136 + int update = waterMeterMapper.update(wmId, map.get("allSacc").toString());
  137 + // 成功生成水费订单
  138 + PayRecords payRecords = payRecords(payFees, wmId, userId, realName);
  139 +
  140 + int i = payRecordsMapper.insertSelective(payRecords);
  141 + if (update > 0 && i >0){
  142 + resultJson.setCode("200");
  143 + }
  144 + }else {
  145 + resultJson.setCode("203");
  146 + }
  147 + return resultJson;
  148 + }catch (Exception e){
  149 + e.printStackTrace();
  150 + resultJson.setCode("203");
  151 + return resultJson;
  152 + }
  153 + }
  154 +
  155 + /**
  156 + * 总水量 换算
  157 + * @param payFees
  158 + * @param wmId
  159 + * @return
  160 + * @throws Exception
  161 + */
  162 + public Map<String, Object> allWater(String payFees, String wmId) throws Exception {
  163 +
  164 + // 充值最后立方水数值
  165 + String s = AllUtils.nubmerDivision(payFees);
  166 + // 查询累计充值量
  167 + String oneWmSacc = waterMeterMapper.findOneWmSacc(wmId);
  168 +
  169 + String allSacc = AllUtils.nubmerAdd(s, oneWmSacc);
  170 + Map<String, Object> datas = new HashMap<>();
  171 + datas.put("MtId", wmId);
  172 + datas.put("Add_sacc", allSacc);
  173 + datas.put("Add_addmode", "2");
  174 + String status = HttpsUtils.httpRequest(payUrl, datas);
  175 +
  176 + datas.put("allSacc",allSacc);
  177 + datas.put("status",status);
  178 +
  179 + return datas;
  180 + }
  181 +
  182 + /**
  183 + * 订单生成
  184 + * @param payFees
  185 + * @param wmId
  186 + * @param userId
  187 + * @param realName
  188 + * @return
  189 + */
  190 + public PayRecords payRecords(String payFees, String wmId, String userId, String realName){
  191 +
  192 + PayRecords payRecords = new PayRecords();
  193 + payRecords.setOrdernumber(AllUtils.getOrderIdByTime());
  194 + payRecords.setPayfees(Long.valueOf(payFees));
  195 + payRecords.setPaystatus(true);
  196 + payRecords.setPaytype(false);
  197 + payRecords.setReamke1("0");
  198 + payRecords.setPayuserid(Integer.valueOf(userId));
  199 + payRecords.setPaytime(new Date());
  200 + payRecords.setPayusername(realName);
  201 + payRecords.setPaytypeaddress(wmId);
  202 + String roomNumber = locationMapper.selectRoomNumber(wmId);
  203 + payRecords.setPaylocationname(roomNumber);
  204 +
  205 + return payRecords;
  206 + }
94 } 207 }
  1 +package com.sunyo.energy.location.utils;
  2 +
  3 +import java.math.BigDecimal;
  4 +import java.math.RoundingMode;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.Date;
  7 +import java.util.Random;
  8 +
  9 +public class AllUtils {
  10 +
  11 + // 数字相减 参数1 减去 参数2
  12 + public static String nubmerSubtraction(String sacc, String lacc){
  13 +
  14 + BigDecimal saccBigDecimal = new BigDecimal(sacc);
  15 + BigDecimal laccBigDecimal = new BigDecimal(lacc);
  16 +
  17 + String surplus = saccBigDecimal.subtract(laccBigDecimal).toString();
  18 +
  19 + return surplus;
  20 +
  21 + }
  22 +
  23 + // 数字相除 参数1 除以参数2
  24 + public static String nubmerDivision(String payFees){
  25 +
  26 + // 单价
  27 + String unitprice = PropertiesLoader.getUnitPrice("unitprice");
  28 + BigDecimal payFessDecimal = new BigDecimal(payFees);
  29 + BigDecimal unitpriceDecimal = new BigDecimal(unitprice);
  30 +
  31 + String s = payFessDecimal.divide(unitpriceDecimal, 2, RoundingMode.HALF_UP).toString();
  32 + return s;
  33 +
  34 + }
  35 +
  36 +
  37 + //数字相加 参数1加参数2
  38 + public static String nubmerAdd(String oneWmSacc, String s){
  39 +
  40 + BigDecimal bigDecimal = new BigDecimal(oneWmSacc);
  41 + BigDecimal bigDecimal1 = new BigDecimal(s);
  42 + String s1 = bigDecimal.add(bigDecimal1).toString();
  43 + return s1;
  44 + }
  45 +
  46 +
  47 + // 订单号生成 时间加随机数
  48 + public static String getOrderIdByTime() {
  49 + SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
  50 + String newDate=sdf.format(new Date());
  51 + String result="";
  52 + Random random=new Random();
  53 + for(int i=0;i<3;i++){
  54 + result+=random.nextInt(10);
  55 + }
  56 + return newDate+result;
  57 + }
  58 +
  59 +
  60 +}
  1 +package com.sunyo.energy.location.utils;
  2 +
  3 +
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +
  7 +import java.io.InputStream;
  8 +import java.util.Properties;
  9 +
  10 +
  11 +/**
  12 + * @description roperties属性文件加载
  13 + * @author gerry.zhang
  14 + * @date 2014-5-29
  15 + * @version 1.0
  16 + *
  17 + */
  18 +public class PropertiesLoader {
  19 +
  20 + private static final Logger logger = LoggerFactory.getLogger(PropertiesLoader.class);
  21 +
  22 + private static final String UNIT_PRICE = "/unitprice.properties";
  23 +
  24 +
  25 + /**
  26 + * load properties文件
  27 + * @param propertyFile
  28 + * @return
  29 + */
  30 + public static Properties loadProperty(String propertyFile){
  31 + InputStream in=PropertiesLoader.class.getResourceAsStream(propertyFile);
  32 + Properties properties = new Properties();
  33 + try{
  34 + properties.load(in);
  35 + }catch(Exception e){
  36 + logger.error("解析文件失败:文件名={}", propertyFile, e);
  37 + }
  38 + return properties;
  39 + }
  40 +
  41 +
  42 + public static String getUnitPrice(String key) {
  43 + Properties properties = PropertiesLoader.loadProperty(UNIT_PRICE);
  44 + return properties.getProperty(key);
  45 + }
  46 +
  47 +
  48 + public static String get(String key,String propertyFile){
  49 + Properties properties = loadProperty(propertyFile);
  50 + return (String) properties.get(key);
  51 + }
  52 +
  53 +
  54 +
  55 +
  56 +
  57 +}
@@ -25,6 +25,26 @@ ${AnsiColor.YELLOW} @@ -25,6 +25,26 @@ ${AnsiColor.YELLOW}
25 # # 25 # #
26 ##################################################### 26 #####################################################
27 27
  28 + .::::.
  29 + .::::::::.
  30 + :::::::::::
  31 + ..:::::::::::'
  32 + '::::::::::::'
  33 + .::::::::::
  34 + '::::::::::::::..
  35 + ..::::::::::::.
  36 + ``::::::::::::::::
  37 + ::::``:::::::::' .:::.
  38 + ::::' ':::::' .::::::::.
  39 + .::::' :::: .:::::::'::::.
  40 + .:::' ::::: .:::::::::' ':::::.
  41 + .::' :::::.:::::::::' ':::::.
  42 + .::' ::::::::::::::' ``::::.
  43 + ...::: ::::::::::::' ``::.
  44 + ```` ':. ':::::::::' ::::..
  45 + '.:::::' ':'````..
  46 + 不存在的 你看我美吗
  47 +
28 ================================================== 48 ==================================================
29 Application Info:${application.title} 49 Application Info:${application.title}
30 ver:${application.version} 50 ver:${application.version}
@@ -23,8 +23,50 @@ @@ -23,8 +23,50 @@
23 select 23 select
24 * 24 *
25 from location 25 from location
26 - where parent = #{parent,jdbcType=INTEGER} 26 + where
  27 + parent = #{id,jdbcType=INTEGER}
  28 + <!--<if test="_adrname != '' and _adrname != null " >-->
  29 + <!--or adrName = #{adrname, jdbcType=VARCHAR}-->
  30 + <!--</if>-->
27 </select> 31 </select>
  32 +
  33 + <select id="selectAllAdrName" resultMap="BaseResultMap" parameterType="java.lang.String" >
  34 + select
  35 + *
  36 + from location
  37 + where
  38 + adrName = #{adrname, jdbcType=VARCHAR}
  39 + </select>
  40 +
  41 + <select id="userPayList" resultType="java.util.HashMap">
  42 + select
  43 + wm.wm_id as wmId, wm.wm_fmstate as wmFmstate,
  44 + wm.wm_lacc as wmLacc, wm.wm_sacc as wmSacc
  45 + from
  46 + location lon
  47 + left join
  48 + water_meter wm on lon.wm_id = wm.wm_id
  49 + where
  50 + lon.adrName=#{value,jdbcType=VARCHAR}
  51 + </select>
  52 +
  53 + <select id="selectRoomNumber" parameterType="java.lang.String" resultType="java.lang.String">
  54 + select
  55 + adrName
  56 + from
  57 + location
  58 + where
  59 + wm_id = #{value, jdbcType=VARCHAR}
  60 + </select>
  61 +
  62 + <select id="countAdrName" resultType="int" parameterType="map">
  63 + select count(adrName) from location where adrName = #{adrName, jdbcType=VARCHAR} and parent = #{parent, jdbcType=VARCHAR}
  64 + </select>
  65 +
  66 + <select id="countParent" parameterType="int" resultType="int">
  67 + select count(parent) from location where parent = #{value}
  68 + </select>
  69 +
28 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > 70 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
29 delete from location 71 delete from location
30 where id = #{id,jdbcType=INTEGER} 72 where id = #{id,jdbcType=INTEGER}
@@ -42,13 +42,6 @@ @@ -42,13 +42,6 @@
42 from water_electricity_parameter where ee_id = #{value,jdbcType=VARCHAR} 42 from water_electricity_parameter where ee_id = #{value,jdbcType=VARCHAR}
43 </select> 43 </select>
44 44
45 - <select id="userPayList" parameterType="java.lang.String" resultMap="BaseResultMap">  
46 - select  
47 - <include refid="Base_Column_List" />  
48 - from water_electricity_parameter  
49 - where reamke2 = #{value,jdbcType=INTEGER}  
50 - </select>  
51 -  
52 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > 45 <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
53 delete from water_electricity_parameter 46 delete from water_electricity_parameter
54 where id = #{id,jdbcType=INTEGER} 47 where id = #{id,jdbcType=INTEGER}
@@ -29,6 +29,20 @@ @@ -29,6 +29,20 @@
29 #{updatetime,jdbcType=TIMESTAMP}, #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}, 29 #{updatetime,jdbcType=TIMESTAMP}, #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR},
30 #{reamke3,jdbcType=VARCHAR}, #{reamke4,jdbcType=VARCHAR}) 30 #{reamke3,jdbcType=VARCHAR}, #{reamke4,jdbcType=VARCHAR})
31 </insert> 31 </insert>
  32 +
  33 +
  34 + <select id="selectAll" resultMap="BaseResultMap">
  35 + select
  36 + *
  37 + from water_meter
  38 + order by wm_rdtime desc
  39 + </select>
  40 +
  41 +
  42 + <select id="findOneWmSacc" resultType="java.lang.String">
  43 + select reamke1 from water_meter where wm_id = #{value,jdbcType=VARCHAR}
  44 + </select>
  45 +
32 <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.WaterMeter" > 46 <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.WaterMeter" >
33 insert into water_meter 47 insert into water_meter
34 <trim prefix="(" suffix=")" suffixOverrides="," > 48 <trim prefix="(" suffix=")" suffixOverrides="," >
@@ -135,4 +149,10 @@ @@ -135,4 +149,10 @@
135 reamke3 = #{reamke3,jdbcType=VARCHAR}, 149 reamke3 = #{reamke3,jdbcType=VARCHAR},
136 reamke4 = #{reamke4,jdbcType=VARCHAR} 150 reamke4 = #{reamke4,jdbcType=VARCHAR}
137 </insert> 151 </insert>
  152 +
  153 + <update id="update" parameterType="java.lang.String">
  154 + update water_meter set reamke1 = #{allSacc,jdbcType=VARCHAR}
  155 + where wm_id = #{wmId, jdbcType=VARCHAR}
  156 + </update>
  157 +
138 </mapper> 158 </mapper>
  1 +# 水费单价
  2 +unitprice = 4.5