正在显示
10 个修改的文件
包含
132 行增加
和
13 行删除
@@ -48,8 +48,9 @@ public class PayOrderController { | @@ -48,8 +48,9 @@ public class PayOrderController { | ||
48 | @RequestParam(value = "orderNumber", required = false) String orderNumber, | 48 | @RequestParam(value = "orderNumber", required = false) String orderNumber, |
49 | @RequestParam(value = "payTime", required = false) String payTime, | 49 | @RequestParam(value = "payTime", required = false) String payTime, |
50 | @RequestParam(value = "username", required = false) String username, | 50 | @RequestParam(value = "username", required = false) String username, |
51 | - @RequestParam(value = "payType", required = false) String payType) { | ||
52 | - PageInfo<PayRecords> order = payOrderService.getOrder(pageSize, pageNum, orderNumber, payTime, username, payType); | 51 | + @RequestParam(value = "payType", required = false) String payType, |
52 | + @RequestParam(value = "paystatus", required = false) String paystatus) { | ||
53 | + PageInfo<PayRecords> order = payOrderService.getOrder(pageSize, pageNum, orderNumber, payTime, username, payType, paystatus); | ||
53 | return order; | 54 | return order; |
54 | } | 55 | } |
55 | 56 |
1 | +package com.sunyo.energy.location.dao; | ||
2 | + | ||
3 | +import com.sunyo.energy.location.model.ElectrifyInfo; | ||
4 | + | ||
5 | +public interface ElectrifyInfoMapper { | ||
6 | + int deleteByPrimaryKey(Integer id); | ||
7 | + | ||
8 | + int insert(ElectrifyInfo record); | ||
9 | + | ||
10 | + int insertSelective(ElectrifyInfo record); | ||
11 | + | ||
12 | + ElectrifyInfo selectByPrimaryKey(Integer id); | ||
13 | + | ||
14 | + int updateByPrimaryKeySelective(ElectrifyInfo record); | ||
15 | + | ||
16 | + int updateByPrimaryKey(ElectrifyInfo record); | ||
17 | +} |
@@ -22,7 +22,8 @@ public interface PayRecordsMapper { | @@ -22,7 +22,8 @@ public interface PayRecordsMapper { | ||
22 | @Param(value = "startTime") String startTime, | 22 | @Param(value = "startTime") String startTime, |
23 | @Param(value = "endTime") String endTime, | 23 | @Param(value = "endTime") String endTime, |
24 | @Param(value = "username") String username, | 24 | @Param(value = "username") String username, |
25 | - @Param(value = "payType") String payType); | 25 | + @Param(value = "payType") String payType, |
26 | + @Param(value = "paystatus") String paystatus); | ||
26 | 27 | ||
27 | String findOrderNumber(String orderId); | 28 | String findOrderNumber(String orderId); |
28 | 29 |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +public class ElectrifyInfo { | ||
4 | + private Integer id; | ||
5 | + | ||
6 | + private String deviceid; | ||
7 | + | ||
8 | + public Integer getId() { | ||
9 | + return id; | ||
10 | + } | ||
11 | + | ||
12 | + public void setId(Integer id) { | ||
13 | + this.id = id; | ||
14 | + } | ||
15 | + | ||
16 | + public String getDeviceid() { | ||
17 | + return deviceid; | ||
18 | + } | ||
19 | + | ||
20 | + public void setDeviceid(String deviceid) { | ||
21 | + this.deviceid = deviceid == null ? null : deviceid.trim(); | ||
22 | + } | ||
23 | +} |
@@ -7,7 +7,8 @@ import com.sunyo.energy.location.model.PayRecords; | @@ -7,7 +7,8 @@ import com.sunyo.energy.location.model.PayRecords; | ||
7 | * Created by XYH on 2019/12/16. | 7 | * Created by XYH on 2019/12/16. |
8 | */ | 8 | */ |
9 | public interface PayOrderService { | 9 | public interface PayOrderService { |
10 | - PageInfo<PayRecords> getOrder(int pageSize, int pageNum, String orderNumber, String payTime, String username, String payType); | 10 | + PageInfo<PayRecords> getOrder(int pageSize, int pageNum, String orderNumber, String payTime, |
11 | + String username, String payType, String paystatus); | ||
11 | 12 | ||
12 | int addOrder(PayRecords payRecords); | 13 | int addOrder(PayRecords payRecords); |
13 | 14 |
@@ -34,6 +34,9 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -34,6 +34,9 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
34 | @Autowired | 34 | @Autowired |
35 | USERSMapper usersMapper; | 35 | USERSMapper usersMapper; |
36 | 36 | ||
37 | + @Autowired | ||
38 | + ElectrifyInfoMapper electrifyInfoMapper; | ||
39 | + | ||
37 | 40 | ||
38 | /** | 41 | /** |
39 | * 获取电表实时数据/余额 | 42 | * 获取电表实时数据/余额 |
@@ -113,10 +116,24 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -113,10 +116,24 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
113 | if (energyInfoForRealTime.getBalance() != null){ | 116 | if (energyInfoForRealTime.getBalance() != null){ |
114 | int i = energyInfoForRealTime.getBalance().compareTo(BigDecimal.ZERO); | 117 | int i = energyInfoForRealTime.getBalance().compareTo(BigDecimal.ZERO); |
115 | if (i > 0){ | 118 | if (i > 0){ |
119 | + /** | ||
120 | + * 通知送电 | ||
121 | + */ | ||
116 | Map<String, Object> map = new HashMap<>(); | 122 | Map<String, Object> map = new HashMap<>(); |
117 | map.put("deviceId", deviceId); | 123 | map.put("deviceId", deviceId); |
118 | map.put("action", "1"); | 124 | map.put("action", "1"); |
119 | - HttpsUtils.sendPost(remoteControlDevices, map); | 125 | + String postResult = HttpsUtils.sendPost(remoteControlDevices, map); |
126 | + RechargeDevicesResult rechargeDevicesResult1 = JSON.parseObject(postResult, RechargeDevicesResult.class); | ||
127 | + if ("0".equals(rechargeDevicesResult1.getErrcode())){ | ||
128 | + // 成功不处理 | ||
129 | + log.info("送电成功------------------------"); | ||
130 | + }else { | ||
131 | + // 失败插入临时表 | ||
132 | + ElectrifyInfo electrifyInfo = new ElectrifyInfo(); | ||
133 | + electrifyInfo.setDeviceid(deviceId); | ||
134 | + electrifyInfoMapper.insertSelective(electrifyInfo); | ||
135 | + log.info("送电失败插入临时表-----------------------------"); | ||
136 | + } | ||
120 | } | 137 | } |
121 | } | 138 | } |
122 | return 1; | 139 | return 1; |
@@ -23,7 +23,8 @@ public class PayOrderImpl implements PayOrderService { | @@ -23,7 +23,8 @@ public class PayOrderImpl implements PayOrderService { | ||
23 | 23 | ||
24 | 24 | ||
25 | @Override | 25 | @Override |
26 | - public PageInfo<PayRecords> getOrder(int pageSize, int pageNum, String orderNumber, String payTime, String username, String payType) { | 26 | + public PageInfo<PayRecords> getOrder(int pageSize, int pageNum, String orderNumber, String payTime, |
27 | + String username, String payType, String paystatus) { | ||
27 | 28 | ||
28 | // 开始时间 | 29 | // 开始时间 |
29 | String startTime = ""; | 30 | String startTime = ""; |
@@ -40,9 +41,9 @@ public class PayOrderImpl implements PayOrderService { | @@ -40,9 +41,9 @@ public class PayOrderImpl implements PayOrderService { | ||
40 | List<PayRecords> list = new ArrayList<>(); | 41 | List<PayRecords> list = new ArrayList<>(); |
41 | if ("admin".equals(username)) { | 42 | if ("admin".equals(username)) { |
42 | username = ""; | 43 | username = ""; |
43 | - list = recordsMapper.findAll(orderNumber, startTime, endTime, username, payType); | 44 | + list = recordsMapper.findAll(orderNumber, startTime, endTime, username, payType, paystatus); |
44 | } else { | 45 | } else { |
45 | - list = recordsMapper.findAll(orderNumber, startTime, endTime, username, payType); | 46 | + list = recordsMapper.findAll(orderNumber, startTime, endTime, username, payType, paystatus); |
46 | } | 47 | } |
47 | 48 | ||
48 | 49 |
@@ -21,10 +21,7 @@ import org.springframework.stereotype.Service; | @@ -21,10 +21,7 @@ import org.springframework.stereotype.Service; | ||
21 | 21 | ||
22 | import java.io.UnsupportedEncodingException; | 22 | import java.io.UnsupportedEncodingException; |
23 | import java.math.BigDecimal; | 23 | import java.math.BigDecimal; |
24 | -import java.util.Date; | ||
25 | -import java.util.HashMap; | ||
26 | -import java.util.List; | ||
27 | -import java.util.Map; | 24 | +import java.util.*; |
28 | 25 | ||
29 | 26 | ||
30 | @Service | 27 | @Service |
@@ -282,7 +279,7 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -282,7 +279,7 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
282 | public PayRecords payRecords(String payFees, String wmId, String userId, String realName, String eeId) { | 279 | public PayRecords payRecords(String payFees, String wmId, String userId, String realName, String eeId) { |
283 | 280 | ||
284 | PayRecords payRecords = new PayRecords(); | 281 | PayRecords payRecords = new PayRecords(); |
285 | - payRecords.setOrdernumber(AllUtils.getOrderIdByTime()); | 282 | + payRecords.setOrdernumber(UUID.randomUUID().toString()); |
286 | payRecords.setPayfees(new BigDecimal(payFees)); | 283 | payRecords.setPayfees(new BigDecimal(payFees)); |
287 | payRecords.setPaystatus(false); | 284 | payRecords.setPaystatus(false); |
288 | if (!"".equals(wmId)) { | 285 | if (!"".equals(wmId)) { |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.sunyo.energy.location.dao.ElectrifyInfoMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectrifyInfo" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="deviceId" property="deviceid" jdbcType="VARCHAR" /> | ||
7 | + </resultMap> | ||
8 | + <sql id="Base_Column_List" > | ||
9 | + id, deviceId | ||
10 | + </sql> | ||
11 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | ||
12 | + select | ||
13 | + <include refid="Base_Column_List" /> | ||
14 | + from electrify_info | ||
15 | + where id = #{id,jdbcType=INTEGER} | ||
16 | + </select> | ||
17 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | ||
18 | + delete from electrify_info | ||
19 | + where id = #{id,jdbcType=INTEGER} | ||
20 | + </delete> | ||
21 | + <insert id="insert" parameterType="com.sunyo.energy.location.model.ElectrifyInfo" > | ||
22 | + insert into electrify_info (id, deviceId) | ||
23 | + values (#{id,jdbcType=INTEGER}, #{deviceid,jdbcType=VARCHAR}) | ||
24 | + </insert> | ||
25 | + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectrifyInfo" > | ||
26 | + insert into electrify_info | ||
27 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
28 | + <if test="id != null" > | ||
29 | + id, | ||
30 | + </if> | ||
31 | + <if test="deviceid != null" > | ||
32 | + deviceId, | ||
33 | + </if> | ||
34 | + </trim> | ||
35 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
36 | + <if test="id != null" > | ||
37 | + #{id,jdbcType=INTEGER}, | ||
38 | + </if> | ||
39 | + <if test="deviceid != null" > | ||
40 | + #{deviceid,jdbcType=VARCHAR}, | ||
41 | + </if> | ||
42 | + </trim> | ||
43 | + </insert> | ||
44 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectrifyInfo" > | ||
45 | + update electrify_info | ||
46 | + <set > | ||
47 | + <if test="deviceid != null" > | ||
48 | + deviceId = #{deviceid,jdbcType=VARCHAR}, | ||
49 | + </if> | ||
50 | + </set> | ||
51 | + where id = #{id,jdbcType=INTEGER} | ||
52 | + </update> | ||
53 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectrifyInfo" > | ||
54 | + update electrify_info | ||
55 | + set deviceId = #{deviceid,jdbcType=VARCHAR} | ||
56 | + where id = #{id,jdbcType=INTEGER} | ||
57 | + </update> | ||
58 | +</mapper> |
@@ -50,6 +50,9 @@ | @@ -50,6 +50,9 @@ | ||
50 | <if test="payType != '' and payType != null"> | 50 | <if test="payType != '' and payType != null"> |
51 | and payType = #{payType, jdbcType=BIT} | 51 | and payType = #{payType, jdbcType=BIT} |
52 | </if> | 52 | </if> |
53 | + <if test="paystatus != '' and paystatus != null"> | ||
54 | + and payStatus = #{paystatus, jdbcType=BIT} | ||
55 | + </if> | ||
53 | order by payTime desc | 56 | order by payTime desc |
54 | </select> | 57 | </select> |
55 | 58 |
-
请 注册 或 登录 后发表评论