diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 3f23ee88c8..bfea4bbbb8 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -198,6 +198,7 @@ public class ThirdLoginController { * * @param formDTO * @return + * 目前烟台用的这个!!!!!! */ @PostMapping("resilogin-internalding") public Result resiLoginInternalDing(@RequestBody DingAppLoginMdFormDTO formDTO) { diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java new file mode 100644 index 0000000000..45b27c1eba --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCommentDTO.java @@ -0,0 +1,100 @@ +package com.epmet.dto; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Data +public class IssueCommentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 议题ID + */ + @NotBlank(message = "issueId不能为空",groups = AddUserInternalGroup.class) + private String issueId; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 评论内容至多200字 + */ + @Length(max = 200,message = "评论内容最多输入200字",groups = AddUserShowGroup.class) + @NotBlank(message = "content不能为空",groups = AddUserInternalGroup.class) + private String content; + + /** + * 评论用户id + */ + private String userId; + + /** + * 姓名 + */ + private String userName; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + private String commentId; + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java new file mode 100644 index 0000000000..90e7fa79a8 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCommentPageFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description + * @Author yzm + * @Date 2023/2/2 13:45 + */ +@Data +public class IssueCommentPageFormDTO extends PageFormDTO { + @NotBlank(message = "issueId不能为空",groups = AddUserInternalGroup.class) + private String issueId; +} + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java new file mode 100644 index 0000000000..f579c9d1fe --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCommentController.java @@ -0,0 +1,61 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.dto.form.IssueCommentPageFormDTO; +import com.epmet.service.IssueCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 议题评论表 + * 目前只有烟台客户,钉钉居民端,议事厅,可以发表评论 + * 产品没有此功能 + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@RestController +@RequestMapping("issuecomment") +public class IssueCommentController { + + @Autowired + private IssueCommentService issueCommentService; + + /** + * 议题评论列表 + * @param formDTO + * @return + */ + @RequestMapping("page") + public Result> page(@RequestBody IssueCommentPageFormDTO formDTO){ + PageData page = issueCommentService.page(formDTO); + return new Result>().ok(page); + } + + /** + * 议题评论 + * @param tokenDto + * @param dto + * @return + */ + @NoRepeatSubmit + @PostMapping("save") + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IssueCommentDTO dto){ + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(dto,IssueCommentDTO.AddUserShowGroup.class,IssueCommentDTO.AddUserInternalGroup.class); + issueCommentService.save(dto); + return new Result(); + } + + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java new file mode 100644 index 0000000000..beaca75c6a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCommentDao.java @@ -0,0 +1,20 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.entity.IssueCommentEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Mapper +public interface IssueCommentDao extends BaseDao { + + List selectCommentList(String issueId); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java new file mode 100644 index 0000000000..4ad01c7038 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCommentEntity.java @@ -0,0 +1,54 @@ +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 2023-02-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_comment") +public class IssueCommentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 议题ID + */ + private String issueId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 评论内容至多200字 + */ + private String content; + + /** + * 评论用户id + */ + private String userId; + + /** + * 姓名 + */ + private String userName; + + /** + * 头像 + */ + private String headPhoto; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java new file mode 100644 index 0000000000..3fa35a8077 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCommentService.java @@ -0,0 +1,37 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.dto.form.IssueCommentPageFormDTO; +import com.epmet.entity.IssueCommentEntity; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +public interface IssueCommentService extends BaseService { + + /** + * 默认分页 + * + * @param formDTO + * @return PageData + * @author generator + * @date 2023-02-02 + */ + PageData page(IssueCommentPageFormDTO formDTO); + + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2023-02-02 + */ + void save(IssueCommentDTO dto); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java new file mode 100644 index 0000000000..863c589f82 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCommentServiceImpl.java @@ -0,0 +1,72 @@ +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IssueCommentDao; +import com.epmet.dto.IssueCommentDTO; +import com.epmet.dto.form.IssueCommentPageFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.entity.IssueCommentEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.service.IssueCommentService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 议题评论表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-02 + */ +@Service +public class IssueCommentServiceImpl extends BaseServiceImpl implements IssueCommentService { + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + + /** + * 议题评论列表 + * @param formDTO + * @return + */ + @Override + public PageData page(IssueCommentPageFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = baseDao.selectCommentList(formDTO.getIssueId()); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 议题评论 + * 需求来源于烟台:https://modao.cc/app/Uz9nPVerhvcupzLnhoiY#screen=sl8mfpxd863xmb5 + * @param dto + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueCommentDTO dto) { + //查询用户信息 + List userIdList=new ArrayList<>(); + userIdList.add(dto.getUserId()); + Result> userInfoRes= userOpenFeignClient.queryUserBaseInfo(userIdList); + if(!userInfoRes.success()|| CollectionUtils.isEmpty(userInfoRes.getData())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询用户信息异常userId:"+dto.getUserId(),"查询用户信息异常"); + } + IssueCommentEntity entity = ConvertUtils.sourceToTarget(dto, IssueCommentEntity.class); + entity.setHeadPhoto(userInfoRes.getData().get(NumConstant.ZERO).getHeadImgUrl()); + entity.setUserName(userInfoRes.getData().get(NumConstant.ZERO).getRealName()); + insert(entity); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.21__issue_comment.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.21__issue_comment.sql new file mode 100644 index 0000000000..3897a5369d --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/V0.0.21__issue_comment.sql @@ -0,0 +1,16 @@ +CREATE TABLE `issue_comment` ( + `ID` varchar(32) NOT NULL COMMENT '主键ID', + `ISSUE_ID` varchar(32) NOT NULL COMMENT '议题ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `CONTENT` varchar(255) NOT NULL COMMENT '评论内容至多200字', + `USER_ID` varchar(64) NOT NULL COMMENT '评论用户id', + `USER_NAME` varchar(64) DEFAULT NULL COMMENT '姓名', + `HEAD_PHOTO` varchar(255) DEFAULT NULL COMMENT '头像', + `DEL_FLAG` varchar(2) 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='议题评论表'; \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml new file mode 100644 index 0000000000..fc7676ed60 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCommentDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPropertyManagementDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPropertyManagementDTO.java index 3554df553f..a276e36387 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPropertyManagementDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPropertyManagementDTO.java @@ -43,6 +43,10 @@ public class IcPropertyManagementDTO implements Serializable { * 物业名称 */ private String name; + /** + * 客户id + */ + private String customerId; /** * 删除标识 0未删除、1已删除 @@ -73,5 +77,8 @@ public class IcPropertyManagementDTO implements Serializable { * 更新时间 */ private Date updatedTime; - + /** + * 关联的小区数量 + */ + private Integer totalNeighborHood; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java index 63ea329d22..bbc2cd7152 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcPropertyManagementFormDTO.java @@ -22,6 +22,7 @@ import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; @@ -39,6 +40,8 @@ public class IcPropertyManagementFormDTO implements Serializable { public interface UpdateShowGroup extends CustomerClientShowGroup { } + public interface PageGroup extends CustomerClientShowGroup { + } @NotBlank(message = "物业id不能为空", groups = {DeleteGroup.class, UpdateShowGroup.class}) private String id; @@ -49,5 +52,11 @@ public class IcPropertyManagementFormDTO implements Serializable { @Length(max = 50, message = "物业名称不能超过50个字", groups = {AddShowGroup.class}) private String name; + private String customerId; + + @NotNull(message = "pageNo不能为空", groups = PageGroup.class) + private Integer pageNo; + @NotNull(message = "pageSize不能为空", groups = PageGroup.class) + private Integer pageSize; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java index 6a38dd3e39..ba24389143 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PropertyManagementController.java @@ -18,12 +18,13 @@ 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.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.IcPropertyManagementDTO; import com.epmet.dto.form.IcPropertyManagementFormDTO; import com.epmet.dto.result.IcPropertyManagementResultDTO; -import com.epmet.service.IcPropertyManagementService; import com.epmet.service.PropertyManagementService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -45,33 +46,46 @@ import java.util.Map; @RestController @RequestMapping("propertymanagement") public class PropertyManagementController { - - @Autowired - private IcPropertyManagementService icPropertyManagementService; @Autowired private PropertyManagementService propertyManagementService; + /** + * 分页查询物业列表 + */ + @PostMapping("page") + public Result> page(@RequestBody IcPropertyManagementFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,IcPropertyManagementFormDTO.PageGroup.class); + return new Result>().ok(propertyManagementService.page(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getName())); + } - + /** + * 新增小区时,下拉框调用此接口 + * @return + */ @PostMapping("list") public Result> list(){ return new Result>().ok(propertyManagementService.getList()); } - + /** + * 新增物业 + * 新增小区页面,添加小区也调用此接口 + * @param tokenDTO + * @param formDTO + * @return + */ @PostMapping("add") public Result add(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ //效验数据 + formDTO.setCustomerId(tokenDTO.getCustomerId()); ValidatorUtils.validateEntity(formDTO, IcPropertyManagementFormDTO.AddShowGroup.class); Map map=new HashMap<>(); map.put("propertyId",propertyManagementService.add(formDTO)); return new Result().ok(map); } - - @PostMapping("update") - public Result update(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ + public Result update(@RequestBody IcPropertyManagementFormDTO formDTO){ //效验数据 ValidatorUtils.validateEntity(formDTO, IcPropertyManagementFormDTO.UpdateShowGroup.class); propertyManagementService.update(formDTO); @@ -79,7 +93,7 @@ public class PropertyManagementController { } @PostMapping("delete") - public Result delete(@LoginUser TokenDto tokenDTO, @RequestBody IcPropertyManagementFormDTO formDTO){ + public Result delete(@RequestBody IcPropertyManagementFormDTO formDTO){ //效验数据 ValidatorUtils.validateEntity(formDTO, IcPropertyManagementFormDTO.DeleteGroup.class); propertyManagementService.delete(formDTO); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java index 52a038ab3b..915b2f6d7d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java @@ -34,7 +34,7 @@ import java.util.List; @Mapper public interface IcPropertyManagementDao extends BaseDao { - IcPropertyManagementEntity selectByName(String name); + IcPropertyManagementEntity selectByName(String customerId,String name,String id); /** * @Description 根据物业名查询已存在的物业名 @@ -58,4 +58,6 @@ public interface IcPropertyManagementDao extends BaseDao selectPropertyNameList(String neighborhoodId); + + List queryList(@Param("customerId") String customerId,@Param("name")String name); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcPropertyManagementEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcPropertyManagementEntity.java index ff8b648d6a..239fce61cc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcPropertyManagementEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcPropertyManagementEntity.java @@ -39,5 +39,5 @@ public class IcPropertyManagementEntity extends BaseEpmetEntity { * 物业名称 */ private String name; - + private String customerId; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java index 7bbbad3616..f3f77cde27 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PropertyManagementService.java @@ -17,6 +17,8 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcPropertyManagementDTO; import com.epmet.dto.form.IcPropertyManagementFormDTO; import com.epmet.dto.result.IcPropertyManagementResultDTO; @@ -36,4 +38,6 @@ public interface PropertyManagementService { void update(IcPropertyManagementFormDTO formDTO); void delete(IcPropertyManagementFormDTO formDTO); + + PageData page(Integer pageNo, Integer pageSize, String name); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java index bfc46dd0b6..41d2f7bfbc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PropertyManagementServiceImpl.java @@ -1,19 +1,24 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.epmet.commons.tools.exception.RenException; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.dao.IcNeighborHoodPropertyDao; import com.epmet.dao.IcPropertyManagementDao; +import com.epmet.dto.IcPropertyManagementDTO; import com.epmet.dto.form.IcPropertyManagementFormDTO; import com.epmet.dto.result.IcPropertyManagementResultDTO; import com.epmet.entity.IcNeighborHoodPropertyEntity; import com.epmet.entity.IcPropertyManagementEntity; import com.epmet.service.PropertyManagementService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.ArrayList; @@ -28,9 +33,15 @@ public class PropertyManagementServiceImpl implements PropertyManagementService @Resource private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; + /** + * 查询当前客户下的物业 + * @return + */ @Override public List getList() { - List propertyManagementEntityList = icPropertyManagementDao.selectList(null); + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(IcPropertyManagementEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + List propertyManagementEntityList = icPropertyManagementDao.selectList(queryWrapper); List list = new ArrayList<>(); propertyManagementEntityList.forEach(item->{ IcPropertyManagementResultDTO propertyManagementResultDTO = new IcPropertyManagementResultDTO(); @@ -41,13 +52,19 @@ public class PropertyManagementServiceImpl implements PropertyManagementService return list; } + /** + * 新增物业 + * 名称客户下唯一 + * @param formDTO + * @return + */ @Override @Transactional(rollbackFor = Exception.class) public String add(IcPropertyManagementFormDTO formDTO) { //物业名字平台内唯一 //如果输入的物业名字已经存在,直接返回物业id formDTO.setName(formDTO.getName().trim()); - IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(formDTO.getName()); + IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(formDTO.getCustomerId(),formDTO.getName(),null); if (null != entity) { return entity.getId(); } @@ -59,17 +76,34 @@ public class PropertyManagementServiceImpl implements PropertyManagementService @Override @Transactional(rollbackFor = Exception.class) public void update(IcPropertyManagementFormDTO formDTO) { + IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(EpmetRequestHolder.getLoginUserCustomerId(),formDTO.getName(),formDTO.getId()); + if (null != entity) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"物业名称已存在","物业名称已存在"); + } IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); icPropertyManagementDao.updateById(icPropertyManagementEntity); } + /** + * 单个删除 + * @param formDTO + */ @Override @Transactional(rollbackFor = Exception.class) public void delete(IcPropertyManagementFormDTO formDTO) { - List list = icNeighborHoodPropertyDao.selectList(new QueryWrapper().lambda().eq(IcNeighborHoodPropertyEntity::getPropertyId, formDTO.getId())); - if(!CollectionUtils.isEmpty(list)){ - throw new RenException("物业存在与小区关联,无法删除"); + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(IcNeighborHoodPropertyEntity::getPropertyId,formDTO.getId()); + if (icNeighborHoodPropertyDao.selectCount(queryWrapper) > 0) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"物业存在与小区关联,无法删除","已与小区关联,无法删除"); } icPropertyManagementDao.deleteById(formDTO.getId()); } + + @Override + public PageData page(Integer pageNo, Integer pageSize, String name) { + PageHelper.startPage(pageNo,pageSize); + List list=icPropertyManagementDao.queryList(EpmetRequestHolder.getLoginUserCustomerId(),name); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.48__ic_property_management.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.48__ic_property_management.sql new file mode 100644 index 0000000000..14ec16f9b4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.48__ic_property_management.sql @@ -0,0 +1,8 @@ +alter table ic_property_management add COLUMN `CUSTOMER_ID` varchar(64) DEFAULT NULL COMMENT '客户id' after NAME; + + +update ic_property_management p,ic_neighbor_hood_property pr,ic_neighbor_hood h +set p.CUSTOMER_ID=h.CUSTOMER_ID +where p.DEL_FLAG='0' + and p.id=pr.PROPERTY_ID + and pr.NEIGHBOR_HOOD_ID=h.id; \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml index 0b0aba046c..045514482f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml @@ -14,14 +14,18 @@ - SELECT m.id FROM ic_property_management m WHERE m.DEL_FLAG = '0' + and m.customer_id = #{customerId} AND m.`NAME` = #{name} + + and m.id !=#{id} + @@ -65,4 +69,17 @@ AND p.DEL_FLAG = '0' ) + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 72f3abf0c3..b0e780209a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -1804,7 +1804,7 @@ public class ArticleServiceImpl extends BaseServiceImpl queryWrapper=new LambdaQueryWrapper(); - queryWrapper.eq(ArticleCoverEntity::getArticleId,articleEntity); + queryWrapper.eq(ArticleCoverEntity::getArticleId,articleId); if (articleCoverDao.selectCount(queryWrapper) == 0) { ArticleCoverEntity articleCoverEntity=new ArticleCoverEntity(); articleCoverEntity.setCustomerId(articleEntity.getCustomerId()); @@ -1852,6 +1852,7 @@ public class ArticleServiceImpl extends BaseServiceImpl imp if (null != guideCollectionService.getCollection(tokenDto, formDTO.getGuideId())) { result.setCollectionFlag(NumConstant.ONE_STR); } - //记录已读未读 + //记录已读未读 来源于烟台 if (null == SpringContextUtils.getBean(GuideReaderService.class).get(formDTO.getGuideId(), tokenDto.getUserId())) { GuideReaderEntity guideReaderEntity=new GuideReaderEntity(); guideReaderEntity.setGuideId(formDTO.getGuideId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java index 7b1051f587..de655b5c3c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/MyHomeServiceImpl.java @@ -206,11 +206,9 @@ public class MyHomeServiceImpl implements MyHomeService { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getCustomerId, tokenDto.getCustomerId()); wrapper.eq(IcResiUserEntity::getIdCard, baseInfo.getIdNum()); - wrapper.select(IcResiUserEntity::getId) - .select(IcResiUserEntity::getHomeId) - .select(IcResiUserEntity::getIdCard); + wrapper.select(IcResiUserEntity::getId,IcResiUserEntity::getHomeId,IcResiUserEntity::getIdCard); IcResiUserEntity icUser = icResiUserDao.selectOne(wrapper); - if (null == icUser) { + if (null == icUser||StringUtils.isBlank(icUser.getHomeId())) { log.warn(String.format("ic_resi_user is null id_card:%s",baseInfo.getIdNum())); return null; }