解决冲突
This commit is contained in:
commit
411ff49ac8
@ -109,7 +109,7 @@ public class ResultRecordController extends AbstractController {
|
||||
req.setStaffId(user.getUserId());
|
||||
} else {
|
||||
StaffRole staffRole = staffRoleService.selectByStaffId(getUserId());
|
||||
if (staffRole == null) {
|
||||
if (staffRole == null && req.getIsChangeDepartmentrtment() == 0) {
|
||||
DepartmentsStaffRelateEntity relateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(getUserId());
|
||||
Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(relateEntity.getDepartmentId());
|
||||
int i = 0;
|
||||
@ -435,21 +435,21 @@ public class ResultRecordController extends AbstractController {
|
||||
return R.error("您的提交记录中有状态不为侍提交的,请重新选择。");
|
||||
}
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
R r = null;
|
||||
for (ResultRecord resultRecord : resultRecords) {
|
||||
r = resultRecordService.approval(resultRecord.getId(), getUserId());
|
||||
}
|
||||
if(r != null && r.isSuccess()){//批量提交
|
||||
StaffEntity mySelf = (StaffEntity)r.get("from");
|
||||
StaffEntity toSelf = (StaffEntity)r.get("to");
|
||||
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
|
||||
sendWorkMSG(mySelf, toSelf, workMsgTypeEnum, 0L, 2);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
|
||||
R r = null;
|
||||
for (ResultRecord resultRecord : resultRecords) {
|
||||
r = resultRecordService.approval(resultRecord.getId(), getUserId());
|
||||
}
|
||||
|
||||
if(r != null && r.isSuccess()){//批量提交
|
||||
StaffEntity mySelf = (StaffEntity)r.get("from");
|
||||
StaffEntity toSelf = (StaffEntity)r.get("to");
|
||||
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
|
||||
sendWorkMSG(mySelf, toSelf, workMsgTypeEnum, 0L, 2);
|
||||
}
|
||||
|
||||
return R.ok("批量提交成功");
|
||||
}
|
||||
|
||||
@ -490,6 +490,43 @@ public class ResultRecordController extends AbstractController {
|
||||
return R.ok("验证成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/preWeightCheck")
|
||||
public R preWeightCheck(ResultRecordReq req) {
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordIdType(req.getRecordResultId(), req.getType());
|
||||
double compare = 0.3; //如果类型是文化价值观
|
||||
if (req.getType() == 1) { //类型是业绩
|
||||
compare = 0.7;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(resultDetails)) {
|
||||
if (req.getId() > 0) { // 编辑验证
|
||||
if (req.getWeight().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() > compare) {
|
||||
return R.error("权重不能大于" + compare);
|
||||
}
|
||||
} else { // 添加验证
|
||||
if (req.getWeight().setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() >= compare) {
|
||||
return R.error("权重不能大于" + compare);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
double sum = resultDetails.stream()
|
||||
.filter(p -> !p.getId().equals(req.getId()))
|
||||
.mapToDouble(n -> NumberUtil.objToDoubleWithDefault(n.getCheckWeight(), 0d)).summaryStatistics().getSum();
|
||||
if (req.getId() > 0) { //编辑验证
|
||||
if (new BigDecimal(sum).add(req.getWeight()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() > compare) {
|
||||
return R.error("权重之和不能大于" + compare);
|
||||
}
|
||||
} else { //添加验证
|
||||
if (new BigDecimal(sum).add(req.getWeight()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() >= compare) {
|
||||
return R.error("权重之和不能大于" + compare);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok("验证成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
|
||||
@ -38,7 +38,6 @@ public class ResultRecordReq {
|
||||
private List<Long > statusList ;
|
||||
private String statusStr;
|
||||
private Long approvalStaffId;
|
||||
|
||||
|
||||
private int isChangeDepartmentrtment;
|
||||
|
||||
}
|
||||
|
||||
@ -324,11 +324,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
public R checkApproval(Long recordId){
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
|
||||
if (CollectionUtils.isEmpty(resultDetails)) {
|
||||
return R.error("请先添加业绩");
|
||||
return R.error("请先添加业绩。");
|
||||
}
|
||||
double sum = resultDetails.stream().filter(p -> p.getType() == 1).mapToDouble(p -> NumberUtil.objToDoubleWithDefault(p.getCheckWeight(), 0d)).sum();
|
||||
if (sum < 0.7) {
|
||||
return R.error("recordId为[" + recordId + "]业绩权重之和必需大于0.7");
|
||||
return R.error("recordId为[" + recordId + "]业绩权重之和必需等于0.7。");
|
||||
}
|
||||
return R.ok();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user