添加企业类型检查指标关联

This commit is contained in:
wenc000 2020-12-28 12:27:43 +08:00
parent c5c3b10c84
commit baf9fe4512
16 changed files with 1241 additions and 16 deletions

View File

@ -4,7 +4,6 @@ import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.CurrentUserIdInfoDTO;
@ -13,13 +12,11 @@ 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.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
import com.cm.inspection.service.industrycheckitem.IIndustryCheckItemService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

View File

@ -0,0 +1,101 @@
package com.cm.inspection.controller.apis.industrycheckitem.v2;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
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 io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IndustryCheckItemController
* @Description: 行业检查项
* @Author: WenG
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "行业检查项接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/industrycheckitem/v2")
public class IndustryCheckItemV2Controller extends AbstractController {
@Autowired
private IIndustryCheckItemV2Service industryCheckItemV2Service;
@Autowired
private SecurityComponent securityComponent;
@ApiOperation(value = "新增行业检查项", notes = "新增行业检查项接口")
@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);
}
@ApiOperation(value = "行业检查项详情(通过ID)", notes = "行业检查项详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "industryCheckItemId", value = "行业检查项ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getindustrycheckitembyid/{industryCheckItemId}")
public IndustryCheckItemV2DTO getIndustryCheckItemById(@PathVariable("industryCheckItemId") String industryCheckItemId) throws SearchException {
return industryCheckItemV2Service.getIndustryCheckItemById(industryCheckItemId);
}
@ApiOperation(value = "行业检查项列表", notes = "行业检查项列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listindustrycheckitem")
public List<IndustryCheckItemV2DTO> listIndustryCheckItem() throws SearchException {
Map<String, Object> params = requestParams();
return industryCheckItemV2Service.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 {
Map<String, Object> params = requestParams();
params.put("industryId", industryId);
return industryCheckItemV2Service.listIndustryCheckItem(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("listpageindustrycheckitem")
public SuccessResultList<List<IndustryCheckItemV2DTO>> listPageIndustryCheckItem(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return industryCheckItemV2Service.listPageIndustryCheckItem(page);
}
@ApiOperation(value = "当前用户id信息", notes = "当前用户id信息接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcurrentuseridinfo")
public CurrentUserIdInfoDTO getCurrentUserIdInfo() {
return securityComponent.getCurrentUserIdInfo();
}
}

View File

@ -3,7 +3,6 @@ package com.cm.inspection.controller.app.apis.industrycheckitem;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
@ -11,13 +10,11 @@ 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.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
import com.cm.inspection.service.industrycheckitem.IIndustryCheckItemService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

View File

@ -3,7 +3,6 @@ package com.cm.inspection.controller.resources.industrycheckitem;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
@ -11,13 +10,11 @@ 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.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
import com.cm.inspection.service.industrycheckitem.IIndustryCheckItemService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

View File

@ -0,0 +1,75 @@
package com.cm.inspection.dao.industrycheckitem.v2;
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 org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IIndustryCheckItemDao
* @Description: 行业检查项
* @Author: WenG
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@Repository
public interface IIndustryCheckItemV2Dao {
/**
* 新增行业检查项
*
* @param params
* @throws SaveException
*/
void saveIndustryCheckItem(Map<String, Object> params) throws SaveException;
/**
* 删除行业检查项
*
* @param params
* @throws RemoveException
*/
void removeIndustryCheckItem(Map<String, Object> params) throws RemoveException;
/**
* 删除行业检查项物理删除
*
* @param params
* @throws RemoveException
*/
void deleteIndustryCheckItem(Map<String, Object> params) throws RemoveException;
/**
* 修改行业检查项
*
* @param params
* @throws UpdateException
*/
void updateIndustryCheckItem(Map<String, Object> params) throws UpdateException;
/**
* 行业检查项详情
*
* @param params
* @return
* @throws SearchException
*/
IndustryCheckItemV2DTO getIndustryCheckItem(Map<String, Object> params) throws SearchException;
/**
* 行业检查项列表
*
* @param params
* @return
* @throws SearchException
*/
List<IndustryCheckItemV2DTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,176 @@
package com.cm.inspection.pojo.dtos.industrycheckitem.v2;
import com.cm.inspection.pojo.dtos.checkitemoption.CheckItemOptionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName: IndustryCheckItemDTO
* @Description: 行业检查项
* @Author: WenG
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@ApiModel
public class IndustryCheckItemV2DTO implements Serializable {
private static final long serialVersionUID = -3848466845851514488L;
@ApiModelProperty(name = "industryCheckItemId", value = "主键")
private String industryCheckItemId;
@ApiModelProperty(name = "industryId", value = "行业ID")
private String industryId;
@ApiModelProperty(name = "natureIdDictionaryName", value = "场所性质ID名称")
private String natureIdDictionaryName;
@ApiModelProperty(name = "checkItemParentId", value = "上级检查项ID")
private String checkItemParentId;
@ApiModelProperty(name = "checkItemId", value = "检查项ID")
private String checkItemId;
@ApiModelProperty(name = "nameJoinByCheckItemId", value = "检查项ID的名称")
private String nameJoinByCheckItemId;
@ApiModelProperty(name = "summaryJoinByCheckItemId", value = "检查项ID的说明")
private String summaryJoinByCheckItemId;
@ApiModelProperty(name = "typeJoinByCheckItemId", value = "检查项ID的类型")
private String typeJoinByCheckItemId;
@ApiModelProperty(name = "iconJoinByCheckItemId", value = "检查项ID的图标")
private String iconJoinByCheckItemId;
@ApiModelProperty(name = "iconPressJoinByCheckItemId", value = "检查项ID的图标按压")
private String iconPressJoinByCheckItemId;
@ApiModelProperty(name = "type", value = "类型")
private Integer type;
@ApiModelProperty(name = "checkItemOptions", value = "检查选项列表")
private List<CheckItemOptionDTO> checkItemOptions;
public String getIndustryCheckItemId() {
return industryCheckItemId == null ? "" : industryCheckItemId;
}
public void setIndustryCheckItemId(String industryCheckItemId) {
this.industryCheckItemId = industryCheckItemId;
}
public String getIndustryId() {
return industryId == null ? "" : industryId.trim();
}
public void setIndustryId(String industryId) {
this.industryId = industryId;
}
public String getNatureIdDictionaryName() {
return natureIdDictionaryName == null ? "" : natureIdDictionaryName;
}
public void setNatureIdDictionaryName(String natureIdDictionaryName) {
this.natureIdDictionaryName = natureIdDictionaryName;
}
public String getCheckItemParentId() {
return checkItemParentId == null ? "" : checkItemParentId;
}
public void setCheckItemParentId(String checkItemParentId) {
this.checkItemParentId = checkItemParentId;
}
public String getCheckItemId() {
return checkItemId == null ? "" : checkItemId;
}
public void setCheckItemId(String checkItemId) {
this.checkItemId = checkItemId;
}
public String getNameJoinByCheckItemId() {
return nameJoinByCheckItemId == null ? "" : nameJoinByCheckItemId;
}
public void setNameJoinByCheckItemId(String nameJoinByCheckItemId) {
this.nameJoinByCheckItemId = nameJoinByCheckItemId;
}
public String getSummaryJoinByCheckItemId() {
return summaryJoinByCheckItemId == null ? "" : summaryJoinByCheckItemId;
}
public void setSummaryJoinByCheckItemId(String summaryJoinByCheckItemId) {
this.summaryJoinByCheckItemId = summaryJoinByCheckItemId;
}
public String getTypeJoinByCheckItemId() {
return typeJoinByCheckItemId == null ? "" : typeJoinByCheckItemId;
}
public void setTypeJoinByCheckItemId(String typeJoinByCheckItemId) {
this.typeJoinByCheckItemId = typeJoinByCheckItemId;
}
public String getIconJoinByCheckItemId() {
return iconJoinByCheckItemId == null ? "" : iconJoinByCheckItemId;
}
public void setIconJoinByCheckItemId(String iconJoinByCheckItemId) {
this.iconJoinByCheckItemId = iconJoinByCheckItemId;
}
public String getIconPressJoinByCheckItemId() {
return iconPressJoinByCheckItemId == null ? "" : iconPressJoinByCheckItemId;
}
public void setIconPressJoinByCheckItemId(String iconPressJoinByCheckItemId) {
this.iconPressJoinByCheckItemId = iconPressJoinByCheckItemId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public List<CheckItemOptionDTO> getCheckItemOptions() {
if (checkItemOptions == null) {
return new ArrayList<>();
}
return checkItemOptions;
}
public void setCheckItemOptions(List<CheckItemOptionDTO> checkItemOptions) {
this.checkItemOptions = checkItemOptions;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"industryCheckItemId\":\"")
.append(industryCheckItemId).append('\"');
sb.append(",\"industryId\":\"")
.append(industryId).append('\"');
sb.append(",\"natureIdDictionaryName\":\"")
.append(natureIdDictionaryName).append('\"');
sb.append(",\"checkItemParentId\":\"")
.append(checkItemParentId).append('\"');
sb.append(",\"checkItemId\":\"")
.append(checkItemId).append('\"');
sb.append(",\"nameJoinByCheckItemId\":\"")
.append(nameJoinByCheckItemId).append('\"');
sb.append(",\"summaryJoinByCheckItemId\":\"")
.append(summaryJoinByCheckItemId).append('\"');
sb.append(",\"typeJoinByCheckItemId\":\"")
.append(typeJoinByCheckItemId).append('\"');
sb.append(",\"iconJoinByCheckItemId\":\"")
.append(iconJoinByCheckItemId).append('\"');
sb.append(",\"iconPressJoinByCheckItemId\":\"")
.append(iconPressJoinByCheckItemId).append('\"');
sb.append(",\"type\":")
.append(type);
sb.append(",\"checkItemOptions\":")
.append(checkItemOptions);
sb.append('}');
return sb.toString();
}
}

View File

@ -11,7 +11,7 @@ import java.util.List;
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: IndustryCheckItemBindVO
* @Description: 行业检查项绑定
* @Description: 场所性质检查项绑定
* @Author: WangGeng
* @Date: 2020/4/15 18:14
* @Version: 1.0

View File

@ -0,0 +1,36 @@
package com.cm.inspection.pojo.vos.industrycheckitem.v2;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: IndustryCheckItemBindVO
* @Description: 行业检查项绑定
* @Author: WangGeng
* @Date: 2020/4/15 18:14
* @Version: 1.0
**/
@ApiModel
public class IndustryCheckItemBindV2VO {
@ApiModelProperty(name = "industryCheckItems", value = "行业性质检查项列表")
private List<IndustryCheckItemVO> industryCheckItems;
public List<IndustryCheckItemVO> getIndustryCheckItems() {
if (industryCheckItems == null) {
return new ArrayList<>();
}
return industryCheckItems;
}
public void setIndustryCheckItems(List<IndustryCheckItemVO> industryCheckItems) {
this.industryCheckItems = industryCheckItems;
}
}

View File

@ -0,0 +1,61 @@
package com.cm.inspection.pojo.vos.industrycheckitem.v2;
import com.cm.common.annotation.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: IndustryCheckItemVO
* @Description: 行业检查项
* @Author: WenG
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@ApiModel
public class IndustryCheckItemV2VO {
@ApiModelProperty(name = "checkItemParentId", value = "检查项上级ID")
private String checkItemParentId;
@ApiModelProperty(name = "checkItemId", value = "检查项ID")
private String checkItemId;
@ApiModelProperty(name = "type", value = "类型")
@CheckNumberAnnotation(name = "类型")
private Integer type;
public String getCheckItemParentId() {
return checkItemParentId == null ? "" : checkItemParentId;
}
public void setCheckItemParentId(String checkItemParentId) {
this.checkItemParentId = checkItemParentId;
}
public String getCheckItemId() {
return checkItemId == null ? "" : checkItemId;
}
public void setCheckItemId(String checkItemId) {
this.checkItemId = checkItemId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"checkItemParentId\":\"")
.append(checkItemParentId).append('\"');
sb.append(",\"checkItemId\":\"")
.append(checkItemId).append('\"');
sb.append(",\"type\":")
.append(type);
sb.append('}');
return sb.toString();
}
}

View File

@ -8,8 +8,6 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.token.app.AppTokenManager;
import com.cm.common.token.app.entity.AppToken;
import com.cm.common.utils.DateUtil;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.check.ICheckDao;
@ -18,7 +16,6 @@ import com.cm.inspection.pojo.dtos.check.CheckSimpleWithEnterpriseDTO;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.dtos.checkitemoption.CheckItemOptionDTO;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO;
import com.cm.inspection.pojo.vos.check.CheckVO;
@ -41,7 +38,6 @@ import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -24,12 +24,12 @@ public interface IIndustryCheckItemService {
/**
* 新增行业检查项
*
* @param natureId
* @param industryId
* @param industryCheckItemVO
* @return
* @throws Exception
*/
SuccessResult saveIndustryCheckItemByNatureId(String natureId, IndustryCheckItemBindVO industryCheckItemVO) throws Exception;
SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindVO industryCheckItemVO) throws Exception;
/**
* 新增行业检查项(APP)

View File

@ -0,0 +1,123 @@
package com.cm.inspection.service.industrycheckitem.v2;
import com.cm.common.exception.RemoveException;
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 java.util.List;
import java.util.Map;
/**
* @ClassName: IIndustryCheckItemService
* @Description: 行业检查项
* @Author: WenG
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
public interface IIndustryCheckItemV2Service {
/**
* 新增行业检查项
*
* @param industryId
* @param industryCheckItemV2VO
* @return
* @throws Exception
*/
SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindV2VO industryCheckItemV2VO) throws Exception;
/**
* 新增行业检查项(APP)
*
* @param token
* @param industryId
* @param industryCheckItemBindV2VO
* @return
* @throws Exception
*/
SuccessResult saveIndustryCheckItemByNatureIdAndToken(String token, String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception;
/**
* 删除行业检查项
*
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removeIndustryCheckItem(String ids) throws RemoveException;
/**
* 删除行业检查项(APP)
*
* @param token
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removeIndustryCheckItemByToken(String token, String ids) throws RemoveException;
/**
* 修改行业检查项
*
* @param industryCheckItemId
* @param industryCheckItemV2VO
* @return
* @throws Exception
*/
SuccessResult updateIndustryCheckItem(String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception;
/**
* 修改行业检查项(APP)
*
* @param token
* @param industryCheckItemId
* @param industryCheckItemV2VO
* @return
* @throws Exception
*/
SuccessResult updateIndustryCheckItemByToken(String token, String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception;
/**
* 行业检查项详情(通过ID)
*
* @param industryCheckItemId
* @return
* @throws SearchException
*/
IndustryCheckItemV2DTO getIndustryCheckItemById(String industryCheckItemId) throws SearchException;
/**
* 行业检查项列表
*
* @param params
* @return
* @throws SearchException
*/
List<IndustryCheckItemV2DTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException;
/**
* 行业检查项分页列表
*
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<IndustryCheckItemV2DTO>> listPageIndustryCheckItem(ListPage page) throws SearchException;
/**
* 获取行业检查项列表通过场所性质
*
* @param industryId
* @return
* @throws SearchException
*/
List<IndustryCheckItemV2DTO> listIndustryCheckItemByIndustryId(String industryId) throws SearchException;
}

View File

@ -0,0 +1,200 @@
package com.cm.inspection.service.industrycheckitem.v2.impl;
import com.cm.common.exception.RemoveException;
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.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.service.BaseService;
import com.cm.inspection.service.checkitemoption.ICheckItemOptionService;
import com.cm.inspection.service.industrycheckitem.v2.IIndustryCheckItemV2Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IndustryCheckItemServiceImpl
* @Description: 行业检查项
* @Author: WenG
* @Date: 2020-03-27 22:12
* @Version: 1.0
**/
@Service
public class IndustryCheckItemV2ServiceImpl extends BaseService implements IIndustryCheckItemV2Service {
@Autowired
private IIndustryCheckItemV2Dao industryCheckItemV2Dao;
@Autowired
private ICheckItemOptionService checkItemOptionService;
@Override
public SuccessResult saveIndustryCheckItemByNatureId(String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
saveIndustryCheckItemInfo(null, industryId, industryCheckItemBindV2VO);
return new SuccessResult();
}
@Override
public SuccessResult saveIndustryCheckItemByNatureIdAndToken(String token, String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
saveIndustryCheckItemInfo(token, industryId, industryCheckItemBindV2VO);
return new SuccessResult();
}
/**
* 新增行业检查项
*
* @param token
* @param industryId
* @param industryCheckItemBindV2VO
* @throws Exception
*/
private void saveIndustryCheckItemInfo(String token, String industryId, IndustryCheckItemBindV2VO industryCheckItemBindV2VO) throws Exception {
// 清空原数据
Map<String, Object> params = getHashMap(1);
params.put("industryId", industryId);
industryCheckItemV2Dao.deleteIndustryCheckItem(params);
// 保存数据
for (IndustryCheckItemVO industryCheckItemVO : industryCheckItemBindV2VO.getIndustryCheckItems()) {
params = HashMapUtil.beanToMap(industryCheckItemVO);
params.put("industryCheckItemId", UUIDUtil.getUUID());
params.put("industryId", industryId);
if (token != null) {
setSaveInfo(token, params);
} else {
setSaveInfo(params);
}
industryCheckItemV2Dao.saveIndustryCheckItem(params);
}
}
@Override
public SuccessResult removeIndustryCheckItem(String ids) throws RemoveException {
removeIndustryCheckItemInfo(null, ids);
return new SuccessResult();
}
@Override
public SuccessResult removeIndustryCheckItemByToken(String token, String ids) throws RemoveException {
removeIndustryCheckItemInfo(token, ids);
return new SuccessResult();
}
/**
* 删除行业检查项
*
* @param token
* @param ids
*/
private void removeIndustryCheckItemInfo(String token, String ids) {
Map<String, Object> params = getHashMap(3);
params.put("industryCheckItemIds", Arrays.asList(ids.split("_")));
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
industryCheckItemV2Dao.removeIndustryCheckItem(params);
}
@Override
public SuccessResult updateIndustryCheckItem(String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception {
updateIndustryCheckItemInfo(null, industryCheckItemId, industryCheckItemV2VO);
return new SuccessResult();
}
@Override
public SuccessResult updateIndustryCheckItemByToken(String token, String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception {
updateIndustryCheckItemInfo(token, industryCheckItemId, industryCheckItemV2VO);
return new SuccessResult();
}
/**
* 修改行业检查项
*
* @param token
* @param industryCheckItemId
* @param industryCheckItemV2VO
*/
private void updateIndustryCheckItemInfo(String token, String industryCheckItemId, IndustryCheckItemV2VO industryCheckItemV2VO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(industryCheckItemV2VO);
params.put("industryCheckItemId", industryCheckItemId);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
industryCheckItemV2Dao.updateIndustryCheckItem(params);
}
@Override
public IndustryCheckItemV2DTO getIndustryCheckItemById(String industryCheckItemId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("industryCheckItemId", industryCheckItemId);
IndustryCheckItemV2DTO industryCheckItemDTO = industryCheckItemV2Dao.getIndustryCheckItem(params);
if (industryCheckItemDTO != null) {
params.clear();
setCheckItemOptions(industryCheckItemDTO, params);
}
return industryCheckItemDTO;
}
@Override
public List<IndustryCheckItemV2DTO> listIndustryCheckItem(Map<String, Object> params) throws SearchException {
List<IndustryCheckItemV2DTO> industryCheckItemDTOs = industryCheckItemV2Dao.listIndustryCheckItem(params);
params.clear();
setCheckItemOptions(industryCheckItemDTOs, params);
return industryCheckItemDTOs;
}
@Override
public SuccessResultList<List<IndustryCheckItemV2DTO>> listPageIndustryCheckItem(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
List<IndustryCheckItemV2DTO> industryCheckItemDTOs = industryCheckItemV2Dao.listIndustryCheckItem(page.getParams());
PageInfo<IndustryCheckItemV2DTO> pageInfo = new PageInfo<>(industryCheckItemDTOs);
return new SuccessResultList<>(industryCheckItemDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public List<IndustryCheckItemV2DTO> listIndustryCheckItemByIndustryId(String industryId) throws SearchException {
Map<String, Object> params = getHashMap(1);
params.put("industryId", industryId);
return listIndustryCheckItem(params);
}
/**
* 设置检查选项
*
* @param industryCheckItemDTOs
* @param params
*/
private void setCheckItemOptions(List<IndustryCheckItemV2DTO> industryCheckItemDTOs, Map<String, Object> params) {
for (IndustryCheckItemV2DTO industryCheckItemDTO : industryCheckItemDTOs) {
setCheckItemOptions(industryCheckItemDTO, params);
}
}
/**
* 设置检查选项
*
* @param industryCheckItemDTO
* @param params
*/
private void setCheckItemOptions(IndustryCheckItemV2DTO industryCheckItemDTO, Map<String, Object> params) {
params.put("checkItemId", industryCheckItemDTO.getCheckItemId());
industryCheckItemDTO.setCheckItemOptions(checkItemOptionService.listCheckItemOption(params));
}
}

View File

@ -0,0 +1,176 @@
<?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">
<resultMap id="industryCheckItemDTO" type="com.cm.inspection.pojo.dtos.industrycheckitem.v2.IndustryCheckItemV2DTO">
<id column="industry_check_item_id" property="industryCheckItemId"/>
<result column="industry_id" property="industryId"/>
<result column="nature_id_dictionary_name" property="natureIdDictionaryName"/>
<result column="check_item_parent_id" property="checkItemParentId"/>
<result column="check_item_id" property="checkItemId"/>
<result column="name_join_by_check_item_id" property="nameJoinByCheckItemId"/>
<result column="summary_join_by_check_item_id" property="summaryJoinByCheckItemId"/>
<result column="type_join_by_check_item_id" property="typeJoinByCheckItemId"/>
<result column="icon_join_by_check_item_id" property="iconJoinByCheckItemId"/>
<result column="icon_press_join_by_check_item_id" property="iconPressJoinByCheckItemId"/>
<result column="type" property="type"/>
</resultMap>
<!-- 新增行业检查项 -->
<insert id="saveIndustryCheckItem" parameterType="map">
INSERT INTO gen_industry_check_item_v2 (
industry_check_item_id,
industry_id,
check_item_parent_id,
check_item_id,
type,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{industryCheckItemId},
#{industryId},
#{checkItemParentId},
#{checkItemId},
#{type},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除行业检查项 -->
<update id="removeIndustryCheckItem" parameterType="map">
UPDATE
gen_industry_check_item_v2
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
industry_check_item_id IN
<foreach collection="industryCheckItemIds" index="index" open="(" separator="," close=")">
#{industryCheckItemIds[${index}]}
</foreach>
</update>
<!-- 删除行业检查项(物理删除) -->
<delete id="deleteIndustryCheckItem" parameterType="map">
DELETE FROM
gen_industry_check_item_v2
WHERE
<if test="industryId != null and industryId != ''">
industry_id = #{industryId}
</if>
<if test="industryCheckItemIds != null and industryCheckItemIds.size > 0">
industry_check_item_id IN
<foreach collection="industryCheckItemIds" index="index" open="(" separator="," close=")">
#{industryCheckItemIds[${index}]}
</foreach>
</if>
</delete>
<!-- 修改行业检查项 -->
<update id="updateIndustryCheckItem" parameterType="map">
UPDATE
gen_industry_check_item_v2
SET
<if test="industryId != null and industryId != ''">
industry_id = #{industryId}
</if>
<if test="checkItemParentId != null and checkItemParentId != ''">
check_item_parent_id = #{checkItemParentId},
</if>
<if test="checkItemId != null and checkItemId != ''">
check_item_id = #{checkItemId},
</if>
<if test="type != null and type != ''">
type = #{type}
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
industry_check_item_id = #{industryCheckItemId}
</update>
<!-- 行业检查项详情 -->
<select id="getIndustryCheckItem" 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="industryCheckItemId != null and industryCheckItemId != ''">
AND
t1.industry_check_item_id = #{industryCheckItemId}
</if>
</select>
<!-- 行业检查项列表 -->
<select id="listIndustryCheckItem" parameterType="map" resultMap="industryCheckItemDTO">
SELECT
t1.industry_id,
t1.check_item_parent_id,
t1.check_item_id,
dt1.dictionary_name nature_id_dictionary_name,
jt1.name name_join_by_check_item_id,
jt1.summary summary_join_by_check_item_id,
jt1.type type_join_by_check_item_id,
jt1.icon icon_join_by_check_item_id,
jt1.icon_press icon_press_join_by_check_item_id,
t1.type,
t1.industry_check_item_id
FROM
gen_industry_check_item_v2 t1
LEFT JOIN
data_dictionary dt1
ON
dt1.dictionary_id = t1.industry_id
AND
dt1.is_delete = 0
INNER JOIN
gen_check_item jt1
ON
t1.check_item_id = jt1.check_item_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
dt1.dictionary_name LIKE CONCAT(#{keywords}, '%')
OR
jt1.name LIKE CONCAT(#{keywords}, '%')
)
</if>
<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,183 @@
<!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 class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" id="submitForm">提交修改</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index',
treeTable: 'treeTable/treeTable',
}).use(['index', 'treeTable'], function() {
var $ = layui.$;
var $win = $(window);
var admin = layui.admin;
var form = layui.form;
var treeTable = layui.treeTable;
var resizeTimeout = null;
var industryId = top.restAjax.params(window.location.href).industryId;
var tableUrl = 'api/checkitem/listcheckitemsimpleall';
var treeTableObj;
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/industrycheckitem/v2/listindustrycheckitembyindustryid/{industryId}', [industryId]), {}, null, function(code, data) {
var checkCheckItemIdArray = [];
for(var i = 0, item; item = data[i++];) {
checkCheckItemIdArray.push(item.checkItemId);
$('input[name="'+ item.checkItemId +'_type"][value='+ item.type +']').attr('checked', true);
}
treeTableObj.setChecked(checkCheckItemIdArray);
form.render('radio', 'dataTable');
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
function initTable() {
top.restAjax.get(tableUrl, {}, null, function(code, data) {
treeTableObj = treeTable.render({
elem: '#dataTable',
data: data,
width: admin.screen() > 1 ? '100%' : '',
height: ($win.height() - 140) +'px',
tree: {
iconIndex: 2 ,
isPidData: true,
idName: 'checkItemId',
pidName: 'checkItemParentId',
},
cols: [
{type: 'numbers'},
{type: 'checkbox'},
{field: 'name', title: '检查项', width: 600},
{field: 'type', title: '检查项', width: 100,
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null) {
return '-';
}
if(rowData == 1) {
return '目录';
} else if(rowData == 2) {
return '检查项';
}
}
},
{field: 'option', title: '操作', width: 200,
templet: function(row) {
if(row.type != 2) {
return '无';
}
return '<input type="radio" name="'+ row.checkItemId +'_type" value="1" title="必查" checked><input type="radio" name="'+ row.checkItemId +'_type" value="2" title="选查">';
}
},
]
});
treeTableObj.expandAll();
initData();
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 重载表格
function reloadTable() {
treeTableObj.reload({
width: admin.screen() > 1 ? '100%' : '',
height: ($win.height() - 140) +'px',
});
treeTableObj.expandAll();
initData();
}
initTable();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
function listIndustryCheckItemType(checkItems) {
var industryCheckItemArray = [];
if(!checkItems || checkItems.length == 0) {
return industryCheckItemArray;
}
var checkItemIds = [];
for(var i = 0, item; item = checkItems[i++];) {
var checkItemType = $('input[name="'+ item.checkItemId +'_type"]:checked').val();
industryCheckItemArray.push({
checkItemParentId: item.checkItemParentId,
checkItemId: item.checkItemId,
type: checkItemType ? checkItemType : 0
});
}
return industryCheckItemArray;
}
$(document).on('click', '#submitForm', function() {
var checkItems = treeTableObj.checkStatus(true);
var industryCheckItemArray = listIndustryCheckItemType(checkItems);
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/industrycheckitem/v2/saveindustrycheckitembyindustryid/{industryId}', [industryId]), {
industryCheckItems: industryCheckItemArray
}, null, function(code, data) {
var layerIndex = top.dialog.msg('提交成功', {
time: 0,
btn: [top.dataMessage.button.yes],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<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">
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
<link rel="stylesheet" href="assets/layuiadmin/style/common.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row layui-col-space15">
<div class="layui-col-md2">
<div class="layui-card">
<div class="layui-card-body left-tree-wrap">
<div id="leftTreeWrap">
<ul id="leftTree" class="ztree"></ul>
</div>
</div>
</div>
</div>
<div class="layui-col-md10">
<div class="layui-card">
<div id="listContentWrap" class="layui-card-body">
<iframe id="listContent" frameborder="0" class="layadmin-iframe"></iframe>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
var common;
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'ztree', 'common'], function() {
common = layui.common;
var $ = layui.$;
var $win = $(window);
var resizeTimeout = null;
var parentId = 0;
// 初始化IFrame
function initIFrame() {
$('#listContent').attr('src', top.restAjax.path('route/industrycheckitem/v2/list-industrycheckitem-v2.html?industryId={parentId}', [parentId]));
}
// 初始化大小
function initSize() {
$('#leftTreeWrap').css({
height: $win.height() - 30,
overflow: 'auto'
});
$('#listContentWrap').css({
height: $win.height() - 50,
});
}
// 初始化树
function initThree() {
// 这里之前是行业类型,换成企业分类
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionaryallbyparentid/b97630ab-45b7-45bc-a624-507d4df952ff', []), {}, null, function(code, data) {
var setting = {
data: {
key: {
title: 'dictionaryName',
name: 'dictionaryName',
id: 'dictionaryId',
children: 'subDictionary'
},
},
callback: {
onClick: function (event, treeId, treeNode) {
parentId = treeNode.dictionaryId;
initIFrame();
return false;
}
},
};
var zTree = $.fn.zTree.init($("#leftTree"), setting, data);
if(data.length > 0) {
parentId = data[0].dictionaryId;
}
initIFrame();
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initSize();
initThree();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
initSize();
}, 500);
});
});
</script>
</body>
</html>