wxz 3 years ago
parent
commit
7b0437b327
  1. 110
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgDTO.java
  2. 90
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgServiceMatterDTO.java
  3. 133
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgFormDTO.java
  4. 28
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgPageFormDTO.java
  5. 87
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcPublicServiceOrgDetailResDTO.java
  6. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceItemResultDTO.java
  7. 101
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPublicServiceOrgController.java
  8. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java
  9. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgDao.java
  10. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgServiceMatterDao.java
  11. 76
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgEntity.java
  12. 44
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgServiceMatterEntity.java
  13. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPublicServiceOrgService.java
  14. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java
  15. 171
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPublicServiceOrgServiceImpl.java
  16. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java
  17. 38
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.29__public_service_org.sql
  18. 81
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgDao.xml
  19. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgServiceMatterDao.xml

110
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgDTO.java

@ -0,0 +1,110 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 公共服务组织管理(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Data
public class IcPublicServiceOrgDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* AGENCY_ID的pids
*/
private String pids;
/**
* 名称
*/
private String name;
/**
* 1实有单位2社会服务组织3志愿团队
*/
private String type;
/**
* 联系人
*/
private String contact;
/**
* 联系电话
*/
private String contactMobile;
/**
* 地址
*/
private String address;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 备注
*/
private String remark;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
private List<IcPublicServiceOrgServiceMatterDTO> serviceMatterList;
}

90
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgServiceMatterDTO.java

@ -0,0 +1,90 @@
package com.epmet.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 公共服务组织服务事项(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Data
public class IcPublicServiceOrgServiceMatterDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@JsonIgnore
private String id;
/**
* 客户id
*/
@JsonIgnore
private String customerId;
/**
* ic_public_service_org.ID
*/
@JsonIgnore
private String orgId;
/**
* ic_service_item_dict.ID
*/
private String categoryId;
/**
* 服务事项编码ic_service_item_dict.CATEGORY_CODE
*/
private String categoryCode;
/**
* 删除标识 0未删除1已删除
*/
@JsonIgnore
private String delFlag;
/**
* 乐观锁
*/
@JsonIgnore
private Integer revision;
/**
* 创建人
*/
@JsonIgnore
private String createdBy;
/**
* 创建时间
*/
@JsonIgnore
private Date createdTime;
/**
* 更新人
*/
@JsonIgnore
private String updatedBy;
/**
* 更新时间
*/
@JsonIgnore
private Date updatedTime;
/**
* 详情页面显示
*/
private String categoryName;
}

133
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgFormDTO.java

