添加环保任务结果接口

This commit is contained in:
wanggeng888 2021-01-10 21:45:05 +08:00
parent 807ac8a792
commit 92034c83c2
8 changed files with 380 additions and 9 deletions

View File

@ -8,9 +8,8 @@ import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult; import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList; import com.cm.common.result.SuccessResultList;
import com.cm.inspection.enums.task.v2.CheckItemListTypeEnum;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckEnterpriseDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportCheckItemDTO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO;
import com.cm.inspection.service.taskcheck.v2.ITaskCheckService; import com.cm.inspection.service.taskcheck.v2.ITaskCheckService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -47,6 +46,11 @@ public class TaskCheckAppController extends AbstractController {
@PostMapping("savetaskcheckreport") @PostMapping("savetaskcheckreport")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public synchronized SuccessResult saveTaskCheckReport(@RequestHeader("token") String token, @RequestBody TaskCheckReportVO taskCheckReportVO) throws Exception { public synchronized SuccessResult saveTaskCheckReport(@RequestHeader("token") String token, @RequestBody TaskCheckReportVO taskCheckReportVO) throws Exception {
boolean isCheckItemNone = (taskCheckReportVO.getIndustryReportItems() == null || taskCheckReportVO.getIndustryReportItems().isEmpty()) &&
(taskCheckReportVO.getEnterpriseReportItems() == null || taskCheckReportVO.getEnterpriseReportItems().isEmpty());
if (isCheckItemNone) {
throw new ParamsException("检查项列表不能为空");
}
if (StringUtils.isBlank(taskCheckReportVO.getCheckLng()) || StringUtils.equals(String.valueOf(Double.MIN_VALUE), taskCheckReportVO.getCheckLng())) { if (StringUtils.isBlank(taskCheckReportVO.getCheckLng()) || StringUtils.equals(String.valueOf(Double.MIN_VALUE), taskCheckReportVO.getCheckLng())) {
throw new ParamsException("检查经度有误"); throw new ParamsException("检查经度有误");
} }
@ -104,4 +108,19 @@ public class TaskCheckAppController extends AbstractController {
return taskCheckService.listCheckItem(checkItemListType, taskEnterpriseId); return taskCheckService.listCheckItem(checkItemListType, taskEnterpriseId);
} }
@ApiOperation(value = "检查结果列表", notes = "检查结果列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkItemListType", value = "检查项列表类型, 1行业检查项2企业检查项", paramType = "path"),
@ApiImplicitParam(name = "taskEnterpriseId", value = "检查任务企业ID", paramType = "path"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listtaskcheckreport/{checkItemListType}/{taskEnterpriseId}")
public List<TaskCheckReportCheckItemDTO> listTaskCheckReport(@PathVariable("checkItemListType") Integer checkItemListType,
@PathVariable("taskEnterpriseId") String taskEnterpriseId) {
if (ITaskCheckService.CHECK_ITEM_LIST_TYPE_RELATION != checkItemListType && ITaskCheckService.CHECK_ITEM_LIST_TYPE_CUSTOM != checkItemListType) {
throw new ParamsException("参数错误");
}
return taskCheckService.listTaskCheckReport(checkItemListType, taskEnterpriseId);
}
} }

View File

@ -6,6 +6,7 @@ import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException; import com.cm.common.exception.UpdateException;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckEnterpriseDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckEnterpriseDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportDTO;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -141,4 +142,21 @@ public interface ITaskCheckDao {
*/ */
List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listEnterpriseCheckItem(Map<String, Object> params) throws SearchException; List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listEnterpriseCheckItem(Map<String, Object> params) throws SearchException;
/**
* 行业任务检查结果
*
* @param params
* @return
* @throws SearchException
*/
List<TaskCheckReportDTO> listIndustryTaskCheckReport(Map<String, Object> params) throws SearchException;
/**
* 企业任务检查结果
*
* @param params
* @return
* @throws SearchException
*/
List<TaskCheckReportDTO> listEnterpriseTaskCheckReport(Map<String, Object> params) throws SearchException;
} }

