新增企业场所性质绑定

This commit is contained in:
wenc000 2020-05-03 21:08:57 +08:00
parent 26dcc1ae71
commit 4cc01f64e9
7 changed files with 118 additions and 6 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.EnterpriseNatureVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
import com.cm.inspection.service.enterprise.IEnterpriseService;
import io.swagger.annotations.*;
@ -70,6 +71,20 @@ public class EnterpriseAppController extends AbstractController {
return enterpriseService.updateEnterpriseByToken(token, enterpriseId, enterpriseVO);
}
@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("updateenterprisenature/{enterpriseId}")
@CheckRequestBodyAnnotation
public SuccessResult updateEnterpriseNature(@RequestHeader("token") String token,
@PathVariable("enterpriseId") String enterpriseId,
@RequestBody EnterpriseNatureVO enterpriseNatureVO) throws Exception {
return enterpriseService.updateEnterpriseNatureByToken(token, enterpriseId, enterpriseNatureVO);
}
@ApiOperation(value = "企业详情(通过ID)", notes = "企业详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),

View File

@ -53,6 +53,14 @@ public interface IEnterpriseDao {
*/
void updateEnterpriseLocation(Map<String, Object> params) throws UpdateException;
/**
* 修改企业场所性质
*
* @param params
* @throws UpdateException
*/
void updateEnterpriseNature(Map<String, Object> params) throws UpdateException;
/**
* 企业详情
*
@ -81,10 +89,10 @@ public interface IEnterpriseDao {
List<EnterpriseDTO> listEnterprise(Map<String, Object> params) throws SearchException;
/**
*
* @param params
* @return
* @throws SearchException
*/
Integer countEnterprise(Map<String, Object> params) throws SearchException;
}

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 EnterpriseNatureVO {
@ApiModelProperty(name = "natureId", value = "场所性质")
@CheckEmptyAnnotation(name = "场所性质")
private String natureId;
public String getNatureId() {
return natureId == null ? "" : natureId;
}
public void setNatureId(String natureId) {
this.natureId = natureId;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"natureId\":")
.append(natureId);
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.EnterpriseNatureVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
import java.util.List;
@ -92,6 +93,17 @@ public interface IEnterpriseService {
*/
SuccessResult updateEnterpriseByToken(String token, String enterpriseId, EnterpriseVO enterpriseVO) throws Exception;
/**
* 更新企业场所性质
*
* @param token
* @param enterpriseId
* @param enterpriseNatureVO
* @return
* @throws Exception
*/
SuccessResult updateEnterpriseNatureByToken(String token, String enterpriseId, EnterpriseNatureVO enterpriseNatureVO) throws Exception;
/**
* 更新企业位置
*

View File

@ -1,9 +1,6 @@
package com.cm.inspection.service.enterprise.impl;
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.common.exception.*;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
import com.cm.common.pojo.ListPage;
@ -14,6 +11,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.EnterpriseNatureVO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
import com.cm.inspection.pojo.vos.enterpriseofgridoperator.EnterpriseOfGridOperatorVO;
import com.cm.inspection.service.BaseService;
@ -141,6 +139,28 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
return new SuccessResult();
}
@Override
public SuccessResult updateEnterpriseNatureByToken(String token, String enterpriseId, EnterpriseNatureVO enterpriseNatureVO) throws Exception {
EnterpriseDTO enterpriseDTO = getEnterpriseById(enterpriseId);
if (enterpriseDTO == null) {
throw new ParamsException("企业不存在");
}
if (StringUtils.isBlank(enterpriseDTO.getNature())) {
throw new ParamsException("企业已经绑定场所性质");
}
DataDictionaryDTO dataDictionaryDTO = dataDictionaryService.getDictionaryById(enterpriseNatureVO.getNatureId());
if (dataDictionaryDTO == null) {
throw new ParamsException("场所性质不存在");
}
Map<String, Object> params = getHashMap(5);
params.put("enterpriseId", enterpriseId);
params.put("nature", enterpriseNatureVO.getNatureId());
params.put("natureDictionaryName", dataDictionaryDTO.getDictionaryName());
setUpdateInfo(token, params);
enterpriseDao.updateEnterpriseNature(params);
return new SuccessResult();
}
@Override
public void updateEnterpriseLocationByEnterpriseId(String enterpriseId, String checkLng, String checkLat) throws UpdateException {
updateEnterpriseLocationByTokenAndEnterpriseId(null, enterpriseId, checkLng, checkLat);

View File

@ -270,6 +270,23 @@
enterprise_id = #{enterpriseId}
</update>
<!-- 修改企业场所性质 -->
<update id="updateEnterpriseNature" parameterType="map">
UPDATE
gen_enterprise
SET
<if test="nature != null and nature != ''">
nature = #{nature},
</if>
<if test="natureDictionaryName != null and natureDictionaryName != ''">
nature_dictionary_name = #{natureDictionaryName},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
enterprise_id = #{enterpriseId}
</update>
<!-- 企业详情 -->
<select id="getEnterprise" parameterType="map" resultMap="enterpriseDTO">
SELECT

View File

@ -700,7 +700,7 @@
top.restAjax.get(top.restAjax.path('api/enterprise/getenterprisesinglebyid/{enterpriseId}', [enterpriseId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i];
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');