LiFei vor 3 Jahren
Ursprung
Commit
94addd7d66

+ 21 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/api/controller/HlwInvoiceController.java

@@ -77,4 +77,25 @@ public class HlwInvoiceController {
         return result;
     }
 
+
+    /**
+     * 申请开票
+     *
+     * @param json
+     * @return
+     */
+    @AutoLog(value = "申请开票")
+    @ApiOperation(value = "申请开票", notes = "申请开票")
+    @PostMapping(value = "/applyInvocie")
+    public Result<?> applyInvocie(@RequestBody String json) {
+        log.info("json========{}", json);
+        //数据解密
+        json = CryptTool.decode(json);
+        JSONObject jsonObject = JSONObject.parseObject(json);
+        //获取应用信息
+        OauthApplication oauthApplication = authService.getApplication(SecurityUtils.getClient());
+        jsonObject.put("applicationId", oauthApplication.getApplicationId());
+        Result<?> result = hlwInvoiceServiceClient.applyInvocie(jsonObject);
+        return result;
+    }
 }

+ 9 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/HlwInvoiceServiceClient.java

@@ -35,4 +35,13 @@ public interface HlwInvoiceServiceClient {
      */
     @PostMapping(value = "/wisdom/hlwInvoice/api/checkApply")
     Result<?> checkApply(JSONObject jsonObject);
+
+    /**
+     * 申请开票
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping(value = "/wisdom/hlwInvoice/api/applyInvocie")
+    Result<?> applyInvocie(JSONObject jsonObject);
 }

+ 5 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/fallback/HlwInvoiceServiceClientFallbackImpl.java

@@ -27,4 +27,9 @@ public class HlwInvoiceServiceClientFallbackImpl implements HlwInvoiceServiceCli
     public Result<?> checkApply(JSONObject jsonObject) {
         return Result.error("查询能否开票失败");
     }
+
+    @Override
+    public Result<?> applyInvocie(JSONObject jsonObject) {
+        return Result.error("查询申请开票失败");
+    }
 }

+ 33 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/api/controller/HlwInvoiceApiController.java

@@ -12,6 +12,8 @@ import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.util.businessAccountUtils;
 import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
 import org.jeecg.modules.hlwinvoice.service.IHlwInvoiceService;
+import org.jeecg.modules.hlwpayment.entity.HlwPaymentInvoice;
+import org.jeecg.modules.hlwpayment.service.IHlwPaymentInvoiceService;
 import org.jeecg.modules.hlwsubcontractor.entity.HlwSubcontractorAccountFlow;
 import org.jeecg.modules.hlwsubcontractor.service.IHlwSubcontractorAccountFlowService;
 import org.jeecg.modules.hlwuser.entity.HlwUser;
@@ -45,6 +47,8 @@ public class HlwInvoiceApiController extends JeecgController<HlwInvoice, IHlwInv
     private IHlwInvoiceService hlwInvoiceService;
     @Autowired
     private IHlwSubcontractorAccountFlowService hlwSubcontractorAccountFlowService;
+    @Autowired
+    private IHlwPaymentInvoiceService hlwPaymentInvoiceService;
 
 
 
@@ -86,6 +90,7 @@ public class HlwInvoiceApiController extends JeecgController<HlwInvoice, IHlwInv
     public Result<?> checkApply(@RequestBody JSONObject jsonObject) {
         Integer applicationId = jsonObject.getInteger("applicationId");
         JSONArray jsonArray = jsonObject.getJSONArray("idsList");
+        List<Integer> paymentIdList =new ArrayList<>();
         List<Integer> idsList=new ArrayList<>();
         for (int i = 0; i <jsonArray.size() ; i++) {
             idsList.add((Integer)jsonArray.get(i));
@@ -94,6 +99,8 @@ public class HlwInvoiceApiController extends JeecgController<HlwInvoice, IHlwInv
         hlwSubcontractorAccountFlow1.setIdsList(idsList);
         if (idsList.size() == 1) {
             //选择单个直接返回实体对象
+            paymentIdList.add(hlwSubcontractorAccountFlow1.getPaymentId());
+            hlwSubcontractorAccountFlow1.setPaymentIdList(paymentIdList);
             return Result.ok(hlwSubcontractorAccountFlow1);
         }
         Double totalPayment = 0.00;
@@ -122,13 +129,39 @@ public class HlwInvoiceApiController extends JeecgController<HlwInvoice, IHlwInv
                     }
                 }
             }
+            paymentIdList.add(hlwSubcontractorAccountFlow2.getPaymentId());
             totalPayment = businessAccountUtils.add(totalPayment, businessAccountUtils.add(hlwSubcontractorAccountFlow2.getAmount(),hlwSubcontractorAccountFlow2.getServiceFee()));
         }
         //将所有选择付款的金额总和存放到准备返回的对象里
         hlwSubcontractorAccountFlow1.setTotalPayment(totalPayment);
         hlwSubcontractorAccountFlow1.setServiceAmount(serviceAmount);
+        hlwSubcontractorAccountFlow1.setPaymentIdList(paymentIdList);
         //如果都相同则返回所需开票页面参数实体对象
         return Result.ok(hlwSubcontractorAccountFlow1);
     }
 
+
+    /**
+     * 申请开票
+     *
+     * @param jsonObject
+     * @return
+     */
+    @AutoLog(value = "申请开票")
+    @ApiOperation(value = "申请开票", notes = "申请开票")
+    @PostMapping(value = "/applyInvocie")
+    public Result<?> applyInvocie(@RequestBody JSONObject jsonObject) {
+        List<HlwPaymentInvoice> list=new ArrayList<>();
+        //获取请求参数
+        String createBy = jsonObject.getString("createBy");
+        JSONArray jsonArray = jsonObject.getJSONArray("idsList");
+        for (int i = 0; i <jsonArray.size() ; i++) {
+            HlwPaymentInvoice hlwPaymentInvoice=new HlwPaymentInvoice();
+            hlwPaymentInvoice.setCreateBy(createBy);
+            hlwPaymentInvoice.setPaymentId((Integer) jsonArray.get(i));
+            list.add(hlwPaymentInvoice);
+        }
+        hlwPaymentInvoiceService.saveBatch(list);
+       return Result.ok();
+    }
 }

