Browse Source

解决代码冲突问题

dev_shibei_match
sunyuchao 5 years ago
parent
commit
71bb41f1da
  1. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
  2. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  3. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java
  4. 45
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  5. 28
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  6. 124
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

7
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java → epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java

@ -19,18 +19,17 @@ package com.epmet.dto.result;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* 组织首页-获取组织机构信息接口返参 * 添加组织-接口返参
* *
* @author sun * @author sun
*/ */
@Data @Data
public class AgencydetailResultDTO implements Serializable { public class AgencysResultDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -77,6 +76,4 @@ public class AgencydetailResultDTO implements Serializable {
* 本机关的所有上级机关 * 本机关的所有上级机关
*/ */
private List<ParentListResultDTO> parentList; private List<ParentListResultDTO> parentList;
} }

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

@ -21,7 +21,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.AddAgencyResultDTO; import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.dto.result.AgencyListResultDTO; import com.epmet.dto.result.AgencyListResultDTO;
import com.epmet.dto.result.AgencydetailResultDTO; import com.epmet.dto.result.AgencysResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.dto.result.SubAgencyResultDTO;
import com.epmet.service.AgencyService; import com.epmet.service.AgencyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -85,7 +85,7 @@ public class AgencyController {
* @Description 组织首页-获取组织机构信息 * @Description 组织首页-获取组织机构信息
*/ */
@PostMapping("agencydetail") @PostMapping("agencydetail")
public Result<AgencydetailResultDTO> agencyDetail(@RequestBody AgencydetailFormDTO formDTO) { public Result<AgencysResultDTO> agencyDetail(@RequestBody AgencydetailFormDTO formDTO) {
return agencyService.agencyDetail(formDTO); return agencyService.agencyDetail(formDTO);
} }

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java

@ -17,16 +17,14 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.entity.CustomerAgencyEntity; import com.epmet.dto.result.AgencyListResultDTO;
import com.epmet.dto.result.AgencysResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 机关单位信息 * 机关单位信息
@ -65,7 +63,7 @@ public interface AgencyService {
* @Author sun * @Author sun
* @Description 组织首页-获取组织机构信息 * @Description 组织首页-获取组织机构信息
*/ */
Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO); Result<AgencysResultDTO> agencyDetail(AgencydetailFormDTO formDTO);
/** /**
* @param formDTO * @param formDTO

45
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -21,11 +21,8 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.dto.result.AgencydetailResultDTO;
import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.SubAgencyResultDTO;
import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerAgencyEntity;
import java.util.List; import java.util.List;
@ -107,44 +104,4 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Date 2020/4/20 21:45 * @Date 2020/4/20 21:45
**/ **/
Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
Result<AddAgencyResultDTO> addAgency(AddAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
Result editAgency(EditAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
Result removeAgency(RemoveAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO);
} }

28
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -17,26 +17,17 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.AgencyService; import com.epmet.service.AgencyService;
import com.epmet.service.CustomerAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -45,7 +36,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 机关单位信息 * 机关单位信息
@ -146,24 +136,24 @@ public class AgencyServiceImpl implements AgencyService {
* @Description 组织首页-获取组织机构信息 * @Description 组织首页-获取组织机构信息
*/ */
@Override @Override
public Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO) { public Result<AgencysResultDTO> agencyDetail(AgencydetailFormDTO formDTO) {
AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO(); AgencysResultDTO agencysResultDTO = new AgencysResultDTO();
//1:查询本机关详细信息 //1:查询本机关详细信息
CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId()); CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId());
if (null == entity) { if (null == entity) {
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO); return new Result<AgencysResultDTO>().ok(agencysResultDTO);
} }
agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class); agencysResultDTO = ConvertUtils.sourceToTarget(entity, AgencysResultDTO.class);
agencydetailResultDTO.setAgencyId(entity.getId()); agencysResultDTO.setAgencyId(entity.getId());
agencydetailResultDTO.setAgencyName(entity.getOrganizationName()); agencysResultDTO.setAgencyName(entity.getOrganizationName());
//2:查询本机关的所有上级机关,按自上而下层级顺序 //2:查询本机关的所有上级机关,按自上而下层级顺序
if (null == entity.getPids()) { if (null == entity.getPids()) {
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO); return new Result<AgencysResultDTO>().ok(agencysResultDTO);
} }
List<String> listStr = Arrays.asList(entity.getPids().split(":")); List<String> listStr = Arrays.asList(entity.getPids().split(":"));
List<ParentListResultDTO> parentList = customerAgencyDao.selectPAgencyById(listStr); List<ParentListResultDTO> parentList = customerAgencyDao.selectPAgencyById(listStr);
agencydetailResultDTO.setParentList(parentList); agencysResultDTO.setParentList(parentList);
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO); return new Result<AgencysResultDTO>().ok(agencysResultDTO);
} }
/** /**

124
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -138,128 +138,4 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
} }
return new Result<List<StaffOrgsResultDTO>>().ok(list); return new Result<List<StaffOrgsResultDTO>>().ok(list);
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 添加组织
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<AddAgencyResultDTO> addAgency(AddAgencyFormDTO formDTO) {
Result<AddAgencyResultDTO> result = new Result<AddAgencyResultDTO>();
AddAgencyResultDTO addAgencyResultDTO = new AddAgencyResultDTO();
//0:属性映射赋值
CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class);
entity.setOrganizationName(formDTO.getAgencyName());
entity.setTotalUser(NumConstant.ZERO);
//1:查询上级机关信息
CustomerAgencyEntity parentEntity = baseDao.selectById(formDTO.getPid());
entity.setCustomerId(parentEntity.getCustomerId());
if (null == parentEntity.getPid()) {
entity.setPids(parentEntity.getId());
entity.setAllParentName(parentEntity.getOrganizationName());
} else {
entity.setPids(":" + parentEntity.getId());
entity.setAllParentName("-" + parentEntity.getOrganizationName());
}
//2:保存组织信息
if (baseDao.insert(entity) < NumConstant.ONE) {
logger.error(CustomerAgencyConstant.SAVE_EXCEPTION);
throw new RenException(CustomerAgencyConstant.SAVE_EXCEPTION);
}
//3:返回新组织Id
addAgencyResultDTO.setAgencyId(entity.getId());
return result.ok(addAgencyResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织名称编辑
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result editAgency(EditAgencyFormDTO formDTO) {
Result result = new Result();
CustomerAgencyEntity entity = new CustomerAgencyEntity();
entity.setId(formDTO.getAgencyId());
entity.setOrganizationName(formDTO.getAgencyName());
if (baseDao.updateById(entity) < NumConstant.ONE) {
logger.error(CustomerAgencyConstant.UPDATE_EXCEPTION);
throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION);
}
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 删除组织机关
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result removeAgency(RemoveAgencyFormDTO formDTO) {
Result result = new Result();
//1:查询当前机关是否存在所属下级机关,存在下级的不能删除
List<SubListResultDTO> agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId());
if (null != agencyList && agencyList.size() > NumConstant.ZERO) {
result.setCode(EpmetErrorCode.NOT_DEL_AGENCY.getCode());
result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY.getMsg());
return result;
}
//2:删除当前机关组织(逻辑删)
if (baseDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) {
logger.error(CustomerAgencyConstant.DEL_EXCEPTION);
throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION);
}
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-获取组织机构信息
*/
@Override
public Result<AgencydetailResultDTO> agencyDetail(AgencydetailFormDTO formDTO) {
AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO();
//1:查询本机关详细信息
CustomerAgencyEntity entity = baseDao.selectById(formDTO.getAgencyId());
if (null == entity) {
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO);
}
agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class);
agencydetailResultDTO.setAgencyId(entity.getId());
agencydetailResultDTO.setAgencyName(entity.getOrganizationName());
//2:查询本机关的所有上级机关,按自上而下层级顺序
if (null == entity.getPids()) {
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO);
}
List<String> listStr = Arrays.asList(entity.getPids().split(":"));
List<ParentListResultDTO> parentList = baseDao.selectPAgencyById(listStr);
agencydetailResultDTO.setParentList(parentList);
return new Result<AgencydetailResultDTO>().ok(agencydetailResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 组织首页-下级机关列表
*/
@Override
public Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO) {
SubAgencyResultDTO subAgencyResultDTO = new SubAgencyResultDTO();
//1:根据当前机关Id查询直属下一级机关列表
List<SubListResultDTO> agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId());
subAgencyResultDTO.setAgencyList(agencyList);
//2:统计下一级机关数
subAgencyResultDTO.setSubAgencyCount(agencyList.size());
return new Result<SubAgencyResultDTO>().ok(subAgencyResultDTO);
}
} }
Loading…
Cancel
Save