新增企业场所性质绑定
This commit is contained in:
parent
26dcc1ae71
commit
4cc01f64e9
@ -11,6 +11,7 @@ import com.cm.common.result.SuccessResult;
|
|||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
|
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.enterprise.EnterpriseVO;
|
||||||
import com.cm.inspection.service.enterprise.IEnterpriseService;
|
import com.cm.inspection.service.enterprise.IEnterpriseService;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
@ -70,6 +71,20 @@ public class EnterpriseAppController extends AbstractController {
|
|||||||
return enterpriseService.updateEnterpriseByToken(token, enterpriseId, enterpriseVO);
|
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)接口")
|
@ApiOperation(value = "企业详情(通过ID)", notes = "企业详情(通过ID)接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ -53,6 +53,14 @@ public interface IEnterpriseDao {
|
|||||||
*/
|
*/
|
||||||
void updateEnterpriseLocation(Map<String, Object> params) throws UpdateException;
|
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;
|
List<EnterpriseDTO> listEnterprise(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param params
|
* @param params
|
||||||
* @return
|
* @return
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
Integer countEnterprise(Map<String, Object> params) throws SearchException;
|
Integer countEnterprise(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import com.cm.common.result.SuccessResult;
|
|||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
|
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.enterprise.EnterpriseVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -92,6 +93,17 @@ public interface IEnterpriseService {
|
|||||||
*/
|
*/
|
||||||
SuccessResult updateEnterpriseByToken(String token, String enterpriseId, EnterpriseVO enterpriseVO) throws Exception;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新企业位置
|
* 更新企业位置
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.cm.inspection.service.enterprise.impl;
|
package com.cm.inspection.service.enterprise.impl;
|
||||||
|
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.*;
|
||||||
import com.cm.common.exception.SaveException;
|
|
||||||
import com.cm.common.exception.SearchException;
|
|
||||||
import com.cm.common.exception.UpdateException;
|
|
||||||
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
||||||
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
||||||
import com.cm.common.pojo.ListPage;
|
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.common.utils.UUIDUtil;
|
||||||
import com.cm.inspection.dao.enterprise.IEnterpriseDao;
|
import com.cm.inspection.dao.enterprise.IEnterpriseDao;
|
||||||
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
|
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.enterprise.EnterpriseVO;
|
||||||
import com.cm.inspection.pojo.vos.enterpriseofgridoperator.EnterpriseOfGridOperatorVO;
|
import com.cm.inspection.pojo.vos.enterpriseofgridoperator.EnterpriseOfGridOperatorVO;
|
||||||
import com.cm.inspection.service.BaseService;
|
import com.cm.inspection.service.BaseService;
|
||||||
@ -141,6 +139,28 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
|
|||||||
return new SuccessResult();
|
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
|
@Override
|
||||||
public void updateEnterpriseLocationByEnterpriseId(String enterpriseId, String checkLng, String checkLat) throws UpdateException {
|
public void updateEnterpriseLocationByEnterpriseId(String enterpriseId, String checkLng, String checkLat) throws UpdateException {
|
||||||
updateEnterpriseLocationByTokenAndEnterpriseId(null, enterpriseId, checkLng, checkLat);
|
updateEnterpriseLocationByTokenAndEnterpriseId(null, enterpriseId, checkLng, checkLat);
|
||||||
|
@ -270,6 +270,23 @@
|
|||||||
enterprise_id = #{enterpriseId}
|
enterprise_id = #{enterpriseId}
|
||||||
</update>
|
</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 id="getEnterprise" parameterType="map" resultMap="enterpriseDTO">
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -700,7 +700,7 @@
|
|||||||
top.restAjax.get(top.restAjax.path('api/enterprise/getenterprisesinglebyid/{enterpriseId}', [enterpriseId]), {}, null, function(code, data) {
|
top.restAjax.get(top.restAjax.path('api/enterprise/getenterprisesinglebyid/{enterpriseId}', [enterpriseId]), {}, null, function(code, data) {
|
||||||
var dataFormData = {};
|
var dataFormData = {};
|
||||||
for(var i in data) {
|
for(var i in data) {
|
||||||
dataFormData[i] = data[i];
|
dataFormData[i] = data[i] +'';
|
||||||
}
|
}
|
||||||
form.val('dataForm', dataFormData);
|
form.val('dataForm', dataFormData);
|
||||||
form.render(null, 'dataForm');
|
form.render(null, 'dataForm');
|
||||||
|
Loading…
Reference in New Issue
Block a user