From a905e8c82632cc14c7bf8c68307ad39b362a11e3 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 19 Oct 2021 15:33:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=8B=E8=A1=8C=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/GridUserWorkDTO.java | 6 +-- .../epmet/dto/form/GridUserWorkFormDTO.java | 49 +++++++++++++++++++ .../controller/GridUserWorkController.java | 18 ++++++- .../com/epmet/entity/GridUserWorkEntity.java | 6 +-- .../epmet/service/GridUserWorkService.java | 9 ++++ .../service/impl/GridUserWorkServiceImpl.java | 37 ++++++++++++++ 6 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java index 8cb632f6bc..78701ffd9a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java @@ -54,12 +54,12 @@ public class GridUserWorkDTO implements Serializable { private String gridName; /** - * 组织名称 + * 组织ID */ - private String orgId; + private String parentOrgId; /** - * 组织名称 xx社区-xx网格 + * 组织名称 */ private String orgName; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java new file mode 100644 index 0000000000..5841f761f4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2021/10/19 10:41 上午 + * @DESC + */ +@Data +public class GridUserWorkFormDTO implements Serializable { + + private static final long serialVersionUID = -2328321123796674558L; + + public interface GridUserWorkForm{} + + @NotBlank(message = "网格ID不能为空",groups = GridUserWorkForm.class) + private String gridId; + + @NotBlank(message = "例行工作类型不能为空",groups = GridUserWorkForm.class) + private String workType; + + @NotBlank(message = "例行工作类型名字不能为空",groups = GridUserWorkForm.class) + private String workTypeName; + + /** + * Y:是、N:否 + */ + @NotBlank(message = "有无变动(异常)不能为空",groups = GridUserWorkForm.class) + private String workResult; + + @NotNull(message = "发生时间不能为空",groups = GridUserWorkForm.class) + private Date happenTime; + + /** + * 备注说明 + */ + private String workContent; + + /** + * 基础信息ID【相关信息】 + */ + private String baseInfoId; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java index 33eb35bb46..2f32331d0f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java @@ -1,5 +1,9 @@ package com.epmet.controller; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.GridUserWorkFormDTO; import com.epmet.service.GridUserWorkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -17,6 +21,18 @@ public class GridUserWorkController { @Autowired private GridUserWorkService gridUserWorkService; - + /** + * @Description 网格员例行工作 + * @param formDTO + * @author zxc + * @date 2021/10/19 1:35 下午 + */ + @NoRepeatSubmit + @PostMapping("griduserwork") + public Result gridUserWork(@RequestBody GridUserWorkFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GridUserWorkFormDTO.GridUserWorkForm.class); + gridUserWorkService.gridUserWork(formDTO); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java index 81b54fbf02..25469ff30d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java @@ -54,12 +54,12 @@ public class GridUserWorkEntity extends BaseEpmetEntity { private String gridName; /** - * 组织名称 + * 组织ID */ - private String orgId; + private String parentOrgId; /** - * 组织名称 xx社区-xx网格 + * 组织名称 */ private String orgName; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java index c5dc23b976..8ce3cc5a10 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.GridUserWorkDTO; +import com.epmet.dto.form.GridUserWorkFormDTO; import com.epmet.entity.GridUserWorkEntity; import java.util.List; @@ -75,4 +76,12 @@ public interface GridUserWorkService extends BaseService { * @date 2021-10-19 */ void delete(String[] ids); + + /** + * @Description 网格员例行工作 + * @param formDTO + * @author zxc + * @date 2021/10/19 1:35 下午 + */ + void gridUserWork(GridUserWorkFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java index bcaf16f379..0a4df06acc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java @@ -3,14 +3,21 @@ 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.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.GridUserWorkDao; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.GridUserWorkDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.GridUserWorkFormDTO; import com.epmet.entity.GridUserWorkEntity; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.GridUserWorkService; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,6 +34,9 @@ import java.util.Map; @Service public class GridUserWorkServiceImpl extends BaseServiceImpl implements GridUserWorkService { + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -79,4 +89,31 @@ public class GridUserWorkServiceImpl extends BaseServiceImpl gridBaseInfoData = govOrgOpenFeignClient.getGridBaseInfoByGridId(gridFormDTO); + if (!gridBaseInfoData.success()){ + throw new RenException("查询网格基本信息失败......"); + } + CustomerGridDTO gridBaseInfo = gridBaseInfoData.getData(); + entity.setGridName(gridBaseInfo.getGridName()); + // 暂时为 哈哈,后期缓存加上 gridCode在修改 + entity.setGridCode("哈哈"); + entity.setCustomerId(gridBaseInfo.getCustomerId()); + entity.setParentOrgId(gridBaseInfo.getPid()); + entity.setOrgName(gridBaseInfo.getAgencyName()); + entity.setPids(gridBaseInfo.getPids()); + baseDao.insert(entity); + } + } \ No newline at end of file