zhaoxian 2 anni fa
parent
commit
7038b70082

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/IFinancePaymentApplicationService.java

@@ -13,7 +13,7 @@ import org.jeecg.common.api.vo.Result;
  */
 public interface IFinancePaymentApplicationService extends IService<FinancePaymentApplication> {
 
-    void add(JSONObject request);
+    void add(JSONObject request) throws InterruptedException;
 
     Result<Object> getAdvertisers(String mediaType);
 
@@ -21,7 +21,7 @@ public interface IFinancePaymentApplicationService extends IService<FinancePayme
 
     Result<Object> updateStatus(FinancePaymentApplication application);
 
-    Result<Object> edit(FinancePaymentApplication application);
+    Result<Object> edit(FinancePaymentApplication application) throws InterruptedException;
 
     Result<Object> queryPoolInfo(String advertiserId, String productId, String type);
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/IFinancePaymentRechargeApplicationService.java

@@ -20,7 +20,7 @@ public interface IFinancePaymentRechargeApplicationService extends IService<Fina
 
     Result add(JSONObject data);
 
-    Result<Object> edit(JSONObject data);
+    Result<Object> edit(JSONObject data) throws InterruptedException;
 
     Result<Object> updateStatus(JSONObject data);
 

+ 26 - 32
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentApplicationServiceImpl.java

@@ -55,7 +55,7 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
     private IMessageTemplate messageTemplate;
 
     @Override
-    public void add(JSONObject request) {
+    public void add(JSONObject request) throws InterruptedException {
         FinancePaymentApplication application = JSONObject.parseObject(JSONObject.toJSONString(request), FinancePaymentApplication.class);
         SysUser user = userService.getById(application.getApplicanterId());
         if (!Check.isNull(user)) {
@@ -73,23 +73,22 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
         }
         //获取审核人
         getRevieweder(application);
+        //添加申请记录 0 创建
+        insertRecord(application.getId(), application.getApplicanterId(), "0", null, application.getFiles(), new Date());
+        Thread.sleep(100);
         //添加申请
-        boolean save = this.save(application);
-        if (save) {
-            //添加申请记录 0 创建
-            insertRecord(application.getId(), application.getApplicanterId(), "0", null, application.getFiles(), new Date());
-            //消息通知内容
-            String message = messageTemplate.getFinancePaymentApplicationMessage(application);
-            //审核人为 财务审核角色
-            if ("financialReview".equals(application.getReviewederId())) {
-                //roleID:32825ea6b43cb61bffa09bf05ad69cf2
-                List<SysUser> users = userService.getUserListByRoleId("32825ea6b43cb61bffa09bf05ad69cf2");
-                for (SysUser u : users) {
-                    sendMessageService.sendMessage(u.getId(), message);
-                }
-            } else {
-                sendMessageService.sendMessage(application.getReviewederId(), message);
+        this.save(application);
+        //消息通知内容
+        String message = messageTemplate.getFinancePaymentApplicationMessage(application);
+        //审核人为 财务审核角色
+        if ("financialReview".equals(application.getReviewederId())) {
+            //roleID:32825ea6b43cb61bffa09bf05ad69cf2
+            List<SysUser> users = userService.getUserListByRoleId("32825ea6b43cb61bffa09bf05ad69cf2");
+            for (SysUser u : users) {
+                sendMessageService.sendMessage(u.getId(), message);
             }
+        } else {
+            sendMessageService.sendMessage(application.getReviewederId(), message);
         }
     }
 
@@ -142,7 +141,7 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
     }
 
     @Override
-    public Result<Object> edit(FinancePaymentApplication application) {
+    public Result<Object> edit(FinancePaymentApplication application) throws InterruptedException {
         FinancePaymentApplication oldApplication = this.getById(application.getId());
         if (Check.isNull(oldApplication)) {
             return Result.error("未查询到申请");
@@ -157,13 +156,14 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
         if (!Check.isNull(advertiser)) {
             application.setAdvertiserName(advertiser.getName());
         }
-        //获取审核人
-        getRevieweder(application);
-        this.updateById(application);
         //添加拒绝记录
         insertRecord(application.getId(), oldApplication.getReviewederId(), oldApplication.getAuditStatus(), oldApplication.getApprovalContent(), oldApplication.getFiles(), oldApplication.getUpdateTime());
         //添加修改记录
         insertRecord(application.getId(), application.getApplicanterId(), "-1", null, application.getFiles(), new Date());
+        Thread.sleep(100);
+        //获取审核人
+        getRevieweder(application);
+        this.updateById(application);
         //消息通知内容
         String message = messageTemplate.getFinancePaymentApplicationMessage(application);
         //审核人为 财务审核角色
@@ -238,22 +238,16 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
             String paymentMedia = application.getPaymentMedia();//媒体类型 1-头条、2-快手、7-磁力金牛、9-广点通
             if ("7".equals(paymentMedia)) {
                 //吴睿刚(4aba62011120ac565c7f2b9f8f4aa96b)
-//TODO            application.setReviewederId("4aba62011120ac565c7f2b9f8f4aa96b");
-//                application.setRevieweder("吴睿刚");
-                application.setReviewederId("1b3deb8258e84df994f1371a51cfc14a");
-                application.setRevieweder("赵西安");
+                application.setReviewederId("4aba62011120ac565c7f2b9f8f4aa96b");
+                application.setRevieweder("吴睿刚");
             } else {
                 //临时垫款
                 if ("1".equals(application.getTemporaryAdvances())) {
-//TODO                    application.setReviewederId("b161b7d9793942f980dbfe8c931cd1b0");
-//                    application.setRevieweder("丁兆明");
-                    application.setReviewederId("1506873789009489921");
-                    application.setRevieweder("芮珊珊");
+                    application.setReviewederId("b161b7d9793942f980dbfe8c931cd1b0");
+                    application.setRevieweder("丁兆明");
                 } else {
-//TODO                    application.setReviewederId("00d630a129e4487cba5427788a1f08ce");
-//                    application.setRevieweder("赵旺");
-                    application.setReviewederId("113dee46c7df464da78c07a985e92cd1");
-                    application.setRevieweder("于蒙");
+                    application.setReviewederId("00d630a129e4487cba5427788a1f08ce");
+                    application.setRevieweder("赵旺");
                 }
             }
         }

+ 50 - 43
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentRechargeApplicationServiceImpl.java

@@ -85,37 +85,42 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
 
     @Override
     public Result add(JSONObject data) {
-        JSONArray list = data.getJSONArray("list");
-        FinancePaymentRechargeApplication recharge = JSONObject.parseObject(JSONObject.toJSONString(data), FinancePaymentRechargeApplication.class);
-        FinancePaymentPool pool = financePaymentPoolService.getIdByUniqueKey(recharge.getAdvertiserId(), recharge.getProductId(), recharge.getPaymentMedia());
-        if (Check.isNull(pool) || Check.isNull(list)) {
-            return Result.error("数据异常");
-        }
-        SysUser user = userService.getById(recharge.getApplicanterId());
-        if (!Check.isNull(user)) {
-            recharge.setApplicanter(user.getRealname());
-        }
-        Product product = productService.getById(recharge.getProductId());
-        if (!Check.isNull(product)) {
-            recharge.setProductName(product.getProductName());
-            data.put("productName", product.getProductName());
-        }
-        List<String> advertiserIds = Arrays.asList(recharge.getAdvertiserId().split(","));
-        Advertiser advertiser = advertiserService.getById(advertiserIds.get(0));
-        if (!Check.isNull(advertiser)) {
-            recharge.setAdvertiserName(advertiser.getName());
-            data.put("advertiserName", advertiser.getName());
-        }
-        Project project = projectService.getById(recharge.getProjectId());
-        if (!Check.isNull(project)) {
-            recharge.setProjectName(project.getProjectName());
-            data.put("projectName", project.getProjectName());
-        }
-        //判断审核人和状态
-        getReviewedRole(recharge);
-        recharge.setPoolId(pool.getId());
-        boolean save = this.save(recharge);
-        if (save) {
+        try {
+            JSONArray list = data.getJSONArray("list");
+            FinancePaymentRechargeApplication recharge = JSONObject.parseObject(JSONObject.toJSONString(data), FinancePaymentRechargeApplication.class);
+            FinancePaymentPool pool = financePaymentPoolService.getIdByUniqueKey(recharge.getAdvertiserId(), recharge.getProductId(), recharge.getPaymentMedia());
+            if (Check.isNull(pool) || Check.isNull(list)) {
+                return Result.error("数据异常");
+            }
+            SysUser user = userService.getById(recharge.getApplicanterId());
+            if (!Check.isNull(user)) {
+                recharge.setApplicanter(user.getRealname());
+            }
+            Product product = productService.getById(recharge.getProductId());
+            if (!Check.isNull(product)) {
+                recharge.setProductName(product.getProductName());
+                data.put("productName", product.getProductName());
+            }
+            List<String> advertiserIds = Arrays.asList(recharge.getAdvertiserId().split(","));
+            Advertiser advertiser = advertiserService.getById(advertiserIds.get(0));
+            if (!Check.isNull(advertiser)) {
+                recharge.setAdvertiserName(advertiser.getName());
+                data.put("advertiserName", advertiser.getName());
+            }
+            Project project = projectService.getById(recharge.getProjectId());
+            if (!Check.isNull(project)) {
+                recharge.setProjectName(project.getProjectName());
+                data.put("projectName", project.getProjectName());
+            }
+            //判断审核人和状态
+            getReviewedRole(recharge);
+            recharge.setPoolId(pool.getId());
+            //添加申请记录
+            insertRecord(recharge.getId(), recharge.getApplicanterId(), "0", null, recharge.getFiles(), new Date());
+
+            Thread.sleep(100);
+
+            this.save(recharge);
             //添加充值账户信息
             List<FinancePaymentRechargeAccount> accountList = new ArrayList<>();
             String accountIds = "";
@@ -137,8 +142,6 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
                 accountIds += obj.getLong("accountId") + ",";
             }
             rechargeAccountService.saveBatch(accountList);
-            //添加申请记录
-            insertRecord(recharge.getId(), recharge.getApplicanterId(), "0", null, recharge.getFiles(), new Date());
             //消息通知内容
             String message = null;
             List<SysUser> users = null;
@@ -155,12 +158,14 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
             for (SysUser u : users) {
                 sendMessageService.sendMessage(u.getId(), message);
             }
+        } catch (InterruptedException e) {
+            e.printStackTrace();
         }
         return Result.ok();
     }
 
     @Override
-    public Result<Object> edit(JSONObject data) {
+    public Result<Object> edit(JSONObject data) throws InterruptedException {
         JSONArray list = data.getJSONArray("list");
         FinancePaymentRechargeApplication recharge = JSONObject.parseObject(JSONObject.toJSONString(data), FinancePaymentRechargeApplication.class);
         FinancePaymentRechargeApplication oldRecharge = this.getById(recharge.getId());
@@ -191,6 +196,13 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
         //判断审核人和状态
         getReviewedRole(recharge);
         recharge.setPoolId(pool.getId());
+
+        //添 拒绝记录
+        insertRecord(recharge.getId(), oldRecharge.getReviewederId(), oldRecharge.getAuditStatus(), oldRecharge.getApprovalContent(), oldRecharge.getFiles(), oldRecharge.getUpdateTime());
+        //添加申请记录 -1 退回修改
+        insertRecord(recharge.getId(), recharge.getApplicanterId(), "-1", null, recharge.getFiles(), new Date());
+        Thread.sleep(100);
+
         this.updateById(recharge);
 
         //添加充值账户信息
@@ -215,10 +227,6 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
         }
         rechargeAccountService.delByRechargeId(recharge.getId());
         rechargeAccountService.saveBatch(accountList);
-        //添 拒绝记录
-        insertRecord(recharge.getId(), oldRecharge.getReviewederId(), oldRecharge.getAuditStatus(), oldRecharge.getApprovalContent(), oldRecharge.getFiles(), oldRecharge.getUpdateTime());
-        //添加申请记录 -1 退回修改
-        insertRecord(recharge.getId(), recharge.getApplicanterId(), "-1", null, recharge.getFiles(), new Date());
         //消息通知内容
         String message = null;
         List<SysUser> users = null;
@@ -252,8 +260,8 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
         if ("2".equals(auditStatus)) {
             recharge.setReviewederId("meidaManager");
             recharge.setRevieweder("-");
-
-            this.updateById(recharge);
+            //添加审核记录 1:财务审核完成
+            insertRecord(recharge.getId(), recharge.getUserId(), "6", recharge.getApprovalContent(), recharge.getFiles(), new Date());
             JSONObject oldData = JSONObject.parseObject(JSONObject.toJSONString(oldRecharge)).toJavaObject(JSONObject.class);
             JSONObject amount = rechargeAccountService.queryAmounts(recharge.getId());
             if (!Check.isNull(amount)) {
@@ -265,8 +273,7 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
             for (SysUser u : users) {
                 sendMessageService.sendMessage(u.getId(), message);
             }
-            //添加审核记录 1:财务审核完成
-            insertRecord(recharge.getId(), recharge.getUserId(), "6", recharge.getApprovalContent(), recharge.getFiles(), new Date());
+            this.updateById(recharge);
         } else if ("3".equals(auditStatus) || "4".equals(auditStatus)) {
             recharge.setReviewederId(recharge.getUserId());
             SysUser user = userService.getById(recharge.getUserId());
@@ -348,7 +355,7 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
     }
 
     private void insertRecord(Long rechargeId, String operatorId, String status, String txt, String files, Date time) {
-        if ("1".equals(status)||"2".equals(status)) {
+        if ("1".equals(status) || "2".equals(status)) {
             return;
         }
         FinancePaymentRechargeApplicationRecord record = new FinancePaymentRechargeApplicationRecord();