Browse Source

Merge remote-tracking branch 'origin/dev_icservice' into dev_icservice

feature/teamB_zz_wgh
yinzuomei 3 years ago
parent
commit
7db56d5598
  1. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceOrgListFormDTO.java
  2. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgListResultDTO.java
  3. 24
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgSelectListResultDTO.java
  4. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceOrgController.java
  5. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceOrgDao.java
  6. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceOrgService.java
  7. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceOrgServiceImpl.java
  8. 41
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceOrgDao.xml

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceOrgListFormDTO.java

@ -27,7 +27,7 @@ public class IcServiceOrgListFormDTO implements Serializable {
/**
* 备注信息
*/
private String remarks;
private String remark;
/**
* 页码
*/

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgListResultDTO.java

@ -60,7 +60,7 @@ public class IcServiceOrgListResultDTO implements Serializable {
/**
* 备注
*/
private String remarks;
private String remark;
@Data
public static class ServiceType {

24
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgSelectListResultDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 组织服务组织列表_下拉框使用--接口返参
* @Author sun
*/
@Data
public class IcServiceOrgSelectListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 服务组织Id
*/
private String icServiceOrgId;
/**
* 服务组织名称
*/
private String orgName;
}

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceOrgController.java

@ -13,10 +13,13 @@ import com.epmet.dto.IcServiceOrgDTO;
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO;
import com.epmet.dto.form.IcServiceOrgListFormDTO;
import com.epmet.dto.result.IcServiceOrgListResultDTO;
import com.epmet.dto.result.IcServiceOrgSelectListResultDTO;
import com.epmet.service.IcServiceOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 服务组织表
@ -56,19 +59,33 @@ public class IcServiceOrgController {
@NoRepeatSubmit
@PostMapping("edit")
public Result edit(@RequestBody IcServiceOrgAddEditFormDTO dto){
//效验数据
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgAddEditFormDTO dto){
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
icServiceOrgService.update(dto);
return new Result();
}
@PostMapping("del")
public Result delete(@RequestBody IcServiceOrgAddEditFormDTO formDTO){
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgAddEditFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, IcServiceOrgAddEditFormDTO.Del.class);
icServiceOrgService.delete(formDTO.getIcServiceOrgId());
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
icServiceOrgService.delete(formDTO);
return new Result();
}
@RequestMapping("detail")
public Result<IcServiceOrgListResultDTO> detail(@RequestBody IcServiceOrgListFormDTO formDTO) {
return new Result<IcServiceOrgListResultDTO>().ok(icServiceOrgService.detail(formDTO));
}
@RequestMapping("selectlist")
public Result<List<IcServiceOrgSelectListResultDTO>> selectList(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgListFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
return new Result<List<IcServiceOrgSelectListResultDTO>>().ok(icServiceOrgService.selectList(formDTO));
}
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceOrgDao.java

@ -3,6 +3,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IcServiceOrgListFormDTO;
import com.epmet.dto.result.IcServiceOrgListResultDTO;
import com.epmet.dto.result.IcServiceOrgSelectListResultDTO;
import com.epmet.entity.IcServiceOrgEntity;
import org.apache.ibatis.annotations.Mapper;
@ -22,4 +23,12 @@ public interface IcServiceOrgDao extends BaseDao<IcServiceOrgEntity> {
* @Description 服务组织-列表查询
**/
List<IcServiceOrgListResultDTO> selectServiceOrgList(IcServiceOrgListFormDTO formDTO);
/**
* @Author sun
* @Description 服务组织列表_下拉框
**/
List<IcServiceOrgSelectListResultDTO> selectServiceOrgSelectList(IcServiceOrgListFormDTO formDTO);
void del(IcServiceOrgEntity entity);
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceOrgService.java

@ -6,8 +6,11 @@ import com.epmet.dto.IcServiceOrgDTO;
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO;
import com.epmet.dto.form.IcServiceOrgListFormDTO;
import com.epmet.dto.result.IcServiceOrgListResultDTO;
import com.epmet.dto.result.IcServiceOrgSelectListResultDTO;
import com.epmet.entity.IcServiceOrgEntity;
import java.util.List;
/**
* 服务组织表
*
@ -56,13 +59,10 @@ public interface IcServiceOrgService extends BaseService<IcServiceOrgEntity> {
*/
void update(IcServiceOrgAddEditFormDTO dto);
/**
* 批量删除
*
* @param icServiceOrgId
* @return void
* @author generator
* @date 2022-05-27
*/
void delete(String icServiceOrgId);
void delete(IcServiceOrgAddEditFormDTO formDTO);
IcServiceOrgListResultDTO detail(IcServiceOrgListFormDTO formDTO);
List<IcServiceOrgSelectListResultDTO> selectList(IcServiceOrgListFormDTO formDTO);
}

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceOrgServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -17,6 +18,7 @@ import com.epmet.dto.IcServiceOrgDTO;
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO;
import com.epmet.dto.form.IcServiceOrgListFormDTO;
import com.epmet.dto.result.IcServiceOrgListResultDTO;
import com.epmet.dto.result.IcServiceOrgSelectListResultDTO;
import com.epmet.entity.IcServiceOrgEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.IcServiceOrgService;
@ -115,7 +117,7 @@ public class IcServiceOrgServiceImpl extends BaseServiceImpl<IcServiceOrgDao, Ic
//3.新增服务组织数据
IcServiceOrgEntity entity = ConvertUtils.sourceToTarget(formDTO, IcServiceOrgEntity.class);
entity.setAgencyId(staffInfo.getAgencyId());
entity.setAgencyIdPath(staffInfo.getAgencyPIds());
entity.setAgencyIdPath(StringUtils.isEmpty(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId());
insert(entity);
}
@ -144,9 +146,50 @@ public class IcServiceOrgServiceImpl extends BaseServiceImpl<IcServiceOrgDao, Ic
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String icServiceOrgId) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteById(icServiceOrgId);
public void delete(IcServiceOrgAddEditFormDTO formDTO) {
IcServiceOrgEntity entity = new IcServiceOrgEntity();
entity.setId(formDTO.getIcServiceOrgId());
entity.setUpdatedBy(formDTO.getUserId());
baseDao.del(entity);
}
@Override
public IcServiceOrgListResultDTO detail(IcServiceOrgListFormDTO formDTO) {
IcServiceOrgListResultDTO resultDTO = new IcServiceOrgListResultDTO();
//1.查询服务组织信息
List<IcServiceOrgListResultDTO> list = baseDao.selectServiceOrgList(formDTO);
//封装服务类别数据
if (!CollectionUtils.isEmpty(list)) {
resultDTO = list.get(NumConstant.ZERO);
//服务类别字典表数据
Result<Map<String, String>> statusRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.IC_SERVICE_TYPE.getCode());
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>();
List<IcServiceOrgListResultDTO.ServiceType> stList = new ArrayList<>();
IcServiceOrgListResultDTO.ServiceType st = null;
for (String str : resultDTO.getServiceType().split(",")) {
st = new IcServiceOrgListResultDTO.ServiceType();
st.setValue(str);
st.setName(null != statusMap.get(str) ? statusMap.get(str) : "");
stList.add(st);
}
resultDTO.setServiceTypeList(stList);
}
return resultDTO;
}
@Override
public List<IcServiceOrgSelectListResultDTO> selectList(IcServiceOrgListFormDTO formDTO) {
//1.获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId()));
}
//2.按条件查询当前组织及下级服务组织数据
List<IcServiceOrgSelectListResultDTO> resultList = baseDao.selectServiceOrgSelectList(formDTO);
return resultList;
}
}

