diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 66abe790f3..61b5b6f250 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -88,11 +88,12 @@ public class CustomerStaffRedis { private static CustomerStaffInfoCache reloadStaffCache(String staffId, String key) { Result staffResult = customerStaffRedis.commonAggFeignClient.getStaffInfo(staffId); if (staffResult == null || !staffResult.success()) { + log.error("/data/aggregator/epmetuser/getStaffInfo/{staffId} 异常 staffId: ",staffId); throw new RenException("获取工作人员信息失败"); } CustomerStaffInfoCache resultData = staffResult.getData(); if (resultData == null) { - log.warn("getStaffInfo staff is null,staffId:{}", staffId); + log.error("getStaffInfo staff is null,staffId:{}", staffId); return null; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index f6de7bd634..d81bb9b1e7 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -9,7 +9,6 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.form.IdAndNameDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.OrgTypeEnum; -import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; @@ -56,9 +55,9 @@ import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.DetailByTypeFormDTO; +import com.epmet.dto.form.GetStaffExistRoleFormDTO; import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.result.DetailByTypeResultDTO; -import com.epmet.dto.form.GetStaffExistRoleFormDTO; import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.dto.result.StaffRoleResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -638,6 +637,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { .eq(CustomerStaffEntity::getDelFlag,NumConstant.ZERO_STR); CustomerStaffEntity staffEntity = customerStaffDao.selectOne(queryWrapper); if (null == staffEntity) { + log.error(String.format("customer_staff is null staffId:%s",staffId)); return null; } CustomerStaffResultDTO result = ConvertUtils.sourceToTarget(staffEntity, CustomerStaffResultDTO.class); diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java index 0115706902..1217ea6875 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java @@ -179,5 +179,9 @@ public class IcPartyActivityDTO implements Serializable { */ @JsonIgnore private Date updatedTime; - + /** + * actId不为空小程序 + * 为空管理平台 + */ + private String originName; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java index 1aed3be19f..b269fa0d5b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java @@ -86,6 +86,11 @@ public class IcPartyUnitDTO implements Serializable { */ private List serviceMatterNameList; + /** + * 服务事项名称多个按照中文顿号隔开 + */ + private String serviceMatterName; + /** * 联系人 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java index fb67921cd8..76f6d485db 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyActivityFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; @@ -15,7 +16,7 @@ import java.util.Date; */ @NoArgsConstructor @Data -public class PartyActivityFormDTO implements Serializable { +public class PartyActivityFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = -2510068555703677L; @NotBlank(message = "组织Id不能为空" ) private String agencyId; @@ -27,7 +28,7 @@ public class PartyActivityFormDTO implements Serializable { @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date endTime; private String serviceMatter; - private Integer pageNo; - private Integer pageSize; + // private Integer pageNo; + // private Integer pageSize; private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java index ec4a1751dd..f238e5dbe1 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/PartyUnitFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import lombok.NoArgsConstructor; @@ -12,7 +13,7 @@ import java.io.Serializable; */ @NoArgsConstructor @Data -public class PartyUnitFormDTO implements Serializable { +public class PartyUnitFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = 1256798619648265622L; private String customerId; @@ -22,8 +23,8 @@ public class PartyUnitFormDTO implements Serializable { private String type; private String contact; private String contactMobile; - private Integer pageNo; - private Integer pageSize; + // private Integer pageNo; + // private Integer pageSize; /** * 工作端当前登录人员 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java index 38b63b836d..2dce5600b5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyActivityController.java @@ -17,15 +17,21 @@ package com.epmet.controller; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; @@ -41,18 +47,21 @@ import com.epmet.service.IcPartyActivityService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.ArrayList; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.Date; import java.util.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; /** @@ -111,23 +120,36 @@ public class IcPartyActivityController { } @PostMapping("export") - public void export(@RequestBody PartyActivityFormDTO formDTO, HttpServletResponse response) throws Exception { - List list = icPartyActivityService.list(formDTO); - List excelList = new ArrayList<>(); - AtomicInteger i = new AtomicInteger(1); - if (CollectionUtils.isNotEmpty(list)) { - 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(DateUtils.format(item.getActivityTime(), DateUtils.DATE_TIME_PATTERN)); - return excel; - }).collect(Collectors.toList()); + public void export(@LoginUser TokenDto tokenDto, @RequestBody PartyActivityFormDTO formDTO, HttpServletResponse response) throws Exception { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); + String fileName = "联建活动".concat(today); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcPartyActivityExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = icPartyActivityService.search(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), IcPartyActivityExcel.class); + formDTO.setPageNo(++pageNo); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + } catch (Exception e) { + log.error("export exception", e); + } finally { + // 千万别忘记finish 会帮忙关闭流 + if (excelWriter != null) { + excelWriter.finish(); + } } - ExcelUtils.exportExcelToTarget(response, null, excelList, IcPartyActivityExcel.class); + } /** @@ -214,4 +236,30 @@ public class IcPartyActivityController { PageData page = icPartyActivityService.getActivityList(tokenDto, formDTO); return new Result>().ok(page); } + + /** + * 下载联建活动导入模板 + * @param response + * @throws IOException + */ + @RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST}) + public void downloadTemplate(HttpServletResponse response) throws IOException { + response.setCharacterEncoding("UTF-8"); + response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); + //response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel"); + response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("联建活动导入模板", "UTF-8") + ".xlsx"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("templates/icpartyactivity_import_tem.xlsx"); + try { + ServletOutputStream os = response.getOutputStream(); + IOUtils.copy(is, os); + } finally { + if (is != null) { + is.close(); + } + } + } + + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java index 4545cb226b..e1578a2d78 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java @@ -1,16 +1,24 @@ package com.epmet.controller; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; 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.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; @@ -27,19 +35,23 @@ import com.epmet.service.IcPartyUnitService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.Date; import java.util.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -59,11 +71,6 @@ public class IcPartyUnitController { @Resource private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; - /** - * 联建单位上传临时目录 - */ - private Path IC_PARTY_UNIT_UPLOAD_DIR; - /** * 联建单位-列表查询 @@ -117,25 +124,38 @@ public class IcPartyUnitController { @PostMapping("export") public void export(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO, HttpServletResponse response) throws Exception { formDTO.setCustomerId(tokenDto.getCustomerId()); - List list = icPartyUnitService.list(formDTO); - List excelList = new ArrayList<>(); - AtomicInteger i = new AtomicInteger(1); - if (CollectionUtils.isNotEmpty(list)) { - 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()); + formDTO.setIsPage(false); + formDTO.setCurrentStaffId(tokenDto.getUserId()); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); + String fileName = "联建单位".concat(today); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcPartyUnitExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = icPartyUnitService.search(formDTO); + data.getList().stream().map(item -> { + item.setServiceMatterName(StringUtils.join(item.getServiceMatterList(), StrConstant.COMMA_ZH)); + return item; + }).collect(Collectors.toList()); + list = ConvertUtils.sourceToTarget(data.getList(), IcPartyUnitExcel.class); + formDTO.setPageNo(++pageNo); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + } catch (Exception e) { + log.error("export exception", e); + } finally { + // 千万别忘记finish 会帮忙关闭流 + if (excelWriter != null) { + excelWriter.finish(); + } } - ExcelUtils.exportExcelToTarget(response, null, excelList, IcPartyUnitExcel.class); } /** @@ -330,4 +350,27 @@ public class IcPartyUnitController { return new Result(); } + /** + * 下载联建单位导入模板 + * @param response + * @throws IOException + */ + @RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST}) + public void downloadTemplate(HttpServletResponse response) throws IOException { + response.setCharacterEncoding("UTF-8"); + response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); + //response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel"); + response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("联建单位导入模板", "UTF-8") + ".xlsx"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("templates/icpartyunit_impoort_tem.xlsx"); + try { + ServletOutputStream os = response.getOutputStream(); + IOUtils.copy(is, os); + } finally { + if (is != null) { + is.close(); + } + } + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyActivityExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyActivityExcel.java index 9ea9544285..4b52917350 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyActivityExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyActivityExcel.java @@ -17,9 +17,13 @@ package com.epmet.excel; -import cn.afterturn.easypoi.excel.annotation.Excel; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import java.util.Date; + /** * 联建活动 * @@ -28,23 +32,31 @@ import lombok.Data; */ @Data public class IcPartyActivityExcel { - - @Excel(name = "序号") - private Integer index; - - @Excel(name = "单位名称") + @ColumnWidth(20) + @ExcelProperty(value = "单位名称") private String unitName; - @Excel(name = "活动标题") + @ColumnWidth(25) + @ExcelProperty(value = "活动标题") private String title; - @Excel(name = "活动地址") + @ColumnWidth(35) + @ExcelProperty(value = "活动地址") private String address; - @Excel(name = "服务人数") + @ColumnWidth(15) + @ExcelProperty(value = "服务人数") private Integer peopleCount; - @Excel(name = "活动时间") - private String activityTime; - + @ColumnWidth(20) + @ExcelProperty(value = "活动时间") + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date activityTime; + /** + * actId不为空小程序 + * 为空管理平台 + */ + @ColumnWidth(20) + @ExcelProperty(value = "来源") + private String originName; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyUnitExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyUnitExcel.java index 652542ef62..36e9484acc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyUnitExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/IcPartyUnitExcel.java @@ -17,7 +17,8 @@ package com.epmet.excel; -import cn.afterturn.easypoi.excel.annotation.Excel; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; import lombok.Data; /** @@ -29,30 +30,42 @@ import lombok.Data; @Data public class IcPartyUnitExcel { - @Excel(name = "序号") - private Integer index; - - @Excel(name = "单位名称") + @ColumnWidth(30) + @ExcelProperty(value = "单位名称") private String unitName; - @Excel(name = "分类") - private String type; + @ColumnWidth(25) + @ExcelProperty(value = "所属组织") + private String agencyName; + + @ColumnWidth(25) + @ExcelProperty(value = "分类") + private String typeName; - @Excel(name = "服务事项") - private String serviceMatter; + /** + * 服务事项名称多个按照中文顿号隔开 + */ + @ColumnWidth(100) + @ExcelProperty(value = "服务事项") + private String serviceMatterName; - @Excel(name = "联系人") + @ColumnWidth(16) + @ExcelProperty(value = "联系人") private String contact; - @Excel(name = "联系电话") + @ColumnWidth(16) + @ExcelProperty(value = "联系电话") private String contactMobile; - @Excel(name = "在职党员") + @ColumnWidth(18) + @ExcelProperty(value = "在职党员数") private Integer memberCount; - @Excel(name = "群众满意度") + @ColumnWidth(18) + @ExcelProperty(value = "群众满意度") private String satisfaction; - @Excel(name = "备注") + @ColumnWidth(100) + @ExcelProperty(value = "备注") private String remark; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 4d89c1bef8..1e72ac9ae5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -151,6 +151,11 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT); dtoList.forEach(item -> { + item.setTypeName(unitTypeMap.getData().get(item.getType())); + //这是错误的,应该是赋值type,遗留bug, 先不改了.... item.setType(unitTypeMap.getData().get(item.getType())); if (StringUtils.isNotBlank(item.getServiceMatter())) { List matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA)); @@ -183,6 +185,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl pointMap = icUserDemandRecService.getServicePoint(formDTO.getCustomerId(), UserDemandConstant.PARTY_UNIT); dtoList.forEach(item -> { + item.setTypeName(unitTypeMap.getData().get(item.getType())); + //这是错误的,应该是赋值type,遗留bug, 先不改了.... item.setType(unitTypeMap.getData().get(item.getType())); if (StringUtils.isNotBlank(item.getServiceMatter())) { List matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA)); @@ -217,6 +221,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl> typeDictMapRes=epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); Map typeDictMap = typeDictMapRes.success() && MapUtils.isNotEmpty(typeDictMapRes.getData()) ? typeDictMapRes.getData() : new HashMap<>(); + dto.setTypeName(MapUtils.isNotEmpty(typeDictMap) && typeDictMap.containsKey(dto.getType()) ? typeDictMap.get(dto.getType()) : StrConstant.EPMETY_STR); + //这是错误的,应该是赋值type,遗留bug, 先不改了.... dto.setType(MapUtils.isNotEmpty(typeDictMap) && typeDictMap.containsKey(dto.getType()) ? typeDictMap.get(dto.getType()) : StrConstant.EPMETY_STR); // 服务事项 if(CollectionUtils.isNotEmpty(dto.getServiceMatterList())){ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/icpartyactivity_import_tem.xlsx b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/icpartyactivity_import_tem.xlsx new file mode 100644 index 0000000000..1d04c7c15d Binary files /dev/null and b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/icpartyactivity_import_tem.xlsx differ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/icpartyunit_impoort_tem.xlsx b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/icpartyunit_impoort_tem.xlsx new file mode 100644 index 0000000000..713aed6eb4 Binary files /dev/null and b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/icpartyunit_impoort_tem.xlsx differ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeWelfareDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeWelfareDTO.java index 02ce0b34c8..7ee639d7dc 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeWelfareDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ChangeWelfareDTO.java @@ -1,6 +1,8 @@ package com.epmet.dto; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import org.hibernate.validator.constraints.Length; import java.io.Serializable; import java.util.Date; @@ -16,7 +18,7 @@ import java.util.Date; public class ChangeWelfareDTO implements Serializable { private static final long serialVersionUID = 1L; - + public interface AddUserShowGroup extends CustomerClientShowGroup {} /** * 主键 */ @@ -116,4 +118,14 @@ public class ChangeWelfareDTO implements Serializable { * 是否享受福利,1是 0否 空是 */ private String isWelfare; + + /** + * 福利发放标识:1:已发放;0:未发放 + */ + private Integer grantFlag; + /** + * 福利类别 + */ + @Length(max = 100,message = "福利类别最多输入100字",groups = AddUserShowGroup.class) + private String categoryName; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java index b87f03d8d7..5fe8f73f31 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; @@ -110,6 +109,9 @@ public class AddIcNatFormDTO implements Serializable { private String customerId; private String staffId; private String client; - + /** + * 政府端:gov、居民端:resi、运营端:oper + */ + private String app; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java index 65f289cd46..4ae7ae8b61 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java @@ -183,7 +183,7 @@ public class IcTripReportFormDTO implements Serializable { /** * 交通方式,来源字典表(traffic_type) */ - @NotBlank(message = "返回方式不能为空", groups = {PcAddRequired.class, ResiUserRequired.class}) + // @NotBlank(message = "返回方式不能为空", groups = {PcAddRequired.class, ResiUserRequired.class}) private String trafficType; /** * 其他返回方式,交通方式为其他时此列需要有值 @@ -192,7 +192,7 @@ public class IcTripReportFormDTO implements Serializable { /** * 来源地详细信息 source_address字段的说明 */ - @NotBlank(message = "来自地区不能为空", groups = {PcAddRequired.class, ResiUserRequired.class}) + // @NotBlank(message = "来自地区不能为空", groups = {PcAddRequired.class, ResiUserRequired.class}) private String sourceDetailAddress; /** * 疫苗接种针次 (0针 1针 2针 3针)【小寨子】 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java index 512a43f7e9..b85f409d2b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java @@ -92,7 +92,8 @@ public class IcNatController implements ResultDataResolver { ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setStaffId(tokenDto.getUserId()); - formDTO.setClient(tokenDto.getClient()); + // formDTO.setClient(tokenDto.getClient()); + formDTO.setApp(tokenDto.getApp()); icNucleinService.add(formDTO); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ChangeWelfareEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ChangeWelfareEntity.java index 2ddb43582a..7f0ec9189d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ChangeWelfareEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ChangeWelfareEntity.java @@ -72,6 +72,14 @@ public class ChangeWelfareEntity extends BaseEpmetEntity { * 移除原因 */ private String removeReason; + /** + * 福利发放标识:1:已发放;0:未发放 + */ + private Integer grantFlag; + /** + * 福利类别 + */ + private String categoryName; /** * 客户ID diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java index acb7705b2f..5a58288ba0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java @@ -21,13 +21,13 @@ public class ChangeWelfareExcel { // @Excel(name = "epmet网格ID") // private String gridId; - @Excel(name = "姓名") + @Excel(name = "姓名",width = 20) private String name; - @Excel(name = "证件号") + @Excel(name = "证件号",width = 20) private String idCard; - @Excel(name = "手机号") + @Excel(name = "手机号",width = 20) private String mobile; @Excel(name = "性别",replace = { "男_1", "女_0", "女_2", " _null"} ) @@ -36,8 +36,18 @@ public class ChangeWelfareExcel { // @Excel(name = "类型") // private String type; // - @Excel(name = "加入时间") + @Excel(name = "加入时间",width = 25) private String joinDate; + /** + * 福利发放标识:1:已发放;0:未发放 + */ + @Excel(name = "福利发放",replace = { "已发放_1", "未发放_0", "_null"},width = 20) + private Integer grantFlag; + /** + * 福利类别 + */ + @Excel(name = "福利类别",width = 120) + private String categoryName; // // @Excel(name = "加入原因") // private String joinReason; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareImportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareImportExcel.java index 992be96b4a..07869bfb2f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareImportExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareImportExcel.java @@ -33,6 +33,16 @@ public class ChangeWelfareImportExcel { // @Excel(name = "客户ID") // private String customerId; + /** + * 福利发放标识:1:已发放;0:未发放 + */ + @Excel(name = "福利发放",replace = { "已发放_1", "未发放_0", "_null"}) + private Integer grantFlag; + /** + * 福利类别 + */ + @Excel(name = "福利类别") + private String categoryName; @ExcelIgnore private Boolean addStatus = false; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeWelfareService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeWelfareService.java index 184cfd9c9a..099c7ae432 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeWelfareService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeWelfareService.java @@ -21,7 +21,7 @@ import java.util.Map; public interface ChangeWelfareService extends BaseService { /** - * 默认分页 + * 福利人员管理-分页查询 * * @param params * @return PageData diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java index f5808bdf3b..9fd94f7a7f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java @@ -16,10 +16,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.ExcelPoiUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; @@ -38,7 +35,6 @@ import com.epmet.entity.ChangeWelfareEntity; import com.epmet.excel.ChangeWelfareImportExcel; import com.epmet.excel.error.ChangeWelfareErrorExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; -import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.redis.ChangeWelfareRedis; import com.epmet.service.ChangeWelfareService; @@ -88,12 +84,15 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl page(Map params) { params.put("customerId", loginUserUtil.getLoginUserCustomerId()); @@ -137,6 +136,12 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl imp if (null != icNatDTO && icNatDTO.getNatResult().equals(formDTO.getNatResult())) { throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg()); } else if (null != icNatDTO && !icNatDTO.getNatResult().equals(formDTO.getNatResult())) { - if ("wxmp".equals(formDTO.getClient())) { + if (AppClientConstant.APP_RESI.equals(formDTO.getApp())) { throw new RenException(EpmetErrorCode.RESI_IC_NAT.getCode(), EpmetErrorCode.RESI_IC_NAT.getMsg()); } throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg()); @@ -129,10 +129,6 @@ public class IcNatServiceImpl extends BaseServiceImpl imp if (null == agencyInfo) { throw new RenException(String.format("获取组织缓存信息失败%s", formDTO.getAgencyId())); } - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); - if (null == staffInfo){ - throw new EpmetException(String.format("获取工作人员信息失败%s", formDTO.getStaffId())); - } ResiAndLocalResiResultDTO resiCount = icResiUserDao.getResiCount(formDTO.getAgencyId(), formDTO.getIdCard(), formDTO.getCustomerId()); //2.新增核酸基础信息数据 IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class); @@ -146,8 +142,19 @@ public class IcNatServiceImpl extends BaseServiceImpl imp IcNatRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcNatRelationEntity.class); relationEntity.setIcNatId(entity.getId()); relationEntity.setIsLocalResiUser(resiCount.getIsLocal() == NumConstant.ZERO ? NumConstant.ZERO_STR : NumConstant.ONE_STR); - relationEntity.setAgencyId(staffInfo.getAgencyId()); - relationEntity.setPids(StringUtils.isNotBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId() : staffInfo.getAgencyId()); + if(AppClientConstant.APP_GOV.equals(formDTO.getApp())){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo){ + log.error(String.format("获取工作人员信息失败%s", formDTO.getStaffId())); + throw new EpmetException(String.format("获取工作人员信息失败%s", formDTO.getStaffId())); + } + relationEntity.setAgencyId(staffInfo.getAgencyId()); + relationEntity.setPids(StringUtils.isNotBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId() : staffInfo.getAgencyId()); + }else{ + relationEntity.setAgencyId(formDTO.getAgencyId()); + AgencyInfoCache agencyInfoCache=CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); + relationEntity.setPids(StringUtils.isNotBlank(agencyInfoCache.getPids()) ? agencyInfoCache.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId()); + } icNatRelationDao.insert(relationEntity); //3.新增通知表信息 diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.94__pli_change_welfare.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.94__pli_change_welfare.sql new file mode 100644 index 0000000000..65f58d0090 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.94__pli_change_welfare.sql @@ -0,0 +1,4 @@ +ALTER TABLE pli_change_welfare ADD COLUMN GRANT_FLAG TINYINT ( 1 ) DEFAULT 0 + COMMENT '福利发放标识:1:已发放;0:未发放' AFTER REMOVE_REASON; +ALTER TABLE pli_change_welfare ADD COLUMN CATEGORY_NAME VARCHAR(255) DEFAULT '' + COMMENT '福利类别' AFTER GRANT_FLAG; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/pli_change_welfare.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/pli_change_welfare.xlsx index a9aa1b3e6a..d1102da4b1 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/pli_change_welfare.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/pli_change_welfare.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeWelfareDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeWelfareDao.xml index c2a9595488..6953f24a98 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeWelfareDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/ChangeWelfareDao.xml @@ -40,7 +40,9 @@ w.REMOVE_DATE, w.REMOVE_REASON, w.CREATED_TIME, - w.UPDATED_TIME + w.UPDATED_TIME, + w.GRANT_FLAG, + w.CATEGORY_NAME FROM pli_change_welfare w LEFT JOIN ic_resi_user u ON u.ID_CARD = w.ID_CARD and u.DEL_FLAG = '0' @@ -68,6 +70,12 @@ AND w.JOIN_DATE <= #{endTime} + + AND w.CATEGORY_NAME like concat('%',#{categoryName},'%') + + + AND w.GRANT_FLAG = #{grantFlag} + order by w.CREATED_TIME desc @@ -76,12 +84,14 @@ where ID_CARD=#{idCard} and del_flag='0' - + update pli_change_welfare set REMOVE_DATE=#{removeDate}, REMOVE_REASON=#{removeReason}, - del_flag='1' + del_flag='1', + UPDATED_BY = #{updatedBy}, + UPDATED_TIME = #{removeDate} where del_flag='0' AND ID = #{id}