Browse Source

联建单位和活动相关接口

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
75d366a479
  1. 1
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java
  2. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java
  3. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
  4. 58
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyActivityExcel.java
  5. 53
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyUnitExcel.java
  6. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java
  7. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  8. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  9. 45
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

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

@ -15,6 +15,7 @@ import java.io.Serializable;
public class PartyUnitFormDTO implements Serializable {
private static final long serialVersionUID = 1256798619648265622L;
private String customerId;
private String agencyId;
private String unitName;
private String serviceMatter;

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java

@ -32,7 +32,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -75,9 +76,19 @@ public class IcPartyActivityController {
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<IcPartyActivityDTO> list = icPartyActivityService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, IcPartyActivityExcel.class);
public void export(@RequestBody PartyActivityFormDTO formDTO, HttpServletResponse response) throws Exception {
List<IcPartyActivityDTO> list = icPartyActivityService.list(formDTO);
AtomicInteger i = new AtomicInteger(0);
List<IcPartyActivityExcel> excelList = list.stream().map(item -> {
IcPartyActivityExcel excel = new IcPartyActivityExcel();
excel.setIndex(i.getAndIncrement());
excel.setUnitName(item.getUnitName());
excel.setTitle(item.getTitle());
excel.setAddress(item.getAddress());
excel.setPeopleCount(item.getPeopleCount());
excel.setActivityTime(item.getActivityTime());
return excel;
}).collect(Collectors.toList());
ExcelUtils.exportExcelToTarget(response, null, excelList, IcPartyActivityExcel.class);
}
}

27
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java

