新增环保任务保存、随机企业、随机网格员接口

This commit is contained in:
wanggeng888 2021-01-04 18:10:11 +08:00
parent f6050b9a0d
commit e98dac921b
29 changed files with 689 additions and 102 deletions

View File

@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@ -31,11 +32,11 @@ import java.util.Map;
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "企业检查项接口")
@RestController("CheckItemV2Controller")
@RestController("checkItemV2Controller")
@RequestMapping(ISystemConstant.API_PREFIX + "/enterprise/checkitem/v2")
public class CheckItemController extends AbstractController {
@Autowired
@Resource(name = "checkItemV2Service")
private ICheckItemService checkItemService;
@Autowired
private SecurityComponent securityComponent;

View File

@ -10,12 +10,9 @@ import com.cm.common.pojo.dtos.CurrentUserIdInfoDTO;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemV2DTO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemBindV2VO;
import com.cm.inspection.service.industrycheckitem.IIndustryCheckItemService;
import com.cm.inspection.service.industrycheckitem.v2.IIndustryCheckItemV2Service;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemDTO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemBindVO;
import com.cm.inspection.service.industrycheckitem.v2.IIndustryCheckItemService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -31,12 +28,12 @@ import java.util.Map;
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "行业检查项接口")
@RestController
@RestController("industryCheckItemV2Controller")
@RequestMapping(ISystemConstant.API_PREFIX + "/industrycheckitem/v2")
public class IndustryCheckItemV2Controller extends AbstractController {
public class IndustryCheckItemController extends AbstractController {
@Autowired
private IIndustryCheckItemV2Service industryCheckItemV2Service;
private IIndustryCheckItemService industryCheckItemService;
@Autowired
private SecurityComponent securityComponent;
@ -44,8 +41,8 @@ public class IndustryCheckItemV2Controller extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveindustrycheckitembyindustryid/{industryId}")
@CheckRequestBodyAnnotation
public SuccessResult saveIndustryCheckItemByNatureId(@PathVariable("industryId") String industryId, @RequestBody IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
return industryCheckItemV2Service.saveIndustryCheckItemByNatureId(industryId, industryCheckItemBindV2VO);
public SuccessResult saveIndustryCheckItemByNatureId(@PathVariable("industryId") String industryId, @RequestBody IndustryCheckItemBindVO industryCheckItemBindVO) throws Exception {
return industryCheckItemService.saveIndustryCheckItemByNatureId(industryId, industryCheckItemBindVO);
}
@ApiOperation(value = "行业检查项详情(通过ID)", notes = "行业检查项详情(通过ID)接口")
@ -54,25 +51,25 @@ public class IndustryCheckItemV2Controller extends AbstractController {
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getindustrycheckitembyid/{industryCheckItemId}")
public IndustryCheckItemV2DTO getIndustryCheckItemById(@PathVariable("industryCheckItemId") String industryCheckItemId) throws SearchException {
return industryCheckItemV2Service.getIndustryCheckItemById(industryCheckItemId);
public IndustryCheckItemDTO getIndustryCheckItemById(@PathVariable("industryCheckItemId") String industryCheckItemId) throws SearchException {
return industryCheckItemService.getIndustryCheckItemById(industryCheckItemId);
}
@ApiOperation(value = "行业检查项列表", notes = "行业检查项列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listindustrycheckitem")
public List<IndustryCheckItemV2DTO> listIndustryCheckItem() throws SearchException {
public List<IndustryCheckItemDTO> listIndustryCheckItem() throws SearchException {
Map<String, Object> params = requestParams();
return industryCheckItemV2Service.listIndustryCheckItem(params);
return industryCheckItemService.listIndustryCheckItem(params);
}
@ApiOperation(value = "行业检查项列表(通过场所性质)", notes = "行业检查项列表(通过行业类型)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listindustrycheckitembyindustryid/{industryId}")
public List<IndustryCheckItemV2DTO> listIndustryCheckItemByNatureId(@PathVariable("industryId") String industryId) throws SearchException {
public List<IndustryCheckItemDTO> listIndustryCheckItemByNatureId(@PathVariable("industryId") String industryId) throws SearchException {
Map<String, Object> params = requestParams();
params.put("industryId", industryId);
return industryCheckItemV2Service.listIndustryCheckItem(params);
return industryCheckItemService.listIndustryCheckItem(params);
}
@ApiOperation(value = "行业检查项分页列表", notes = "行业检查项分页列表接口")
@ -85,10 +82,10 @@ public class IndustryCheckItemV2Controller extends AbstractController {
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpageindustrycheckitem")
public SuccessResultList<List<IndustryCheckItemV2DTO>> listPageIndustryCheckItem(ListPage page) throws SearchException {
public SuccessResultList<List<IndustryCheckItemDTO>> listPageIndustryCheckItem(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return industryCheckItemV2Service.listPageIndustryCheckItem(page);
return industryCheckItemService.listPageIndustryCheckItem(page);
}
@ApiOperation(value = "当前用户id信息", notes = "当前用户id信息接口")

View File

@ -0,0 +1,88 @@
package com.cm.inspection.controller.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.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.utils.RegexUtil;
import com.cm.inspection.enums.task.v2.TaskTypeSubEnum;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO;
import com.cm.inspection.service.taskcheck.v2.ITaskCheckService;
import io.swagger.annotations.*;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TaskCheckV2Controller
* @Description: 环保检查任务
* @Author: wanggeng
* @Date: 2021/1/3 12:19 下午
* @Version: 1.0
*/
@Data
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "环保检查任务")
@RestController("TaskCheckV2Controller")
@RequestMapping(ISystemConstant.API_PREFIX + "/taskcheck//v2")
public class TaskCheckController extends AbstractController {
@Resource(name = "taskCheckV2Service")
private ITaskCheckService taskCheckService;
@ApiOperation(value = "新增检查任务", notes = "新增检查任务接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@CheckRequestBodyAnnotation
public synchronized SuccessResult save(@RequestBody TaskCheckVO taskCheckVO) throws Exception {
if (taskCheckVO.getTaskTypeSub() == TaskTypeSubEnum.LIMIT.getValue()) {
if (StringUtils.isBlank(taskCheckVO.getStartTime())) {
throw new ParamsException("开始时间不能为空");
}
if (RegexUtil.isDatetime(taskCheckVO.getStartTime())) {
throw new ParamsException("开始时间格式错误");
}
if (StringUtils.isBlank(taskCheckVO.getEndTime())) {
throw new ParamsException("结束时间不能为空");
}
if (RegexUtil.isDatetime(taskCheckVO.getEndTime())) {
throw new ParamsException("结束时间格式错误");
}
}
return taskCheckService.save(taskCheckVO);
}
@ApiOperation(value = "随机企业列表", notes = "随机企业列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "randomCount", value = "随机数", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listrandomenterprise/{randomCount}")
public List<EnterpriseDTO> listRandomEnterprise(@PathVariable("randomCount") Integer randomCount) {
Map<String, Object> params = requestParams();
return taskCheckService.listRandomEnterprise(randomCount, params);
}
@ApiOperation(value = "随机网格员列表", notes = "随机网格员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "randomCount", value = "随机数", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listrandomgridpersonnel/{randomCount}")
public List<GridPersonnelDTO> listRandomGridPersonnel(@PathVariable("randomCount") Integer randomCount) {
Map<String, Object> params = requestParams();
return taskCheckService.listRandomGridPersonnel(randomCount, params);
}
}

View File

@ -18,7 +18,7 @@ import java.util.Map;
* @Date: 2020-03-25 22:59
* @Version: 1.0
**/
@Repository("ICheckItemV2Dao")
@Repository("checkItemV2Dao")
public interface ICheckItemDao {
/**

View File

@ -137,9 +137,19 @@ public interface IEnterpriseOfGridOperatorDao {
/**
* 统计认领企业
*
* @param params
* @return
* @throws SearchException
*/
Integer countEnterpriseOfGridOperatorSimple(Map<String, Object> params) throws SearchException;
/**
* 企业网格员列表简单格式
*
* @param params
* @return
* @throws SearchException
*/
List<EnterpriseOfGridOperatorDTO> listSimple(Map<String, Object> params) throws SearchException;
}

View File

@ -4,8 +4,7 @@ import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemV2DTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -18,8 +17,8 @@ import java.util.Map;
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@Repository
public interface IIndustryCheckItemV2Dao {
@Repository("industryCheckItemV2Dao")
public interface IIndustryCheckItemDao {
/**
* 新增行业检查项
@ -60,7 +59,7 @@ public interface IIndustryCheckItemV2Dao {
* @return
* @throws SearchException
*/
IndustryCheckItemV2DTO getIndustryCheckItem(Map<String, Object> params) throws SearchException;
IndustryCheckItemDTO getIndustryCheckItem(Map<String, Object> params) throws SearchException;
/**
* 行业检查项列表
@ -69,7 +68,14 @@ public interface IIndustryCheckItemV2Dao {
* @return
* @throws SearchException
*/
List<IndustryCheckItemV2DTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException;
List<IndustryCheckItemDTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException;
/**
* 行业检查项列表
*
* @param params
* @return
* @throws SearchException
*/
List<IndustryCheckItemDTO> listSimple(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,43 @@
package com.cm.inspection.dao.taskcheck.v2;
import com.cm.common.exception.SaveException;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: ITaskCheckV2Dao
* @Description: 环保检查任务
* @Author: wanggeng
* @Date: 2021/1/3 12:25 下午
* @Version: 1.0
*/
@Repository("taskCheckV2Dao")
public interface ITaskCheckDao {
/**
* 保存任务
*
* @param params
* @throws SaveException
*/
void saveTask(Map<String, Object> params) throws SaveException;
/**
* 保存任务企业
*
* @param params
* @throws SaveException
*/
void saveTaskEnterprise(Map<String, Object> params) throws SaveException;
/**
* 保存任务检查项
*
* @param params
* @throws SaveException
*/
void saveTaskEnterpriseCheckItem(Map<String, Object> params) throws SaveException;
}

View File

@ -0,0 +1,36 @@
package com.cm.inspection.enums.task.v2;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: CheckItemListTypeEnum
* @Description: 检查项列表类型
* @Author: wanggeng
* @Date: 2021/1/3 8:56 下午
* @Version: 1.0
*/
public enum CheckItemListTypeEnum {
/**
* 默认项关联+自定义
*/
DEFAULT(1),
/**
* 关联项
*/
RELATION(2),
/**
* 自定义项
*/
CUSTOM(3);
private int value;
CheckItemListTypeEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@ -0,0 +1,36 @@
package com.cm.inspection.enums.task.v2;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TaskTypeEnum
* @Description: 环保任务类型
* @Author: wanggeng
* @Date: 2021/1/3 2:47 下午
* @Version: 1.0
*/
public enum TaskTypeEnum {
/**
* 指定任务
*/
ALLOCATE(1),
/**
* 单随机
*/
SINGLE_RANDOM(2),
/**
* 双随机
*/
DOUBLE_RANDOM(3);
private int value;
TaskTypeEnum (int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@ -0,0 +1,26 @@
package com.cm.inspection.enums.task.v2;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TaskTypeSubEnum
* @Description: 环保子任务类型
* @Author: wanggeng
* @Date: 2021/1/3 2:45 下午
* @Version: 1.0
*/
public enum TaskTypeSubEnum {
UN_LIMIT(1),
LIMIT(2);
private int value;
TaskTypeSubEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

View File

@ -16,7 +16,7 @@ import java.util.List;
* @Version: 1.0
**/
@ApiModel
public class IndustryCheckItemV2DTO implements Serializable {
public class IndustryCheckItemDTO implements Serializable {
private static final long serialVersionUID = -3848466845851514488L;
@ApiModelProperty(name = "industryCheckItemId", value = "主键")

View File

@ -0,0 +1,14 @@
package com.cm.inspection.pojo.dtos.taskcheck.v2;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TaskCheckV2DTO
* @Description: 环保检查任务
* @Author: wanggeng
* @Date: 2021/1/3 12:29 下午
* @Version: 1.0
*/
public class TaskCheckV2DTO {
}

View File

@ -18,7 +18,7 @@ import java.util.List;
* @Version: 1.0
**/
@ApiModel
public class IndustryCheckItemBindV2VO {
public class IndustryCheckItemBindVO {
@ApiModelProperty(name = "industryCheckItems", value = "行业性质检查项列表")
private List<IndustryCheckItemVO> industryCheckItems;

View File

@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
* @Version: 1.0
**/
@ApiModel
public class IndustryCheckItemV2VO {
public class IndustryCheckItemVO {
@ApiModelProperty(name = "checkItemParentId", value = "检查项上级ID")
private String checkItemParentId;

View File

@ -0,0 +1,87 @@
package com.cm.inspection.pojo.vos.taskcheck.v2;
import com.cm.common.annotation.CheckEmptyAnnotation;
import com.cm.common.annotation.CheckNumberAnnotation;
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: TaskCheckV2VO
* @Description: 环保检查任务
* @Author: wanggeng
* @Date: 2021/1/3 12:28 下午
* @Version: 1.0
*/
@Data
@ApiModel
public class TaskCheckVO {
@ApiModelProperty(name = "taskName", value = "任务名称")
@CheckEmptyAnnotation(name = "任务名称")
private String taskName;
@ApiModelProperty(name = "taskSummary", value = "任务说明")
private String taskSummary;
@ApiModelProperty(name = "taskType", value = "任务种类1指定任务2单随机任务3双随机任务")
@CheckNumberAnnotation(name = "任务种类", types = {"1", "2", "3"})
private Integer taskType;
@ApiModelProperty(name = "taskTypeSub", value = "子任务种类1不限时任务2限时任务")
@CheckNumberAnnotation(name = "子任务种类", types = {"1", "2"})
private Integer taskTypeSub;
@ApiModelProperty(name = "checkItemListType", value = "检查项列表类型1默认项关联+自定义2关联项3自定义项")
@CheckNumberAnnotation(name = "检查项列表类型", types = {"1", "2", "3"})
private Integer checkItemListType;
@ApiModelProperty(name = "startTime", value = "开始时间")
private String startTime;
@ApiModelProperty(name = "endTime", value = "结束时间")
private String endTime;
@ApiModelProperty(name = "isAllotted", value = "是否已经分配")
private Integer isAllotted;
@ApiModelProperty(name = "area1Id", value = "1级区域")
private String area1Id;
@ApiModelProperty(name = "area2Id", value = "2级区域")
private String area2Id;
@ApiModelProperty(name = "area3Id", value = "3级区域")
private String area3Id;
@ApiModelProperty(name = "area4Id", value = "4级区域")
private String area4Id;
@ApiModelProperty(name = "area5Id", value = "5级区域")
private String area5Id;
@ApiModelProperty(name = "enterprises", value = "企业列表")
private List<EnterpriseVO> enterprises;
@Data
@ApiModel
public static class EnterpriseVO {
@ApiModelProperty(name = "enterpriseId", value = "企业ID")
private String enterpriseId;
@ApiModelProperty(name = "industryId", value = "行业ID")
private String industryId;
@ApiModelProperty(name = "checkUserId", value = "检查人ID")
private String checkUserId;
@ApiModelProperty(name = "checkItems", value = "检查项列表")
private List<CheckItemVO> checkItems;
@Data
@ApiModel
public static class CheckItemVO {
@ApiModelProperty(name = "checkItemId", value = "检查项ID")
private String checkItemId;
@ApiModelProperty(name = "checkItemParentId", value = "检查项上级ID")
private String checkItemParentId;
@ApiModelProperty(name = "checkItemType", value = "检查项类型")
private Integer checkItemType;
}
}
}

View File

@ -238,5 +238,15 @@ public interface IEnterpriseService {
*/
EnterprisePollutionDTO getEnterprisePollutionByEnterpriseId(String enterpriseId) throws SearchException;
/**
* 企业列表
*
* @param area1Id
* @param area2Id
* @param area3Id
* @param area4Id
* @param area5Id
* @return
*/
List<EnterpriseDTO> listSimpleByArea(String area1Id, String area2Id, String area3Id, String area4Id, String area5Id);
}

View File

@ -86,4 +86,12 @@ public interface ICheckItemService {
*/
SuccessResultList<List<CheckItemDTO>> listPage(ListPage page) throws SearchException;
/**
* 检查项列表
*
* @param enterpriseId 企业ID
* @return
* @throws SearchException
*/
List<CheckItemDTO> listByEnterpriseId(String enterpriseId) throws SearchException;
}

View File

@ -18,6 +18,7 @@ import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -29,10 +30,10 @@ import java.util.Map;
* @Date: 2020-03-25 22:59
* @Version: 1.0
**/
@Service("CheckItemServiceV2Impl")
@Service("checkItemV2Service")
public class CheckItemServiceImpl extends BaseService implements ICheckItemService {
@Autowired
@Resource(name = "checkItemV2Dao")
private ICheckItemDao checkItemDao;
@Override
@ -93,4 +94,10 @@ public class CheckItemServiceImpl extends BaseService implements ICheckItemServi
return new SuccessResultList<>(checkItemDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public List<CheckItemDTO> listByEnterpriseId(String enterpriseId) throws SearchException {
Map<String, Object> params = getHashMap(2);
params.put("enterpriseId", enterpriseId);
return list(params);
}
}

View File

@ -30,10 +30,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @ClassName: EnterpriseServiceImpl
@ -383,6 +380,20 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
return enterpriseDao.getEnterprisePollution(params);
}
@Override
public List<EnterpriseDTO> listSimpleByArea(String area1Id, String area2Id, String area3Id, String area4Id, String area5Id) {
Map<String, Object> params = getHashMap(10);
params.put("area1", area1Id);
params.put("area2", area2Id);
params.put("area3", area3Id);
params.put("area4", area4Id);
params.put("area5", area5Id);
List<EnterpriseDTO> oldEnterprises = listEnterprise(params);
List<EnterpriseDTO> newEnterprises = new ArrayList<>(oldEnterprises.size());
Collections.copy(newEnterprises, oldEnterprises);
return newEnterprises;
}
/**
* 通过企业ID列表获取企业污染因子列表
*

View File

@ -226,4 +226,13 @@ public interface IEnterpriseOfGridOperatorService {
* @throws SearchException
*/
Integer countEnterpriseOfGridOperator(Map<String, Object> params) throws SearchException;
/**
* 企业网格员列表简单格式
*
* @param params
* @return
* @throws SearchException
*/
List<EnterpriseOfGridOperatorDTO> listSimple(Map<String, Object> params) throws SearchException;
}

View File

@ -271,6 +271,11 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements
return count == null ? 0 : count;
}
@Override
public List<EnterpriseOfGridOperatorDTO> listSimple(Map<String, Object> params) throws SearchException {
return enterpriseOfGridOperatorDao.listSimple(params);
}
/**
* 初始化未认领地区
*

View File

@ -5,12 +5,9 @@ import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemV2DTO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemBindV2VO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemV2VO;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemDTO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemVO;
import java.util.List;
import java.util.Map;
@ -22,7 +19,7 @@ import java.util.Map;
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
public interface IIndustryCheckItemV2Service {
public interface IIndustryCheckItemService {
/**
* 新增行业检查项
@ -32,18 +29,18 @@ public interface IIndustryCheckItemV2Service {
* @return
* @throws Exception
*/
SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindV2VO industryCheckItemV2VO) throws Exception;
SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindVO industryCheckItemV2VO) throws Exception;
/**
* 新增行业检查项(APP)
*
* @param token
* @param industryId
* @param industryCheckItemBindV2VO
* @param industryCheckItemBindVO
* @return
* @throws Exception
*/
SuccessResult saveIndustryCheckItemByNatureIdAndToken(String token, String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception;
SuccessResult saveIndustryCheckItemByNatureIdAndToken(String token, String industryId, IndustryCheckItemBindVO industryCheckItemBindVO) throws Exception;
/**
* 删除行业检查项
@ -68,22 +65,22 @@ public interface IIndustryCheckItemV2Service {
* 修改行业检查项
*
* @param industryCheckItemId
* @param industryCheckItemV2VO
* @param industryCheckItemVO
* @return
* @throws Exception
*/
SuccessResult updateIndustryCheckItem(String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception;
SuccessResult updateIndustryCheckItem(String industryCheckItemId, IndustryCheckItemVO industryCheckItemVO) throws Exception;
/**
* 修改行业检查项(APP)
*
* @param token
* @param industryCheckItemId
* @param industryCheckItemV2VO
* @param industryCheckItemVO
* @return
* @throws Exception
*/
SuccessResult updateIndustryCheckItemByToken(String token, String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception;
SuccessResult updateIndustryCheckItemByToken(String token, String industryCheckItemId, IndustryCheckItemVO industryCheckItemVO) throws Exception;
/**
* 行业检查项详情(通过ID)
@ -92,7 +89,7 @@ public interface IIndustryCheckItemV2Service {
* @return
* @throws SearchException
*/
IndustryCheckItemV2DTO getIndustryCheckItemById(String industryCheckItemId) throws SearchException;
IndustryCheckItemDTO getIndustryCheckItemById(String industryCheckItemId) throws SearchException;
/**
* 行业检查项列表
@ -101,7 +98,7 @@ public interface IIndustryCheckItemV2Service {
* @return
* @throws SearchException
*/
List<IndustryCheckItemV2DTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException;
List<IndustryCheckItemDTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException;
/**
* 行业检查项分页列表
@ -110,7 +107,7 @@ public interface IIndustryCheckItemV2Service {
* @return
* @throws SearchException
*/
SuccessResultList<List<IndustryCheckItemV2DTO>> listPageIndustryCheckItem(ListPage page) throws SearchException;
SuccessResultList<List<IndustryCheckItemDTO>> listPageIndustryCheckItem(ListPage page) throws SearchException;
/**
* 获取行业检查项列表通过场所性质
@ -119,5 +116,14 @@ public interface IIndustryCheckItemV2Service {
* @return
* @throws SearchException
*/
List<IndustryCheckItemV2DTO> listIndustryCheckItemByIndustryId(String industryId) throws SearchException;
List<IndustryCheckItemDTO> listIndustryCheckItemByIndustryId(String industryId) throws SearchException;
/**
* 行业检查项列表
*
* @param industryId
* @return
* @throws SearchException
*/
List<IndustryCheckItemDTO> listByIndustryId(String industryId) throws SearchException;
}

View File

@ -7,21 +7,19 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.industrycheckitem.v2.IIndustryCheckItemV2Dao;
import com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemV2DTO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemBindV2VO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemV2VO;
import com.cm.inspection.dao.industrycheckitem.v2.IIndustryCheckItemDao;
import com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemDTO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.v2.IndustryCheckItemVO;
import com.cm.inspection.service.BaseService;
import com.cm.inspection.service.checkitemoption.ICheckItemOptionService;
import com.cm.inspection.service.industrycheckitem.v2.IIndustryCheckItemV2Service;
import com.cm.inspection.service.industrycheckitem.v2.IIndustryCheckItemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -33,23 +31,23 @@ import java.util.Map;
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@Service
public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndustryCheckItemV2Service {
@Service("industryCheckItemV2Service")
public class IndustryCheckItemServiceImpl extends BaseService implements IIndustryCheckItemService {
@Autowired
private IIndustryCheckItemV2Dao industryCheckItemV2Dao;
@Resource(name = "industryCheckItemV2Dao")
private IIndustryCheckItemDao industryCheckItemDao;
@Autowired
private ICheckItemOptionService checkItemOptionService;
@Override
public SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
saveIndustryCheckItemInfo(null, industryId, industryCheckItemBindV2VO);
public SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindVO industryCheckItemBindVO) throws Exception {
saveIndustryCheckItemInfo(null, industryId, industryCheckItemBindVO);
return new SuccessResult();
}
@Override
public SuccessResult saveIndustryCheckItemByNatureIdAndToken(String token, String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
saveIndustryCheckItemInfo(token, industryId, industryCheckItemBindV2VO);
public SuccessResult saveIndustryCheckItemByNatureIdAndToken(String token, String industryId, IndustryCheckItemBindVO industryCheckItemBindVO) throws Exception {
saveIndustryCheckItemInfo(token, industryId, industryCheckItemBindVO);
return new SuccessResult();
}
@ -58,16 +56,16 @@ public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndu
*
* @param token
* @param industryId
* @param industryCheckItemBindV2VO
* @param industryCheckItemBindVO
* @throws Exception
*/
private void saveIndustryCheckItemInfo(String token, String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
private void saveIndustryCheckItemInfo(String token, String industryId, IndustryCheckItemBindVO industryCheckItemBindVO) throws Exception {
// 清空原数据
Map<String, Object> params = getHashMap(1);
params.put("industryId", industryId);
industryCheckItemV2Dao.deleteIndustryCheckItem(params);
industryCheckItemDao.deleteIndustryCheckItem(params);
// 保存数据
for (IndustryCheckItemVO industryCheckItemVO : industryCheckItemBindV2VO.getIndustryCheckItems()) {
for (com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO industryCheckItemVO : industryCheckItemBindVO.getIndustryCheckItems()) {
params = HashMapUtil.beanToMap(industryCheckItemVO);
params.put("industryCheckItemId", UUIDUtil.getUUID());
params.put("industryId", industryId);
@ -76,7 +74,7 @@ public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndu
} else {
setSaveInfo(params);
}
industryCheckItemV2Dao.saveIndustryCheckItem(params);
industryCheckItemDao.saveIndustryCheckItem(params);
}
}
@ -106,18 +104,18 @@ public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndu
} else {
setUpdateInfo(params);
}
industryCheckItemV2Dao.removeIndustryCheckItem(params);
industryCheckItemDao.removeIndustryCheckItem(params);
}
@Override
public SuccessResult updateIndustryCheckItem(String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception {
updateIndustryCheckItemInfo(null, industryCheckItemId, industryCheckItemV2VO);
public SuccessResult updateIndustryCheckItem(String industryCheckItemId, IndustryCheckItemVO industryCheckItemVO) throws Exception {
updateIndustryCheckItemInfo(null, industryCheckItemId, industryCheckItemVO);
return new SuccessResult();
}
@Override
public SuccessResult updateIndustryCheckItemByToken(String token, String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception {
updateIndustryCheckItemInfo(token, industryCheckItemId, industryCheckItemV2VO);
public SuccessResult updateIndustryCheckItemByToken(String token, String industryCheckItemId, IndustryCheckItemVO industryCheckItemVO) throws Exception {
updateIndustryCheckItemInfo(token, industryCheckItemId, industryCheckItemVO);
return new SuccessResult();
}
@ -126,24 +124,24 @@ public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndu
*
* @param token
* @param industryCheckItemId
* @param industryCheckItemV2VO
* @param industryCheckItemVO
*/
private void updateIndustryCheckItemInfo(String token, String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(industryCheckItemV2VO);
private void updateIndustryCheckItemInfo(String token, String industryCheckItemId, IndustryCheckItemVO industryCheckItemVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(industryCheckItemVO);
params.put("industryCheckItemId", industryCheckItemId);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
industryCheckItemV2Dao.updateIndustryCheckItem(params);
industryCheckItemDao.updateIndustryCheckItem(params);
}
@Override
public IndustryCheckItemV2DTO getIndustryCheckItemById(String industryCheckItemId) throws SearchException {
public IndustryCheckItemDTO getIndustryCheckItemById(String industryCheckItemId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("industryCheckItemId", industryCheckItemId);
IndustryCheckItemV2DTO industryCheckItemDTO = industryCheckItemV2Dao.getIndustryCheckItem(params);
IndustryCheckItemDTO industryCheckItemDTO = industryCheckItemDao.getIndustryCheckItem(params);
if (industryCheckItemDTO != null) {
params.clear();
setCheckItemOptions(industryCheckItemDTO, params);
@ -152,36 +150,43 @@ public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndu
}
@Override
public List<IndustryCheckItemV2DTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException {
List<IndustryCheckItemV2DTO> industryCheckItemDTOs = industryCheckItemV2Dao.listIndustryCheckItem(params);
public List<IndustryCheckItemDTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException {
List<IndustryCheckItemDTO> industryCheckItemDTOs = industryCheckItemDao.listIndustryCheckItem(params);
params.clear();
setCheckItemOptions(industryCheckItemDTOs, params);
return industryCheckItemDTOs;
}
@Override
public SuccessResultList<List<IndustryCheckItemV2DTO>> listPageIndustryCheckItem(ListPage page) throws SearchException {
public SuccessResultList<List<IndustryCheckItemDTO>> listPageIndustryCheckItem(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
List<IndustryCheckItemV2DTO> industryCheckItemDTOs = industryCheckItemV2Dao.listIndustryCheckItem(page.getParams());
PageInfo<IndustryCheckItemV2DTO> pageInfo = new PageInfo<>(industryCheckItemDTOs);
List<IndustryCheckItemDTO> industryCheckItemDTOs = industryCheckItemDao.listIndustryCheckItem(page.getParams());
PageInfo<IndustryCheckItemDTO> pageInfo = new PageInfo<>(industryCheckItemDTOs);
return new SuccessResultList<>(industryCheckItemDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public List<IndustryCheckItemV2DTO> listIndustryCheckItemByIndustryId(String industryId) throws SearchException {
public List<IndustryCheckItemDTO> listIndustryCheckItemByIndustryId(String industryId) throws SearchException {
Map<String, Object> params = getHashMap(1);
params.put("industryId", industryId);
return listIndustryCheckItem(params);
}
@Override
public List<IndustryCheckItemDTO> listByIndustryId(String industryId) throws SearchException {
Map<String, Object> params = getHashMap(2);
params.put("industryId", industryId);
return industryCheckItemDao.listSimple(params);
}
/**
* 设置检查选项
*
* @param industryCheckItemDTOs
* @param params
*/
private void setCheckItemOptions(List<IndustryCheckItemV2DTO> industryCheckItemDTOs, Map<String, Object> params) {
for (IndustryCheckItemV2DTO industryCheckItemDTO : industryCheckItemDTOs) {
private void setCheckItemOptions(List<IndustryCheckItemDTO> industryCheckItemDTOs, Map<String, Object> params) {
for (IndustryCheckItemDTO industryCheckItemDTO : industryCheckItemDTOs) {
setCheckItemOptions(industryCheckItemDTO, params);
}
}
@ -192,7 +197,7 @@ public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndu
* @param industryCheckItemDTO
* @param params
*/
private void setCheckItemOptions(IndustryCheckItemV2DTO industryCheckItemDTO, Map<String, Object> params) {
private void setCheckItemOptions(IndustryCheckItemDTO industryCheckItemDTO, Map<String, Object> params) {
params.put("checkItemId", industryCheckItemDTO.getCheckItemId());
industryCheckItemDTO.setCheckItemOptions(checkItemOptionService.listCheckItemOption(params));
}

View File

@ -0,0 +1,53 @@
package com.cm.inspection.service.taskcheck.v2;
import com.cm.common.exception.SearchException;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.vos.taskcheck.v2.TaskCheckVO;
import java.util.List;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: ITaskCheckV2Service
* @Description: 环保任务检查
* @Author: wanggeng
* @Date: 2021/1/3 12:23 下午
* @Version: 1.0
*/
public interface ITaskCheckService {
/**
* 新增检查任务
*
* @param taskCheckVO
* @return
* @throws Exception
*/
SuccessResult save(TaskCheckVO taskCheckVO) throws Exception;
/**
* 随机企业列表
*
* @param randomCount 随机数
* @param params
* @return
* @throws SearchException
*/
List<EnterpriseDTO> listRandomEnterprise(int randomCount, Map<String, Object> params) throws SearchException;
/**
* 随机网格员列表
*
* @param randomCount 随机数
* @param params
* @return
* @throws SearchException
*/
List<GridPersonnelDTO> listRandomGridPersonnel(Integer randomCount, Map<String, Object> params) throws SearchException;
}

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.inspection.dao.enterprise.IEnterpriseDao">
<cache/>
<cache flushInterval="1800000"/>
<resultMap id="enterpriseDTO" type="com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO">
<id column="enterprise_id" property="enterpriseId"/>

View File

@ -665,4 +665,23 @@
</if>
</select>
<!-- 企业网格员列表(简单格式) -->
<select id="listSimple" parameterType="map" resultMap="enterpriseOfGridOperatorDTO">
SELECT
enterprise_of_grid_operator_id,
user_id,
enterprise_id
FROM
gen_enterprise_of_grid_operator
WHERE
is_delete = 0
<if test="enterpriseIds != null and enterpriseIds.size > 0">
AND
enterprise_id IN
<foreach collection="enterpriseIds" index="index" open="(" separator="," close=")">
#{enterpriseIds[${index}]}
</foreach>
</if>
</select>
</mapper>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.inspection.dao.industrycheckitem.v2.IIndustryCheckItemV2Dao">
<mapper namespace="com.cm.inspection.dao.industrycheckitem.v2.IIndustryCheckItemDao">
<resultMap id="industryCheckItemDTO" type="com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemV2DTO">
<resultMap id="industryCheckItemDTO" type="com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemDTO">
<id column="industry_check_item_id" property="industryCheckItemId"/>
<result column="industry_id" property="industryId"/>
<result column="nature_id_dictionary_name" property="natureIdDictionaryName"/>
@ -173,4 +173,37 @@
</if>
</select>
<!-- 行业检查项列表 -->
<select id="listSimple" parameterType="map" resultMap="industryCheckItemDTO">
SELECT
t1.industry_id,
t1.check_item_parent_id,
t1.check_item_id,
t1.type,
t1.industry_check_item_id
FROM
gen_industry_check_item_v2 t1
WHERE
t1.is_delete = 0
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="industryId != null and industryId != ''">
AND
t1.industry_id = #{industryId}
</if>
<if test="industryCheckItemIds != null and industryCheckItemIds.size > 0">
AND
t1.industry_check_item_id IN
<foreach collection="industryCheckItemIds" index="index" open="(" separator="," close=")">
#{industryCheckItemIds[${index}]}
</foreach>
</if>
</select>
</mapper>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.inspection.dao.taskcheck.v2.ITaskCheckDao">
<!-- 保存任务 -->
<insert id="saveTask" parameterType="map">
INSERT INTO gen_task_check_v2(
task_id,
task_name,
task_summary,
task_type,
task_type_sub,
start_time,
end_time,
is_allotted,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{taskId},
#{taskName},
#{taskSummary},
#{taskType},
#{taskTypeSub},
#{startTime},
#{endTime},
#{isAllotted},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 保存任务企业 -->
<insert id="saveTaskEnterprise" parameterType="map">
INSERT INTO gen_task_enterprise_v2(
task_enterprise_id,
task_check_id,
enterprise_id,
check_user_id,
is_checked,
check_time,
is_completed
) VALUES(
#{taskEnterpriseId},
#{taskCheckId},
#{enterpriseId},
#{checkUserId},
#{isChecked},
#{checkTime},
#{isCompleted}
)
</insert>
<!-- 保存任务检查项 -->
<insert id="saveTaskEnterpriseCheckItem" parameterType="map">
INSERT INTO gen_task_enterprise_check_item_v2(
task_check_id,
task_enterprise_id,
check_item_id,
check_item_parent_id,
check_item_type
) VALUES(
#{taskCheckId},
#{taskEnterpriseId},
#{checkItemId},
#{checkItemParentId},
#{checkItemType}
)
</insert>
</mapper>

View File

@ -71,7 +71,7 @@
title: 'dictionaryName',
name: 'dictionaryName',
id: 'dictionaryId',
children: 'subDictionary'
// children: 'subDictionary'
},
},
callback: {