41
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceOrgDao.xml

@ -15,7 +15,7 @@
longitude longitude,
latitude latitude,
address address,
remarks remarks
remark remark
FROM
ic_service_org
WHERE
@ -27,7 +27,10 @@
AND customer_id = #{customerId}
</if>
<if test="agencyId != null and agencyId != '' ">
AND pids LIKE CONCAT('%',#{agencyId},'%')
AND agency_id_path LIKE CONCAT('%',#{agencyId},'%')
</if>
<if test="serviceType != null and serviceType != '' ">
AND service_type LIKE CONCAT('%', #{serviceType}, '%')
</if>
<if test="orgName != null and orgName != '' ">
AND org_name LIKE CONCAT('%', #{orgName}, '%')
@ -35,11 +38,41 @@
<if test="address != null and address != '' ">
AND address LIKE CONCAT('%', #{address}, '%')
</if>
<if test="remarks != null and remarks != '' ">
AND remarks LIKE CONCAT('%', #{remarks}, '%')
<if test="remark != null and remark != '' ">
AND remark LIKE CONCAT('%', #{remark}, '%')
</if>
ORDER BY created_time DESC
</select>
<select id="selectServiceOrgSelectList" resultType="com.epmet.dto.result.IcServiceOrgSelectListResultDTO">
SELECT
id icServiceOrgId,
org_name orgName
FROM
ic_service_org
WHERE
del_flag = '0'
<if test="customerId != null and customerId != '' ">
AND customer_id = #{customerId}
</if>
<if test="agencyId != null and agencyId != '' ">
AND agency_id_path LIKE CONCAT('%',#{agencyId},'%')
</if>
<if test="serviceType != null and serviceType != '' ">
AND service_type LIKE CONCAT('%', #{serviceType}, '%')
</if>
ORDER BY created_time DESC
</select>
<delete id="del">
UPDATE ic_service_org
SET del_flag = '1',
updated_by = #{updatedBy},
updated_time = NOW()
WHERE
id = #{id}
AND del_flag = '0'
</delete>
</mapper>
Loading…
Cancel
Save