|
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.platform.common.enums.DataFilterTypeEnum;
|
|
|
import com.platform.common.exception.BusinessException;
|
|
|
+import com.platform.common.model.OauthUser;
|
|
|
import com.platform.common.model.UserInfo;
|
|
|
import com.platform.common.util.*;
|
|
|
import com.platform.dao.bean.MyPage;
|
|
@@ -100,6 +101,31 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
return new MyPage(mapper.selectList(model));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 获取当日移动端现场任务:当日的任务
|
|
|
+ * 如果有sbId,则说明是查询某一台设备的任务,需要查询设备的显示使用人员账号
|
|
|
+ * @param model
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AbstractPageResultBean<CheckJobVO> selectPageListMobile(CheckJobDTO model, int pageNum, int pageSize) {
|
|
|
+
|
|
|
+ // 查询设备的使用人员账户,通过该账户查询查询任务,状态不限制
|
|
|
+ SbInfo sbInfo = sbInfoService.getModelById(model.getSbId());
|
|
|
+ if(sbInfo != null){
|
|
|
+ if(sbInfo.getSaveUser() != null){
|
|
|
+ model.setCheckUserId(sbInfo.getSaveUser());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ model.setSearchStartTime(DateUtils.getTodayStartTime());
|
|
|
+ model.setSearchEndTime(DateUtils.getTodayEndTime());
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ return new MyPage(mapper.selectList(model));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<CheckJob> getModelListByDTO(CheckJobDTO model) {
|
|
|
if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
|
|
@@ -690,10 +716,20 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
}
|
|
|
checkJob.setStatus(CheckJobStatusEnum.EXECUTING.getValue());
|
|
|
checkJob.setActualStartTime(LocalDateTime.now());
|
|
|
- UserInfo userInfo = SecurityUtils.getUser().getUserInfo();
|
|
|
- checkJob.setUpdateTime(LocalDateTime.now());
|
|
|
- checkJob.setUpdateUserId(userInfo.getUserId());
|
|
|
- checkJob.setUpdateUserName(userInfo.getUsername());
|
|
|
+
|
|
|
+ OauthUser oauthUser = SecurityUtils.checkAndGetUser();
|
|
|
+ if(oauthUser==null){// 未登录,获取设备的使用人员
|
|
|
+ SbInfoVO sbInfoVO = sbInfoService.getById(checkJob.getSbId());
|
|
|
+ if (sbInfoVO == null) {
|
|
|
+ throw new BusinessException("设备不存在,无法完成任务");
|
|
|
+ }
|
|
|
+ checkJob.setUpdateUserId(sbInfoVO.getSaveUser());
|
|
|
+ checkJob.setUpdateUserName(sbInfoVO.getSaveUserName());
|
|
|
+ }else{
|
|
|
+ UserInfo userInfo = SecurityUtils.getUser().getUserInfo();
|
|
|
+ checkJob.setUpdateUserId(userInfo.getUserId());
|
|
|
+ checkJob.setUpdateUserName(userInfo.getUsername());
|
|
|
+ }
|
|
|
mapper.updateByPrimaryKeySelective(checkJob);
|
|
|
}
|
|
|
|
|
@@ -702,6 +738,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
* 公
|
|
|
* 里和台时的任务,需要定时器每天晚上定时来跑
|
|
|
*
|
|
|
+ * 如果是移动端的,未登录,不需要获取用户信息,
|
|
|
* @param dto
|
|
|
*/
|
|
|
@Override
|
|
@@ -715,10 +752,21 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
checkJob.setStatus(CheckJobStatusEnum.FINISHED.getValue());
|
|
|
checkJob.setActualEndTime(now);
|
|
|
checkJob.setRealHours(DateUtils.getDurationMinutes(checkJob.getActualStartTime(), checkJob.getActualEndTime()) + "");
|
|
|
- UserInfo userInfo = SecurityUtils.getUser().getUserInfo();
|
|
|
+ OauthUser oauthUser = SecurityUtils.checkAndGetUser();
|
|
|
+ if(oauthUser==null){// 未登录,在获取设备的使用人员
|
|
|
+ SbInfoVO sbInfoVO = sbInfoService.getById(checkJob.getSbId());
|
|
|
+ if (sbInfoVO == null) {
|
|
|
+ throw new BusinessException("设备不存在,无法完成任务");
|
|
|
+ }
|
|
|
+ checkJob.setUpdateUserId(sbInfoVO.getSaveUser());
|
|
|
+ checkJob.setUpdateUserName(sbInfoVO.getSaveUserName());
|
|
|
+ }else{
|
|
|
+ UserInfo userInfo = SecurityUtils.getUser().getUserInfo();
|
|
|
+ checkJob.setUpdateUserId(userInfo.getUserId());
|
|
|
+ checkJob.setUpdateUserName(userInfo.getUsername());
|
|
|
+ }
|
|
|
checkJob.setUpdateTime(now);
|
|
|
- checkJob.setUpdateUserId(userInfo.getUserId());
|
|
|
- checkJob.setUpdateUserName(userInfo.getUsername());
|
|
|
+
|
|
|
// checkJob.setSbStatus(dto.getSbStatus());
|
|
|
checkJob.setFeedback(dto.getFeedback());
|
|
|
mapper.updateByPrimaryKeySelective(checkJob);
|
|
@@ -799,6 +847,9 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
if(status !=null){
|
|
|
weekendCriteria.andIn(CheckJob::getStatus, status);
|
|
|
}
|
|
|
+
|
|
|
+ // 查询当日的任务数
|
|
|
+ weekendCriteria.andBetween(CheckJob::getStartTime, DateUtils.getTodayStartTime(), DateUtils.getTodayEndTime());
|
|
|
return mapper.selectCountByExample(weekend);
|
|
|
}
|
|
|
|