|
@@ -291,9 +291,11 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
this.baseMapper.insert(entity);
|
|
this.baseMapper.insert(entity);
|
|
} else {
|
|
} else {
|
|
WmScorePackageSettleNote oldData = this.baseMapper.selectById(note.getId());
|
|
WmScorePackageSettleNote oldData = this.baseMapper.selectById(note.getId());
|
|
|
|
+ if (oldData == null) {
|
|
|
|
+ return R.failed("结算数据不存在,不能修改");
|
|
|
|
+ }
|
|
|
|
|
|
if (0 != oldData.getSettleNoteStatus()) {
|
|
if (0 != oldData.getSettleNoteStatus()) {
|
|
-
|
|
|
|
return R.failed("状态异常,不能修改");
|
|
return R.failed("状态异常,不能修改");
|
|
}
|
|
}
|
|
WmScorePackageSettleNote updateEntity = new WmScorePackageSettleNote();
|
|
WmScorePackageSettleNote updateEntity = new WmScorePackageSettleNote();
|
|
@@ -320,7 +322,12 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public R<?> batchSaveSettleInfo(List<WmScorePackageSettleNote> noteList) {
|
|
public R<?> batchSaveSettleInfo(List<WmScorePackageSettleNote> noteList) {
|
|
- noteList.forEach(this::saveSettleInfo);
|
|
|
|
|
|
+ for (WmScorePackageSettleNote note : noteList) {
|
|
|
|
+ R settleResult = this.saveSettleInfo(note);
|
|
|
|
+ if (settleResult.getCode() != 0) {
|
|
|
|
+ throw new RuntimeException(settleResult.getMsg());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -426,7 +433,6 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
if (null != note.getId()) {
|
|
if (null != note.getId()) {
|
|
WmScorePackageSettleNote oldData = this.baseMapper.selectById(note.getId());
|
|
WmScorePackageSettleNote oldData = this.baseMapper.selectById(note.getId());
|
|
if (0 != oldData.getSettleNoteStatus()) {
|
|
if (0 != oldData.getSettleNoteStatus()) {
|
|
-
|
|
|
|
return R.failed("状态异常,不能提交");
|
|
return R.failed("状态异常,不能提交");
|
|
}
|
|
}
|
|
updateEntity = new WmScorePackageSettleNote();
|
|
updateEntity = new WmScorePackageSettleNote();
|
|
@@ -436,6 +442,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
updateEntity.setInvoiceType(note.getInvoiceType());
|
|
updateEntity.setInvoiceType(note.getInvoiceType());
|
|
updateEntity.setCategoryName(note.toCategoryName());
|
|
updateEntity.setCategoryName(note.toCategoryName());
|
|
updateEntity.setSettleAmount(note.getSettleAmount());
|
|
updateEntity.setSettleAmount(note.getSettleAmount());
|
|
|
|
+ updateEntity.setActualAmount(note.getActualAmount());
|
|
updateEntity.setSettleNoteStatus(9);
|
|
updateEntity.setSettleNoteStatus(9);
|
|
updateEntity.setSubTime(localDateTime);
|
|
updateEntity.setSubTime(localDateTime);
|
|
updateEntity.setUpdateTime(localDateTime);
|
|
updateEntity.setUpdateTime(localDateTime);
|
|
@@ -454,6 +461,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
entity.setInvoiceType(note.getInvoiceType());
|
|
entity.setInvoiceType(note.getInvoiceType());
|
|
entity.setCategoryName(note.toCategoryName());
|
|
entity.setCategoryName(note.toCategoryName());
|
|
entity.setSettleAmount(note.getSettleAmount());
|
|
entity.setSettleAmount(note.getSettleAmount());
|
|
|
|
+ entity.setActualAmount(note.getActualAmount());
|
|
entity.setDiscount(new BigDecimal(1));
|
|
entity.setDiscount(new BigDecimal(1));
|
|
entity.setPackageId(note.getPackageId());
|
|
entity.setPackageId(note.getPackageId());
|
|
entity.setTaskId(note.getTaskId());
|
|
entity.setTaskId(note.getTaskId());
|
|
@@ -482,7 +490,12 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public R<?> batchSubSettleInfo(List<WmScorePackageSettleNote> noteList) {
|
|
public R<?> batchSubSettleInfo(List<WmScorePackageSettleNote> noteList) {
|
|
- noteList.forEach(this::subSettleInfo);
|
|
|
|
|
|
+ for (WmScorePackageSettleNote note : noteList) {
|
|
|
|
+ R settleResult = this.subSettleInfo(note);
|
|
|
|
+ if (settleResult.getCode() != 0) {
|
|
|
|
+ throw new RuntimeException(settleResult.getMsg());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -537,13 +550,13 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
|
|
|
SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
|
|
|
|
- if (input.getSubjectLocation() == null) {
|
|
|
|
|
|
+ if (note.getSubjectLocation() == null) {
|
|
return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
}
|
|
}
|
|
|
|
|
|
// 获取结算零工
|
|
// 获取结算零工
|
|
- GigTypeEnum gigTypeEnum = input.getSubjectLocation().getGigType();
|
|
|
|
- String subType = String.valueOf(input.getSubjectLocation().getGigType().getCode());
|
|
|
|
|
|
+ GigTypeEnum gigTypeEnum = note.getSubjectLocation().getGigType();
|
|
|
|
+ String subType = String.valueOf(note.getSubjectLocation().getGigType().getCode());
|
|
|
|
|
|
/**
|
|
/**
|
|
* 结算配置信息
|
|
* 结算配置信息
|
|
@@ -551,6 +564,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
SysDeptSub condition = new SysDeptSub();
|
|
SysDeptSub condition = new SysDeptSub();
|
|
condition.setDeptId(sysDept.getDeptId());
|
|
condition.setDeptId(sysDept.getDeptId());
|
|
condition.setSubjectType(subType);
|
|
condition.setSubjectType(subType);
|
|
|
|
+ condition.setSubjectLocation(note.getSubjectLocation());
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
condition.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
SysDeptSub sysDeptSub = sysDeptSubService.getOne(Wrappers.query(condition));
|
|
|
|
|
|
@@ -559,7 +573,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
}
|
|
}
|
|
|
|
|
|
SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
- .eq(SysUserSub::getSubjectLocation, input.getSubjectLocation())
|
|
|
|
|
|
+ .eq(SysUserSub::getSubjectLocation, note.getSubjectLocation())
|
|
.eq(SysUserSub::getDeptId, sysUser.getDeptId())
|
|
.eq(SysUserSub::getDeptId, sysUser.getDeptId())
|
|
.eq(SysUserSub::getUserId, sysUser.getUserId())
|
|
.eq(SysUserSub::getUserId, sysUser.getUserId())
|
|
);
|
|
);
|
|
@@ -689,16 +703,16 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
|
|
|
|
SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
SysUser sysUser = sysUserService.getById(note.getUserId());
|
|
|
|
|
|
- if (input.getSubjectLocation() == null) {
|
|
|
|
|
|
+ if (note.getSubjectLocation() == null) {
|
|
return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
return R.failed(sysUser.getRealname() + "人员结算渠道不存在,不能结算");
|
|
}
|
|
}
|
|
|
|
|
|
// 获取结算零工
|
|
// 获取结算零工
|
|
- GigTypeEnum gigTypeEnum = input.getSubjectLocation().getGigType();
|
|
|
|
- String subType = String.valueOf(input.getSubjectLocation().getGigType().getCode());
|
|
|
|
|
|
+ GigTypeEnum gigTypeEnum = note.getSubjectLocation().getGigType();
|
|
|
|
+ String subType = String.valueOf(note.getSubjectLocation().getGigType().getCode());
|
|
|
|
|
|
SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
SysUserSub userSub = sysUserSubMapper.selectOne(Wrappers.<SysUserSub>lambdaQuery()
|
|
- .eq(SysUserSub::getSubjectLocation, input.getSubjectLocation())
|
|
|
|
|
|
+ .eq(SysUserSub::getSubjectLocation, note.getSubjectLocation())
|
|
.eq(SysUserSub::getDeptId, sysUser.getDeptId())
|
|
.eq(SysUserSub::getDeptId, sysUser.getDeptId())
|
|
.eq(SysUserSub::getUserId, sysUser.getUserId())
|
|
.eq(SysUserSub::getUserId, sysUser.getUserId())
|
|
);
|
|
);
|
|
@@ -2534,6 +2548,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.warn("自由职家结算提交失败: {}", note.getSettleNo());
|
|
log.warn("自由职家结算提交失败: {}", note.getSettleNo());
|
|
|
|
+ log.error("自由职家结算异常", e);
|
|
note.setUpdateTime(LocalDateTime.now());
|
|
note.setUpdateTime(LocalDateTime.now());
|
|
note.setSettleNoteStatus(DingEnum.NOTE_STATUS_FAIL.getType());
|
|
note.setSettleNoteStatus(DingEnum.NOTE_STATUS_FAIL.getType());
|
|
|
|
|