View File

@ -0,0 +1,55 @@
package com.cm.inspection.pojo.dtos.taskcheck.v2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TaskCheckReportCheckItemDTO
* @Description: 任务上报检查项
* @Author: wanggeng
* @Date: 2021/1/10 2:27 下午
* @Version: 1.0
*/
@Data
@ApiModel
public class TaskCheckReportCheckItemDTO {
@ApiModelProperty(name = "checkItemId", value = "检查项ID")
private String checkItemId;
@ApiModelProperty(name = "checkItemParentId", value = "检查项上级ID")
private String checkItemParentId;
@ApiModelProperty(name = "checkItemName", value = "检查项名称")
private String checkItemName;
@ApiModelProperty(name = "checkItemType", value = "检查项类型1目录2检查项")
private Integer checkItemType;
@ApiModelProperty(name = "taskItemListType", value = "检查项列表类型1行业检查项2企业检查项")
private Integer taskItemListType;
@ApiModelProperty(name = "checkItemOptions", value = "检查项列表")
private List<CheckItemOptionDTO> checkItemOptions;
@Data
@ApiModel
public static class CheckItemOptionDTO {
@ApiModelProperty(name = "checkItemOptionId", value = "检查项ID")
private String checkItemOptionId;
@ApiModelProperty(name = "checkItemOptionType", value = "检查项选项类型1勾选2数字3文本")
private Integer checkItemOptionType;
@ApiModelProperty(name = "checkItemOptionName", value = "检查项名称")
private String checkItemOptionName;
@ApiModelProperty(name = "checkItemOptionUnit", value = "检查项单位")
private String checkItemOptionUnit;
@ApiModelProperty(name = "checkItemIsWrong", value = "是否错误项")
private Integer checkItemIsWrong;
@ApiModelProperty(name = "checkResult", value = "检查结果")
private String checkResult;
@ApiModelProperty(name = "scenePhotos", value = "佐证图片")
private String scenePhotos;
}
}

View File

@ -0,0 +1,52 @@
package com.cm.inspection.pojo.dtos.taskcheck.v2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TaskCheckReport
* @Description: 任务上报
* @Author: wanggeng
* @Date: 2021/1/10 1:21 下午
* @Version: 1.0
*/
@Data
@ApiModel
public class TaskCheckReportDTO {
@ApiModelProperty(name = "taskCheckReportId", value = "任务检查ID")
private String taskCheckReportId;
@ApiModelProperty(name = "taskId", value = "任务ID")
private String taskId;
@ApiModelProperty(name = "taskEnterpriseId", value = "任务企业ID")
private String taskEnterpriseId;
@ApiModelProperty(name = "checkItemId", value = "检查项ID")
private String checkItemId;
@ApiModelProperty(name = "checkItemParentId", value = "检查项上级ID")
private String checkItemParentId;
@ApiModelProperty(name = "checkItemName", value = "检查项名称")
private String checkItemName;
@ApiModelProperty(name = "checkItemType", value = "检查项类型1目录2检查项")
private Integer checkItemType;
@ApiModelProperty(name = "taskItemListType", value = "检查项列表类型1行业检查项2企业检查项")
private Integer taskItemListType;
@ApiModelProperty(name = "checkItemOptionId", value = "检查项ID")
private String checkItemOptionId;
@ApiModelProperty(name = "checkItemOptionType", value = "检查项选项类型1勾选2数字3文本")
private Integer checkItemOptionType;
@ApiModelProperty(name = "checkItemOptionName", value = "检查项名称")
private String checkItemOptionName;
@ApiModelProperty(name = "checkItemOptionUnit", value = "检查项单位")
private String checkItemOptionUnit;
@ApiModelProperty(name = "checkItemIsWrong", value = "是否错误项")
private Integer checkItemIsWrong;
@ApiModelProperty(name = "checkResult", value = "检查结果")
private String checkResult;
@ApiModelProperty(name = "scenePhotos", value = "佐证图片")
private String scenePhotos;
}

