Browse Source

Merge remote-tracking branch 'origin/feature/lc_addAreaCode'

feature/screenDataPush
liuchuang 4 years ago
parent
commit
d70e29a31f
  1. 27
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java
  2. 14
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/AnalysisFeignClient.java
  3. 9
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/fallback/AnalysisFeignClientFallback.java
  4. 10
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java
  5. 31
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java
  6. 5
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/EpmetConstant.java
  7. 31
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/DeptAddAreaCodeFormDTO.java
  8. 18
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/DeptAddAreaCodeResultDTO.java
  9. 23
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/controller/AdminAnalysisController.java
  10. 13
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/AdminAnalysisService.java
  11. 8
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/impl/AdminAnalysisServiceImpl.java

27
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java

@ -9,6 +9,7 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.annotation.LogOperation;
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
@ -23,6 +24,7 @@ import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO;
import com.elink.esua.epdc.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -284,4 +286,29 @@ public class SysDeptController {
return new Result<List<SysDeptDTO>>().ok(data);
}
/**
* 新增区域编码
*
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.SysDeptDTO>
* @author Liuchuang
* @since 2021/5/11 15:20
*/
@PostMapping("addAreaCode")
public Result<SysDeptDTO> addAreaCode(@RequestBody SysDeptDTO dto) {
if (!OrganizationTypeConstant.ORG_TYPE_STREET_PARTY.equals(dto.getTypeKey())
&& !OrganizationTypeConstant.ORG_TYPE_COMMUNITY_PARTY.equals(dto.getTypeKey())) {
return new Result<SysDeptDTO>().error("只有机构类型为街道或者社区时可以新增区域编码");
}
if (null == dto.getName() || StringUtils.isEmpty(dto.getName())) {
return new Result<SysDeptDTO>().error("请填写机构名称");
}
if (null == dto.getPid() || 0 == dto.getPid()) {
return new Result<SysDeptDTO>().error("请选择上级部门");
}
return sysDeptService.addAreaCode(dto);
}
}

14
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/AnalysisFeignClient.java

@ -2,12 +2,15 @@ package com.elink.esua.epdc.feign;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO;
import com.elink.esua.epdc.dto.epdc.DeptCodeOption;
import com.elink.esua.epdc.feign.fallback.AnalysisFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
@ -29,4 +32,15 @@ public interface AnalysisFeignClient {
@GetMapping(value = "analysis/admin/getDeptCode", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<DeptCodeOption> getDeptCode(@RequestBody DeptCodeFormDTO deptCodeFormDTO);
/**
* 新增区域编码
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO>
* @author Liuchuang
* @since 2021/5/11 15:38
*/
@PostMapping(value = "analysis/admin/addAreaCode", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<DeptAddAreaCodeResultDTO> addAreaCode(DeptAddAreaCodeFormDTO formDto);
}

9
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/feign/fallback/AnalysisFeignClientFallback.java

@ -3,6 +3,8 @@ package com.elink.esua.epdc.feign.fallback;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO;
import com.elink.esua.epdc.dto.epdc.DeptCodeOption;
import com.elink.esua.epdc.feign.AnalysisFeignClient;
@ -18,6 +20,11 @@ public class AnalysisFeignClientFallback implements AnalysisFeignClient {
@Override
public Result<DeptCodeOption> getDeptCode(DeptCodeFormDTO deptCodeFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "homePagePlatformSummary",deptCodeFormDTO);
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "getDeptCode",deptCodeFormDTO);
}
@Override
public Result<DeptAddAreaCodeResultDTO> addAreaCode(DeptAddAreaCodeFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "addAreaCode",formDto);
}
}

10
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java

@ -288,4 +288,14 @@ public interface SysDeptService extends BaseService<SysDeptEntity> {
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.DeptOption>
**/
Result<DeptOption> getUserDeptOptionByUserId(String userId);
/**
* 新增区域编码
*
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.SysDeptDTO>
* @author Liuchuang
* @since 2021/5/11 15:21
*/
Result<SysDeptDTO> addAreaCode(SysDeptDTO dto);
}

31
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java

