From 91f3e65d30836be1726b15bd688dc80550e9112d Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 16:46:44 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97-=E6=9C=8D=E5=8A=A1=E3=80=91=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E6=8F=90=E4=BA=A4-=E6=8F=90=E4=BA=A4=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E4=BB=A3=E7=A0=81=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/WorkdiaryServiceRecordDTO.java | 119 ++++++++++++++++++ .../WorkdiaryServiceRecordController.java | 82 ++++++++++++ .../epmet/dao/WorkdiaryServiceRecordDao.java | 16 +++ .../entity/WorkdiaryServiceRecordEntity.java | 89 +++++++++++++ .../excel/WorkdiaryServiceRecordExcel.java | 78 ++++++++++++ .../redis/WorkdiaryServiceRecordRedis.java | 30 +++++ .../WorkdiaryServiceRecordService.java | 78 ++++++++++++ .../WorkdiaryServiceRecordServiceImpl.java | 87 +++++++++++++ .../db/migration/workdiary_service.sql | 26 ++++ .../mapper/WorkdiaryServiceRecordDao.xml | 30 +++++ 10 files changed, 635 insertions(+) create mode 100755 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceRecordDao.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceRecordRedis.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java new file mode 100755 index 0000000000..4cf60df0d2 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -0,0 +1,119 @@ +package com.epmet.dto.result; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +public class WorkdiaryServiceRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 服务类型 + */ + private String serviceType; + + /** + * 单位ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 组织ID path + */ + private String orgIdPath; + + /** + * 申请人ID + */ + private String applicantId; + + /** + * 申请人姓名 + */ + private String applicantName; + + /** + * 申请人住址 + */ + private String applicantAddress; + + /** + * 申请人联系电话 + */ + private String applicantMobile; + + /** + * 服务内容 + */ + private String serviceContent; + + /** + * 服务时间 + */ + private Date serviceTime; + + /** + * 负责人姓名 + */ + private String principalName; + + /** + * 备注 + */ + private String remark; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java new file mode 100755 index 0000000000..2ca6537d09 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java @@ -0,0 +1,82 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.epmet.excel.WorkdiaryServiceRecordExcel; +import com.epmet.service.WorkdiaryServiceRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@RestController +@RequestMapping("workdiaryServiceRecord") +public class WorkdiaryServiceRecordController { + + @Autowired + private WorkdiaryServiceRecordService workdiaryServiceRecordService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = workdiaryServiceRecordService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + WorkdiaryServiceRecordDTO data = workdiaryServiceRecordService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody WorkdiaryServiceRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + workdiaryServiceRecordService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody WorkdiaryServiceRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + workdiaryServiceRecordService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + workdiaryServiceRecordService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = workdiaryServiceRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceRecordExcel.class); + } + + + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceRecordDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceRecordDao.java new file mode 100755 index 0000000000..5f33762fb8 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceRecordDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WorkdiaryServiceRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Mapper +public interface WorkdiaryServiceRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java new file mode 100755 index 0000000000..50b5bb7bab --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java @@ -0,0 +1,89 @@ +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 2022-08-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("workdiary_service_record") +public class WorkdiaryServiceRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 服务类型 + */ + private String serviceType; + + /** + * 单位ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 组织ID path + */ + private String orgIdPath; + + /** + * 申请人ID + */ + private String applicantId; + + /** + * 申请人姓名 + */ + private String applicantName; + + /** + * 申请人住址 + */ + private String applicantAddress; + + /** + * 申请人联系电话 + */ + private String applicantMobile; + + /** + * 服务内容 + */ + private String serviceContent; + + /** + * 服务时间 + */ + private Date serviceTime; + + /** + * 负责人姓名 + */ + private String principalName; + + /** + * 备注 + */ + private String remark; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java new file mode 100755 index 0000000000..e0eace7a2a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -0,0 +1,78 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +public class WorkdiaryServiceRecordExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "服务类型") + private String serviceType; + + @Excel(name = "单位ID") + private String agencyId; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "组织ID path") + private String orgIdPath; + + @Excel(name = "申请人ID") + private String applicantId; + + @Excel(name = "申请人姓名") + private String applicantName; + + @Excel(name = "申请人住址") + private String applicantAddress; + + @Excel(name = "申请人联系电话") + private String applicantMobile; + + @Excel(name = "服务内容") + private String serviceContent; + + @Excel(name = "服务时间") + private Date serviceTime; + + @Excel(name = "负责人姓名") + private String principalName; + + @Excel(name = "备注") + private String remark; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer 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; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceRecordRedis.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceRecordRedis.java new file mode 100755 index 0000000000..bb15d79a6a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceRecordRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Component +public class WorkdiaryServiceRecordRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java new file mode 100755 index 0000000000..ee543708a3 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.epmet.entity.WorkdiaryServiceRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +public interface WorkdiaryServiceRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-23 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-23 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WorkdiaryServiceRecordDTO + * @author generator + * @date 2022-08-23 + */ + WorkdiaryServiceRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-23 + */ + void save(WorkdiaryServiceRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-23 + */ + void update(WorkdiaryServiceRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-23 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java new file mode 100755 index 0000000000..3211ae09b1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.service.impl; + +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WorkdiaryServiceRecordDao; +import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.epmet.entity.WorkdiaryServiceRecordEntity; +import com.epmet.redis.WorkdiaryServiceRecordRedis; +import com.epmet.service.WorkdiaryServiceRecordService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作日志(服务)-记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Service +public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl implements WorkdiaryServiceRecordService { + + @Autowired + private WorkdiaryServiceRecordRedis workdiaryServiceRecordRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WorkdiaryServiceRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WorkdiaryServiceRecordDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WorkdiaryServiceRecordDTO get(String id) { + WorkdiaryServiceRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WorkdiaryServiceRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WorkdiaryServiceRecordDTO dto) { + WorkdiaryServiceRecordEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WorkdiaryServiceRecordDTO dto) { + WorkdiaryServiceRecordEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql new file mode 100644 index 0000000000..63869fa0c2 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql @@ -0,0 +1,26 @@ +# 服务记录表 +CREATE TABLE `workdiary_service_record` +( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `SERVICE_TYPE` varchar(32) NOT NULL COMMENT '服务类型', + `AGENCY_ID` varchar(32) NOT NULL COMMENT '单位ID', + `GRID_ID` varchar(32) NOT NULL COMMENT '网格ID', + `ORG_ID_PATH` varchar(255) NOT NULL COMMENT '组织ID path', + `APPLICANT_ID` varchar(32) NOT NULL COMMENT '申请人ID', + `APPLICANT_NAME` varchar(32) NOT NULL COMMENT '申请人姓名', + `APPLICANT_ADDRESS` varchar(32) NOT NULL COMMENT '申请人住址', + `APPLICANT_MOBILE` varchar(20) NOT NULL COMMENT '申请人联系电话', + `SERVICE_CONTENT` varchar(255) NOT NULL COMMENT '服务内容', + `SERVICE_TIME` datetime NOT NULL COMMENT '服务时间', + `PRINCIPAL_NAME` varchar(10) NOT NULL COMMENT '负责人姓名', + `REMARK` varchar(255) NOT NULL COMMENT '备注', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-记录' diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml new file mode 100755 index 0000000000..5241dbafe1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From ae2a099d389f9d787ff4f0d77c7bf8bc74dda0b7 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 17:37:46 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E6=9C=8D=E5=8A=A1=E7=B1=BB=E5=9E=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/WorkdiaryServiceTypeDTO.java | 74 ++++++++++++++++ .../WorkdiaryServiceTypeController.java | 83 ++++++++++++++++++ .../epmet/dao/WorkdiaryServiceTypeDao.java | 16 ++++ .../entity/WorkdiaryServiceTypeEntity.java | 44 ++++++++++ .../entity/WorkdiaryServiceTypeExcel.java | 51 +++++++++++ .../redis/WorkdiaryServiceTypeRedis.java | 30 +++++++ .../service/WorkdiaryServiceTypeService.java | 78 +++++++++++++++++ .../impl/WorkdiaryServiceTypeServiceImpl.java | 87 +++++++++++++++++++ .../db/migration/workdiary_service.sql | 20 +++++ .../mapper/WorkdiaryServiceTypeDao.xml | 21 +++++ 10 files changed, 504 insertions(+) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java create mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java new file mode 100644 index 0000000000..c392df375b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +public class WorkdiaryServiceTypeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 服务类型 + */ + private String serviceType; + + /** + * 服务类型名称 + */ + private String serviceName; + + /** + * 是否启用。0:禁用,1:启用 + */ + private Integer enabled; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java new file mode 100755 index 0000000000..7ec0167414 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java @@ -0,0 +1,83 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.ActSummaryDTO; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.entity.WorkdiaryServiceTypeExcel; +import com.epmet.service.WorkdiaryServiceTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@RestController +@RequestMapping("workdiaryServiceType") +public class WorkdiaryServiceTypeController { + + @Autowired + private WorkdiaryServiceTypeService workdiaryServiceTypeService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = workdiaryServiceTypeService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + WorkdiaryServiceTypeDTO data = workdiaryServiceTypeService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody WorkdiaryServiceTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + workdiaryServiceTypeService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody WorkdiaryServiceTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + workdiaryServiceTypeService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + workdiaryServiceTypeService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = workdiaryServiceTypeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceTypeExcel.class); + } + + + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java new file mode 100755 index 0000000000..fe37602384 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WorkdiaryServiceTypeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Mapper +public interface WorkdiaryServiceTypeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java new file mode 100755 index 0000000000..3a7464aa7b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.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 2022-08-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("workdiary_service_type") +public class WorkdiaryServiceTypeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 服务类型 + */ + private String serviceType; + + /** + * 服务类型名称 + */ + private String serviceName; + + /** + * 是否启用。0:禁用,1:启用 + */ + private Integer enabled; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java new file mode 100755 index 0000000000..a8c3340c73 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java @@ -0,0 +1,51 @@ +package com.epmet.entity; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +public class WorkdiaryServiceTypeExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "服务类型") + private String serviceType; + + @Excel(name = "服务类型名称") + private String serviceName; + + @Excel(name = "是否启用。0:禁用,1:启用") + private Integer enabled; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer 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; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java new file mode 100755 index 0000000000..bf4dc2ffc1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Component +public class WorkdiaryServiceTypeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java new file mode 100755 index 0000000000..88318950a4 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.entity.WorkdiaryServiceTypeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +public interface WorkdiaryServiceTypeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-23 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-23 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WorkdiaryServiceTypeDTO + * @author generator + * @date 2022-08-23 + */ + WorkdiaryServiceTypeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-23 + */ + void save(WorkdiaryServiceTypeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-23 + */ + void update(WorkdiaryServiceTypeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-23 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java new file mode 100755 index 0000000000..2058e93c47 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.service.impl; + +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WorkdiaryServiceTypeDao; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.entity.WorkdiaryServiceTypeEntity; +import com.epmet.redis.WorkdiaryServiceTypeRedis; +import com.epmet.service.WorkdiaryServiceTypeService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Service +public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl implements WorkdiaryServiceTypeService { + + @Autowired + private WorkdiaryServiceTypeRedis workdiaryServiceTypeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WorkdiaryServiceTypeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WorkdiaryServiceTypeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WorkdiaryServiceTypeDTO get(String id) { + WorkdiaryServiceTypeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WorkdiaryServiceTypeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WorkdiaryServiceTypeDTO dto) { + WorkdiaryServiceTypeEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceTypeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WorkdiaryServiceTypeDTO dto) { + WorkdiaryServiceTypeEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceTypeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql index 63869fa0c2..809e8078cf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql @@ -24,3 +24,23 @@ CREATE TABLE `workdiary_service_record` PRIMARY KEY (`ID`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-记录' + + +# 工作日志-服务分类 +CREATE TABLE `workdiary_service_type` +( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `SERVICE_TYPE` varchar(32) NOT NULL COMMENT '服务类型', + `SERVICE_NAME` varchar(32) NOT NULL COMMENT '服务类型名称', + `ENABLED` tinyint(1) NOT NULL COMMENT '是否启用。0:禁用,1:启用', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + unique index cust_service_type(CUSTOMER_ID asc , SERVICE_TYPE asc , DEL_FLAG asc) using btree +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-服务类型' diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml new file mode 100755 index 0000000000..5679d1cb91 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 40bb8cd80227db8780532d369a97805cde56e1b3 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 24 Aug 2022 10:00:26 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=92=8C=E5=AD=97=E6=AE=B5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/WorkdiaryServiceTypeDTO.java | 6 +- .../WorkdiaryServiceQueryFormDTO.java | 10 ++ .../dto/result/WorkdiaryServiceRecordDTO.java | 2 +- .../WorkdiaryServiceRecordController.java | 129 ++++++++++++++++-- .../WorkdiaryServiceTypeController.java | 43 ------ .../entity/WorkdiaryServiceRecordEntity.java | 2 +- .../entity/WorkdiaryServiceTypeEntity.java | 4 +- .../db/migration/workdiary_service.sql | 6 +- .../mapper/WorkdiaryServiceTypeDao.xml | 2 +- 9 files changed, 136 insertions(+), 68 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java index c392df375b..4f8c936bf7 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java @@ -29,17 +29,17 @@ public class WorkdiaryServiceTypeDTO implements Serializable { /** * 服务类型 */ - private String serviceType; + private Short serviceType; /** * 服务类型名称 */ - private String serviceName; + private String serviceTypeName; /** * 是否启用。0:禁用,1:启用 */ - private Integer enabled; + private Short enabled; /** * 删除标识 0.未删除 1.已删除 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java new file mode 100644 index 0000000000..28d967b175 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java @@ -0,0 +1,10 @@ +package com.epmet.dto.form.workdiaryservice; + +import lombok.Data; + +@Data +public class WorkdiaryServiceQueryFormDTO { + + + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java index 4cf60df0d2..825c4e76e3 100755 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -29,7 +29,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 服务类型 */ - private String serviceType; + private Short serviceType; /** * 单位ID diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java index 2ca6537d09..fc8fea3b39 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java @@ -9,9 +9,13 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.dto.form.workdiaryservice.WorkdiaryServiceQueryFormDTO; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.epmet.entity.WorkdiaryServiceTypeExcel; import com.epmet.excel.WorkdiaryServiceRecordExcel; import com.epmet.service.WorkdiaryServiceRecordService; +import com.epmet.service.WorkdiaryServiceTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -27,56 +31,153 @@ import java.util.Map; * @since v1.0.0 2022-08-23 */ @RestController -@RequestMapping("workdiaryServiceRecord") +@RequestMapping("workdiaryService") public class WorkdiaryServiceRecordController { @Autowired private WorkdiaryServiceRecordService workdiaryServiceRecordService; - @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = workdiaryServiceRecordService.page(params); + @Autowired + private WorkdiaryServiceTypeService workdiaryServiceTypeService; + + /** + * 记录-分页 + * @param params + * @return + */ + @RequestMapping("/record/page") + public Result> recordPage(@RequestBody WorkdiaryServiceQueryFormDTO input){ + PageData page = workdiaryServiceRecordService.page(null); return new Result>().ok(page); } - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ + /** + * 记录-单条 + * @param id + * @return + */ + @RequestMapping(value = "/record/{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result recordGet(@PathVariable("id") String id){ WorkdiaryServiceRecordDTO data = workdiaryServiceRecordService.get(id); return new Result().ok(data); } + /** + * 记录-保存 + * @return + */ @NoRepeatSubmit - @PostMapping("save") - public Result save(@RequestBody WorkdiaryServiceRecordDTO dto){ + @PostMapping("/record/save") + public Result recordSave(@RequestBody WorkdiaryServiceRecordDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); workdiaryServiceRecordService.save(dto); return new Result(); } + /** + * 记录-更新 + * @param + * @return + */ @NoRepeatSubmit - @PostMapping("update") - public Result update(@RequestBody WorkdiaryServiceRecordDTO dto){ + @PostMapping("/record/update") + public Result recordUpdate(@RequestBody WorkdiaryServiceRecordDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); workdiaryServiceRecordService.update(dto); return new Result(); } - @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ + /** + * 记录-删除 + * @return + */ + @PostMapping("/record/delete") + public Result recordDelete(@RequestBody String[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); workdiaryServiceRecordService.delete(ids); return new Result(); } - @GetMapping("export") - public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + /** + * 记录-导出 + * @return + */ + @GetMapping("/record/export") + public void recordExport(@RequestParam Map params, HttpServletResponse response) throws Exception { List list = workdiaryServiceRecordService.list(params); ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceRecordExcel.class); } + /** + * 服务类型-分页 + * @return + */ + @RequestMapping("/serviceType/page") + public Result> serviceTypePage(@RequestParam Map params){ + PageData page = workdiaryServiceTypeService.page(params); + return new Result>().ok(page); + } + + /** + * 服务类型-单条 + * @return + */ + @RequestMapping(value = "/serviceType/{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result serviceTypeGet(@PathVariable("id") String id){ + WorkdiaryServiceTypeDTO data = workdiaryServiceTypeService.get(id); + return new Result().ok(data); + } + + /** + * 服务类型-保存 + * @return + */ + @NoRepeatSubmit + @PostMapping("/serviceType/save") + public Result serviceTypeSave(@RequestBody WorkdiaryServiceTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + workdiaryServiceTypeService.save(dto); + return new Result(); + } + + /** + * 服务类型-更新 + * @return + */ + @NoRepeatSubmit + @PostMapping("/serviceType/update") + public Result serviceTypeUpdate(@RequestBody WorkdiaryServiceTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + workdiaryServiceTypeService.update(dto); + return new Result(); + } + + /** + * 服务类型-删除 + * @return + */ + @PostMapping("/serviceType/delete") + public Result serviceTypeDelete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + workdiaryServiceTypeService.delete(ids); + return new Result(); + } + + /** + * 服务类型-导出 + * @return + */ + @GetMapping("/serviceType/export") + public void serviceTypeExport(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = workdiaryServiceTypeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceTypeExcel.class); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java index 7ec0167414..8d473d494b 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java @@ -31,52 +31,9 @@ import java.util.Map; @RequestMapping("workdiaryServiceType") public class WorkdiaryServiceTypeController { - @Autowired - private WorkdiaryServiceTypeService workdiaryServiceTypeService; - @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = workdiaryServiceTypeService.page(params); - return new Result>().ok(page); - } - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ - WorkdiaryServiceTypeDTO data = workdiaryServiceTypeService.get(id); - return new Result().ok(data); - } - @NoRepeatSubmit - @PostMapping("save") - public Result save(@RequestBody WorkdiaryServiceTypeDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - workdiaryServiceTypeService.save(dto); - return new Result(); - } - - @NoRepeatSubmit - @PostMapping("update") - public Result update(@RequestBody WorkdiaryServiceTypeDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - workdiaryServiceTypeService.update(dto); - return new Result(); - } - - @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ - //效验数据 - AssertUtils.isArrayEmpty(ids, "id"); - workdiaryServiceTypeService.delete(ids); - return new Result(); - } - - @GetMapping("export") - public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = workdiaryServiceTypeService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceTypeExcel.class); - } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java index 50b5bb7bab..35ea3e19dd 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java @@ -29,7 +29,7 @@ public class WorkdiaryServiceRecordEntity extends BaseEpmetEntity { /** * 服务类型 */ - private String serviceType; + private Short serviceType; /** * 单位ID diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java index 3a7464aa7b..2f3258503b 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java @@ -29,12 +29,12 @@ public class WorkdiaryServiceTypeEntity extends BaseEpmetEntity { /** * 服务类型 */ - private String serviceType; + private Short serviceType; /** * 服务类型名称 */ - private String serviceName; + private String serviceTypeName; /** * 是否启用。0:禁用,1:启用 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql index 809e8078cf..ebb1138369 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql @@ -3,7 +3,7 @@ CREATE TABLE `workdiary_service_record` ( `ID` varchar(64) NOT NULL COMMENT '主键', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', - `SERVICE_TYPE` varchar(32) NOT NULL COMMENT '服务类型', + `SERVICE_TYPE` tinyint(1) NOT NULL COMMENT '服务类型', `AGENCY_ID` varchar(32) NOT NULL COMMENT '单位ID', `GRID_ID` varchar(32) NOT NULL COMMENT '网格ID', `ORG_ID_PATH` varchar(255) NOT NULL COMMENT '组织ID path', @@ -31,8 +31,8 @@ CREATE TABLE `workdiary_service_type` ( `ID` varchar(64) NOT NULL COMMENT '主键', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', - `SERVICE_TYPE` varchar(32) NOT NULL COMMENT '服务类型', - `SERVICE_NAME` varchar(32) NOT NULL COMMENT '服务类型名称', + `SERVICE_TYPE` tinyint(1) NOT NULL COMMENT '服务类型', + `SERVICE_TYPE_NAME` varchar(32) NOT NULL COMMENT '服务类型名称', `ENABLED` tinyint(1) NOT NULL COMMENT '是否启用。0:禁用,1:启用', `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', `REVISION` int(11) NOT NULL COMMENT '乐观锁', diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml index 5679d1cb91..d3fd24730d 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml @@ -7,7 +7,7 @@ - + From 4768aa55d4d732c9fbf5c69bae9a5ddff008f43f Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 24 Aug 2022 13:01:52 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=911.=E4=B8=80=E4=BA=9B=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4=EF=BC=9B2.=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=B1=BB=E5=9E=8B=E7=9A=84curd=EF=BC=9B3.?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=AE=B0=E5=BD=95-=E8=BF=98=E6=9C=89?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA=E6=B2=A1=E5=81=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/redis/RedisKeys.java | 1 - .../WorkdiaryServiceQueryFormDTO.java | 18 ++++- .../dto/result/WorkdiaryServiceRecordDTO.java | 4 +- ...r.java => WorkdiaryServiceController.java} | 25 ++++-- .../WorkdiaryServiceTypeController.java | 40 ---------- .../epmet/dao/WorkdiaryServiceTypeDao.java | 9 ++- .../entity/WorkdiaryServiceRecordEntity.java | 2 +- .../entity/WorkdiaryServiceTypeEntity.java | 2 +- .../WorkdiaryServiceRecordService.java | 3 + .../service/WorkdiaryServiceTypeService.java | 5 +- .../WorkdiaryServiceRecordServiceImpl.java | 78 ++++++++++++++++++- .../impl/WorkdiaryServiceTypeServiceImpl.java | 50 ++++++++++-- .../db/migration/workdiary_service.sql | 4 +- .../mapper/WorkdiaryServiceTypeDao.xml | 8 +- 14 files changed, 182 insertions(+), 67 deletions(-) rename epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/{WorkdiaryServiceRecordController.java => WorkdiaryServiceController.java} (86%) delete mode 100755 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 4c18a3ea55..bb7edb3e2a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -871,5 +871,4 @@ public class RedisKeys { public static String getDhToken() { return rootPrefix.concat("dh:token"); } - } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java index 28d967b175..2f5a628916 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java @@ -1,10 +1,26 @@ package com.epmet.dto.form.workdiaryservice; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; +/** + * 工作日志-服务 + */ @Data -public class WorkdiaryServiceQueryFormDTO { +public class WorkdiaryServiceQueryFormDTO extends PageFormDTO { + private String id; + private Short serviceType; + private String gridId; + private String applicantName; + private String applicantAddress; + private String serviceContent; + private String applicantMobile; + private String principalName; + //@DateTimeFormat + //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:sss", timezone = "GMT+8") + //private Date serviceTime; + private String remark; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java index 825c4e76e3..95fcdcc88a 100755 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -30,6 +30,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { * 服务类型 */ private Short serviceType; + private String serviceTypeName; /** * 单位ID @@ -40,6 +41,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { * 网格ID */ private String gridId; + private String gridName; /** * 组织ID path @@ -74,7 +76,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 服务时间 */ - private Date serviceTime; + private String serviceTime; /** * 负责人姓名 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java similarity index 86% rename from epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java rename to epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index fc8fea3b39..282f6be973 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceRecordController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; @@ -20,19 +21,20 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotNull; import java.util.List; import java.util.Map; /** - * 工作日志(服务)-记录 + * 工作日志(服务) * * @author generator generator@elink-cn.com * @since v1.0.0 2022-08-23 */ @RestController @RequestMapping("workdiaryService") -public class WorkdiaryServiceRecordController { +public class WorkdiaryServiceController { @Autowired private WorkdiaryServiceRecordService workdiaryServiceRecordService; @@ -42,12 +44,21 @@ public class WorkdiaryServiceRecordController { /** * 记录-分页 - * @param params * @return */ @RequestMapping("/record/page") - public Result> recordPage(@RequestBody WorkdiaryServiceQueryFormDTO input){ - PageData page = workdiaryServiceRecordService.page(null); + public Result> recordPage(@RequestBody WorkdiaryServiceQueryFormDTO query){ + String gridId = query.getGridId(); + Short serviceType = query.getServiceType(); + String applicantName = query.getApplicantName(); + String applicantAddress = query.getApplicantAddress(); + String serviceContent = query.getServiceContent(); + String applicantMobile = query.getApplicantMobile(); + Integer pageNo = query.getPageNo(); + Integer pageSize = query.getPageSize(); + + PageData page = workdiaryServiceRecordService.page( + gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, pageNo, pageSize); return new Result>().ok(page); } @@ -116,8 +127,8 @@ public class WorkdiaryServiceRecordController { * @return */ @RequestMapping("/serviceType/page") - public Result> serviceTypePage(@RequestParam Map params){ - PageData page = workdiaryServiceTypeService.page(params); + public Result> serviceTypePage(@RequestBody PageFormDTO input){ + PageData page = workdiaryServiceTypeService.page(input.getPageNo(), input.getPageSize()); return new Result>().ok(page); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java deleted file mode 100755 index 8d473d494b..0000000000 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.epmet.controller; - -import com.epmet.commons.tools.aop.NoRepeatSubmit; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.AssertUtils; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.dto.ActSummaryDTO; -import com.epmet.dto.WorkdiaryServiceTypeDTO; -import com.epmet.entity.WorkdiaryServiceTypeExcel; -import com.epmet.service.WorkdiaryServiceTypeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.Map; - - -/** - * 工作日志(服务)-服务类型 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2022-08-23 - */ -@RestController -@RequestMapping("workdiaryServiceType") -public class WorkdiaryServiceTypeController { - - - - - - - -} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java index fe37602384..5997be4147 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java @@ -3,6 +3,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.WorkdiaryServiceTypeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 工作日志(服务)-服务类型 @@ -12,5 +13,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface WorkdiaryServiceTypeDao extends BaseDao { - + + /** + * 该客户最大的type是啥 + * @param customerId + * @return + */ + Short getMaxType(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java index 35ea3e19dd..4b74496fd6 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java @@ -74,7 +74,7 @@ public class WorkdiaryServiceRecordEntity extends BaseEpmetEntity { /** * 服务时间 */ - private Date serviceTime; + private String serviceTime; /** * 负责人姓名 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java index 2f3258503b..868fb4e001 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java @@ -39,6 +39,6 @@ public class WorkdiaryServiceTypeEntity extends BaseEpmetEntity { /** * 是否启用。0:禁用,1:启用 */ - private Integer enabled; + private Short enabled; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java index ee543708a3..47671ea202 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java @@ -26,6 +26,9 @@ public interface WorkdiaryServiceRecordService extends BaseService page(Map params); + PageData page(String gridId, Short serviceType, String applicantName, String applicantAddress, + String serviceContent, String applicantMobile, Integer pageNo, Integer pageSize); + /** * 默认查询 * diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java index 88318950a4..4d969e1337 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java @@ -19,12 +19,11 @@ public interface WorkdiaryServiceTypeService extends BaseService * @author generator * @date 2022-08-23 */ - PageData page(Map params); + PageData page(Integer pageNo, Integer pageSize); /** * 默认查询 @@ -36,6 +35,8 @@ public interface WorkdiaryServiceTypeService extends BaseService list(Map params); + List list(Integer pageNo, Integer pageSize); + /** * 单条查询 * diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 3211ae09b1..b38bd0d85b 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -1,16 +1,32 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.ServiceConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dao.WorkdiaryServiceRecordDao; +import com.epmet.dao.WorkdiaryServiceTypeDao; +import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.WorkdiaryServiceTypeDTO; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import com.epmet.entity.WorkdiaryServiceRecordEntity; +import com.epmet.entity.WorkdiaryServiceTypeEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.WorkdiaryServiceRecordRedis; import com.epmet.service.WorkdiaryServiceRecordService; +import com.epmet.service.WorkdiaryServiceTypeService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,6 +35,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; /** * 工作日志(服务)-记录 @@ -27,11 +45,17 @@ import java.util.Map; * @since v1.0.0 2022-08-23 */ @Service -public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl implements WorkdiaryServiceRecordService { +public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl implements WorkdiaryServiceRecordService, ResultDataResolver { @Autowired private WorkdiaryServiceRecordRedis workdiaryServiceRecordRedis; + @Autowired + private WorkdiaryServiceTypeDao workdiaryServiceTypeDao; + + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -41,6 +65,31 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl page(String gridId, Short serviceType, String applicantName, String applicantAddress, + String serviceContent, String applicantMobile, Integer pageNo, Integer pageSize) { + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(StringUtils.isNotBlank(gridId), WorkdiaryServiceRecordEntity::getGridId, gridId); + query.eq(serviceType != null, WorkdiaryServiceRecordEntity::getServiceType, serviceType); + query.like(StringUtils.isNotBlank(applicantName), WorkdiaryServiceRecordEntity::getApplicantName, applicantName); + query.like(StringUtils.isNotBlank(applicantAddress), WorkdiaryServiceRecordEntity::getApplicantAddress, applicantAddress); + query.like(StringUtils.isNotBlank(serviceContent), WorkdiaryServiceRecordEntity::getServiceContent, serviceContent); + query.like(StringUtils.isNotBlank(applicantMobile), WorkdiaryServiceRecordEntity::getApplicantMobile, applicantMobile); + + // 查找类型列表 + List stList = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(1, 100); + Map stMap = stList.stream().collect(Collectors.toMap(WorkdiaryServiceTypeDTO::getServiceType, WorkdiaryServiceTypeDTO::getServiceTypeName)); + + // 查找服务记录 + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.selectList(query) + .stream() + .map(e -> convertEntity2DTO(e, stMap)) + .collect(Collectors.toList()); + return new PageData<>(list, new PageInfo<>(list).getTotal(), pageSize); + } + @Override public List list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); @@ -60,13 +109,24 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId()))); + + IcResiUserDTO applicant = getResultDataOrThrowsException(userOpenFeignClient.getIcResiUserDTO(dto.getApplicantId()), ServiceConstant.EPMET_USER_SERVER, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到申请人信息"); + + if (applicant != null) { + entity.setApplicantName(applicant.getName()); + } insert(entity); } @@ -84,4 +144,18 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl stMap) { + + if (stMap == null || stMap.size() == 0) { + // 查找类型列表 + List list = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(1, 100); + stMap = list.stream().collect(Collectors.toMap(WorkdiaryServiceTypeDTO::getServiceType, WorkdiaryServiceTypeDTO::getServiceTypeName)); + } + + WorkdiaryServiceRecordDTO d = ConvertUtils.sourceToTarget(entity, WorkdiaryServiceRecordDTO.class); + Optional.ofNullable(CustomerOrgRedis.getGridInfo(entity.getGridId())).ifPresent((gridInfo) -> d.setGridName(gridInfo.getAgencyName() + gridInfo.getGridName())); + d.setServiceTypeName(stMap.get(entity.getServiceType())); + return d; + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java index 2058e93c47..e81f8b7c30 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java @@ -1,16 +1,23 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.dao.WorkdiaryServiceTypeDao; import com.epmet.dto.WorkdiaryServiceTypeDTO; import com.epmet.entity.WorkdiaryServiceTypeEntity; import com.epmet.redis.WorkdiaryServiceTypeRedis; import com.epmet.service.WorkdiaryServiceTypeService; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 工作日志(服务)-服务类型 @@ -31,14 +39,13 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, WorkdiaryServiceTypeDTO.class); + public PageData page(Integer pageNo, Integer pageSize) { + List list = list(pageNo, pageSize); + return new PageData<>(list, new PageInfo<>(list).getTotal(), pageSize); } @Override @@ -48,6 +55,20 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl list(Integer pageNo, Integer pageSize) { + LambdaQueryWrapper stQuery = new LambdaQueryWrapper<>(); + stQuery.eq(WorkdiaryServiceTypeEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + List ds = baseDao.selectList(stQuery).stream().map((e) -> { + WorkdiaryServiceTypeDTO d = new WorkdiaryServiceTypeDTO(); + d.setServiceType(e.getServiceType()); + d.setServiceTypeName(e.getServiceTypeName()); + d.setEnabled(e.getEnabled()); + return d; + }).collect(Collectors.toList()); + return ds; + } + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); @@ -66,8 +87,23 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); + query.eq(WorkdiaryServiceTypeEntity::getCustomerId, customerId); + query.eq(WorkdiaryServiceTypeEntity::getServiceTypeName, dto.getServiceTypeName()); + if (baseDao.selectCount(query) > 0) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "已存在该类别", "已存在该类别"); + } + WorkdiaryServiceTypeEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceTypeEntity.class); - insert(entity); + entity.setCustomerId(customerId); + entity.setEnabled(Short.valueOf("1")); + synchronized (this) { + Short max = baseDao.getMaxType(customerId); + entity.setServiceType(++max); + insert(entity); + } } @Override diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql index ebb1138369..d825fba47e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql @@ -3,7 +3,7 @@ CREATE TABLE `workdiary_service_record` ( `ID` varchar(64) NOT NULL COMMENT '主键', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', - `SERVICE_TYPE` tinyint(1) NOT NULL COMMENT '服务类型', + `SERVICE_TYPE` tinyint(3) NOT NULL COMMENT '服务类型', `AGENCY_ID` varchar(32) NOT NULL COMMENT '单位ID', `GRID_ID` varchar(32) NOT NULL COMMENT '网格ID', `ORG_ID_PATH` varchar(255) NOT NULL COMMENT '组织ID path', @@ -31,7 +31,7 @@ CREATE TABLE `workdiary_service_type` ( `ID` varchar(64) NOT NULL COMMENT '主键', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', - `SERVICE_TYPE` tinyint(1) NOT NULL COMMENT '服务类型', + `SERVICE_TYPE` tinyint(3) NOT NULL COMMENT '服务类型', `SERVICE_TYPE_NAME` varchar(32) NOT NULL COMMENT '服务类型名称', `ENABLED` tinyint(1) NOT NULL COMMENT '是否启用。0:禁用,1:启用', `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml index d3fd24730d..b62d6f86c6 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml @@ -17,5 +17,11 @@ - + + \ No newline at end of file From 072932fec4377abe68ae894e5f395d5330986df7 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 24 Aug 2022 13:50:02 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E5=A4=84=E7=90=86urlPath=E7=9A=84=E5=86=B2?= =?UTF-8?q?=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/WorkdiaryServiceController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index 282f6be973..4b5a574df8 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -67,7 +67,7 @@ public class WorkdiaryServiceController { * @param id * @return */ - @RequestMapping(value = "/record/{id}",method = {RequestMethod.POST,RequestMethod.GET}) + @RequestMapping(value = "/record/{id}/detail",method = {RequestMethod.POST,RequestMethod.GET}) public Result recordGet(@PathVariable("id") String id){ WorkdiaryServiceRecordDTO data = workdiaryServiceRecordService.get(id); return new Result().ok(data); @@ -136,7 +136,7 @@ public class WorkdiaryServiceController { * 服务类型-单条 * @return */ - @RequestMapping(value = "/serviceType/{id}",method = {RequestMethod.POST,RequestMethod.GET}) + @RequestMapping(value = "/serviceType/{id}/detail",method = {RequestMethod.POST,RequestMethod.GET}) public Result serviceTypeGet(@PathVariable("id") String id){ WorkdiaryServiceTypeDTO data = workdiaryServiceTypeService.get(id); return new Result().ok(data); From 9a57fe475442739c16fb0bb0537ada939798b13a Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 24 Aug 2022 15:14:07 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E5=AE=8C=E6=88=90=E5=AF=BC=E5=87=BA=EF=BC=9B?= =?UTF-8?q?=E5=88=A0=E9=99=A4servicetype=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=AF=B9record=E7=9A=84=E5=88=A4=E6=96=AD=EF=BC=8C=E6=9C=89rec?= =?UTF-8?q?ord=E4=BA=86=E4=B8=8D=E8=83=BD=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkdiaryServiceController.java | 23 +++-- .../excel/WorkdiaryServiceRecordExcel.java | 93 ++++++++----------- .../WorkdiaryServiceRecordService.java | 7 ++ .../service/WorkdiaryServiceTypeService.java | 2 +- .../WorkdiaryServiceRecordServiceImpl.java | 57 +++++++++++- .../impl/WorkdiaryServiceTypeServiceImpl.java | 41 ++++++-- 6 files changed, 152 insertions(+), 71 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index 4b5a574df8..cdd26b8794 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; @@ -14,7 +15,6 @@ import com.epmet.dto.WorkdiaryServiceTypeDTO; import com.epmet.dto.form.workdiaryservice.WorkdiaryServiceQueryFormDTO; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import com.epmet.entity.WorkdiaryServiceTypeExcel; -import com.epmet.excel.WorkdiaryServiceRecordExcel; import com.epmet.service.WorkdiaryServiceRecordService; import com.epmet.service.WorkdiaryServiceTypeService; import org.springframework.beans.factory.annotation.Autowired; @@ -116,10 +116,15 @@ public class WorkdiaryServiceController { * 记录-导出 * @return */ - @GetMapping("/record/export") - public void recordExport(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = workdiaryServiceRecordService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceRecordExcel.class); + @PostMapping("/record/export") + public void recordExport(@RequestBody WorkdiaryServiceQueryFormDTO query, HttpServletResponse response) throws Exception { + String gridId = query.getGridId(); + Short serviceType = query.getServiceType(); + String applicantName = query.getApplicantName(); + String applicantAddress = query.getApplicantAddress(); + String serviceContent = query.getServiceContent(); + String applicantMobile = query.getApplicantMobile(); + workdiaryServiceRecordService.export(gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, response); } /** @@ -176,8 +181,12 @@ public class WorkdiaryServiceController { public Result serviceTypeDelete(@RequestBody String[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); - workdiaryServiceTypeService.delete(ids); - return new Result(); + int failCount = workdiaryServiceTypeService.delete(ids); + if (failCount == 0) { + return new Result(); + } else { + return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "部分条目已经被使用,未完全删除,失败条目:" + failCount); + } } /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java index e0eace7a2a..8a2f2cf454 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -1,12 +1,12 @@ 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.epmet.dto.result.WorkdiaryServiceRecordDTO; import lombok.Data; -import java.util.Date; - /** - * 工作日志(服务)-记录 + * 工作日志(服务)-记录 excel * * @author generator generator@elink-cn.com * @since v1.0.0 2022-08-23 @@ -14,65 +14,52 @@ import java.util.Date; @Data public class WorkdiaryServiceRecordExcel { - @Excel(name = "主键") - private String id; - - @Excel(name = "客户id") - private String customerId; - - @Excel(name = "服务类型") - private String serviceType; - - @Excel(name = "单位ID") - private String agencyId; - - @Excel(name = "网格ID") - private String gridId; + @ColumnWidth(25) + @ExcelProperty(value = "所属网格") + private String gridName; - @Excel(name = "组织ID path") - private String orgIdPath; + @ColumnWidth(15) + @ExcelProperty(value = "服务类型") + private String serviceTypeName; - @Excel(name = "申请人ID") - private String applicantId; - - @Excel(name = "申请人姓名") + @ColumnWidth(10) + @ExcelProperty(value = "申请人") private String applicantName; - @Excel(name = "申请人住址") + @ColumnWidth(25) + @ExcelProperty(value = "住址") private String applicantAddress; - @Excel(name = "申请人联系电话") - private String applicantMobile; - - @Excel(name = "服务内容") + @ColumnWidth(25) + @ExcelProperty(value = "服务内容") private String serviceContent; - @Excel(name = "服务时间") - private Date serviceTime; - - @Excel(name = "负责人姓名") - private String principalName; - - @Excel(name = "备注") - private String remark; - - @Excel(name = "删除标识 0.未删除 1.已删除") - private Integer delFlag; - - @Excel(name = "乐观锁") - private Integer revision; - - @Excel(name = "创建人") - private String createdBy; - - @Excel(name = "创建时间") - private Date createdTime; + @ColumnWidth(15) + @ExcelProperty(value = "联系电话") + private String applicantMobile; - @Excel(name = "更新人") - private String updatedBy; + @ColumnWidth(10) + @ExcelProperty(value = "负责人") + private String principal; - @Excel(name = "更新时间") - private Date updatedTime; + @ColumnWidth(10) + @ExcelProperty(value = "服务时间") + private String serviceTime; + @ColumnWidth(20) + @ExcelProperty(value = "备注") + private String remark; + public WorkdiaryServiceRecordExcel(WorkdiaryServiceRecordDTO dto) { + this.gridName = dto.getGridName(); + this.serviceTypeName = dto.getServiceTypeName(); + this.applicantName = dto.getApplicantName(); + this.applicantAddress = dto.getApplicantAddress(); + this.serviceContent = dto.getServiceContent(); + this.serviceContent = dto.getServiceContent(); + this.principal = dto.getPrincipalName(); + this.principal = dto.getPrincipalName(); + this.serviceTime = dto.getServiceTime(); + this.remark = dto.getRemark(); + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java index 47671ea202..e6ed7578f4 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java @@ -2,9 +2,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.workdiaryservice.WorkdiaryServiceQueryFormDTO; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import com.epmet.entity.WorkdiaryServiceRecordEntity; +import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; @@ -78,4 +80,9 @@ public interface WorkdiaryServiceRecordService extends BaseService page = this.page(gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, pageNo, pageSize); + List list = page.getList(); + if (CollectionUtils.isEmpty(list)) { + // 空的,导出结束 + break; + } + + List excelObjects = list.stream().map(e -> new WorkdiaryServiceRecordExcel(e)).collect(Collectors.toList()); + writer.write(excelObjects, sheet); + } + } finally { + writer.finish(); + } + } + + @Override + public Integer selectRecordCountOfType(Short serviceType) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(WorkdiaryServiceRecordEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + query.eq(WorkdiaryServiceRecordEntity::getServiceType, serviceType); + return baseDao.selectCount(query); + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java index e81f8b7c30..8c34a9b93c 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java @@ -2,28 +2,31 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.FieldConstant; +import com.epmet.commons.tools.distributedlock.DistributedLock; 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.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dao.WorkdiaryServiceTypeDao; import com.epmet.dto.WorkdiaryServiceTypeDTO; import com.epmet.entity.WorkdiaryServiceTypeEntity; import com.epmet.redis.WorkdiaryServiceTypeRedis; +import com.epmet.service.WorkdiaryServiceRecordService; import com.epmet.service.WorkdiaryServiceTypeService; 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 org.springframework.web.bind.annotation.RequestBody; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -41,6 +44,8 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl page(Integer pageNo, Integer pageSize) { @@ -61,6 +66,7 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl ds = baseDao.selectList(stQuery).stream().map((e) -> { WorkdiaryServiceTypeDTO d = new WorkdiaryServiceTypeDTO(); + d.setId(e.getId()); d.setServiceType(e.getServiceType()); d.setServiceTypeName(e.getServiceTypeName()); d.setEnabled(e.getEnabled()); @@ -115,9 +121,30 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl canDeleteIds = new ArrayList<>(); + int failCount = 0; + for (String id : ids) { + WorkdiaryServiceTypeEntity st = baseDao.selectById(id); + if (st == null) { + continue; + } + WorkdiaryServiceRecordService wsRecordService = SpringContextUtils.getBean(WorkdiaryServiceRecordService.class); + Integer recordCount = wsRecordService.selectRecordCountOfType(st.getServiceType()); + if (recordCount > 0) { + failCount++; + } else { + canDeleteIds.add(id); + } + } + + if (CollectionUtils.isNotEmpty(canDeleteIds)) { + baseDao.deleteBatchIds(canDeleteIds); + } + return failCount; } } \ No newline at end of file From 71d0176d48492cdbbbc3f2d99c5f3f96dbffae81 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 24 Aug 2022 17:27:53 +0800 Subject: [PATCH 07/23] kehuId --- .../epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 290a583e7e..b59d7658ff 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -134,6 +134,7 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl Date: Thu, 25 Aug 2022 09:37:47 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E6=96=B0=E5=A2=9E=E7=BC=BA=E5=A4=B1=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WorkdiaryServiceRecordServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 290a583e7e..4547aa952a 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -127,11 +127,15 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId()))); + .ifPresent(gi -> { + entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId())); + entity.setAgencyId(gi.getPid()); + }); IcResiUserDTO applicant = getResultDataOrThrowsException(userOpenFeignClient.getIcResiUserDTO(dto.getApplicantId()), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到申请人信息"); + entity.setCustomerId(EpmetRequestHolder.getLoginUserCustomerId()); if (applicant != null) { entity.setApplicantName(applicant.getName()); } From cbbff32fb79887fb132a7f82badb40402e9f1795 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 09:46:26 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91update=E7=BC=BA=E5=A4=B1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkdiaryServiceRecordServiceImpl.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 6e91f95877..ffd71c8489 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -147,6 +147,26 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl { + entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId())); + entity.setAgencyId(gi.getPid()); + }); + } + + if (StringUtils.isNotBlank(dto.getApplicantId())) { + IcResiUserDTO applicant = getResultDataOrThrowsException(userOpenFeignClient.getIcResiUserDTO(dto.getApplicantId()), ServiceConstant.EPMET_USER_SERVER, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到申请人信息"); + + if (applicant != null) { + entity.setApplicantName(applicant.getName()); + entity.setCustomerId(applicant.getCustomerId()); + } + } + updateById(entity); } From c0c802c8de3b8ad4f3a106c6183cc19b559c04d2 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 13:34:43 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91flyway=E8=B5=8B=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{workdiary_service.sql => V0.0.28__workdiary_service.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/{workdiary_service.sql => V0.0.28__workdiary_service.sql} (100%) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql similarity index 100% rename from epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql rename to epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql From cfe04406b33232dcfe50880cc3057c6aaca57163 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 13:45:18 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91flyway=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V0.0.28__workdiary_service.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql index d825fba47e..0b42aeac0f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql @@ -23,7 +23,7 @@ CREATE TABLE `workdiary_service_record` `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) ) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-记录' + DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-记录'; # 工作日志-服务分类 From be350ccf6f2d077d17a375d8522d1b300ebfa2da Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 14:19:49 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=911.=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E8=87=AA=E5=B7=B1=E7=9C=8B=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=E3=80=822.=E4=BF=AE=E5=A4=8D=EF=BC=9Aflyway=20serviceTime?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BAvarchar?= =?UTF-8?q?=E3=80=823.=E5=A2=9E=E5=8A=A0=E5=85=A5=E5=8F=82=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/WorkdiaryServiceTypeDTO.java | 8 ++++++++ .../dto/result/WorkdiaryServiceRecordDTO.java | 15 +++++++++++++++ .../controller/WorkdiaryServiceController.java | 8 ++++---- .../impl/WorkdiaryServiceRecordServiceImpl.java | 1 + .../db/migration/V0.0.28__workdiary_service.sql | 2 +- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java index 4f8c936bf7..1f9d7abc3e 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java @@ -1,7 +1,10 @@ package com.epmet.dto; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.Date; @@ -16,9 +19,13 @@ public class WorkdiaryServiceTypeDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface Save extends CustomerClientShowGroup {} + public interface Update extends CustomerClientShowGroup {} + /** * 主键 */ + @NotBlank(message = "未选中任何数据", groups = { Update.class }) private String id; /** @@ -34,6 +41,7 @@ public class WorkdiaryServiceTypeDTO implements Serializable { /** * 服务类型名称 */ + @NotBlank(message = "服务类型名称必填", groups = { Save.class, Update.class }) private String serviceTypeName; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java index 95fcdcc88a..7a440ec79e 100755 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -2,8 +2,12 @@ package com.epmet.dto.result; import java.io.Serializable; import java.util.Date; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; + /** * 工作日志(服务)-记录 @@ -16,9 +20,13 @@ public class WorkdiaryServiceRecordDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface Save extends CustomerClientShowGroup {} + public interface Update extends CustomerClientShowGroup {} + /** * 主键 */ + @NotBlank(message = "未选中任何数据", groups = { Update.class }) private String id; /** @@ -29,6 +37,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 服务类型 */ + @NotBlank(message = "服务类型为必填项", groups = { Save.class, Update.class }) private Short serviceType; private String serviceTypeName; @@ -40,6 +49,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 网格ID */ + @NotBlank(message = "网格为必填项", groups = { Save.class, Update.class }) private String gridId; private String gridName; @@ -51,6 +61,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 申请人ID */ + @NotBlank(message = "申请人为必填项", groups = { Save.class, Update.class }) private String applicantId; /** @@ -61,21 +72,25 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 申请人住址 */ + @NotBlank(message = "住址为必填项", groups = { Save.class, Update.class }) private String applicantAddress; /** * 申请人联系电话 */ + @NotBlank(message = "联系电话为必填项", groups = { Save.class, Update.class }) private String applicantMobile; /** * 服务内容 */ + @NotBlank(message = "服务内容为必填项", groups = { Save.class, Update.class }) private String serviceContent; /** * 服务时间 */ + @NotBlank(message = "服务时间为必填项", groups = { Save.class, Update.class }) private String serviceTime; /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index cdd26b8794..03893f9955 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -81,7 +81,7 @@ public class WorkdiaryServiceController { @PostMapping("/record/save") public Result recordSave(@RequestBody WorkdiaryServiceRecordDTO dto){ //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + ValidatorUtils.validateEntity(dto, WorkdiaryServiceRecordDTO.Save.class); workdiaryServiceRecordService.save(dto); return new Result(); } @@ -95,7 +95,7 @@ public class WorkdiaryServiceController { @PostMapping("/record/update") public Result recordUpdate(@RequestBody WorkdiaryServiceRecordDTO dto){ //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + ValidatorUtils.validateEntity(dto, WorkdiaryServiceRecordDTO.Update.class); workdiaryServiceRecordService.update(dto); return new Result(); } @@ -155,7 +155,7 @@ public class WorkdiaryServiceController { @PostMapping("/serviceType/save") public Result serviceTypeSave(@RequestBody WorkdiaryServiceTypeDTO dto){ //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + ValidatorUtils.validateEntity(dto, WorkdiaryServiceTypeDTO.Save.class); workdiaryServiceTypeService.save(dto); return new Result(); } @@ -168,7 +168,7 @@ public class WorkdiaryServiceController { @PostMapping("/serviceType/update") public Result serviceTypeUpdate(@RequestBody WorkdiaryServiceTypeDTO dto){ //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + ValidatorUtils.validateEntity(dto, WorkdiaryServiceTypeDTO.Update.class); workdiaryServiceTypeService.update(dto); return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index ffd71c8489..6603b01f4d 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -80,6 +80,7 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); query.eq(StringUtils.isNotBlank(gridId), WorkdiaryServiceRecordEntity::getGridId, gridId); query.eq(serviceType != null, WorkdiaryServiceRecordEntity::getServiceType, serviceType); + query.eq(WorkdiaryServiceRecordEntity::getCreatedBy, EpmetRequestHolder.getLoginUserId()); query.like(StringUtils.isNotBlank(applicantName), WorkdiaryServiceRecordEntity::getApplicantName, applicantName); query.like(StringUtils.isNotBlank(applicantAddress), WorkdiaryServiceRecordEntity::getApplicantAddress, applicantAddress); query.like(StringUtils.isNotBlank(serviceContent), WorkdiaryServiceRecordEntity::getServiceContent, serviceContent); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql index 0b42aeac0f..7631087ce3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql @@ -12,7 +12,7 @@ CREATE TABLE `workdiary_service_record` `APPLICANT_ADDRESS` varchar(32) NOT NULL COMMENT '申请人住址', `APPLICANT_MOBILE` varchar(20) NOT NULL COMMENT '申请人联系电话', `SERVICE_CONTENT` varchar(255) NOT NULL COMMENT '服务内容', - `SERVICE_TIME` datetime NOT NULL COMMENT '服务时间', + `SERVICE_TIME` varchar(32) NOT NULL COMMENT '服务时间', `PRINCIPAL_NAME` varchar(10) NOT NULL COMMENT '负责人姓名', `REMARK` varchar(255) NOT NULL COMMENT '备注', `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', From 3675bb71c792469d2385e8370637652321303685 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 14:36:32 +0800 Subject: [PATCH 13/23] 1 --- .../java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java index 7a440ec79e..58be0bae12 100755 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; /** @@ -37,7 +38,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 服务类型 */ - @NotBlank(message = "服务类型为必填项", groups = { Save.class, Update.class }) + @NotNull(message = "服务类型为必填项", groups = { Save.class, Update.class }) private Short serviceType; private String serviceTypeName; From 8ed15e36e35dbbe195d96f110f28a98bcb29f253 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 14:48:47 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=97=B6=E5=80=99?= =?UTF-8?q?=E8=BD=ACexcel=E6=96=87=E4=BB=B6=EF=BC=8C=E4=B8=A2=E5=A4=B1mobi?= =?UTF-8?q?le=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java index 8a2f2cf454..7da0010c82 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -56,8 +56,7 @@ public class WorkdiaryServiceRecordExcel { this.applicantName = dto.getApplicantName(); this.applicantAddress = dto.getApplicantAddress(); this.serviceContent = dto.getServiceContent(); - this.serviceContent = dto.getServiceContent(); - this.principal = dto.getPrincipalName(); + this.applicantMobile = dto.getApplicantMobile(); this.principal = dto.getPrincipalName(); this.serviceTime = dto.getServiceTime(); this.remark = dto.getRemark(); From 6dbb245ff66fc6807cfc5d30e9d579d314120e69 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 25 Aug 2022 15:56:34 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E6=96=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9A=E5=8F=AF=E7=94=A8=E7=9A=84=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/WorkdiaryServiceTypeDTO.java | 1 - .../dto/result/WorkdiaryServiceRecordDTO.java | 14 +++++++------- .../controller/WorkdiaryServiceController.java | 13 ++++++++++++- .../service/WorkdiaryServiceTypeService.java | 6 ++++-- .../impl/WorkdiaryServiceRecordServiceImpl.java | 17 ++++++++++++++--- .../impl/WorkdiaryServiceTypeServiceImpl.java | 12 +++++++++--- 6 files changed, 46 insertions(+), 17 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java index 1f9d7abc3e..664465c7ae 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java @@ -41,7 +41,6 @@ public class WorkdiaryServiceTypeDTO implements Serializable { /** * 服务类型名称 */ - @NotBlank(message = "服务类型名称必填", groups = { Save.class, Update.class }) private String serviceTypeName; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java index 58be0bae12..98d4eacb1e 100755 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -38,7 +38,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 服务类型 */ - @NotNull(message = "服务类型为必填项", groups = { Save.class, Update.class }) + @NotNull(message = "服务类型为必填项", groups = { Save.class }) private Short serviceType; private String serviceTypeName; @@ -50,7 +50,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 网格ID */ - @NotBlank(message = "网格为必填项", groups = { Save.class, Update.class }) + @NotBlank(message = "网格为必填项", groups = { Save.class }) private String gridId; private String gridName; @@ -62,7 +62,7 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 申请人ID */ - @NotBlank(message = "申请人为必填项", groups = { Save.class, Update.class }) + @NotBlank(message = "申请人为必填项", groups = { Save.class }) private String applicantId; /** @@ -73,25 +73,25 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 申请人住址 */ - @NotBlank(message = "住址为必填项", groups = { Save.class, Update.class }) + @NotBlank(message = "住址为必填项", groups = { Save.class }) private String applicantAddress; /** * 申请人联系电话 */ - @NotBlank(message = "联系电话为必填项", groups = { Save.class, Update.class }) + @NotBlank(message = "联系电话为必填项", groups = { Save.class }) private String applicantMobile; /** * 服务内容 */ - @NotBlank(message = "服务内容为必填项", groups = { Save.class, Update.class }) + @NotBlank(message = "服务内容为必填项", groups = { Save.class }) private String serviceContent; /** * 服务时间 */ - @NotBlank(message = "服务时间为必填项", groups = { Save.class, Update.class }) + @NotBlank(message = "服务时间为必填项", groups = { Save.class }) private String serviceTime; /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index 03893f9955..1b73a301a4 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -133,7 +133,18 @@ public class WorkdiaryServiceController { */ @RequestMapping("/serviceType/page") public Result> serviceTypePage(@RequestBody PageFormDTO input){ - PageData page = workdiaryServiceTypeService.page(input.getPageNo(), input.getPageSize()); + PageData page = workdiaryServiceTypeService.page(null, input.getPageNo(), input.getPageSize()); + return new Result>().ok(page); + } + + /** + * 列出启用了的类型列表 + * @param input + * @return + */ + @RequestMapping("/serviceType/avaliableList") + public Result> listAvaliableServiceType(@RequestBody PageFormDTO input){ + PageData page = workdiaryServiceTypeService.listAvaliableServiceType(input.getPageNo(), input.getPageSize()); return new Result>().ok(page); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java index e12e45755b..255b1db312 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java @@ -23,7 +23,7 @@ public interface WorkdiaryServiceTypeService extends BaseService page(Integer pageNo, Integer pageSize); + PageData page(Short enabled, Integer pageNo, Integer pageSize); /** * 默认查询 @@ -35,7 +35,7 @@ public interface WorkdiaryServiceTypeService extends BaseService list(Map params); - List list(Integer pageNo, Integer pageSize); + List list(Short enabled, Integer pageNo, Integer pageSize); /** * 单条查询 @@ -76,4 +76,6 @@ public interface WorkdiaryServiceTypeService extends BaseService listAvaliableServiceType(Integer pageNo, Integer pageSize); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 6603b01f4d..64505ae54a 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -87,7 +87,7 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl stList = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(1, 100); + List stList = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(null, 1, 100); Map stMap = stList.stream().collect(Collectors.toMap(WorkdiaryServiceTypeDTO::getServiceType, WorkdiaryServiceTypeDTO::getServiceTypeName)); // 查找服务记录 @@ -147,7 +147,18 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl list = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(1, 100); + List list = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(null, 1, 100); stMap = list.stream().collect(Collectors.toMap(WorkdiaryServiceTypeDTO::getServiceType, WorkdiaryServiceTypeDTO::getServiceTypeName)); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java index 8c34a9b93c..fea0eeaa84 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java @@ -48,8 +48,8 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl page(Integer pageNo, Integer pageSize) { - List list = list(pageNo, pageSize); + public PageData page(Short enabled, Integer pageNo, Integer pageSize) { + List list = list(enabled, pageNo, pageSize); return new PageData<>(list, new PageInfo<>(list).getTotal(), pageSize); } @@ -61,9 +61,10 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl list(Integer pageNo, Integer pageSize) { + public List list(Short enabled, Integer pageNo, Integer pageSize) { LambdaQueryWrapper stQuery = new LambdaQueryWrapper<>(); stQuery.eq(WorkdiaryServiceTypeEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + stQuery.eq(enabled != null, WorkdiaryServiceTypeEntity::getEnabled, enabled); List ds = baseDao.selectList(stQuery).stream().map((e) -> { WorkdiaryServiceTypeDTO d = new WorkdiaryServiceTypeDTO(); d.setId(e.getId()); @@ -75,6 +76,11 @@ public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl listAvaliableServiceType(Integer pageNo, Integer pageSize) { + return this.page(Short.valueOf("1"), pageNo, pageSize); + } + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); From 38effff29b02275af17cfffcabe7f5cf81cba98b Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 26 Aug 2022 14:13:04 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E6=96=B0=E5=A2=9E=EF=BC=9A=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=AF=BC=E5=85=A5excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/security/user/LoginUserUtil.java | 1 + .../epmet/constants/ImportTaskConstants.java | 4 + .../WorkdiaryServiceController.java | 102 ++++++- .../entity/WorkdiaryServiceRecordEntity.java | 4 + .../excel/WorkdiaryServiceRecordExcel.java | 9 + .../WorkdiaryServiceImportListener.java | 54 ++++ .../WorkdiaryServiceRecordService.java | 6 + .../WorkdiaryServiceRecordServiceImpl.java | 267 +++++++++++++++++- .../templates/workdiary_service_import.xlsx | Bin 0 -> 8961 bytes .../com/epmet/dto/form/GridOptionFormDTO.java | 4 + .../dto/result/HouseAgencyInfoResultDTO.java | 1 + .../src/main/resources/mapper/IcHouseDao.xml | 1 + .../resi/IcResiPageNonDynamicFormDTO.java | 25 ++ .../resi/IcResiNonDynamicResultDTO.java | 23 ++ .../epmet/feign/EpmetUserOpenFeignClient.java | 11 + .../EpmetUserOpenFeignClientFallback.java | 7 + .../controller/IcResiUserController.java | 21 ++ .../com/epmet/service/IcResiUserService.java | 2 + .../service/impl/IcResiUserServiceImpl.java | 18 ++ 19 files changed, 544 insertions(+), 16 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java index ce92400ae0..220ac403a8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java @@ -2,6 +2,7 @@ package com.epmet.commons.tools.security.user; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index 2108042cd6..64cceb765a 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java @@ -23,6 +23,10 @@ public interface ImportTaskConstants { String BIZ_TYPE_IC_ENTERPRISE="ic_enterprise"; String IC_POINT_NUCLEIC_MONITORING = "ic_point_nucleic_monitoring"; String IC_POINT_VACCINES_INOCULATION = "ic_point_vaccines_inoculation"; + /** + * 工作日志导入 + */ + String BIZ_TYPE_WORK_DIARY_IMPORT = "work_diary_import"; /** * 核酸检测 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index 1b73a301a4..31a9b61af6 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -1,29 +1,52 @@ package com.epmet.controller; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.FileUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.WorkdiaryServiceTypeDTO; import com.epmet.dto.form.workdiaryservice.WorkdiaryServiceQueryFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import com.epmet.entity.WorkdiaryServiceTypeExcel; import com.epmet.service.WorkdiaryServiceRecordService; import com.epmet.service.WorkdiaryServiceTypeService; +import com.epmet.utils.ImportTaskUtils; +import lombok.extern.slf4j.Slf4j; +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.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotNull; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.file.Path; import java.util.List; import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; /** @@ -32,9 +55,10 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2022-08-23 */ +@Slf4j @RestController @RequestMapping("workdiaryService") -public class WorkdiaryServiceController { +public class WorkdiaryServiceController implements ResultDataResolver { @Autowired private WorkdiaryServiceRecordService workdiaryServiceRecordService; @@ -42,6 +66,9 @@ public class WorkdiaryServiceController { @Autowired private WorkdiaryServiceTypeService workdiaryServiceTypeService; + @Autowired + private ExecutorService executorService; + /** * 记录-分页 * @return @@ -127,6 +154,75 @@ public class WorkdiaryServiceController { workdiaryServiceRecordService.export(gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, response); } + /** + * 下载模板 + * @return + */ + @RequestMapping("downloadTemplate") + public void downloadTemplate(HttpServletResponse response) throws UnsupportedEncodingException { + response.setCharacterEncoding("UTF-8"); + response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); + response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("工作日志导入模板", "UTF-8") + ".xlsx"); + + try (InputStream is = this.getClass().getClassLoader().getResourceAsStream("templates/workdiary_service_import.xlsx"); + ServletOutputStream os = response.getOutputStream()) { + IOUtils.copy(is, os); + } catch (IOException e) { + log.error("【工作日志】下载模板-IO错误:{}", ExceptionUtils.getErrorStackTrace(e)); + } + } + + /** + * 记录导入 + * @param file + */ + @PostMapping("/record/import") + public Result recordImport(MultipartFile file) { + + if (file == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "请选择文件"); + } + + // 格式校验 + // 只接受如下两种格式后缀 + String originFileName = file.getOriginalFilename(); + String suffix = originFileName.substring(originFileName.lastIndexOf(".")); + if (StringUtils.isBlank(suffix) || (!".xlsx".equals(suffix) && !".xls".equals(suffix))) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "只支持.xls和.xlsx两种格式"); + } + + // 创建保存目录 + Path fileSavePath = null; + try { + Path saveDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("workdiary", "import", EpmetRequestHolder.getLoginUserId()); + fileSavePath = saveDir.resolve(System.currentTimeMillis() + suffix); + } catch (IOException e) { + e.printStackTrace(); + } + + // 将文件保存到本地 + try (FileOutputStream fos = new FileOutputStream(fileSavePath.toString()); + InputStream is = file.getInputStream()) { + IOUtils.copy(is, fos); + } catch (Exception e) { + log.error("【书记日志】上传-保存文件到本地失败:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + + // 创建导入记录 + ImportTaskCommonResultDTO itResult = getResultDataOrThrowsException(ImportTaskUtils.createImportTask(originFileName, ImportTaskConstants.BIZ_TYPE_WORK_DIARY_IMPORT), + ServiceConstant.EPMET_COMMON_SERVICE, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "有导入操作正在进行", "有导入操作正在进行"); + + // 执行异步导入 + Path finalFileSavePath = fileSavePath; + CompletableFuture.runAsync(() -> { + workdiaryServiceRecordService.createImportTaskAndExecuteImport(finalFileSavePath, originFileName, itResult.getTaskId()); + }, executorService); + + return new Result(); + } + /** * 服务类型-分页 * @return diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java index 4b74496fd6..16db6c8bc5 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java @@ -3,8 +3,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; import java.util.Date; @@ -17,6 +19,8 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("workdiary_service_record") +@NoArgsConstructor +@AllArgsConstructor public class WorkdiaryServiceRecordEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java index 7da0010c82..631c3ed943 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -4,6 +4,9 @@ import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; /** * 工作日志(服务)-记录 excel @@ -12,16 +15,20 @@ import lombok.Data; * @since v1.0.0 2022-08-23 */ @Data +@NoArgsConstructor public class WorkdiaryServiceRecordExcel { + @NotBlank(message = "所属网格必填") @ColumnWidth(25) @ExcelProperty(value = "所属网格") private String gridName; + @NotBlank(message = "服务类型必填") @ColumnWidth(15) @ExcelProperty(value = "服务类型") private String serviceTypeName; + @NotBlank(message = "申请人必填") @ColumnWidth(10) @ExcelProperty(value = "申请人") private String applicantName; @@ -30,6 +37,7 @@ public class WorkdiaryServiceRecordExcel { @ExcelProperty(value = "住址") private String applicantAddress; + @NotBlank(message = "服务内容必填") @ColumnWidth(25) @ExcelProperty(value = "服务内容") private String serviceContent; @@ -42,6 +50,7 @@ public class WorkdiaryServiceRecordExcel { @ExcelProperty(value = "负责人") private String principal; + @NotBlank(message = "服务时间必填") @ColumnWidth(10) @ExcelProperty(value = "服务时间") private String serviceTime; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java new file mode 100644 index 0000000000..bc09d401d0 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java @@ -0,0 +1,54 @@ +package com.epmet.excel.listener; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.excel.WorkdiaryServiceRecordExcel; +import com.epmet.service.WorkdiaryServiceRecordService; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; + +/** + * 工作日志-导入-监听器 + */ +@Slf4j +public class WorkdiaryServiceImportListener implements ReadListener { + + /** + * 200 一批执行导入 + */ + public static final Integer BATCH_SIZE = 2; + + /** + * 数据列表 + */ + private List datas = new ArrayList<>(); + + private WorkdiaryServiceRecordService workdiaryServiceRecordService; + + public WorkdiaryServiceImportListener(WorkdiaryServiceRecordService workdiaryServiceRecordService) { + this.workdiaryServiceRecordService = workdiaryServiceRecordService; + } + + @Override + public void invoke(WorkdiaryServiceRecordExcel data, AnalysisContext context) { + datas.add(data); + if (datas.size() >= BATCH_SIZE) { + // 达到批量阈值,执行一次导入 + try { + workdiaryServiceRecordService.executeBatchImport(datas); + } catch (Exception e) { + log.error("【工作日志】导入-发生未知错误:{}", ExceptionUtils.getErrorStackTrace(e)); + } finally { + datas.clear(); + } + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + workdiaryServiceRecordService.executeBatchImport(datas); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java index e6ed7578f4..4dfc2f3cb5 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java @@ -5,8 +5,10 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.form.workdiaryservice.WorkdiaryServiceQueryFormDTO; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; import com.epmet.entity.WorkdiaryServiceRecordEntity; +import com.epmet.excel.WorkdiaryServiceRecordExcel; import javax.servlet.http.HttpServletResponse; +import java.nio.file.Path; import java.util.List; import java.util.Map; @@ -85,4 +87,8 @@ public interface WorkdiaryServiceRecordService extends BaseService datas); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 64505ae54a..ea0966c7a0 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -1,7 +1,11 @@ package com.epmet.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.write.metadata.WriteSheet; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -9,41 +13,61 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.EpmetRequestHolder; -import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.WorkdiaryServiceRecordDao; import com.epmet.dao.WorkdiaryServiceTypeDao; -import com.epmet.dto.IcResiUserDTO; -import com.epmet.dto.WorkdiaryServiceTypeDTO; -import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.epmet.dto.*; +import com.epmet.dto.form.GridOptionFormDTO; +import com.epmet.dto.form.LoginUserDetailsFormDTO; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; +import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.entity.WorkdiaryServiceRecordEntity; import com.epmet.excel.WorkdiaryServiceRecordExcel; +import com.epmet.excel.listener.WorkdiaryServiceImportListener; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OssFeignClient; import com.epmet.redis.WorkdiaryServiceRecordRedis; import com.epmet.service.WorkdiaryServiceRecordService; import com.epmet.service.WorkdiaryServiceTypeService; +import com.epmet.utils.ImportTaskUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; +import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -64,6 +88,34 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl> importResultDescTl = new ThreadLocal<>(); + + /** + * 导入结果描述 + */ + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class ImportResultDesc { + @ColumnWidth(20) + @ExcelProperty(value = "申请人") + private String applicantName; + + @ColumnWidth(30) + @ExcelProperty(value = "服务内容") + private String serviceContent; + + @ColumnWidth(30) + @ExcelProperty(value = "描述") + private String desc; + } + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -77,14 +129,18 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl page(String gridId, Short serviceType, String applicantName, String applicantAddress, String serviceContent, String applicantMobile, Integer pageNo, Integer pageSize) { + LoginUserDetailsResultDTO currentStaff = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(new LoginUserDetailsFormDTO( + EpmetRequestHolder.getLoginUserApp(), EpmetRequestHolder.getLoginUserClient(), EpmetRequestHolder.getLoginUserId() + )), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "查询工作人员信息失败", "查询工作人员信息失败"); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); query.eq(StringUtils.isNotBlank(gridId), WorkdiaryServiceRecordEntity::getGridId, gridId); query.eq(serviceType != null, WorkdiaryServiceRecordEntity::getServiceType, serviceType); - query.eq(WorkdiaryServiceRecordEntity::getCreatedBy, EpmetRequestHolder.getLoginUserId()); query.like(StringUtils.isNotBlank(applicantName), WorkdiaryServiceRecordEntity::getApplicantName, applicantName); query.like(StringUtils.isNotBlank(applicantAddress), WorkdiaryServiceRecordEntity::getApplicantAddress, applicantAddress); query.like(StringUtils.isNotBlank(serviceContent), WorkdiaryServiceRecordEntity::getServiceContent, serviceContent); query.like(StringUtils.isNotBlank(applicantMobile), WorkdiaryServiceRecordEntity::getApplicantMobile, applicantMobile); + query.likeRight(WorkdiaryServiceRecordEntity::getOrgIdPath, currentStaff.getOrgIdPath()); // 查找类型列表 List stList = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(null, 1, 100); @@ -246,4 +302,189 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl()); + WorkdiaryServiceImportListener listener = new WorkdiaryServiceImportListener(this); + EasyExcel.read(fileSavePath.toFile(), WorkdiaryServiceRecordExcel.class,listener).headRowNumber(1).sheet(0).doRead(); + } catch (Exception e) { + logger.error("【工作日志】-导入-未知错误:{}", ExceptionUtils.getErrorStackTrace(e)); + } finally { + // 清理临时文件 + try { + Files.deleteIfExists(fileSavePath); + } catch (IOException e) { + logger.error("【书记日志】-导入-删除导入临时文件失败,staffId:{}, 文件名称:{}, 错误信息:{}", + EpmetRequestHolder.getLoginUserId(), fileSavePath.toString(), ExceptionUtils.getErrorStackTrace(e)); + } + + // 上传错误描述文件 + try { + resultDescFileUtl = buildAndUploadResultDescFile(importResultDescTl.get()); + } catch (IOException e) { + logger.error("【工作日志】导入-生成和上传错误描述文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + + // 清理错误结果描述缓存 + importResultDescTl.remove(); + } + + + + // 修改导入记录状态为已完成 + ImportTaskUtils.finishImportTask(taskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS, resultDescFileUtl, ""); + } + + /** + * 生成和上传错误描述文件 + * @return + */ + private String buildAndUploadResultDescFile(List descs) throws IOException { + if(CollectionUtils.isEmpty(descs)) { + return null; + } + //Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表","导入失败的数据列表"), + // ImportResultDesc.class, descs); + + String fileName = System.currentTimeMillis() + "_" + EpmetRequestHolder.getLoginUserId() + ".xlsx"; + + FileItem fileItem = new DiskFileItemFactory(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD, FileUtils.getAndCreateDirUnderEpmetFilesDir("workdiary", "result_desc").toFile()) + .createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName); + + // 为了自动关闭流 + try (OutputStream os = fileItem.getOutputStream()) { + EasyExcel.write(os, ImportResultDesc.class).sheet("失败列表").doWrite(descs); + } + + UploadImgResultDTO result = getResultDataOrThrowsException(ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)), + ServiceConstant.EPMET_OSS_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "上传结果描述文件失败", "上传结果描述文件失败"); + + if (!fileItem.isInMemory()) { + fileItem.delete(); + } + return result.getUrl(); + } + + /** + * 执行批量插入 + * @param datas + */ + @Override + public void executeBatchImport(List datas) { + if (CollectionUtils.isEmpty(datas)) { + return; + } + + // 当前登录人 + LoginUserDetailsResultDTO currentStaff = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails( + new LoginUserDetailsFormDTO(EpmetRequestHolder.getLoginUserApp(), EpmetRequestHolder.getLoginUserClient(), EpmetRequestHolder.getLoginUserId())), + ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【工作日志】-导入-没有找到当前登录人信息", "【工作日志】-导入-没有找到当前登录人信息"); + + // 服务类型字典。key:养老 value:object + List serviceTypes = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).page(null, 1, 100).getList(); + Map serviceTypeMap = serviceTypes.stream().collect(Collectors.toMap(WorkdiaryServiceTypeDTO::getServiceTypeName, Function.identity())); + + ArrayList diaryRecordList = new ArrayList<>(); + + // 循环校验和填充数据 + for (WorkdiaryServiceRecordExcel row : datas) { + + String gridName = row.getGridName(); + String serviceTypeName = row.getServiceTypeName(); + String applicantName = row.getApplicantName(); + + try { + // 校验必填 + ValidatorUtils.validateEntity(row); + + // 检查服务类型 + WorkdiaryServiceTypeDTO serviceType = serviceTypeMap.get(serviceTypeName); + if (serviceType == null || serviceType.getEnabled().shortValue() == 0) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所选服务类型不存在或已禁用", "所选服务类型不存在或已禁用"); + } + + // 检查网格 + OptionResultDTO grid = findGrid(currentStaff.getAgencyId(), gridName); + if (grid == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "网格不存在,或不在您所属的组织下", "网格不存在,或不在您所属的组织下"); + } + + // 查找居民 + IcResiNonDynamicResultDTO resi = findResi(grid.getValue(), row.getApplicantName(), row.getApplicantMobile()); + + if (StringUtils.isBlank(row.getApplicantMobile())) { + row.setApplicantMobile(resi.getMobile()); + } + + // 没填写住址的,到系统查询 + if (StringUtils.isBlank(row.getApplicantAddress())) { + + HouseAgencyInfoResultDTO house = getResultDataOrThrowsException(govOrgOpenFeignClient.getHouseAgencyInfo(resi.getHomeId()), + ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "查询房屋失败", "查询房屋失败"); + + if (house == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民住址未找到", "居民未找到"); + } + + row.setApplicantAddress(house.getFullName()); + } + // 填充到entity + WorkdiaryServiceRecordEntity record = new WorkdiaryServiceRecordEntity(EpmetRequestHolder.getLoginUserCustomerId(), serviceType.getServiceType(), currentStaff.getAgencyId(), + grid.getValue(), currentStaff.getOrgIdPath().concat(":").concat(grid.getValue()), resi.getId(), row.getApplicantName(), + row.getApplicantAddress(), row.getApplicantMobile(), row.getServiceContent(), row.getServiceTime(), row.getPrincipal(), row.getRemark()); + + diaryRecordList.add(record); + } catch (ValidateException ve) { + importResultDescTl.get().add(new ImportResultDesc(applicantName, row.getServiceContent(), ve.getMsg())); + } catch (EpmetException ee) { + importResultDescTl.get().add(new ImportResultDesc(applicantName, row.getServiceContent(), ee.getMsg())); + } catch (Throwable t) { + logger.error(ExceptionUtils.getThrowableErrorStackTrace(t)); + importResultDescTl.get().add(new ImportResultDesc(applicantName, row.getServiceContent(), "未知错误")); + } + } + + // 批量持久化 + insertBatch(diaryRecordList, 50); + } + + private IcResiNonDynamicResultDTO findResi(String gridId, String applicantName, String mobile) { + PageData page = getResultDataOrThrowsException(userOpenFeignClient.listResiNonDynamic(new IcResiPageNonDynamicFormDTO(gridId, applicantName, mobile, false)), + ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民未找到", "居民未找到"); + + List list = page.getList(); + + if (page == null || CollectionUtils.isEmpty(page.getList())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民未找到", "居民未找到"); + } + + return list.get(0); + } + + /** + * 从组织下查找指定的网格名称,得到网格数据 + * @param agencyId + * @param gridName + * @return + */ + private OptionResultDTO findGrid(String agencyId, String gridName) { + List gridOptions = getResultDataOrThrowsException(govOrgOpenFeignClient.getGridOption(new GridOptionFormDTO(agencyId, "saveOrUpdate")), + ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "【工作日志】-导入-网格查询失败", "【工作日志】-导入-网格查询失败"); + + for (OptionResultDTO grid : gridOptions) { + if (gridName.equals(grid.getLabel())) { + return grid; + } + } + + return null; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..06bf284e8b4126ca92f7360d17ab57001bbc1e49 GIT binary patch literal 8961 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 C3}CVV literal 0 HcmV?d00001 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java index e6fae52bc9..434af5aed4 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.dto.form; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -11,6 +13,8 @@ import java.io.Serializable; * @Date 2021/11/12 10:54 上午 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class GridOptionFormDTO implements Serializable { /** * 部门Id diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java index d5734e2791..eff5a441d8 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java @@ -21,6 +21,7 @@ public class HouseAgencyInfoResultDTO implements Serializable { private String neighborHoodId; private String buildingId; private String buildingUnitId; + private String fullName; public HouseAgencyInfoResultDTO() { this.agencyId = ""; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 8b900c90dd..6098775330 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -393,6 +393,7 @@ h.BUILDING_UNIT_ID, nh.AGENCY_ID, nh.GRID_ID, + h.FULL_NAME, nh.AGENCY_PIDS AS pids FROM ic_house h INNER JOIN ic_neighbor_hood nh ON (nh.ID = h.NEIGHBOR_HOOD_ID AND nh.DEL_FLAG = '0') diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java new file mode 100644 index 0000000000..e5453cda85 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form.resi; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class IcResiPageNonDynamicFormDTO extends PageFormDTO { + + private String gridId; + + private String name; + + private String mobile; + + /** + * 是否模糊。true:模糊,false:精确 + */ + private Boolean fuzzy = false; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java new file mode 100644 index 0000000000..52da33987e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result.resi; + +import lombok.Data; + +/** + * 居民基础信息V2 + */ +@Data +public class IcResiNonDynamicResultDTO { + private String id; + private String name; + private String customerId; + private String agencyId; + private String gridId; + private String villageId; + private String buildId; + private String unitId; + private String homeId; + private String mobile; + private String idCard; + private String gender; + private String idCardType; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index e37454ed35..47a67e5fbd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -3,12 +3,15 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +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.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallbackFactory; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import org.springframework.cloud.openfeign.FeignClient; @@ -871,4 +874,12 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/customerstaff/customerstaff") Result> customerStaff(@RequestBody GridStaffUploadtFormDTO formDTO); + + /** + * 居民列表,非动态 + * @param input + * @return + */ + @PostMapping("/epmetuser/icresiuser/nonDynamic/listResi") + Result> listResiNonDynamic(@RequestBody IcResiPageNonDynamicFormDTO input); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 71711e66a8..7c9cc3b2a4 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -2,13 +2,16 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import org.springframework.web.bind.annotation.RequestBody; @@ -671,4 +674,8 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "customerStaff", formDTO); } + @Override + public Result> listResiNonDynamic(IcResiPageNonDynamicFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "listResiNonDynamic", input); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 7604ebc5c7..9b0fe3324c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -55,8 +55,10 @@ import com.epmet.constant.SystemMessageType; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.PartyMemberAgeExportExcel; import com.epmet.excel.PartyMemberEducationExportExcel; @@ -1371,4 +1373,23 @@ public class IcResiUserController implements ResultDataResolver { return new Result().ok(icResiUserService.icUserMatchGrid(formDTO)); } + /** + * 居民列表分页查询 非动态 + * @param input + * @return + */ + @PostMapping("/nonDynamic/listResi") + public Result> listResiNonDynamic(@RequestBody IcResiPageNonDynamicFormDTO input) { + + String gridId = input.getGridId(); + String name = input.getName(); + Integer pageNo = input.getPageNo(); + Integer pageSize = input.getPageSize(); + Boolean fuzzy = input.getFuzzy(); + String mobile = input.getMobile(); + + PageData page = icResiUserService.listResiNonDynamic(fuzzy, gridId, name, mobile, pageNo, pageSize); + return new Result>().ok(page); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 37cf258e14..8975e06443 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -26,6 +26,7 @@ import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.entity.IcResiUserEntity; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; @@ -505,4 +506,5 @@ public interface IcResiUserService extends BaseService { */ IcUserMatchGridResultDTO icUserMatchGrid(IcUserMatchGridFormDTO formDTO); + PageData listResiNonDynamic(Boolean fuzzy, String gridId, String name, String mobile, Integer pageNo, Integer pageSize); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index d8f57e4e81..ce30430738 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -63,6 +63,7 @@ import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.entity.*; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.feign.*; @@ -3312,4 +3313,21 @@ public class IcResiUserServiceImpl extends BaseServiceImpl" + customer); return customer; } + + @Override + public PageData listResiNonDynamic(Boolean fuzzy, String gridId, String name, String mobile, Integer pageNo, Integer pageSize) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + query.eq(StringUtils.isNotBlank(gridId), IcResiUserEntity::getGridId, gridId); + // 一个模糊一个精确 + query.eq((!fuzzy && StringUtils.isNotBlank(name)), IcResiUserEntity::getName, name); + query.like((fuzzy && StringUtils.isNotBlank(name)), IcResiUserEntity::getName, name); + + query.eq((!fuzzy && StringUtils.isNotBlank(mobile)), IcResiUserEntity::getMobile, mobile); + query.like((fuzzy && StringUtils.isNotBlank(mobile)), IcResiUserEntity::getMobile, mobile); + + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.selectList(query).stream().map((e) -> ConvertUtils.sourceToTarget(e, IcResiNonDynamicResultDTO.class)).collect(Collectors.toList()); + return new PageData(list, new PageInfo<>(list).getTotal(), pageSize); + } } From 9df28cdbe9232f58da3105429af8a64aa6af833e Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 26 Aug 2022 14:30:14 +0800 Subject: [PATCH 17/23] - --- .../java/com/epmet/controller/WorkdiaryServiceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index 31a9b61af6..ab69929616 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -158,7 +158,7 @@ public class WorkdiaryServiceController implements ResultDataResolver { * 下载模板 * @return */ - @RequestMapping("downloadTemplate") + @RequestMapping("/record/downloadTemplate") public void downloadTemplate(HttpServletResponse response) throws UnsupportedEncodingException { response.setCharacterEncoding("UTF-8"); response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); From 9a103d3ea960cfd801963876451ee0c141876dcb Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 26 Aug 2022 15:51:09 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E3=80=90?= =?UTF-8?q?=E4=B9=A6=E8=AE=B0=E6=97=A5=E5=BF=97=E3=80=91=E5=AF=BC=E5=85=A5?= =?UTF-8?q?-=E5=A2=9E=E5=8A=A0=E8=BA=AB=E4=BB=BD=E8=AF=81=E5=8F=B7?= =?UTF-8?q?=E3=80=82=E6=9C=8D=E5=8A=A1=E6=97=B6=E9=97=B4=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BAdatetime=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkdiaryServiceQueryFormDTO.java | 12 ++++ .../dto/result/WorkdiaryServiceRecordDTO.java | 10 ++- .../WorkdiaryServiceController.java | 11 ++- .../entity/WorkdiaryServiceRecordEntity.java | 7 +- .../excel/WorkdiaryServiceRecordExcel.java | 35 +++++++--- .../WorkdiaryServiceRecordService.java | 6 +- .../WorkdiaryServiceRecordServiceImpl.java | 64 ++++++++++++++---- .../mapper/WorkdiaryServiceRecordDao.xml | 1 + .../templates/workdiary_service_import.xlsx | Bin 8961 -> 8951 bytes 9 files changed, 116 insertions(+), 30 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java index 2f5a628916..3d581924a3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/workdiaryservice/WorkdiaryServiceQueryFormDTO.java @@ -1,7 +1,11 @@ package com.epmet.dto.form.workdiaryservice; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; /** * 工作日志-服务 @@ -23,4 +27,12 @@ public class WorkdiaryServiceQueryFormDTO extends PageFormDTO { //private Date serviceTime; private String remark; + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date serviceTimeStart; + + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date serviceTimeEnd; + } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java index 98d4eacb1e..8e75f55c34 100755 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/WorkdiaryServiceRecordDTO.java @@ -4,7 +4,9 @@ import java.io.Serializable; import java.util.Date; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -65,6 +67,8 @@ public class WorkdiaryServiceRecordDTO implements Serializable { @NotBlank(message = "申请人为必填项", groups = { Save.class }) private String applicantId; + private String applicantIdCard; + /** * 申请人姓名 */ @@ -91,8 +95,10 @@ public class WorkdiaryServiceRecordDTO implements Serializable { /** * 服务时间 */ - @NotBlank(message = "服务时间为必填项", groups = { Save.class }) - private String serviceTime; + @NotNull(message = "服务时间为必填项", groups = { Save.class }) + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date serviceTime; /** * 负责人姓名 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java index ab69929616..230e3617ee 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceController.java @@ -43,6 +43,7 @@ import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.file.Path; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -83,9 +84,11 @@ public class WorkdiaryServiceController implements ResultDataResolver { String applicantMobile = query.getApplicantMobile(); Integer pageNo = query.getPageNo(); Integer pageSize = query.getPageSize(); + Date startTime = query.getServiceTimeStart(); + Date endTime = query.getServiceTimeEnd(); PageData page = workdiaryServiceRecordService.page( - gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, pageNo, pageSize); + gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, startTime, endTime, pageNo, pageSize); return new Result>().ok(page); } @@ -151,7 +154,11 @@ public class WorkdiaryServiceController implements ResultDataResolver { String applicantAddress = query.getApplicantAddress(); String serviceContent = query.getServiceContent(); String applicantMobile = query.getApplicantMobile(); - workdiaryServiceRecordService.export(gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, response); + Date serviceTimeStart = query.getServiceTimeStart(); + Date serviceTimeEnd = query.getServiceTimeEnd(); + + workdiaryServiceRecordService.export(gridId, serviceType, applicantName, applicantAddress, serviceContent, + applicantMobile, serviceTimeStart, serviceTimeEnd, response); } /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java index 16db6c8bc5..a72064b8cd 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceRecordEntity.java @@ -55,6 +55,11 @@ public class WorkdiaryServiceRecordEntity extends BaseEpmetEntity { */ private String applicantId; + /** + * 证件号 + */ + private String applicantIdCard; + /** * 申请人姓名 */ @@ -78,7 +83,7 @@ public class WorkdiaryServiceRecordEntity extends BaseEpmetEntity { /** * 服务时间 */ - private String serviceTime; + private Date serviceTime; /** * 负责人姓名 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java index 631c3ed943..07b2b19797 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -1,12 +1,18 @@ package com.epmet.excel; +import cn.hutool.core.bean.BeanUtil; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; /** * 工作日志(服务)-记录 excel @@ -33,6 +39,10 @@ public class WorkdiaryServiceRecordExcel { @ExcelProperty(value = "申请人") private String applicantName; + @ColumnWidth(10) + @ExcelProperty(value = "证件号") + private String applicantIdCard; + @ColumnWidth(25) @ExcelProperty(value = "住址") private String applicantAddress; @@ -50,24 +60,27 @@ public class WorkdiaryServiceRecordExcel { @ExcelProperty(value = "负责人") private String principal; - @NotBlank(message = "服务时间必填") + @NotNull(message = "服务时间必填") @ColumnWidth(10) @ExcelProperty(value = "服务时间") - private String serviceTime; + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date serviceTime; @ColumnWidth(20) @ExcelProperty(value = "备注") private String remark; public WorkdiaryServiceRecordExcel(WorkdiaryServiceRecordDTO dto) { - this.gridName = dto.getGridName(); - this.serviceTypeName = dto.getServiceTypeName(); - this.applicantName = dto.getApplicantName(); - this.applicantAddress = dto.getApplicantAddress(); - this.serviceContent = dto.getServiceContent(); - this.applicantMobile = dto.getApplicantMobile(); - this.principal = dto.getPrincipalName(); - this.serviceTime = dto.getServiceTime(); - this.remark = dto.getRemark(); + BeanUtil.copyProperties(dto, this); + //this.gridName = dto.getGridName(); + //this.serviceTypeName = dto.getServiceTypeName(); + //this.applicantName = dto.getApplicantName(); + //this.applicantAddress = dto.getApplicantAddress(); + //this.serviceContent = dto.getServiceContent(); + //this.applicantMobile = dto.getApplicantMobile(); + //this.principal = dto.getPrincipalName(); + //this.serviceTime = dto.getServiceTime(); + //this.remark = dto.getRemark(); } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java index 4dfc2f3cb5..f574f47f17 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceRecordService.java @@ -9,6 +9,7 @@ import com.epmet.excel.WorkdiaryServiceRecordExcel; import javax.servlet.http.HttpServletResponse; import java.nio.file.Path; +import java.util.Date; import java.util.List; import java.util.Map; @@ -31,7 +32,8 @@ public interface WorkdiaryServiceRecordService extends BaseService page(Map params); PageData page(String gridId, Short serviceType, String applicantName, String applicantAddress, - String serviceContent, String applicantMobile, Integer pageNo, Integer pageSize); + String serviceContent, String applicantMobile, Date serviceTimeStart, Date serviceTimeEnd, + Integer pageNo, Integer pageSize); /** * 默认查询 @@ -84,7 +86,7 @@ public interface WorkdiaryServiceRecordService extends BaseService page(String gridId, Short serviceType, String applicantName, String applicantAddress, - String serviceContent, String applicantMobile, Integer pageNo, Integer pageSize) { + String serviceContent, String applicantMobile, Date serviceTimeStart, Date serviceTimeEnd, + Integer pageNo, Integer pageSize) { LoginUserDetailsResultDTO currentStaff = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(new LoginUserDetailsFormDTO( EpmetRequestHolder.getLoginUserApp(), EpmetRequestHolder.getLoginUserClient(), EpmetRequestHolder.getLoginUserId() @@ -142,6 +144,13 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl stList = SpringContextUtils.getBean(WorkdiaryServiceTypeService.class).list(null, 1, 100); Map stMap = stList.stream().collect(Collectors.toMap(WorkdiaryServiceTypeDTO::getServiceType, WorkdiaryServiceTypeDTO::getServiceTypeName)); @@ -182,12 +191,28 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl { - entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId())); - entity.setAgencyId(gi.getPid()); - }); + LoginUserDetailsResultDTO currentStaff = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(new LoginUserDetailsFormDTO( + EpmetRequestHolder.getLoginUserApp(), EpmetRequestHolder.getLoginUserClient(), EpmetRequestHolder.getLoginUserId() + )), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "查询工作人员信息失败", "查询工作人员信息失败"); + + String staffOrgIdPath = currentStaff.getOrgIdPath(); + + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId()); + + if (gridInfo == null) { + // 说明网格是其他组织下的 + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "网格未找到", "网格未找到"); + } + + String gridOrgIdPath = gridInfo.getPids().concat(":").concat(gridInfo.getId()); + + if (!gridOrgIdPath.contains(staffOrgIdPath)) { + // 说明网格是其他组织下的 + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所选网格不在您所属组织下", "所选网格不在您所属组织下"); + } + + entity.setOrgIdPath(gridOrgIdPath); + entity.setAgencyId(gridInfo.getPid()); IcResiUserDTO applicant = getResultDataOrThrowsException(userOpenFeignClient.getIcResiUserDTO(dto.getApplicantId()), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到申请人信息"); @@ -215,6 +240,7 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl page = this.page(gridId, serviceType, applicantName, applicantAddress, serviceContent, applicantMobile, pageNo, pageSize); + PageData page = this.page(gridId, serviceType, applicantName, applicantAddress, serviceContent, + applicantMobile, serviceTimeStart, serviceTimeEnd, pageNo, pageSize); + List list = page.getList(); if (CollectionUtils.isEmpty(list)) { // 空的,导出结束 @@ -437,9 +465,21 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx index 06bf284e8b4126ca92f7360d17ab57001bbc1e49..0938c354cfd89f0ea9a8469f8c6c10544e664500 100644 GIT binary patch delta 4212 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 K2HG9~0001T#RkOy delta 4232 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 Date: Fri, 26 Aug 2022 16:02:02 +0800 Subject: [PATCH 19/23] - --- .../main/resources/db/migration/V0.0.28__workdiary_service.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql index 7631087ce3..0b42aeac0f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql @@ -12,7 +12,7 @@ CREATE TABLE `workdiary_service_record` `APPLICANT_ADDRESS` varchar(32) NOT NULL COMMENT '申请人住址', `APPLICANT_MOBILE` varchar(20) NOT NULL COMMENT '申请人联系电话', `SERVICE_CONTENT` varchar(255) NOT NULL COMMENT '服务内容', - `SERVICE_TIME` varchar(32) NOT NULL COMMENT '服务时间', + `SERVICE_TIME` datetime NOT NULL COMMENT '服务时间', `PRINCIPAL_NAME` varchar(10) NOT NULL COMMENT '负责人姓名', `REMARK` varchar(255) NOT NULL COMMENT '备注', `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', From 058281d66c172d29d009c90454fbd1ef4db129a1 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 26 Aug 2022 16:10:16 +0800 Subject: [PATCH 20/23] - --- .../main/resources/db/migration/V0.0.28__workdiary_service.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql index 0b42aeac0f..010a22ac54 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.28__workdiary_service.sql @@ -8,6 +8,7 @@ CREATE TABLE `workdiary_service_record` `GRID_ID` varchar(32) NOT NULL COMMENT '网格ID', `ORG_ID_PATH` varchar(255) NOT NULL COMMENT '组织ID path', `APPLICANT_ID` varchar(32) NOT NULL COMMENT '申请人ID', + `APPLICANT_ID_CARD` varchar(32) NOT NULL COMMENT '申请人证件号', `APPLICANT_NAME` varchar(32) NOT NULL COMMENT '申请人姓名', `APPLICANT_ADDRESS` varchar(32) NOT NULL COMMENT '申请人住址', `APPLICANT_MOBILE` varchar(20) NOT NULL COMMENT '申请人联系电话', From 06a357c2bf30e3288c7e1b546426c5a9585e0eec Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 26 Aug 2022 16:59:46 +0800 Subject: [PATCH 21/23] 1231 --- .../poi/excel/converter/DateConverter.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java new file mode 100644 index 0000000000..6fae39280d --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java @@ -0,0 +1,47 @@ +package com.epmet.commons.tools.utils.poi.excel.converter; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/8/26 4:59 下午 + * @version: 1.0 + */ + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +import java.text.SimpleDateFormat; +import java.util.Date; + +package com.lxj.common.convert; + +/** + * @Author: liujianjun + * @Date: 2022/7/19 + * @Description: yyyy-MM-dd easyExcel 日期转换 + */ +public class DateConverter implements Converter { + + private static final String PATTERN_YYYY_MM_DD = "yyyy-MM-dd"; + + @Override + public Class supportJavaTypeKey() { + return Converter.super.supportJavaTypeKey(); + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return Converter.super.supportExcelTypeKey(); + } + + @Override + public WriteCellData convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); + String dateValue = sdf.format(value); + return new WriteCellData<>(dateValue); + } +} From ef161352e58dab2b1d294cbcedb26572594d337e Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 26 Aug 2022 17:11:00 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=87=BA=EF=BC=8C?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=BD=AC=E6=8D=A2=E5=99=A8=E3=80=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=94=99=E8=AF=AF=E7=9A=84sql=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...erter.java => EasyExcelDateConverter.java} | 6 ++---- .../excel/WorkdiaryServiceRecordExcel.java | 19 +++---------------- .../WorkdiaryServiceImportListener.java | 2 +- .../migration/V0.0.28__workdiary_service.sql | 6 +++--- 4 files changed, 9 insertions(+), 24 deletions(-) rename epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/{DateConverter.java => EasyExcelDateConverter.java} (93%) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java similarity index 93% rename from epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java index 6fae39280d..74196eb43f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/DateConverter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java @@ -17,14 +17,12 @@ import com.alibaba.excel.metadata.property.ExcelContentProperty; import java.text.SimpleDateFormat; import java.util.Date; -package com.lxj.common.convert; - /** * @Author: liujianjun * @Date: 2022/7/19 * @Description: yyyy-MM-dd easyExcel 日期转换 */ -public class DateConverter implements Converter { +public class EasyExcelDateConverter implements Converter { private static final String PATTERN_YYYY_MM_DD = "yyyy-MM-dd"; @@ -44,4 +42,4 @@ public class DateConverter implements Converter { String dateValue = sdf.format(value); return new WriteCellData<>(dateValue); } -} +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java index 07b2b19797..917fa6f2ce 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -3,12 +3,10 @@ package com.epmet.excel; import cn.hutool.core.bean.BeanUtil; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; -import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.poi.excel.converter.EasyExcelDateConverter; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; -import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -61,10 +59,8 @@ public class WorkdiaryServiceRecordExcel { private String principal; @NotNull(message = "服务时间必填") - @ColumnWidth(10) - @ExcelProperty(value = "服务时间") - @DateTimeFormat(pattern = "yyyy-MM-dd") - @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ColumnWidth(20) + @ExcelProperty(value = "服务时间", converter = EasyExcelDateConverter.class) private Date serviceTime; @ColumnWidth(20) @@ -73,14 +69,5 @@ public class WorkdiaryServiceRecordExcel { public WorkdiaryServiceRecordExcel(WorkdiaryServiceRecordDTO dto) { BeanUtil.copyProperties(dto, this); - //this.gridName = dto.getGridName(); - //this.serviceTypeName = dto.getServiceTypeName(); - //this.applicantName = dto.getApplicantName(); - //this.applicantAddress = dto.getApplicantAddress(); - //this.serviceContent = dto.getServiceContent(); - //this.applicantMobile = dto.getApplicantMobile(); - //this.principal = dto.getPrincipalName(); - //this.serviceTime = dto.getServiceTime(); - //this.remark = dto.getRemark(); } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java index bc09d401d0..1adb672911 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java @@ -19,7 +19,7 @@ public class WorkdiaryServiceImportListener implements ReadListener Date: Fri, 26 Aug 2022 18:21:35 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E3=80=91-fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../converter/EasyExcelDateConverter.java | 6 +++++ .../excel/WorkdiaryServiceRecordExcel.java | 12 ++++++--- .../WorkdiaryServiceImportListener.java | 4 +-- .../WorkdiaryServiceRecordServiceImpl.java | 25 +++++++++++++++++-- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java index 74196eb43f..b3c1d207d4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java @@ -42,4 +42,10 @@ public class EasyExcelDateConverter implements Converter { String dateValue = sdf.format(value); return new WriteCellData<>(dateValue); } + + //@Override + //public Date convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + // SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); + // return sdf.parse(cellData.getStringValue()); + //} } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java index 917fa6f2ce..13a9afdfdd 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/WorkdiaryServiceRecordExcel.java @@ -2,9 +2,12 @@ package com.epmet.excel; import cn.hutool.core.bean.BeanUtil; import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.poi.excel.converter.EasyExcelDateConverter; import com.epmet.dto.result.WorkdiaryServiceRecordDTO; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.NoArgsConstructor; @@ -56,12 +59,14 @@ public class WorkdiaryServiceRecordExcel { @ColumnWidth(10) @ExcelProperty(value = "负责人") - private String principal; + private String principalName; @NotNull(message = "服务时间必填") @ColumnWidth(20) - @ExcelProperty(value = "服务时间", converter = EasyExcelDateConverter.class) - private Date serviceTime; + @ExcelProperty(value = "服务时间") + //@DateTimeFormat("yyyy-MM-dd") + //@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private String serviceTime; @ColumnWidth(20) @ExcelProperty(value = "备注") @@ -69,5 +74,6 @@ public class WorkdiaryServiceRecordExcel { public WorkdiaryServiceRecordExcel(WorkdiaryServiceRecordDTO dto) { BeanUtil.copyProperties(dto, this); + this.serviceTime = DateUtils.format(dto.getServiceTime()); } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java index 1adb672911..0f98babccc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/listener/WorkdiaryServiceImportListener.java @@ -1,7 +1,7 @@ package com.epmet.excel.listener; import com.alibaba.excel.context.AnalysisContext; -import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.excel.event.AnalysisEventListener; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.excel.WorkdiaryServiceRecordExcel; import com.epmet.service.WorkdiaryServiceRecordService; @@ -14,7 +14,7 @@ import java.util.List; * 工作日志-导入-监听器 */ @Slf4j -public class WorkdiaryServiceImportListener implements ReadListener { +public class WorkdiaryServiceImportListener extends AnalysisEventListener { /** * 200 一批执行导入 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java index 907018fc1f..f44d157e22 100755 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java @@ -61,6 +61,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotNull; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; @@ -464,6 +465,26 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl