|
|
@@ -2,6 +2,7 @@ package com.ruoyi.finance.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.ruoyi.approvalFlow.domain.AuditItems;
|
|
|
import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
|
|
|
import com.ruoyi.basicData.domain.TCorps;
|
|
|
@@ -27,6 +28,8 @@ import com.ruoyi.reportManagement.dto.TWarehousebill;
|
|
|
import com.ruoyi.reportManagement.excel.Payable;
|
|
|
import com.ruoyi.reportManagement.excel.Profit;
|
|
|
import com.ruoyi.reportManagement.excel.Receivable;
|
|
|
+import com.ruoyi.shipping.domain.TFeeInvoice;
|
|
|
+import com.ruoyi.shipping.mapper.TFeeInvoiceMapper;
|
|
|
import com.ruoyi.system.domain.SysConfig;
|
|
|
import com.ruoyi.system.mapper.SysConfigMapper;
|
|
|
import com.ruoyi.system.service.ISysDictDataService;
|
|
|
@@ -87,6 +90,8 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
|
|
|
@Autowired
|
|
|
private ISysDictDataService iSysDictDataService;
|
|
|
+ @Autowired
|
|
|
+ private TFeeInvoiceMapper tFeeInvoiceMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -123,8 +128,14 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
TWarehouseBills tWarehousebills = tWarehouseBillsMapper.selectTWarehousebillsById(fees.getfSrcpid());
|
|
|
// 费用名称
|
|
|
TFees tFees= tFeesMapper.selectTFeesById(fees.getfFeeid());
|
|
|
+ if (tFees == null){
|
|
|
+ return AjaxResult.error("费用名称为空,请确认");
|
|
|
+ }
|
|
|
// 费用表数据
|
|
|
TWarehousebillsfees tWarehousebillsfees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesById(fees.getfSrcid());
|
|
|
+ if (tWarehousebillsfees == null){
|
|
|
+ return AjaxResult.error("费用数据为空,请确认");
|
|
|
+ }
|
|
|
// 字典宝
|
|
|
SysDictData sysDictData =new SysDictData();
|
|
|
sysDictData.setDictType("data_unitfees");
|
|
|
@@ -172,7 +183,11 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
map1.put("fFeeunitid",sysDictDataList.get(0).getDictLabel());
|
|
|
map1.put("fQty",tWarehousebillsfees.getfQty());
|
|
|
map1.put("fUnitprice",tWarehousebillsfees.getfUnitprice());
|
|
|
- map1.put("fBusinessType",sysDictDataListIn.get(0).getDictLabel());
|
|
|
+ if (tWarehousebillsfees.getfBilltype().equals("KHDD")){
|
|
|
+ map1.put("fBusinessType","船运订单");
|
|
|
+ }else {
|
|
|
+ map1.put("fBusinessType",sysDictDataListIn.get(0).getDictLabel());
|
|
|
+ }
|
|
|
if(tWarehousebills.getfBilltype().equals("SJRK")){
|
|
|
map1.put("fBilltype","入库");
|
|
|
} else if(tWarehousebills.getfBilltype().equals("SJCK")){
|
|
|
@@ -183,6 +198,8 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
map1.put("fBilltype","货物通关");
|
|
|
} else if(tWarehousebills.getfBilltype().equals("HQZY")){
|
|
|
map1.put("fBilltype","货权转移");
|
|
|
+ }else if(tWarehousebills.getfBilltype().equals("KHDD")){
|
|
|
+ map1.put("fBilltype","船运订单");
|
|
|
}
|
|
|
feeDoList.add(map1);
|
|
|
}
|
|
|
@@ -211,6 +228,20 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> selectTFeeByIdNew(Long fId) {
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ TFee tFee = tFeeMapper.selectTFeeByIdNew(fId);
|
|
|
+ List<TFeeDo> feeDoList = tFeeDoMapper.selectTFeeDoByfPid(fId);
|
|
|
+ TFeeInvoice tFeeInvoice = new TFeeInvoice();
|
|
|
+ tFeeInvoice.setfPid(fId);
|
|
|
+ List<TFeeInvoice> tFeeInvoiceList = tFeeInvoiceMapper.selectTFeeInvoiceList(tFeeInvoice);
|
|
|
+ map.put("tFee",tFee);
|
|
|
+ map.put("feeDoList",feeDoList);
|
|
|
+ map.put("tFeeInvoiceList",tFeeInvoiceList);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询财务数据主列表
|
|
|
*
|
|
|
@@ -263,15 +294,71 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
Date time = new Date();
|
|
|
String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
|
|
|
tFee.setfBillno(billNo);
|
|
|
+ tFee.setfBillstatus("2");
|
|
|
+ tFeeMapper.insertTFee(tFee);
|
|
|
+ fPid = tFee.getfId();
|
|
|
+ } else {
|
|
|
+ fPid = tFee.getfId();
|
|
|
+ tFee.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
+ tFee.setUpdateTime(new Date());
|
|
|
+ tFeeMapper.updateTFee(tFee);
|
|
|
+ // 删除从表
|
|
|
+ tFeeDoMapper.deleteByFPid(fPid);
|
|
|
+ }
|
|
|
+ // 财务从表
|
|
|
+ if (StringUtils.isNotNull(tfeeDo)) {
|
|
|
+ JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
|
|
|
+ List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
|
|
|
+ for (TFeeDo tFeeDo : tFeeDoList) {
|
|
|
+ tFeeDo.setfPid(fPid);
|
|
|
+ tFeeDo.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ tFeeDo.setCreateTime(new Date());
|
|
|
+ tFeeDo.setfStatus("2");
|
|
|
+ tFeeDoMapper.insertTFeeDo(tFeeDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("tFee", tFee);
|
|
|
+ return AjaxResult.success("成功", map);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 新增对账 、收费、
|
|
|
+ * @param tfee
|
|
|
+ * @param tfeeDo
|
|
|
+ * @param loginUser
|
|
|
+ * @param fBilltype
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo,String tFeeInvoice, LoginUser loginUser, String fBilltype) {
|
|
|
+ Long fPid = null;
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ TFee tFee = JSONArray.parseObject(tfee, TFee.class);
|
|
|
+ if (StringUtils.isNull(tFee.getfId())) {
|
|
|
+ // 如果是新数据
|
|
|
+ tFee.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ tFee.setCreateTime(new Date());
|
|
|
+ tFee.setfDeptid(loginUser.getUser().getDeptId());
|
|
|
+ tFee.setfBilltype(fBilltype);
|
|
|
+ // 业务编码
|
|
|
+ Date time = new Date();
|
|
|
+ String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
|
|
|
+ tFee.setfBillno(billNo);
|
|
|
+ tFee.setfBillstatus("2");
|
|
|
tFeeMapper.insertTFee(tFee);
|
|
|
fPid = tFee.getfId();
|
|
|
} else {
|
|
|
fPid = tFee.getfId();
|
|
|
+ boolean change = this.change(fPid);
|
|
|
+ if (!change){
|
|
|
+ return AjaxResult.error("当前数据不支持修改");
|
|
|
+ }
|
|
|
tFee.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
tFee.setUpdateTime(new Date());
|
|
|
tFeeMapper.updateTFee(tFee);
|
|
|
// 删除从表
|
|
|
tFeeDoMapper.deleteByFPid(fPid);
|
|
|
+ tFeeInvoiceMapper.deleteByFPid(fPid);
|
|
|
}
|
|
|
// 财务从表
|
|
|
if (StringUtils.isNotNull(tfeeDo)) {
|
|
|
@@ -281,9 +368,21 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
tFeeDo.setfPid(fPid);
|
|
|
tFeeDo.setCreateBy(loginUser.getUser().getUserName());
|
|
|
tFeeDo.setCreateTime(new Date());
|
|
|
+ tFeeDo.setfStatus("2");
|
|
|
tFeeDoMapper.insertTFeeDo(tFeeDo);
|
|
|
}
|
|
|
}
|
|
|
+ if (!"".equals(tFeeInvoice) && tFeeInvoice != null && !"null".equals(tFeeInvoice)) {
|
|
|
+ JSONArray jsonDrArray = JSONArray.parseArray(tFeeInvoice);
|
|
|
+ List<TFeeInvoice> tFeeInvoiceList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeInvoice.class);
|
|
|
+ for (TFeeInvoice feeInvoice : tFeeInvoiceList) {
|
|
|
+ feeInvoice.setfPid(fPid);
|
|
|
+ feeInvoice.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ feeInvoice.setCreateTime(new Date());
|
|
|
+ feeInvoice.setfBillstatus("2");
|
|
|
+ tFeeInvoiceMapper.insertTFeeInvoice(feeInvoice);
|
|
|
+ }
|
|
|
+ }
|
|
|
map.put("tFee", tFee);
|
|
|
return AjaxResult.success("成功", map);
|
|
|
}
|
|
|
@@ -338,9 +437,13 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("tWareHouseFees", tWareHouseFees);
|
|
|
List<Map<String, Object>> mapList =new ArrayList<>();
|
|
|
- if(billsType.equals("DZ")){
|
|
|
+ if(billsType.equals("DZ") ||billsType.equals("KHDZ")){
|
|
|
mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
|
|
|
- } else{
|
|
|
+ }else if (billsType.equals("invoiceFP")){
|
|
|
+ mapList = tFeeMapper.warehouseInvoiceFPFeesList(map);
|
|
|
+ }else if (billsType.equals("ApplyFP")){
|
|
|
+ mapList = tFeeMapper.warehouseApplyFPFeesList(map);
|
|
|
+ }else{
|
|
|
mapList = tFeeMapper.warehouseBillsFeesList(map);
|
|
|
/*if(tWareHouseFees.getfStatementNo()!=null && !tWareHouseFees.getfStatementNo().equals("")){
|
|
|
mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
|
|
|
@@ -371,14 +474,49 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public AjaxResult confirm(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
|
|
|
-
|
|
|
+ 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";
|
|
|
+ } else if ("KHDZ".equals(fBilltype)) {
|
|
|
+ actId = 430L;
|
|
|
+ key = "warehouse.kaiHeContrast.ApprovalFlow";
|
|
|
+ } else if ("KHSF".equals(fBilltype)) {
|
|
|
+ actId = 440L;
|
|
|
+ key = "warehouse.kaiHeCharge.ApprovalFlow";
|
|
|
+ }else if ("KHFF".equals(fBilltype)) {
|
|
|
+ actId = 450L;
|
|
|
+ key = "warehouse.kaiHePayment.ApprovalFlow";
|
|
|
+ }
|
|
|
+ SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
|
|
|
+ if (StringUtils.isNull(sysConfig)) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("系统参数异常,未找到开启审批流参数");
|
|
|
+ }
|
|
|
+ if ("0".equals(sysConfig.getConfigValue())) {
|
|
|
+ isApprove = true;
|
|
|
+ }
|
|
|
TFee tFee = JSONArray.parseObject(tfee, TFee.class);
|
|
|
- tFee.setfBillstatus("4");
|
|
|
+ String billstatus = "";
|
|
|
+ if (isApprove){
|
|
|
+ billstatus = "4";
|
|
|
+ }else {
|
|
|
+ billstatus = "6";
|
|
|
+ }
|
|
|
if (StringUtils.isNull(tFee.getfId())) {
|
|
|
// 如果是新数据
|
|
|
tFee.setCreateBy(loginUser.getUser().getUserName());
|
|
|
tFee.setfDeptid(loginUser.getUser().getDeptId());
|
|
|
tFee.setfBilltype(fBilltype);
|
|
|
+ tFee.setfBillstatus(billstatus);
|
|
|
// 业务编码
|
|
|
Date time = new Date();
|
|
|
String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
|
|
|
@@ -387,6 +525,7 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
} else {
|
|
|
tFee.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
tFee.setUpdateTime(new Date());
|
|
|
+ tFee.setfBillstatus(billstatus);
|
|
|
tFeeMapper.updateTFee(tFee);
|
|
|
// 删除从表
|
|
|
tFeeDoMapper.deleteByFPid(tFee.getfId());
|
|
|
@@ -399,13 +538,63 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
tFeeDo.setfPid(tFee.getfId());
|
|
|
tFeeDo.setCreateBy(loginUser.getUser().getUserName());
|
|
|
tFeeDo.setCreateTime(new Date());
|
|
|
+ tFeeDo.setfStatus(billstatus);
|
|
|
tFeeDoMapper.insertTFeeDo(tFeeDo);
|
|
|
}
|
|
|
}
|
|
|
// 这里加个判断取系统参数来确定是否需要启用审批流
|
|
|
+
|
|
|
+ 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(String.valueOf(tFee.getfCorpid())); // 货权方
|
|
|
+ auditItems.setRefno2(tFee.getfBilltype());// 财务类型
|
|
|
+ auditItems.setRefno3(tFee.gettMblno());// 提单号
|
|
|
+ auditItems.setSendUserId(loginUser.getUser().getUserId());
|
|
|
+ auditItems.setSendName(loginUser.getUsername());
|
|
|
+ auditItems.setSendTime(new Date());
|
|
|
+ auditItems.setAuditUserId(loginUser.getUser().getUserId());
|
|
|
+ auditItems.setAuditItem(new Date());
|
|
|
+ auditItems.setAuditOpTime(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;
|
|
|
+ }else {
|
|
|
+ if (StringUtils.isNotNull(tfeeDo) && !"[]".equals(tfeeDo)) {
|
|
|
+ JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
|
|
|
+ List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
|
|
|
+ for (TFeeDo tFeeDo : tFeeDoList) {
|
|
|
+ // 跟新费用明细
|
|
|
+ int m = updateBillsFees(tFee.getfId(),tFeeDo,fBilltype);
|
|
|
+ if (m == 0) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("更新费用明细失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ AjaxResult ajaxResult = tfeeFollow(tFee.getfId(), 6L);
|
|
|
+ Long code = Long.valueOf(String.valueOf(ajaxResult.get("code"))).longValue();
|
|
|
+ return ajaxResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult confirmKaiHe(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser, String fBilltype) {
|
|
|
+ Long fPid = null;
|
|
|
+ TFee tFee = JSONArray.parseObject(tfee, TFee.class);
|
|
|
String key = "";
|
|
|
boolean isApprove = false;
|
|
|
long actId = 0L;
|
|
|
+ String billStatus = "";
|
|
|
if ("DZ".equals(fBilltype)) {
|
|
|
actId = 210L;
|
|
|
key = "warehouse.contrast.ApprovalFlow";
|
|
|
@@ -415,6 +604,18 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
} else if ("FF".equals(fBilltype)) {
|
|
|
actId = 230L;
|
|
|
key = "warehouse.payment.ApprovalFlow";
|
|
|
+ } else if ("KHDZ".equals(fBilltype)) {
|
|
|
+ actId = 430L;
|
|
|
+ key = "warehouse.kaiHeContrast.ApprovalFlow";
|
|
|
+ } else if ("KHSF".equals(fBilltype)) {
|
|
|
+ actId = 440L;
|
|
|
+ key = "warehouse.kaiHeCharge.ApprovalFlow";
|
|
|
+ }else if ("KHFF".equals(fBilltype)) {
|
|
|
+ actId = 450L;
|
|
|
+ key = "warehouse.kaiHePayment.ApprovalFlow";
|
|
|
+ }else if ("ApplyFP".equals(fBilltype)) {
|
|
|
+ actId = 470L;
|
|
|
+ key = "warehouse.kaiHeApplyFP.ApprovalFlow";
|
|
|
}
|
|
|
SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
|
|
|
if (StringUtils.isNull(sysConfig)) {
|
|
|
@@ -424,6 +625,62 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
if ("0".equals(sysConfig.getConfigValue())) {
|
|
|
isApprove = true;
|
|
|
}
|
|
|
+ if (isApprove){
|
|
|
+ billStatus = "4";
|
|
|
+ }else {
|
|
|
+ billStatus ="6";
|
|
|
+ }
|
|
|
+ if (StringUtils.isNull(tFee.getfId())) {
|
|
|
+ // 如果是新数据
|
|
|
+ tFee.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ tFee.setfDeptid(loginUser.getUser().getDeptId());
|
|
|
+ tFee.setfBilltype(fBilltype);
|
|
|
+ // 业务编码
|
|
|
+ Date time = new Date();
|
|
|
+ String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
|
|
|
+ tFee.setfBillno(billNo);
|
|
|
+ tFee.setfBillstatus(billStatus);
|
|
|
+ tFeeMapper.insertTFee(tFee);
|
|
|
+ fPid = tFee.getfId();
|
|
|
+ } else {
|
|
|
+ fPid = tFee.getfId();
|
|
|
+ boolean change = this.change(fPid);
|
|
|
+ if (!change){
|
|
|
+ return AjaxResult.error("当前数据不支持修改");
|
|
|
+ }
|
|
|
+ tFee.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
+ tFee.setUpdateTime(new Date());
|
|
|
+ tFee.setfBillstatus(billStatus);
|
|
|
+ tFeeMapper.updateTFee(tFee);
|
|
|
+ // 删除从表
|
|
|
+ tFeeDoMapper.deleteByFPid(tFee.getfId());
|
|
|
+ //删除开票从表
|
|
|
+ tFeeInvoiceMapper.deleteByFPid(tFee.getfId());
|
|
|
+ }
|
|
|
+ // 财务从表
|
|
|
+ if (StringUtils.isNotNull(tfeeDo) && !"[]".equals(tfeeDo)) {
|
|
|
+ JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
|
|
|
+ List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
|
|
|
+ for (TFeeDo tFeeDo : tFeeDoList) {
|
|
|
+ tFeeDo.setfPid(tFee.getfId());
|
|
|
+ tFeeDo.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ tFeeDo.setCreateTime(new Date());
|
|
|
+ tFeeDo.setfStatus(billStatus);
|
|
|
+ tFeeDoMapper.insertTFeeDo(tFeeDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!"".equals(tFeeInvoice) && tFeeInvoice != null && !"null".equals(tFeeInvoice)) {
|
|
|
+ JSONArray jsonDrArray = JSONArray.parseArray(tFeeInvoice);
|
|
|
+ List<TFeeInvoice> tFeeInvoiceList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeInvoice.class);
|
|
|
+ for (TFeeInvoice feeInvoice : tFeeInvoiceList) {
|
|
|
+ feeInvoice.setfPid(fPid);
|
|
|
+ feeInvoice.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ feeInvoice.setCreateTime(new Date());
|
|
|
+ feeInvoice.setfBillstatus(billStatus);
|
|
|
+ tFeeInvoiceMapper.insertTFeeInvoice(feeInvoice);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 这里加个判断取系统参数来确定是否需要启用审批流
|
|
|
if (isApprove) {
|
|
|
AuditItems auditItems = new AuditItems();
|
|
|
auditItems.setLevelId(0L);
|
|
|
@@ -489,8 +746,20 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
try{
|
|
|
int itemUpdateResult = tFeeDoMapper.tfeeDoFollowUpdate(fPid,fettle);
|
|
|
} catch (Exception exception){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return AjaxResult.error("更新财务明细状态失败,请联系管理员");
|
|
|
}
|
|
|
+ TFeeInvoice invoice = new TFeeInvoice();
|
|
|
+ invoice.setfPid(fPid);
|
|
|
+ List<TFeeInvoice> tFeeInvoiceList = tFeeInvoiceMapper.selectTFeeInvoiceList(invoice);
|
|
|
+ if (CollectionUtils.isNotEmpty(tFeeInvoiceList)){
|
|
|
+ try{
|
|
|
+ int itemUpdateResult = tFeeInvoiceMapper.tFeeInvoiceUpdate(fPid,fettle);
|
|
|
+ } catch (Exception exception){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("更新开票明细状态失败,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@@ -561,6 +830,29 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult remove(Long fId) {
|
|
|
+ TFee tFee=tFeeMapper.selectTFeeById(fId);
|
|
|
+ if ("4".equals(tFee.getfBillstatus())){
|
|
|
+ return AjaxResult.error("数据已提交审批,暂不能删除");
|
|
|
+ }else if ("5".equals(tFee.getfBillstatus())){
|
|
|
+ return AjaxResult.error("数据正在审批,暂不能删除");
|
|
|
+ }else if ("6".equals(tFee.getfBillstatus())){
|
|
|
+ return AjaxResult.error("数据审批完成,不能删除");
|
|
|
+ }else {
|
|
|
+ try {
|
|
|
+ tFeeMapper.deleteTFeeById(fId);
|
|
|
+ tFeeDoMapper.deleteByFPid(fId);
|
|
|
+ tFeeInvoiceMapper.deleteByFPid(fId);
|
|
|
+ }catch (Exception e){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("删除失败,请找管理员");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<TWareHouseExcelItem> selectTWarehousebillsItemsList(Long fId) {
|
|
|
List<TWareHouseExcelItem> tWareHouseExcelItemList = tFeeMapper.selectTWarehousebillsItemsList(fId);
|
|
|
List<TWareHouseExcelItem> tWareHouseExcelItemList1 = new ArrayList<>();
|
|
|
@@ -690,7 +982,8 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
public int updateBillsFees(Long fid,TFeeDo tFeeDo,String billsType){
|
|
|
// 查询从表数据
|
|
|
TFee tFee=tFeeMapper.selectTFeeById(fid);
|
|
|
- if(billsType.equals("SF") || billsType.equals("FF")){
|
|
|
+ if(billsType.equals("SF") || billsType.equals("FF")
|
|
|
+ || billsType.equals("KHSF") || billsType.equals("KHFF")){
|
|
|
billsType="DC";
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
@@ -699,6 +992,18 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
map.put("tFeeDo", tFeeDo);
|
|
|
return tWarehousebillsfeesMapper.updateTWarehousebillsfee(map);
|
|
|
}
|
|
|
+ public boolean change(Long fId){
|
|
|
+ boolean flag = false;
|
|
|
+ TFee tFee = tFeeMapper.selectTFeeById(fId);
|
|
|
+ if ("4".equals(tFee.getfBillstatus())
|
|
|
+ || "5".equals(tFee.getfBillstatus())
|
|
|
+ ||"6".equals(tFee.getfBillstatus())){
|
|
|
+ flag = false;
|
|
|
+ }else {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|