@ -0,0 +1,133 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.dto.IcPublicServiceOrgServiceMatterDTO;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2023/2/3 15:04
*/
@Data
public class IcPublicServiceOrgFormDTO {
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
public interface UpdateUserInternalGroup {
}
public interface UpdateUserShowGroup extends CustomerClientShowGroup {
}
/**
* 主键
*/
@NotBlank(message = "id为空", groups = UpdateUserInternalGroup.class)
private String id;
/**
* 客户id
*/
@NotBlank(message = "customerId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String customerId;
/**
* 组织ID
*/
@NotBlank(message = "agencyId不能为空",groups =UpdateUserInternalGroup.class )
private String agencyId;
/**
* AGENCY_ID的pids
*/
private String pids;
/**
* 名称
*/
@Length(max = 100, groups = AddUserShowGroup.class, message = "最多输入100字")
@NotBlank(message = "名称不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class})
private String name;
/**
* 1实有单位2社会服务组织3志愿团队
*/
@NotBlank(message = "类别不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class})
private String type;
/**
* 联系人
*/
@NotBlank(message = "联系人不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class})
private String contact;
/**
* 联系电话
*/
@NotBlank(message = "联系电话不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class})
private String contactMobile;
/**
* 地址
*/
@NotBlank(message = "地址不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class})
private String address;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 备注
*/
@Length(max = 500,message = "最多输入500字",groups ={UpdateUserShowGroup.class,AddUserShowGroup.class} )
private String remark;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
private List<IcPublicServiceOrgServiceMatterDTO> serviceMatterList;
}

28
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgPageFormDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2023/2/3 16:02
*/
@Data
public class IcPublicServiceOrgPageFormDTO extends PageFormDTO {
private String customerId;
private String agencyId;
private String name;
private List<String> categoryIds;
private String type;
private String contact;
private String contactMobile;
/**
* 工作端当前登录人员
*/
private String currentStaffId;
}

87
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcPublicServiceOrgDetailResDTO.java

@ -0,0 +1,87 @@
package com.epmet.dto.result;
import com.epmet.dto.IcPublicServiceOrgServiceMatterDTO;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2023/2/3 15:52
*/
@Data
public class IcPublicServiceOrgDetailResDTO {
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
private String agencyName;
/**
* AGENCY_ID的pids
*/
private String pids;
/**
* 名称
*/
private String name;
/**
* 1实有单位2社会服务组织3志愿团队
*/
private String type;
private String typeName;
/**
* 联系人
*/
private String contact;
/**
* 联系电话
*/
private String contactMobile;
/**
* 地址
*/
private String address;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 备注
*/
private String remark;
/**
* 服务事项名称
* 多个按照英文逗号隔开
*/
private String serviceMatterName;
private List<IcPublicServiceOrgServiceMatterDTO> serviceMatterList;
}

4
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/ServiceItemResultDTO.java

@ -13,6 +13,10 @@ import java.io.Serializable;
public class ServiceItemResultDTO implements Serializable {
private static final long serialVersionUID = -590440160577071133L;
private String categoryId;
/**
* 分类编码
*/
private String categoryCode;
private String categoryName;
private Integer awardPoint;
private Boolean usableFlag;

101
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPublicServiceOrgController.java

@ -0,0 +1,101 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.IcPublicServiceOrgFormDTO;
import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO;
import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO;
import com.epmet.service.IcPublicServiceOrgService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 公共服务组织管理(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@RestController
@RequestMapping("icPublicServiceOrg")
public class IcPublicServiceOrgController {
@Autowired
private IcPublicServiceOrgService icPublicServiceOrgService;
/**
*
* @param tokenDto
* @param formDTO
* @return
*/
@RequestMapping("page")
public Result<PageData<IcPublicServiceOrgDetailResDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody IcPublicServiceOrgPageFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
//工作端调用的话,赋值当前登录用户id
if(AppClientConstant.APP_GOV.equals(tokenDto.getApp())){
formDTO.setCurrentStaffId(tokenDto.getUserId());
}
PageData<IcPublicServiceOrgDetailResDTO> page = icPublicServiceOrgService.page(formDTO);
return new Result<PageData<IcPublicServiceOrgDetailResDTO>>().ok(page);
}
@PostMapping("detail/{id}")
public Result<IcPublicServiceOrgDetailResDTO> get(@PathVariable("id") String id){
IcPublicServiceOrgDetailResDTO data = icPublicServiceOrgService.get(id);
return new Result<IcPublicServiceOrgDetailResDTO>().ok(data);
}
/**
* 新增名称组织下唯一
* @param formDTO
* @return
*/
@NoRepeatSubmit
@PostMapping("save")
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPublicServiceOrgFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCreatedBy(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, IcPublicServiceOrgFormDTO.AddUserShowGroup.class, IcPublicServiceOrgFormDTO.AddUserInternalGroup.class);
icPublicServiceOrgService.save(formDTO);
return new Result();
}
/**
*
* @param tokenDto
* @param formDTO
* @return
*/
@NoRepeatSubmit
@PostMapping("update")
public Result update(@LoginUser TokenDto tokenDto,@RequestBody IcPublicServiceOrgFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCreatedBy(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, IcPublicServiceOrgFormDTO.UpdateUserShowGroup.class, IcPublicServiceOrgFormDTO.UpdateUserInternalGroup.class);
icPublicServiceOrgService.update(formDTO);
return new Result();
}
/**
* 同时删除服务事项表
* @param ids
* @return
*/
@PostMapping("delete")
public Result delete(@RequestBody List<String> ids){
if(CollectionUtils.isNotEmpty(ids)){
icPublicServiceOrgService.delete(ids);
}
return new Result();
}
}

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceItemDictController.java

@ -87,6 +87,18 @@ public class IcServiceItemDictController {
return new Result<List<OptionDTO>>().ok(icServiceItemDictService.queryDictListForSelect(formDTO));
}
/**
* 烟台的公共服务组织服务事项列表
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("dict-options")
public Result<List<ServiceItemResultDTO>> queryDictOption(@LoginUser TokenDto tokenDto, @RequestBody ServiceItemSelectFormDTO formDTO) {
return new Result<List<ServiceItemResultDTO>>().ok(icServiceItemDictService.queryDictOption(formDTO.getType(), tokenDto.getCustomerId()));
}
/**
* 客户初始化数据
* @Param customerId

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgDao.java

@ -0,0 +1,21 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO;
import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO;
import com.epmet.entity.IcPublicServiceOrgEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 公共服务组织管理(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Mapper
public interface IcPublicServiceOrgDao extends BaseDao<IcPublicServiceOrgEntity> {
List<IcPublicServiceOrgDetailResDTO> pageList(IcPublicServiceOrgPageFormDTO formDTO);
}

20
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgServiceMatterDao.java

@ -0,0 +1,20 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcPublicServiceOrgServiceMatterDTO;
import com.epmet.entity.IcPublicServiceOrgServiceMatterEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 公共服务组织服务事项(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Mapper
public interface IcPublicServiceOrgServiceMatterDao extends BaseDao<IcPublicServiceOrgServiceMatterEntity> {
List<IcPublicServiceOrgServiceMatterDTO> selectServiceMatter(String orgId);
}

76
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgEntity.java

@ -0,0 +1,76 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 公共服务组织管理(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_public_service_org")
public class IcPublicServiceOrgEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* AGENCY_ID的pids
*/
private String pids;
/**
* 名称
*/
private String name;
/**
* 1实有单位2社会服务组织3志愿团队
*/
private String type;
/**
* 联系人
*/
private String contact;
/**
* 联系电话
*/
private String contactMobile;
/**
* 地址
*/
private String address;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 备注
*/
private String remark;
}

44
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgServiceMatterEntity.java

@ -0,0 +1,44 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 公共服务组织服务事项(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_public_service_org_service_matter")
public class IcPublicServiceOrgServiceMatterEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* ic_public_service_org.ID
*/
private String orgId;
/**
* ic_service_item_dict.ID
*/
private String categoryId;
/**
* 服务事项编码ic_service_item_dict.CATEGORY_CODE
*/
private String categoryCode;
}

34
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPublicServiceOrgService.java

@ -0,0 +1,34 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.IcPublicServiceOrgFormDTO;
import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO;
import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO;
import com.epmet.entity.IcPublicServiceOrgEntity;
import java.util.List;
/**
* 公共服务组织管理(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
public interface IcPublicServiceOrgService extends BaseService<IcPublicServiceOrgEntity> {
/**
* 公共服务组织
* @param dto
* @return
*/
String save(IcPublicServiceOrgFormDTO dto);
String update(IcPublicServiceOrgFormDTO formDTO);
void delete(List<String> orgIds);
IcPublicServiceOrgDetailResDTO get(String id);
PageData<IcPublicServiceOrgDetailResDTO> page(IcPublicServiceOrgPageFormDTO formDTO);
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceItemDictService.java

@ -81,4 +81,6 @@ public interface IcServiceItemDictService extends BaseService<IcServiceItemDictE
void customerInit(String customerId);
String getCategoryName(String customerId, String id);
List<ServiceItemResultDTO> queryDictOption(String type, String customerId);
}

171
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPublicServiceOrgServiceImpl.java

@ -0,0 +1,171 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
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.dao.IcPublicServiceOrgDao;
import com.epmet.dao.IcPublicServiceOrgServiceMatterDao;
import com.epmet.dto.form.IcPublicServiceOrgFormDTO;
import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO;
import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO;
import com.epmet.entity.IcPublicServiceOrgEntity;
import com.epmet.entity.IcPublicServiceOrgServiceMatterEntity;
import com.epmet.service.IcPublicServiceOrgService;
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.List;
import java.util.stream.Collectors;
/**
* 公共服务组织管理(烟台需求)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-02-03
*/
@Service
public class IcPublicServiceOrgServiceImpl extends BaseServiceImpl<IcPublicServiceOrgDao, IcPublicServiceOrgEntity> implements IcPublicServiceOrgService {
@Autowired
private IcPublicServiceOrgServiceMatterDao icPublicServiceOrgServiceMatterDao;
@Transactional(rollbackFor = EpmetException.class)
@Override
public String save(IcPublicServiceOrgFormDTO formDto) {
CustomerStaffInfoCacheResult staffInfo= CustomerStaffRedis.getStaffInfo(formDto.getCustomerId(),formDto.getCreatedBy());
if(null==staffInfo|| StringUtils.isBlank(staffInfo.getAgencyId())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode());
}
checkUnqiueName(formDto.getName(),staffInfo.getAgencyId(),null);
formDto.setAgencyId(staffInfo.getAgencyId());
formDto.setPids(staffInfo.getAgencyPIds());
IcPublicServiceOrgEntity entity=ConvertUtils.sourceToTarget(formDto,IcPublicServiceOrgEntity.class);
baseDao.insert(entity);
if(CollectionUtils.isNotEmpty(formDto.getServiceMatterList())){
formDto.getServiceMatterList().forEach(dto->{
IcPublicServiceOrgServiceMatterEntity serviceOrgServiceMatterEntity=ConvertUtils.sourceToTarget(dto,IcPublicServiceOrgServiceMatterEntity.class);
serviceOrgServiceMatterEntity.setOrgId(entity.getId());
serviceOrgServiceMatterEntity.setCustomerId(formDto.getCustomerId());
icPublicServiceOrgServiceMatterDao.insert(serviceOrgServiceMatterEntity);
});
}
return entity.getId();
}
/**
*
* @param name
* @param agencyId
* @param id
*/
private void checkUnqiueName(String name, String agencyId, String id) {
LambdaQueryWrapper<IcPublicServiceOrgEntity> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(IcPublicServiceOrgEntity::getName,name)
.eq(IcPublicServiceOrgEntity::getAgencyId,agencyId)
.ne(StringUtils.isNotBlank(id),IcPublicServiceOrgEntity::getId,id);
int count=baseDao.selectCount(queryWrapper);
if(count>0){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"名称已存在","名称已存在");
}
}
@Transactional(rollbackFor = EpmetException.class)
@Override
public String update(IcPublicServiceOrgFormDTO formDTO) {
checkUnqiueName(formDTO.getName(),formDTO.getAgencyId(),formDTO.getId());
IcPublicServiceOrgEntity entity=ConvertUtils.sourceToTarget(formDTO,IcPublicServiceOrgEntity.class);
baseDao.updateById(entity);
if(CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())){
//先删除
LambdaQueryWrapper<IcPublicServiceOrgServiceMatterEntity> deleteWrapper=new LambdaQueryWrapper<>();
deleteWrapper.eq(IcPublicServiceOrgServiceMatterEntity::getOrgId,formDTO.getId());
icPublicServiceOrgServiceMatterDao.delete(deleteWrapper);
formDTO.getServiceMatterList().forEach(dto->{
IcPublicServiceOrgServiceMatterEntity serviceOrgServiceMatterEntity=ConvertUtils.sourceToTarget(dto,IcPublicServiceOrgServiceMatterEntity.class);
serviceOrgServiceMatterEntity.setOrgId(entity.getId());
serviceOrgServiceMatterEntity.setCustomerId(formDTO.getCustomerId());
icPublicServiceOrgServiceMatterDao.insert(serviceOrgServiceMatterEntity);
});
}
return entity.getId();
}
@Transactional(rollbackFor = EpmetException.class)
@Override
public void delete(List<String> orgIds) {
orgIds.forEach(orgId->{
baseDao.deleteById(orgId);
//先删除
LambdaQueryWrapper<IcPublicServiceOrgServiceMatterEntity> deleteWrapper=new LambdaQueryWrapper<>();
deleteWrapper.eq(IcPublicServiceOrgServiceMatterEntity::getOrgId,orgId);
icPublicServiceOrgServiceMatterDao.delete(deleteWrapper);
});
}
@Override
public IcPublicServiceOrgDetailResDTO get(String id) {
IcPublicServiceOrgEntity entity = baseDao.selectById(id);
if (null == entity) {
return null;
}
IcPublicServiceOrgDetailResDTO result = ConvertUtils.sourceToTarget(entity, IcPublicServiceOrgDetailResDTO.class);
// 1:实有单位;2:社会服务组织3:志愿团队
if(NumConstant.ONE_STR.equals(result.getType())){
result.setTypeName("实有单位");
}else if(NumConstant.TWO_STR.equals(result.getType())){
result.setTypeName("社会服务组织");
}else if(NumConstant.THREE_STR.equals(result.getType())){
result.setTypeName("志愿团队");
}
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(result.getAgencyId());
if (null != agencyInfoCache) {
result.setAgencyName(agencyInfoCache.getOrganizationName());
}
result.setServiceMatterList(icPublicServiceOrgServiceMatterDao.selectServiceMatter(id));
List<String> nameList=result.getServiceMatterList().stream().map(m->m.getCategoryName()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(nameList)){
result.setServiceMatterName(StringUtils.joinWith(StrConstant.SEMICOLON,nameList.toArray()));
}
return result;
}
@Override
public PageData<IcPublicServiceOrgDetailResDTO> page(IcPublicServiceOrgPageFormDTO formDTO) {
if (StringUtils.isNotBlank(formDTO.getCurrentStaffId()) && StringUtils.isBlank(formDTO.getAgencyId())) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<IcPublicServiceOrgDetailResDTO> list = baseDao.pageList(formDTO);
PageInfo<IcPublicServiceOrgDetailResDTO> pageInfo = new PageInfo<>(list);
list.forEach(item -> {
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(item.getAgencyId());
item.setAgencyName(null != agencyInfoCache ? agencyInfoCache.getOrganizationName() : StrConstant.EPMETY_STR);
List<String> nameList=item.getServiceMatterList().stream().map(m->m.getCategoryName()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(nameList)){
item.setServiceMatterName(StringUtils.joinWith(StrConstant.SEMICOLON,nameList.toArray()));
}
});
return new PageData<>(list, pageInfo.getTotal());
}
}

22
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java

@ -205,4 +205,26 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl<IcServiceItemD
public String getCategoryName(String customerId, String categoryCode) {
return baseDao.selectName(customerId,categoryCode);
}
@Override
public List<ServiceItemResultDTO> queryDictOption(String type, String customerId) {
List<ServiceItemResultDTO> resultList = new ArrayList<>();
LambdaQueryWrapper<IcServiceItemDictEntity> query = new LambdaQueryWrapper<>();
query.eq(IcServiceItemDictEntity::getCustomerId, customerId)
.eq(StringUtils.isNotBlank(type) && "usable".equals(type), IcServiceItemDictEntity::getUsableFlag, true)
.orderByAsc(IcServiceItemDictEntity::getSort);
List<IcServiceItemDictEntity> list = baseDao.selectList(query);
for (IcServiceItemDictEntity entity : list) {
ServiceItemResultDTO dto = new ServiceItemResultDTO();
dto.setCategoryName(entity.getCategoryName());
dto.setCategoryId(entity.getId());
dto.setCategoryCode(entity.getCategoryCode());
dto.setUsableFlag(entity.getUsableFlag());
dto.setAwardPoint(entity.getAwardPoint());
resultList.add(dto);
}
return resultList;
}
}

