Browse Source

1.注释没有用到的代码

lisheng 3 days ago
parent
commit
81059d0149

+ 56 - 56
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/operate/PersonReimSyncQuotaTaskOp.java

@@ -61,62 +61,62 @@ public class PersonReimSyncQuotaTaskOp extends AbstractOperationServicePlugIn {
     }
     protected void doSyncPersonReim(DynamicObject billInfo){
         // 校验数据是否合格
-        DynamicObject user = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_USER);
-        DynamicObject org = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_ORG);
-        DynamicObject preOrg = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_ORG_PRE);
-        DynamicObject position = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_POSITIONHR);
-        DynamicObject prePosition = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_POSITIONHR_PRE);
-        DynamicObject jobLever = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_JOBLEVELHR);
-        DynamicObject preJobLever = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_JOBLEVELHR_PRE);
-
-        int year = billInfo.getInt(PersonReimSyncTaskConstant.KEY_NCKD_YEAR);
-        // 增加事务控制,如果发生异常,回滚生成的额度信息,保持数据一致
-        try(TXHandle h = TX.requiresNew(getClass().getName()+"doSyncPersonReim")){
-            try {
-                // 校验数据
-                checkData(billInfo);
-                // 获取总额度  费用项目、职级、岗位
-                Map<Long, Map<Long, BigDecimal>> currencyReimJobAmount = personReimQuotaHelper.getExpenseJobAmount(position.getPkValue(), jobLever.getPkValue());
-                // 判断组织是否存在便变更,组织变更则作废原组织
-                if(!org.getPkValue().equals(preOrg.getPkValue())){
-                    personReimQuotaHelper.doInvalidPersonReim(user.getLong(PersonReimSyncTaskConstant.ID),preOrg.getLong(PersonReimSyncTaskConstant.ID),null,null,year);
-                }
-
-                // 变更前岗位、职位为空,直接新增
-                if(prePosition == null || preJobLever == null){
-                    personReimQuotaHelper.createPersonReimDirect(billInfo,currencyReimJobAmount);
-                }else{
-                    Map<Long, Map<Long, BigDecimal>> sourceCurrencyReimJobAmount = personReimQuotaHelper.getExpenseJobAmount(prePosition.getPkValue(), preJobLever.getPkValue());
-                    Set<Long> invalidCurrencySet = sourceCurrencyReimJobAmount.keySet().stream()
-                            .filter(r -> !currencyReimJobAmount.keySet().contains(r)).collect(Collectors.toSet());
-                    // 作废已删除的币别数据
-                    logger.info(String.format("需要作废的币别ID为:" + StringUtils.join(",",invalidCurrencySet)));
-                    invalidCurrencySet.forEach(r -> personReimQuotaHelper.doInvalidPersonReim(user.getLong(PersonReimSyncTaskConstant.ID),org.getLong(PersonReimSyncTaskConstant.ID),null,r,year));
-                    for(Map.Entry<Long, Map<Long, BigDecimal>> currencyRow : currencyReimJobAmount.entrySet()){
-                        Long currencyId = currencyRow.getKey();
-                        Map<Long, BigDecimal> expenseJobAmount = currencyRow.getValue();
-                        if(sourceCurrencyReimJobAmount.containsKey(currencyId)){
-                            Set<Long> invalidExpenseSet = sourceCurrencyReimJobAmount.get(currencyId).keySet().stream()
-                                    .filter(r -> !expenseJobAmount.keySet().contains(r)).collect(Collectors.toSet());
-                            logger.info(String.format("需要作废的费用类型ID为:" + StringUtils.join(",",invalidExpenseSet)));
-                            invalidExpenseSet.forEach(r -> personReimQuotaHelper.doInvalidPersonReim(user.getLong(PersonReimSyncTaskConstant.ID),org.getLong(PersonReimSyncTaskConstant.ID),r,currencyId,year));
-                        }
-                        for(Map.Entry<Long, BigDecimal> dataRow : expenseJobAmount.entrySet()){
-                            Long expenseItemId = dataRow.getKey();
-                            BigDecimal amount = dataRow.getValue();
-                            personReimQuotaHelper.createPersonReimByExpense(billInfo,currencyId,expenseItemId,amount);
-                        }
-                    }
-                }
-                addRecord(billInfo,"创建成功。",Boolean.TRUE);
-            }catch (Exception e){
-                logger.error(String.format("单据%s同步额度失败",billInfo.getString(PersonReimSyncTaskConstant.KEY_NUMBER)),e);
-                String errorMsg = StringUtils.isEmpty(e.getMessage())?"同步额度时发生未知异常,请用traceid在monitor通过任务编码查看日志详情。":e.getMessage();
-                addRecord(billInfo,errorMsg,Boolean.FALSE);
-                h.markRollback();
-            }
-        }
-        SaveServiceHelper.save(new DynamicObject[]{billInfo});
+////        DynamicObject user = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_USER);
+////        DynamicObject org = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_ORG);
+////        DynamicObject preOrg = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_ORG_PRE);
+////        DynamicObject position = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_POSITIONHR);
+////        DynamicObject prePosition = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_POSITIONHR_PRE);
+////        DynamicObject jobLever = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_JOBLEVELHR);
+////        DynamicObject preJobLever = billInfo.getDynamicObject(PersonReimSyncTaskConstant.KEY_NCKD_JOBLEVELHR_PRE);
+////
+////        int year = billInfo.getInt(PersonReimSyncTaskConstant.KEY_NCKD_YEAR);
+////        // 增加事务控制,如果发生异常,回滚生成的额度信息,保持数据一致
+////        try(TXHandle h = TX.requiresNew(getClass().getName()+"doSyncPersonReim")){
+////            try {
+////                // 校验数据
+////                checkData(billInfo);
+////                // 获取总额度  费用项目、职级、岗位
+////                Map<Long, Map<Long, BigDecimal>> currencyReimJobAmount = personReimQuotaHelper.getExpenseJobAmount(position.getPkValue(), jobLever.getPkValue());
+////                // 判断组织是否存在便变更,组织变更则作废原组织
+////                if(!org.getPkValue().equals(preOrg.getPkValue())){
+////                    personReimQuotaHelper.doInvalidPersonReim(user.getLong(PersonReimSyncTaskConstant.ID),preOrg.getLong(PersonReimSyncTaskConstant.ID),null,null,year);
+////                }
+////
+////                // 变更前岗位、职位为空,直接新增
+////                if(prePosition == null || preJobLever == null){
+////                    personReimQuotaHelper.createPersonReimDirect(billInfo,currencyReimJobAmount);
+////                }else{
+////                    Map<Long, Map<Long, BigDecimal>> sourceCurrencyReimJobAmount = personReimQuotaHelper.getExpenseJobAmount(prePosition.getPkValue(), preJobLever.getPkValue());
+////                    Set<Long> invalidCurrencySet = sourceCurrencyReimJobAmount.keySet().stream()
+////                            .filter(r -> !currencyReimJobAmount.keySet().contains(r)).collect(Collectors.toSet());
+////                    // 作废已删除的币别数据
+////                    logger.info(String.format("需要作废的币别ID为:" + StringUtils.join(",",invalidCurrencySet)));
+////                    invalidCurrencySet.forEach(r -> personReimQuotaHelper.doInvalidPersonReim(user.getLong(PersonReimSyncTaskConstant.ID),org.getLong(PersonReimSyncTaskConstant.ID),null,r,year));
+////                    for(Map.Entry<Long, Map<Long, BigDecimal>> currencyRow : currencyReimJobAmount.entrySet()){
+////                        Long currencyId = currencyRow.getKey();
+////                        Map<Long, BigDecimal> expenseJobAmount = currencyRow.getValue();
+////                        if(sourceCurrencyReimJobAmount.containsKey(currencyId)){
+////                            Set<Long> invalidExpenseSet = sourceCurrencyReimJobAmount.get(currencyId).keySet().stream()
+////                                    .filter(r -> !expenseJobAmount.keySet().contains(r)).collect(Collectors.toSet());
+////                            logger.info(String.format("需要作废的费用类型ID为:" + StringUtils.join(",",invalidExpenseSet)));
+////                            invalidExpenseSet.forEach(r -> personReimQuotaHelper.doInvalidPersonReim(user.getLong(PersonReimSyncTaskConstant.ID),org.getLong(PersonReimSyncTaskConstant.ID),r,currencyId,year));
+////                        }
+////                        for(Map.Entry<Long, BigDecimal> dataRow : expenseJobAmount.entrySet()){
+////                            Long expenseItemId = dataRow.getKey();
+////                            BigDecimal amount = dataRow.getValue();
+////                            personReimQuotaHelper.createPersonReimByExpense(billInfo,currencyId,expenseItemId,amount);
+////                        }
+////                    }
+////                }
+//                addRecord(billInfo,"创建成功。",Boolean.TRUE);
+//            }catch (Exception e){
+//                logger.error(String.format("单据%s同步额度失败",billInfo.getString(PersonReimSyncTaskConstant.KEY_NUMBER)),e);
+//                String errorMsg = StringUtils.isEmpty(e.getMessage())?"同步额度时发生未知异常,请用traceid在monitor通过任务编码查看日志详情。":e.getMessage();
+//                addRecord(billInfo,errorMsg,Boolean.FALSE);
+//                h.markRollback();
+//            }
+//        }
+//        SaveServiceHelper.save(new DynamicObject[]{billInfo});
     }
 
 

