Browse Source

Merge branch 'dev_group_code' into dev_temp

# Conflicts:
#	epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
#	epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
dev_shibei_match
liushaowen 5 years ago
parent
commit
890fe59224
  1. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  2. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  3. 24
      epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/UploadBytesFormDTO.java
  4. 5
      epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java
  5. 5
      epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java
  6. 8
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  7. 3
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java
  8. 19
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java
  9. 14
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupCodeConstant.java
  10. 96
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupCodeDTO.java
  11. 40
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CreateGroupCodeFormDTO.java
  12. 40
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GetGroupCodeFormDTO.java
  13. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  14. 15
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  15. 12
      epmet-module/resi-group/resi-group-server/pom.xml
  16. 102
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupCodeController.java
  17. 33
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupCodeDao.java
  18. 67
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupCodeEntity.java
  19. 58
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupCodeRedis.java
  20. 117
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupCodeService.java
  21. 255
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java
  22. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  23. 15
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.4__group_code.sql
  24. 22
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml
  25. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  26. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  27. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  28. 26
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  29. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

4
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); ScreenUserJoinEntity entity = insertMap.get(gridId);
entity.setJoinTotal(issue.getIssueIncr()); entity.setJoinTotal(issue.getIssueIncr());
GridUserCountResultDTO user = userCountMap.get(gridId); 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) //百人人均议题:统计周期内总的议题数/(注册用户数/100)
log.debug("issue:{}", JSON.toJSONString(issue)); log.debug("issue:{}", JSON.toJSONString(issue));
log.debug("user:{}", JSON.toJSONString(user)); log.debug("user:{}", JSON.toJSONString(user));

1
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.setCustomerId(customerId);
regGridD.setGridId(gridId); regGridD.setGridId(gridId);
regGridD.setCustomerId(customerId);
regGridD.setAgencyId(agencyId);//网格直属得机关 regGridD.setAgencyId(agencyId);//网格直属得机关
regGridD.setDateId(timeDimension.getDateId()); regGridD.setDateId(timeDimension.getDateId());
regGridD.setWeekId(timeDimension.getWeekId()); regGridD.setWeekId(timeDimension.getWeekId());

24
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;
}

5
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.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UploadBytesFormDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.feign.fallback.OssFeignClientFallback; import com.epmet.feign.fallback.OssFeignClientFallback;
import feign.codec.Encoder; import feign.codec.Encoder;
@ -19,6 +20,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping; 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.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -43,6 +45,9 @@ public interface OssFeignClient {
@PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
Result<UploadImgResultDTO> uploadQrCode(@RequestPart(value = "file") MultipartFile file); Result<UploadImgResultDTO> uploadQrCode(@RequestPart(value = "file") MultipartFile file);
@PostMapping(value ="oss/file/uploadbytes", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<UploadImgResultDTO> uploadBytes(@RequestBody UploadBytesFormDTO dto);
@Configuration @Configuration
class MultipartSupportConfig { class MultipartSupportConfig {

5
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.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UploadBytesFormDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -35,4 +36,8 @@ public class OssFeignClientFallback implements OssFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file); return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file);
} }
@Override
public Result<UploadImgResultDTO> uploadBytes(UploadBytesFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadBytes", dto);
}
} }

