Kaynağa Gözat

无票报销

chenyuesheng 2 yıl önce
ebeveyn
işleme
0f759116a4

+ 12 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementBusinessTwoController.java

@@ -56,11 +56,21 @@ public class AccountantReimbursementBusinessTwoController {
     @ApiLog("绑定")
     @RequestMapping("modifyBindCode")
     public ResponseEntity modifyBindCode(@RequestParam("ids")String ids,@RequestParam("businessCode")String businessCode,@RequestParam("money")String money){
+        String[] split = ids.split(",");
+        BigDecimal sum = new BigDecimal(0);
+        if(split.length!=0){
+            for (int i = 0; i < split.length; i++) {
+                AccountantReimbursementBusinessTwoDTO dataById = accountantReimbursementBusinessTwoService.findDataById(split[i]);
+                sum = sum.add(new BigDecimal(dataById.getReimbursementAmount()));
+            }
+        }else{
+            AccountantReimbursementBusinessTwoDTO dataById = accountantReimbursementBusinessTwoService.findDataById(ids);
+            sum = new BigDecimal(dataById.getReimbursementAmount());
+        }
         AccountantReimbursementDTO businessById = reimbursementBusinessService.getBusinessById(businessCode);
-        if(new BigDecimal(businessById.getCanReimbursementAmount()).compareTo(new BigDecimal(money))<0){
+        if(new BigDecimal(businessById.getCanReimbursementAmount()).compareTo(sum)<0){
             return ResponseEntity.ok(false);
         }
-        String[] split = ids.split(",");
         if(split.length!=0){
             for (int i = 0; i < split.length; i++) {
                 accountantReimbursementBusinessTwoService.modifyBindCode(split[i],businessCode);

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementBusinessTwoMapper.java

@@ -45,4 +45,6 @@ public interface AccountantReimbursementBusinessTwoMapper extends BaseMapper<Acc
     List<String> findSelectYearList();
 
     List<AccountantReimbursementDTO> findSelectCodeListByYear(String year);
+
+    AccountantReimbursementBusinessTwoDTO findDataById(@Param("id")String id);
 }

+ 7 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementBusinessTwoMapper.xml

@@ -106,6 +106,13 @@
         where year = #{year} and business_code is not null and business_code != '' and reimbursement_ratio is not null and reimbursement_ratio !=''
         group by business_code
     </select>
+    <select id="findDataById"
+            resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessTwoDTO">
+        select
+        <include refid="zsReimbursementBusinessAccountantInfoColumns"/>
+        from zs_reimbursement_business_accountant_info a
+        where id=#{id}
+    </select>
 
 
     <update id="delPhysicsById">

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementBusinessTwoService.java

@@ -24,4 +24,6 @@ public interface AccountantReimbursementBusinessTwoService {
     List<String> findSelectYearList();
 
     List<AccountantReimbursementDTO> findSelectCodeListByYear(String year);
+
+    AccountantReimbursementBusinessTwoDTO findDataById(String id);
 }

+ 5 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementBusinessTwoServiceImpl.java

@@ -70,4 +70,9 @@ public class AccountantReimbursementBusinessTwoServiceImpl implements Accountant
         });
         return selectCodeListByYear;
     }
+
+    @Override
+    public AccountantReimbursementBusinessTwoDTO findDataById(String id) {
+        return accountantReimbursementBusinessTwoMapper.findDataById(id);
+    }
 }