|
@@ -1,5 +1,6 @@
|
|
|
package com.qunzhixinxi.hnqz.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
@@ -370,8 +371,20 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
|
List<WmScorePackageSettleNote> notes = input.getNotes();
|
|
|
SubjectLocation location = input.getSubjectLocation();
|
|
|
|
|
|
- // 校验是否配置了结算限制
|
|
|
Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
+ if (SubjectLocation.MAH_SETTLE.equals(input.getSubjectLocation())) {
|
|
|
+ // 默认在当前企业,取一个结算渠道
|
|
|
+ SysDeptSub condition = new SysDeptSub();
|
|
|
+ condition.setDeptId(deptId);
|
|
|
+ condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
+ List<SysDeptSub> deptSubs = sysDeptSubService.list(Wrappers.query(condition));
|
|
|
+ if (CollUtil.isEmpty(deptSubs)) {
|
|
|
+ return R.failed("结算渠道不存在");
|
|
|
+ }
|
|
|
+ location = deptSubs.get(0).getSubjectLocation();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验是否配置了结算限制
|
|
|
SysDeptSub queryDeptSub = sysDeptSubService.getOne(Wrappers.<SysDeptSub>lambdaQuery()
|
|
|
.eq(SysDeptSub::getDeptId, SecurityUtils.getUser().getDeptId())
|
|
|
.eq(SysDeptSub::getSubjectLocation, location)
|
|
@@ -389,11 +402,12 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
|
BigDecimal total = monitoringIndicatorService.settleMonitoringIndicator(notes, location);
|
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
+ SubjectLocation finalLocation = location;
|
|
|
notes.forEach(note -> {
|
|
|
note.setUpdateTime(now);
|
|
|
note.setSubTime(now);
|
|
|
- note.setSubType(String.valueOf(location.getGigType().getCode()));
|
|
|
- note.setSubjectLocation(input.getSubjectLocation());
|
|
|
+ note.setSubType(String.valueOf(finalLocation.getGigType().getCode()));
|
|
|
+ note.setSubjectLocation(finalLocation);
|
|
|
note.setInvoiceType(input.getInvoiceCategory());
|
|
|
note.setCategoryName(input.getCategoryName());
|
|
|
if (null == note.getId()) {
|
|
@@ -408,7 +422,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
|
updateEntity.setSettleStatus(DingEnum.SETTLE_STATUS_WAIT.getType());
|
|
|
updateEntity.setScorePackageStatus("5");
|
|
|
updateEntity.setDescription(input.getDescription());
|
|
|
- updateEntity.setSubType(String.valueOf(location.getGigType().getCode()));
|
|
|
+ updateEntity.setSubType(String.valueOf(input.getSubjectLocation().getGigType().getCode()));
|
|
|
updateEntity.setLocation(input.getSubjectLocation());
|
|
|
updateEntity.setSettlementDate(LocalDateTime.now());
|
|
|
if (SubjectLocation.MAH_SETTLE.equals(input.getSubjectLocation())) {
|
|
@@ -444,7 +458,21 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
|
public R<?> settleSave(WmScorePackageSettleInput input) {
|
|
|
|
|
|
List<WmScorePackageSettleNote> notes = input.getNotes();
|
|
|
- SubjectLocation location = input.getSubjectLocation();
|
|
|
+ SubjectLocation location;
|
|
|
+
|
|
|
+ if (SubjectLocation.MAH_SETTLE.equals(input.getSubjectLocation())) {
|
|
|
+ // 默认在当前企业,取一个结算渠道
|
|
|
+ SysDeptSub condition = new SysDeptSub();
|
|
|
+ condition.setDeptId(SecurityUtils.getUser().getDeptId());
|
|
|
+ condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
+ List<SysDeptSub> deptSubs = sysDeptSubService.list(Wrappers.query(condition));
|
|
|
+ if (CollUtil.isEmpty(deptSubs)) {
|
|
|
+ return R.failed("结算渠道不存在");
|
|
|
+ }
|
|
|
+ location = deptSubs.get(0).getSubjectLocation();
|
|
|
+ } else {
|
|
|
+ location = input.getSubjectLocation();
|
|
|
+ }
|
|
|
|
|
|
// 校验人员信息
|
|
|
Set<Integer> userIds = notes.stream().map(WmScorePackageSettleNote::getUserId).map(Integer::valueOf).collect(Collectors.toSet());
|
|
@@ -458,7 +486,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
|
|
|
note.setUpdateTime(now);
|
|
|
note.setSubTime(now);
|
|
|
note.setSubType(String.valueOf(location.getGigType().getCode()));
|
|
|
- note.setSubjectLocation(input.getSubjectLocation());
|
|
|
+ note.setSubjectLocation(location);
|
|
|
note.setInvoiceType(input.getInvoiceCategory());
|
|
|
note.setCategoryName(input.getCategoryName());
|
|
|
if (null == note.getId()) {
|