8
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.QcloudGroup;
import com.epmet.commons.tools.validator.group.QiniuGroup; import com.epmet.commons.tools.validator.group.QiniuGroup;
import com.epmet.dto.UploadDTO; import com.epmet.dto.UploadDTO;
import com.epmet.dto.form.UploadBytesFormDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.OssEntity; import com.epmet.entity.OssEntity;
import com.epmet.enums.OssTypeEnum; import com.epmet.enums.OssTypeEnum;
@ -159,6 +160,13 @@ public class OssController {
public Result<UploadImgResultDTO> uploadQrCode(@RequestPart(value = "file") MultipartFile file) { public Result<UploadImgResultDTO> uploadQrCode(@RequestPart(value = "file") MultipartFile file) {
return ossService.uploadImg(file); return ossService.uploadImg(file);
} }
@PostMapping("uploadbytes")
public Result<UploadImgResultDTO> uploadBytes(@RequestBody UploadBytesFormDTO dto){
ValidatorUtils.validateEntity(dto);
return ossService.uploadBytes(dto);
}
/** /**
* 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件这里不再使用通用的接口 * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件这里不再使用通用的接口
* 针对每一个业务新建上传接口) * 针对每一个业务新建上传接口)

3
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.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UploadBytesFormDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.OssEntity; import com.epmet.entity.OssEntity;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -31,4 +32,6 @@ public interface OssService extends BaseService<OssEntity> {
Result<UploadImgResultDTO> uploadImg(MultipartFile file); Result<UploadImgResultDTO> uploadImg(MultipartFile file);
Result<UploadImgResultDTO> extUpload(MultipartFile file, String fileName); Result<UploadImgResultDTO> extUpload(MultipartFile file, String fileName);
Result<UploadImgResultDTO> uploadBytes(UploadBytesFormDTO dto);
} }

19
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.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.OssDao; import com.epmet.dao.OssDao;
import com.epmet.dto.form.UploadBytesFormDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.OssEntity; import com.epmet.entity.OssEntity;
import com.epmet.exception.ModuleErrorCode; import com.epmet.exception.ModuleErrorCode;
@ -104,4 +105,22 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
dto.setUrl(url); dto.setUrl(url);
return new Result<UploadImgResultDTO>().ok(dto); return new Result<UploadImgResultDTO>().ok(dto);
} }
@Override
public Result<UploadImgResultDTO> uploadBytes(UploadBytesFormDTO dto) {
if (dto.getBytes().length == 0) {
return new Result<UploadImgResultDTO>().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<UploadImgResultDTO>().ok(uploadImgResultDTO);
}
} }

14
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";
}

96
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

40
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;
}

40
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;
}

17
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.form.GroupEditionAuditFormDTO;
import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO;
import com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO; 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 org.springframework.cloud.openfeign.FeignClient;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -32,9 +38,18 @@ import java.util.List;
* @date 2020/6/4 13:16 * @date 2020/6/4 13:16
*/ */
@FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class) @FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class)
//@FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupOpenFeignClientFallback.class,url = "localhost:8095")
public interface ResiGroupOpenFeignClient { public interface ResiGroupOpenFeignClient {
/**
* @Description 创建群组二维码
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author liushaowen
* @Date 2020/11/13 16:33
*/
@PostMapping(value = "/resi/group/resigroupcode/creategroupcode", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<String> createGroupCode(@RequestBody CreateGroupCodeFormDTO dto);
/** /**
* @Description 查询用户参与的且不是自己发表的话题对应的议题Id集合 * @Description 查询用户参与的且不是自己发表的话题对应的议题Id集合
* @author sun * @author sun

15
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.form.GroupInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO; import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO; 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.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -28,6 +32,17 @@ import java.util.List;
*/ */
@Component @Component
public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClient { public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClient {
/**
* @param dto
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Description 创建群组二维码
* @Author liushaowen
* @Date 2020/11/13 16:33
*/
@Override
public Result<String> createGroupCode(CreateGroupCodeFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "createGroupCode", dto);
}
@Override @Override
public Result<List<IssueGridResultDTO>> topicToIssueList(MyPartProjectsFormDTO formDTO) { public Result<List<IssueGridResultDTO>> topicToIssueList(MyPartProjectsFormDTO formDTO) {

12
epmet-module/resi-group/resi-group-server/pom.xml

@ -94,6 +94,18 @@
<version>2.0.0</version> <version>2.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

102
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<ResiGroupCodeDTO>> page(@RequestParam Map<String, Object> params){
PageData<ResiGroupCodeDTO> page = resiGroupCodeService.page(params);
return new Result<PageData<ResiGroupCodeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ResiGroupCodeDTO> get(@PathVariable("id") String id){
ResiGroupCodeDTO data = resiGroupCodeService.get(id);
return new Result<ResiGroupCodeDTO>().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<String> createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){
ValidatorUtils.validateEntity(dto);
return new Result<String>().ok(resiGroupCodeService.createGroupCode(dto));
}
@RequestMapping("getgroupcode")
public Result<String> getGroupCode(@RequestBody GetGroupCodeFormDTO dto){
ValidatorUtils.validateEntity(dto);
return resiGroupCodeService.getGroupCode(dto);
}
}

33
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ResiGroupCodeEntity> {
}

67
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

58
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<String,Object> getAuthorizerRefreshToken(String key){
Map<String, Object> result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key);
return result;
}
}

117
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ResiGroupCodeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ResiGroupCodeDTO>
* @author generator
* @date 2020-11-13
*/
PageData<ResiGroupCodeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ResiGroupCodeDTO>
* @author generator
* @date 2020-11-13
*/
List<ResiGroupCodeDTO> list(Map<String, Object> 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<java.lang.String>
* @Author liushaowen
* @Date 2020/11/16 9:37
*/
Result<String> getGroupCode(GetGroupCodeFormDTO dto);
}

255
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<ResiGroupCodeDao, ResiGroupCodeEntity> implements ResiGroupCodeService {
private static final Logger logger = LoggerFactory.getLogger(ResiGroupCodeServiceImpl.class);
@Autowired
private ResiGroupCodeRedis resiGroupCodeRedis;
@Autowired
private OssFeignClient ossFeignClient;
@Override
public PageData<ResiGroupCodeDTO> page(Map<String, Object> params) {
IPage<ResiGroupCodeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ResiGroupCodeDTO.class);
}
@Override
public List<ResiGroupCodeDTO> list(Map<String, Object> params) {
List<ResiGroupCodeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResiGroupCodeDTO.class);
}
private QueryWrapper<ResiGroupCodeEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<ResiGroupCodeEntity> 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<UploadImgResultDTO> 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<java.lang.String>
* @Description 获取群组二维码
* @Author liushaowen
* @Date 2020/11/16 9:37
*/
@Override
public Result<String> getGroupCode(GetGroupCodeFormDTO dto) {
ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType());
if (codeByGroupId != null) {
//数据库有数据
return new Result<String>().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<String>().ok(url);
}
}
private ResiGroupCodeEntity getCode(String groupId, String type) {
if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) {
throw new RenException("获取二维码失败,groupId或type为空");
}
QueryWrapper<ResiGroupCodeEntity> 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<String, Object> 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;
}
}