View File

@ -36,9 +36,10 @@ public class TaskCheckReportVO {
private String checkLat; private String checkLat;
@ApiModelProperty(name = "scenePhotos", value = "佐证图片") @ApiModelProperty(name = "scenePhotos", value = "佐证图片")
private String scenePhotos; private String scenePhotos;
@ApiModelProperty(name = "taskCheckReportItems", value = "检查项列表") @ApiModelProperty(name = "industryReportItems", value = "行业检查项列表")
@CheckListAnnotation(name = "检查项列表") private List<TaskCheckReportItemVO> industryReportItems;
private List<TaskCheckReportItemVO> taskCheckReportItems; @ApiModelProperty(name = "enterpriseReportItems", value = "企业检查项列表")
private List<TaskCheckReportItemVO> enterpriseReportItems;
@Data @Data
@ApiModel @ApiModel

View File

@ -10,6 +10,8 @@ import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO; import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckEnterpriseDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckEnterpriseDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportCheckItemDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportDTO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO;
@ -175,4 +177,13 @@ public interface ITaskCheckService {
*/ */
SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterprise(String taskId, ListPage page) throws SearchException; SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterprise(String taskId, ListPage page) throws SearchException;
/**
* 检查检查结果列表
*
* @param checkItemListType 检查项类型ID
* @param taskEnterpriseId 任务企业ID
* @return
* @throws SearchException
*/
List<TaskCheckReportCheckItemDTO> listTaskCheckReport(Integer checkItemListType, String taskEnterpriseId) throws SearchException;
} }

View File

