|
@@ -2,6 +2,8 @@ package com.ruoyi.finance.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ruoyi.approvalFlow.domain.AuditItems;
|
|
|
+import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
|
|
|
import com.ruoyi.basicData.domain.TCorps;
|
|
|
import com.ruoyi.basicData.domain.TFees;
|
|
|
import com.ruoyi.basicData.mapper.TCorpsMapper;
|
|
@@ -16,6 +18,8 @@ import com.ruoyi.finance.domain.TWareHouseFees;
|
|
|
import com.ruoyi.finance.mapper.TFeeDoMapper;
|
|
|
import com.ruoyi.finance.mapper.TFeeMapper;
|
|
|
import com.ruoyi.finance.service.ITFeeService;
|
|
|
+import com.ruoyi.system.domain.SysConfig;
|
|
|
+import com.ruoyi.system.mapper.SysConfigMapper;
|
|
|
import com.ruoyi.warehouseBusiness.domain.*;
|
|
|
import com.ruoyi.warehouseBusiness.mapper.BillnoDelMapper;
|
|
|
import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
|
|
@@ -61,6 +65,12 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
@Autowired
|
|
|
private TWarehousebillsfeesMapper tWarehousebillsfeesMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysConfigMapper sysConfigMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AuditItemsServiceImpl auditItemsService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询财务数据主
|
|
@@ -106,6 +116,7 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
map1.put("fFeeName",tFees.getfName());
|
|
|
map1.put("fSrcdc",fees.getfSrcdc());
|
|
|
map1.put("fAmt",fees.getfAmt());
|
|
|
+ map1.put("fAmtdr",fees.getfAmtdr());
|
|
|
if(tWarehousebills.getfBilltype().equals("SJRK")){
|
|
|
map1.put("fBilltype","入库");
|
|
|
} else if(tWarehousebills.getfBilltype().equals("SJCK")){
|
|
@@ -303,7 +314,7 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
// 删除从表
|
|
|
tFeeDoMapper.deleteByFPid(tFee.getfId());
|
|
|
// 财务从表
|
|
|
- if (StringUtils.isNotNull(tfeeDo)) {
|
|
|
+ if (StringUtils.isNotNull(tfeeDo) && !"[]".equals(tfeeDo)) {
|
|
|
JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
|
|
|
List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
|
|
|
for (TFeeDo tFeeDo : tFeeDoList) {
|
|
@@ -319,9 +330,51 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // 审批流程
|
|
|
-
|
|
|
- return AjaxResult.success();
|
|
|
+ // 这里加个判断取系统参数来确定是否需要启用审批流
|
|
|
+ String key = "";
|
|
|
+ boolean isApprove = false;
|
|
|
+ long actId = 0L;
|
|
|
+ if ("DZ".equals(fBilltype)) {
|
|
|
+ actId = 210L;
|
|
|
+ key = "warehouse.contrast.ApprovalFlow";
|
|
|
+ } else if ("SF".equals(fBilltype)) {
|
|
|
+ actId = 220L;
|
|
|
+ key = "warehouse.charge.ApprovalFlow";
|
|
|
+ } else if ("FF".equals(fBilltype)) {
|
|
|
+ actId = 230L;
|
|
|
+ key = "warehouse.payment.ApprovalFlow";
|
|
|
+ }
|
|
|
+ SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
|
|
|
+ if (StringUtils.isNull(sysConfig)) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("系统参数异常,未找到开启审批流参数");
|
|
|
+ }
|
|
|
+ if ("0".equals(sysConfig.getConfigValue())) {
|
|
|
+ isApprove = true;
|
|
|
+ }
|
|
|
+ if (isApprove) {
|
|
|
+ AuditItems auditItems = new AuditItems();
|
|
|
+ auditItems.setLevelId(0L);
|
|
|
+ auditItems.setBillId(tFee.getfId());
|
|
|
+ auditItems.setActId(actId);
|
|
|
+ auditItems.setIffinalItem("F");
|
|
|
+ auditItems.setBillNo(tFee.getfBillno()); // 业务编号
|
|
|
+ auditItems.setRefno1(tFee.getfBilltype()); // 财务类型
|
|
|
+ auditItems.setSendUserId(loginUser.getUser().getUserId());
|
|
|
+ auditItems.setSendName(loginUser.getUsername());
|
|
|
+ auditItems.setSendTime(new Date());
|
|
|
+ auditItems.setAuditUserId(loginUser.getUser().getUserId());
|
|
|
+ auditItems.setAuditItem(new Date());
|
|
|
+ auditItems.setAuditMsg("提交");
|
|
|
+ auditItems.setAuditStatus("O");
|
|
|
+ AjaxResult approvalFlow = auditItemsService.createApprovalFlow(auditItems);
|
|
|
+ Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
|
|
|
+ if (code.equals(500L)) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ }
|
|
|
+ return approvalFlow;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|