diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index bdbb60d9d7..3c58609ada 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -117,6 +117,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { ScreenUserJoinEntity entity = insertMap.get(gridId); entity.setJoinTotal(issue.getIssueIncr()); GridUserCountResultDTO user = userCountMap.get(gridId); + if (user == null) { + log.warn("gridId:{} is not exist in issue,customerId:{},monthId:{},gridId:{}", JSON.toJSONString(issue), formDTO.getCustomerId(), formDTO.getMonthId(), gridId); + return; + } //百人人均议题:统计周期内总的议题数/(注册用户数/100) log.debug("issue:{}", JSON.toJSONString(issue)); log.debug("user:{}", JSON.toJSONString(user)); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index faf43458cd..bc0a9e83d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -518,7 +518,6 @@ public class UserServiceImpl implements UserService { regGridD.setCustomerId(customerId); regGridD.setGridId(gridId); - regGridD.setCustomerId(customerId); regGridD.setAgencyId(agencyId);//网格直属得机关 regGridD.setDateId(timeDimension.getDateId()); regGridD.setWeekId(timeDimension.getWeekId()); diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java new file mode 100644 index 0000000000..6e6d3ca1a0 --- /dev/null +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/13 10:56 + */ + +@Data +public class UploadBytesFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @NotNull(message = "字节数组不能为空") + private byte[] bytes; + + @NotBlank(message = "后缀不能为空") + private String extension; +} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index 47daa888cc..d4c6cb170c 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java @@ -10,6 +10,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.fallback.OssFeignClientFallback; import feign.codec.Encoder; @@ -19,6 +20,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; @@ -43,6 +45,9 @@ public interface OssFeignClient { @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) Result uploadQrCode(@RequestPart(value = "file") MultipartFile file); + @PostMapping(value ="oss/file/uploadbytes", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result uploadBytes(@RequestBody UploadBytesFormDTO dto); + @Configuration class MultipartSupportConfig { diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java index 0158f7f017..ea550200b2 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java @@ -11,6 +11,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; import org.springframework.stereotype.Component; @@ -35,4 +36,8 @@ public class OssFeignClientFallback implements OssFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file); } + @Override + public Result uploadBytes(UploadBytesFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadBytes", dto); + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index ff52e99ce4..3876612092 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -20,6 +20,7 @@ import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.commons.tools.validator.group.QiniuGroup; import com.epmet.dto.UploadDTO; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.enums.OssTypeEnum; @@ -159,6 +160,13 @@ public class OssController { public Result uploadQrCode(@RequestPart(value = "file") MultipartFile file) { return ossService.uploadImg(file); } + + @PostMapping("uploadbytes") + public Result uploadBytes(@RequestBody UploadBytesFormDTO dto){ + ValidatorUtils.validateEntity(dto); + return ossService.uploadBytes(dto); + } + /** * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件,这里不再使用通用的接口 * 针对每一个业务新建上传接口) diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index c67fec06f2..9335b1e2aa 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -11,6 +11,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import org.springframework.web.multipart.MultipartFile; @@ -31,4 +32,6 @@ public interface OssService extends BaseService { Result uploadImg(MultipartFile file); Result extUpload(MultipartFile file, String fileName); + + Result uploadBytes(UploadBytesFormDTO dto); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index cc44456c7e..2c617ee3ee 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -17,6 +17,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.OssDao; +import com.epmet.dto.form.UploadBytesFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.exception.ModuleErrorCode; @@ -104,4 +105,22 @@ public class OssServiceImpl extends BaseServiceImpl implement dto.setUrl(url); return new Result().ok(dto); } + + @Override + public Result uploadBytes(UploadBytesFormDTO dto) { + if (dto.getBytes().length == 0) { + return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); + } + //上传文件 + String url = null; + url = OssFactory.build().uploadSuffix(dto.getBytes(), dto.getExtension()); + //保存文件信息 + OssEntity ossEntity = new OssEntity(); + ossEntity.setUrl(url); + baseDao.insert(ossEntity); + //文件信息 + UploadImgResultDTO uploadImgResultDTO = new UploadImgResultDTO(); + uploadImgResultDTO.setUrl(url); + return new Result().ok(uploadImgResultDTO); + } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java new file mode 100644 index 0000000000..34a154cf6b --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java @@ -0,0 +1,14 @@ +package com.epmet.resi.group.constant; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/13 16:23 + */ + +public interface GroupCodeConstant { + /** + * 群二维码类型-邀请 + */ + String CODE_TYPE_INVITE = "invite"; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java new file mode 100644 index 0000000000..8871b5ec6d --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.group; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@Data +public class ResiGroupCodeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组Id + */ + private String groupId; + + /** + * 二维码类型 + */ + private String type; + + /** + * 二维码路径 + */ + private String url; + + /** + * 删除标志 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java new file mode 100644 index 0000000000..2de7fe7531 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/13 16:22 + */ +@Data +public class CreateGroupCodeFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * 网格id + */ + @NotBlank(message = "网格id不能为空") + private String gridId; + + /** + * 组id + */ + @NotBlank(message = "群组id不能为空") + private String groupId; + + /** + * 类型 GroupCodeConstant中的类型 + */ + @NotBlank(message = "二维码类型不能为空") + private String type; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java new file mode 100644 index 0000000000..351c8dbc7b --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/16 9:31 + */ +@Data +public class GetGroupCodeFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * 网格id + */ + @NotBlank(message = "网格id不能为空") + private String gridId; + + /** + * 组id + */ + @NotBlank(message = "群组id不能为空") + private String groupId; + + /** + * 类型 GroupCodeConstant中的类型 + */ + @NotBlank(message = "二维码类型不能为空") + private String type; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index bdfb2e9d8d..4e68945180 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -11,10 +11,16 @@ import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupEditionAuditFormDTO; import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO; +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; import org.springframework.cloud.openfeign.FeignClient; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -32,9 +38,18 @@ import java.util.List; * @date 2020/6/4 13:16 */ @FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class) -//@FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class,url = "localhost:8095") public interface ResiGroupOpenFeignClient { + /** + * @Description 创建群组二维码 + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/11/13 16:33 + */ + @PostMapping(value = "/resi/group/resigroupcode/creategroupcode", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result createGroupCode(@RequestBody CreateGroupCodeFormDTO dto); + /** * @Description 查询用户参与的且不是自己发表的话题对应的议题Id集合 * @author sun diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index 4987f369ad..97b4ae6395 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -14,6 +14,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.group.form.GroupInfoFormDTO; import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO; import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import org.springframework.stereotype.Component; @@ -28,6 +32,17 @@ import java.util.List; */ @Component public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClient { + /** + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Description 创建群组二维码 + * @Author liushaowen + * @Date 2020/11/13 16:33 + */ + @Override + public Result createGroupCode(CreateGroupCodeFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "createGroupCode", dto); + } @Override public Result> topicToIssueList(MyPartProjectsFormDTO formDTO) { diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index cdc3e9d9b9..225f32587a 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -94,6 +94,18 @@ 2.0.0 compile + + com.epmet + epmet-third-client + 2.0.0 + compile + + + com.epmet + epmet-oss-client + 2.0.0 + compile + diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java new file mode 100644 index 0000000000..d3d26595a0 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java @@ -0,0 +1,102 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.controller; + + +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.modules.group.service.ResiGroupCodeService; +import com.epmet.resi.group.dto.group.ResiGroupCodeDTO; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; +import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO; +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 qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@RestController +@RequestMapping("resigroupcode") +public class ResiGroupCodeController { + + @Autowired + private ResiGroupCodeService resiGroupCodeService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = resiGroupCodeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ResiGroupCodeDTO data = resiGroupCodeService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ResiGroupCodeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + resiGroupCodeService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ResiGroupCodeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + resiGroupCodeService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + resiGroupCodeService.delete(ids); + return new Result(); + } + + @RequestMapping("creategroupcode") + public Result createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){ + ValidatorUtils.validateEntity(dto); + return new Result().ok(resiGroupCodeService.createGroupCode(dto)); + } + + @RequestMapping("getgroupcode") + public Result getGroupCode(@RequestBody GetGroupCodeFormDTO dto){ + ValidatorUtils.validateEntity(dto); + return resiGroupCodeService.getGroupCode(dto); + } + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java new file mode 100644 index 0000000000..5b46fce0df --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.group.entity.ResiGroupCodeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@Mapper +public interface ResiGroupCodeDao extends BaseDao { + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java new file mode 100644 index 0000000000..ae5498c114 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java @@ -0,0 +1,67 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.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 qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_group_code") +public class ResiGroupCodeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组Id + */ + private String groupId; + + /** + * 二维码类型 + */ + private String type; + + /** + * 二维码路径 + */ + private String url; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java new file mode 100644 index 0000000000..a34bae4c5e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java @@ -0,0 +1,58 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@Component +public class ResiGroupCodeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + + /** + * @Description 获取刷新 + * @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType 前缀+客户ID+客户端类型 + * @author zxc + */ + public Map getAuthorizerRefreshToken(String key){ + Map result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key); + return result; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java new file mode 100644 index 0000000000..b9d95fe3ca --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java @@ -0,0 +1,117 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service; + + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.modules.group.entity.ResiGroupCodeEntity; +import com.epmet.resi.group.dto.group.ResiGroupCodeDTO; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; +import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO; + +import java.util.List; +import java.util.Map; + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +public interface ResiGroupCodeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-13 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-13 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ResiGroupCodeDTO + * @author generator + * @date 2020-11-13 + */ + ResiGroupCodeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-13 + */ + void save(ResiGroupCodeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-13 + */ + void update(ResiGroupCodeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-11-13 + */ + void delete(String[] ids); + + /** + * @Description 创建群组二维码 + * @param dto + * @return String + * @Author liushaowen + * @Date 2020/11/13 16:32 + */ + String createGroupCode(CreateGroupCodeFormDTO dto); + + /** + * @Description 获取群组二维码 + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/11/16 9:37 + */ + Result getGroupCode(GetGroupCodeFormDTO dto); +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java new file mode 100644 index 0000000000..fe80b0e406 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -0,0 +1,255 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.api.R; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.enums.EnvEnum; +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.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UploadBytesFormDTO; +import com.epmet.dto.result.CustomerTokensResultDTO; +import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.feign.OssFeignClient; +import com.epmet.modules.group.dao.ResiGroupCodeDao; +import com.epmet.modules.group.entity.ResiGroupCodeEntity; +import com.epmet.modules.group.redis.ResiGroupCodeRedis; +import com.epmet.modules.group.service.ResiGroupCodeService; +import com.epmet.modules.utils.ModuleConstant; +import com.epmet.resi.group.dto.group.ResiGroupCodeDTO; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; +import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-11-13 + */ +@Service +public class ResiGroupCodeServiceImpl extends BaseServiceImpl implements ResiGroupCodeService { + + private static final Logger logger = LoggerFactory.getLogger(ResiGroupCodeServiceImpl.class); + + @Autowired + private ResiGroupCodeRedis resiGroupCodeRedis; + + @Autowired + private OssFeignClient ossFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ResiGroupCodeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResiGroupCodeDTO.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 ResiGroupCodeDTO get(String id) { + ResiGroupCodeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ResiGroupCodeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ResiGroupCodeDTO dto) { + ResiGroupCodeEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupCodeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ResiGroupCodeDTO dto) { + ResiGroupCodeEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupCodeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param dto + * @return void + * @Description 创建群组二维码 + * @Author liushaowen + * @Date 2020/11/13 16:32 + */ + @Override + public String createGroupCode(CreateGroupCodeFormDTO dto) { + String result = ""; + ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); + if (codeByGroupId != null) { + logger.error("本群组该类型二维码已存在,请勿重复添加。groupId:{},type:{}", dto.getGroupId(), dto.getType()); + throw new RenException("本群组该类型二维码已存在,请勿重复添加。"); + } else { + //向微信获取二维码 + + // 获取AccessToken + String accessToken = getAccessToken(dto.getCustomerId()); + if (StringUtils.isBlank(accessToken)) { + logger.error("获取accessToken失败,customerId:{}", dto.getCustomerId()); + throw new RenException("获取accessToken失败"); + } + //跳转的页面 + StringBuilder path = new StringBuilder(ModuleConstant.CODE_INVITE_PAGE); + path.append("?groupId=").append(dto.getGroupId()); + //需要发送的Json + JSONObject data = new JSONObject(); + data.put("path", path.toString()); + data.put("width", 400); + //发送 + byte[] buffer = HttpClientManager.getInstance().getMediaByteArray(ModuleConstant.GET_CODE_URL + accessToken, JSON.toJSONString(data)).getData(); + if (buffer != null && buffer.length < 500) { + String wxResult = ""; + try { + wxResult = new String(buffer, "UTF-8"); + if (-1 != wxResult.indexOf("errcode")) { + logger.error("获取二维码接口返回错误:{}", wxResult); + throw new RenException("获取二维码失败"); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + //上传 + UploadBytesFormDTO uploadBytesFormDTO = new UploadBytesFormDTO(); + uploadBytesFormDTO.setBytes(buffer); + uploadBytesFormDTO.setExtension("jpg"); + Result uploadResult = ossFeignClient.uploadBytes(uploadBytesFormDTO); + if (uploadResult.success()) { + result = uploadResult.getData().getUrl(); + //存表 + ResiGroupCodeEntity entity = new ResiGroupCodeEntity(); + BeanUtils.copyProperties(dto, entity); + entity.setUrl(uploadResult.getData().getUrl()); + baseDao.insert(entity); + } else { + logger.error("上传图片失败:{}", uploadResult.getMsg()); + throw new RenException("上传图片失败"); + } + } + return result; + } + + /** + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @Description 获取群组二维码 + * @Author liushaowen + * @Date 2020/11/16 9:37 + */ + @Override + public Result getGroupCode(GetGroupCodeFormDTO dto) { + ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); + if (codeByGroupId != null) { + //数据库有数据 + return new Result().ok(codeByGroupId.getUrl()); + } else { + //从微信获取二维码并存储 + CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO(); + BeanUtils.copyProperties(dto, createDto); + String url = createGroupCode(createDto); + if (StringUtils.isBlank(url)){ + throw new RenException("获取二维码失败"); + } + return new Result().ok(url); + } + } + + private ResiGroupCodeEntity getCode(String groupId, String type) { + if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) { + throw new RenException("获取二维码失败,groupId或type为空"); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("DEL_FLAG", "0"); + queryWrapper.eq("GROUP_ID", groupId); + queryWrapper.eq("TYPE", type); + return baseDao.selectOne(queryWrapper); + } + + //获取AccessToken + private String getAccessToken(String customerId) { + EnvEnum envEnum = EnvEnum.getCurrentEnv(); + String resiAccessToken = null; + if (EnvEnum.PROD.getCode().equals(envEnum.getCode())) { + //居民端 + StringBuilder resiKey = new StringBuilder(customerId).append(":resi"); + Map authorizerRefreshToken = new HashMap<>(); + authorizerRefreshToken = resiGroupCodeRedis.getAuthorizerRefreshToken(resiKey.toString()); + resiAccessToken = (String) authorizerRefreshToken.get("authorizerAccessToken"); + } else { + String url = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/tokenlist"; + JSONObject postData = new JSONObject(); + postData.put("customerId", customerId); + String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(postData)).getData(); + JSONObject toResult = JSON.parseObject(data); + Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); + if (null != toResult.get("code")) { + mapToResult.setCode(((Integer) toResult.get("code")).intValue()); + } + Object CustomerTokensResultDTO = mapToResult.getData(); + JSONObject json = JSON.parseObject(CustomerTokensResultDTO.toString()); + CustomerTokensResultDTO customerTokensResultDTO = ConvertUtils.mapToEntity(json, com.epmet.dto.result.CustomerTokensResultDTO.class); + resiAccessToken = customerTokensResultDTO.getResiAuthorizerToken(); + } + return resiAccessToken; + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 6f6a94d7ed..678de5e061 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -338,4 +338,13 @@ public interface ModuleConstant extends Constant { * 审核操作 拒绝 */ String AUDITING_OPERATION_REJECT = "rejected"; + + /** + * 获取二维码的url + */ + String GET_CODE_URL = "https://api.weixin.qq.com/wxa/getwxacode?access_token="; + /** + * 群邀请二维码跳转页面 + */ + String CODE_INVITE_PAGE = "pages/group/group/invitation/invitation"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql new file mode 100644 index 0000000000..9fe2aeae45 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql @@ -0,0 +1,15 @@ +CREATE TABLE `resi_group_code` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组Id', + `TYPE` varchar(32) NOT NULL COMMENT '二维码类型 邀请:invite', + `URL` varchar(128) NOT NULL COMMENT '二维码路径', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标志', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的'; diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml new file mode 100644 index 0000000000..17b935a356 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index e8ae592334..e1eefc0a94 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -385,7 +385,7 @@ public class CustomerStaffController { * @Date 11:09 2020-08-25 **/ @PostMapping(value = "staffbasicinfo") - public Result staffBasicInfo(@LoginUser TokenDto tokenDTO){ + public Result staffBasicInfo(@LoginUser TokenDto tokenDTO){ return customerStaffService.selectStaffBasicInfo(tokenDTO.getUserId()); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index 457c88e2f6..acffa2840e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -189,7 +189,7 @@ public interface CustomerStaffDao extends BaseDao { * @Author zhangyong * @Date 10:07 2020-08-26 **/ - BasicInfoResultDTO selectStaffBasicInfo(@Param("userId") String userId); + StaffBasicInfoResultDTO selectStaffBasicInfo(@Param("userId") String userId); /** * 根据staffId查询用户基本信息 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index fe3c88e8fb..833791fc54 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -305,7 +305,7 @@ public interface CustomerStaffService extends BaseService { * @Author zhangyong * @Date 11:10 2020-08-25 **/ - Result selectStaffBasicInfo(String userId); + Result selectStaffBasicInfo(String userId); /** * @param formDTO diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 17f0ae9f5e..be351746dc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -623,7 +623,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl customerStaffList = baseDao.selectListCustomerStaffDTO(formDTO.getPhone()); - for (CustomerStaffDTO staffDTO : customerStaffList){ + //sun 2020.11.12 需求变更-之前pc工作端只能是工作端小程序的超级管理员能登陆 现调整为工作端小程序的工作人员均可登陆(使用账号密码登陆) start + /*for (CustomerStaffDTO staffDTO : customerStaffList){ // 2.根据 customer_id 去 gov_staff_role表,查询 customer_id + role_key = root_manager ,确定 根管理员的id,即roleId GovStaffRoleDTO roleKey = govStaffRoleDao.getRoleByCustomerIdAndRoleKey(staffDTO.getCustomerId(), RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); if (null != roleKey){ @@ -645,14 +646,29 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); + if (!customerInfo.success()) { + logger.error(String.format("获取客户信息失败,调用%s服务查询客户名称失败,入参%s", ServiceConstant.OPER_CRM_SERVER, JSON.toJSONString(staffDTO.getCustomerId()))); + } else { + if (null != customerInfo.getData()){ + CustomerListResultDTO resultDTO = new CustomerListResultDTO(); + resultDTO.setCustomerId(customerInfo.getData().getId()); + resultDTO.setCustomerName(customerInfo.getData().getCustomerName()); + listResultDTO.add(resultDTO); + } + } + } + //2020.11.12 sun end return new Result>().ok(listResultDTO); } @Override - public Result selectStaffBasicInfo(String userId) { - BasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId); - return new Result().ok(resultDTO); + public Result selectStaffBasicInfo(String userId) { + StaffBasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId); + return new Result().ok(resultDTO); } /** diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 2dd23e4170..f5a341bf5b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -313,7 +313,7 @@ LIMIT 1 - SELECT cs.CUSTOMER_ID customerId, cs.USER_ID id,