添加环保任务检查企业功能
This commit is contained in:
parent
d8c4240362
commit
6b71f2bac8
@ -139,4 +139,62 @@ public class TaskCheckController extends AbstractController {
|
||||
return taskCheckService.listRandomGridPersonnel(randomCount, params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "检查任务分页列表", notes = "检查任务分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagetaskcheck")
|
||||
public SuccessResultList<List<TaskCheckDTO>> listPageTaskCheck(ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return taskCheckService.listPageTaskCheck(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "任务详情", notes = "任务详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("gettaskbyid/{taskId}")
|
||||
public TaskCheckDTO getTaskById(@PathVariable("taskId") String taskId) {
|
||||
return taskCheckService.getTaskById(taskId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "任务企业分页列表", notes = "任务企业分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "Integer", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagetaskenterprise/{taskId}")
|
||||
public SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterprise(@PathVariable("taskId") String taskId, ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return taskCheckService.listPageTaskEnterprise(taskId, page);
|
||||
}
|
||||
|
||||
@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("listcheckitem/{checkItemListType}/{taskEnterpriseId}")
|
||||
public List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listCheckItem(@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.listCheckItem(checkItemListType, taskEnterpriseId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
package com.cm.inspection.controller.app.apis.taskcheck.v2;
|
||||
|
||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
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.TaskCheckEnterpriseDTO;
|
||||
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO;
|
||||
import com.cm.inspection.service.taskcheck.v2.ITaskCheckService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -35,6 +39,23 @@ public class TaskCheckAppController extends AbstractController {
|
||||
@Resource(name = "taskCheckV2Service")
|
||||
private ITaskCheckService taskCheckService;
|
||||
|
||||
@ApiOperation(value = "上报检查任务", notes = "上报检查任务接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("savetaskcheckreport")
|
||||
@CheckRequestBodyAnnotation
|
||||
public synchronized SuccessResult saveTaskCheckReport(@RequestHeader("token") String token, @RequestBody TaskCheckReportVO taskCheckReportVO) throws Exception {
|
||||
if (StringUtils.isBlank(taskCheckReportVO.getCheckLng()) || StringUtils.equals(String.valueOf(Double.MIN_VALUE), taskCheckReportVO.getCheckLng())) {
|
||||
throw new ParamsException("检查经度有误");
|
||||
}
|
||||
if (StringUtils.isBlank(taskCheckReportVO.getCheckLat()) || StringUtils.equals(String.valueOf(Double.MIN_VALUE), taskCheckReportVO.getCheckLat())) {
|
||||
throw new ParamsException("检查纬度有误");
|
||||
}
|
||||
return taskCheckService.saveTaskCheckReport(token, taskCheckReportVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "我的检查任务分页列表", notes = "我的检查任务分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "Integer", defaultValue = "1"),
|
||||
|
@ -6,6 +6,7 @@ import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.UpdateException;
|
||||
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO;
|
||||
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckEnterpriseDTO;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -56,6 +57,15 @@ public interface ITaskCheckDao {
|
||||
*/
|
||||
List<TaskCheckDTO> listTask(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 任务详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
TaskCheckDTO getTask(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 保存任务企业
|
||||
*
|
||||
@ -88,6 +98,22 @@ public interface ITaskCheckDao {
|
||||
*/
|
||||
void deleteTaskEnterpriseCheckItem(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 更新企业检查状态
|
||||
*
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void updateTaskEnterpriseStatus(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 保存任务检查上报
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void saveTaskCheckReport(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 检查任务企业列表
|
||||
*
|
||||
@ -114,4 +140,5 @@ public interface ITaskCheckDao {
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listEnterpriseCheckItem(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -77,10 +77,16 @@ public class TaskCheckDTO {
|
||||
private String enterpriseAddress;
|
||||
@ApiModelProperty(name = "enterpriseLegalPerson", value = "企业法人")
|
||||
private String enterpriseLegalPerson;
|
||||
@ApiModelProperty(name = "enterpriseLng", value = "企业经度")
|
||||
private String enterpriseLng;
|
||||
@ApiModelProperty(name = "enterpriseLat", value = "企业纬度")
|
||||
private String enterpriseLat;
|
||||
@ApiModelProperty(name = "industryId", value = "行业ID")
|
||||
private String industryId;
|
||||
@ApiModelProperty(name = "checkUserId", value = "检查人ID")
|
||||
private String checkUserId;
|
||||
@ApiModelProperty(name = "checkUserName", value = "检查人名称")
|
||||
private String checkUserName;
|
||||
@ApiModelProperty(name = "isChecked", value = "是否检查")
|
||||
private Integer isChecked;
|
||||
@ApiModelProperty(name = "checkTime", value = "检查时间")
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.cm.inspection.pojo.vos.taskcheck.v2;
|
||||
|
||||
import com.cm.common.annotation.CheckEmptyAnnotation;
|
||||
import com.cm.common.annotation.CheckListAnnotation;
|
||||
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: TaskCheckReportVO
|
||||
* @Description: 任务上报
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/1/8 6:19 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class TaskCheckReportVO {
|
||||
|
||||
@ApiModelProperty(name = "taskId", value = "任务ID")
|
||||
@CheckEmptyAnnotation(name = "任务ID不能为空")
|
||||
private String taskId;
|
||||
@ApiModelProperty(name = "taskEnterpriseId", value = "任务企业ID")
|
||||
@CheckEmptyAnnotation(name = "任务企业ID不能为空")
|
||||
private String taskEnterpriseId;
|
||||
@ApiModelProperty(name = "checkLng", value = "检查经度")
|
||||
@CheckEmptyAnnotation(name = "检查经度")
|
||||
private String checkLng;
|
||||
@ApiModelProperty(name = "checkLat", value = "检查纬度")
|
||||
@CheckEmptyAnnotation(name = "检查纬度")
|
||||
private String checkLat;
|
||||
@ApiModelProperty(name = "scenePhotos", value = "佐证图片")
|
||||
private String scenePhotos;
|
||||
@ApiModelProperty(name = "taskCheckReportItems", value = "检查项列表")
|
||||
@CheckListAnnotation(name = "检查项列表")
|
||||
private List<TaskCheckReportItemVO> taskCheckReportItems;
|
||||
|
||||
@Data
|
||||
@ApiModel
|
||||
public static class TaskCheckReportItemVO {
|
||||
@ApiModelProperty(name = "checkItemId", value = "检查项ID")
|
||||
private String checkItemId;
|
||||
@ApiModelProperty(name = "checkItemOptionId", value = "检查项结果")
|
||||
private String checkItemOptionId;
|
||||
@ApiModelProperty(name = "checkItemOptionType", value = "检查项选项类型,1:勾选,2:数字,3:文本")
|
||||
private String checkItemOptionType;
|
||||
@ApiModelProperty(name = "scenePhotos", value = "佐证图片")
|
||||
private String scenePhotos;
|
||||
@ApiModelProperty(name = "checkResult", value = "检查结果")
|
||||
private String checkResult;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.cm.inspection.service.taskcheck.v2;
|
||||
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
@ -9,6 +10,7 @@ import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
|
||||
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.TaskCheckEnterpriseDTO;
|
||||
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO;
|
||||
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -56,6 +58,16 @@ public interface ITaskCheckService {
|
||||
*/
|
||||
SuccessResult delete(String ids) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 上报检查任务
|
||||
*
|
||||
* @param token
|
||||
* @param taskCheckReportVO
|
||||
* @return
|
||||
* @throws SaveException
|
||||
*/
|
||||
SuccessResult saveTaskCheckReport(String token, TaskCheckReportVO taskCheckReportVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 检查任务列表
|
||||
*
|
||||
@ -74,6 +86,15 @@ public interface ITaskCheckService {
|
||||
*/
|
||||
SuccessResultList<List<TaskCheckDTO>> listPageTask(ListPage page) throws SearchException;
|
||||
|
||||
/**
|
||||
* 任务详情
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
TaskCheckDTO getTaskById(String taskId) throws SearchException;
|
||||
|
||||
/**
|
||||
* 随机企业列表
|
||||
*
|
||||
@ -134,4 +155,24 @@ public interface ITaskCheckService {
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<TaskCheckDTO.EnterpriseDTO.CheckItemDTO> listCheckItem(Integer checkItemListType, String taskEnterpriseId) throws SearchException;
|
||||
|
||||
/**
|
||||
* 检查任务分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultList<List<TaskCheckDTO>> listPageTaskCheck(ListPage page) throws SearchException;
|
||||
|
||||
/**
|
||||
* 任务企业分页列表
|
||||
*
|
||||
* @param taskId
|
||||
* @param page
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterprise(String taskId, ListPage page) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -2,18 +2,23 @@ package com.cm.inspection.service.taskcheck.v2.impl;
|
||||
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.token.app.entity.AppTokenUser;
|
||||
import com.cm.common.utils.DateUtil;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.inspection.dao.taskcheck.v2.ITaskCheckDao;
|
||||
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
|
||||
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
|
||||
import com.cm.inspection.pojo.dtos.taskcheck.v2.TaskCheckDTO;
|
||||
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckReportVO;
|
||||
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO;
|
||||
import com.cm.inspection.runnable.taskcheck.v2.TaskCheckSaveRunnable;
|
||||
import com.cm.inspection.service.BaseService;
|
||||
@ -51,9 +56,6 @@ import java.util.concurrent.TimeUnit;
|
||||
@Service("taskCheckV2Service")
|
||||
public class TaskCheckServiceImpl extends BaseService implements ITaskCheckService {
|
||||
|
||||
/**
|
||||
* 线程池
|
||||
*/
|
||||
private static ExecutorService executorService = new ThreadPoolExecutor(2, 100,
|
||||
0L, TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<Runnable>(1024), new ThreadFactoryBuilder().setDaemon(true).setNameFormat("task-check-pool-%d").build(), new ThreadPoolExecutor.AbortPolicy());
|
||||
@ -75,6 +77,8 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
|
||||
private IGridPersonnelService gridPersonnelService;
|
||||
@Autowired
|
||||
private DataSourceTransactionManager dataSourceTransactionManager;
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Override
|
||||
public SuccessResult save(TaskCheckVO taskCheckVO) throws Exception {
|
||||
@ -115,6 +119,28 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResult saveTaskCheckReport(String token, TaskCheckReportVO taskCheckReportVO) throws Exception {
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
Map<String, Object> params = getHashMap(16);
|
||||
params.put("taskEnterpriseId", taskCheckReportVO.getTaskEnterpriseId());
|
||||
params.put("checkLng", taskCheckReportVO.getCheckLng());
|
||||
params.put("checkLat", taskCheckReportVO.getCheckLat());
|
||||
params.put("scenePhotos", taskCheckReportVO.getScenePhotos());
|
||||
params.put("isChecked", 1);
|
||||
params.put("isCompleted", 1);
|
||||
params.put("checkTime", DateUtil.getTime());
|
||||
taskCheckDao.updateTaskEnterpriseStatus(params);
|
||||
for (TaskCheckReportVO.TaskCheckReportItemVO taskCheckReportItemVO : taskCheckReportVO.getTaskCheckReportItems()) {
|
||||
params = HashMapUtil.beanToMap(taskCheckReportItemVO);
|
||||
params.put("taskId", taskCheckReportVO.getTaskId());
|
||||
params.put("taskEnterpriseId", taskCheckReportVO.getTaskEnterpriseId());
|
||||
setSaveInfoByUserId(params, appTokenUser.getId());
|
||||
taskCheckDao.saveTaskCheckReport(params);
|
||||
}
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskCheckDTO> listTask(Map<String, Object> params) throws SearchException {
|
||||
return taskCheckDao.listTask(params);
|
||||
@ -128,6 +154,13 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
|
||||
return new SuccessResultList<>(taskCheckDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskCheckDTO getTaskById(String taskId) throws SearchException {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("taskId", taskId);
|
||||
return taskCheckDao.getTask(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseDTO> listRandomEnterprise(int randomCount, Map<String, Object> params) throws SearchException {
|
||||
params.put("isLogOff", 0);
|
||||
@ -192,6 +225,18 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
|
||||
public SuccessResultList<List<TaskCheckDTO>> listPageTaskCheckOfMine(String token, ListPage page) throws SearchException {
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
page.getParams().put("checkUserId", appTokenUser.getId());
|
||||
return listPageTaskCheck(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterpriseOfMine(String token, String taskId, ListPage page) throws SearchException {
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
page.getParams().put("checkUserId", appTokenUser.getId());
|
||||
return listPageTaskEnterprise(taskId, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<TaskCheckDTO>> listPageTaskCheck(ListPage page) throws SearchException {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<TaskCheckDTO> taskCheckDTOs = taskCheckDao.listTask(page.getParams());
|
||||
PageInfo<TaskCheckDTO> pageInfo = new PageInfo(taskCheckDTOs);
|
||||
@ -199,14 +244,27 @@ public class TaskCheckServiceImpl extends BaseService implements ITaskCheckServi
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterpriseOfMine(String token, String taskId, ListPage page) throws SearchException {
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
page.getParams().put("checkUserId", appTokenUser.getId());
|
||||
public SuccessResultList<List<TaskCheckDTO.EnterpriseDTO>> listPageTaskEnterprise(String taskId, ListPage page) throws SearchException {
|
||||
page.getParams().put("taskId", taskId);
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<TaskCheckDTO.EnterpriseDTO> taskCheckDTOs = taskCheckDao.listTaskEnterprise(page.getParams());
|
||||
PageInfo<TaskCheckDTO.EnterpriseDTO> pageInfo = new PageInfo(taskCheckDTOs);
|
||||
return new SuccessResultList<>(taskCheckDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
List<TaskCheckDTO.EnterpriseDTO> taskEnterpriseDTOs = taskCheckDao.listTaskEnterprise(page.getParams());
|
||||
PageInfo<TaskCheckDTO.EnterpriseDTO> pageInfo = new PageInfo(taskEnterpriseDTOs);
|
||||
if (page.getParams().get("checkUserId") == null) {
|
||||
List<String> userIds = new ArrayList<>();
|
||||
for (TaskCheckDTO.EnterpriseDTO enterpriseDTO : taskEnterpriseDTOs) {
|
||||
userIds.add(enterpriseDTO.getCheckUserId());
|
||||
}
|
||||
List<UserResourceBO> userResourceBOs = userService.listUserResourceByIds(userIds);
|
||||
for (TaskCheckDTO.EnterpriseDTO enterpriseDTO : taskEnterpriseDTOs) {
|
||||
for (UserResourceBO userResourceBO : userResourceBOs) {
|
||||
if (StringUtils.equals(enterpriseDTO.getCheckUserId(), userResourceBO.getUserId())) {
|
||||
enterpriseDTO.setCheckUserName(userResourceBO.getUserName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new SuccessResultList<>(taskEnterpriseDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,6 +30,8 @@
|
||||
<result column="enterprise_name" property="enterpriseName"/>
|
||||
<result column="enterprise_address" property="enterpriseAddress"/>
|
||||
<result column="enterprise_legal_person" property="enterpriseLegalPerson"/>
|
||||
<result column="enterprise_lng" property="enterpriseLng"/>
|
||||
<result column="enterprise_lat" property="enterpriseLat"/>
|
||||
<result column="industry_id" property="industryId"/>
|
||||
<result column="check_user_id" property="checkUserId"/>
|
||||
<result column="task_id" property="taskId"/>
|
||||
@ -172,6 +174,39 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 任务详情 -->
|
||||
<select id="getTask" parameterType="map" resultMap="taskCheckDTO">
|
||||
SELECT
|
||||
t1.task_id,
|
||||
t1.task_name,
|
||||
t1.task_summary,
|
||||
t1.task_type,
|
||||
t1.task_type_sub,
|
||||
t1.start_time,
|
||||
t1.end_time,
|
||||
t1.is_allotted,
|
||||
t1.check_item_list_type,
|
||||
t1.area1,
|
||||
t1.area2,
|
||||
t1.area3,
|
||||
t1.area4,
|
||||
t1.area5,
|
||||
t1.random_count,
|
||||
t1.publish_status,
|
||||
t1.publish_msg,
|
||||
t1.publish_use_time,
|
||||
t1.creator,
|
||||
LEFT(t1.gmt_create, 19) gmt_create
|
||||
FROM
|
||||
gen_task_v2 t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="taskId != null and taskId != ''">
|
||||
AND
|
||||
t1.task_id = #{taskId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 保存任务企业 -->
|
||||
<insert id="saveTaskEnterprise" parameterType="map">
|
||||
INSERT INTO gen_task_enterprise_v2(
|
||||
@ -234,6 +269,50 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 更新企业检查状态 -->
|
||||
<update id="updateTaskEnterpriseStatus" parameterType="map">
|
||||
UPDATE
|
||||
gen_task_enterprise_v2
|
||||
SET
|
||||
check_lng = #{checkLng},
|
||||
check_lat = #{checkLat},
|
||||
scene_photos = #{scenePhotos},
|
||||
is_checked = #{isChecked},
|
||||
is_completed = #{isCompleted},
|
||||
check_time = #{checkTime}
|
||||
WHERE
|
||||
task_enterprise_id = #{taskEnterpriseId}
|
||||
</update>
|
||||
|
||||
<!-- 保存任务检查上报 -->
|
||||
<insert id="saveTaskCheckReport" parameterType="map">
|
||||
INSERT INTO gen_task_check_report_v2(
|
||||
task_check_report_id,
|
||||
check_item_id,
|
||||
check_item_option_id,
|
||||
check_item_option_type,
|
||||
check_result,
|
||||
scene_photos,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
gmt_modified,
|
||||
is_delete
|
||||
) VALUES(
|
||||
#{taskCheckReportId},
|
||||
#{checkItemId},
|
||||
#{checkItemOptionId},
|
||||
#{checkItemOptionType},
|
||||
#{checkResult},
|
||||
#{scenePhotos},
|
||||
#{creator},
|
||||
#{gmtCreate},
|
||||
#{modifier},
|
||||
#{gmtModified},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 检查任务企业列表 -->
|
||||
<select id="listTaskEnterprise" parameterType="map" resultMap="taskEnterpriseDTO">
|
||||
SELECT
|
||||
@ -243,6 +322,8 @@
|
||||
jt1.address enterprise_address,
|
||||
jt1.legal_person enterprise_legal_person,
|
||||
jt1.industry_type industry_id,
|
||||
jt1.enterprise_lng,
|
||||
jt1.enterprise_lat,
|
||||
t1.check_user_id,
|
||||
t1.task_id,
|
||||
t1.is_checked,
|
||||
|
@ -0,0 +1,164 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/inspection/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var resizeTimeout = null;
|
||||
var taskId = top.restAjax.params(window.location.href).taskId;
|
||||
var tableUrl = 'api/taskcheck/v2/listpagetaskenterprise/{taskId}';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, [taskId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 22,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [[
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'enterpriseName', width: 240, title: '企业名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'enterpriseAddress', width: 400, title: '详细地址', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'enterpriseLegalPerson', width: 120, title: '企业法人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'isChecked', width: 90, title: '是否检查', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null) {
|
||||
return '-';
|
||||
}
|
||||
if(rowData == 0) {
|
||||
return '否';
|
||||
}
|
||||
if(rowData == 1) {
|
||||
return '是';
|
||||
}
|
||||
return '错误';
|
||||
}
|
||||
},
|
||||
{field: 'isCompleted', width: 90, title: '是否完成', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null) {
|
||||
return '-';
|
||||
}
|
||||
if(rowData == 0) {
|
||||
return '否';
|
||||
}
|
||||
if(rowData == 1) {
|
||||
return '是';
|
||||
}
|
||||
return '错误';
|
||||
}
|
||||
},
|
||||
{field: 'checkUserName', width: 120, title: '企业检查人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'operation', width: 90, title: '操作', fixed: 'right', align:'center',
|
||||
templet: function(row) {
|
||||
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="checkItemEvent">检查项</button>';
|
||||
}
|
||||
},
|
||||
]],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, [taskId]),
|
||||
where: {},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var data = obj.data;
|
||||
var event = obj.event;
|
||||
if(event === 'pollutionEvent') {
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -240,6 +240,14 @@
|
||||
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="publishMsgEvent">查看结果</button>';
|
||||
}
|
||||
},
|
||||
{field: 'taskEnterpriseOption', width: 100, title: '检查企业', align:'center', fixed: 'right',
|
||||
templet: function(row) {
|
||||
if(row.publishStatus != 1) {
|
||||
return '-';
|
||||
}
|
||||
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="taskEnterpriseEvent">查看企业</button>';
|
||||
}
|
||||
},
|
||||
]],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
@ -358,6 +366,14 @@
|
||||
shadeClose: true,
|
||||
content: '<div style="padding: 15px;"><pre>'+ data.publishMsg +'</pre></div>'
|
||||
});
|
||||
} else if(event === 'taskEnterpriseEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/taskcheck/v2/list-task-enterprise.html?taskId={taskId}', [data.taskId]),
|
||||
title: '检查企业列表',
|
||||
width: '70%',
|
||||
height: '80%',
|
||||
onClose: function () {}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user