Bläddra i källkod

* 功能优化

顾绍勇 4 år sedan
förälder
incheckning
fa1458b11a

+ 13
- 0
src/main/java/com/huiju/estateagents/common/CommonUtils.java Visa fil

@@ -68,6 +68,19 @@ public class CommonUtils {
68 68
      */
69 69
     public static Double fenToYuan(Integer money) {
70 70
         return Double.parseDouble(BigDecimal.valueOf(Long.valueOf(money)).divide(new BigDecimal(100)).toString());
71
+    }
71 72
 
73
+    /**
74
+     * double减法运算,防止直接相减失去精度
75
+     *
76
+     * @param m1 减数
77
+     * @param m2 被减数
78
+     * @return
79
+     */
80
+    public static Double subDouble(double m1, double m2) {
81
+        BigDecimal p1 = new BigDecimal(Double.toString(m1));
82
+        BigDecimal p2 = new BigDecimal(Double.toString(m2));
83
+        return p1.subtract(p2).doubleValue();
72 84
     }
85
+
73 86
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/excel/redPacket/AccountConsumeRecordExport.java Visa fil

@@ -42,6 +42,6 @@ public class AccountConsumeRecordExport {
42 42
     private String phone;
43 43
 
44 44
     @ColumnWidth(15)
45
-    @ExcelProperty(value = "消费状态", index = 5)
45
+    @ExcelProperty(value = "消费状态", index = 6)
46 46
     private String consumeStatus;
47 47
 }

+ 5
- 11
src/main/java/com/huiju/estateagents/excel/redPacket/RedPacketRankingListExport.java Visa fil

@@ -13,31 +13,25 @@ import lombok.Data;
13 13
 @Data
14 14
 public class RedPacketRankingListExport {
15 15
 
16
-
17
-    @ColumnWidth(15)
18
-    @ExcelProperty(value = "头像", index = 0)
19
-    private String avatarurl;
20
-
21
-
22 16
     @ColumnWidth(15)
23
-    @ExcelProperty(value = "昵称", index = 1)
17
+    @ExcelProperty(value = "昵称", index = 0)
24 18
     private String nickname;
25 19
 
26 20
 
27 21
     @ColumnWidth(15)
28
-    @ExcelProperty(value = "姓名", index = 2)
22
+    @ExcelProperty(value = "姓名", index = 1)
29 23
     private String name;
30 24
 
31 25
 
32 26
     @ColumnWidth(15)
33
-    @ExcelProperty(value = "手机号", index = 3)
27
+    @ExcelProperty(value = "手机号", index = 2)
34 28
     private String phone;
35 29
 
36 30
     @ColumnWidth(15)
37
-    @ExcelProperty(value = "发起时间", index = 4)
31
+    @ExcelProperty(value = "发起时间", index = 3)
38 32
     private String createDate;
39 33
 
40 34
     @ColumnWidth(15)
41
-    @ExcelProperty(value = "助力人数", index = 5)
35
+    @ExcelProperty(value = "助力人数", index = 4)
42 36
     private String votes;
43 37
 }

+ 6
- 12
src/main/java/com/huiju/estateagents/excel/redPacket/RedPacketVisitRecordtExport.java Visa fil

@@ -13,35 +13,29 @@ import lombok.Data;
13 13
 @Data
14 14
 public class RedPacketVisitRecordtExport {
15 15
 
16
-
17
-    @ColumnWidth(15)
18
-    @ExcelProperty(value = "头像", index = 0)
19
-    private String avatarurl;
20
-
21
-
22 16
     @ColumnWidth(15)
23
-    @ExcelProperty(value = "昵称", index = 1)
17
+    @ExcelProperty(value = "昵称", index = 0)
24 18
     private String nickname;
25 19
 
26 20
 
27 21
     @ColumnWidth(15)
28
-    @ExcelProperty(value = "姓名", index = 2)
22
+    @ExcelProperty(value = "姓名", index = 1)
29 23
     private String name;
30 24
 
31 25
 
32 26
     @ColumnWidth(15)
33
-    @ExcelProperty(value = "手机号", index = 3)
27
+    @ExcelProperty(value = "手机号", index = 2)
34 28
     private String phone;
35 29
 
36 30
     @ColumnWidth(15)
37
-    @ExcelProperty(value = "访问时间", index = 4)
31
+    @ExcelProperty(value = "访问时间", index = 3)
38 32
     private String createDate;
39 33
 
40 34
     @ColumnWidth(15)
41
-    @ExcelProperty(value = "分享人昵称", index = 5)
35
+    @ExcelProperty(value = "分享人昵称", index = 4)
42 36
     private String sharePersonNickName;
43 37
 
44 38
     @ColumnWidth(15)
45
-    @ExcelProperty(value = "分享人手机号", index = 6)
39
+    @ExcelProperty(value = "分享人手机号", index = 5)
46 40
     private String sharePersonPhone;
47 41
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgOrderServiceImpl.java Visa fil

@@ -171,7 +171,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
171 171
         }
172 172
 
173 173
         // 计算支付金额
174
-        Double realAmount = amount * (1 + CommConstant.WXMCH_PAY_RATE);
174
+        Double realAmount = Math.ceil(amount * (1 + CommConstant.WXMCH_PAY_RATE) * 100) / 100;
175 175
 
176 176
         // 1.创建订单主表信息
177 177
         TaOrgOrder taOrgOrder = new TaOrgOrder();
@@ -215,7 +215,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
215 215
         JSONObject obj = new JSONObject();
216 216
         obj.put("amount", amount);
217 217
         obj.put("realAmount", realAmount);
218
-        obj.put("serviceFee", amount * CommConstant.WXMCH_PAY_RATE);
218
+        obj.put("serviceFee", CommonUtils.subDouble(realAmount, amount));
219 219
         obj.put("mchPayRate", CommConstant.WXMCH_PAY_RATE_STRING);
220 220
         obj.put("payQrCode", payResult.getData());
221 221
         obj.put("orderInfo", taOrgOrder);

+ 7
- 5
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java Visa fil

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
16 16
 import org.springframework.web.bind.annotation.*;
17 17
 
18 18
 import javax.servlet.http.HttpServletRequest;
19
+import java.math.BigDecimal;
19 20
 import java.time.LocalDateTime;
20 21
 import java.util.List;
21 22
 
@@ -258,10 +259,11 @@ public class TaContactController extends BaseController {
258 259
 
259 260
     /**
260 261
      * 新增财务联系人
261
-     * @param id  实体ID
262
+     *
263
+     * @param id 实体ID
262 264
      */
263
-    @RequestMapping(value="/channel/taContactFinance/{id}",method= RequestMethod.PUT)
264
-    public ResponseBean taContactInfoAdd(@PathVariable Integer id){
265
+    @RequestMapping(value = "/channel/taContactFinance/{id}", method = RequestMethod.PUT)
266
+    public ResponseBean taContactInfoAdd(@PathVariable Integer id) {
265 267
         ResponseBean responseBean = new ResponseBean();
266 268
         try {
267 269
             TaContact taContact = new TaContact();
@@ -272,9 +274,9 @@ public class TaContactController extends BaseController {
272 274
             } else {
273 275
                 responseBean.addError("fail");
274 276
             }
275
-        }catch (Exception e){
277
+        } catch (Exception e) {
276 278
             e.printStackTrace();
277
-            logger.error("taContactInfoAdd -=- {}",e.toString());
279
+            logger.error("taContactInfoAdd -=- {}", e.toString());
278 280
             responseBean.addError(e.getMessage());
279 281
         }
280 282
         return responseBean;

+ 1
- 1
src/main/resources/mapper/redpack/TaRedPacketMapper.xml Visa fil

@@ -151,7 +151,7 @@
151 151
 
152 152
     <select id = "exportVisitRecordByCondition" resultType="com.huiju.estateagents.excel.redPacket.RedPacketVisitRecordtExport">
153 153
         SELECT
154
-        t.create_date
154
+        t.create_date,
155 155
         t2.nickname,
156 156
         t2.NAME,
157 157
         t2.avatarurl,

+ 1
- 1
src/main/resources/mapper/redpack/TaRedPacketPersonMapper.xml Visa fil

@@ -26,7 +26,7 @@
26 26
     <select id="exportRedPacketRankingList" resultType="com.huiju.estateagents.excel.redPacket.RedPacketRankingListExport">
27 27
         SELECT
28 28
             t.votes,
29
-            t.crate_date,
29
+            t.create_date,
30 30
             t2.phone,
31 31
             t2.NAME,
32 32
             t2.nickname nickname,