From 7d790f8e83591eecbc9659e43a18b0a3cd02657c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 19 Nov 2021 09:40:01 +0800 Subject: [PATCH] emm --- .../AddCommunitySelfOrganizationFormDTO.java | 75 +++++++++++++++++++ .../IcCommunitySelfOrganizationConstant.java | 11 +++ ...IcCommunitySelfOrganizationController.java | 18 +++++ .../IcCommunitySelfOrganizationEntity.java | 7 +- .../IcCommunitySelfOrganizationService.java | 11 +++ ...cCommunitySelfOrganizationServiceImpl.java | 50 +++++++++++++ 6 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java new file mode 100644 index 0000000000..a0c1cb762d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java @@ -0,0 +1,75 @@ +package com.epmet.dto.form; + +import com.epmet.dto.IcCommunitySelfOrganizationPersonnelDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/11/18 5:32 下午 + * @DESC + */ +@Data +public class AddCommunitySelfOrganizationFormDTO implements Serializable { + + private static final long serialVersionUID = -4996925380900678065L; + + public interface AddCommunitySelfOrganizationForm{} + + /** + * 组织名称 + */ + @NotBlank(message = "organizationName不能为空",groups = AddCommunitySelfOrganizationForm.class) + private String organizationName; + + /** + * 组织人数 + */ + @NotNull(message = "organizationPersonCount不能为空",groups = AddCommunitySelfOrganizationForm.class) + private Integer organizationPersonCount; + + /** + * 负责人姓名 + */ + @NotBlank(message = "principalName不能为空",groups = AddCommunitySelfOrganizationForm.class) + private String principalName; + + /** + * 负责人电话 + */ + @NotBlank(message = "principalPhone不能为空",groups = AddCommunitySelfOrganizationForm.class) + private String principalPhone; + + /** + * 服务事项 + */ + @NotBlank(message = "serviceItem不能为空",groups = AddCommunitySelfOrganizationForm.class) + private String serviceItem; + + /** + * 社区自组织创建时间 + */ + private Date organizationCreatedTime; + + /** + * 经度 + */ + @NotBlank(message = "longitude不能为空",groups = AddCommunitySelfOrganizationForm.class) + private String longitude; + + /** + * 纬度 + */ + @NotBlank(message = "latitude不能为空",groups = AddCommunitySelfOrganizationForm.class) + private String latitude; + + /** + * 社区自组织人员 + */ + private List organizationPersonnel; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java new file mode 100644 index 0000000000..ffd87124bf --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/IcCommunitySelfOrganizationConstant.java @@ -0,0 +1,11 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/11/19 8:39 上午 + * @DESC + */ +public interface IcCommunitySelfOrganizationConstant { + + String ORG_TYPE_AGENCY = "agency"; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java index acab1c9611..3093b70b91 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java @@ -17,7 +17,10 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -26,6 +29,7 @@ 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.IcCommunitySelfOrganizationDTO; +import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO; import com.epmet.excel.IcCommunitySelfOrganizationExcel; import com.epmet.service.IcCommunitySelfOrganizationService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +95,18 @@ public class IcCommunitySelfOrganizationController { ExcelUtils.exportExcelToTarget(response, null, list, IcCommunitySelfOrganizationExcel.class); } + /** + * @Description 添加社区自组织 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2021/11/19 8:33 上午 + */ + @PostMapping("addcommunityselforganization") + public Result addCommunitySelfOrganization(@LoginUser TokenDto tokenDto, @RequestBody AddCommunitySelfOrganizationFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddCommunitySelfOrganizationFormDTO.AddCommunitySelfOrganizationForm.class); + icCommunitySelfOrganizationService.addCommunitySelfOrganization(tokenDto, formDTO); + return new Result(); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java index 4d3515e7ff..9e06cb48c3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java @@ -17,9 +17,12 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; @@ -91,7 +94,9 @@ public class IcCommunitySelfOrganizationEntity extends BaseEpmetEntity { /** * 社区自组织创建时间 */ - private Date organizationCreatedTime; + @TableField(fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date organizationCreatedTime; /** * 经度 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java index 353ed2e6d8..4133c7c103 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java @@ -19,7 +19,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcCommunitySelfOrganizationDTO; +import com.epmet.dto.form.AddCommunitySelfOrganizationFormDTO; import com.epmet.entity.IcCommunitySelfOrganizationEntity; import java.util.List; @@ -92,4 +94,13 @@ public interface IcCommunitySelfOrganizationService extends BaseService implements IcCommunitySelfOrganizationService { + @Autowired + private IcCommunitySelfOrganizationPersonnelService personnelService; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -80,4 +95,39 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); + persons.forEach(p -> { + p.setCustomerId(customerId); + p.setOrgId(orgEntity.getId()); + }); + personnelService.insertBatch(persons); + } + } + } \ No newline at end of file