Browse Source

待执行任务列表添加用户名称

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
01e2031e5f
3 changed files with 35 additions and 5 deletions
  1. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/MissionVO.java
  2. +23
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java
  3. +11
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/MissionVO.java View File

@@ -93,7 +93,7 @@ public class MissionVO implements Serializable {
@ApiModelProperty(value = "备注")
private String note;

@ApiModelProperty(value = "备注")
@ApiModelProperty(value = "创建人")
private String createUser;

@ApiModelProperty(value = "租户id",hidden = true)

+ 23
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java View File

@@ -26,7 +26,9 @@ import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.*;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.mapper.UserMapper;
import com.tuoheng.system.utils.ShiroUtils;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,6 +60,9 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi
@Autowired
private IDspService dspService;

@Autowired
private UserMapper userMapper;


@Value("${tuoheng.dsp-callback-url:}")
private String dspCallbackUrl;
@@ -207,11 +212,14 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi
queryInspection.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getCreateTime);

IPage<ThMission> thMissionIPage = thMissionMapper.selectPage(page, queryInspection);
List<ThMission> records = thMissionIPage.getRecords();

Map<Integer, String> userName = getUserNameMap(records);
List<MissionVO> result=new ArrayList<>();
thMissionIPage.getRecords().forEach(mission->{
records.forEach(mission->{
MissionVO missionVO=new MissionVO();
BeanUtils.copyProperties(mission,missionVO);
missionVO.setCreateUser(userName.get(mission.getCreateUser()));
result.add(missionVO);
});

@@ -224,6 +232,20 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi
return resultPage;
}

private Map<Integer, String> getUserNameMap(List<ThMission> records) {
Map<Integer,String> userName=new HashMap<>();
Set<Integer> userId=new HashSet<>();
records.forEach(thMission -> {
userId.add(thMission.getCreateUser());
});

List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getId, userId));
for (User user : users) {
userName.put(user.getId(),user.getUsername());
}
return userName;
}

private void queryParam(MissionQuery queryInspectionRequest, LambdaQueryWrapper<ThMission> queryInspection) {
//编号
queryInspection.like(!StringUtils.isEmpty(queryInspectionRequest.getCode()),ThMission::getCode, queryInspectionRequest.getCode());

+ 11
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java View File

@@ -82,9 +82,17 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp
reportMapper.insert(report);
}else if(mission.getReportStatus() == ReportStatusEnum.UPDATE.getCode()){
Report update = reportMapper.selectOne(new LambdaQueryWrapper<Report>().eq(Report::getMissionId, missionId));
update.setGenerateTime(new Date());
//修改报告
reportMapper.updateById(update);

if(ObjectUtil.isEmpty(update)){
//生成报告
Report report = setInfo(missionId, reportNo, mission);
reportMapper.insert(report);
}else{
update.setGenerateTime(new Date());
//修改报告
reportMapper.updateById(update);
}

}
//更新任务的状态
mission.setReportStatus(ReportStatusEnum.UN_GENERATE.getCode());

Loading…
Cancel
Save