重置绩效,任务添加预计开始结束日期效验

This commit is contained in:
2025-05-15 22:20:37 +08:00
parent 9ed6f173ee
commit 35b077f716
7 changed files with 57 additions and 2 deletions

View File

@ -34,4 +34,12 @@ public class ZtMonthScoreController {
}
@RequestMapping(value = "/resetScope", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
public Result resetScope(@RequestBody PerformanceDTO dto){
monthScoreService.resetScope(dto);
return Result.success();
}
}

View File

@ -30,6 +30,6 @@ public class ZtBugBoundUserDTO implements Serializable {
* 责任人
*/
private String assignedTo;
private String assignedToName;
}

View File

@ -58,6 +58,7 @@ public enum ActionStatus {
LOGIN(100, "login","登录"),
XGMM(101, "xgmm","修改密码"),
CZMM(101, "czmm","重置密码"),
CZINFO(101, "czmm","重置"),
;
@EnumValue

View File

@ -15,4 +15,7 @@ import com.sa.zentao.entity.ZtMonthScore;
public interface IZtMonthScoreService extends IService<ZtMonthScore> {
void saveScope(PerformanceDTO dto);
void resetScope(PerformanceDTO dto);
}

View File

@ -328,7 +328,15 @@ public class ZtBugServiceImpl extends ServiceImpl<ZtBugMapper, ZtBug> implements
d.setDeadline(DateUtils.getDayLast(d.getDeadline()));
}
List<ZtBugBoundUser> boundList = this.bugBoundUserService.listByBugId(d.getId());
d.setBoundList(BeanCopyUtil.copyListProperties(boundList,ZtBugBoundUserDTO::new));
List<ZtBugBoundUserDTO> ztBugBoundUserDTOS = BeanCopyUtil.copyListProperties(boundList, ZtBugBoundUserDTO::new);
ztBugBoundUserDTOS = ztBugBoundUserDTOS.stream().peek(o->{
ZtUser u = userMap.get(o.getAssignedTo());
if(u!=null){
o.setAssignedToName(u.getNickname());
}
}).collect(Collectors.toList());
d.setBoundList(ztBugBoundUserDTOS);
return d;
}

View File

@ -1,6 +1,7 @@
package com.sa.zentao.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sa.zentao.conf.RiskUserThreadLocal;
import com.sa.zentao.dao.BusinessException;
@ -13,6 +14,7 @@ import com.sa.zentao.mapper.ZtMonthScoreMapper;
import com.sa.zentao.service.IZtActionService;
import com.sa.zentao.service.IZtMonthScoreService;
import com.sa.zentao.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -38,6 +40,13 @@ public class ZtMonthScoreServiceImpl extends ServiceImpl<ZtMonthScoreMapper, ZtM
@Override
@Transactional
public void saveScope(PerformanceDTO dto) {
Date date = dto.getDate();
Date currentDate = new Date();
if(date==null||DateUtils.getDayEndDate(DateUtils.getMonthEndDate(currentDate)).getTime()<=DateUtils.getDayEndDate(DateUtils.getMonthEndDate(date)).getTime()){
throw new BusinessException("本月绩效未到提交时间");
}
boolean addFlag = dto.getId()==null?true:false;
ZtMonthScore ztMonthScore = null;
@ -66,5 +75,19 @@ public class ZtMonthScoreServiceImpl extends ServiceImpl<ZtMonthScoreMapper, ZtM
}
@Override
@Transactional
public void resetScope(PerformanceDTO dto) {
String account = dto.getAccount();
Date date = dto.getDate();
if(StringUtils.isEmpty(account)||date==null){
throw new BusinessException("请检查数据");
}
this.baseMapper.delete(new QueryWrapper<ZtMonthScore>().lambda()
.eq(ZtMonthScore::getAccount,account).eq(ZtMonthScore::getDateStr,DateUtils.formatDate(dto.getDate(),"yyyy-MM")));
actionService.addAction(ActionType.SCORECOUNT, ActionStatus.CZINFO,null,null,null,null,RiskUserThreadLocal.get().getName(),"",null);
}
}

View File

@ -539,6 +539,9 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
@Override
@Transactional
public void addTask(ZtTaskDTO dto) {
if(dto.getDeadline()==null||dto.getEstStarted()==null){
throw new BusinessException("请录入开始结束日期");
}
ZtTask ztTask = new ZtTask();
BeanUtils.copyProperties(dto, ztTask);
ztTask.setOpenedby(RiskUserThreadLocal.get().getName());
@ -660,6 +663,9 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
@Override
@Transactional
public void modifyTask(ZtTaskDTO dto) {
if(dto.getDeadline()==null||dto.getEstStarted()==null){
throw new BusinessException("请录入开始结束日期");
}
ZtTask ztTask = this.baseMapper.selectById(dto.getId());
if (ztTask == null) {
throw new BusinessException("未查询到数据");
@ -1064,6 +1070,12 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
UserType userType = RiskUserThreadLocal.get().getUserType();
List<ZtTaskDTO> list = dto.getList();
long nullDeadlineCount = list.stream().filter(o -> o.getDeadline() == null || o.getEstStarted() == null).count();
if(nullDeadlineCount>0){
throw new BusinessException("请录入开始结束日期");
}
List<ZtTask> saveList = new ArrayList();
List<Integer> storyList = list.stream().filter(o -> o.getStory() != null && o.getStory() != 0).map(o -> o.getStory()).collect(Collectors.toList());