zxc 3 years ago
parent
commit
7dad033736
  1. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceProjectFormDTO.java
  2. 26
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceProjectListFormDTO.java
  3. 61
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/ServiceProjectListResultDTO.java
  4. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceProjectController.java
  5. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceProjectDao.java
  6. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceProjectService.java
  7. 42
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceProjectServiceImpl.java
  8. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml

1
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceProjectFormDTO.java

@ -46,6 +46,5 @@ public class ServiceProjectFormDTO implements Serializable {
/**
* 附件集合
*/
@Valid
private List<IcServiceProjectAttachmentDTO> attachmentList;
}

26
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceProjectListFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/5/27 16:42
* @DESC
*/
@Data
public class ServiceProjectListFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = -6508966695564469253L;
private String serviceCategoryKey;
private String serviceName;
private String serviceContent;
private String policyGround;
private String customerId;
private String userId;
private String agencyId;
}

61
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/ServiceProjectListResultDTO.java

@ -0,0 +1,61 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.dto.IcServiceProjectAttachmentDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/5/27 16:42
* @DESC
*/
@Data
public class ServiceProjectListResultDTO implements Serializable {
private static final long serialVersionUID = -6508966695564469113L;
/**
* 服务类别
*/
private String serviceCategory;
private String serviceCategoryKey;
/**
* 服务项目ID
*/
private String serviceProjectId;
/**
* 服务名称
*/
private String serviceName;
/**
* 服务内容
*/
private String serviceContent;
/**
* 政策依据
*/
private String policyGround;
/**
* 政策级别
*/
private String policyLevel;
private List<IcServiceProjectAttachmentDTO> attachmentList;
public ServiceProjectListResultDTO() {
this.serviceCategory = "";
this.serviceProjectId = "";
this.serviceName = "";
this.serviceContent = "";
this.policyGround = "";
this.policyLevel = "";
}
}

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceProjectController.java

@ -13,6 +13,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcServiceProjectDTO;
import com.epmet.dto.form.ServiceProjectFormDTO;
import com.epmet.dto.form.ServiceProjectListFormDTO;
import com.epmet.service.IcServiceProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -89,4 +90,17 @@ public class IcServiceProjectController {
return new Result();
}
/**
* Desc: 服务项目列表
* @param formDTO
* @author zxc
* @date 2022/5/27 16:46
*/
@PostMapping("serviceProjectList")
public Result<PageData> serviceProjectList(@LoginUser TokenDto tokenDto,@RequestBody ServiceProjectListFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData>().ok(icServiceProjectService.serviceProjectList(formDTO));
}
}

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceProjectDao.java

@ -1,9 +1,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ServiceProjectListFormDTO;
import com.epmet.dto.result.ServiceProjectListResultDTO;
import com.epmet.entity.IcServiceProjectEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 服务项目管理表
*
@ -12,5 +16,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcServiceProjectDao extends BaseDao<IcServiceProjectEntity> {
/**
* Desc: 查询服务项目列表
* @param formDTO
* @author zxc
* @date 2022/5/27 17:13
*/
List<ServiceProjectListResultDTO> getServiceProjectList(ServiceProjectListFormDTO formDTO);
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceProjectService.java

@ -4,6 +4,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcServiceProjectDTO;
import com.epmet.dto.form.ServiceProjectFormDTO;
import com.epmet.dto.form.ServiceProjectListFormDTO;
import com.epmet.entity.IcServiceProjectEntity;
import java.util.List;
@ -85,4 +86,12 @@ public interface IcServiceProjectService extends BaseService<IcServiceProjectEnt
*/
void serviceProjectAdd(ServiceProjectFormDTO formDTO);
/**
* Desc: 服务项目列表
* @param formDTO
* @author zxc
* @date 2022/5/27 16:46
*/
PageData serviceProjectList(ServiceProjectListFormDTO formDTO);
}

42
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceProjectServiceImpl.java

