From 91f3e65d30836be1726b15bd688dc80550e9112d Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Tue, 23 Aug 2022 16:46:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=BF=97-?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E3=80=91=E5=88=9D=E5=A7=8B=E6=8F=90=E4=BA=A4?= =?UTF-8?q?-=E6=8F=90=E4=BA=A4=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=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