@ -29,6 +29,8 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.utils.TreeUtils;
import com.elink.esua.epdc.dao.SysDeptDao;
import com.elink.esua.epdc.dto.*;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO;
import com.elink.esua.epdc.dto.epdc.DeptCodeOption;
import com.elink.esua.epdc.dto.epdc.DeptTreeWithTypeKeyDTO;
@ -978,4 +980,33 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
return new Result<DeptOption>().ok((DeptOption) obj);
}
@Override
public Result<SysDeptDTO> addAreaCode(SysDeptDTO dto) {
SysDeptEntity parentDeptInfo = baseDao.getById(dto.getPid());
if (null == parentDeptInfo) {
return new Result<SysDeptDTO>().error("请选择上级部门");
}
if (StringUtils.isEmpty(parentDeptInfo.getAreaCode())) {
return new Result<SysDeptDTO>().error("上级部门未绑定区域编码,请先绑定上级部门区域编码");
}
DeptAddAreaCodeFormDTO formDto = new DeptAddAreaCodeFormDTO();
formDto.setParentAreaCode(parentDeptInfo.getAreaCode());
formDto.setName(dto.getName());
if (null != dto.getId() && NumConstant.ZERO_L != dto.getId()) {
SysDeptEntity deptInfo = baseDao.getById(dto.getId());
formDto.setCode(deptInfo.getAreaCode());
}
Result<DeptAddAreaCodeResultDTO> data = analysisFeignClient.addAreaCode(formDto);
if (!data.success()) {
return new Result<SysDeptDTO>().error(data.getMsg());
}
dto.setAreaCode(data.getData().getCode());
// 更新缓存中的行政区划
this.packageKcDeptCodeOption();
return new Result<SysDeptDTO>().ok(dto);
}
}

5
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/EpmetConstant.java

@ -222,6 +222,11 @@ public interface EpmetConstant {
*/
String EPMET_PROJECT_CATEGORY_ORG_DAILY = "/data/stats/project/category-org-daily";
/**
* 新增行政地区编码
*/
String EPMET_SCREEN_AGENCY_ADD_STREET_COMM = "/data/report/screen/agency/addstreetcomm";
/**
* 行政地区编码查询 - 平阴县

31
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/DeptAddAreaCodeFormDTO.java

@ -0,0 +1,31 @@
package com.elink.esua.epdc.dto.admin;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author Liuchuang
*/
@Data
public class DeptAddAreaCodeFormDTO implements Serializable {
private static final long serialVersionUID = -8154207132241940362L;
/**
* 上级组织区域编码
*/
@NotBlank(message = "上级组织区域编码不能为空")
private String parentAreaCode;
/**
* 新增组织名称
*/
@NotBlank(message = "新增组织名称不能为空")
private String name;
/**
* 新增组织区域编码如果code有值会更新行政区划的名字
*/
private String code;
}

18
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/admin/DeptAddAreaCodeResultDTO.java

@ -0,0 +1,18 @@
package com.elink.esua.epdc.dto.admin;
import lombok.Data;
import java.io.Serializable;
/**
* @author Liuchuang
*/
@Data
public class DeptAddAreaCodeResultDTO implements Serializable {
private static final long serialVersionUID = 8182151134618271181L;
/**
* 区域编码
*/
private String code;
}

23
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/controller/AdminAnalysisController.java

@ -1,14 +1,14 @@
package com.elink.esua.epdc.modules.admin.controller;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO;
import com.elink.esua.epdc.dto.epdc.DeptCodeOption;
import com.elink.esua.epdc.modules.admin.service.AdminAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @Description admin相关
@ -35,4 +35,19 @@ public class AdminAnalysisController {
return new Result().ok(deptCodeOption);
}
/**
* 新增区域编码
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO>
* @author Liuchuang
* @since 2021/5/11 15:43
*/
@PostMapping("addAreaCode")
public Result<DeptAddAreaCodeResultDTO> addAreaCode(@RequestBody DeptAddAreaCodeFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return adminAnalysisService.addAreaCode(formDto);
}
}

13
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/AdminAnalysisService.java

@ -1,5 +1,8 @@
package com.elink.esua.epdc.modules.admin.service;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO;
import com.elink.esua.epdc.dto.epdc.DeptCodeOption;
@ -17,4 +20,14 @@ public interface AdminAnalysisService {
* @return java.lang.String
**/
DeptCodeOption getDeptCode(DeptCodeFormDTO deptCodeFormDTO);
/**
* 新增区域编码
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO>
* @author Liuchuang
* @since 2021/5/11 15:45
*/
Result<DeptAddAreaCodeResultDTO> addAreaCode(DeptAddAreaCodeFormDTO formDto);
}

8
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/admin/service/impl/AdminAnalysisServiceImpl.java

@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.EpmetConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptAddAreaCodeResultDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeFormDTO;
import com.elink.esua.epdc.dto.admin.DeptCodeTree;
import com.elink.esua.epdc.dto.epdc.DeptCodeOption;
@ -44,4 +46,10 @@ public class AdminAnalysisServiceImpl extends BaseServiceImpl<IssueAnalysisDao,
return new DeptCodeOption();
}
@Override
public Result<DeptAddAreaCodeResultDTO> addAreaCode(DeptAddAreaCodeFormDTO formDto) {
String dataResult = epmetUtils.httpPost(EpmetConstant.EPMET_SCREEN_AGENCY_ADD_STREET_COMM, JSONObject.toJSONString(formDto));
return JSONObject.parseObject(dataResult, Result.class);
}
}

Loading…
Cancel
Save