修改企业分类与检查项绑定

This commit is contained in:
wenc000 2020-06-12 21:03:26 +08:00
parent c0e4c50014
commit bac3987d0b
10 changed files with 237 additions and 87 deletions

View File

@ -11,6 +11,7 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseClassifyVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseNatureVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
import com.cm.inspection.service.enterprise.IEnterpriseService;
@ -85,6 +86,20 @@ public class EnterpriseAppController extends AbstractController {
return enterpriseService.updateEnterpriseNatureByToken(token, enterpriseId, enterpriseNatureVO);
}
@ApiOperation(value = "更新企业分类", notes = "更新企业分类")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updateenterpriseclassify/{enterpriseId}")
@CheckRequestBodyAnnotation
public SuccessResult updateEnterpriseClassify(@RequestHeader("token") String token,
@PathVariable("enterpriseId") String enterpriseId,
@RequestBody EnterpriseClassifyVO enterpriseClassifyVO) throws Exception {
return enterpriseService.updateEnterpriseClassifyByToken(token, enterpriseId, enterpriseClassifyVO);
}
@ApiOperation(value = "企业详情(通过ID)", notes = "企业详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),

View File

@ -61,6 +61,14 @@ public interface IEnterpriseDao {
*/
void updateEnterpriseNature(Map<String, Object> params) throws UpdateException;
/**
* 更新企业分类
*
* @param params
* @throws UpdateException
*/
void updateEnterpriseClassify(Map<String, Object> params) throws UpdateException;
/**
* 企业详情
*
@ -89,6 +97,8 @@ public interface IEnterpriseDao {
List<EnterpriseDTO> listEnterprise(Map<String, Object> params) throws SearchException;
/**
* 统计企业
*
* @param params
* @return
* @throws SearchException
@ -103,4 +113,6 @@ public interface IEnterpriseDao {
* @throws SearchException
*/
List<EnterpriseDTO> listEnterpriseByUser(Map<String, Object> params) throws SearchException;
}

View File

@ -29,6 +29,10 @@ public class TaskCheckDTO {
private String enterpriseNature;
@ApiModelProperty(name = "enterpriseNatureDictionaryName", value = "企业场所性质名称")
private String enterpriseNatureDictionaryName;
@ApiModelProperty(name = "enterpriseClassify", value = "企业分类")
private String enterpriseClassify;
@ApiModelProperty(name = "enterpriseClassifyDictionaryName", value = "企业分类名称")
private String enterpriseClassifyDictionaryName;
@ApiModelProperty(name = "gmtCreate", value = "发布时间")
private String gmtCreate;
@ApiModelProperty(name = "userId", value = "处理人")
@ -108,6 +112,22 @@ public class TaskCheckDTO {
this.userId = userId;
}
public String getEnterpriseClassify() {
return enterpriseClassify == null ? "" : enterpriseClassify.trim();
}
public void setEnterpriseClassify(String enterpriseClassify) {
this.enterpriseClassify = enterpriseClassify;
}
public String getEnterpriseClassifyDictionaryName() {
return enterpriseClassifyDictionaryName == null ? "" : enterpriseClassifyDictionaryName.trim();
}
public void setEnterpriseClassifyDictionaryName(String enterpriseClassifyDictionaryName) {
this.enterpriseClassifyDictionaryName = enterpriseClassifyDictionaryName;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
@ -143,6 +163,10 @@ public class TaskCheckDTO {
.append(enterpriseNature).append('\"');
sb.append(",\"enterpriseNatureDictionaryName\":\"")
.append(enterpriseNatureDictionaryName).append('\"');
sb.append(",\"enterpriseClassify\":\"")
.append(enterpriseClassify).append('\"');
sb.append(",\"enterpriseClassifyDictionaryName\":\"")
.append(enterpriseClassifyDictionaryName).append('\"');
sb.append(",\"gmtCreate\":\"")
.append(gmtCreate).append('\"');
sb.append(",\"userId\":\"")

View File

@ -0,0 +1,40 @@
package com.cm.inspection.pojo.vos.enterprise;
import com.cm.common.annotation.CheckEmptyAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: EnterpriseNatureVO
* @Description: 企业分类
* @Author: WangGeng
* @Date: 2020/5/3 20:00
* @Version: 1.0
**/
@ApiModel
public class EnterpriseClassifyVO {
@ApiModelProperty(name = "classifyId", value = "企业分类")
@CheckEmptyAnnotation(name = "企业分类")
private String classifyId;
public String getClassifyId() {
return classifyId == null ? "" : classifyId.trim();
}
public void setClassifyId(String classifyId) {
this.classifyId = classifyId;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"classifyId\":\"")
.append(classifyId).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -9,6 +9,7 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseClassifyVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseNatureVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
@ -104,6 +105,17 @@ public interface IEnterpriseService {
*/
SuccessResult updateEnterpriseNatureByToken(String token, String enterpriseId, EnterpriseNatureVO enterpriseNatureVO) throws Exception;
/**
* 更新企业分类
*
* @param token
* @param enterpriseId
* @param enterpriseClassifyVO
* @return
* @throws Exception
*/
SuccessResult updateEnterpriseClassifyByToken(String token, String enterpriseId, EnterpriseClassifyVO enterpriseClassifyVO) throws Exception;
/**
* 更新企业位置
*
@ -195,4 +207,5 @@ public interface IEnterpriseService {
* @throws SearchException
*/
List<EnterpriseDTO> listEnterpriseByUserId(String userId) throws SearchException;
}

View File

@ -12,6 +12,7 @@ import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.enterprise.IEnterpriseDao;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseClassifyVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseNatureVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
import com.cm.inspection.pojo.vos.enterpriseofgridoperator.EnterpriseOfGridOperatorVO;
@ -162,6 +163,28 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
return new SuccessResult();
}
@Override
public SuccessResult updateEnterpriseClassifyByToken(String token, String enterpriseId, EnterpriseClassifyVO enterpriseClassifyVO) throws Exception {
EnterpriseDTO enterpriseDTO = getEnterpriseById(enterpriseId);
if (enterpriseDTO == null) {
throw new ParamsException("企业不存在");
}
if (!StringUtils.isBlank(enterpriseDTO.getClassify())) {
throw new ParamsException("企业已经绑定分类");
}
DataDictionaryDTO dataDictionaryDTO = dataDictionaryService.getDictionaryById(enterpriseClassifyVO.getClassifyId());
if (dataDictionaryDTO == null) {
throw new ParamsException("企业分类不存在");
}
Map<String, Object> params = getHashMap(5);
params.put("enterpriseId", enterpriseId);
params.put("classify", enterpriseClassifyVO.getClassifyId());
params.put("classifyDictionaryName", dataDictionaryDTO.getDictionaryName());
setUpdateInfo(token, params);
enterpriseDao.updateEnterpriseClassify(params);
return new SuccessResult();
}
@Override
public void updateEnterpriseLocationByEnterpriseId(String enterpriseId, String checkLng, String checkLat) throws UpdateException {
updateEnterpriseLocationByTokenAndEnterpriseId(null, enterpriseId, checkLng, checkLat);

View File

@ -133,13 +133,13 @@
<!-- 删除企业 -->
<update id="removeEnterprise" parameterType="map">
UPDATE
gen_enterprise
gen_enterprise
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
enterprise_id IN
enterprise_id IN
<foreach collection="enterpriseIds" index="index" open="(" separator="," close=")">
#{enterpriseIds[${index}]}
</foreach>
@ -148,7 +148,7 @@
<!-- 修改企业 -->
<update id="updateEnterprise" parameterType="map">
UPDATE
gen_enterprise
gen_enterprise
SET
<if test="name != null and name != ''">
name = #{name},
@ -249,16 +249,16 @@
<if test="isLogOff != null and isLogOff != ''">
is_log_off = #{isLogOff},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
enterprise_id = #{enterpriseId}
enterprise_id = #{enterpriseId}
</update>
<!-- 修改企业位置 -->
<update id="updateEnterpriseLocation" parameterType="map">
UPDATE
gen_enterprise
gen_enterprise
SET
<if test="enterpriseLng != null and enterpriseLng != ''">
enterprise_lng = #{enterpriseLng},
@ -266,16 +266,16 @@
<if test="enterpriseLat != null and enterpriseLat != ''">
enterprise_lat = #{enterpriseLat},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
enterprise_id = #{enterpriseId}
enterprise_id = #{enterpriseId}
</update>
<!-- 修改企业场所性质 -->
<update id="updateEnterpriseNature" parameterType="map">
UPDATE
gen_enterprise
gen_enterprise
SET
<if test="nature != null and nature != ''">
nature = #{nature},
@ -283,54 +283,71 @@
<if test="natureDictionaryName != null and natureDictionaryName != ''">
nature_dictionary_name = #{natureDictionaryName},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
enterprise_id = #{enterpriseId}
enterprise_id = #{enterpriseId}
</update>
<!-- 修改企业分类 -->
<update id="updateEnterpriseClassify" parameterType="map">
UPDATE
gen_enterprise
SET
<if test="classify != null and classify != ''">
classify = #{classify},
</if>
<if test="classifyDictionaryName != null and classifyDictionaryName != ''">
classify_dictionary_name = #{classifyDictionaryName},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
enterprise_id = #{enterpriseId}
</update>
<!-- 企业详情 -->
<select id="getEnterprise" parameterType="map" resultMap="enterpriseDTO">
SELECT
t1.name,
t1.type,
t1.type_dictionary_name,
t1.area1,
t1.area1_dictionary_name,
t1.area2,
t1.area2_dictionary_name,
t1.area3,
t1.area3_dictionary_name,
t1.area4,
t1.area4_dictionary_name,
t1.area5,
t1.area5_dictionary_name,
t1.address,
t1.industry,
t1.industry_dictionary_name,
t1.engaged_count,
t1.risk_operation,
t1.risk_operation_dictionary_name,
t1.master,
t1.phone,
t1.factory_gate,
t1.workplace,
t1.industry_type,
t1.industry_type_dictionary_name,
t1.bussiness_reg_num,
t1.legal_person,
t1.summary,
t1.classify,
t1.classify_dictionary_name,
t1.nature,
t1.nature_dictionary_name,
t1.is_log_off,
t1.remarks,
t1.enterprise_id
t1.name,
t1.type,
t1.type_dictionary_name,
t1.area1,
t1.area1_dictionary_name,
t1.area2,
t1.area2_dictionary_name,
t1.area3,
t1.area3_dictionary_name,
t1.area4,
t1.area4_dictionary_name,
t1.area5,
t1.area5_dictionary_name,
t1.address,
t1.industry,
t1.industry_dictionary_name,
t1.engaged_count,
t1.risk_operation,
t1.risk_operation_dictionary_name,
t1.master,
t1.phone,
t1.factory_gate,
t1.workplace,
t1.industry_type,
t1.industry_type_dictionary_name,
t1.bussiness_reg_num,
t1.legal_person,
t1.summary,
t1.classify,
t1.classify_dictionary_name,
t1.nature,
t1.nature_dictionary_name,
t1.is_log_off,
t1.remarks,
t1.enterprise_id
FROM
gen_enterprise t1
gen_enterprise t1
WHERE
t1.is_delete = 0
t1.is_delete = 0
<if test="enterpriseId != null and enterpriseId != ''">
AND
t1.enterprise_id = #{enterpriseId}
@ -340,39 +357,39 @@
<!-- 企业详情单表 -->
<select id="getEnterpriseSingle" resultMap="enterpriseDTO">
SELECT
t1.name,
t1.type,
t1.area1,
t1.area2,
t1.area3,
t1.area4,
t1.area5,
t1.address,
t1.industry_type,
t1.industry,
t1.engaged_count,
t1.risk_operation,
t1.master,
t1.phone,
t1.factory_gate,
t1.workplace,
t1.industry_type,
t1.bussiness_reg_num,
t1.legal_person,
t1.summary,
t1.classify,
t1.classify_dictionary_name,
t1.nature,
t1.nature_dictionary_name,
t1.is_log_off,
t1.remarks,
t1.enterprise_id
t1.name,
t1.type,
t1.area1,
t1.area2,
t1.area3,
t1.area4,
t1.area5,
t1.address,
t1.industry_type,
t1.industry,
t1.engaged_count,
t1.risk_operation,
t1.master,
t1.phone,
t1.factory_gate,
t1.workplace,
t1.industry_type,
t1.bussiness_reg_num,
t1.legal_person,
t1.summary,
t1.classify,
t1.classify_dictionary_name,
t1.nature,
t1.nature_dictionary_name,
t1.is_log_off,
t1.remarks,
t1.enterprise_id
FROM
gen_enterprise t1
gen_enterprise t1
WHERE
t1.is_delete = 0
t1.is_delete = 0
<if test="enterpriseId != null and enterpriseId != ''">
AND
AND
t1.enterprise_id = #{enterpriseId}
</if>
</select>

View File

@ -11,6 +11,8 @@
<result column="enterprise_phone" property="enterprisePhone"/>
<result column="enterprise_nature" property="enterpriseNature"/>
<result column="enterprise_nature_dictionary_name" property="enterpriseNatureDictionaryName"/>
<result column="enterprise_classify" property="enterpriseClassify"/>
<result column="enterprise_classify_dictionary_name" property="enterpriseClassifyDictionaryName"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="is_handled" property="isHandled"/>
<result column="user_id" property="userId"/>
@ -115,6 +117,8 @@
jt1.phone enterprise_phone,
jt1.nature enterprise_nature,
jt1.nature_dictionary_name enterprise_nature_dictionary_name,
jt1.classify enterprise_classify,
jt1.classify_dictionary_name enterprise_classify_dictionary_name,
t1.user_id,
LEFT(t1.gmt_create, 19) gmt_create,
t1.is_handled,

View File

@ -63,14 +63,15 @@
}
// 初始化树
function initThree() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionaryallbyparentid/54c583df-6a6f-4a55-bcb3-2d6ace99b8ef', []), {}, null, function(code, data) {
// 这里之前是行业类型,换成企业分类
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionaryallbyparentid/27694872-7295-4b41-aaa0-297fc6dbac3e', []), {}, null, function(code, data) {
var setting = {
data: {
key: {
title: 'dictionaryName',
name: 'dictionaryName',
id: 'dictionaryId',
children: 'subDictionary'
// children: 'subDictionary'
},
},
callback: {

View File

@ -15,6 +15,7 @@
.col-area {width: 100px;}
.col-area-content {width: 100px; margin: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
.col-area-address {width: 480px !important;}
.col-content-info {width: 480px !important;}
</style>
</head>
<body>
@ -144,7 +145,7 @@
'<td class="col-area"><div class="col-area-content">'+ (row.area5DictionaryName ? row.area5DictionaryName : '-') +'</div></td>' +
'</tr>';
infoDiv += '<tr><td class="col-title">检查地址</td><td class="col-content" colspan="4"><div class="col-content-name col-area-address check-location" title="'+ row.checkAddress +'" data-lng="'+ row.checkLng +'" data-lat="'+ row.checkLat +'"><i class="fa fa-map-marker"></i> '+ row.checkAddress +'</div></td></tr>';
infoDiv += '<tr><td class="col-title">检查内容</td><td class="col-content" colspan="4"><div class="col-content-name" title="'+ row.checkContent +'">'+ row.checkContent +'</div></td></tr>';
infoDiv += '<tr><td class="col-title">检查内容</td><td class="col-content" colspan="4"><div class="col-content-name col-content-info" title="'+ row.checkContent +'">'+ row.checkContent +'</div></td></tr>';
infoDiv += '</table>';
return infoDiv;
}