@ -2,7 +2,6 @@ package com.cm.inspection.service.taskcheck.v2.impl;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.cm.common.exception.RemoveException; import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException; import com.cm.common.exception.SearchException;
import com.cm.common.plugin.oauth.service.user.IUserService; import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.plugin.pojo.bos.UserResourceBO; import com.cm.common.plugin.pojo.bos.UserResourceBO;
@ -15,9 +14,12 @@ import com.cm.common.utils.DateUtil;
import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil; import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.taskcheck.v2.ITaskCheckDao; import com.cm.inspection.dao.taskcheck.v2.ITaskCheckDao;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO; import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO; import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO; import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportCheckItemDTO;
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportDTO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO; import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO;
import com.cm.inspection.runnable.taskcheck.v2.TaskCheckSaveRunnable; import com.cm.inspection.runnable.taskcheck.v2.TaskCheckSaveRunnable;
@ -68,7 +70,9 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
@Resource(name = "industryCheckItemV2Service") @Resource(name = "industryCheckItemV2Service")
private IIndustryCheckItemService industryCheckItemService; private IIndustryCheckItemService industryCheckItemService;
@Resource(name = "checkItemV2Service") @Resource(name = "checkItemV2Service")
private ICheckItemService checkItemService; private ICheckItemService checkItemV2Service;
@Autowired
private com.cm.inspection.service.checkitem.ICheckItemService checkItemService;
@Autowired @Autowired
private ICheckItemOptionService checkItemOptionService; private ICheckItemOptionService checkItemOptionService;
@Resource(name = "checkItemOptionServiceV2Impl") @Resource(name = "checkItemOptionServiceV2Impl")
@ -96,7 +100,7 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
TaskCheckSaveRunnable taskCheckSaveRunnable = new TaskCheckSaveRunnable(securityComponent.getCurrentUser().getUserId(), taskId, taskCheckVO); TaskCheckSaveRunnable taskCheckSaveRunnable = new TaskCheckSaveRunnable(securityComponent.getCurrentUser().getUserId(), taskId, taskCheckVO);
taskCheckSaveRunnable.setDataSourceTransactionManager(dataSourceTransactionManager); taskCheckSaveRunnable.setDataSourceTransactionManager(dataSourceTransactionManager);
taskCheckSaveRunnable.setTaskCheckDao(taskCheckDao); taskCheckSaveRunnable.setTaskCheckDao(taskCheckDao);
taskCheckSaveRunnable.setCheckItemService(checkItemService); taskCheckSaveRunnable.setCheckItemService(checkItemV2Service);
taskCheckSaveRunnable.setEnterpriseService(enterpriseService); taskCheckSaveRunnable.setEnterpriseService(enterpriseService);
taskCheckSaveRunnable.setIndustryCheckItemService(industryCheckItemService); taskCheckSaveRunnable.setIndustryCheckItemService(industryCheckItemService);
taskCheckSaveRunnable.setGridPersonnelService(gridPersonnelService); taskCheckSaveRunnable.setGridPersonnelService(gridPersonnelService);
@ -131,10 +135,21 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
params.put("isCompleted", 1); params.put("isCompleted", 1);
params.put("checkTime", DateUtil.getTime()); params.put("checkTime", DateUtil.getTime());
taskCheckDao.updateTaskEnterpriseStatus(params); taskCheckDao.updateTaskEnterpriseStatus(params);
for (TaskCheckReportVO.TaskCheckReportItemVO taskCheckReportItemVO : taskCheckReportVO.getTaskCheckReportItems()) { for (TaskCheckReportVO.TaskCheckReportItemVO taskCheckReportItemVO : taskCheckReportVO.getIndustryReportItems()) {
params = HashMapUtil.beanToMap(taskCheckReportItemVO); params = HashMapUtil.beanToMap(taskCheckReportItemVO);
params.put("taskCheckReportId", UUIDUtil.getUUID());
params.put("taskId", taskCheckReportVO.getTaskId()); params.put("taskId", taskCheckReportVO.getTaskId());
params.put("taskEnterpriseId", taskCheckReportVO.getTaskEnterpriseId()); params.put("taskEnterpriseId", taskCheckReportVO.getTaskEnterpriseId());
params.put("checkItemListType", 1);
setSaveInfoByUserId(params, appTokenUser.getId());
taskCheckDao.saveTaskCheckReport(params);
}
for (TaskCheckReportVO.TaskCheckReportItemVO taskCheckReportItemVO : taskCheckReportVO.getEnterpriseReportItems()) {
params = HashMapUtil.beanToMap(taskCheckReportItemVO);
params.put("taskCheckReportId", UUIDUtil.getUUID());
params.put("taskId", taskCheckReportVO.getTaskId());
params.put("taskEnterpriseId", taskCheckReportVO.getTaskEnterpriseId());
params.put("checkItemListType", 2);
setSaveInfoByUserId(params, appTokenUser.getId()); setSaveInfoByUserId(params, appTokenUser.getId());
taskCheckDao.saveTaskCheckReport(params); taskCheckDao.saveTaskCheckReport(params);
} }
@ -267,6 +282,93 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
return new SuccessResultList<>(taskEnterpriseDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); return new SuccessResultList<>(taskEnterpriseDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
} }
@Override
public List<TaskCheckReportCheckItemDTO> listTaskCheckReport(Integer checkItemListType, String taskEnterpriseId) throws SearchException {
Map<String, Object> params = getHashMap(4);
params.put("checkItemListType", checkItemListType);
params.put("taskEnterpriseId", taskEnterpriseId);
List<TaskCheckReportDTO> taskCheckReportDTOs = null;
if (CHECK_ITEM_LIST_TYPE_RELATION == checkItemListType) {
taskCheckReportDTOs = taskCheckDao.listIndustryTaskCheckReport(params);
}
if (CHECK_ITEM_LIST_TYPE_CUSTOM == checkItemListType) {
taskCheckReportDTOs = taskCheckDao.listEnterpriseTaskCheckReport(params);
}
if (taskCheckReportDTOs == null || taskCheckReportDTOs.isEmpty()) {
return new ArrayList<>();
}
// 组合检查项列表
Map<String, TaskCheckReportCheckItemDTO> taskCheckReportCheckItemDTOMap = new HashMap<>();
for (TaskCheckReportDTO taskCheckReportDTO : taskCheckReportDTOs) {
if (taskCheckReportCheckItemDTOMap.get(taskCheckReportDTO) != null) {
continue;
}
TaskCheckReportCheckItemDTO taskCheckReportCheckItemDTO = new TaskCheckReportCheckItemDTO();
taskCheckReportCheckItemDTO.setCheckItemId(taskCheckReportDTO.getCheckItemId());
taskCheckReportCheckItemDTO.setCheckItemParentId(taskCheckReportDTO.getCheckItemParentId());
taskCheckReportCheckItemDTO.setCheckItemName(taskCheckReportDTO.getCheckItemName());
taskCheckReportCheckItemDTO.setCheckItemType(taskCheckReportDTO.getCheckItemType());
taskCheckReportCheckItemDTO.setTaskItemListType(checkItemListType);
taskCheckReportCheckItemDTOMap.put(taskCheckReportDTO.getCheckItemId(), taskCheckReportCheckItemDTO);
}
// 获取上级检查项
List<String> checkItemIds = new ArrayList<>();
for (Map.Entry<String, TaskCheckReportCheckItemDTO> kv : taskCheckReportCheckItemDTOMap.entrySet()) {
if (!StringUtils.equals("0", kv.getValue().getCheckItemParentId())) {
checkItemIds.add(kv.getValue().getCheckItemParentId());
}
}
params.clear();
params.put("checkItemIds", checkItemIds);
if (CHECK_ITEM_LIST_TYPE_RELATION == checkItemListType && !checkItemIds.isEmpty()) {
List<CheckItemDTO> checkItemDTOs = checkItemService.listCheckItem(params);
for (CheckItemDTO checkItemDTO : checkItemDTOs) {
TaskCheckReportCheckItemDTO taskCheckReportCheckItemDTO = new TaskCheckReportCheckItemDTO();
taskCheckReportCheckItemDTO.setCheckItemId(checkItemDTO.getCheckItemId());
taskCheckReportCheckItemDTO.setCheckItemParentId(checkItemDTO.getCheckItemParentId());
taskCheckReportCheckItemDTO.setCheckItemName(checkItemDTO.getName());
taskCheckReportCheckItemDTO.setCheckItemType(checkItemDTO.getType());
taskCheckReportCheckItemDTOMap.put(checkItemDTO.getCheckItemId(), taskCheckReportCheckItemDTO);
}
}
if (CHECK_ITEM_LIST_TYPE_CUSTOM == checkItemListType && !checkItemIds.isEmpty()) {
List<com.cm.inspection.pojo.dtos.enterprise.checkitem.v2.CheckItemDTO> checkItemDTOs = checkItemV2Service.list(params);
for (com.cm.inspection.pojo.dtos.enterprise.checkitem.v2.CheckItemDTO checkItemDTO : checkItemDTOs) {
TaskCheckReportCheckItemDTO taskCheckReportCheckItemDTO = new TaskCheckReportCheckItemDTO();
taskCheckReportCheckItemDTO.setCheckItemId(checkItemDTO.getCheckItemId());
taskCheckReportCheckItemDTO.setCheckItemParentId(checkItemDTO.getCheckItemParentId());
taskCheckReportCheckItemDTO.setCheckItemName(checkItemDTO.getName());
taskCheckReportCheckItemDTO.setCheckItemType(checkItemDTO.getType());
taskCheckReportCheckItemDTOMap.put(checkItemDTO.getCheckItemId(), taskCheckReportCheckItemDTO);
}
}
// 组装检查结果
List<TaskCheckReportCheckItemDTO> taskCheckReportCheckItemDTOs = new ArrayList<>();
for (Map.Entry<String, TaskCheckReportCheckItemDTO> kv : taskCheckReportCheckItemDTOMap.entrySet()) {
TaskCheckReportCheckItemDTO taskCheckReportCheckItemDTO = kv.getValue();
taskCheckReportCheckItemDTOs.add(taskCheckReportCheckItemDTO);
List<TaskCheckReportCheckItemDTO.CheckItemOptionDTO> checkItemOptions = new ArrayList<>();
taskCheckReportCheckItemDTO.setCheckItemOptions(checkItemOptions);
for (int i = 0; i < taskCheckReportDTOs.size(); i++) {
TaskCheckReportDTO taskCheckReportDTO = taskCheckReportDTOs.get(i);
if (StringUtils.equals(kv.getKey(), taskCheckReportDTO.getCheckItemId())) {
TaskCheckReportCheckItemDTO.CheckItemOptionDTO checkItemOptionDTO = new TaskCheckReportCheckItemDTO.CheckItemOptionDTO();
checkItemOptionDTO.setCheckItemOptionId(taskCheckReportDTO.getCheckItemOptionId());
checkItemOptionDTO.setCheckItemOptionName(taskCheckReportDTO.getCheckItemOptionName());
checkItemOptionDTO.setCheckItemOptionType(taskCheckReportDTO.getCheckItemOptionType());
checkItemOptionDTO.setCheckItemOptionUnit(taskCheckReportDTO.getCheckItemOptionUnit());
checkItemOptionDTO.setCheckItemIsWrong(taskCheckReportDTO.getCheckItemIsWrong());
checkItemOptionDTO.setCheckResult(taskCheckReportDTO.getCheckResult());
checkItemOptionDTO.setScenePhotos(taskCheckReportDTO.getScenePhotos());
checkItemOptions.add(checkItemOptionDTO);
taskCheckReportDTOs.remove(i);
i--;
}
}
}
return taskCheckReportCheckItemDTOs;
}
@Override @Override
public List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listCheckItem(Integer checkItemListType, String taskEnterpriseId) throws SearchException { public List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listCheckItem(Integer checkItemListType, String taskEnterpriseId) throws SearchException {
Map<String, Object> params = getHashMap(4); Map<String, Object> params = getHashMap(4);

View File

@ -51,6 +51,25 @@
<result column="check_item_summary" property="checkItemSummary"/> <result column="check_item_summary" property="checkItemSummary"/>
</resultMap> </resultMap>
<resultMap id="taskCheckReportDTO" type="com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckReportDTO">
<id column="task_check_report_id" property="taskCheckReportId"/>
<result column="task_id" property="taskId"/>
<result column="task_enterprise_id" property="taskEnterpriseId"/>
<result column="check_item_id" property="checkItemId"/>
<result column="check_item_parent_id" property="checkItemParentId"/>
<result column="check_item_name" property="checkItemName"/>
<result column="check_item_type" property="checkItemType"/>
<result column="task_item_list_type" property="taskItemListType"/>
<result column="check_item_option_id" property="checkItemOptionId"/>
<result column="check_item_option_type" property="checkItemOptionType"/>
<result column="check_item_option_name" property="checkItemOptionName"/>
<result column="check_item_option_unit" property="checkItemOptionUnit"/>
<result column="check_item_is_wrong" property="checkItemIsWrong"/>
<result column="check_result" property="checkResult"/>
<result column="scene_photos" property="scenePhotos"/>
</resultMap>
<!-- 保存任务 --> <!-- 保存任务 -->
<insert id="saveTask" parameterType="map"> <insert id="saveTask" parameterType="map">
INSERT INTO gen_task_v2( INSERT INTO gen_task_v2(
@ -287,24 +306,30 @@
<!-- 保存任务检查上报 --> <!-- 保存任务检查上报 -->
<insert id="saveTaskCheckReport" parameterType="map"> <insert id="saveTaskCheckReport" parameterType="map">
INSERT INTO gen_task_check_report_v2( INSERT INTO gen_task_check_report_v2(
task_id,
task_enterprise_id,
task_check_report_id, task_check_report_id,
check_item_id, check_item_id,
check_item_option_id, check_item_option_id,
check_item_option_type, check_item_option_type,
check_result, check_result,
scene_photos, scene_photos,
check_item_list_type,
creator, creator,
gmt_create, gmt_create,
modifier, modifier,
gmt_modified, gmt_modified,
is_delete is_delete
) VALUES( ) VALUES(
#{taskId},
#{taskEnterpriseId},
#{taskCheckReportId}, #{taskCheckReportId},
#{checkItemId}, #{checkItemId},
#{checkItemOptionId}, #{checkItemOptionId},
#{checkItemOptionType}, #{checkItemOptionType},
#{checkResult}, #{checkResult},
#{scenePhotos}, #{scenePhotos},
#{checkItemListType},
#{creator}, #{creator},
#{gmtCreate}, #{gmtCreate},
#{modifier}, #{modifier},
@ -413,4 +438,92 @@
</if> </if>
</select> </select>
<!-- 检查结果 -->
<select id="listIndustryTaskCheckReport" parameterType="map" resultMap="taskCheckReportDTO">
SELECT
t1.task_check_report_id,
t1.task_id,
t1.task_enterprise_id,
t1.check_item_id,
t1.check_item_list_type,
t1.check_item_option_id,
t1.check_item_option_type,
t1.check_result,
t1.scene_photos,
jt1.check_item_parent_id,
jt1.type check_item_type,
jt1.name check_item_name,
jt2.name check_item_option_name,
jt2.unit check_item_option_unit,
jt2.is_wrong check_item_option_is_wrong
FROM
gen_task_check_report_v2 t1
INNER JOIN
gen_check_item jt1
ON
t1.check_item_id = jt1.check_item_id
AND
jt1.is_delete = 0
INNER JOIN
gen_check_item_option jt2
ON
t1.check_item_option_id = jt2.check_item_option_id
AND
jt2.is_delete = 0
WHERE
t1.is_delete = 0
<if test="checkItemListType != null and checkItemListType != ''">
AND
t1.check_item_list_type = #{checkItemListType}
</if>
<if test="taskEnterpriseId != null and taskEnterpriseId != ''">
AND
t1.task_enterprise_id = #{taskEnterpriseId}
</if>
</select>
<!-- 检查结果 -->
<select id="listEnterpriseTaskCheckReport" parameterType="map" resultMap="taskCheckReportDTO">
SELECT
t1.task_check_report_id,
t1.task_id,
t1.task_enterprise_id,
t1.check_item_id,
t1.check_item_list_type,
t1.check_item_option_id,
t1.check_item_option_type,
t1.check_result,
t1.scene_photos,
jt1.check_item_parent_id,
jt1.type check_item_type,
jt1.name check_item_name,
jt2.name check_item_option_name,
jt2.unit check_item_option_unit,
jt2.is_wrong check_item_option_is_wrong
FROM
gen_task_check_report_v2 t1
INNER JOIN
gen_enterprise_check_item_v2 jt1
ON
t1.check_item_id = jt1.check_item_id
AND
jt1.is_delete = 0
INNER JOIN
gen_enterprise_check_item_option_v2 jt2
ON
t1.check_item_option_id = jt2.check_item_option_id
AND
jt2.is_delete = 0
WHERE
t1.is_delete = 0
<if test="checkItemListType != null and checkItemListType != ''">
AND
t1.check_item_list_type = #{checkItemListType}
</if>
<if test="taskEnterpriseId != null and taskEnterpriseId != ''">
AND
t1.task_enterprise_id = #{taskEnterpriseId}
</if>
</select>
</mapper> </mapper>