|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package org.springblade.desk.oem.service.impl; |
|
|
|
package org.springblade.desk.oem.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists; |
|
|
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
@ -550,16 +551,30 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UpdateWrapper<OemStatementEntity> updateWrapper = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<OemStatementEntity> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 2026/5/15 |
|
|
|
|
|
|
|
* ●审核不通过:结算状态更新为【结算异常】-【异常原因:MES结算审核不通过】 |
|
|
|
|
|
|
|
* ●审核通过:结算状态更新为【待推送】 |
|
|
|
|
|
|
|
* */ |
|
|
|
if (3 == oemSettleAccountsApproval.getApprovalStatus()) { |
|
|
|
if (3 == oemSettleAccountsApproval.getApprovalStatus()) { |
|
|
|
//审核通过
|
|
|
|
//审核通过
|
|
|
|
updateWrapper.set("approval_status", OemStatementEntity.APPROVAL_STATUS_VIA).set("memo", "外协结算完成").set("ros_status", OemStatementEntity.OK_SETTLEMENT).in("id", ids); |
|
|
|
updateWrapper.set("approval_status", OemStatementEntity.APPROVAL_STATUS_VIA) |
|
|
|
|
|
|
|
.set("memo", "外协结算完成") |
|
|
|
|
|
|
|
.set("ros_status", OemStatementEntity.OK_SETTLEMENT) |
|
|
|
|
|
|
|
.in("id", ids); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//审核不通过:(1)原因为不需要结算的更新为【无需结算】(2)原因是基础数据有误的更新为【结算异常】
|
|
|
|
//审核不通过:(1)原因为不需要结算的更新为【无需结算】(2)原因是基础数据有误的更新为【结算异常】
|
|
|
|
if (1 == oemSettleAccountsApproval.getReason()) { |
|
|
|
if (1 == oemSettleAccountsApproval.getReason()) { |
|
|
|
updateWrapper.set("approval_status", OemStatementEntity.APPROVAL_STATUS_VIA).set("memo", "无需结算").set("total_price", null).set("unit_price", null).set("quotation", "").set("ros_status", OemStatementEntity.NOT_NEED_SETTLEMENT).in("id", ids); |
|
|
|
updateWrapper.set("approval_status", OemStatementEntity.APPROVAL_STATUS_VIA) |
|
|
|
|
|
|
|
.set("memo", "无需结算").set("total_price", null).set("unit_price", null) |
|
|
|
|
|
|
|
.set("quotation", "") |
|
|
|
|
|
|
|
.set("ros_status", OemStatementEntity.NOT_NEED_SETTLEMENT) |
|
|
|
|
|
|
|
.in("id", ids); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
updateWrapper.set("approval_status", OemStatementEntity.APPROVAL_STATUS_FAIL).set("memo", "基础数据有误").set("ros_status", OemStatementEntity.ERR_SETTLEMENT).in("id", ids); |
|
|
|
updateWrapper.set("approval_status", OemStatementEntity.APPROVAL_STATUS_FAIL) |
|
|
|
|
|
|
|
.set("memo", "基础数据有误") |
|
|
|
|
|
|
|
.set("ros_status", OemStatementEntity.ERR_SETTLEMENT) |
|
|
|
|
|
|
|
.in("id", ids); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1980,4 +1995,52 @@ public class OemStatementServiceImpl extends BaseServiceImpl<OemStatementMapper, |
|
|
|
return settlementList; |
|
|
|
return settlementList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R matchStandardProcessCode() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1. 查询所有【结算异常】状态的数据(带关联字段)
|
|
|
|
|
|
|
|
List<StatementVO> errorStatements = baseMapper.selectErrorStatements(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(errorStatements)) { |
|
|
|
|
|
|
|
return R.success("没有需要匹配的结算异常数据"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 过滤掉异常原因为"无需结算、重复镀后入库"的数据
|
|
|
|
|
|
|
|
List<StatementVO> needMatchList = errorStatements.stream() |
|
|
|
|
|
|
|
.filter(vo -> { |
|
|
|
|
|
|
|
String memo = vo.getMemo(); |
|
|
|
|
|
|
|
// 排除"无需结算"和"重复镀后入库"
|
|
|
|
|
|
|
|
return !StrUtil.contains(memo, "无需结算") |
|
|
|
|
|
|
|
&& !StrUtil.contains(memo, "重复镀后入库"); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(needMatchList)) { |
|
|
|
|
|
|
|
return R.success("没有需要匹配标准工序代码的数据"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 执行匹配逻辑
|
|
|
|
|
|
|
|
matchStandardProcess(needMatchList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 更新数据库
|
|
|
|
|
|
|
|
List<OemStatementEntity> updateList = needMatchList.stream() |
|
|
|
|
|
|
|
//.filter(vo -> StringUtils.isNotEmpty(vo.getStandardProcessCode()))
|
|
|
|
|
|
|
|
.map(vo -> { |
|
|
|
|
|
|
|
OemStatementEntity entity = new OemStatementEntity(); |
|
|
|
|
|
|
|
entity.setId(vo.getId()); |
|
|
|
|
|
|
|
entity.setStandardProcessCode(vo.getStandardProcessCode()); |
|
|
|
|
|
|
|
entity.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
return entity; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(updateList)) { |
|
|
|
|
|
|
|
this.updateBatchById(updateList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.success(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|