|
@@ -29,6 +29,8 @@ import com.customs.cq.datacenter.business.domain.bo.GridCheckFormBo;
|
|
import com.customs.cq.datacenter.business.domain.vo.CheckRecordVO;
|
|
import com.customs.cq.datacenter.business.domain.vo.CheckRecordVO;
|
|
import com.customs.cq.datacenter.business.entity.request.checkrecord.ReqCreateCheckRecord;
|
|
import com.customs.cq.datacenter.business.entity.request.checkrecord.ReqCreateCheckRecord;
|
|
import com.customs.cq.datacenter.business.entity.request.checkrecorditem.ReqCreateCheckRecordItem;
|
|
import com.customs.cq.datacenter.business.entity.request.checkrecorditem.ReqCreateCheckRecordItem;
|
|
|
|
+import com.customs.cq.datacenter.business.entity.response.check.ResCheckRecordDetail;
|
|
|
|
+import com.customs.cq.datacenter.business.entity.response.check.ResCheckRecordItem;
|
|
import com.customs.cq.datacenter.business.entity.response.check.ResListGrid4User;
|
|
import com.customs.cq.datacenter.business.entity.response.check.ResListGrid4User;
|
|
import com.customs.cq.datacenter.business.entity.search.SearchCheckRecord;
|
|
import com.customs.cq.datacenter.business.entity.search.SearchCheckRecord;
|
|
import com.customs.cq.datacenter.business.mapper.impl.*;
|
|
import com.customs.cq.datacenter.business.mapper.impl.*;
|
|
@@ -41,6 +43,7 @@ import com.customs.cq.datacenter.common.core.service.BasicService;
|
|
import com.customs.cq.datacenter.common.enums.*;
|
|
import com.customs.cq.datacenter.common.enums.*;
|
|
import com.customs.cq.datacenter.common.exception.ServiceException;
|
|
import com.customs.cq.datacenter.common.exception.ServiceException;
|
|
import com.customs.cq.datacenter.common.helper.LoginHelper;
|
|
import com.customs.cq.datacenter.common.helper.LoginHelper;
|
|
|
|
+import com.customs.cq.datacenter.common.model.LabelValueDto;
|
|
import com.customs.cq.datacenter.common.model.Tuple;
|
|
import com.customs.cq.datacenter.common.model.Tuple;
|
|
import com.customs.cq.datacenter.common.utils.*;
|
|
import com.customs.cq.datacenter.common.utils.*;
|
|
import com.customs.cq.datacenter.system.mapper.SysDictDataMapper;
|
|
import com.customs.cq.datacenter.system.mapper.SysDictDataMapper;
|
|
@@ -201,12 +204,15 @@ public class CheckRecordService extends BasicService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public ExecutedResult<CheckRecordVO> get(Long id) {
|
|
|
|
- CheckRecordVO result = new CheckRecordVO();
|
|
|
|
|
|
+ public ExecutedResult<ResCheckRecordDetail> get(Long id) {
|
|
|
|
+ ResCheckRecordDetail result = new ResCheckRecordDetail();
|
|
|
|
|
|
CheckRecordPO find = dao.selectById(id);
|
|
CheckRecordPO find = dao.selectById(id);
|
|
if (null != find) {
|
|
if (null != find) {
|
|
- result = CopierUtil.mapTo(find, CheckRecordVO.class);
|
|
|
|
|
|
+ // 查找检查项
|
|
|
|
+ List<CheckRecordItemPO> list = checkRecordItemMapper.list4CheckRecord(id);
|
|
|
|
+ result = CopierUtil.mapTo(find, ResCheckRecordDetail.class);
|
|
|
|
+ result.setListItem(CopierUtil.mapTo(list, ResCheckRecordItem.class));
|
|
}
|
|
}
|
|
return ExecutedResult.success(result);
|
|
return ExecutedResult.success(result);
|
|
}
|
|
}
|
|
@@ -275,8 +281,18 @@ public class CheckRecordService extends BasicService {
|
|
IPage<CheckRecordPO> pageList = dao.search(search);
|
|
IPage<CheckRecordPO> pageList = dao.search(search);
|
|
List<CheckRecordPO> list = pageList.getRecords();
|
|
List<CheckRecordPO> list = pageList.getRecords();
|
|
if (ListUtil.isNotNullOrEmpty(list)) {
|
|
if (ListUtil.isNotNullOrEmpty(list)) {
|
|
- // 转换vo
|
|
|
|
- listVo = CopierUtil.mapTo(list, CheckRecordVO.class);
|
|
|
|
|
|
+ List<Long> listGridId = list.stream().map(CheckRecordPO::getGridId).distinct()
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ Map<Long, LabelValueDto<Long>> map4Grid = gridInfoMapper.map4Id(listGridId);
|
|
|
|
+ for (CheckRecordPO item : list) {
|
|
|
|
+ // 转换vo
|
|
|
|
+ CheckRecordVO vo = CopierUtil.mapTo(item, CheckRecordVO.class);
|
|
|
|
+ vo.setGridName("");
|
|
|
|
+ if (map4Grid.containsKey(item.getGridId())) {
|
|
|
|
+ vo.setGridName(map4Grid.get(item.getGridId()).getLabel());
|
|
|
|
+ }
|
|
|
|
+ listVo.add(vo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
PagerResult<CheckRecordVO> result = new PagerResult<>(pageList.getSize(), pageList.getCurrent(), pageList.getTotal(), listVo);
|
|
PagerResult<CheckRecordVO> result = new PagerResult<>(pageList.getSize(), pageList.getCurrent(), pageList.getTotal(), listVo);
|
|
return ExecutedResult.success(result);
|
|
return ExecutedResult.success(result);
|
|
@@ -410,6 +426,7 @@ public class CheckRecordService extends BasicService {
|
|
checkItem.setCustoms("");
|
|
checkItem.setCustoms("");
|
|
checkItem.setCustomsName("");
|
|
checkItem.setCustomsName("");
|
|
checkItem.setItemName(c.getItemName());
|
|
checkItem.setItemName(c.getItemName());
|
|
|
|
+ checkItem.setItemDescription(c.getDescription());
|
|
checkItem.setCheckTime(0L);
|
|
checkItem.setCheckTime(0L);
|
|
checkItem.setCheckPerson("");
|
|
checkItem.setCheckPerson("");
|
|
checkItem.setCheckResult(0);
|
|
checkItem.setCheckResult(0);
|
|
@@ -445,4 +462,44 @@ public class CheckRecordService extends BasicService {
|
|
throw new Exception("添加检查记录失败");
|
|
throw new Exception("添加检查记录失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 提交到网格管理员
|
|
|
|
+ public ExecutedResult<ResCheckRecordDetail> submitAdmin(Long id) {
|
|
|
|
+ LoginUser loginUser = LoginHelper.getLoginUser();
|
|
|
|
+ if (Objects.isNull(loginUser)) {
|
|
|
|
+ throw new ServiceException("尚未登陆.", EResultCode.UNAUTHORIZED.getCode());
|
|
|
|
+ }
|
|
|
|
+ // 获取用户
|
|
|
|
+ SysUser user = userMapper.selectById(loginUser.getUserId());
|
|
|
|
+
|
|
|
|
+ // 校验是否存在
|
|
|
|
+ ExecutedResult<CheckRecordPO> checkExists = this.check4Id(id);
|
|
|
|
+ if (checkExists.isFailed()) {
|
|
|
|
+ return ExecutedResult.failed(checkExists.getMsg());
|
|
|
|
+ }
|
|
|
|
+ CheckRecordPO find = checkExists.getData();
|
|
|
|
+ if (!Objects.equals(find.getStatus(), ECheckFormStatus.STAGING.getValue())) {
|
|
|
|
+ return ExecutedResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 查询网格管理的网格员
|
|
|
|
+ List<GridPersonPO> listPerson = gridPersonMapper.list4Grid(find.getGridId());
|
|
|
|
+ if (listPerson.stream().noneMatch(c -> Objects.equals(c.getUserGuid(), user.getUserGuid()))) {
|
|
|
|
+ return ExecutedResult.failed("当前用户没有权限!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CheckRecordPO item = new CheckRecordPO();
|
|
|
|
+ item.setId(id);
|
|
|
|
+ item.setStatus(ECheckFormStatus.SUBMITTED.getValue());
|
|
|
|
+ // 修改人信息
|
|
|
|
+ item.setUpdateBy(loginUser.getUserId().toString());
|
|
|
|
+ item.setUpdateByName(loginUser.getUsername());
|
|
|
|
+ item.setUpdateTime(LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtil.nowTimeStamp()));
|
|
|
|
+
|
|
|
|
+ int result = dao.updateById(item);
|
|
|
|
+ if (result != 1) {
|
|
|
|
+ return ExecutedResult.failed("检查单提交操作失败");
|
|
|
|
+ }
|
|
|
|
+ return ExecutedResult.success();
|
|
|
|
+ }
|
|
}
|
|
}
|