38
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.29__public_service_org.sql

@ -0,0 +1,38 @@
CREATE TABLE `ic_public_service_org` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`AGENCY_ID` varchar(64) NOT NULL COMMENT '组织ID',
`PIDS` varchar(255) NOT NULL COMMENT 'AGENCY_ID的pids',
`NAME` varchar(128) NOT NULL COMMENT '名称',
`TYPE` varchar(64) NOT NULL COMMENT '1:实有单位;2:社会服务组织3:志愿团队',
`CONTACT` varchar(32) NOT NULL COMMENT '联系人',
`CONTACT_MOBILE` varchar(32) NOT NULL COMMENT '联系电话',
`ADDRESS` varchar(255) NOT NULL COMMENT '地址',
`LONGITUDE` varchar(32) DEFAULT NULL COMMENT '中心位置经度',
`LATITUDE` varchar(32) DEFAULT NULL COMMENT '中心位置纬度',
`REMARK` varchar(512) DEFAULT NULL COMMENT '备注',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公共服务组织管理(烟台需求)';
CREATE TABLE `ic_public_service_org_service_matter` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`ORG_ID` varchar(64) NOT NULL COMMENT 'ic_public_service_org.ID',
`CATEGORY_ID` varchar(64) NOT NULL COMMENT 'ic_service_item_dict.ID',
`CATEGORY_CODE` varchar(255) NOT NULL COMMENT '服务事项编码ic_service_item_dict.CATEGORY_CODE',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除',
`REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公共服务组织服务事项(烟台需求)';

81
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgDao.xml

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcPublicServiceOrgDao">
<resultMap type="com.epmet.entity.IcPublicServiceOrgEntity" id="icPublicServiceOrgMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="name" column="NAME"/>
<result property="type" column="TYPE"/>
<result property="contact" column="CONTACT"/>
<result property="contactMobile" column="CONTACT_MOBILE"/>
<result property="address" column="ADDRESS"/>
<result property="longitude" column="LONGITUDE"/>
<result property="latitude" column="LATITUDE"/>
<result property="remark" column="REMARK"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<resultMap id="IcPublicServiceOrgDetailResDTOMap" type="com.epmet.dto.result.IcPublicServiceOrgDetailResDTO">
<result property="id" column="ID"/>
<result property="name" column="NAME"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="type" column="TYPE"/>
<result property="typeName" column="typeName"/>
<result property="contact" column="CONTACT"/>
<result property="contactMobile" column="CONTACT_MOBILE"/>
<result property="remark" column="REMARK"/>
<collection property="serviceMatterList" ofType="com.epmet.dto.IcPublicServiceOrgServiceMatterDTO"
select="com.epmet.dao.IcPublicServiceOrgServiceMatterDao.selectServiceMatter" column="ID">
</collection>
</resultMap>
<select id="pageList" parameterType="com.epmet.dto.form.IcPublicServiceOrgPageFormDTO" resultMap="IcPublicServiceOrgDetailResDTOMap">
SELECT
distinct o.ID,
o.`NAME`,
o.AGENCY_ID,
o.TYPE,
( CASE WHEN o.type = '1' THEN '实有单位' WHEN o.type = '2' THEN '社会服务组织' WHEN o.type = '3' THEN '志愿团队' end) AS typeName,
o.CONTACT,
o.CONTACT_MOBILE,
o.REMARK
FROM
ic_public_service_org o
LEFT JOIN ic_public_service_org_service_matter m ON ( o.id = m.ORG_ID and m.del_flag='0')
LEFT JOIN ic_service_item_dict d ON ( m.CATEGORY_ID = d.ID and m.CUSTOMER_ID=d.CUSTOMER_ID)
WHERE
o.DEL_FLAG = '0'
and o.CUSTOMER_ID=#{customerId}
<if test='null != agencyId and "" != agencyId'>
AND ( o.AGENCY_ID = #{agencyId} OR o.PIDS LIKE concat( '%', #{agencyId}, '%' ))
</if>
<if test='null != name and "" != name'>
AND o.`NAME` LIKE concat( '%', #{name}, '%' )
</if>
<if test="null != categoryIds and categoryIds.size() > 0">
<foreach collection="categoryIds" item="categoryId" open="AND" separator="" close="">
m.CATEGORY_ID = #{categoryId}
</foreach>
</if>
<if test='null != type and "" != type'>
AND o.TYPE = #{type}
</if>
<if test='null != contact and "" != contact'>
AND o.CONTACT LIKE concat( '%', #{contact}, '%' )
</if>
<if test='null != contactMobile and "" != contactMobile'>
AND o.CONTACT_MOBILE like concat( '%', #{contactMobile}, '%' )
</if>
ORDER BY
o.CREATED_TIME DESC
</select>
</mapper>

30
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgServiceMatterDao.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcPublicServiceOrgServiceMatterDao">
<resultMap type="com.epmet.entity.IcPublicServiceOrgServiceMatterEntity" id="icPublicServiceOrgServiceMatterMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgId" column="ORG_ID"/>
<result property="categoryId" column="CATEGORY_ID"/>
<result property="categoryCode" column="CATEGORY_CODE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectServiceMatter" parameterType="java.lang.String" resultType="com.epmet.dto.IcPublicServiceOrgServiceMatterDTO">
SELECT
m.*,
i.CATEGORY_NAME
FROM
ic_public_service_org_service_matter m
LEFT JOIN ic_service_item_dict i ON ( m.CATEGORY_ID = i.ID )
WHERE m.del_flag='0'
and m.ORG_ID = #{orgId}
</select>
</mapper>
Loading…
Cancel
Save