+ 0 - 5
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwsubcontractor/controller/HlwSubcontractorAccountFlowController.java

@@ -182,14 +182,11 @@ public class HlwSubcontractorAccountFlowController extends JeecgController<HlwSu
 	 @PutMapping(value = "/invoicePayment")
 	 public Result<?> invoicePayment(@RequestBody HlwSubcontractorAccountFlow hlwSubcontractorAccountFlow) {
 		 List<Integer> idsList = hlwSubcontractorAccountFlow.getIdsList();
-		 List<Integer> paymentIdList =new ArrayList<>();
 		 if (idsList.size() > 0) {
 			 HlwSubcontractorAccountFlow hlwSubcontractorAccountFlow1 = hlwSubcontractorAccountFlowService.getHlwSubcontractorAccountFlowById(idsList.get(0));
 			 hlwSubcontractorAccountFlow1.setIdsList(hlwSubcontractorAccountFlow.getIdsList());
 			 if (idsList.size() == 1) {
 				 //选择单个直接返回实体对象
-				 paymentIdList.add(hlwSubcontractorAccountFlow1.getPaymentId());
-				 hlwSubcontractorAccountFlow1.setPaymentIdList(paymentIdList);
 				 return Result.ok(hlwSubcontractorAccountFlow1);
 			 }
 			 Double totalPayment = 0.00;
@@ -218,13 +215,11 @@ public class HlwSubcontractorAccountFlowController extends JeecgController<HlwSu
 						 }
 					 }
 				 }
-				 paymentIdList.add(hlwSubcontractorAccountFlow2.getPaymentId());
 				 totalPayment = businessAccountUtils.add(totalPayment, businessAccountUtils.add(hlwSubcontractorAccountFlow2.getAmount(),hlwSubcontractorAccountFlow2.getServiceFee()));
 			 }
 			 //将所有选择付款的金额总和存放到准备返回的对象里
 			 hlwSubcontractorAccountFlow1.setTotalPayment(totalPayment);
 			 hlwSubcontractorAccountFlow1.setServiceAmount(serviceAmount);
-			 hlwSubcontractorAccountFlow1.setPaymentIdList(paymentIdList);
 			 //如果都相同则返回所需开票页面参数实体对象
 			 return Result.ok(hlwSubcontractorAccountFlow1);
 		 }