9
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"; 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";
} }

15
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='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的';

22
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.resi.group.dto.group.ResiGroupCodeDTO">
<resultMap type="com.epmet.modules.group.entity.ResiGroupCodeEntity" id="resiGroupCodeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="groupId" column="GROUP_ID"/>
<result property="type" column="TYPE"/>
<result property="url" column="URL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

2
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 * @Date 11:09 2020-08-25
**/ **/
@PostMapping(value = "staffbasicinfo") @PostMapping(value = "staffbasicinfo")
public Result<BasicInfoResultDTO> staffBasicInfo(@LoginUser TokenDto tokenDTO){ public Result<StaffBasicInfoResultDTO> staffBasicInfo(@LoginUser TokenDto tokenDTO){
return customerStaffService.selectStaffBasicInfo(tokenDTO.getUserId()); return customerStaffService.selectStaffBasicInfo(tokenDTO.getUserId());
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -189,7 +189,7 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Author zhangyong * @Author zhangyong
* @Date 10:07 2020-08-26 * @Date 10:07 2020-08-26
**/ **/
BasicInfoResultDTO selectStaffBasicInfo(@Param("userId") String userId); StaffBasicInfoResultDTO selectStaffBasicInfo(@Param("userId") String userId);
/** /**
* 根据staffId查询用户基本信息 * 根据staffId查询用户基本信息

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -305,7 +305,7 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @Author zhangyong * @Author zhangyong
* @Date 11:10 2020-08-25 * @Date 11:10 2020-08-25
**/ **/
Result<BasicInfoResultDTO> selectStaffBasicInfo(String userId); Result<StaffBasicInfoResultDTO> selectStaffBasicInfo(String userId);
/** /**
* @param formDTO * @param formDTO

26
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -623,7 +623,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
// 1.根据手机号,去 customer_staff表,进行查询; 查询结果 多条:字段 customer_id,user_id // 1.根据手机号,去 customer_staff表,进行查询; 查询结果 多条:字段 customer_id,user_id
List<CustomerStaffDTO> customerStaffList = baseDao.selectListCustomerStaffDTO(formDTO.getPhone()); List<CustomerStaffDTO> 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 // 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); GovStaffRoleDTO roleKey = govStaffRoleDao.getRoleByCustomerIdAndRoleKey(staffDTO.getCustomerId(), RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
if (null != roleKey){ if (null != roleKey){
@ -645,14 +646,29 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
} }
} }
} }
} }*/
for (CustomerStaffDTO staffDTO : customerStaffList){
customerDTO.setId(staffDTO.getCustomerId());
Result<CustomerDTO> 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<List<CustomerListResultDTO>>().ok(listResultDTO); return new Result<List<CustomerListResultDTO>>().ok(listResultDTO);
} }
@Override @Override
public Result<BasicInfoResultDTO> selectStaffBasicInfo(String userId) { public Result<StaffBasicInfoResultDTO> selectStaffBasicInfo(String userId) {
BasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId); StaffBasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId);
return new Result<BasicInfoResultDTO>().ok(resultDTO); return new Result<StaffBasicInfoResultDTO>().ok(resultDTO);
} }
/** /**

2
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -313,7 +313,7 @@
LIMIT 1 LIMIT 1
</select> </select>
<select id="selectStaffBasicInfo" resultType="com.epmet.dto.result.BasicInfoResultDTO"> <select id="selectStaffBasicInfo" resultType="com.epmet.dto.result.StaffBasicInfoResultDTO">
SELECT SELECT
cs.CUSTOMER_ID customerId, cs.CUSTOMER_ID customerId,
cs.USER_ID id, cs.USER_ID id,

Loading…
Cancel
Save