|
@@ -167,6 +167,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
.divide(new BigDecimal(wmScorePackage.getTaskNum()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
query.setSettleAmount(amount);
|
|
|
query.setSubType(wmScorePackage.getSubType());
|
|
|
+ query.setSubjectLocation(wmScorePackage.getSubjectLocation());
|
|
|
}
|
|
|
query.setRealName(user.getRealname());
|
|
|
query.setIdCardNumber(user.getIdCardNumber());
|
|
@@ -183,20 +184,26 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
if (StringUtils.isEmpty(user.getIdCardNumber())) {
|
|
|
return R.failed(user.getRealname() + "未认证,不能发起结算");
|
|
|
}
|
|
|
- if ("0".equals(note.getSubType())) {
|
|
|
- if (!Objects.equals(user.getRljCertStatus(), DingEnum.CER_STATUS_1.getType())) {
|
|
|
- return R.failed(user.getRealname() + "未认证,不能发起结算");
|
|
|
- }
|
|
|
+
|
|
|
+ if (note.getSubjectLocation() == null) {
|
|
|
+ return R.failed(user.getRealname() + "人员结算渠道不存在,不能结算");
|
|
|
}
|
|
|
- if ("1".equals(note.getSubType())) {
|
|
|
- if (!Objects.equals(user.getCertStatus(), TaxHelperCertStatus.CERT.getCode())) {
|
|
|
- return R.failed(user.getRealname() + "人员未认证或未绑卡,不能结算");
|
|
|
- }
|
|
|
+
|
|
|
+ String subType = String.valueOf(note.getSubjectLocation().getGigType().getCode());
|
|
|
+
|
|
|
+ SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
|
+ .eq(SysUserSub::getSubjectLocation, note.getSubjectLocation())
|
|
|
+ .eq(SysUserSub::getDeptId, user.getDeptId())
|
|
|
+ .eq(SysUserSub::getUserId, user.getUserId())
|
|
|
+ );
|
|
|
+ if (userSub == null) {
|
|
|
+ return R.failed(user.getRealname() + "人员认证信息不存在,不能结算");
|
|
|
}
|
|
|
|
|
|
SysDeptSub condition = new SysDeptSub();
|
|
|
condition.setDeptId(user.getDeptId());
|
|
|
- condition.setSubjectType(note.getSubType());
|
|
|
+ condition.setSubjectType(subType);
|
|
|
+ condition.setSubjectLocation(note.getSubjectLocation());
|
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
|
|
|
@@ -212,13 +219,13 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
if (null != note.getId()) {
|
|
|
ids.add(note.getId());
|
|
|
}
|
|
|
- SettleAmountMonitorInput monitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, note.getSubType());
|
|
|
+ SettleAmountMonitorInput monitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, subType, note.getSubjectLocation());
|
|
|
List<SettleAmountMonitorOutput> monitorOutputList = sysDeptSubService.getSettleAmountMonitor(monitorInput);
|
|
|
|
|
|
- SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, note.getSubType());
|
|
|
+ SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, subType, note.getSubjectLocation());
|
|
|
List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
|
|
|
|
- SettleAmountMonitorInput yaoyiMonitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, note.getSubType());
|
|
|
+ SettleAmountMonitorInput yaoyiMonitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, subType, note.getSubjectLocation());
|
|
|
List<SettleAmountMonitorOutput> yaoyiAmountMonitor = sysDeptSubService.getYaoyiAmountMonitor(yaoyiMonitorInput);
|
|
|
|
|
|
SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
@@ -230,7 +237,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
SettleAmountMonitorOutput yaoyiMonitorOutput = yaoyiAmountMonitor.stream().filter(item -> item.getIdCardNumber()
|
|
|
.equals(user.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
|
|
- MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(note.getSubType());
|
|
|
+ MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(subType, note.getSubjectLocation());
|
|
|
BigDecimal deptLimit = sysDeptSub.getLimitAmount();
|
|
|
BigDecimal yaoyiLimit = monitoringIndicator.getYaoyiLimitAmount();
|
|
|
BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
@@ -266,7 +273,8 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
if (null == note.getId()) {
|
|
|
|
|
|
WmScorePackageSettleNote entity = new WmScorePackageSettleNote();
|
|
|
- entity.setSubType(note.getSubType());
|
|
|
+ entity.setSubType(subType);
|
|
|
+ entity.setSubjectLocation(note.getSubjectLocation());
|
|
|
entity.setInvoiceType(note.getInvoiceType());
|
|
|
entity.setCategoryName(note.toCategoryName());
|
|
|
entity.setSettleAmount(note.getSettleAmount());
|
|
@@ -290,7 +298,8 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
}
|
|
|
WmScorePackageSettleNote updateEntity = new WmScorePackageSettleNote();
|
|
|
updateEntity.setId(note.getId());
|
|
|
- updateEntity.setSubType(note.getSubType());
|
|
|
+ updateEntity.setSubType(subType);
|
|
|
+ updateEntity.setSubjectLocation(note.getSubjectLocation());
|
|
|
updateEntity.setInvoiceType(note.getInvoiceType());
|
|
|
updateEntity.setCategoryName(note.getCategoryName());
|
|
|
updateEntity.setSettleAmount(note.getSettleAmount());
|
|
@@ -310,20 +319,26 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
if (StringUtils.isEmpty(user.getIdCardNumber())) {
|
|
|
return R.failed(user.getRealname() + "未认证,不能发起结算");
|
|
|
}
|
|
|
- if ("0".equals(note.getSubType())) {
|
|
|
- if (!Objects.equals(user.getRljCertStatus(), DingEnum.CER_STATUS_1.getType())) {
|
|
|
- return R.failed(user.getRealname() + "未认证,不能发起结算");
|
|
|
- }
|
|
|
+
|
|
|
+ if (note.getSubjectLocation() == null) {
|
|
|
+ return R.failed(user.getRealname() + "人员结算渠道不存在,不能结算");
|
|
|
}
|
|
|
- if ("1".equals(note.getSubType())) {
|
|
|
- if (!Objects.equals(user.getCertStatus(), TaxHelperCertStatus.CERT.getCode())) {
|
|
|
- return R.failed(user.getRealname() + "人员未认证或未绑卡,不能结算");
|
|
|
- }
|
|
|
+
|
|
|
+ String subType = String.valueOf(note.getSubjectLocation().getGigType().getCode());
|
|
|
+
|
|
|
+ SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
|
+ .eq(SysUserSub::getSubjectLocation, note.getSubjectLocation())
|
|
|
+ .eq(SysUserSub::getDeptId, user.getDeptId())
|
|
|
+ .eq(SysUserSub::getUserId, user.getUserId())
|
|
|
+ );
|
|
|
+ if (userSub == null) {
|
|
|
+ return R.failed(user.getRealname() + "人员认证信息不存在,不能结算");
|
|
|
}
|
|
|
|
|
|
SysDeptSub condition = new SysDeptSub();
|
|
|
condition.setDeptId(user.getDeptId());
|
|
|
- condition.setSubjectType(note.getSubType());
|
|
|
+ condition.setSubjectType(subType);
|
|
|
+ condition.setSubjectLocation(note.getSubjectLocation());
|
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
|
|
|
@@ -339,13 +354,13 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
if (null != note.getId()) {
|
|
|
ids.add(note.getId());
|
|
|
}
|
|
|
- SettleAmountMonitorInput monitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, note.getSubType());
|
|
|
+ SettleAmountMonitorInput monitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, subType, note.getSubjectLocation());
|
|
|
List<SettleAmountMonitorOutput> monitorOutputList = sysDeptSubService.getSettleAmountMonitor(monitorInput);
|
|
|
|
|
|
- SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, note.getSubType());
|
|
|
+ SettleAmountMonitorInput deptMonitorInput = SettleAmountMonitorInput.fromUserId(userIds, ids, subType, note.getSubjectLocation());
|
|
|
List<SettleAmountMonitorOutput> deptAmountMonitor = sysDeptSubService.getDeptAmountMonitor(deptMonitorInput);
|
|
|
|
|
|
- SettleAmountMonitorInput yaoyiMonitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, note.getSubType());
|
|
|
+ SettleAmountMonitorInput yaoyiMonitorInput = SettleAmountMonitorInput.fromIdCard(idCard, ids, subType, note.getSubjectLocation());
|
|
|
List<SettleAmountMonitorOutput> yaoyiAmountMonitor = sysDeptSubService.getYaoyiAmountMonitor(yaoyiMonitorInput);
|
|
|
|
|
|
SettleAmountMonitorOutput monitorOutput = monitorOutputList.stream().filter(item -> item.getIdCardNumber()
|
|
@@ -357,7 +372,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
SettleAmountMonitorOutput yaoyiMonitorOutput = yaoyiAmountMonitor.stream().filter(item -> item.getIdCardNumber()
|
|
|
.equals(user.getIdCardNumber())).findFirst().orElse(null);
|
|
|
|
|
|
- MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(note.getSubType());
|
|
|
+ MonitoringIndicator monitoringIndicator = monitoringIndicatorService.getBySubType(subType, note.getSubjectLocation());
|
|
|
BigDecimal deptLimit = sysDeptSub.getLimitAmount();
|
|
|
BigDecimal yaoyiLimit = monitoringIndicator.getYaoyiLimitAmount();
|
|
|
BigDecimal monitoringLimit = monitoringIndicator.getLimitAmount();
|
|
@@ -399,7 +414,8 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
}
|
|
|
updateEntity = new WmScorePackageSettleNote();
|
|
|
updateEntity.setId(note.getId());
|
|
|
- updateEntity.setSubType(note.getSubType());
|
|
|
+ updateEntity.setSubType(subType);
|
|
|
+ updateEntity.setSubjectLocation(note.getSubjectLocation());
|
|
|
updateEntity.setInvoiceType(note.getInvoiceType());
|
|
|
updateEntity.setCategoryName(note.toCategoryName());
|
|
|
updateEntity.setSettleAmount(note.getSettleAmount());
|
|
@@ -416,7 +432,8 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
return R.ok();
|
|
|
} else {
|
|
|
WmScorePackageSettleNote entity = new WmScorePackageSettleNote();
|
|
|
- entity.setSubType(note.getSubType());
|
|
|
+ entity.setSubType(subType);
|
|
|
+ entity.setSubjectLocation(note.getSubjectLocation());
|
|
|
entity.setInvoiceType(note.getInvoiceType());
|
|
|
entity.setCategoryName(note.toCategoryName());
|
|
|
entity.setSettleAmount(note.getSettleAmount());
|
|
@@ -488,12 +505,22 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
return R.failed("数据异常,不能结算");
|
|
|
}
|
|
|
|
|
|
+ SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
|
+
|
|
|
+ if (input.getSubjectLocation() == null) {
|
|
|
+ return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取结算零工
|
|
|
+ GigTypeEnum gigTypeEnum = input.getSubjectLocation().getGigType();
|
|
|
+ String subType = String.valueOf(input.getSubjectLocation().getGigType().getCode());
|
|
|
+
|
|
|
/**
|
|
|
* 结算配置信息
|
|
|
*/
|
|
|
SysDeptSub condition = new SysDeptSub();
|
|
|
condition.setDeptId(sysDept.getDeptId());
|
|
|
- condition.setSubjectType(note.getSubType());
|
|
|
+ condition.setSubjectType(subType);
|
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
|
|
|
@@ -501,16 +528,9 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
return R.failed("机构appId未维护");
|
|
|
}
|
|
|
|
|
|
- SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
|
-
|
|
|
- // 获取结算零工
|
|
|
- GigTypeEnum gigTypeEnum = GigTypeEnum.resolve(Integer.parseInt(note.getSubType()));
|
|
|
-
|
|
|
- if (gigTypeEnum == null) {
|
|
|
- return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
|
- }
|
|
|
-
|
|
|
- SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery().eq(SysUserSub::getGigType, gigTypeEnum)
|
|
|
+ SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
|
+ .eq(SysUserSub::getSubjectLocation, input.getSubjectLocation())
|
|
|
+ .eq(SysUserSub::getDeptId, sysUser.getDeptId())
|
|
|
.eq(SysUserSub::getUserId, sysUser.getUserId())
|
|
|
);
|
|
|
|
|
@@ -554,9 +574,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
|
|
|
}
|
|
|
// 自由职家
|
|
|
- else if (SubjectTypeEnum.TYPE_OLADING.getCode().equals(note.getSubType())
|
|
|
- || SubjectTypeEnum.TYPE_JIN_YUAN.getCode().equals(note.getSubType())
|
|
|
- || SubjectTypeEnum.TYPE_XIN_TAI_ZI.getCode().equals(note.getSubType())
|
|
|
+ else if (SubjectTypeEnum.TYPE_OLADING.getCode().equals(subType)
|
|
|
) {
|
|
|
String taxCode = sysDept.getTaxCode();
|
|
|
return settleByOlading(note, wmScorePackage, sysUser, taxCode);
|
|
@@ -591,7 +609,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
List<SysDeptSub> subList = sysDeptSubService.list(Wrappers.query(condition));
|
|
|
Map<String, SysDeptSub> subMap = new HashMap<>();
|
|
|
|
|
|
- subList.forEach(item -> subMap.put(item.getSubjectType(), item));
|
|
|
+ subList.forEach(item -> subMap.put(item.getSubjectLocation().name(), item));
|
|
|
|
|
|
String[] ids = input.getIdStr().split(",");
|
|
|
List<WmScorePackageSettleNote> noteList = new ArrayList<>(ids.length);
|
|
@@ -611,7 +629,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
/**
|
|
|
* 结算配置信息
|
|
|
*/
|
|
|
- SysDeptSub sysDeptSub = subMap.get(note.getSubType());
|
|
|
+ SysDeptSub sysDeptSub = subMap.get(note.getSubjectLocation().name());
|
|
|
|
|
|
if (null == sysDeptSub || StringUtils.isEmpty(sysDeptSub.getAppId())) {
|
|
|
return R.failed("机构appId未维护");
|
|
@@ -619,14 +637,17 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
|
|
|
SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
|
|
|
|
- // 获取结算零工
|
|
|
- GigTypeEnum gigTypeEnum = GigTypeEnum.resolve(Integer.parseInt(note.getSubType()));
|
|
|
-
|
|
|
- if (gigTypeEnum == null) {
|
|
|
+ if (input.getSubjectLocation() == null) {
|
|
|
return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
|
}
|
|
|
|
|
|
- SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery().eq(SysUserSub::getGigType, gigTypeEnum)
|
|
|
+ // 获取结算零工
|
|
|
+ GigTypeEnum gigTypeEnum = input.getSubjectLocation().getGigType();
|
|
|
+ String subType = String.valueOf(input.getSubjectLocation().getGigType().getCode());
|
|
|
+
|
|
|
+ SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
|
+ .eq(SysUserSub::getSubjectLocation, input.getSubjectLocation())
|
|
|
+ .eq(SysUserSub::getDeptId, sysUser.getDeptId())
|
|
|
.eq(SysUserSub::getUserId, sysUser.getUserId())
|
|
|
);
|
|
|
|
|
@@ -660,7 +681,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
log.info("结算明细noteId: {} 开始结算-----------", note.getId());
|
|
|
log.info("结算渠道: {} ", note.getSubType());
|
|
|
|
|
|
- if (SubjectTypeEnum.TYPE_RENLIJIA.getCode().equals(input.getSubType())) {
|
|
|
+ if (SubjectTypeEnum.TYPE_RENLIJIA.getCode().equals(subType)) {
|
|
|
DingConfig config = new DingConfig();
|
|
|
config.setAppId(sysDeptSub.getAppId());
|
|
|
config.setAppSecret(sysDeptSub.getAppSecret());
|
|
@@ -670,8 +691,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
|
|
|
}
|
|
|
// 自由职家
|
|
|
- else if (SubjectTypeEnum.TYPE_OLADING.getCode().equals(note.getSubType()) || SubjectTypeEnum.TYPE_JIN_YUAN.getCode().equals(note.getSubType())
|
|
|
- || SubjectTypeEnum.TYPE_XIN_TAI_ZI.getCode().equals(note.getSubType())) {
|
|
|
+ else if (SubjectTypeEnum.TYPE_OLADING.getCode().equals(subType)) {
|
|
|
oladingNoteList.add(note);
|
|
|
}
|
|
|
// 税邦云
|