@ -37,7 +37,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -54,7 +55,8 @@ public class IcPartyUnitController {
private IcPartyUnitService icPartyUnitService;
@PostMapping("list")
public Result<PageData<IcPartyUnitDTO>> search(@RequestBody PartyUnitFormDTO formDTO){
public Result<PageData<IcPartyUnitDTO>> search(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
PageData<IcPartyUnitDTO> page = icPartyUnitService.search(formDTO);
return new Result<PageData<IcPartyUnitDTO>>().ok(page);
}
@ -83,9 +85,24 @@ public class IcPartyUnitController {
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<IcPartyUnitDTO> list = icPartyUnitService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, IcPartyUnitExcel.class);
public void export(@RequestBody PartyUnitFormDTO formDTO, HttpServletResponse response) throws Exception {
List<IcPartyUnitDTO> list = icPartyUnitService.list(formDTO);
AtomicInteger i = new AtomicInteger(0);
List<IcPartyUnitExcel> excelList = list.stream().map(item -> {
IcPartyUnitExcel excel = new IcPartyUnitExcel();
excel.setIndex(i.getAndIncrement());
excel.setUnitName(item.getUnitName());
excel.setContact(item.getContact());
excel.setContactMobile(item.getContactMobile());
excel.setType(item.getType());
excel.setMemberCount(item.getMemberCount());
excel.setRemark(item.getRemark());
excel.setSatisfaction(item.getSatisfaction());
excel.setServiceMatter(String.join(String.valueOf((char)10), item.getServiceMatterList()));
return excel;
}).collect(Collectors.toList());
ExcelUtils.exportExcelToTarget(response, null, excelList, IcPartyUnitExcel.class);
}
/**

58
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyActivityExcel.java

@ -31,32 +31,17 @@ import java.util.Date;
@Data
public class IcPartyActivityExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "序号")
private Integer index;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "组织ID")
private String agencyId;
@Excel(name = "组织的所有上级")
private String pids;
@Excel(name = "单位ID")
private String unitId;
@Excel(name = "服务事项")
private String serviceMatter;
@Excel(name = "单位名称")
private String unitName;
@Excel(name = "活动标题")
private String title;
@Excel(name = "活动目标")
private String target;
@Excel(name = "活动内容")
private String content;
@Excel(name = "活动地址")
private String address;
@Excel(name = "服务人数")
private Integer peopleCount;
@ -64,35 +49,4 @@ public class IcPartyActivityExcel {
@Excel(name = "活动时间")
private Date activityTime;
@Excel(name = "活动地址")
private String address;
@Excel(name = "活动地址经度")
private String longitude;
@Excel(name = "活动地址纬度")
private String latitude;
@Excel(name = "活动结果")
private String result;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

53
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyUnitExcel.java

@ -20,8 +20,6 @@ package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 联建单位
*
@ -31,28 +29,16 @@ import java.util.Date;
@Data
public class IcPartyUnitExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户id")
private String customerId;
@Excel(name = "组织ID")
private String agencyId;
@Excel(name = "网格ID")
private String gridId;
@Excel(name = "")
private String pids;
@Excel(name = "序号")
private Integer index;
@Excel(name = "单位名称")
private String unitName;
@Excel(name = "分类 楼宇党建 两新组织 区域单位党建 机关直属部门 其他")
@Excel(name = "分类")
private String type;
@Excel(name = "服务事项 多选逗号隔开")
@Excel(name = "服务事项")
private String serviceMatter;
@Excel(name = "联系人")
@ -61,41 +47,12 @@ public class IcPartyUnitExcel {
@Excel(name = "联系电话")
private String contactMobile;
@Excel(name = "在职党员")
@Excel(name = "在职党员")
private Integer memberCount;
@Excel(name = "地址")
private String address;
@Excel(name = "中心位置经度")
private String longitude;
@Excel(name = "中心位置纬度")
private String latitude;
@Excel(name = "群众满意度")
private String satisfaction;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java

@ -24,7 +24,6 @@ import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.entity.IcPartyActivityEntity;
import java.util.List;
import java.util.Map;
/**
* 联建活动
@ -47,12 +46,12 @@ public interface IcPartyActivityService extends BaseService<IcPartyActivityEntit
/**
* 默认查询
*
* @param params
* @param formDTO
* @return java.util.List<IcPartyActivityDTO>
* @author generator
* @date 2021-11-19
*/
List<IcPartyActivityDTO> list(Map<String, Object> params);
List<IcPartyActivityDTO> list(PartyActivityFormDTO formDTO);
/**
* 单条查询

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java

@ -26,7 +26,6 @@ import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcPartyUnitEntity;
import java.util.List;
import java.util.Map;
/**
* 联建单位
@ -49,12 +48,12 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
/**
* 默认查询
*
* @param params
* @param formDTO
* @return java.util.List<IcPartyUnitDTO>
* @author generator
* @date 2021-11-19
*/
List<IcPartyUnitDTO> list(Map<String, Object> params);
List<IcPartyUnitDTO> list(PartyUnitFormDTO formDTO);
/**
* 单条查询

23
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -83,10 +83,27 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
}
@Override
public List<IcPartyActivityDTO> list(Map<String, Object> params) {
List<IcPartyActivityEntity> entityList = baseDao.selectList(getWrapper(params));
public List<IcPartyActivityDTO> list(PartyActivityFormDTO formDTO) {
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcPartyActivityEntity::getUnitId, formDTO.getUnitId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter());
wrapper.like(StringUtils.isNotBlank(formDTO.getTitle()), IcPartyActivityEntity::getTitle, formDTO.getTitle());
wrapper.between(IcPartyActivityEntity::getActivityTime, formDTO.getStartTime(), formDTO.getEndTime());
wrapper.orderByDesc(IcPartyActivityEntity::getUpdatedTime);
List<IcPartyActivityEntity> list = baseDao.selectList(wrapper);
List<IcPartyActivityDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class);
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(dtoList)) {
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(dto -> {
dto.setUnitName(option.get(dto.getUnitId()));
});
}
return ConvertUtils.sourceToTarget(entityList, IcPartyActivityDTO.class);
return dtoList;
}
private QueryWrapper<IcPartyActivityEntity> getWrapper(Map<String, Object> params){

45
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

@ -33,16 +33,17 @@ import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.form.demand.SubCodeFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcPartyUnitEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.IcPartyUnitService;
import com.epmet.service.IcResiDemandDictService;
import com.epmet.service.IcUserDemandRecService;
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;
@ -61,8 +62,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
@Resource
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient;
@Autowired
@Resource
private IcUserDemandRecService icUserDemandRecService;
@Resource
private IcResiDemandDictService icResiDemandDictService;
@Override
@ -79,11 +82,17 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(formDTO.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(item -> {
item.setType(unitTypeMap.getData().get(item.getType()));
//TODO 服务事项
if (StringUtils.isNotBlank(item.getServiceMatter())) {
List<String> matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA));
item.setServiceMatterList(matters.stream().map(categoryMap::get).collect(Collectors.toList()));
} else {
item.setServiceMatterList(new ArrayList<>());
}
});
PageInfo<IcPartyUnitDTO> pageInfo = new PageInfo<>(dtoList);
@ -91,10 +100,32 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
}
@Override
public List<IcPartyUnitDTO> list(Map<String, Object> params) {
List<IcPartyUnitEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, IcPartyUnitDTO.class);
public List<IcPartyUnitDTO> list(PartyUnitFormDTO formDTO) {
LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyUnitEntity::getAgencyId, formDTO.getAgencyId());
wrapper.like(StringUtils.isNotBlank(formDTO.getUnitName()), IcPartyUnitEntity::getUnitName, formDTO.getUnitName());
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyUnitEntity::getServiceMatter, formDTO.getServiceMatter());
wrapper.eq(StringUtils.isNotBlank(formDTO.getType()), IcPartyUnitEntity::getType, formDTO.getType());
wrapper.like(StringUtils.isNotBlank(formDTO.getContact()), IcPartyUnitEntity::getContact, formDTO.getContact());
wrapper.like(StringUtils.isNotBlank(formDTO.getContactMobile()), IcPartyUnitEntity::getContactMobile, formDTO.getContactMobile());
wrapper.orderByDesc(IcPartyUnitEntity::getUpdatedTime);
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper);
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class);
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO();
codeFormDTO.setCustomerId(formDTO.getCustomerId());
codeFormDTO.setParentCategoryCode("1010");
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(item -> {
item.setType(unitTypeMap.getData().get(item.getType()));
if (StringUtils.isNotBlank(item.getServiceMatter())) {
List<String> matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA));
item.setServiceMatterList(matters.stream().map(categoryMap::get).collect(Collectors.toList()));
} else {
item.setServiceMatterList(new ArrayList<>());
}
});
return dtoList;
}
private QueryWrapper<IcPartyUnitEntity> getWrapper(Map<String, Object> params){

Loading…
Cancel
Save