Browse Source

四舍五入

夏文涛 2 years ago
parent
commit
7eba05883f

+ 7 - 9
.idea/workspace.xml

@@ -2,9 +2,7 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="33456f28-da03-4d10-99dd-fd9bd193cf84" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/repair/common/utils/TimeExchange.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/repair/common/utils/TimeExchange.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/repair/controller/RepairRecordController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/repair/controller/RepairRecordController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/target/repair_system-0.0.1-SNAPSHOT.jar.original" beforeDir="false" afterPath="$PROJECT_DIR$/target/repair_system-0.0.1-SNAPSHOT.jar.original" afterDir="false" />
     </list>
     <ignored path="$PROJECT_DIR$/out/" />
     <ignored path="$PROJECT_DIR$/target/" />
@@ -39,8 +37,8 @@
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/src/main/java/com/repair/controller/RepairRecordController.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="43">
-              <caret line="301" column="67" selection-start-line="301" selection-start-column="67" selection-end-line="301" selection-end-column="67" />
+            <state relative-caret-position="250">
+              <caret line="277" column="140" selection-start-line="277" selection-start-column="140" selection-end-line="277" selection-end-column="140" />
               <folding>
                 <element signature="imports" expanded="true" />
               </folding>
@@ -732,12 +730,12 @@
       <workItem from="1694155605252" duration="2798000" />
       <workItem from="1694483448254" duration="3243000" />
       <workItem from="1694575708078" duration="6153000" />
-      <workItem from="1694997999891" duration="27790000" />
+      <workItem from="1694997999891" duration="29438000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1077968000" />
+    <option name="totallyTimeSpent" value="1079616000" />
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
@@ -764,7 +762,7 @@
       <window_info content_ui="combo" id="Project" order="9" sideWeight="0.5021882" visible="true" weight="0.14765458" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" weight="0.32603937" />
-      <window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.51641136" />
+      <window_info anchor="bottom" id="Run" order="2" weight="0.51641136" />
       <window_info anchor="bottom" id="Event Log" order="3" weight="0.32822758" />
       <window_info anchor="bottom" id="Debug" order="4" weight="0.3501094" />
       <window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
@@ -1296,8 +1294,8 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/src/main/java/com/repair/controller/RepairRecordController.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="43">
-          <caret line="301" column="67" selection-start-line="301" selection-start-column="67" selection-end-line="301" selection-end-column="67" />
+        <state relative-caret-position="250">
+          <caret line="277" column="140" selection-start-line="277" selection-start-column="140" selection-end-line="277" selection-end-column="140" />
           <folding>
             <element signature="imports" expanded="true" />
           </folding>

+ 7 - 7
src/main/java/com/repair/controller/RepairRecordController.java

@@ -262,7 +262,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
                     rpr.setRecordId(rr.getId());
                     rpr.setUserId(rr.getUserId());
                     rpr.setPayNo(result.getNonce_str());
-                    System.out.println("回调的金额:"+result.getTotal_fee());
+                    System.out.println("回调的金额:" + result.getTotal_fee());
                     rpr.setPayPrice(new BigDecimal(result.getTotal_fee()).divide(new BigDecimal("100")).setScale(2));
                     rpr.setIsSuccess(ePayStatu.Paysuccess.getValue());
                     rpr.setRemark("微信支付支付成功");
@@ -274,8 +274,8 @@ public class RepairRecordController implements RepairRecordControllerAPI {
                     }
                 } else if (rpr.getIsSuccess() != ePayStatu.Paysuccess.getValue()) {
                     rpr.setPayNo(result.getNonce_str());
-                    System.out.println("回调的金额:"+result.getTotal_fee());
-                    rpr.setPayPrice(new BigDecimal(result.getTotal_fee()).divide(new BigDecimal("100")).setScale(2));
+                    System.out.println("回调的金额:" + result.getTotal_fee());
+                    rpr.setPayPrice(new BigDecimal(result.getTotal_fee()).divide(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP));
                     rpr.setIsSuccess(ePayStatu.Paysuccess.getValue());
                     rpr.setRemark(rpr.getRemark() + "微信支付支付成功");
                     int updateRpr = repairPayRecordService.updateRepairPayRecord(rpr);
@@ -299,7 +299,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
                 RepairTrackRecord rtr = new RepairTrackRecord();
                 rtr.setRecordId(rr.getId());
                 rtr.setMaintenanceState(eRecordStatu.Maintenance.getValue());
-                rtr.setContent("订单支付:"+rpr.getPayPrice().toString());
+                rtr.setContent("订单支付:" + rpr.getPayPrice().toString());
                 rtr.setUserId(rr.getUserId());
                 rtr.setUserZzstr("用户");
                 int insertRtr = repairTrackRecordService.insertRepairTrackRecord(rtr);
@@ -317,7 +317,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
         } catch (Exception e) {
             String returnMsg = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[MESSAGE]]></return_msg></xml>";
             response.getWriter().write(returnMsg);// 发送消息返回给微信
-            System.out.println("支付回调失败错误信息:"+ e.getMessage());
+            System.out.println("支付回调失败错误信息:" + e.getMessage());
             throw new Exception("支付回调失败!");
         }
     }
@@ -3877,7 +3877,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
 
             //查询用户的微校卡号
             RepairUser user = repairUserService.getRepairById(recordData.getUserId());
-            if(user == null){
+            if (user == null) {
                 throw new Exception("关单失败");
             }
             List<String> cardNumber = new ArrayList<>();
@@ -3967,7 +3967,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
             }
 
             RepairUser user = repairUserService.getRepairById(recordData.getUserId());
-            if(user == null){
+            if (user == null) {
                 throw new Exception("关单失败");
             }
             List<String> cardNumber = new ArrayList<>();