|
@@ -1,14 +1,31 @@
|
|
package cn.superdesk.uniorder.service.unified.settlement.impl;
|
|
package cn.superdesk.uniorder.service.unified.settlement.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
|
+import cn.superdesk.uniorder.common.enums.accounting.operator.SettlementRangeWayEnum;
|
|
|
|
+import cn.superdesk.uniorder.common.enums.accounting.operator.SettlementScopeEnum;
|
|
|
|
+import cn.superdesk.uniorder.common.enums.accounting.operator.SupnameDisplayRuleEnum;
|
|
|
|
+import cn.superdesk.uniorder.common.rest.response.R;
|
|
|
|
+import cn.superdesk.uniorder.common.sequence.GenRandomHelper;
|
|
import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme;
|
|
import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme;
|
|
|
|
+import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeRangeRule;
|
|
|
|
+import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeAmountRuleMapper;
|
|
import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeMapper;
|
|
import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeMapper;
|
|
|
|
+import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeRangeRuleMapper;
|
|
|
|
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
|
|
|
|
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementRangeRuleParam;
|
|
import cn.superdesk.uniorder.service.unified.settlement.UnifiedSettlementProgrammeService;
|
|
import cn.superdesk.uniorder.service.unified.settlement.UnifiedSettlementProgrammeService;
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -18,6 +35,10 @@ import java.util.Map;
|
|
public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementProgrammeService {
|
|
public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementProgrammeService {
|
|
private final UnifiedSettlementProgrammeMapper unifiedSettlementProgrammeMapper;
|
|
private final UnifiedSettlementProgrammeMapper unifiedSettlementProgrammeMapper;
|
|
|
|
|
|
|
|
+ private final UnifiedSettlementProgrammeAmountRuleMapper unifiedSettlementProgrammeAmountRuleMapper;
|
|
|
|
+
|
|
|
|
+ private final UnifiedSettlementProgrammeRangeRuleMapper unifiedSettlementProgrammeRangeRuleMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int insertSelective(UnifiedSettlementProgramme unifiedSettlementProgramme) {
|
|
public int insertSelective(UnifiedSettlementProgramme unifiedSettlementProgramme) {
|
|
return 0;
|
|
return 0;
|
|
@@ -47,4 +68,64 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
|
|
public PageInfo<UnifiedSettlementProgramme> findByPaging(Map<String, Object> params, Integer pageNo, Integer pageSize) {
|
|
public PageInfo<UnifiedSettlementProgramme> findByPaging(Map<String, Object> params, Integer pageNo, Integer pageSize) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ @Override
|
|
|
|
+ public R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId) {
|
|
|
|
+ //校验
|
|
|
|
+
|
|
|
|
+ UnifiedSettlementProgramme entity = new UnifiedSettlementProgramme();
|
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
|
+ entity.setCreateUserId(sysUserId);
|
|
|
|
+ entity.setCreateTime(new Date());
|
|
|
|
+ entity.setProgrammeNo("PR"+ DateUtil.format(new Date(), "yyyyMM")+ GenRandomHelper.genRandomNum(6) );
|
|
|
|
+ unifiedSettlementProgrammeMapper.insertSelective(entity);
|
|
|
|
+
|
|
|
|
+ if (param.getSettlementScope().intValue() == SettlementScopeEnum.部分订单不参与结算.getKey().intValue()
|
|
|
|
+ && CollectionUtils.isNotEmpty(param.getUnifiedSettlementRangeRuleParam1List())) {
|
|
|
|
+
|
|
|
|
+ //结算范围 部分订单不参与结算
|
|
|
|
+ for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
|
|
|
|
+ UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
|
|
|
|
+ rangeRule.setType(1);
|
|
|
|
+ rangeRule.setProgrammeId(entity.getId());
|
|
|
|
+ rangeRule.setDisplay(unifiedSettlementRangeRuleParam.getDisplay());
|
|
|
|
+ rangeRule.setCreateUserId(sysUserId);
|
|
|
|
+ rangeRule.setCreateTime(new Date());
|
|
|
|
+ rangeRule.setWay(unifiedSettlementRangeRuleParam.getWay());
|
|
|
|
+ rangeRule.setNotJoiningRange(unifiedSettlementRangeRuleParam.getNotJoiningRange());
|
|
|
|
+ rangeRule.setNotJoiningRangeJson(JSON.toJSONString(unifiedSettlementRangeRuleParam.getSysSelectVoList()));
|
|
|
|
+
|
|
|
|
+ unifiedSettlementProgrammeRangeRuleMapper.insertSelective(rangeRule);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (param.getSupnameDisplayRule().intValue() == SupnameDisplayRuleEnum.部分按原供应商名称导出.getKey().intValue()
|
|
|
|
+ && CollectionUtils.isNotEmpty(param.getUnifiedSettlementRangeRuleParam1List())) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
|
|
|
|
+ UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
|
|
|
|
+ rangeRule.setType(1);
|
|
|
|
+ rangeRule.setProgrammeId(entity.getId());
|
|
|
|
+ rangeRule.setDisplay(unifiedSettlementRangeRuleParam.getDisplay());
|
|
|
|
+ rangeRule.setCreateUserId(sysUserId);
|
|
|
|
+ rangeRule.setCreateTime(new Date());
|
|
|
|
+ rangeRule.setWay(unifiedSettlementRangeRuleParam.getWay());
|
|
|
|
+ rangeRule.setNotJoiningRange(unifiedSettlementRangeRuleParam.getNotJoiningRange());
|
|
|
|
+ rangeRule.setNotJoiningRangeJson(JSON.toJSONString(unifiedSettlementRangeRuleParam.getSysSelectVoList()));
|
|
|
|
+
|
|
|
|
+ unifiedSettlementProgrammeRangeRuleMapper.insertSelective(rangeRule);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //更改客户主体 结算方案已配置
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|