+ 0 - 28
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/task/PersonReimBigJobTask.java

@@ -100,34 +100,6 @@ public class PersonReimBigJobTask extends AbstractTask {
      * @param jobId
      */
     protected void refreshPersonQuota(Long userId ,Long companyId , Long positionId,Long jobId) {
-        Map<Long, Map<Long, BigDecimal>> currencyReimJobAmount = getPersonReimQuotaHelper().getExpenseJobAmount(positionId, jobId);
-        for (Map.Entry<Long, Map<Long, BigDecimal>> currencyRow : currencyReimJobAmount.entrySet()) {
-            Long currencyId = currencyRow.getKey();
-            Map<Long, BigDecimal> expenseJobAmount = currencyRow.getValue();
-            for (Map.Entry<Long, BigDecimal> dataRow : expenseJobAmount.entrySet()) {
-                Long expenseItemId = dataRow.getKey();
-                BigDecimal amount = dataRow.getValue();
-
-                PersonReimQuotaVO quotaVO = new PersonReimQuotaVO(userId, companyId, expenseItemId, currencyId, amount);
-                quotaVO.setYear(CommonUtils.getDateFeild(new Date(), Calendar.YEAR));
-                // 更新下个月
-                quotaVO.setMonth(CommonUtils.getDateFeild(new Date(), Calendar.MONTH)+2);
-                // 创建个人额度表
-                DynamicObject personReim = getPersonReimQuotaHelper().createPersonReim(quotaVO,false);
-
-                if(personReim != null){
-                    // 调用审核
-                    OperationResult saveOp = OperationServiceHelper.executeOperate("save", BillTypeConstants.ER_REIMBURSEAMOUNT, new DynamicObject[]{personReim}, OperateOption.create());
-                    if (!saveOp.isSuccess() || saveOp.getSuccessPkIds().size() == 0) {
-                        throw new KDBizException(CommonUtils.getOperationResultErrorInfos(saveOp));
-                    }
-                    OperationResult approveOp = OperationServiceHelper.executeOperate("approve", BillTypeConstants.ER_REIMBURSEAMOUNT, new Object[]{saveOp.getSuccessPkIds().get(0)}, OperateOption.create());
-                    if (!approveOp.isSuccess() || approveOp.getSuccessPkIds().size() == 0) {
-                        throw new KDBizException(CommonUtils.getOperationResultErrorInfos(approveOp));
-                    }
-                }
 
-            }
-        }
     }
 }