@ -4,7 +4,9 @@ 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.NumConstant;
import com.epmet.commons.tools.dto.form.DictListFormDTO;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.DictListResultDTO;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
@ -12,19 +14,26 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcServiceProjectDao;
import com.epmet.dto.IcServiceProjectDTO;
import com.epmet.dto.form.ServiceProjectFormDTO;
import com.epmet.dto.form.ServiceProjectListFormDTO;
import com.epmet.dto.result.ServiceProjectListResultDTO;
import com.epmet.entity.IcServiceProjectAttachmentEntity;
import com.epmet.entity.IcServiceProjectEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.IcServiceProjectAttachmentService;
import com.epmet.service.IcServiceProjectService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -40,6 +49,8 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec
@Autowired
private IcServiceProjectAttachmentService attachmentService;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override
public PageData<IcServiceProjectDTO> page(Map<String, Object> params) {
@ -130,4 +141,35 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec
}
}
/**
* Desc: 服务项目列表
* @param formDTO
* @author zxc
* @date 2022/5/27 16:46
*/
@Override
public PageData<List<ServiceProjectListResultDTO>> serviceProjectList(ServiceProjectListFormDTO formDTO) {
PageData result = new PageData(new ArrayList(),NumConstant.ZERO);
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询到此工作人员"+formDTO.getUserId());
}
formDTO.setAgencyId(staffInfo.getAgencyId());
PageInfo<ServiceProjectListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getServiceProjectList(formDTO));
if (CollectionUtils.isNotEmpty(pageInfo.getList())){
DictListFormDTO dictListFormDTO = new DictListFormDTO();
dictListFormDTO.setDictType("ic_service_type");
Result<List<DictListResultDTO>> listResult = adminOpenFeignClient.dictList(dictListFormDTO);
if (!listResult.success()){
throw new EpmetException("获取字典表数据失败,类型为:ic_service_type");
}
if (CollectionUtils.isNotEmpty(listResult.getData())){
pageInfo.getList().forEach(p -> listResult.getData().stream().filter(l -> l.getValue().equals(p.getServiceCategoryKey())).forEach(l -> p.setServiceCategory(l.getLabel())));
}
result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal())));
result.setList(pageInfo.getList());
}
return result;
}
}

49
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml

@ -3,4 +3,53 @@
<mapper namespace="com.epmet.dao.IcServiceProjectDao">
<!-- 查询服务项目列表 -->
<resultMap id="getServiceProjectListMap" type="com.epmet.dto.result.ServiceProjectListResultDTO">
<result column="serviceProjectId" property="serviceProjectId"/>
<result column="serviceName" property="serviceName"/>
<result column="serviceContent" property="serviceContent"/>
<result column="serviceCategoryKey" property="serviceCategoryKey"/>
<result column="policyGround" property="policyGround"/>
<result column="policyLevel" property="policyLevel"/>
<collection property="attachmentList" column="serviceProjectId" ofType="com.epmet.dto.IcServiceProjectAttachmentDTO" select="getAttachmentList"/>
</resultMap>
<select id="getServiceProjectList" resultMap="getServiceProjectListMap">
SELECT
SERVICE_NAME AS serviceName,
SERVICE_CONTENT AS serviceContent,
SERVICE_CATEGORY_KEY AS serviceCategoryKey,
ID AS serviceProjectId,
POLICY_GROUND AS policyGround,
(CASE WHEN POLICY_LEVEL = '0' THEN '市级'
WHEN POLICY_LEVEL = '0' THEN '区级'
WHEN POLICY_LEVEL = '0' THEN '街道级'
ELSE '' end) AS policyLevel
FROM ic_service_project
WHERE DEL_FLAG = 0
AND ENABLED = 0
AND AGENCY_ID = #{agencyId}
<if test='null != serviceCategoryKey and serviceCategoryKey != "" '>
AND SERVICE_CATEGORY_KEY = #{serviceCategoryKey}
</if>
<if test='null != serviceName and serviceName != "" '>
AND SERVICE_NAME LIKE CONCAT('%',#{serviceName},'%')
</if>
<if test='null != serviceContent and serviceContent != "" '>
AND SERVICE_CONTENT LIKE CONCAT('%',#{serviceContent},'%')
</if>
<if test='null != policyGround and policyGround != "" '>
AND POLICY_GROUND LIKE CONCAT('%',#{policyGround},'%')
</if>
ORDER BY CREATED_TIME desc
</select>
<select id="getAttachmentList" resultType="com.epmet.dto.IcServiceProjectAttachmentDTO">
SELECT
ATTACHMENT_NAME,
ATTACHMENT_TYPE,
ATTACHMENT_FORMAT,
ATTACHMENT_URL
FROM ic_service_project_attachment
WHERE DEL_FLAG = '0'
AND IC_SERVICE_ID = #{serviceProjectId}
</select>
</mapper>
Loading…
Cancel
Save