diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index b2609df0b1..e32e5e5432 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.43 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.56 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-prod.yml b/epmet-auth/deploy/docker-compose-prod.yml index 13ddca93b7..fda9a1724d 100644 --- a/epmet-auth/deploy/docker-compose-prod.yml +++ b/epmet-auth/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.36 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.56 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-test.yml b/epmet-auth/deploy/docker-compose-test.yml index d15b071181..e71cca12c3 100644 --- a/epmet-auth/deploy/docker-compose-test.yml +++ b/epmet-auth/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.36 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.56 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index ab11a183fc..8ffde60165 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.43 + 0.3.56 com.epmet epmet-cloud @@ -122,6 +122,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + @@ -182,6 +188,8 @@ wx3d1372029eb816a3 651f02d71ed3f123dfb584b8bf0f4d8b + diff --git a/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java index d083b2a26b..85163f625c 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java @@ -9,6 +9,7 @@ import com.epmet.constant.PublicUserLoginConstant; import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PublicSendSmsCodeFormDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.PublicUserLoginService; import org.springframework.beans.factory.annotation.Autowired; @@ -70,5 +71,18 @@ public class PublicUserLoginController { return new Result().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + @PostMapping(value = "/register") + public Result register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDTO.getUserId()); + return new Result().ok(publicUserLoginService.register(formDTO)); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 90be83d3b2..461dd1ab48 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.LoginFormDTO; +import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.ThirdLoginService; import org.springframework.beans.factory.annotation.Autowired; @@ -46,4 +47,17 @@ public class ThirdLoginController { return new Result().ok(thirdLoginService.workLogin(formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + @PostMapping(value = "enterorg") + public Result enterOrg(@RequestBody ThirdWxmpEnteOrgFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,ThirdWxmpEnteOrgFormDTO.AddUserShowGroup.class,ThirdWxmpEnteOrgFormDTO.AddUserInternalGroup.class); + UserTokenResultDTO userTokenResultDTO=thirdLoginService.enterOrg(formDTO); + return new Result().ok(userTokenResultDTO); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java index e68df77236..298fa611bc 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -38,5 +38,11 @@ public class GovWxmpEnteOrgFormDTO implements Serializable { */ @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) private String rootAgencyId; + + /** + * desc:小程序appId + */ + private String appId; + } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java index 8bab423dec..55abfd3bce 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java @@ -19,5 +19,9 @@ public class GovWxmpFormDTO extends LoginCommonFormDTO implements Serializable { */ @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) private String wxCode; + /** + * appId + */ + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java index 8ddfe9edff..3f59baf4d7 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java @@ -29,4 +29,6 @@ public class LoginByWxCodeFormDTO extends LoginCommonFormDTO implements Serializ * 加密算法的初始向量 */ private String iv; + + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java index f0148b3c14..f710be379e 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java @@ -32,4 +32,6 @@ public class ResiWxPhoneFormDTO implements Serializable { */ @NotBlank(message = "iv不能为空",groups = {AddUserInternalGroup.class}) private String iv; + + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java new file mode 100644 index 0000000000..14c7339245 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 单客户-选择组织,进入首页入参Dto + * @Author sun + */ +@Data +public class ThirdWxmpEnteOrgFormDTO implements Serializable { + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) + private String wxCode; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class}) + private String mobile; + + /** + * 选择的组织所属的id + */ + @NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 选择的要进入的组织(根组织id) + */ + @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) + private String rootAgencyId; + + /** + * 客户appId(exJson文件中获取) + */ + @NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class}) + private String appId; +} + diff --git a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java new file mode 100644 index 0000000000..a7f36c75f0 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.redis; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAppDTO; +import com.epmet.dto.CustomerAppRedisDTO; +import com.epmet.feign.OperCrmOpenFeignClient; +import com.google.common.collect.Maps; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.SetOperations; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 客户app Redis + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class CustomerAppWxServiceUtil implements ApplicationRunner { + private static Logger logger = LogManager.getLogger(CustomerAppWxServiceUtil.class); + + /** + * 过期时长为30分钟,单位:秒 + */ + private final static long MINUTE_THIRTY_EXPIRE = 60 * 60 * 24 * 7L; + private final static String JSON_STR = "JSON"; + + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + + private static Map maServices = Maps.newConcurrentMap(); + + public static WxMaService getWxMaService(String appId) { + WxMaService wxMaService = maServices.get(appId); + if (wxMaService == null) { + logger.error("getMaService appId:{} is not config from customer_app", appId); + } + return wxMaService; + } + + @Override + public void run(ApplicationArguments args) { + Map maServicesNew = Maps.newConcurrentMap(); + SetOperations appSet = null; + List result = null; + String appKey = RedisKeys.getCustomerAppKey(); + try { + appSet = redisTemplate.opsForSet(); + Set members = appSet.members(appKey); + if (!CollectionUtils.isEmpty(members)) { + members.forEach(app -> { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(app.getAppId()); + config.setSecret(app.getSecret()); + config.setMsgDataFormat(JSON_STR); + WxMaService service = new WxMaServiceImpl(); + service.setWxMaConfig(config); + maServicesNew.put(app.getAppId(), service); + }); + } + } catch (Exception ex) { + logger.error("init wxMaService from redis error", ex); + } + try { + Result> configAllAppResult = operCrmOpenFeignClient.getConfigAllApp(); + logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp result:{}", JSON.toJSONString(configAllAppResult)); + if (configAllAppResult == null || !configAllAppResult.success()) { + logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp fail"); + return; + } + result = configAllAppResult.getData(); + result.forEach(app -> { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(app.getAppId()); + config.setSecret(app.getSecret()); + config.setMsgDataFormat(JSON_STR); + + WxMaService service = new WxMaServiceImpl(); + service.setWxMaConfig(config); + maServicesNew.put(app.getAppId(), service); + }); + } catch (Exception e) { + logger.error("init wxMaService from db exception", e); + } + if (maServicesNew.size() > 0) { + maServices = maServicesNew; + if (appSet != null && result != null) { + appSet.add(appKey, result); + } + } + } +} diff --git a/epmet-auth/src/main/java/com/epmet/service/LoginService.java b/epmet-auth/src/main/java/com/epmet/service/LoginService.java index 248e7c4d97..a0e429eff9 100644 --- a/epmet-auth/src/main/java/com/epmet/service/LoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/LoginService.java @@ -45,11 +45,12 @@ public interface LoginService { * @return cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult * @param app * @param wxCode + * @param appId 非必填 * @Author yinzuomei * @Description 解析wxCode * @Date 2020/4/19 0:24 **/ - WxMaJscode2SessionResult getWxMaUser(String app, String wxCode); + WxMaJscode2SessionResult getWxMaUser(String app, String wxCode, String appId); /** * @return java.lang.String diff --git a/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java index 0ee6449c90..80fd7ea305 100644 --- a/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PublicSendSmsCodeFormDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.UserTokenResultDTO; /** @@ -38,4 +39,12 @@ public interface PublicUserLoginService { **/ UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + UserTokenResultDTO register(RegisterFormDTO formDTO); + } diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index 4a9d939a93..a532adec56 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.dto.form.LoginFormDTO; +import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO; import com.epmet.dto.result.UserTokenResultDTO; /** @@ -24,4 +25,12 @@ public interface ThirdLoginService { * @Description 单客户-政府端微信小程序登录 **/ UserTokenResultDTO workLogin(LoginFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 092a327312..d9134aabec 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -21,10 +21,7 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.feign.EpmetMessageOpenFeignClient; -import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.*; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; import com.epmet.redis.CaptchaRedis; @@ -67,6 +64,8 @@ public class GovLoginServiceImpl implements GovLoginService { private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private EpmetUserOpenFeignClient userOpenFeignClient; + @Autowired + private EpmetThirdFeignClient epmetThirdFeignClient; /** * @param formDTO @@ -141,7 +140,7 @@ public class GovLoginServiceImpl implements GovLoginService { @Override public UserTokenResultDTO loginByWxCode(GovWxmpFormDTO formDTO) { //1、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode()); + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode(), formDTO.getAppId()); if(null!=wxMaJscode2SessionResult){ logger.info(String.format("app=%s,wxCode=%s,openId=%s",formDTO.getApp(),formDTO.getWxCode(),wxMaJscode2SessionResult.getOpenid())); } @@ -273,7 +272,8 @@ public class GovLoginServiceImpl implements GovLoginService { } CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); //2、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode(), formDTO.getAppId()); + //3、记录staff_wechat,并记录用户激活状态,激活时间 this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); //4、记录登录日志 @@ -437,7 +437,7 @@ public class GovLoginServiceImpl implements GovLoginService { govTokenDto.setUserId(staffId); govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); - govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); + govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid()); govTokenDto.setToken(token); govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 695c187105..adadb9b626 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; +import com.alibaba.fastjson.JSON; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -22,6 +23,7 @@ import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperAccessOpenFeignClient; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; +import com.epmet.redis.CustomerAppWxServiceUtil; import com.epmet.service.CaptchaService; import com.epmet.service.LoginService; import com.epmet.utils.WxMaServiceUtils; @@ -82,7 +84,7 @@ public class LoginServiceImpl implements LoginService { throw new RenException("参数错误"); } //1、根据wxCode获取微信信息 - WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode()); + WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode(),formDTO.getAppId()); logger.info("openId=[" + wxMaJscode2SessionResult.getOpenid() + "]unionId=[" + wxMaJscode2SessionResult.getUnionid() + "]"); //2、根据openId查询数据库,没有则直接插入一条记录 String userId = this.getUserId(formDTO, wxMaJscode2SessionResult); @@ -109,21 +111,29 @@ public class LoginServiceImpl implements LoginService { * @date 2020/3/14 20:16 */ @Override - public WxMaJscode2SessionResult getWxMaUser(String app,String wxCode) { + public WxMaJscode2SessionResult getWxMaUser(String app,String wxCode,String appId) { WxMaJscode2SessionResult wxMaJscode2SessionResult = null; try { - if (LoginConstant.APP_GOV.equals(app)) { - wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode); - } else if (LoginConstant.APP_OPER.equals(app)) { - wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(wxCode); - } else if (LoginConstant.APP_RESI.equals(app)) { - wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode); + if (StringUtils.isNotBlank(appId)){ + WxMaService wxMaService = CustomerAppWxServiceUtil.getWxMaService(appId); + if (wxMaService == null){ + throw new RenException("解析微信用户信息失败"); + } + wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(wxCode); + }else{ + if (LoginConstant.APP_GOV.equals(app)) { + wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode); + } else if (LoginConstant.APP_OPER.equals(app)) { + wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(wxCode); + } else if (LoginConstant.APP_RESI.equals(app)) { + wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode); + } } } catch (WxErrorException e) { - log.error("->[getMaOpenId]::error[{}]", "解析微信code失败"); + log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e); } if (null == wxMaJscode2SessionResult) { - log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s]",app,wxCode)); + log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult))); throw new RenException("解析微信用户信息失败"); } else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) { log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode)); @@ -137,7 +147,12 @@ public class LoginServiceImpl implements LoginService { String phone=""; try { ValidatorUtils.validateEntity(formDTO, ResiWxPhoneFormDTO.AddUserInternalGroup.class); - WxMaService wxMaService = wxMaServiceUtils.resiWxMaService(); + WxMaService wxMaService = null; + if (StringUtils.isNotBlank(formDTO.getAppId())){ + wxMaService = CustomerAppWxServiceUtil.getWxMaService(formDTO.getAppId()); + }else{ + wxMaService = wxMaServiceUtils.resiWxMaService(); + } WxMaJscode2SessionResult wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(formDTO.getWxCode()); WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(wxMaJscode2SessionResult.getSessionKey(), formDTO.getEncryptedData(), diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 6d0e615944..524f475671 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -1,8 +1,10 @@ package com.epmet.service.impl; import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; @@ -14,10 +16,7 @@ import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.PaUserDTO; import com.epmet.dto.PaUserWechatDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CustomerUserResultDTO; -import com.epmet.dto.result.SaveUserResultDTO; -import com.epmet.dto.result.SendVerificationCodeResultDTO; -import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetThirdFeignClient; import com.epmet.jwt.JwtTokenProperties; @@ -33,8 +32,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -100,6 +101,10 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { logger.error("wxMpUser is null"); throw new RenException("解析微信用户信息失败 wxMpUser is null"); } + if(StringUtils.isBlank(wxMpUser.getOpenId())){ + logger.error("wxMpUser.getOpenId() is null"); + throw new RenException("解析微信用户信息失败"); + } /*if(StringUtils.isBlank(wxMpUser.getUnionId())){ logger.error("wxMpUser.getUnionId() is null"); // throw new RenException("解析微信用户信息失败"); @@ -242,4 +247,35 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { return userTokenResultDTO; } + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + @Override + public UserTokenResultDTO register(RegisterFormDTO formDTO) { + //1.调用epmet-third服务,完成信息注册 + Result result = epmetThirdFeignClient.register(formDTO); + if (!result.success()) { + logger.error("调用epmet_third服务初始化用户信息失败"); + throw new RenException(result.getCode()); + } + RegisterResultDTO resultDTO = result.getData(); + + //2.直接生成一个新的token放入缓存中(不管缓存中是否存在旧的token,都重新生成) + //2-1.生成token + String token = this.generateGovWxmpToken(resultDTO.getUserId()); + //2-2.token存入redis + String openid = resultDTO.getOpenId(); + String unionId = (null == resultDTO.getUnionId() ? "" : resultDTO.getUnionId()); + this.saveLatestGovTokenDto("", resultDTO.getUserId(), openid, unionId, token); + + //3.返回token + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; + } + + } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 4985f4d9e8..df85d0ccd1 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -10,10 +11,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.UserDTO; -import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.DepartmentListResultDTO; import com.epmet.dto.result.GridByStaffResultDTO; @@ -347,4 +345,100 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { return null; } + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + @Override + public UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO) { + //1、需要校验要登录的客户,是否被禁用 + CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO(); + customerStaffFormDTO.setCustomerId(formDTO.getCustomerId()); + customerStaffFormDTO.setMobile(formDTO.getMobile()); + Result customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfo(customerStaffFormDTO); + if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { + logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); + throw new RenException(customerStaffDTOResult.getCode()); + } + CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); + //2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun start + //2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 + WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); + resiLoginFormDTO.setAppId(formDTO.getAppId()); + resiLoginFormDTO.setWxCode(formDTO.getWxCode()); + Result result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO); + if (!result.success()) { + logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败"); + throw new RenException(result.getCode()); + } + UserWechatDTO userWechatDTO = result.getData(); + WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult(); + wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId()); + wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey()); + wxMaJscode2SessionResult.setUnionid(""); + // end + + //3、记录staff_wechat,并记录用户激活状态,激活时间 + this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + //4、记录登录日志 + this.saveGovStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + //5.1、获取用户token + String token = this.generateGovWxmpToken(customerStaff.getUserId()); + //5.2、保存到redis + this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; + } + + //保存登录日志 + private Result saveGovStaffLoginRecord(ThirdWxmpEnteOrgFormDTO formDTO, String staffId, String openId) { + StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); + staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId()); + staffLoginAgencyRecordFormDTO.setStaffId(staffId); + staffLoginAgencyRecordFormDTO.setWxOpenId(openId); + staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); + staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getRootAgencyId()); + Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); + return staffLoginRecordResult; + } + + /** + * @Description 生成token + * @Date 2020/4/18 23:04 + **/ + private void saveGovTokenDto(String orgId, + String customerId, + String staffId, + WxMaJscode2SessionResult wxMaJscode2SessionResult, + String token) { + int expire = jwtTokenProperties.getExpire(); + GovTokenDto govTokenDto = new GovTokenDto(); + govTokenDto.setApp(LoginConstant.APP_GOV); + govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setUserId(staffId); + govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); + govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); + govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid()); + govTokenDto.setToken(token); + govTokenDto.setUpdateTime(System.currentTimeMillis()); + govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + govTokenDto.setRootAgencyId(orgId); + govTokenDto.setCustomerId(customerId); + + //设置部门,网格,角色列表 + govTokenDto.setDeptIdList(getDeptartmentIdList(staffId)); + govTokenDto.setGridIdList(getGridIdList(staffId)); + CustomerAgencyDTO agency = getAgencyByStaffId(staffId); + if (agency != null) { + govTokenDto.setAgencyId(agency.getId()); + govTokenDto.setRoleList(queryGovStaffRoles(staffId, agency.getId())); + } + govTokenDto.setOrgIdPath(getOrgIdPath(staffId)); + cpUserDetailRedis.set(govTokenDto, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + } + } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java new file mode 100644 index 0000000000..8ccaba98b4 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java @@ -0,0 +1,20 @@ +package com.epmet.commons.tools.constant; + +/** + * 消息常亮 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 9:58 + */ +public interface MqConstant { + + /** + * 加分 plus + */ + String PLUS="plus"; + + /** + * 减分标识 minus + */ + String MINUS="minus"; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index b4a81ce53a..944c8afb2f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -48,4 +48,29 @@ public interface StrConstant { * 中文顿号 */ String COMMA_ZH = "、"; + + /** + * 反斜杠 + */ + String SEPARATOR = "/"; + + /** + * true + */ + String TRUE = "true"; + + /** + * true + */ + String FALSE = "false"; + + /** + * * + */ + String STAR="*"; + + /** + * 空字符串 + */ + String EPMETY_STR=""; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java new file mode 100644 index 0000000000..fb82587822 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java @@ -0,0 +1,41 @@ +package com.epmet.commons.tools.dto.form.mq; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:消息网关事件类型dto + * + * @author lyn + * @date 2020/7/24 18:30 + */ +@Data +public class EventClassDto implements Serializable { + private static final long serialVersionUID = 6923860669547819790L; + /** + * appId + */ + private String appId; + /** + * 事件类型Id + */ + private Integer id; + /** + * 事件标识 + */ + private String eventClass; + /** + * 事件名称 + */ + private String eventClassName; + /** + * 0''未删''1''已删 + */ + private Integer delFlag; + /** + * 事件计数 + */ + private Integer eventCount; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java index 812d2e5baa..6e9318549e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java @@ -3,6 +3,8 @@ package com.epmet.commons.tools.dto.form.mq; import lombok.Data; import org.springframework.stereotype.Component; +import javax.validation.constraints.NotBlank; + /** * 消息网关基础信息 * @@ -11,20 +13,23 @@ import org.springframework.stereotype.Component; **/ @Data @Component -public class MqBaseMsgDTO extends MqConfigDTO { +public class MqBaseMsgDTO extends MqBaseParamDTO { private static final long serialVersionUID = 8176470786428432009L; /** * mq的事件类型 */ + @NotBlank(message = "事件类型不能为空") private String eventClass; /** * 事件code */ + @NotBlank(message = "事件标识不能为空") private String eventTag; /** * 消息体 */ + @NotBlank(message = "消息体不能为空") private String msg; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java similarity index 83% rename from epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java index 24a388f8ae..9ad8df6cf4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java @@ -11,7 +11,7 @@ import java.io.Serializable; * @date 2020-07-21 14:33 **/ @Data -public class MqConfigDTO implements Serializable { +public class MqBaseParamDTO implements Serializable { private String appId; private String token; private String requestUrl; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java new file mode 100644 index 0000000000..60db245a07 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java @@ -0,0 +1,18 @@ +package com.epmet.commons.tools.dto.form.mq.eventmsg; + +import lombok.Data; + +/** + * 结束活动,发放活动积分消息体 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 9:26 + */ +@Data +public class ActPointEventMsg extends BasePointEventMsg{ + /** + * 参与活动的备注 + */ + private String remark; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java new file mode 100644 index 0000000000..435234f7dd --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java @@ -0,0 +1,45 @@ +package com.epmet.commons.tools.dto.form.mq.eventmsg; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分相关事件消息体 + * + * @author lyn + * @date 2020/7/23 16:34 + */ +@Data +public class BasePointEventMsg implements Serializable { + private static final long serialVersionUID = 4037225404113743943L; + + /** + * 操作人机关id + */ + private String opAgencyId; + + /** + * 客户Id + */ + private String customerId; + /** + * 被操作用户id + */ + private String userId; + + /** + * 加减分标识 plus/minus + */ + private String actionFlag; + + /** + * 积分值 + */ + private Integer point; + + /** + * 是否是通用事件,通用事件不走规则 + */ + private Boolean isCommon; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java new file mode 100644 index 0000000000..1dc0b571c5 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java @@ -0,0 +1,42 @@ +package com.epmet.commons.tools.enums; + +/** + * 通用操作类型 枚举类 + * dev|test|prod + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum CommonOperateTypeEnum { + ADD("add", "添加"), + EDIT("edit", "编辑"), + DEL("del", "删除"), + ; + + private String code; + private String desc; + + + CommonOperateTypeEnum(String code, String name) { + this.code = code; + this.desc = name; + } + + public static CommonOperateTypeEnum getEnum(String code) { + CommonOperateTypeEnum[] values = CommonOperateTypeEnum.values(); + for (CommonOperateTypeEnum value : values) { + if (code != null && value.getCode().equals(code)) { + return value; + } + } + return null; + } + + public String getCode() { + return code; + } + + public String getDesc() { + return desc; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java new file mode 100644 index 0000000000..68347c29f9 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -0,0 +1,47 @@ +package com.epmet.commons.tools.enums; + +/** + * 系统支持的事件枚举类 + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum EventEnum { + ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"), + REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"), + ACTIVE_INSERT_LIVE("active_insert_live", "epmet_heart", "添加活动实况"), + ; + + private String eventClass; + private String eventTag; + private String eventDesc; + + + EventEnum(String eventTag, String eventClass, String eventDesc) { + this.eventTag = eventTag; + this.eventClass = eventClass; + this.eventDesc = eventDesc; + } + + public static EventEnum getEnum(String eventCode) { + EventEnum[] values = EventEnum.values(); + for (EventEnum value : values) { + if (eventCode != null && value.getEventTag().equals(eventCode)) { + return value; + } + } + return null; + } + + public String getEventTag() { + return eventTag; + } + + public String getEventClass() { + return eventClass; + } + + public String getEventDesc() { + return eventDesc; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java index 014722de84..866229d1d9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java @@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums; **/ public enum MqMethodPathEnum { SEND_MSG("producerService/producer/sendMsg", "发送消息"), + GET_EVENT_LIST("eventClass/getList", "获取事件类型列表"), ; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 63cab186d4..7ec8b301fd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -54,6 +54,13 @@ public enum EpmetErrorCode { ACT_CONTENT_TEXT_SCAN_FAILED(8116,"活动详情内容审核失败,请重新编辑"), ACT_CONTENT_IMG_SCAN_FAILED(8117,"活动详情图片失败,请重新编辑"), ACT_COVER_PIC_SCAN_FAILED(8118,"活动封面图片审核失败,请重新编辑"), + ACT_START_TIME_ERROR(8119,"活动预计开始时间应早于活动预计结束时间"), + ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"), + ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"), + ACT_ACTUAL_START_TIME_ERROR(8122,"实际开始时间应早于实际结束时间"), + HAVE_HANDLE(8123,"存在待处理事项,请先处理"), + ACTUAL_TIME(8124,"请录入实际开始时间,实际结束时间"), + ACTUAL_NOT_FINISHED(8125,"请先结束活动"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), @@ -74,6 +81,11 @@ public enum EpmetErrorCode { IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"), PROJECT_IS_CLOSED(8601,"项目已结案"), + // 爱心互助 居民端 + NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), + NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"), + ACT_TIME_CONFLICT(8512, "活动时间冲突"), + // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 0dadd18200..457788f5a9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -254,6 +254,14 @@ public class RedisKeys { return rootPrefix.concat("tags:grid:relationTag:").concat(gridId).concat(StrConstant.COLON).concat(tagId); } + /** + * appId secret 缓存Key + * @return + */ + public static String getCustomerAppKey() { + return rootPrefix.concat("oper:crm:app"); + } + /** * 获取生成的用户标识 缓存Key * @param shortUserId diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index e76c5a4c33..d7c2098221 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -341,12 +341,12 @@ public class DateUtils { return DateUtils.addDateDays(nextMonth, -1); } - public static void main(String[] args) { - //int weekOfYear = getWeekOfYear(new Date()); - String format = String.format("%02d", 9); - - System.out.println(666); - } +// public static void main(String[] args) { +// //int weekOfYear = getWeekOfYear(new Date()); +// String format = String.format("%02d", 9); +// +// System.out.println(666); +// } /** * 获取日期前一天 @@ -485,7 +485,7 @@ public class DateUtils { public static String formatTimestamp(Long timestamp, String pattern) { //设置格式 SimpleDateFormat format = new SimpleDateFormat(pattern); - return format.format(timestamp); + return format.format(timestamp * 1000); } public static Date minStrToSecondDate(String minStr){ @@ -502,4 +502,12 @@ public class DateUtils { return null; } + public static Integer calculateMin(Date startDate,Date endDate){ + long start=startDate.getTime(); + long end=endDate.getTime(); + // 计算差多少分钟 + int minutes = (int) ((end - start) / (1000 * 60)); + System.out.println("两个时间之间的分钟差为:" + minutes); + return minutes; + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java new file mode 100644 index 0000000000..a9623b7cde --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java @@ -0,0 +1,37 @@ +package com.epmet.commons.tools.utils; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; + +public class FileUtils { + + /** + * 创建临时文件. + * + * @param inputStream 输入文件流 + * @param name 文件名 + * @param ext 扩展名 + * @param tmpDirFile 临时文件夹目录 + */ + public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException { + File resultFile = File.createTempFile(name, '.' + ext, tmpDirFile); + + resultFile.deleteOnExit(); + org.apache.commons.io.FileUtils.copyToFile(inputStream, resultFile); + return resultFile; + } + + /** + * 创建临时文件. + * + * @param inputStream 输入文件流 + * @param name 文件名 + * @param ext 扩展名 + */ + public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException { + return createTmpFile(inputStream, name, ext, Files.createTempDirectory("weixin-java-tools-temp").toFile()); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 5061222074..151ad8e10d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -6,7 +6,6 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; @@ -23,9 +22,10 @@ import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; @@ -43,6 +43,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; @@ -170,11 +171,20 @@ public class HttpClientManager { try { HttpPost httppost = new HttpPost(url); httppost.setConfig(requestConfig); - httppost.addHeader("Content-Type", "application/json; charset=utf-8"); - FileBody fileBody = new FileBody(file); - HttpEntity reqEntity = MultipartEntityBuilder.create() - .addPart("media", fileBody).build(); - httppost.setEntity(reqEntity); + String boundaryStr = "------------" + System.currentTimeMillis(); + httppost.addHeader("Connection", "keep-alive"); + httppost.addHeader("Accept", "*/*"); + httppost.addHeader("Content-Type", "multipart/form-data;boundary=" + boundaryStr); + httppost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); + MultipartEntityBuilder meb = MultipartEntityBuilder.create(); + meb.setBoundary(boundaryStr).setCharset(StandardCharsets.UTF_8).setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + meb.addBinaryBody("media", file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); + HttpEntity entity = meb.build(); + httppost.setEntity(entity); +// FileBody fileBody = new FileBody(file); +// HttpEntity reqEntity = MultipartEntityBuilder.create() +// .addPart("media", fileBody).build(); +// httppost.setEntity(reqEntity); return execute(httppost,false); } catch (Exception e) { log.error("send exception", e); @@ -295,6 +305,7 @@ public class HttpClientManager { return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } + /** * desc: 发送get请求 * param:url, params @@ -303,7 +314,7 @@ public class HttpClientManager { * * @author: jianjun liu */ - public Result sendGetFile(String url, Map params) { + public Result getByteArray(String url, Map params) { try { URIBuilder builder = new URIBuilder(url); @@ -318,11 +329,71 @@ public class HttpClientManager { return executeToByte(httpGet); } catch (Exception e) { log.error("sendGet exception", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + + private Result executeToByte(HttpRequestBase httpMethod) { + CloseableHttpResponse response = null; + try { + response = httpclient.execute(httpMethod); + log.debug("http send response:{}", JSON.toJSONString(response)); + if (response != null && response.getStatusLine() != null) { + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + InputStream in = response.getEntity().getContent(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = in.read(buffer))) { + output.write(buffer, 0, n); + } +// return new Result().ok(ArrayUtils.toObject(output.toByteArray())); + return new Result().ok(output.toByteArray()); + } else { + log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); + } + } + } catch (Exception e) { + log.error("execute exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } finally { + httpMethod.releaseConnection(); + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + } + } + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + + /** + * 获取下载文件的字节数组 + * @param url + * @param params + * @return + */ + public Result getDownloadFilebytes(String url, Map params) { + + try { + URIBuilder builder = new URIBuilder(url); + if (!CollectionUtils.isEmpty(params)) { + Set set = params.keySet(); + for (String key : set) { + builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key))); + } + } + HttpGet httpGet = new HttpGet(builder.build()); + httpGet.setConfig(requestConfig); + return executeTobyte(httpGet); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } } - private Result executeToByte(HttpRequestBase httpMethod) { + private Result executeTobyte(HttpRequestBase httpMethod) { CloseableHttpResponse response = null; try { response = httpclient.execute(httpMethod); @@ -336,14 +407,14 @@ public class HttpClientManager { while (-1 != (n = in.read(buffer))) { output.write(buffer, 0, n); } - return new Result().ok(ArrayUtils.toObject(output.toByteArray())); + return new Result().ok(output.toByteArray()); } else { log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); } } } catch (Exception e) { log.error("execute exception", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); } finally { httpMethod.releaseConnection(); try { @@ -353,7 +424,7 @@ public class HttpClientManager { } catch (IOException e) { } } - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } private static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java index 65fb179ca3..dede8d5706 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java @@ -4,14 +4,21 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.epmet.commons.tools.config.MqConfig; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.mq.EventClassDto; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult; import com.epmet.commons.tools.enums.MqMethodPathEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.DefaultGroup; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 发送亿联云消息工具类 * @@ -21,7 +28,7 @@ import org.springframework.stereotype.Component; @Slf4j @Component public class SendMqMsgUtils { - private static MqConfig mqStaticConfig; + private static MqConfig mqConfig; /** * desc:发送mq消息 @@ -29,19 +36,19 @@ public class SendMqMsgUtils { * @return */ public static Result sendMsg(MqBaseMsgDTO msg) { - if (mqStaticConfig == null) { - mqStaticConfig = SpringContextUtils.getBean(MqConfig.class); + if (mqConfig == null) { + mqConfig = SpringContextUtils.getBean(MqConfig.class); } log.debug("sendMsg param:{}", JSON.toJSONString(msg)); try { // TODO - //ValidatorUtils.validateEntity(msg, null); + ValidatorUtils.validateEntity(msg, DefaultGroup.class); } catch (ValidateException e) { return new Result().error(e.getMsg()); } - msg.setAppId(mqStaticConfig.getAppId()); - msg.setRequestUrl(mqStaticConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode())); - msg.setToken(mqStaticConfig.getToken()); + msg.setAppId(mqConfig.getAppId()); + msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode())); + msg.setToken(mqConfig.getToken()); try { Result result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg)); log.debug("sendMsg result:{}", JSON.toJSONString(result)); @@ -66,4 +73,42 @@ public class SendMqMsgUtils { } + /** + * desc:发送mq消息 + * + * @return + */ + public static Result> getEventClassList() { + if (mqConfig == null) { + mqConfig = SpringContextUtils.getBean(MqConfig.class); + } + Map param = new HashMap<>(); + param.put("appId", mqConfig.getAppId()); + param.put("token", mqConfig.getToken()); + String requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode()); + + try { + Result result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param)); + log.debug("getEventClassList result:{}", JSON.toJSONString(result)); + if (result.success()) { + MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class); + if (resultResult.getErrCode().equals(NumConstant.ZERO)) { + List eventClassDto = JSON.parseArray(resultResult.getData(), EventClassDto.class); + return new Result>().ok(eventClassDto); + } else { + log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult)); + return new Result>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg()); + } + } + Result> resultResult = new Result<>(); + resultResult.error(result.getCode(), result.getMsg()); + resultResult.setInternalMsg(result.getInternalMsg()); + return resultResult; + } catch (Exception e) { + log.debug("sendMsg exception", e); + return new Result>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + + } diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index 702ce1f34e..b4dc44a7df 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.27 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.28 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/deploy/docker-compose-prod.yml b/epmet-gateway/deploy/docker-compose-prod.yml index 35a4e7e1e2..cec8fb60da 100644 --- a/epmet-gateway/deploy/docker-compose-prod.yml +++ b/epmet-gateway/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.26 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 057ba37342..3944de1695 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.27 + 0.3.28 com.epmet epmet-cloud @@ -108,7 +108,7 @@ - + lb://epmet-auth-server lb://epmet-admin-server @@ -130,6 +130,7 @@ lb://oper-customize-server lb://oper-crm-server + lb://resi-guide-server @@ -282,7 +283,7 @@ lb://epmet-heart-server - http://127.0.0.1:8112 + lb://epmet-point-server @@ -367,7 +368,7 @@ lb://epmet-heart-server - http://127.0.0.1:8112 + lb://epmet-point-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index c2105542bb..851ac62764 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -353,6 +353,8 @@ renren: - /resi/group/** - /resi/partymember/** - /gov/grid/** + - /heart/** + - /point/** management: endpoints: web: diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 811a2df85c..e86909b2c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.39 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.41 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml index 3b3123c312..4d3be03e5d 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.39 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.41 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 971d0c956a..1709484e94 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.39 + 0.3.41 data-statistical com.epmet diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java index bfe699c25e..f3618f4e06 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java @@ -43,4 +43,6 @@ public interface CustomerDao extends BaseDao { List listValidCustomersByCreateTime( @Param("createTimeFrom") Date createTimeFrom, @Param("createTimeTo") Date createTimeTo); + + List listValidCustomersByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java index 2b9b4705ab..8db5a46efb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java @@ -38,4 +38,5 @@ public interface CustomerDepartmentDao extends BaseDao @Param("createdTimeFrom") Date createdTimeFrom, @Param("createdTimeTo") Date createdTimeTo); + List listDepartmentsByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java index faccf553a2..9f26b8b98d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -59,4 +59,12 @@ public interface CustomerGridDao extends BaseDao { * @author zxc */ List getCustomerGridIdList(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 根据更新时间查询列表 + * @param startTime + * @param endTime + * @return + */ + List listUpdatedGridsByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index b3de9cfd02..eb02051e91 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -20,4 +20,6 @@ public interface StatsCustomerAgencyDao extends BaseDao { List selectAllAgency(); List selectSubAgencyByPid(@Param("pid")String pid); + + List listAgenciesByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java index 419a54ef2c..8788232a7b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java @@ -124,4 +124,6 @@ public interface DimAgencyDao extends BaseDao { String getPidByAgencyId(@Param("agencyId") String agencyId); DimAgencyEntity getLatestCreatedAgencyDimEntity(); + + DimAgencyEntity getLatestUpdatedAgencyDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java index 1834b73ffc..8bd2c3cf8d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java @@ -47,4 +47,6 @@ public interface DimCustomerDao extends BaseDao { void insertOne(DimCustomerEntity dim); DimCustomerEntity getLatestCreatedDimEntity(); + + DimCustomerEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java index 5098869983..0b58bc2220 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java @@ -42,4 +42,6 @@ public interface DimDepartmentDao extends BaseDao { List getDepartmentListByCustomerId(@Param("customerId") String customerId); DimDepartmentEntity getLatestCreatedDimEntity(); + + DimDepartmentEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java index 669e8a08a0..c1671131b1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java @@ -58,4 +58,6 @@ public interface DimGridDao extends BaseDao { * @author zxc */ List selectSubAgencyId(@Param("formDTO")List formDTO); + + DimGridEntity getLastUpdatedGridDim(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java index e562a08365..dbc2cc03f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java @@ -9,4 +9,5 @@ public interface CustomerService { List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); + List listValidCustomersByUpdatedTime(Date updatedTime, Date initTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java index 3db2f197bd..056df4e50e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java @@ -22,4 +22,9 @@ public class CustomerServiceImpl implements CustomerService { public List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo); } + + @Override + public List listValidCustomersByUpdatedTime(Date startTime, Date endTime) { + return customerDao.listValidCustomersByUpdateTime(startTime, endTime); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index dde7d9f14e..5c09458416 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -1,8 +1,6 @@ package com.epmet.service.impl; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.RobotConstant; -import com.epmet.constant.StatsSubject; import com.epmet.entity.crm.CustomerEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.org.CustomerDepartmentEntity; @@ -18,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -54,6 +53,17 @@ public class StatsDimServiceImpl implements StatsDimService { @Override public void initGridDim() { + List newDimGrids = getNewDimGrids(); + List changedGrids = getChangedGrids(); + + dimGridService.initGridDims(newDimGrids, changedGrids); + } + + /** + * 初始化新建网格 + * @return + */ + public List getNewDimGrids() { DimGridEntity lastDimEntity = dimGridService.getLastCreatedGridDim(); List grids; Date now = new Date(); @@ -65,10 +75,36 @@ public class StatsDimServiceImpl implements StatsDimService { grids = customerGridService.listGridsByCreateTime(lastInitTime, now); } - List gridDims = convertCustomerGrid2GridDim(grids, now); - if (!CollectionUtils.isEmpty(gridDims)) { - dimGridService.initGridDims(gridDims); + return convertCustomerGrid2GridDim(grids, now); + } + + /** + * 初始化变更的网格 + * @return + */ + public List getChangedGrids() { + DimGridEntity lastUpdatedGridDim = dimGridService.getLastUpdatedGridDim(); + + List updatedGrids; + Date now = new Date(); + if (lastUpdatedGridDim != null) { + Date lastInitTime = lastUpdatedGridDim.getUpdatedTime(); + updatedGrids = customerGridService.listUpdatedGridsByUpdateTime(lastInitTime, now); + ArrayList dimGrids = new ArrayList<>(); + for (CustomerGridEntity updatedGrid : updatedGrids) { + DimGridEntity dimGrid = dimGridService.selectById(updatedGrid.getId()); + if (dimGrid != null) { + dimGrid.setGridName(updatedGrid.getGridName()); + dimGrid.setUpdatedTime(now); + dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT); + dimGrids.add(dimGrid); + } + } + + return dimGrids; } + + return new ArrayList<>(); } /** @@ -98,19 +134,41 @@ public class StatsDimServiceImpl implements StatsDimService { */ @Override public void initAgencyDim() { + Date now = new Date(); + List agencies2Add = listAgencies2Add(now); + List agencies2Update = listAgencies2Update(now); + dimAgencyService.initAgencyDims(agencies2Add, agencies2Update, now); + } + + /** + * 查询需要添加的机关ç + * @return + */ + public List listAgencies2Add(Date endDate) { DimAgencyEntity latestCreatedAgencyDim = dimAgencyService.getLatestCreatedAgencyDimEntity(); - Date now = new Date(); Date lastInitTime = null; if (latestCreatedAgencyDim != null) { lastInitTime = latestCreatedAgencyDim.getCreatedTime(); } - List agencies = customerAgencyService.listAgenciesByCreateTime(lastInitTime, now); - if (!CollectionUtils.isEmpty(agencies)) { - dimAgencyService.initAgencyDims(agencies, now); + return customerAgencyService.listAgenciesByCreateTime(lastInitTime, endDate); + } + + /** + * 查询需要更新的机关 + * @return + */ + public List listAgencies2Update(Date endDate) { + DimAgencyEntity latestUpdatedAgencyDim = dimAgencyService.getLatestUpdatedAgencyDimEntity(); + + if (latestUpdatedAgencyDim != null) { + // 不是首次初始化,可以更新 + Date updatedTime = latestUpdatedAgencyDim.getUpdatedTime(); + return customerAgencyService.listAgenciesByUpdatedTime(updatedTime, endDate); } + return new ArrayList<>(); } /** @@ -118,24 +176,59 @@ public class StatsDimServiceImpl implements StatsDimService { */ @Override public void initCustomerDim() { + Date now = new Date(); + List newCustomers = listNewCustomers(now); + List updatedCustomers = listUpdatedCustomers(now); +// System.out.println(666); + dimCustomerService.initCustomerDims(newCustomers, updatedCustomers, now); + } + + /** + * 查询新增的客户列表 + * @param initTime + * @return + */ + public List listNewCustomers(Date initTime) { DimCustomerEntity lastCreateDim = dimCustomerService.getLatestCreatedDimEntity(); - Date now = new Date(); Date lastInitTime = null; if (lastCreateDim != null) { lastInitTime = lastCreateDim.getCreatedTime(); } - List customers = customerService.listValidCustomersByCreateTime(lastInitTime, now); - if (!CollectionUtils.isEmpty(customers)) { - dimCustomerService.initCustomerDims(customers, now); + List customers = customerService.listValidCustomersByCreateTime(lastInitTime, initTime); + + return customers; + } + + /** + * 查询更新的客户列表 + * @param initTime + * @return + */ + public List listUpdatedCustomers(Date initTime) { + DimCustomerEntity lastCreatedDim = dimCustomerService.getLatestUpdatedDimEntity(); + if (lastCreatedDim != null) { + // 说明不是首次初始化 + List customers = customerService.listValidCustomersByUpdatedTime(lastCreatedDim.getUpdatedTime(), initTime); + return customers; } + return new ArrayList<>(); } + /** + * 初始化部门维度 + */ @Override public void initDepartmentDim() { + Date now = new Date(); + List newDepartments = listNewDepartments(now); + List updatedDepartments = listUpdatedDepartments(now); + dimDepartmentService.initDepartmentDims(newDepartments, updatedDepartments, now); + } + public List listNewDepartments(Date initTime) { DimDepartmentEntity lastCreatedDeptDim = dimDepartmentService.getLatestCreatedDimEntity(); Date now = new Date(); @@ -144,10 +237,14 @@ public class StatsDimServiceImpl implements StatsDimService { if (lastCreatedDeptDim != null) { lastInitTime = lastCreatedDeptDim.getCreatedTime(); } + return departmentService.listDepartmentsByCreatedTime(lastInitTime, now); + } - List departments = departmentService.listDepartmentsByCreatedTime(lastInitTime, now); - if (!CollectionUtils.isEmpty(departments)) { - dimDepartmentService.initDepartmentDims(departments, now); + public List listUpdatedDepartments(Date initTime) { + DimDepartmentEntity lastUpdatedDeptDim = dimDepartmentService.getLatestUpdatedDimEntity(); + if (lastUpdatedDeptDim != null) { + return departmentService.listDepartmentsByUpdatedTime(lastUpdatedDeptDim.getCreatedTime(), initTime); } + return new ArrayList<>(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index c0f4b194a9..bcc55ede28 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -613,7 +613,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { for (ArticleTagsEntity tagEntity : articleTagsList) { ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); if (articleEntity == null) { - log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); + log.error("publicitySummary articleMap not contain articleId:{} ", tagEntity.getArticleId()); continue; } DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java index 034499e955..96669f2ae9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -7,4 +7,6 @@ import java.util.List; public interface CustomerAgencyService { List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime); + + List listAgenciesByUpdatedTime(Date updatedTime, Date now); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java index 1aa2c2f7db..15178715ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java @@ -8,4 +8,6 @@ import java.util.List; public interface CustomerDepartmentService { List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo); + + List listDepartmentsByUpdatedTime(Date createdTime, Date initTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 00b46e8b75..b2b7a5b129 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -32,4 +32,12 @@ public interface CustomerGridService { * @author zxc */ List getCustomerGridIdList(String customerId, String dateId); + + /** + * 根据更新时间查询变更过的网格列表 + * @param lastInitTime + * @param now + * @return + */ + List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index 2912ca0cca..4813309176 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -22,4 +22,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { public List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime); } + + @Override + public List listAgenciesByUpdatedTime(Date startTime, Date endTime) { + return customerAgencyDao.listAgenciesByUpdatedTime(startTime, endTime); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java index ac430a3abd..0a7a4e380a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java @@ -28,4 +28,9 @@ public class CustomerDepartmentServiceImpl implements CustomerDepartmentService public List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) { return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo); } + + @Override + public List listDepartmentsByUpdatedTime(Date startTime, Date endTime) { + return departmentDao.listDepartmentsByUpdatedTime(startTime, endTime); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index fc95a3de29..5bab5596a7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -46,4 +46,9 @@ public class CustomerGridServiceImpl implements CustomerGridService { public List getCustomerGridIdList(String customerId, String dateId) { return customerGridDao.getCustomerGridIdList(customerId, dateId); } + + @Override + public List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) { + return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index df58489fd0..aad2cae314 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java @@ -107,9 +107,8 @@ public interface DimAgencyService extends BaseService { /** * 初始化机关维度 - * @param agencies */ - void initAgencyDims(List agencies, Date initTime); + void initAgencyDims(List agencies2Add, List agencies2Update, Date initTime); /** * @Description 查询所有机关以及它下级机关的信息 @@ -175,4 +174,6 @@ public interface DimAgencyService extends BaseService { String getPidByAgencyId(String agencyId); DimAgencyEntity getLatestCreatedAgencyDimEntity(); + + DimAgencyEntity getLatestUpdatedAgencyDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java index d3562d01db..9d53593957 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java @@ -110,9 +110,10 @@ public interface DimCustomerService extends BaseService { /** * 添加客户维度 - * @param customers */ - void initCustomerDims(List customers, Date initTime); + void initCustomerDims(List newCustomers, List updatedCustomers, Date initTime); DimCustomerEntity getLatestCreatedDimEntity(); + + DimCustomerEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java index fe839ac0c9..767d5b8ffe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java @@ -95,7 +95,7 @@ public interface DimDepartmentService extends BaseService { */ void delete(String[] ids); - void initDepartmentDims(List departments, Date initTime); + void initDepartmentDims(List newDepartments, List updatedDepartments, Date initTime); /** * desc: 根据客户Id获取 部门数据 @@ -108,4 +108,6 @@ public interface DimDepartmentService extends BaseService { List getDepartmentListByCustomerId(String customerId); DimDepartmentEntity getLatestCreatedDimEntity(); + + DimDepartmentEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java index 312659eb96..b937efdf9e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java @@ -101,9 +101,8 @@ public interface DimGridService extends BaseService { /** * 初始化网格维度 - * @param gridDims */ - void initGridDims(List gridDims); + void initGridDims(List newDimGrids, List changedGrids); /** * desc: 根据客户Id获取 该客户下所有的网格数据 @@ -128,4 +127,6 @@ public interface DimGridService extends BaseService { * @author zxc */ List selectSubAgencyId(List formDTO); + + DimGridEntity getLastUpdatedGridDim(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index 0d21b5525f..d40987c1bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -123,12 +123,25 @@ public class DimAgencyServiceImpl extends BaseServiceImpl agencies, Date initTime) { - for (CustomerAgencyEntity agency : agencies) { + public void initAgencyDims(List agencies2Add, List agencies2Update, Date initTime) { + // 添加新增的机关维度 + for (CustomerAgencyEntity agency : agencies2Add) { initAgencyAllDim(agency, initTime); initAgencySelfDim(agency, initTime); } + // 更新变更过的机关维度 + for (CustomerAgencyEntity agency : agencies2Update) { + DimAgencyEntity existsDimAgency = baseDao.selectById(agency.getId()); + if (existsDimAgency != null) { + //说明是已存在的,不是新增的 + existsDimAgency.setAgencyName(agency.getOrganizationName()); + existsDimAgency.setUpdatedTime(initTime); + existsDimAgency.setUpdatedBy(RobotConstant.DIMENSION_ROBOT); + baseDao.updateById(existsDimAgency); + } + } + lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY); } @@ -255,4 +268,9 @@ public class DimAgencyServiceImpl extends BaseServiceImpl customers, Date initTime) { - for (CustomerEntity customer : customers) { + public void initCustomerDims(List newCustomers, List updatedCustomers, Date initTime) { + // 添加新增的客户维度 + for (CustomerEntity customer : newCustomers) { DimCustomerEntity dim = new DimCustomerEntity(); dim.setCustomerName(customer.getCustomerName()); dim.setCreatedBy(RobotConstant.DIMENSION_ROBOT); @@ -131,6 +132,18 @@ public class DimCustomerServiceImpl extends BaseServiceImpl departments, Date initTime) { - for (CustomerDepartmentEntity department : departments) { + public void initDepartmentDims(List newDepartments, List updatedDepartments, Date initTime) { + // 新增科室初始化 + for (CustomerDepartmentEntity department : newDepartments) { DimDepartmentEntity dim = new DimDepartmentEntity(); dim.setAgencyId(department.getAgencyId()); dim.setCustomerId(department.getCustomerId()); @@ -122,6 +123,18 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl gridDims) { - for (DimGridEntity gridDim : gridDims) { - baseDao.insert(gridDim); + public void initGridDims(List newDimGrids, List changedGrids) { + for (DimGridEntity newGridDim : newDimGrids) { + baseDao.insert(newGridDim); + } + + for (DimGridEntity updatedGridDim : changedGrids) { + baseDao.updateById(updatedGridDim); } lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_GRID); @@ -156,4 +159,9 @@ public class DimGridServiceImpl extends BaseServiceImpl selectSubAgencyId(List formDTO) { return baseDao.selectSubAgencyId(formDTO); } + + @Override + public DimGridEntity getLastUpdatedGridDim() { + return baseDao.getLastUpdatedGridDim(); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml index 0aac258069..382edefac3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml @@ -41,4 +41,27 @@ CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml index 6d3bc43ce3..365ae56b8a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml @@ -16,4 +16,24 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 6a5253e473..48c5176a78 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -47,4 +47,25 @@ AND customer_id = #{customerId} AND DATE_FORMAT( created_time, '%Y%m%d' ) #{dateId} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index 3e22e1b5c3..268782eb3d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -75,4 +75,29 @@ grid.ID + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index 74c52efaa6..dedf82d8fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -277,4 +277,25 @@ LIMIT 1 + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml index 7b8ad49e3c..13bc6a3e01 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml @@ -25,4 +25,19 @@ ORDER BY CREATED_TIME DESC LIMIT 1 + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml index 68de10bef6..4f0a68ed28 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml @@ -35,4 +35,21 @@ ORDER BY CREATED_TIME DESC LIMIT 1 + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index 783230dc55..eef43456f7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -52,4 +52,21 @@ + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java index 2c72dd5e4b..10aadcb475 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java @@ -77,8 +77,8 @@ public class EventFormDTO implements Serializable { /** * 事件功能分组ID 来自oper_customize.customer_function表 */ - @NotBlank(message = "事件功能分组ID不能为空",groups = {AddGroup.class}) - private String eventGroupId; + @NotBlank(message = "功能分组ID不能为空",groups = {AddGroup.class}) + private String functionId; /** * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值 diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java similarity index 64% rename from epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java rename to epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java index 25251dd36a..e95e09002a 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java @@ -15,21 +15,22 @@ * along with this program. If not, see . */ -package com.epmet.dto; +package com.epmet.dto.result; + +import lombok.Data; import java.io.Serializable; import java.util.Date; -import lombok.Data; /** - * 积分规则表 + * 事件表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-20 + * @since v1.0.0 2020-07-16 */ @Data -public class PointRuleDTO implements Serializable { +public class EventDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -39,59 +40,44 @@ public class PointRuleDTO implements Serializable { private String id; /** - * 客户ID + * 消息网关事件类别ID 从消息网关获取事件类型Id */ - private String customerId; + private String classId; /** - * 规则名称 与事件名称保持一致即可 + * 消息网关APP_ID */ - private String ruleName; + private String appId; /** - * 规则说明 事件说明 + * 消息网关APP_NAME */ - private String ruleDesc; + private String appName; /** - * 事件CODE 来自事件表 + * 事件标识 与消息网关事件tag一致 */ private String eventCode; /** - * 事件名称 来自事件表 + * 事件名称 */ private String eventName; /** - * 操作类型 加积分:add;减积分:subtract - */ - private String operateType; - - /** - * 积分上限 - */ - private Integer upLimit; - - /** - * 积分上限描述 - */ - private String upLimitDesc; - - /** - * 获得积分值 + * 事件说明 */ - private Integer pointNum; + private String eventDesc; /** - * 获得积分单位 次:time;分钟:minute;小时:hour + * 事件功能分组ID 来自oper_customize.customer_function表 */ - private String pointUnit; + private String functionId; /** - * 是否启用 0-否,1-是 + * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值 */ - private String enabledFlag; + private String isCommon; /** * 删除标识 0-否,1-是 @@ -99,7 +85,7 @@ public class PointRuleDTO implements Serializable { private String delFlag; /** - * 乐观锁 + * 乐观锁 查询时添加版本号,新加的事件需要更新版本号 */ private Integer revision; diff --git a/epmet-module/epmet-common-service/common-service-server/pom.xml b/epmet-module/epmet-common-service/common-service-server/pom.xml index 2c694bbd67..69b16c5a01 100644 --- a/epmet-module/epmet-common-service/common-service-server/pom.xml +++ b/epmet-module/epmet-common-service/common-service-server/pom.xml @@ -116,6 +116,11 @@ false + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 202007161443499985fa2d397436d10356542134c8f008c48 + 52d9d9b0e7d0eb5b8b81c205b579e07c @@ -177,6 +182,11 @@ true + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 202007161443499985fa2d397436d10356542134c8f008c48 + 52d9d9b0e7d0eb5b8b81c205b579e07c diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java index f07730295b..4c3212b878 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java @@ -17,15 +17,22 @@ package com.epmet.controller; +import com.epmet.commons.tools.config.MqConfig; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.form.EventFormDTO; +import com.epmet.dto.result.EventDTO; import com.epmet.service.EventService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.Map; + /** * 事件表 @@ -33,12 +40,25 @@ import org.springframework.web.bind.annotation.*; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-16 */ +@Slf4j @RestController @RequestMapping("event") public class EventController { @Autowired private EventService eventService; + @Autowired + private MqConfig mqConfig; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = eventService.page(params); + return new Result>().ok(page); + } + @GetMapping("geteventclass") + public Result getEventClass(){ + return SendMqMsgUtils.getEventClassList(); + } /** * desc:添加事件,如果已存在则不作任何改动,直接返回成功 @@ -49,11 +69,11 @@ public class EventController { * "classId":"epmet_heart", * "appId":"202007161443499985fa2d397436d10356542134c8f008c48", * "appName":"党群e事通开发测试", - * "eventCode":"epmet_heart_active_send_point", - * "eventName":"活动发放积分", - * "eventDesc":"给参加活动的人发放积分", - * "eventGroupId":"1234", - * "isCommon":"1" + * "eventCode":"register_volunteer", + * "eventName":"认证志愿者", + * "eventDesc":"给注册志愿者的人发放积分", + * "functionId":"43addd0735230c01eedbb38d721076b0", + * "isCommon":"0" * } */ @PostMapping("addEvent") diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java index 391b11ad40..7db253d389 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 事件表 * @@ -71,7 +68,7 @@ public class EventEntity extends BaseEpmetEntity { /** * 事件功能分组ID 来自oper_customize.customer_function表 */ - private String eventGroupId; + private String functionId; /** * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值 diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java index a34883da65..373689f711 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java @@ -11,17 +11,17 @@ public enum SysResponseEnum { * * 编码样式:【CCCBBOOXX】 * 编码示例说明: - * CCC 中心编码&业务系统 (120-内容扫描服务中心服务) + * CCC 中心编码&业务系统 (103-内容扫描服务中心服务) * BB 业务类型(00-默认 ) * OO 操作类型(00-默认) * */ /*通用枚举 */ - EXCEPTION(12001,"系统异常"), + EXCEPTION(10301,"系统异常"), /*事件 业务 01*/ - EVENT_HAS_ALREADY_EXIST(120010001,"事件已存在无需重复添加"), + EVENT_HAS_ALREADY_EXIST(103010001,"事件已存在无需重复添加"), ; private Integer code; diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java index fc60058fc2..8e2c4cb635 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java @@ -18,9 +18,13 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; import com.epmet.dto.form.EventFormDTO; +import com.epmet.dto.result.EventDTO; import com.epmet.entity.EventEntity; +import java.util.Map; + /** * 事件表 * @@ -32,4 +36,6 @@ public interface EventService extends BaseService { void addEvent(EventFormDTO formDTO); void updateEvent(EventFormDTO formDTO); + + PageData page(Map params); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java index fed5a58ed3..5fe736adb3 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java @@ -17,18 +17,23 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.EventDao; import com.epmet.dto.form.EventFormDTO; +import com.epmet.dto.result.EventDTO; import com.epmet.entity.EventEntity; -import com.epmet.enu.SysResponseEnum; import com.epmet.service.EventService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.util.Map; + /** * 事件表 * @@ -38,18 +43,17 @@ import org.springframework.stereotype.Service; @Slf4j @Service public class EventServiceImpl extends BaseServiceImpl implements EventService { - + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, EventDTO.class); + } @Override public void addEvent(EventFormDTO formDTO) { - if (baseDao.getCountByEventCode(formDTO.getEventCode()) > 0) { - log.warn("addEvent fail,msg:{}", SysResponseEnum.EVENT_HAS_ALREADY_EXIST.getMsg()); - return; - } - EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class); - if (eventEntity == null) { - throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); - } baseDao.insert(eventEntity); } @@ -57,4 +61,12 @@ public class EventServiceImpl extends BaseServiceImpl imp public void updateEvent(EventFormDTO formDTO) { //baseDao.update(eventEntity); } + 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; + } } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml index 146d5758dd..ec2f2c7a2b 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml @@ -117,4 +117,12 @@ ribbon: #pageHelper分页插件 pagehelper: helper-dialect: mysql - reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 \ No newline at end of file + reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 + +#亿联云消息网关 +elink: + mq: + appId: @elink.mq.appId@ #项目接入亿联云的应用Id + token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret + host: @elink.mq.host@ #亿联云消息网关服务地址 + sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql index bcf0b493c7..2702dde08b 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql @@ -418,21 +418,22 @@ INSERT INTO `calender` VALUES ('ffe45e7059c67874f88498cfcfd19b4c', 0, '20200424' SET FOREIGN_KEY_CHECKS = 1; #add by liujianjun 2020-07-16 -CREATE TABLE event( - ID VARCHAR(64) NOT NULL COMMENT '主键' , - CLASS_ID VARCHAR(32) COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id' , - APP_ID VARCHAR(128) COMMENT '消息网关APP_ID' , - APP_NAME VARCHAR(32) COMMENT '消息网关APP_NAME' , - EVENT_CODE VARCHAR(32) COMMENT '事件标识 与消息网关事件tag一致' , - EVENT_NAME VARCHAR(32) COMMENT '事件名称' , - EVENT_DESC VARCHAR(64) COMMENT '事件说明' , - EVENT_GROUP_ID VARCHAR(512) COMMENT '事件功能分组ID 来自oper_customize.customer_function表' , - IS_COMMON VARCHAR(1) COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值' , - DEL_FLAG VARCHAR(1) COMMENT '删除标识 0-否,1-是' , - REVISION INT COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号' , - CREATED_BY VARCHAR(32) COMMENT '创建人' , - CREATED_TIME DATETIME COMMENT '创建时间' , - UPDATED_BY VARCHAR(32) COMMENT '更新人' , - UPDATED_TIME DATETIME COMMENT '更新时间' , - PRIMARY KEY (ID) -) COMMENT = '事件表'; +CREATE TABLE `event` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CLASS_ID` varchar(32) DEFAULT NULL COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id', + `APP_ID` varchar(128) DEFAULT NULL COMMENT '消息网关APP_ID', + `APP_NAME` varchar(32) DEFAULT NULL COMMENT '消息网关APP_NAME', + `EVENT_CODE` varchar(32) DEFAULT NULL COMMENT '事件标识 与消息网关事件tag一致', + `EVENT_NAME` varchar(32) DEFAULT NULL COMMENT '事件名称', + `EVENT_DESC` varchar(64) DEFAULT NULL COMMENT '事件说明', + `FUNCTION_ID` varchar(64) DEFAULT NULL COMMENT '功能ID 来自oper_customize.customer_function表', + `IS_COMMON` varchar(1) DEFAULT NULL COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值', + `DEL_FLAG` varchar(1) DEFAULT NULL COMMENT '删除标识 0-否,1-是', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号', + `CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + UNIQUE KEY `unx_event_code` (`EVENT_CODE`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件表'; diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml index 9865ab0efa..e5418337ad 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml @@ -11,7 +11,7 @@ - + diff --git a/epmet-module/epmet-heart/epmet-heart-client/pom.xml b/epmet-module/epmet-heart/epmet-heart-client/pom.xml index 8701e1a09d..454488ddc2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-client/pom.xml @@ -26,6 +26,12 @@ io.springfox springfox-swagger-ui + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java index ad18a98c8b..b747b77985 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java @@ -112,7 +112,7 @@ public class ActInfoDTO implements Serializable { /** * 活动签到打卡位置经度 */ - private BigDecimal signinLongitude; + private BigDecimal signInLongitude; /** * 活动签到打卡位置纬度 @@ -247,4 +247,11 @@ public class ActInfoDTO implements Serializable { */ private String delFlag; -} \ No newline at end of file + // 虚字段 + + /** + * 用户id + */ + private String userId; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java index 00b8294271..955997a340 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java @@ -53,9 +53,14 @@ public class ActOperationRecDTO implements Serializable { private String type; /** - * 1通知用户0不通知 + * 1通知用户0不通知,取消活动时默认true */ - private Boolean noticeUser; + private Boolean noticeUser; + + /** + * 备注,取消活动时此列有值 + */ + private String remark; /** * 删除标记 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java index 2d878f2615..6b6daf74c2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -48,11 +49,6 @@ public class ActPointLogDTO implements Serializable { */ private String userId; - /** - * 加积分:add ; 减积分:subtract - */ - private String pointType; - /** * 积分值 */ @@ -98,5 +94,4 @@ public class ActPointLogDTO implements Serializable { * 更新时间 */ private Date updatedTime; - } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java index 233b5c2188..b1bc9f1898 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -44,7 +45,7 @@ public class ActStatisticalDTO implements Serializable { private String actId; /** - * 已报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) + * 报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) */ private Integer signupNum; @@ -73,16 +74,6 @@ public class ActStatisticalDTO implements Serializable { */ private Integer signedInUserNum; - /** - * 添加实况总人数 - */ - private Integer liveUserNum; - - /** - * 实况总记录数 - */ - private Integer liveCount; - /** * 发放积分总人数 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java index a6f783b20f..a7bff8713b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -50,13 +51,10 @@ public class ActUserLogDTO implements Serializable { /** * 操作类型(已报名/待审核auditing, -审核通过passed, -审核不通过refused -取消报名canceld, -发放积分rewarded -拒绝发放积分refuse_reward -重新处理processing -) + * 审核通过passed, + * 审核不通过refused + * 取消报名canceled, + * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java index 57952477e7..2c7c7a2d8d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -52,7 +53,7 @@ public class ActUserRelationDTO implements Serializable { * 当前状态(已报名/待审核auditing, 审核通过passed, 审核不通过refused -取消报名canceld, +取消报名canceled, ) */ private String status; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java deleted file mode 100644 index fa7e943ebf..0000000000 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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.dto.form.resi; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; - -/** - * 用户活动打卡参数 - * - * @author zhangyong - * @since v1.0.0 2020-07-14 - */ -@Data -public class ActUserClockLogFormDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 用户ID - */ - private String userId; - /** - * 活动ID - */ - @NotBlank(message = "活动ID不能为空") - private String actId; - /** - * 打卡类型(0-打卡,1-更新打卡) - */ - @NotBlank(message = "打卡类型不能为空") - private String clockType; - /** - * 打卡位置经度 - */ - @NotBlank(message = "打卡位置经度不能为空") - private BigDecimal clockLongitude; - /** - * 打卡位置纬度 - */ - @NotBlank(message = "打卡位置纬度不能为空") - private BigDecimal clockLatitude; - /** - * 打卡地址 - */ - @NotBlank(message = "打卡地址不能为空") - private String clockAddress; - /** - * 打卡描述 - */ - @NotBlank(message = "打卡描述不能为空") - private String clockDesc; - /** - * 打卡是否有效(0-否,1-是) - */ - @NotBlank(message = "打卡是否有效不能为空") - private String effectiveFlag; - /** - * 打卡图片 - */ - private ArrayList images; -} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java index b48ff6bb08..bd67a4a69b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java @@ -28,18 +28,18 @@ public class ResiActCaculateDistanceFormDTO implements Serializable { /** * 经度 */ - @NotBlank(message = "经度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + @NotBlank(message = "经度不能为空", groups = { AddUserInternalGroup.class }) private Double longitude; /** * 纬度 */ - @NotBlank(message = "纬度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + @NotBlank(message = "纬度不能为空", groups = { AddUserInternalGroup.class }) private Double latitude; /** * 用户id */ - @NotBlank(message = "活动ID不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) private String actId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java new file mode 100644 index 0000000000..29ccd9fd98 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java @@ -0,0 +1,46 @@ +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动内容(活动详情-已结束-回顾稿) 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-21 18:12 + */ +@Data +public class ResiActContentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动Id + */ + @NotBlank(message = "活动Id不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class }) + private Integer pageNo; + + /** + * 页容量,默认20页 + */ + @Min(value = 1, message = "每页条数必须大于必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private Integer pageSize; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java new file mode 100644 index 0000000000..18c41b255e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动详情 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-21 18:12 + */ +@Data +public class ResiActDetailFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动Id + */ + @NotBlank(message = "活动Id不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java new file mode 100644 index 0000000000..54182f0da3 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java @@ -0,0 +1,104 @@ +/** + * 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.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 活动-添加实况 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-23 + */ +@Data +public class ResiActInsertLiveFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 活动签到描述 + */ + private String desc; + + /** + * 活动签到位置经度 + */ + @NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal longitude; + + /** + * 活动签到位置纬度 + */ + @NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal latitude; + + /** + * 活动签到地址 + */ + @NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 图片 + */ + private List images; + + /** + * 用户id + */ + private String userId; + + /** + * id + */ + private String id; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class }) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java new file mode 100644 index 0000000000..378b38e40c --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java @@ -0,0 +1,61 @@ +/** + * 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.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动报名参数 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActRegistrationFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 用户Id + */ + private String userId; + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空", groups = { AddUserInternalGroup.class }) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java new file mode 100644 index 0000000000..69c1486c7f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java @@ -0,0 +1,105 @@ +/** + * 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.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 活动签到 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-23 + */ +@Data +public class ResiActSignInFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 活动签到描述 + */ + private String desc; + + /** + * 活动签到位置经度 + */ + @NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal longitude; + + /** + * 活动签到位置纬度 + */ + @NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal latitude; + + /** + * 活动签到地址 + */ + @NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 图片 + */ + private List images; + + /** + * 0不同步实况1同步到实况记录 + */ + @NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private Integer syncLive; + + /** + * 用户id + */ + private String userId; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class }) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java index 1cad8308bc..5a8ad4e43f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiMyActFormDTO.java @@ -20,7 +20,6 @@ package com.epmet.dto.form.resi; import lombok.Data; import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; import java.io.Serializable; /** diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java new file mode 100644 index 0000000000..497f36f06e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java @@ -0,0 +1,117 @@ +package com.epmet.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 志愿者认证 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-23 09:57 + */ + +@Data +public class ResiVolunteerAuthenticateFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 用户id + */ + private String userId; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class }) + private String customerId; + + /** + * 姓 + */ + @NotBlank(message = "姓不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String surname; + + /** + * 名 + */ + @NotBlank(message = "名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String name; + + /** + * 性别(1男2女0未知) + */ + @NotBlank(message = "性别不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String gender; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String mobile; + + /** + * 身份证号码 + */ + @NotBlank(message = "身份证号码不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String idNum; + + /** + * 街道 + */ + @NotBlank(message = "街道不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String street; + + /** + * 小区名 + */ + @NotBlank(message = "小区名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String district; + + /** + * 楼栋单元 + */ + @NotBlank(message = "楼栋单元不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String buildingAddress; + + /** + * 志愿者自我介绍 + */ + private String volunteerIntroduce; + + /** + * 昵称 + */ + @NotBlank(message = "昵称不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String nickname; + + /** + * 头像 + */ + @NotBlank(message = "头像不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String avatarUrl; + + /** + * 志愿者签名 + */ + private String volunteerSignature; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java new file mode 100644 index 0000000000..3e653e76c1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form.work; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 报名审核-人员详情-入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/22 22:22 + */ +@Data +public class AactUserDetailFormDTO implements Serializable { + private static final long serialVersionUID = 5791290477143999176L; + + public interface AddUserInternalGroup { + } + + /** + * 列表页返回的主键 + */ + @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class}) + private String actUserRelationId; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditingActUserFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java similarity index 50% rename from epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditingActUserFormDTO.java rename to epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java index 9fb58c8179..632b567c11 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditingActUserFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java @@ -6,18 +6,19 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * 报名审核-待审核列表入参 + * 活动id通用formdto * * @author yinzuomei@elink-cn.com - * @date 2020/7/21 22:12 + * @date 2020/7/24 11:07 */ @Data -public class AuditingActUserFormDTO implements Serializable { - private static final long serialVersionUID = 3811387419859675753L; +public class ActIdFormDTO implements Serializable { + private static final long serialVersionUID = 7151533863877527886L; + public interface AddUserInternalGroup {} /** * 活动id */ - @NotBlank(message = "活动id不能为空", groups = { AddUserInternalGroup.class }) + @NotBlank(message = "活动id不能为空", groups = { ActIdFormDTO.AddUserInternalGroup.class }) private String actId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActListCommonFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActListCommonFormDTO.java new file mode 100644 index 0000000000..bc89178a5c --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActListCommonFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form.work; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 21:21 + */ +@Data +public class ActListCommonFormDTO implements Serializable { + private static final long serialVersionUID = -8014343076037268806L; + public interface AddUserInternalGroup {} + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserInternalGroup.class }) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java new file mode 100644 index 0000000000..0df68ec7a8 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 审核通过、拒绝入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 17:28 + */ +@Data +public class AuditUserFormDTO implements Serializable { + private static final long serialVersionUID = 243279409415285207L; + public interface AddUserInternalGroup { + } + public interface RefusedUserShowGroup extends CustomerClientShowGroup { + } + /** + * 列表页返回的主键 + */ + @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class,RefusedUserShowGroup.class}) + private String actUserRelationId; + + @NotBlank(message = "拒绝理由不能为空", groups = {RefusedUserShowGroup.class}) + private String rejectReason; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java new file mode 100644 index 0000000000..1ae524df14 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 17:23 + */ +@Data +public class CancelActFormDTO implements Serializable { + private static final long serialVersionUID = -5297836691628421645L; + public interface AddUserInternalGroup {} + public interface UserShowGroup extends CustomerClientShowGroup { + } + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class }) + private String actId; + + /** + * 取消原因 + */ + @NotBlank(message = "取消原因不能为空", groups = {UserShowGroup.class}) + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java index 55cd75a090..1d128594ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java @@ -1,6 +1,5 @@ package com.epmet.dto.form.work; -import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.Valid; @@ -22,9 +21,6 @@ public class DraftActInfoFormDTO implements Serializable { public interface AddUserInternalGroup { } - public interface AddDraftUserShowGroup extends CustomerClientShowGroup { - } - @Valid private List actContent; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java new file mode 100644 index 0000000000..b3b79453b5 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 积分发放给分,不给分,通用入参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 13:10 + */ +@Data +public class GrantPointsFormDTO implements Serializable { + private static final long serialVersionUID = 4785107755585941804L; + public interface AddUserInternalGroup { + } + public interface DenyUserShowGroup extends CustomerClientShowGroup { + } + /** + * 积分发放待处理列表返参中的actUserRelationId + */ + @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class,DenyUserShowGroup.class}) + private String actUserRelationId; + + @NotBlank(message = "理由不能为空", groups = {DenyUserShowGroup.class}) + private String denyRewardReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java new file mode 100644 index 0000000000..f3bce130df --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java @@ -0,0 +1,194 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 重新发布活动-入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 13:49 + */ +@Data +public class RePublishFormDTO implements Serializable { + private static final long serialVersionUID = -959956652123514886L; + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @Valid + @Size(min=1,message = "活动详情不能为空",groups = {AddUserShowGroup.class}) + private List actContent; + + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class}) + private String actId; + + /** + * 是否通知已报名人员:true 通知 false 不通知 + */ + @NotNull(message = "是否通知已报名人员标志不能为空",groups ={AddUserInternalGroup.class} ) + private Boolean noticePassedPeople; + + + /** + * 活动标题 + */ + @NotBlank(message = "活动标题不能为空", groups = {AddUserShowGroup.class}) + @Length(min=1, max=50,message = "活动标题限50字以内", groups = {AddUserShowGroup.class}) + private String title; + + /** + * 封面图 + */ + @NotBlank(message = "封面图不能为空", groups = {AddUserShowGroup.class}) + private String coverPic; + + /** + * 活动地点 + */ + @NotBlank(message = "活动地点不能为空", groups = {AddUserShowGroup.class}) + private String actAddress; + + /** + * 活动地点-经度 + */ + @NotNull(message = "活动地点经度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal actLongitude; + + /** + * 活动地点-纬度 + */ + @NotNull(message = "活动地点经度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal actLatitude; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "活动预计开始时间不能为空", groups = {AddUserShowGroup.class}) + private String actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "活动预计结束时间不能为空", groups = {AddUserShowGroup.class}) + private String actEndTime; + + /** + * 活动人数 + */ + @Min(0) + private Integer actQuota; + + /** + * 活动积分 + */ + @Min(0) + private Integer reward; + + /** + * 报名审核:true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动 + */ + @NotNull(message = "报名身份不能为空", groups = {AddUserInternalGroup.class}) + private Boolean volunteerLimit; + + /** + * 报名审核: true: 需人工审核 false: 无需审核 + */ + @NotNull(message = "报名审核方式不能为空", groups = {AddUserInternalGroup.class}) + private Boolean auditSwitch; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "报名截止时间不能为空", groups = {AddUserShowGroup.class}) + private String signUpEndTime; + + /** + * 报名条件 + */ + @NotBlank(message = "报名条件不能为空", groups = {AddUserShowGroup.class}) + @Length(min=1, max=50,message = "报名条件限200字以内", groups = {AddUserShowGroup.class}) + private String requirement; + + /** + * 签到开始时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "签到开始时间不能为空", groups = {AddUserShowGroup.class}) + private String signInStartTime; + + /** + * 签到结束时间: yyyy-MM-dd HH:mm + */ + @NotBlank(message = "签到结束时间不能为空", groups = {AddUserShowGroup.class}) + private String signInEndTime; + + /** + * 签到地址 + */ + @NotBlank(message = "签到地址不能为空", groups = {AddUserShowGroup.class}) + private String signInAddress; + + /** + * 签到地址-纬度 + */ + @NotNull(message = "签到地址-纬度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal signInLatitude; + + /** + * 签到地址-经度 + */ + @NotNull(message = "签到地址-经度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal signInLongitude; + + /** + * 签到有效范围(米) + */ + @Min(0) + @NotNull(message = "签到有效范围不能为空", groups = {AddUserShowGroup.class}) + private Integer signInRadius; + + /** + * 主办方id + */ + @NotBlank(message = "主办方id不能为空", groups = {AddUserInternalGroup.class}) + private String sponsorId; + + /** + * 主办方类型:以网格名义:grid , 以机关名义: agency + */ + @NotBlank(message = "主办方类型不能为空", groups = {AddUserInternalGroup.class}) + private String sponsorType; + + /** + * 主办方名称 + */ + @NotBlank(message = "主办方名称不能为空", groups = {AddUserShowGroup.class}) + private String sponsorName; + + /** + * 联系人 + */ + @NotBlank(message = "联系人不能为空", groups = {AddUserShowGroup.class}) + private String sponsorContacts; + + /** + * 联系电话 + */ + @NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) + private String sponsorTel; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java new file mode 100644 index 0000000000..8380ece57c --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 已结束-保存活动实际开始结束时间 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 19:43 + */ +@Data +public class SaveActualTimeFormDTO implements Serializable { + private static final long serialVersionUID = -3668309257254318868L; + + public interface AddUserInternalGroup { + } + + public interface UserShowGroup extends CustomerClientShowGroup { + } + + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class}) + private String actId; + /** + * 实际开始时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "实际开始时间不能为空", groups = {UserShowGroup.class}) + private String actualStartTime; + /** + * 实际结束时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "实际结束时间不能为空", groups = {UserShowGroup.class}) + private String actualEndTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SummaryActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SummaryActFormDTO.java new file mode 100644 index 0000000000..bd5f3a2655 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SummaryActFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + * 保存添加回顾入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 10:33 + */ +@Data +public class SummaryActFormDTO implements Serializable { + private static final long serialVersionUID = -3610355661618180808L; + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class }) + private String actId; + + @Valid + @Size(min=1,message = "活动详情不能为空",groups = {AddUserShowGroup.class}) + private List actContent; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java new file mode 100644 index 0000000000..26e2944e35 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form.work; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 报名审核-人员历史活动情况入参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 16:12 + */ +@Data +public class UserHistoricalActFormDTO implements Serializable { + public interface AddUserInternalGroup {} + /** + * 居民端用户id + */ + @NotBlank(message = "居民端用户id不能为空", groups = {AddUserInternalGroup.class}) + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java new file mode 100644 index 0000000000..4d6e9bbf3f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java @@ -0,0 +1,56 @@ +/** + * 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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 活动内容 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@Data +public class ResiActContentResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actContentId; + + /** + * 内容 + */ + private String content; + + /** + * 内容类型 图片:img;文字:text + */ + private String contentType; + + /** + * 内容顺序 从1开始 + */ + private Integer orderNum; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java new file mode 100644 index 0000000000..18dba0c301 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java @@ -0,0 +1,140 @@ +/** + * 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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 活动详情 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + /** + * 联系人 + */ + private String contacts; + + /** + * 联系电话 + */ + private String tel; + + /** + * 报名截止时间(yyyy-MM-dd HH:mm) + */ + private String signUpEndTime; + + /** + * 活动开始时间(yyyy-MM-dd HH:mm) + */ + private String actStartTime; + + /** + * 活动结束时间(yyyy-MM-dd HH:mm) + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额 false: 不限制名额) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 已报名人数 + */ + private Integer signupNum; + + /** + * 积分奖励 + */ + private Integer reward; + + /** + * 招募要求 + */ + private String requirement; + + /** + * 活动详情 + */ + private List actContent; + + /** + * 用户当前状态(sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消) + */ + private String currentUserStatus; + + /** + * 用户是否是志愿者身份 (true:是,false 不是) + */ + private Boolean userVolunteerFlag; + + /** + * 是否需要是志愿者(true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动) + */ + private Boolean volunteerLimit; + + /** + * 活动实际开始时间(yyyy-MM-dd HH:mm) + */ + private String actualStartTime; + + /** + * 活动实际结束时间(yyyy-MM-dd HH:mm) + */ + private String actualEndTime; + + /** + * 主办方 + */ + private String sponsor; + + /** + * 是否已签到(true已签到,false未签到) + */ + private Boolean isSignUp; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java similarity index 78% rename from epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java rename to epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java index cb3cc26361..8798dfb0ef 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java @@ -22,27 +22,25 @@ import lombok.Data; import java.io.Serializable; import java.util.List; + /** - * 打卡列表 + * 活动详情-已结束-现场实况列表 * - * @author zhangyong - * @since v1.0.0 2020-07-14 + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 */ @Data -public class ActClockListResultDTO implements Serializable { +public class ResiActLiveRecResultDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 活动打卡人次 + * 现场实况次数 */ - private Integer clockNum; + private Integer actLiveNum; /** * 打卡列表 */ - private List clocks; - - - + private List actLives; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java new file mode 100644 index 0000000000..34d18ae9d2 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java @@ -0,0 +1,99 @@ +/** + * 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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 活动详情-未通过 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActRefusedDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + /** + * 报名截止时间(yyyy-MM-dd HH:mm) + */ + private String signUpEndTime; + + /** + * 活动开始时间(yyyy-MM-dd HH:mm) + */ + private String actStartTime; + + /** + * 活动结束时间(yyyy-MM-dd HH:mm) + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额 false: 不限制名额) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 联系人 + */ + private String contacts; + + /** + * 联系电话 + */ + private String tel; + + /** + * 积分奖励 + */ + private Integer reward; + + /** + * 主办方 + */ + private String sponsor; + + /** + * 未通过原因 + */ + private String failureReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java new file mode 100644 index 0000000000..f52006de80 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java @@ -0,0 +1,55 @@ +/** + * 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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 活动回顾列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@Data +public class ResiActSummaryResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String summaryId; + + /** + * 内容 + */ + private String content; + + /** + * 内容类型 图片:img;文字:text + */ + private String contentType; + + /** + * 内容顺序 从1开始 + */ + private Integer orderNum; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java new file mode 100644 index 0000000000..d3d50da078 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java @@ -0,0 +1,60 @@ +/** + * 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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 爱心榜 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@Data +public class ResiLeaderboardResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 微信昵称 + */ + private String nickname; + + /** + * 微信头像 + */ + private String headImg; + + /** + * 是否是志愿者(true:是志愿者,false: 不是志愿者) + */ + private Boolean volunteerFlag; + + /** + * 爱心时长(单位:小时) + */ + private Integer kindnessTime; + + /** + * 参加次数 + */ + private Integer participationNum; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java index f5869bdb87..eb6f07693c 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java @@ -43,13 +43,13 @@ public class ActPreviewResultDTO implements Serializable { private Integer reward; /** - * 活动开始时间yyyy-MM-dd HH:mm + * 活动预计开始时间yyyy-MM-dd HH:mm */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actStartTime; /** - * 活动结束时间yyyy-MM-dd HH:mm + * 活动预计结束时间yyyy-MM-dd HH:mm */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actEndTime; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java new file mode 100644 index 0000000000..480cc75f71 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 审核结果(已通过/已拒绝) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 14:01 + */ +@Data +public class AuditResult implements Serializable { + private static final long serialVersionUID = -656845099071435835L; + /** + * 审核通过/拒绝的时间yyyy-MM-dd HH:mm:ss + */ + private Date auditTime; + + /** + * 拒绝原因,status=passed时返回空字符串 + */ + private String refusedReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java new file mode 100644 index 0000000000..764c81b2fe --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java @@ -0,0 +1,104 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 报名审核-待审核人员详情-返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/22 22:24 + */ +@Data +public class AuditingUserDetailResultDTO implements Serializable { + private static final long serialVersionUID = 6259802533450991971L; + /** + * 活动id + */ + private String actId; + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 性别1男2女0未知 + */ + private String gender; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 联系方式 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idNum; + + /** + * 居住地址 + */ + private String address; + + /** + * 待审核auditing, 审核通过passed, 审核不通过refused 取消报名canceld, + */ + private String status; + + /** + * 报名时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signUpTime; + + /** + * 返回文本:已拒绝5次 + */ + private String refusedCountDesc; + + /** + * 最近一次拒绝原因 + */ + private String latestRefusedReason; + + /** + * 最近一次拒绝的时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date latestAuditTime; + + /** + * 历史活动情况 + */ + private HistoricalActInfo historicalActInfo; + + + /** + * 取消信息(已取消界面 用) + */ + private CancelResult cancelResult; + /** + * 审核结果(已通过/已拒绝) + */ + private AuditResult auditResult; + + /** + * 审核历史(待审核界面需要显示) + */ + private HistoricalAuditResult historicalAuditResult; + private String actUserRelationId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java new file mode 100644 index 0000000000..bf128fc0b1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 取消信息(已取消界面 用) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 13:53 + */ +@Data +public class CancelResult implements Serializable { + private static final long serialVersionUID = -4638522326622908384L; + + /** + * 取消的原因:当status=canceld,才有值 + */ + private String cancelReason; + + /** + * 取消的时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date cancelTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java new file mode 100644 index 0000000000..3239a78ced --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java @@ -0,0 +1,127 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 已取消-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 18:02 + */ +@Data +public class CanceledActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 4438884084461494174L; + + /** + *活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + /** + * 活动积分 + */ + private Integer reward; + /** + * 主办方名称 + */ + private String sponsorName; + /** + * 报名条件 + */ + private String requirement; + /** + * 取消时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date cancelTime; + /** + * 取消理由 + */ + private String cancelReason; + /** + * 活动详情 + */ + private List actContent; + /** + * true,我发布的,false,其他人发布的 + */ + private Boolean isMyPublish; + + @JsonIgnore + private String createdBy; + + @Override + public String toString() { + return "CanceledActDetailResultDTO{" + + "actId='" + actId + '\'' + + ", title='" + title + '\'' + + ", signUpEndTime=" + signUpEndTime + + ", actStartTime=" + actStartTime + + ", actEndTime=" + actEndTime + + ", actAddress='" + actAddress + '\'' + + ", actQuota=" + actQuota + + ", actQuotaCategory=" + actQuotaCategory + + ", sponsorContacts='" + sponsorContacts + '\'' + + ", sponsorTel='" + sponsorTel + '\'' + + ", reward=" + reward + + ", sponsorName='" + sponsorName + '\'' + + ", requirement='" + requirement + '\'' + + ", cancelTime=" + cancelTime + + ", cancelReason='" + cancelReason + '\'' + + ", actContent=" + actContent + + '}'; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java new file mode 100644 index 0000000000..887a457b4e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java @@ -0,0 +1,55 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 23:09 + */ +@Data +public class CanceledActResultDTO implements Serializable { + private static final long serialVersionUID = 7026227776577088524L; + /** + *活动id + */ + private String actId; + + /** + *活动标题 + */ + private String title; + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 取消活动的时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date cancelTime; + + /** + * 活动取消的原因 + */ + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java new file mode 100644 index 0000000000..6a02a9796d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java @@ -0,0 +1,62 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 已结束-已取消报名人员列表 返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 10:51 + */ +@Data +public class CanceledUserResultDTO implements Serializable { + private static final long serialVersionUID = 5261680369821817096L; + /** + * 主键 + */ + private String actUserRelationId; + + /** + * 活动id + */ + private String actId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 取消时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date cancelTime; + + /** + * 取消原因 + */ + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java new file mode 100644 index 0000000000..c7ca1833bb --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放-已拒绝列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 19:01 + */ +@Data +public class DeniedUserResultDTO implements Serializable { + private static final long serialVersionUID = 110993452055116412L; + + /** + * 给分或者不给分,重新处理入参用 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 活动id + */ + private String actId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true:是志愿者 false:不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 拒绝原因 + */ + private String denyRewardReason; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java new file mode 100644 index 0000000000..5e9d4a991d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java @@ -0,0 +1,116 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 已结束-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 20:52 + */ +@Data +public class FinishedActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 6780614493878658227L; + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + + /** + * 活动积分 + */ + private Integer reward; + + /** + * 主办方名称 + */ + private String sponsorName; + + /** + * 报名条件 + */ + private String requirement; + + /** + * 是否添加回顾:true已经总结 false:未总结 + */ + private Boolean summaryFlag; + + /** + * 活动详情 + */ + private List actContent; + + /** + * 实际开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualStartTime; + + /** + * 实际结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualEndTime; + /** + * true,我发布的,false,其他人发布的 + */ + private Boolean isMyPublish; + + @JsonIgnore + private String createdBy; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java new file mode 100644 index 0000000000..25f9d7e46b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 23:19 + */ +@Data +public class FinishedActResultDTO implements Serializable { + private static final long serialVersionUID = -8967999331248723146L; + + /** + *活动id + */ + private String actId; + + /** + *活动标题 + */ + private String title; + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + /** + * 活动实际开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualStartTime; + + /** + * 活动实际结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualEndTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/Grid.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/Grid.java new file mode 100644 index 0000000000..581eac9d9a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/Grid.java @@ -0,0 +1,44 @@ +/** + * 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.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 添加组织-接口返参 + * + * @author sun + */ +@Data +public class Grid implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 网格Id + */ + private String gridId = ""; + /** + * 机关-网格名称 + */ + private String agencyGridName = ""; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java new file mode 100644 index 0000000000..6054511006 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java @@ -0,0 +1,34 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户历史活动情况 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 12:39 + */ +@Data +public class HistoricalActInfo implements Serializable { + private static final long serialVersionUID = -7554295919888726898L; + /** + * 实际参加活动个数 + */ + private Integer signInActNum; + /** + * 报名活动个数 + */ + private Integer signUpActNum; + /** + * 获得积分活动个数 + */ + private Integer obtainPointsActNum; + + public HistoricalActInfo(){ + this.signInActNum=0; + this.signUpActNum=0; + this.obtainPointsActNum=0; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java new file mode 100644 index 0000000000..54f307c152 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 审核历史(待审核界面需要显示) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 14:03 + */ +@Data +public class HistoricalAuditResult implements Serializable { + /** + * 最近一次拒绝原因 + */ + private String latestRefusedReason; + /** + * 最近一次拒绝的时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date latestAuditTime; + /** + * 返回文本:已拒绝5次 + */ + private String refusedCountDesc; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java new file mode 100644 index 0000000000..cc9e66a9bf --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java @@ -0,0 +1,101 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 进行中-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 21:26 + */ +@Data +public class InProgressActDetailResultDTO implements Serializable { + private static final long serialVersionUID = -2159602705968655263L; + + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + + /** + * 活动积分 + */ + private Integer reward; + + /** + * 主办方名称 + */ + private String sponsorName; + + /** + * 报名条件 + */ + private String requirement; + + /** + * 活动详情 + */ + private List actContent; + + /** + * true,我发布的,false,其他人发布的 + */ + private Boolean isMyPublish; + + @JsonIgnore + private String createdBy; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java new file mode 100644 index 0000000000..5e25e5fab0 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java @@ -0,0 +1,80 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 21:23 + */ +@Data +public class InProgressActResultDTO implements Serializable { + private static final long serialVersionUID = -2631607663760353230L; + + /** + *活动id + */ + private String actId; + + /** + *活动标题 + */ + private String title; + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动状态:报名中:signing_up;截止报名: end_sign_up; 已开始: in_progress; 已报满: enough + */ + private String status=""; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 活动名额人数 + */ + private Integer actQuota; + + /** + * 已报名人数 + */ + private Integer signedUp; + + /** + * 报名截止时间 + */ + @JsonIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 报名开始时间 + */ + @JsonIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpStartTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java new file mode 100644 index 0000000000..821364850a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 已结束-已参加人员列表 返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 9:54 + */ +@Data +public class JoinedUserResultDTO implements Serializable { + private static final long serialVersionUID = 3120376299314043862L; + /** + * 主键 + */ + private String actUserRelationId; + + /** + * 活动id + */ + private String actId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true已签到 false:未签到 + */ + private Boolean signInFlag; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 报名时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpTime; + + /** + * 积分说明,接口直接返回:积分+5 或者 积分+0 + */ + private String pointsDes; + + /** + * 活动奖励积分 + */ + @JsonIgnore + private Integer reward; + + /** + * 已给分:agree, 不给分:deny 默认"" + */ + @JsonIgnore + private String rewardFlag; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java new file mode 100644 index 0000000000..05cf6e2674 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放-已发放列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 18:43 + */ +@Data +public class ObtainedUserResultDTO implements Serializable { + private static final long serialVersionUID = 8187248601958392521L; + /** + * 给分或者不给分,重新处理入参用 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 活动id + */ + private String actId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true:是志愿者 false:不是志愿者 + */ + private Boolean volunteerFlag; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PendingUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PendingUserResultDTO.java new file mode 100644 index 0000000000..d8f3837265 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PendingUserResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result.work; + +import com.epmet.commons.tools.constant.StrConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 积分发放-待处理列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:20 + */ +@Data +public class PendingUserResultDTO implements Serializable { + private static final long serialVersionUID = -5744298386442386198L; + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 积分奖励 + */ + private Integer reward; + + /** + * 已签到人员列表 + */ + private List signedInList; + + /** + * 未签到人员列表 + */ + private List noSignInList; + public PendingUserResultDTO(String actId){ + this.actId= actId; + this.title=StrConstant.EPMETY_STR; + this.reward=0; + this.signedInList=new ArrayList<>(); + this.noSignInList=new ArrayList<>(); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java index 5fdc6a5c06..bc9c9549cd 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java @@ -13,5 +13,8 @@ import java.io.Serializable; @Data public class PublishActResultDTO implements Serializable { private static final long serialVersionUID = 4699176252192192495L; + /** + * 活动id + */ private String actId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java new file mode 100644 index 0000000000..80f668afae --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java @@ -0,0 +1,151 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 重新编辑-获取活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 11:14 + */ +@Data +public class ReEditActInfoResultDTO implements Serializable { + private static final long serialVersionUID = 512857031034752008L; + + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 封面图地址 + */ + private String coverPic; + + /** + * 活动地址 + */ + private String actAddress; + + /** + * 活动地址-经度 + */ + private BigDecimal actLongitude; + + /** + *活动地址-维度 + */ + private BigDecimal actLatitude; + /** + * 活动预计开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动人数 + */ + private Integer actQuota; + /** + * 活动积分 + */ + private Integer reward; + /** + * 身份限制:1只有志愿者才可以参加活动0不限制志愿者身份 + */ + private Boolean volunteerLimit; + + /** + * 审核开关:1报名人员需要人工审核0不需要 + */ + private Boolean auditSwitch; + + /** + * 报名截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + /** + * 报名条件 + */ + private String requirement; + + /** + * 打卡开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signInStartTime; + + /** + * 打卡签到截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signInEndTime; + + /** + * 活动签到打卡地点 + */ + private String signInAddress; + + /** + * 活动签到打卡位置经度 + */ + private BigDecimal signInLongitude; + + /** + * 活动签到打卡位置纬度 + */ + private BigDecimal signInLatitude; + + /** + * 活动签到打卡半径(单位:米) + */ + private Integer signInRadius; + + /** + * 主办方id(机关或网格的id) + */ + private String sponsorId; + + /** + * 活动主办方名称(机关或网格的名称) + */ + private String sponsorName; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + + /** + * 发布名义:网格主办:grid;组织主办:agency + */ + private String sponsorType; + + /** + * 活动详情 + */ + private List actContent; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/SponsorResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/SponsorResultDTO.java new file mode 100644 index 0000000000..ee7006381f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/SponsorResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:23 + */ +@Data +public class SponsorResultDTO implements Serializable { + private static final long serialVersionUID = 2781093523201803701L; + /** + * 机关组织Id + */ + private String agencyId = ""; + /** + * 机关组织名称 + */ + private String agencyName = ""; + /** + * 机关下网格列表信息 + */ + private List agencyGridList; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserBaseInfo.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserBaseInfo.java new file mode 100644 index 0000000000..b7ec382f5e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserBaseInfo.java @@ -0,0 +1,45 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放待处理界面,用户基本信息 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:22 + */ +@Data +public class UserBaseInfo implements Serializable { + private static final long serialVersionUID = 4316319460642833716L; + /** + * act_user_relation主键 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 微信昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java new file mode 100644 index 0000000000..c4bbb1f100 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 历史活动列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 16:19 + */ +@Data +public class UserHistoricalActInfoDTO implements Serializable { + private static final long serialVersionUID = 3703921511083310251L; + /** + * 活动id + */ + private String actId; + /** + * 活动标题 + */ + private String title; + /** + * 活动地址 + */ + private String actAddress; + /** + * 签到时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signInTime; + /** + * 服务时长单位120分钟 + */ + private Integer kindNessTime; + /** + * 可得积分 + */ + private Integer reward; + /** + * 正常发放:agree, 拒绝发放:deny + */ + private String rewardFlag; + /** + * 拒绝给分的理由 + */ + private String denyRewardReason; + + /** + * 已处理: handled; 默认"",重新处理时reward_flag置为空字符串 + */ + private String processFlag; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java new file mode 100644 index 0000000000..a6046ffd63 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java @@ -0,0 +1,54 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 16:15 + */ +@Data +public class UserHistoricalActResultDTO implements Serializable { + private static final long serialVersionUID = 7437428110692437615L; + /** + * 居民端用户id + */ + private String userId; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 昵称 + */ + private String nickName; + + /** + * 姓名 + */ + private String realName; + + /** + * 实际参加活动个数 + */ + private Integer signInActNum; + /** + * 报名活动个数 + */ + private Integer signUpActNum; + /** + * 获得积分活动个数 + */ + private Integer obtainPointsActNum; + + /** + *历史活动列表 + */ + private List actInfoList; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml index e245a2cdc9..52a56bea7c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml @@ -76,6 +76,12 @@ 2.0.0 compile + + com.epmet + epmet-message-client + 2.0.0 + compile + @@ -138,6 +144,9 @@ producerService/producer/sendMsg 202007161443499985fa2d397436d10356542134c8f008c48 52d9d9b0e7d0eb5b8b81c205b579e07c + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -176,6 +185,9 @@ producerService/producer/sendMsg 202007161443499985fa2d397436d10356542134c8f008c48 52d9d9b0e7d0eb5b8b81c205b579e07c + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -214,6 +226,9 @@ producerService/producer/sendMsg 202007161443499985fa2d397436d10356542134c8f008c48 52d9d9b0e7d0eb5b8b81c205b579e07c + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java index 5b6016b8b1..c5387c8ce4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java @@ -49,22 +49,22 @@ public interface ActConstant { String SPONSOR_GRID="grid"; /** - * 活动操作日志:取消活动 + * act_operation_rec活动操作日志:取消活动 */ String ACT_OPER_TYPE_CANCEL="cancel"; /** - * 活动操作日志:发布活动 + * act_operation_rec活动操作日志:发布活动 */ String ACT_OPER_TYPE_PUBLISH="publish"; /** - * 活动操作日志:结束活动 + * act_operation_rec活动操作日志:结束活动 */ String ACT_OPER_TYPE_FINISH="finish"; /** - * 活动操作日志:重新发布活动 + * act_operation_rec活动操作日志:重新发布活动 */ String ACT_OPER_TYPE_UPDATE="update"; @@ -84,7 +84,81 @@ public interface ActConstant { String ACT_USER_STATUS_REFUSED="refused"; /** - * (4)act_user_relation表的status:取消报名canceld, + * (4)act_user_relation表的status:取消报名canceled, */ - String ACT_USER_STATUS_CANCELD="canceld"; + String ACT_USER_STATUS_CANCELD="canceled"; + + /** + * (5)act_user_relation表的REWARD_FLAG:给积分agree + */ + String ACT_USER_STATUS_AGREE="agree"; + + /** + * (6)act_user_relation表的REWARD_FLAG:不给积分deny + */ + String ACT_USER_STATUS_DENY="deny"; + + /** + * (7)act_user_relation表的SIGN_IN_FLAG:已签到 + */ + String ACT_USER_STATUS_SIGNED_IN="signed_in"; + + /*act_user_log表:操作类型( + 已报名/待审核auditing, + 审核通过passed, + 审核不通过refused + 取消报名canceld, + )*/ + String ACT_USER_LOG_OPER_AUDITING="auditing"; + String ACT_USER_LOG_OPER_PASSED="passed"; + String ACT_USER_LOG_OPER_REFUSED="refused"; + String ACT_USER_LOG_OPER_CANCELD="canceled"; + + /** + * 审核通过类型:auto, manual + */ + String PASSEDTYPE_AUTO="auto"; + String PASSEDTYPE_MANUAL="manual"; + + /** + * (1)用户活动页面按钮控制:我要报名 + */ + String CURRENT_STATUS_USER_SIGN_UP = "sign_up"; + + /** + * (2)用户活动页面按钮控制:已报满 + */ + String CURRENT_STATUS_USER_ENOUGH = "enough"; + + /** + * (3)用户活动页面按钮控制:截止报名 + */ + String CURRENT_STATUS_USER_END_SIGN_UP = "end_sign_up"; + + /** + * (4)用户活动页面按钮控制:已开始 + */ + String CURRENT_STATUS_USER_IN_PROGRESS = "in_progress"; + + /** + * (5)用户活动页面按钮控制:已结束 + */ + String CURRENT_STATUS_USER_FINISHED = "finished"; + + /** + * (6)用户活动页面按钮控制:已取消 + */ + String CURRENT_STATUS_USER_CANCELED = "canceled"; + + /** + * (7)用户活动页面按钮控制:已确认积分 + */ + String CURRENT_STATUS_USER_POINTS_CONFIRM = "points_confirm"; + + /** + * act_user_rea + */ + String HANDLED="handled"; + + String RESET="reset"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java new file mode 100644 index 0000000000..5fcbb51334 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -0,0 +1,43 @@ +package com.epmet.constant; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 17:55 + */ +public interface ActMessageConstant { + String TITLE="您有一条活动消息"; + /** + * 报名审核成功,给居民端用户发送消息 + */ + String AUDIT_PASSED="您报名的%s活动,已审核通过"; + /** + * 拒绝用户的报名,给居民端用户发送消息 + */ + String AUDIT_REFUSED="您报名的%s活动,审核未通过,原因:%s"; + /** + * 活动被取消,给已经通过审核的居民端用户,发送消息 + */ + String ACT_CANCELED="您报名的%s活动,已取消,原因:%s"; + + /** + * 发放积分(结束活动)时调用消息的备注 + */ + String ACT_POINTS_EVENT_REMARK="参与%s"; + + /** + * 居民端-用户认证志愿者,发送消息 + */ + String POINTS_EVENT_VOLUNTEER_AUTHENTICATE="用户%s,认证志愿者"; + + /** + * 居民端-添加实况,发送消息 + */ + String ACT_POINTS_EVENT_VOLUNTEER_LIVE="用户%s,添加活动实况,活动:%s"; + + /** + * 工作端-重新发布活动,通知待审核+已经审核通过的用户 + */ + String RE_PUBLISH_ACT="您好,您参与的%s活动,%s,请注意查看"; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java index f28d58a269..72f402337a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java @@ -1,8 +1,23 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.work.ActIdFormDTO; +import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.CanceledUserResultDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; +import com.epmet.dto.result.work.PendingUserResultDTO; +import com.epmet.service.GrantPointsService; +import com.epmet.service.WorkActUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 工作端-积分发放api * @@ -12,4 +27,102 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("grantpoints") public class GrantPointsController { + @Autowired + private GrantPointsService grantPointsService; + @Autowired + private WorkActUserService workActUserService ; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-待处理列表 + * @Date 2020/7/24 12:28 + **/ + @PostMapping("pendinglist") + public Result queryPendingList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(grantPointsService.queryPendingList(formDTO.getActId())); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-不给分 + * @Date 2020/7/24 13:14 + **/ + @PostMapping("deny") + public Result deny(@RequestBody GrantPointsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.DenyUserShowGroup.class); + grantPointsService.deny(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-给分 + * @Date 2020/7/24 13:13 + **/ + @PostMapping("agree") + public Result agree(@RequestBody GrantPointsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class); + grantPointsService.agree(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-重新处理 + * @Date 2020/7/24 15:16 + **/ + @PostMapping("reset") + public Result reset(@RequestBody GrantPointsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class); + grantPointsService.reset(formDTO); + return new Result(); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:46 + **/ + @PostMapping("agreedlist") + public Result> agreedList(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(grantPointsService.agreedList(actIdFormDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + @PostMapping("deniedlist") + public Result> deniedList(@RequestBody ActIdFormDTO actIdFormDTO){ + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(grantPointsService.deniedList(actIdFormDTO)); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 积分发放-已取消报名列表 + * @Date 2020/7/26 19:19 + **/ + @PostMapping("canceleduserlist") + public Result> canceledUserList(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryCanceledUserList(actIdFormDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 235dbca23b..29cde0e42b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -5,15 +5,16 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.resi.*; import com.epmet.dto.result.resi.*; -import com.epmet.service.ActInfoService; +import com.epmet.service.*; import com.epmet.commons.tools.utils.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** - * 居民端-活动列表相关api + * 居民端-活动相关api * * @author yinzuomei@elink-cn.com * @date 2020/7/19 23:17 @@ -25,6 +26,21 @@ public class ResiActListController { @Autowired private ActInfoService actInfoService; + @Autowired + private ActUserRelationService actUserRelationService; + + @Autowired + private ActSummaryService actSummaryService; + + @Autowired + private ActLiveRecService actLiveRecService; + + @Autowired + private HeartUserInfoService heartUserInfoService; + + @Autowired + private ActSignInRecService actSignInRecService; + /** * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) * @@ -36,6 +52,7 @@ public class ResiActListController { **/ @PostMapping("list") public Result> listAct(@LoginUser TokenDto tokenDto, @RequestBody ResiActBaseFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiActBaseFormDTO.AddUserInternalGroup.class); return actInfoService.listAct(tokenDto, formDto); } @@ -51,6 +68,7 @@ public class ResiActListController { **/ @PostMapping("list/auditing") public Result> listAuditing(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class); return actInfoService.myActListAuditing(tokenDto, formDto); } @@ -65,6 +83,7 @@ public class ResiActListController { **/ @PostMapping("list/refused") public Result> listRefused(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class); return actInfoService.myActListRefused(tokenDto, formDto); } @@ -79,6 +98,7 @@ public class ResiActListController { **/ @PostMapping("list/passed") public Result> listPassed(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class); return actInfoService.myActListPassed(tokenDto, formDto); } @@ -93,6 +113,7 @@ public class ResiActListController { **/ @PostMapping("list/canceld") public Result> listcanceld(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiMyActFormDTO.AddUserInternalGroup.class); return actInfoService.myActListCanceld(tokenDto, formDto); } @@ -106,6 +127,7 @@ public class ResiActListController { **/ @PostMapping("list/latestact") public Result> latestAct(@RequestBody ResiLatestActFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiLatestActFormDTO.AddUserInternalGroup.class); return actInfoService.latestAct(formDto); } @@ -132,9 +154,71 @@ public class ResiActListController { **/ @PostMapping("actlookback") public Result> actLookBack(@RequestBody ResiActBaseFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiActBaseFormDTO.AddUserInternalGroup.class); return actInfoService.actLookBack(formDto); } + // + + /** + * 活动详情 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiActDetailFormDTO.AddUserInternalGroup.class); + return actInfoService.actDetail(tokenDto, formDto); + } + + /** + * 活动详情-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("rejectdetail") + public Result rejectDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiActDetailFormDTO.AddUserInternalGroup.class); + return actInfoService.rejectDetail(tokenDto, formDto); + } + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("summary/list") + public Result summaryList(@RequestBody ResiActContentFormDTO formDto) { + ValidatorUtils.validateEntity(formDto, ResiActContentFormDTO.AddUserInternalGroup.class); + return actSummaryService.summaryList(formDto); + } + + /** + * 活动详情-已结束-现场实况列表 + * + * @param map{actId:""} + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("livereclist") + public Result liveRecList(@RequestBody Map map) { + return actLiveRecService.liveRecList(map); + } + + // + /** * 取消活动报名 * @@ -146,8 +230,8 @@ public class ResiActListController { **/ @PostMapping("cancelsignup") public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); - return actInfoService.cancelSignUp(tokenDto, formDTO); + ValidatorUtils.validateEntity(formDTO, ResiActUserCancelSignUpFormDTO.AddUserInternalGroup.class, ResiActUserCancelSignUpFormDTO.AddUserShowGroup.class); + return actUserRelationService.cancelSignUp(tokenDto, formDTO); } /** @@ -161,8 +245,68 @@ public class ResiActListController { **/ @PostMapping("checksigninaddress") public Result cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO, ResiActCaculateDistanceFormDTO.AddUserInternalGroup.class); return actInfoService.checkSignInAddress(formDTO); } + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:42 2020-07-22 + **/ + @PostMapping("leaderboard") + public Result> leaderboard(@RequestBody ResiActBaseFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ResiActBaseFormDTO.AddUserInternalGroup.class); + return heartUserInfoService.leaderboard(formDTO); + } + + /** + * 活动-添加实况 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + @PostMapping("insertlive") + public Result insertLive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ResiActInsertLiveFormDTO.AddUserInternalGroup.class, ResiActInsertLiveFormDTO.AddUserShowGroup.class); + Result result = actLiveRecService.insertLive(tokenDto, formDTO); + return new Result(); + } + + /** + * 活动-签到 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + @PostMapping("signin") + public Result actSignIn(@LoginUser TokenDto tokenDto, @RequestBody ResiActSignInFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ResiActSignInFormDTO.AddUserInternalGroup.class, ResiActSignInFormDTO.AddUserShowGroup.class); + return actSignInRecService.actSignIn(tokenDto, formDTO); + } + + /** + * 活动报名 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 16:46 2020-07-23 + **/ + @PostMapping("registration") + public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class); + return actUserRelationService.registration(tokenDto, formDTO); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java new file mode 100644 index 0000000000..a2768b99bd --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -0,0 +1,52 @@ +/** + * 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.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.service.VolunteerInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 居民端-志愿者相关api + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@RestController +@RequestMapping("/resi/volunteer") +public class ResiVolunteerController { + + @Autowired + private VolunteerInfoService volunteerInfoService; + + @PostMapping("authenticate") + public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class); + return volunteerInfoService.authenticate(tokenDto, formDTO); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index 4bc41c41d3..8501fb6ac8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -1,8 +1,18 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.work.*; +import com.epmet.dto.result.work.*; +import com.epmet.service.WorkActService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 工作端-发布活动相关api * @@ -12,4 +22,222 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/work/act") public class WorkActController { + @Autowired + private WorkActService workActService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + @PostMapping("deletedraft") + public Result deleteDraft(){ + workActService.deleteDraft(); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 活动主办方 + * @Date 2020/7/23 20:37 + **/ + @PostMapping("sponsorlist") + public Result querySponsorList(){ + return new Result().ok(workActService.querySponsorList()); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:32 + **/ + @PostMapping("publish") + public Result publishAct(@RequestBody PublishActInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.publishAct(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 进行中活动列表 + * @Date 2020/7/23 21:24 + **/ + @PostMapping("inprogresslist") + public Result> queryInProgressList(@RequestBody ActListCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActService.queryInProgressList(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:11 + **/ + @PostMapping("canceledlist") + public Result> queryCanceledlist(@RequestBody ActListCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActService.queryCanceledList(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + @PostMapping("finishedlist") + public Result> queryFinishedList(@RequestBody ActListCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActService.queryFinishedList(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + @PostMapping("cancelact") + public Result cancelAct(@RequestBody CancelActFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,CancelActFormDTO.UserShowGroup.class,CancelActFormDTO.AddUserInternalGroup.class); + workActService.cancelAct(formDTO); + return new Result(); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + @PostMapping("canceleddetail") + public Result canceledDetail(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.canceledDetail(actIdFormDTO.getActId())); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已结束-保存活动实际开始结束时间 + * @Date 2020/7/26 19:48 + **/ + @PostMapping("saveactualtime") + public Result saveActualTime(@RequestBody SaveActualTimeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, SaveActualTimeFormDTO.UserShowGroup.class, + SaveActualTimeFormDTO.AddUserInternalGroup.class); + workActService.saveActualTime(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:01 + **/ + @PostMapping("finisheddeatil") + public Result finishedDeatil(@RequestBody ActIdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.finishedDeatil(formDTO)); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:33 + **/ + @PostMapping("inprogressdetail") + public Result inProgressDetail(@RequestBody ActIdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.inProgressDetail(formDTO.getActId())); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 已结束-确认结束活动 + * @Date 2020/7/26 21:48 + **/ + @PostMapping("finishact") + public Result finishAct(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + workActService.finishAct(formDTO.getActId()); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 保存添加回顾 + * @Date 2020/7/27 10:45 + **/ + @PostMapping("summaryact") + public Result summaryAct(@RequestBody SummaryActFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, SummaryActFormDTO.AddUserInternalGroup.class); + if(null!=formDTO.getActContent()&&formDTO.getActContent().size()>0){ + ValidatorUtils.validateEntity(formDTO.getActContent(), SummaryActFormDTO.AddUserShowGroup.class); + } + workActService.summaryAct(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 重新编辑-获取活动详情 + * @Date 2020/7/27 13:36 + **/ + @PostMapping("getactinfo") + public Result getActInfo(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.getActInfo(formDTO.getActId())); + } + + /** + * @param rePublishFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 重新发布活动 + * @Date 2020/7/27 13:55 + **/ + @PostMapping("republish") + public Result rePublish(@RequestBody RePublishFormDTO rePublishFormDTO) { + ValidatorUtils.validateEntity(rePublishFormDTO, RePublishFormDTO.AddUserShowGroup.class, RePublishFormDTO.AddUserInternalGroup.class); + for (PublishActContentFormDTO actContentFormDTO : rePublishFormDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.rePublish(rePublishFormDTO)); + } + + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java index f69b65b065..e960a2f926 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java @@ -37,19 +37,6 @@ public class WorkActDraftController { return new Result().ok(initResultDTO); } - /** - * @return com.epmet.commons.tools.utils.Result - * @param - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - @PostMapping("deletedraft") - public Result deleteDraft(){ - workActDraftService.deleteDraft(); - return new Result(); - } - /** * @return com.epmet.commons.tools.utils.Result * @param @@ -72,9 +59,8 @@ public class WorkActDraftController { **/ @PostMapping("saveact") public Result saveAct(@RequestBody DraftActInfoFormDTO formDTO){ - //起码活动标题不能为空 - ValidatorUtils.validateEntity(formDTO, DraftActInfoFormDTO.AddDraftUserShowGroup.class, - DraftActInfoFormDTO.AddUserInternalGroup.class); + //起码客户id不能为空 + ValidatorUtils.validateEntity(formDTO,DraftActInfoFormDTO.AddUserInternalGroup.class); //如果录入了活动内容,需要校验 content、contentType if (null != formDTO.getActContent() && formDTO.getActContent().size() > 0) { for(DraftActContentFormDTO actContentFormDTO:formDTO.getActContent()){ @@ -102,25 +88,4 @@ public class WorkActDraftController { return new Result().ok(resultDTO); } - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:32 - **/ - @PostMapping("publish") - public Result publishAct(@RequestBody PublishActInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); - for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { - ValidatorUtils.validateEntity(actContentFormDTO, - PublishActContentFormDTO.UserShowGroup.class, - PublishActContentFormDTO.UserInternalGroup.class - ); - } - PublishActResultDTO resultDTO = workActDraftService.publishAct(formDTO); - return new Result().ok(resultDTO); - } - - } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java index 78e5f52ce4..59769d69b9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java @@ -2,7 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.work.AuditingActUserFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.work.*; import com.epmet.service.WorkActUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -34,10 +34,9 @@ public class WorkActUserController { * @Date 2020/7/21 22:24 **/ @PostMapping("auditinglist") - public Result> getAuditingList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getAuditingList(formDTO); - return new Result>().ok(list); + public Result> getAuditingList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.getAuditingList(formDTO)); } @@ -49,10 +48,9 @@ public class WorkActUserController { * @Date 2020/7/22 15:16 **/ @PostMapping("passedlist") - public Result> getPassedList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getPassedList(formDTO); - return new Result>().ok(list); + public Result> getPassedList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.getPassedList(formDTO)); } /** @@ -63,10 +61,9 @@ public class WorkActUserController { * @Date 2020/7/22 15:49 **/ @PostMapping("rejectedlist") - public Result> getRejectedlist(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getRejectedlist(formDTO); - return new Result>().ok(list); + public Result> getRejectedlist(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.getRejectedlist(formDTO)); } /** @@ -77,10 +74,9 @@ public class WorkActUserController { * @Date 2020/7/22 16:23 **/ @PostMapping("canceledlist") - public Result getCanceledList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getCanceledList(formDTO); - return new Result>().ok(list); + public Result> getCanceledList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.getCanceledList(formDTO)); } /** @@ -91,10 +87,88 @@ public class WorkActUserController { * @Date 2020/7/22 16:43 **/ @PostMapping("signupstat") - public Result getActSignUpStat(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - ActSignUpStatResultDTO resultDTO=workActUserService.getActSignUpStat(formDTO.getActId()); - return new Result().ok(resultDTO); + public Result getActSignUpStat(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActUserService.getActSignUpStat(formDTO.getActId())); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 报名审核-人员详情(待审核、已通过,已拒绝,已取消报名用的是一个api) + * @Date 2020/7/22 22:44 + **/ + @PostMapping("userdetail") + public Result queryAuditingUserDetail(@RequestBody AactUserDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AactUserDetailFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActUserService.queryAuditingUserDetail(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 报名审核-人员历史活动情况 + * @Date 2020/7/23 16:12 + **/ + @PostMapping("historicalact") + public Result queryUserHistoricalAct(@RequestBody UserHistoricalActFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, UserHistoricalActFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActUserService.queryUserHistoricalAct(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 报名审核-审核通过 + * @Date 2020/7/23 17:31 + **/ + @PostMapping("auditpass") + public Result auditPass(@RequestBody AuditUserFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.AddUserInternalGroup.class); + workActUserService.auditPass(formDTO.getActUserRelationId()); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 报名审核-拒绝报名 + * @Date 2020/7/23 18:08 + **/ + @PostMapping("auditrefuse") + public Result auditrefuse(@RequestBody AuditUserFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.RefusedUserShowGroup.class); + workActUserService.auditRefuse(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:17 + **/ + @PostMapping("joinuserlist") + public Result> queryJoinUserList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryJoinUserList(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:53 + **/ + @PostMapping("canceleduserlist") + public Result> queryCanceledUserList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryCanceledUserList(formDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java index 2d7ef0de25..8ff05abcde 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java @@ -18,9 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.work.ActPreviewContentResultDTO; import com.epmet.entity.ActContentEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 活动内容 * @@ -29,5 +32,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActContentDao extends BaseDao { - + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 根据活动id查询活动详情 + * @Date 2020/7/26 18:26 + **/ + List selectByActId(String actId); + + /** + * @return int + * @param actId + * @author yinzuomei + * @description 根据活动id,将原来的活动详情删除,del_flag=1 + * @Date 2020/7/27 14:06 + **/ + int updateDelFlagByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index dfe34da353..ce0d39cb16 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -20,10 +20,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.form.resi.ResiActBaseFormDTO; +import com.epmet.dto.form.resi.ResiActDetailFormDTO; import com.epmet.dto.form.resi.ResiLatestActFormDTO; import com.epmet.dto.form.resi.ResiMyActFormDTO; import com.epmet.dto.result.resi.*; -import com.epmet.dto.result.work.ActSignUpStatResultDTO; +import com.epmet.dto.result.work.*; import com.epmet.entity.ActInfoEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -118,7 +119,7 @@ public interface ActInfoDao extends BaseDao { * @Author zhangyong * @Date 13:53 2020-07-20 **/ - List selectListActMyHavePassed(ResiMyActFormDTO formDTO); + List selectListMyActIHavePassed(ResiMyActFormDTO formDTO); /** * 我的活动-已结束 @@ -184,4 +185,116 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/22 17:08 **/ ActSignUpStatResultDTO getActSignUpStat(String actId); + + /** + * 活动详情 + * + * @param formDto + * @return com.epmet.dto.result.resi.ResiActDetailResultDTO + * @Author zhangyong + * @Date 09:20 2020-07-22 + **/ + ResiActDetailResultDTO selectActInfoDetail(ResiActDetailFormDTO formDto); + + /** + * 活动详情-未通过 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + ResiActRefusedDetailResultDTO selectActRejectDetail(ResiActDetailFormDTO formDto); + + /** + * 从活动内容表,查询活动内容 + * + * @param actId + * @return java.util.List + * @Author zhangyong + * @Date 09:56 2020-07-22 + **/ + List selectListActContent(@Param("actId") String actId); + + /** + * 查询当前报名的活动开始时间-结束时间,是否与其他已报名,未结束的活动,存在交集情况 + * + * @param actInfoDTO + * @return java.lang.Integer + * @Author zhangyong + * @Date 17:17 2020-07-23 + **/ + Integer checkActTime(ActInfoDTO actInfoDTO); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 查询正在进行中的活动列表 + * @Date 2020/7/23 21:58 + **/ + List selectInprogress(String customerId); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:13 + **/ + List selectCanceledList(String customerId); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + List selectFinishedList(String customerId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:18 + **/ + List queryJoinUserList(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:55 + **/ + List queryCanceledUserList(String actId); + + /** + * @return com.epmet.dto.result.work.CanceledActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 工作端-查询已取消活动详情 + * @Date 2020/7/26 18:29 + **/ + CanceledActDetailResultDTO selectCanceledActInfo(String actId); + + /** + * @return com.epmet.dto.result.work.FinishedActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:04 + **/ + FinishedActDetailResultDTO selectFinishedDetail(String actId); + + /** + * @return com.epmet.dto.result.work.InProgressActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:35 + **/ + InProgressActDetailResultDTO selectInProgressDetail(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java index dec7d0055b..ce9999af87 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java @@ -18,8 +18,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ActLivePicDTO; +import com.epmet.dto.ActLiveRecDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.entity.ActLiveRecEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 活动实况记录 @@ -29,5 +35,34 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActLiveRecDao extends BaseDao { - -} \ No newline at end of file + + /** + * 根据活动id,查询活动下的所有活动实况 + * + * @param actId + * @return java.util.List + * @Author zhangyong + * @Date 16:27 2020-07-22 + **/ + List selectListActLives(@Param("actId") String actId); + + /** + * 根据实况id,查询每条实况对应的多张图片 + * + * @param liveIds + * @return java.util.List + * @Author zhangyong + * @Date 17:04 2020-07-22 + **/ + List selectListActLiveImg(@Param("liveId") List liveIds); + + /** + * 插入活动实况表 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 18:05 2020-07-24 + **/ + void insertActLiveRec(ResiActInsertLiveFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java index 04c13f13cd..ca383df81f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInRecEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSignInRecDao extends BaseDao { - -} \ No newline at end of file + + /** + * 插入活动签到记录表 + * + * @param dto + * @return void + * @Author zhangyong + * @Date 18:05 2020-07-24 + **/ + void insertActSignInRec(ActSignInRecDTO dto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java index 9ebc0e3fed..cb4993d0b0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActSummaryResultDTO; import com.epmet.entity.ActSummaryEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSummaryDao extends BaseDao { - -} \ No newline at end of file + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.dto.result.resi.ResiActSummaryResultDTO + * @Author zhangyong + * @Date 15:11 2020-07-22 + **/ + ResiActSummaryResultDTO selectListSummary(ResiActContentFormDTO formDto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java index 52b3034e75..348a259dde 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java @@ -18,8 +18,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ActUserLogDTO; import com.epmet.entity.ActUserLogEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 用户活动关系日志表 @@ -29,5 +31,34 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActUserLogDao extends BaseDao { - -} \ No newline at end of file + + /** + * @return java.lang.Integer + * @param actId + * @param userId + * @author yinzuomei + * @description 被拒绝的总次数 + * @Date 2020/7/23 14:13 + **/ + Integer selectRefusedCount(@Param("actId") String actId, @Param("userId") String userId); + + /** + * @return com.epmet.dto.ActUserLogDTO + * @param actId + * @param userId + * @author yinzuomei + * @description 最后被拒绝的记录 + * @Date 2020/7/23 14:13 + **/ + ActUserLogDTO selectLatestRefused(@Param("actId") String actId, @Param("userId") String userId); + + /** + * 查询我累计【报名过】的活动次数 + * + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 16:12 2020-07-23 + **/ + Integer countActTimesOfParticipation(@Param("userId") String userId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index facb735601..46affbe03e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -19,6 +19,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; +import com.epmet.dto.result.work.UserHistoricalActInfoDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -61,4 +64,146 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/22 18:20 **/ Integer selectCountUser(@Param("actId") String actId, @Param("status")String status); -} \ No newline at end of file + + /** + * 根据活动id,查询活动已报名的人数 + * + * @param actId + * @return Integer + * @Author zhangyong + * @Date 10:51 2020-07-22 + **/ + Integer selectActSignupNum(@Param("actId") String actId); + + /** + * 根据用户id和活动id,修改 用户活动关系表 + * + * @param userRelationDTO + * @return void + * @Author zhangyong + * @Date 14:39 2020-07-22 + **/ + void updateUserRelationByActIdAndUserId(ActUserRelationDTO userRelationDTO); + + /** + * @return java.lang.Integer + * @param userId + * @author yinzuomei + * @description 实际参加活动个数(已经签到的) + * @Date 2020/7/23 15:56 + **/ + Integer countSignInActNum(String userId); + + /** + * @return java.lang.Integer + * @param userId + * @author yinzuomei + * @description 报名活动个数(act_user_realation) + * @Date 2020/7/23 15:57 + **/ + Integer countSignUpActNum(String userId); + + /** + * @return java.lang.Integer + * @param userId + * @author yinzuomei + * @description 获得积分活动个数 + * @Date 2020/7/23 15:57 + **/ + Integer countObtainPointsActNum(String userId); + + /** + * @return java.util.List + * @param userId + * @author yinzuomei + * @description 根据userId,查询参与活动记录 + * @Date 2020/7/23 16:46 + **/ + List selectAllByUserId(String userId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 查询待处理的记录 + * @Date 2020/7/24 13:02 + **/ + List selectInProgress(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 查询待处理的人员id集合 + * @Date 2020/7/24 13:02 + **/ + List selectInProgressUserIds(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:48 + **/ + List selectAgreedList(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:11 + **/ + List selectDeniedList(String actId); + + /** + * @return java.lang.Integer + * @param actId + * @author yinzuomei + * @description 活动已签到人数 + * @Date 2020/7/26 22:34 + **/ + Integer selectCountSinedIn(String actId); + + /** + * @return java.lang.Integer + * @param actId + * @param rewardFlag + * @author yinzuomei + * @description 查询发放积分的总人数、拒绝发放积分的总人数 + * @Date 2020/7/26 22:38 + **/ + Integer selectCountByReward(@Param("actId") String actId, @Param("rewardFlag")String rewardFlag); + + /** + * 取消报名 + * 根据用户id和活动id,删除 用户活动关系表中,用户的报名记录 + * + * @param entity + * @return void + * @Author zhangyong + * @Date 14:39 2020-07-22 + **/ + void delSignUpRecord(ActUserRelationEntity entity); + + /** + * 当前用户是否曾报名参加过该活动 + * + * @param actId + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 14:35 2020-07-27 + **/ + Integer selectCountByActIdAndUserId(@Param("actId") String actId, @Param("userId")String userId); + + /** + * @return java.util.List + * @param actId 活动id + * @author yinzuomei + * @description 根据活动id,查询待审核+已经审核通过的人员 + * @Date 2020/7/27 14:59 + **/ + List selectAuditingAndPassedList(String actId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java index 8ec5974ac9..5e0bfb3785 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java @@ -19,8 +19,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.HeartUserInfoDTO; +import com.epmet.dto.form.resi.ResiActBaseFormDTO; import com.epmet.entity.HeartUserInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 用户信息 @@ -39,4 +43,37 @@ public interface HeartUserInfoDao extends BaseDao { * @Date 2020/7/21 22:48 **/ HeartUserInfoDTO selectByUserId(String userId); -} \ No newline at end of file + + + /** + * 查询用户是否是志愿者:1是志愿者,0不是志愿者 + * + * @param userId + * @return java.lang.Boolean + * @Author zhangyong + * @Date 13:53 2020-07-22 + **/ + Boolean selectUserVolunteerFlag(@Param("userId") String userId); + + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 18:06 2020-07-22 + **/ + List selectListLeaderboard(ResiActBaseFormDTO formDTO); + + /** + * 根据用户id,修改用户信息表 + * + * @param dto + * @return void + * @Author zhangyong + * @Date 16:27 2020-07-23 + **/ + void updateHeartUserInfoByUserId(HeartUserInfoDTO dto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java index a0cbb2b6e5..acf7fe8557 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java @@ -60,4 +60,13 @@ public interface LatestActContentDao extends BaseDao { * @Date 2020/7/21 18:07 **/ List previewActContent(String actId); + + /** + * @return int + * @param actId + * @author yinzuomei + * @description 根据活动id删除活动详情 物理删除 + * @Date 2020/7/24 16:08 + **/ + int deleteByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java index d1a00cb15d..caf1adf16f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java @@ -58,4 +58,13 @@ public interface LatestActInfoDao extends BaseDao { * @Date 2020/7/21 17:56 **/ ActPreviewResultDTO previewActInfo(String actDraftId); + + /** + * @return int + * @param id + * @author yinzuomei + * @description 逻辑删除表记录 + * @Date 2020/7/27 17:10 + **/ + int updateToDelById(String id); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java index 2d23a8d37c..5ceec37857 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.VolunteerInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 志愿者信息 @@ -29,5 +30,26 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface VolunteerInfoDao extends BaseDao { - -} \ No newline at end of file + + /** + * 查询用户是否是志愿者身份 + * >0 是 + * 0 不是 + * + * @param userId + * @return java.lang.String + * @Author zhangyong + * @Date 14:33 2020-07-23l + **/ + Integer queryVolunteerFlagByUserId(@Param("userId") String userId); + + /** + * 根据用户ID,修改志愿者信息 + * + * @param entity + * @return void + * @Author zhangyong + * @Date 15:05 2020-07-23 + **/ + void updateVolunteerInfoByUserId(VolunteerInfoEntity entity); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java index aef5e68fe0..5a54f8f5c5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java @@ -49,8 +49,12 @@ public class ActOperationRecEntity extends BaseEpmetEntity { private String type; /** - * 1通知用户0不通知 + * 1通知用户0不通知,取消活动时默认true */ private Boolean noticeUser; + /** + * 备注,取消活动时此列有值 + */ + private String remark; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java index 1a437316e1..e18170b8a3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 活动发放积分日志表 * @@ -48,11 +45,6 @@ public class ActPointLogEntity extends BaseEpmetEntity { */ private String userId; - /** - * 加积分:add ; 减积分:subtract - */ - private String pointType; - /** * 积分值 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java index 61de147e46..cc1a41fa9a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 活动统计信息 * @@ -44,7 +41,7 @@ public class ActStatisticalEntity extends BaseEpmetEntity { private String actId; /** - * 已报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) + * 报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) */ private Integer signupNum; @@ -73,16 +70,6 @@ public class ActStatisticalEntity extends BaseEpmetEntity { */ private Integer signedInUserNum; - /** - * 添加实况总人数 - */ - private Integer liveUserNum; - - /** - * 实况总记录数 - */ - private Integer liveCount; - /** * 发放积分总人数 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java index 101f3c9556..751f535f5f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 用户活动关系日志表 * @@ -50,13 +47,10 @@ public class ActUserLogEntity extends BaseEpmetEntity { /** * 操作类型(已报名/待审核auditing, -审核通过passed, -审核不通过refused -取消报名canceld, -发放积分rewarded -拒绝发放积分refuse_reward -重新处理processing -) + * 审核通过passed, + * 审核不通过refused + * 取消报名canceled, + * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java index 4eb9a68cdd..f5af4a176d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java @@ -52,7 +52,7 @@ public class ActUserRelationEntity extends BaseEpmetEntity { * 当前状态(已报名/待审核auditing, 审核通过passed, 审核不通过refused -取消报名canceld, +取消报名canceled, ) */ private String status; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java index 6d1a11c42b..484e911fe1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java @@ -44,8 +44,8 @@ public class VolunteerInfoEntity extends BaseEpmetEntity { private String userId; /** - * 客户id - */ + * 客户id + */ private String customerId; /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java index 32c0978916..4f67a60cd8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java @@ -26,6 +26,8 @@ import com.epmet.dto.result.resi.*; import com.epmet.entity.ActInfoEntity; import com.epmet.commons.tools.utils.Result; + +import java.util.Date; import java.util.List; import java.util.Map; @@ -192,13 +194,34 @@ public interface ActInfoService extends BaseService { Result> actLookBack(ResiActBaseFormDTO formDTO); /** - * 取消活动报名 + * 活动详情 * * @param tokenDto - * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); + + /** + * 活动详情-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); + + /** + * 查询当前报名的活动开始时间-结束时间,是否与其他已报名,未结束的活动,存在交集情况 + * + * @param actInfoDTO + * @return java.lang.Integer * @Author zhangyong - * @Date 09:29 2020-07-20 + * @Date 17:17 2020-07-23 **/ - Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO); + Integer checkActTime(ActInfoDTO actInfoDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index aa89cb830a..9ebe84e2ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -18,11 +18,12 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.ActLiveRecDTO; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; +import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; -import java.util.List; import java.util.Map; /** @@ -34,62 +35,24 @@ import java.util.Map; public interface ActLiveRecService extends BaseService { /** - * 默认分页 + * 活动详情-已结束-现场实况列表 * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); + * @param map + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result liveRecList(Map map); /** - * 默认查询 + * 活动-添加实况 + * 返回实况id,主要是因为,当签到并转发实况时,表中需要存储【实况ID】 * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ActLiveRecDTO - * @author generator - * @date 2020-07-19 - */ - ActLiveRecDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(ActLiveRecDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(ActLiveRecDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:40 2020-07-23 + **/ + Result insertLive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java index c8119da389..c2ba4124ce 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java @@ -18,13 +18,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.ActSignInRecDTO; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInRecEntity; -import java.util.List; -import java.util.Map; - /** * 活动签到记录 * @@ -32,64 +30,14 @@ import java.util.Map; * @since v1.0.0 2020-07-19 */ public interface ActSignInRecService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ActSignInRecDTO - * @author generator - * @date 2020-07-19 - */ - ActSignInRecDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(ActSignInRecDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(ActSignInRecDTO dto); - /** - * 批量删除 + * 活动-签到 * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java index 6cc0b1e450..863626d44f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java @@ -19,7 +19,10 @@ 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.ActSummaryDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActSummaryResultDTO; import com.epmet.entity.ActSummaryEntity; import java.util.List; @@ -92,4 +95,14 @@ public interface ActSummaryService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result summaryList(ResiActContentFormDTO formDto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java index 8edb4ef9c5..4eb8fbe83d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java @@ -92,4 +92,14 @@ public interface ActUserLogService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 查询我累计报名过的活动次数 + * + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 16:12 2020-07-23 + **/ + Integer countActTimesOfParticipation(String userId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java index a93a4936cd..f3a135ee6a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java @@ -19,7 +19,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; +import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Param; @@ -123,4 +127,27 @@ public interface ActUserRelationService extends BaseService + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:47 + **/ + List agreedList(ActIdFormDTO actIdFormDTO); + + /** + * @return java.util.List + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + List deniedList(ActIdFormDTO actIdFormDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java index ba77b11ed9..f753bb67ae 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/HeartUserInfoService.java @@ -19,7 +19,10 @@ 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.HeartUserInfoDTO; +import com.epmet.dto.form.resi.ResiActBaseFormDTO; +import com.epmet.dto.result.resi.ResiLeaderboardResultDTO; import com.epmet.entity.HeartUserInfoEntity; import java.util.List; @@ -101,4 +104,27 @@ public interface HeartUserInfoService extends BaseService { * @Date 2020/7/21 22:48 **/ HeartUserInfoDTO getByUserId(String userId); -} \ No newline at end of file + + + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:42 2020-07-22 + **/ + Result> leaderboard(ResiActBaseFormDTO formDTO); + + /** + * 根据用户id,修改用户信息表 + * + * @param dto + * @return void + * @Author zhangyong + * @Date 16:27 2020-07-23 + **/ + void updateHeartUserInfoByUserId(HeartUserInfoDTO dto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index e7874814d2..6938871d5b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.entity.VolunteerInfoEntity; import java.util.List; @@ -34,62 +37,14 @@ import java.util.Map; public interface VolunteerInfoService extends BaseService { /** - * 默认分页 + * 志愿者认证 * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return VolunteerInfoDTO - * @author generator - * @date 2020-07-19 - */ - VolunteerInfoDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(VolunteerInfoDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(VolunteerInfoDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:09 2020-07-23 + **/ + Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO); + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java index e08b1671e4..cc0683b91c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java @@ -2,8 +2,10 @@ package com.epmet.service; import com.epmet.dto.form.work.ActPreviewFormDTO; import com.epmet.dto.form.work.DraftActInfoFormDTO; -import com.epmet.dto.form.work.PublishActInfoFormDTO; -import com.epmet.dto.result.work.*; +import com.epmet.dto.result.work.ActPreviewResultDTO; +import com.epmet.dto.result.work.LatestDraftActInfoResultDTO; +import com.epmet.dto.result.work.PublishActInitResultDTO; +import com.epmet.dto.result.work.SaveActDraftResultDTO; /** * 工作端活动草稿 @@ -22,15 +24,6 @@ public interface WorkActDraftService { **/ PublishActInitResultDTO publishActInit(); - /** - * @return void - * @param - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - void deleteDraft(); - /** * @return com.epmet.dto.result.work.LatestDraftActInfoResultDTO * @param @@ -58,12 +51,4 @@ public interface WorkActDraftService { **/ ActPreviewResultDTO previewActDetail(ActPreviewFormDTO formDTO); - /** - * @return com.epmet.dto.result.work.PublishActResultDTO - * @param formDTO - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:33 - **/ - PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java new file mode 100644 index 0000000000..8aca54049d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -0,0 +1,149 @@ +package com.epmet.service; + +import com.epmet.dto.form.work.*; +import com.epmet.dto.result.work.*; + +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:36 + */ +public interface WorkActService { + /** + * @return void + * @param + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + void deleteDraft(); + + /** + * @return com.epmet.dto.result.work.SponsorResultDTO + * @param + * @author yinzuomei + * @description 活动主办方 + * @Date 2020/7/23 20:37 + **/ + SponsorResultDTO querySponsorList(); + + /** + * @return com.epmet.dto.result.work.PublishActResultDTO + * @param formDTO + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:33 + **/ + PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); + + /** + * @return com.epmet.dto.result.work.InProgressActResultDTO + * @param formDTO + * @author yinzuomei + * @description 进行中活动列表 + * @Date 2020/7/23 21:24 + **/ + List queryInProgressList(ActListCommonFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:11 + **/ + List queryCanceledList(ActListCommonFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + List queryFinishedList(ActListCommonFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + void cancelAct(CancelActFormDTO formDTO); + + /** + * @return void + * @param actId + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + CanceledActDetailResultDTO canceledDetail(String actId); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 已结束-保存活动实际开始结束时间 + * @Date 2020/7/26 19:49 + **/ + void saveActualTime(SaveActualTimeFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.dto.result.work.FinishedActDetailResultDTO + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:02 + **/ + FinishedActDetailResultDTO finishedDeatil(ActIdFormDTO formDTO); + + /** + * @return com.epmet.dto.result.work.InProgressActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:34 + **/ + InProgressActDetailResultDTO inProgressDetail(String actId); + + /** + * @return void + * @param actId + * @author yinzuomei + * @description 已结束-确认结束活动 + * @Date 2020/7/26 21:48 + **/ + void finishAct(String actId); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 保存添加回顾 + * @Date 2020/7/27 10:45 + **/ + void summaryAct(SummaryActFormDTO formDTO); + + /** + * @return com.epmet.dto.result.work.ReEditActInfoResultDTO + * @param actId + * @author yinzuomei + * @description 重新编辑-获取活动详情 + * @Date 2020/7/27 13:36 + **/ + ReEditActInfoResultDTO getActInfo(String actId); + + /** + * @return com.epmet.dto.result.work.PublishActResultDTO + * @param rePublishFormDTO + * @author yinzuomei + * @description 重新发布活动 + * @Date 2020/7/27 13:55 + **/ + PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java index 82b846a23a..281d8e7556 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java @@ -1,6 +1,10 @@ package com.epmet.service; -import com.epmet.dto.form.work.AuditingActUserFormDTO; +import com.epmet.dto.form.work.AactUserDetailFormDTO; +import com.epmet.dto.form.work.ActIdFormDTO; +import com.epmet.dto.form.work.AuditUserFormDTO; +import com.epmet.dto.form.work.UserHistoricalActFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.work.*; import java.util.List; @@ -19,7 +23,7 @@ public interface WorkActUserService { * @description 报名审核-待审核列表 * @Date 2020/7/21 22:25 **/ - List getAuditingList(AuditingActUserFormDTO formDTO); + List getAuditingList(ActIdFormDTO formDTO); /** * @return java.util.List @@ -28,7 +32,7 @@ public interface WorkActUserService { * @description 报名审核-已通过列表 * @Date 2020/7/22 15:16 **/ - List getPassedList(AuditingActUserFormDTO formDTO); + List getPassedList(ActIdFormDTO formDTO); /** * @return java.util.List @@ -37,7 +41,7 @@ public interface WorkActUserService { * @description 报名审核-已拒绝列表 * @Date 2020/7/22 15:50 **/ - List getRejectedlist(AuditingActUserFormDTO formDTO); + List getRejectedlist(ActIdFormDTO formDTO); /** * @return java.util.List @@ -46,7 +50,7 @@ public interface WorkActUserService { * @description 报名审核-已取消报名列表 * @Date 2020/7/22 16:35 **/ - List getCanceledList(AuditingActUserFormDTO formDTO); + List getCanceledList(ActIdFormDTO formDTO); /** * @return com.epmet.dto.result.work.ActSignUpStatResultDTO @@ -56,4 +60,85 @@ public interface WorkActUserService { * @Date 2020/7/22 17:02 **/ ActSignUpStatResultDTO getActSignUpStat(String actId); + + /** + * @return com.epmet.dto.result.work.AuditingUserDetailResultDTO + * @param formDTO + * @author yinzuomei + * @description 报名审核-待审核人员详情 + * @Date 2020/7/22 22:44 + **/ + AuditingUserDetailResultDTO queryAuditingUserDetail(AactUserDetailFormDTO formDTO); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 报名审核-人员历史活动情况 + * @Date 2020/7/23 16:16 + **/ + UserHistoricalActResultDTO queryUserHistoricalAct(UserHistoricalActFormDTO formDTO); + + /** + * @return void + * @param actUserRelationId + * @author yinzuomei + * @description 报名审核-审核通过 + * @Date 2020/7/23 17:30 + **/ + void auditPass(String actUserRelationId); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 报名审核-拒绝报名 + * @Date 2020/7/23 18:14 + **/ + void auditRefuse(AuditUserFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:17 + **/ + List queryJoinUserList(ActIdFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:54 + **/ + List queryCanceledUserList(ActIdFormDTO formDTO); + + /** + * @return com.epmet.dto.result.UserBaseInfoResultDTO + * @param userId + * @author yinzuomei + * @description 根据用户id获取用户基本信息 + * @Date 2020/7/24 12:47 + **/ + UserBaseInfoResultDTO queryUserBaseInfo(String userId); + + /** + * @return java.util.List + * @param userIdList + * @author yinzuomei + * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) + * @Date 2020/7/24 12:47 + **/ + List queryUserBaseInfoList(List userIdList); + + /** + * @return java.lang.Boolean + * @param userId + * @author yinzuomei + * @description 根据用户id判断是否志愿者 + * @Date 2020/7/24 12:52 + **/ + Boolean getVolunteerFlag(String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index a1b23bed6b..3644df4f10 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -20,19 +20,23 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ActConstant; import com.epmet.dao.ActInfoDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dao.HeartUserInfoDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.form.resi.*; import com.epmet.dto.result.resi.*; import com.epmet.entity.ActInfoEntity; +import com.epmet.entity.ActUserRelationEntity; import com.epmet.redis.ActInfoRedis; import com.epmet.service.ActInfoService; import com.epmet.service.ActUserRelationService; @@ -42,10 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 活动信息 @@ -62,6 +63,12 @@ public class ActInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -145,6 +152,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl> myActListAuditing(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); List myAct = baseDao.selectListMyActAuditing(formDto); return new Result>().ok(myAct); } @@ -152,6 +161,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl> myActListRefused(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); List myAct = baseDao.selectListActRefused(formDto); return new Result>().ok(myAct); } @@ -159,13 +170,17 @@ public class ActInfoServiceImpl extends BaseServiceImpl> myActListPassed(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); - List myAct = baseDao.selectListActMyHavePassed(formDto); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); + List myAct = baseDao.selectListMyActIHavePassed(formDto); return new Result>().ok(myAct); } @Override public Result> myActListCanceld(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); List myAct = baseDao.selectListMyActCanceld(formDto); return new Result>().ok(myAct); } @@ -184,22 +199,159 @@ public class ActInfoServiceImpl extends BaseServiceImpl> actLookBack(ResiActBaseFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); List lookBackAct = baseDao.selectListLookBackAct(formDTO); return new Result>().ok(lookBackAct); } @Override - public Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO) { - // 判断用户是否已报名该活动 - ActInfoDTO actInfoDTO = baseDao.queryActAccordingToActIdAndUserId(formDTO.getActId(),formDTO.getUserId()); -// if (null == actInfoDTO){ -// throw new RenException(EpmetErrorCode.NO_ACT_TO_CANCEL_SIGN_UP_WERE_FOUND.getCode()); -// } - //1、更新用户活动关系表 -// relationService.update(); - //2、插入用户活动关系日志表 - //3、更新act_info的已报名名额 - return null; + public Result actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + // 从活动表查询活动信息 + ResiActDetailResultDTO detailResultDTO = baseDao.selectActInfoDetail(formDto); + // 获取活动内容 + detailResultDTO.setActContent(baseDao.selectListActContent(formDto.getActId())); + // 查询用户是否是志愿者 + Boolean volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId()); + detailResultDTO.setUserVolunteerFlag(volunteerFlag); + + // 获取用户报名状态 + String currentUserStatus = getCurrentUserStatus(formDto.getActId(), formDto.getUserId()); + detailResultDTO.setCurrentUserStatus(currentUserStatus); + return new Result().ok(detailResultDTO); + } + + /** + * 返回当前活动下,用户状态: + * (sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消) + * + * @param actId 活动id + * @param userId 用户id + * @return java.lang.String + * @Author zhangyong + * @Date 2020/7/22 10:54 + **/ + private String getCurrentUserStatus(String actId, String userId) { + Date currentTime = new Date(); + ActInfoEntity actInfoEntity =baseDao.selectById(actId); + // 活动已取消 + if (ActConstant.CURRENT_STATUS_USER_CANCELED.equals(actInfoEntity.getActStatus())) { + return ActConstant.CURRENT_STATUS_USER_CANCELED; + } + // 活动已经结束 + if (ActConstant.CURRENT_STATUS_USER_FINISHED.equals(actInfoEntity.getActStatus())) { + return ActConstant.CURRENT_STATUS_USER_FINISHED; + } + + // 查询用户是否报名该活动 + QueryWrapper actUserRelationWrapper = new QueryWrapper<>(); + actUserRelationWrapper.eq("ACT_ID", actId) + .eq("USER_ID", userId) + .orderByDesc("CREATED_TIME").last("limit 1"); + ActUserRelationEntity actUserRelationEntity = actUserRelationDao.selectOne(actUserRelationWrapper); + // 查询活动已报名的人数 + Integer signUpNum = actUserRelationDao.selectActSignupNum(actId); + + if (null == actUserRelationEntity) { + return getCurrentUserStatusNotSignUp(actInfoEntity, signUpNum, currentTime); + } else { + return getCurrentUserStatusHasSignUp(actInfoEntity, actUserRelationEntity, signUpNum, currentTime); + } + } + + /** + * 用户未报名活动时,判断用户活动状态 + * + * @param actInfoEntity 当前活动 + * @param signUpNum 活动报名人数 + * @param currentTime 当前时间 + * @return java.lang.String + * @author zhangyong + * @date 2020/7/22 10:54 + */ + private String getCurrentUserStatusNotSignUp(ActInfoEntity actInfoEntity, Integer signUpNum, Date currentTime) { + if (currentTime.before(actInfoEntity.getSignUpEndTime())) { + /*报名结束前*/ + if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) || actInfoEntity.getActQuota() > signUpNum) { + // 我要报名(不限名额或者未报满的) + return ActConstant.CURRENT_STATUS_USER_SIGN_UP; + } else { + // 已报满(限制名额且已经报满的) + return ActConstant.CURRENT_STATUS_USER_ENOUGH; + } + } else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) { + /*报名结束,活动未开始:显示:截止报名*/ + return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP; + } else if (currentTime.after(actInfoEntity.getActStartTime()) && currentTime.before(actInfoEntity.getActEndTime())) { + // 活动开始-结束的时间段内: 显示:已开始 + return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS; + } else { + // 最后,显示:已结束 + return ActConstant.CURRENT_STATUS_USER_FINISHED; + } + } + + /** + * 用户已报名活动时,判断用户活动状态 + * + * @param actInfoEntity 当前活动 + * @param actUserRelationEntity 用户活动关系 + * @param signUpNum 活动报名人数 + * @param currentTime 当前时间 + * @return java.lang.String + * @author zhangyong + * @date 2020/7/22 17:11 + */ + private String getCurrentUserStatusHasSignUp(ActInfoEntity actInfoEntity, ActUserRelationEntity actUserRelationEntity, Integer signUpNum, Date currentTime) { + String actUserStatus = actUserRelationEntity.getStatus(); + + // 已确认过积分,直接返回 + if (ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelationEntity.getRewardFlag()) + || ActConstant.ACT_USER_STATUS_DENY.equals(actUserRelationEntity.getRewardFlag())) { + return ActConstant.CURRENT_STATUS_USER_POINTS_CONFIRM; + } + + if (currentTime.after(actInfoEntity.getActStartTime()) && currentTime.before(actInfoEntity.getActEndTime())) { + /* 活动开始-结束的时间段内 */ + return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS; + } else if (currentTime.before(actInfoEntity.getSignUpEndTime())) { + /* 报名截至时间前 */ + //(未审核、审核通过的)底部显示按钮 取消报名 + if (ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_PASSED.equals(actUserStatus)) { + return ActConstant.ACT_USER_STATUS_CANCELD; + } + // 活动限制名额,且报名人数已满 已报满 + if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) && signUpNum >= actInfoEntity.getActQuota()) { + return ActConstant.CURRENT_STATUS_USER_ENOUGH; + } + // (报名审核未通过或者已经取消报名的)可再次报名-我要报名 + if (ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) { + return ActConstant.CURRENT_STATUS_USER_SIGN_UP; + } + } else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) { + /* 报名截止但 活动未开始 */ + // 已经取消报名的-报名截止 + if (ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) { + return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP; + } + // 已报名审核不通过 -报名截止 + if (ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)) { + return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP; + } + // 已报名且审核通过、未审核 -取消报名 + if (ActConstant.ACT_USER_STATUS_PASSED.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)) { + return ActConstant.ACT_USER_STATUS_CANCELD; + } + } + return ActConstant.CURRENT_STATUS_USER_FINISHED; + } + + @Override + public Result rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + ResiActRefusedDetailResultDTO detail = baseDao.selectActRejectDetail(formDto); + return new Result().ok(detail); } @Override @@ -207,11 +359,15 @@ public class ActInfoServiceImpl extends BaseServiceImpl implements ActLiveRecService { + private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class); @Autowired private ActLiveRecRedis actLiveRecRedis; - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActLiveRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActLiveRecDTO.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; - } + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; - @Override - public ActLiveRecDTO get(String id) { - ActLiveRecEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ActLiveRecDTO.class); - } + @Autowired + private ActLivePicDao actLivePicDao; @Override - @Transactional(rollbackFor = Exception.class) - public void save(ActLiveRecDTO dto) { - ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class); - insert(entity); + public Result liveRecList(Map map) { + if (map.get("actId") == null){ + logger.error("传参中没有活动ID"); + throw new RenException("传参中没有活动ID"); + } + // 数据汇总 + ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO(); + // 查询实况记录 + List actLives = baseDao.selectListActLives(map.get("actId")); + List userIds = new ArrayList<>(); + List liveIds = new ArrayList<>(); + for (ActLiveRecDTO actLive : actLives){ + userIds.add(actLive.getUserId()); + liveIds.add(actLive.getId()); + } + if (actLives.size() > NumConstant.ZERO){ + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + if (userWxInfos.getData().size() > NumConstant.ZERO){ + // 根据活动实况id,查询对应实况的图片集合 + List actLiveImg = baseDao.selectListActLiveImg(liveIds); + + List dataContainer = new ArrayList<>(); + for (int k = 0; k < actLives.size(); k++) { + Map base = new HashMap<>(); + base.put("nickname", userWxInfos.getData().get(k).getNickname()); + base.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl()); + base.put("desc", actLives.get(k).getDesc()); + base.put("createdTime", actLives.get(k).getCreatedTime()); + // 查询打卡对应图片 + List imgUrlList = new ArrayList<>(); + for (ActLivePicDTO urlDto : actLiveImg) { + if (actLives.get(k).getId().equals(urlDto.getLiveId())) { + imgUrlList.add(urlDto.getPicUrl()); + } + } + base.put("images", imgUrlList); + dataContainer.add(base); + } + resultDto.setActLives(dataContainer); + resultDto.setActLiveNum(dataContainer.size()); + } else { + logger.error("未查到用户基础信息"); + throw new RenException("未查到用户基础信息"); + } + } + return new Result().ok(resultDto); } @Override @Transactional(rollbackFor = Exception.class) - public void update(ActLiveRecDTO dto) { - ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class); - updateById(entity); + public Result insertLive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 文本校验 + ValidityVerification verification = new ValidityVerification(); + verification.textScanVerification(formDTO.getDesc(),"添加实况-文本内容审核失败"); + // 图片校验 + verification.imgScanVerification(formDTO.getImages(),"添加实况-图片审核失败"); + + // 存储活动实况记录表 + String uuid = UUID.randomUUID().toString().replaceAll("-",""); + formDTO.setId(uuid); + baseDao.insertActLiveRec(formDTO); + + //存储活动实况图片 + List imgList = formDTO.getImages(); + if (null != imgList){ + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActLivePicEntity actLivePicEntity = new ActLivePicEntity(); + actLivePicEntity.setLiveId(uuid); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actLivePicDao.insert(actLivePicEntity); + } + } + // 发送消息 由积分系统消费消息(需要使用规则) + this.grantActPoints(formDTO); + return new Result().ok(uuid); } - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + private void grantActPoints(ResiActInsertLiveFormDTO formDTO){ + //备注 + String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_VOLUNTEER_LIVE,formDTO.getUserId(),formDTO.getActId()); + MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); + //mq的事件类型 + mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_INSERT_LIVE.getEventClass()); + //事件code + mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_INSERT_LIVE.getEventTag()); + List actPointEventMsgList=new ArrayList<>(); + ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + actPointEventMsg.setCustomerId(formDTO.getCustomerId()); + actPointEventMsg.setUserId(formDTO.getUserId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + actPointEventMsg.setRemark(remark); + actPointEventMsgList.add(actPointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error("添加活动实况,事件发送失败"); + } } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index ac608c807a..c874a61640 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java @@ -17,25 +17,31 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ActConstant; +import com.epmet.dao.ActSignInPicDao; import com.epmet.dao.ActSignInRecDao; +import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; +import com.epmet.entity.ActSignInPicEntity; import com.epmet.entity.ActSignInRecEntity; import com.epmet.redis.ActSignInRecRedis; +import com.epmet.service.ActLiveRecService; import com.epmet.service.ActSignInRecService; -import org.apache.commons.lang3.StringUtils; +import com.epmet.utils.ValidityVerification; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; import java.util.List; -import java.util.Map; +import java.util.UUID; /** * 活动签到记录 @@ -49,56 +55,58 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActSignInRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActSignInRecDTO.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 ActSignInRecDTO get(String id) { - ActSignInRecEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ActSignInRecDTO.class); - } + @Autowired + private ActUserRelationDao actUserRelationDao; - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ActSignInRecDTO dto) { - ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class); - insert(entity); - } + @Autowired + private ActSignInPicDao actSignInPicDao; - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ActSignInRecDTO dto) { - ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class); - updateById(entity); - } + @Autowired + private ActLiveRecService actLiveRecService; @Override @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 文本校验 + ValidityVerification verification = new ValidityVerification(); + verification.textScanVerification(formDTO.getDesc(),"添加签到-文本内容审核失败"); + // 图片校验 + verification.imgScanVerification(formDTO.getImages(),"添加签到-图片审核失败"); + + // 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到 + ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO(); + actUserRelationDTO.setActId(formDTO.getActId()); + actUserRelationDTO.setUserId(formDTO.getUserId()); + actUserRelationDTO.setSignInFlag(ActConstant.ACT_USER_STATUS_SIGNED_IN); + actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO); + + ActSignInRecDTO dto = ConvertUtils.sourceToTarget(formDTO, ActSignInRecDTO.class); + + if (formDTO.getSyncLive() == NumConstant.ONE){ + // 签到内容同步到实况 + ResiActInsertLiveFormDTO liveFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiActInsertLiveFormDTO.class); + Result inSertlive = actLiveRecService.insertLive(tokenDto, liveFormDTO); + //实况id, 当sync_live=1时此列有值 + dto.setLiveId(inSertlive.getData()); + } + // 存储活动签到记录表 + String uuid = UUID.randomUUID().toString().replaceAll("-",""); + dto.setId(uuid); + baseDao.insertActSignInRec(dto); + + //存储活动签到图片 + List imgList = formDTO.getImages(); + if (null != imgList){ + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); + actLivePicEntity.setSignInId(uuid); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actSignInPicDao.insert(actLivePicEntity); + } + } + return new Result(); } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java index 4bb9ad328f..d3f9087afc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java @@ -20,11 +20,15 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.ActSummaryDao; import com.epmet.dto.ActSummaryDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActSummaryResultDTO; import com.epmet.entity.ActSummaryEntity; import com.epmet.redis.ActSummaryRedis; import com.epmet.service.ActSummaryService; @@ -101,4 +105,11 @@ public class ActSummaryServiceImpl extends BaseServiceImpl summaryList(ResiActContentFormDTO formDto) { + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); + return new Result().ok(baseDao.selectListSummary(formDto)); + } + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserLogServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserLogServiceImpl.java index 71311479b3..72cc2395c9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserLogServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserLogServiceImpl.java @@ -101,4 +101,8 @@ public class ActUserLogServiceImpl extends BaseServiceImpl page(Map params) { @@ -140,5 +174,152 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl0 当前用户是志愿者 + Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId()); + if (actInfoDTO.getVolunteerLimit()){ + // 活动只能志愿者参加, 当前用户是否满足条件 + satisfy = this.volunteerParticipationAct(volunteerFlag); + } else { + // 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件 + satisfy = this.resiParticipationAct(formDTO.getUserId()); + } + if (satisfy){ + // 开始报名 + this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag); + } + return new Result(); + } + + /** + * 开始报名活动 + * + * @param actInfoDTO 活动详情 + * @param formDTO 接口请求入参 + * @param volunteerFlag >0 当前用户是志愿者 + * @return void + * @Author zhangyong + * @Date 15:31 2020-07-24 + **/ + private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){ + boolean signUp = true; + Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId()); + if (auditingNum > NumConstant.ZERO){ + // 2.判断本次报名的活动与之前未结束的活动报名时间 是否产生交集,产生则 报名失败 + actInfoDTO.setUserId(formDTO.getUserId()); + Integer actTimeFlag = actInfoService.checkActTime(actInfoDTO); + if (actTimeFlag > NumConstant.ZERO){ + signUp = false; + logger.info("活动报名失败,活动时间冲突"); + throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode()); + } + } else { + // 3.第一次报名 + HeartUserInfoEntity entity = new HeartUserInfoEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setUserId(formDTO.getUserId()); + entity.setVolunteerFlag(volunteerFlag > NumConstant.ZERO); + entity.setKindnessTime(NumConstant.ZERO); + entity.setParticipationNum(NumConstant.ZERO); + entity.setObtainPointNum(NumConstant.ZERO); + heartUserInfoDao.insert(entity); + } + if (signUp){ + // 4.插入活动日志表 + ActUserLogEntity userLogEntity = new ActUserLogEntity(); + userLogEntity.setActId(formDTO.getActId()); + userLogEntity.setUserId(formDTO.getUserId()); + userLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_AUDITING); + actUserLogService.insert(userLogEntity); + } + ActUserRelationEntity entity = new ActUserRelationEntity(); + entity.setActId(formDTO.getActId()); + entity.setUserId(formDTO.getUserId()); + entity.setStatus(ActConstant.ACT_USER_STATUS_AUDITING); + // 审核开关:1报名人员需要人工审核(true) 0不需要(false) + if (actInfoDTO.getAuditSwitch()){ + entity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); + } else { + entity.setPassedType(ActConstant.PASSEDTYPE_AUTO); + entity.setAuditTime(new Date()); + } + Integer operationCount = baseDao.selectCountByActIdAndUserId(formDTO.getActId(), formDTO.getUserId()); + if (operationCount > NumConstant.ZERO){ + // 用户如果不是第一次参加 这次的活动,先删除关系表中的数据,在插入 + baseDao.delSignUpRecord(entity); + } + baseDao.insert(entity); + } + + /** + * 活动报名,限制必须是志愿者身份。当前用户是否符合 + * @param volunteerFlag + * @return boolean + * @Author zhangyong + * @Date 15:04 2020-07-24 + **/ + private boolean volunteerParticipationAct(Integer volunteerFlag){ + boolean satisfy = false; + // 活动只能志愿者参加 + if (volunteerFlag > NumConstant.ZERO){ + satisfy = true; + return satisfy; + } else { + logger.info("活动报名失败,请先认证志愿者"); + throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); + } + } + + /** + * 活动报名,不限制志愿者身份,但要求是 居民身份。当前用户是否符合 + * @param userId + * @return boolean + * @Author zhangyong + * @Date 15:04 2020-07-24 + **/ + private boolean resiParticipationAct(String userId){ + boolean satisfy = false; + // 活动不限制志愿者身份,但要求是 居民身份 + Result> userRoleInfo = epmetUserOpenFeignClient.getUserRoleInfoByUserId(userId); + if (userRoleInfo.success()){ + for (UserRoleResultDTO roleResultDTO :userRoleInfo.getData()){ + if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleResultDTO.getRoleKey())){ + satisfy = true; + } + } + } + if (!satisfy){ + logger.info("活动报名失败,请完善居民信息"); + throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); + } else { + return satisfy; + } + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java new file mode 100644 index 0000000000..ccdab4e19e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java @@ -0,0 +1,288 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.constant.ActConstant; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActInfoDTO; +import com.epmet.dto.ActPointLogDTO; +import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.work.ActIdFormDTO; +import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; +import com.epmet.dto.result.work.PendingUserResultDTO; +import com.epmet.dto.result.work.UserBaseInfo; +import com.epmet.service.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 积分发放 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:27 + */ +@Service +public class GrantPointsServiceImpl implements GrantPointsService { + private Logger logger = LogManager.getLogger(GrantPointsServiceImpl.class); + @Autowired + private ActInfoService actInfoService; + @Autowired + private ActUserRelationDao actUserRelationDao; + @Autowired + private WorkActUserService workActUserService; + @Autowired + private ActUserRelationService actUserRelationService; + @Autowired + private ActPointLogService actPointLogService; + @Autowired + private LoginUserUtil loginUserUtil; + /** + * @param actId + * @return com.epmet.dto.result.work.PendingUserResultDTO + * @author yinzuomei + * @description 积分发放-待处理列表 + * @Date 2020/7/24 12:28 + **/ + @Override + public PendingUserResultDTO queryPendingList(String actId) { + PendingUserResultDTO pendingUserResultDTO = new PendingUserResultDTO(actId); + ActInfoDTO actInfoDTO = actInfoService.get(actId); + if (null == actInfoDTO) { + return pendingUserResultDTO; + } + pendingUserResultDTO.setActId(actId); + pendingUserResultDTO.setReward(actInfoDTO.getReward()); + pendingUserResultDTO.setTitle(actInfoDTO.getTitle()); + //已签到人员列表 + List signedInList = new ArrayList<>(); + //未签到人员列表 + List noSignInList = new ArrayList<>(); + List signedActUserList = actUserRelationDao.selectInProgress(actId); + List userIdList = actUserRelationDao.selectInProgressUserIds(actId); + List userInfoList = workActUserService.queryUserBaseInfoList(userIdList); + for (ActUserRelationDTO actUserRelation : signedActUserList) { + UserBaseInfo userBaseInfo = new UserBaseInfo(); + userBaseInfo.setActUserRelationId(actUserRelation.getId()); + userBaseInfo.setUserId(actUserRelation.getUserId()); + userBaseInfo.setVolunteerFlag(workActUserService.getVolunteerFlag(actUserRelation.getUserId())); + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userInfoList) { + if (actUserRelation.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + userBaseInfo.setRealName(userBaseInfoResultDTO.getRealName()); + userBaseInfo.setNickName(userBaseInfoResultDTO.getNickname()); + userBaseInfo.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + if (ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())) { + //已签到 + signedInList.add(userBaseInfo); + } else { + //未签到 + noSignInList.add(userBaseInfo); + } + } + pendingUserResultDTO.setNoSignInList(noSignInList); + pendingUserResultDTO.setSignedInList(signedInList); + return pendingUserResultDTO; + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 积分发放-给分 + * @Date 2020/7/24 13:34 + **/ + @Override + public void agree(GrantPointsFormDTO formDTO) { + //是否是待处理 + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + if(null==actUserRelationDTO){ + logger.warn("积分发放-给分act_user_relation is null,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //如果是已处理直接返回 + if(ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())){ + logger.info("积分发放-给分act_user_relation already handled,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //查取分值 + ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); + if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { + logger.warn("积分发放-给分act_info is null or act_info is finished"); + return; + } + if(!loginUserUtil.getLoginUserId().equals(actInfoDTO.getCreatedBy())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //更新act_user_relation改为已处理,给分 + actUserRelationDTO.setProcessFlag(ActConstant.HANDLED); + actUserRelationDTO.setRewardFlag(ActConstant.ACT_USER_STATUS_AGREE); + actUserRelationDTO.setDenyRewardReason(StrConstant.EPMETY_STR); + actUserRelationService.update(actUserRelationDTO); + //增加一条act_point_log + ActPointLogDTO actPointLogDTO=new ActPointLogDTO(); + actPointLogDTO.setActId(actUserRelationDTO.getActId()); + actPointLogDTO.setUserId(actUserRelationDTO.getUserId()); + actPointLogDTO.setPoints(actInfoDTO.getReward()); + actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_AGREE); + actPointLogDTO.setRemark(StrConstant.EPMETY_STR); + actPointLogService.save(actPointLogDTO); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 积分发放-不给分 + * @Date 2020/7/24 15:03 + **/ + @Override + public void deny(GrantPointsFormDTO formDTO) { + //是否是待处理 + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + if(null==actUserRelationDTO){ + logger.warn("积分发放-不给分act_user_relation is null,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //如果是已处理直接返回 + if(ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())){ + logger.info("积分发放-不给分act_user_relation already handled,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //查取分值 + ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); + if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { + logger.warn("积分发放-不给分act_info is null or act_info is finished"); + return; + } + if(!loginUserUtil.getLoginUserId().equals(actInfoDTO.getCreatedBy())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //更新act_user_relation改为已处理,给分 + actUserRelationDTO.setProcessFlag(ActConstant.HANDLED); + actUserRelationDTO.setRewardFlag(ActConstant.ACT_USER_STATUS_DENY); + actUserRelationDTO.setDenyRewardReason(formDTO.getDenyRewardReason()); + actUserRelationService.update(actUserRelationDTO); + //增加一条act_point_log + ActPointLogDTO actPointLogDTO=new ActPointLogDTO(); + actPointLogDTO.setActId(actUserRelationDTO.getActId()); + actPointLogDTO.setUserId(actUserRelationDTO.getUserId()); + actPointLogDTO.setPoints(actInfoDTO.getReward()); + actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_DENY); + actPointLogDTO.setRemark(formDTO.getDenyRewardReason()); + actPointLogService.save(actPointLogDTO); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 积分发放-重新处理 + * @Date 2020/7/24 15:16 + **/ + @Override + public void reset(GrantPointsFormDTO formDTO) { + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + if(null==actUserRelationDTO){ + logger.warn("积分发放-重新处理act_user_relation is null,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //查取分值 + ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); + if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { + logger.warn("积分发放-重新处理act_info is null or act_info is finished"); + return; + } + if(!loginUserUtil.getLoginUserId().equals(actInfoDTO.getCreatedBy())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //更新act_user_relation改为未处理 初始状态 + actUserRelationDTO.setProcessFlag(StrConstant.EPMETY_STR); + actUserRelationDTO.setRewardFlag(StrConstant.EPMETY_STR); + actUserRelationDTO.setDenyRewardReason(StrConstant.EPMETY_STR); + actUserRelationService.update(actUserRelationDTO); + //增加一条act_point_log + ActPointLogDTO actPointLogDTO=new ActPointLogDTO(); + actPointLogDTO.setActId(actUserRelationDTO.getActId()); + actPointLogDTO.setUserId(actUserRelationDTO.getUserId()); + actPointLogDTO.setPoints(actInfoDTO.getReward()); + actPointLogDTO.setOperateType(ActConstant.RESET); + actPointLogDTO.setRemark(StrConstant.EPMETY_STR); + actPointLogService.save(actPointLogDTO); + } + + /** + * @param actIdFormDTO + * @return java.util.List + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:47 + **/ + @Override + public List agreedList(ActIdFormDTO actIdFormDTO) { + List list = actUserRelationDao.selectAgreedList(actIdFormDTO.getActId()); + if (null == list || list.size() < 0) { + return new ArrayList<>(); + } + List userIdList = new ArrayList<>(); + for (ObtainedUserResultDTO obtainedUserResultDTO : list) { + obtainedUserResultDTO.setVolunteerFlag(workActUserService.getVolunteerFlag(obtainedUserResultDTO.getUserId())); + userIdList.add(obtainedUserResultDTO.getUserId()); + } + List userBaseInfoResultDTOList = workActUserService.queryUserBaseInfoList(userIdList); + for (ObtainedUserResultDTO obtainedUser : list) { + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userBaseInfoResultDTOList) { + if (obtainedUser.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + obtainedUser.setRealName(userBaseInfoResultDTO.getRealName()); + obtainedUser.setNickName(userBaseInfoResultDTO.getNickname()); + obtainedUser.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + } + return list; + } + + /** + * @param actIdFormDTO + * @return java.util.List + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + @Override + public List deniedList(ActIdFormDTO actIdFormDTO) { + List list = actUserRelationDao.selectDeniedList(actIdFormDTO.getActId()); + if (null == list || list.size() < 0) { + return new ArrayList<>(); + } + List userIdList = new ArrayList<>(); + for (DeniedUserResultDTO deniedUserResultDTO : list) { + deniedUserResultDTO.setVolunteerFlag(workActUserService.getVolunteerFlag(deniedUserResultDTO.getUserId())); + userIdList.add(deniedUserResultDTO.getUserId()); + } + List userBaseInfoResultDTOList = workActUserService.queryUserBaseInfoList(userIdList); + for (DeniedUserResultDTO deniedUser : list) { + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userBaseInfoResultDTOList) { + if (deniedUser.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + deniedUser.setRealName(userBaseInfoResultDTO.getRealName()); + deniedUser.setNickName(userBaseInfoResultDTO.getNickname()); + deniedUser.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + } + return list; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java index 3b7aa9f2c9..a8d0dfacfe 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java @@ -20,19 +20,29 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.HeartUserInfoDao; import com.epmet.dto.HeartUserInfoDTO; +import com.epmet.dto.form.resi.ResiActBaseFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.resi.ResiLeaderboardResultDTO; import com.epmet.entity.HeartUserInfoEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.HeartUserInfoRedis; import com.epmet.service.HeartUserInfoService; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -45,9 +55,11 @@ import java.util.Map; */ @Service public class HeartUserInfoServiceImpl extends BaseServiceImpl implements HeartUserInfoService { - + private Logger logger = LogManager.getLogger(HeartUserInfoServiceImpl.class); @Autowired private HeartUserInfoRedis heartUserInfoRedis; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override public PageData page(Map params) { @@ -113,4 +125,44 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl> leaderboard(ResiActBaseFormDTO formDTO) { + List resultDTOS = new ArrayList<>(); + // 获取排好序的 排行榜 + List leaderboardList = baseDao.selectListLeaderboard(formDTO); + if (leaderboardList.size() > NumConstant.ZERO){ + // 根据用户ID获取微信昵称、头像 + List userIds = new ArrayList<>(); + for (HeartUserInfoDTO list : leaderboardList){ + userIds.add(list.getUserId()); + } + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + if (userWxInfos.success() && userWxInfos.getData().size() > NumConstant.ZERO){ + for (HeartUserInfoDTO list : leaderboardList){ + ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO(); + dto.setKindnessTime(list.getKindnessTime()); + dto.setVolunteerFlag(list.getVolunteerFlag()); + dto.setParticipationNum(list.getParticipationNum()); + List wxInfo = userWxInfos.getData(); + for (UserBaseInfoResultDTO wx : wxInfo){ + if (list.getUserId().equals(wx.getUserId())){ + dto.setHeadImg(wx.getHeadImgUrl()); + dto.setNickname(wx.getNickname()); + } + } + resultDTOS.add(dto); + } + } else { + logger.info("查询用户基本信息接口返回失败"); + throw new RenException("查询用户基本信息失败"); + } + } + return new Result>().ok(resultDTOS); + } + + @Override + public void updateHeartUserInfoByUserId(HeartUserInfoDTO dto) { + baseDao.updateHeartUserInfoByUserId(dto); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java index e60c7d539e..9d73f7866a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java @@ -93,7 +93,7 @@ public class LatestActContentServiceImpl extends BaseServiceImpl dtoList) { //先删除之前的 - this.deleteByActId(dtoList.get(0).getActId()); + baseDao.deleteByActId(dtoList.get(0).getActId()); //再插入新的 for(LatestActContentDTO dto:dtoList){ LatestActContentEntity entity = ConvertUtils.sourceToTarget(dto, LatestActContentEntity.class); @@ -124,6 +124,7 @@ public class LatestActContentServiceImpl extends BaseServiceImpl implements LatestActInfoService { - + private Logger logger = LogManager.getLogger(LatestActInfoServiceImpl.class); @Autowired private LatestActInfoRedis latestActInfoRedis; @Autowired @@ -96,13 +97,16 @@ public class LatestActInfoServiceImpl extends BaseServiceImpl implements VolunteerInfoService { + private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class); @Autowired private VolunteerInfoRedis volunteerInfoRedis; - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, VolunteerInfoDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.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 VolunteerInfoDTO get(String id) { - VolunteerInfoEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, VolunteerInfoDTO.class); - } + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; - @Override - @Transactional(rollbackFor = Exception.class) - public void save(VolunteerInfoDTO dto) { - VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); - insert(entity); - } + @Autowired + private HeartUserInfoService heartUserInfoService; @Override @Transactional(rollbackFor = Exception.class) - public void update(VolunteerInfoDTO dto) { - VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); - updateById(entity); + public Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 检查是否是志愿者 + Integer volunteerFlag = baseDao.queryVolunteerFlagByUserId(tokenDto.getUserId()); + VolunteerInfoEntity volunteerInfoEntity = ConvertUtils.sourceToTarget(formDTO, VolunteerInfoEntity.class); + if (volunteerFlag > NumConstant.ZERO){ + // 是志愿者:更新志愿者信息表 + baseDao.updateVolunteerInfoByUserId(volunteerInfoEntity); + } else { + // 不是志愿者:插入志愿者信息表 + baseDao.insert(volunteerInfoEntity); + + // 更新用户信息表的 是否是志愿者标识 + HeartUserInfoDTO userInfoDTO = new HeartUserInfoDTO(); + userInfoDTO.setUserId(tokenDto.getUserId()); + userInfoDTO.setVolunteerFlag(true); + heartUserInfoService.updateHeartUserInfoByUserId(userInfoDTO); + + // 发送消息 由积分系统消费消息(需要使用规则) + this.grantActPoints(formDTO); + } + // 更新用户基础信息表 并 更新用户微信表 + WxUserInfoFormDTO wxUserInfoFormDTO = ConvertUtils.sourceToTarget(formDTO, WxUserInfoFormDTO.class); + return epmetUserOpenFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO); } - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + private void grantActPoints(ResiVolunteerAuthenticateFormDTO formDTO){ + //备注 + String remark=String.format(ActMessageConstant.POINTS_EVENT_VOLUNTEER_AUTHENTICATE,formDTO.getUserId()); + MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); + //mq的事件类型 + mqBaseMsgDTO.setEventClass(EventEnum.REGISTER_VOLUNTEER.getEventClass()); + //事件code + mqBaseMsgDTO.setEventTag(EventEnum.REGISTER_VOLUNTEER.getEventTag()); + List actPointEventMsgList=new ArrayList<>(); + ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + actPointEventMsg.setCustomerId(formDTO.getCustomerId()); + actPointEventMsg.setUserId(formDTO.getUserId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + actPointEventMsg.setRemark(remark); + actPointEventMsgList.add(actPointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error("志愿者认证事件发送失败"); + } } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java index 1c75dfdb57..a1b008430e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java @@ -1,31 +1,13 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.scan.param.ImgScanParamDTO; -import com.epmet.commons.tools.scan.param.ImgTaskDTO; -import com.epmet.commons.tools.scan.param.TextScanParamDTO; -import com.epmet.commons.tools.scan.param.TextTaskDTO; -import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.ScanContentUtils; -import com.epmet.constant.ActConstant; -import com.epmet.dao.ActContentDao; -import com.epmet.dao.ActInfoDao; -import com.epmet.dao.ActOperationRecDao; -import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.LatestActContentDTO; import com.epmet.dto.LatestActInfoDTO; -import com.epmet.dto.form.work.*; +import com.epmet.dto.form.work.ActPreviewFormDTO; +import com.epmet.dto.form.work.DraftActContentFormDTO; +import com.epmet.dto.form.work.DraftActInfoFormDTO; import com.epmet.dto.result.work.*; -import com.epmet.entity.ActContentEntity; -import com.epmet.entity.ActInfoEntity; -import com.epmet.entity.ActOperationRecEntity; -import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.LatestActContentService; import com.epmet.service.LatestActInfoService; import com.epmet.service.WorkActDraftService; @@ -33,14 +15,11 @@ import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.UUID; /** * 工作端活动草稿 @@ -57,20 +36,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { private LatestActInfoService latestActInfoService; @Autowired private LatestActContentService latestActContentService; - @Value("${openapi.scan.server.url}") - private String scanApiUrl; - @Value("${openapi.scan.method.textSyncScan}") - private String textSyncScanMethod; - @Value("${openapi.scan.method.imgSyncScan}") - private String imgSyncScanMethod; - @Autowired - private ActInfoDao actInfoDao; - @Autowired - private ActContentDao actContentDao; - @Autowired - private ActOperationRecDao actOperationRecDao; - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; /** * @return com.epmet.dto.form.work.PublishActInitResultDTO @@ -96,19 +61,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { return resultDTO; } - /** - * @return void - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - @Override - public void deleteDraft() { - String currentUserId=loginUserUtil.getLoginUserId(); - if(StringUtils.isNotBlank(currentUserId)){ - latestActInfoService.deleteAllDraft(currentUserId); - } - } /** * @return com.epmet.dto.result.work.LatestDraftActInfoResultDTO @@ -148,7 +100,7 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { if(null!=formDTO.getActContent()&&formDTO.getActContent().size()>0){ //保存活动内容 List actContentList=this.constructLatestActContent(formDTO.getActContent(),actDraftId); - //删除之前的内容 + //删除之前的内容,保存本次的修改 物理删除 latestActContentService.saveLatestActContentDTOList(actContentList); } SaveActDraftResultDTO resultDTO=new SaveActDraftResultDTO(); @@ -175,266 +127,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { return actPreviewResultDTO; } - /** - * @param formDTO - * @return com.epmet.dto.result.work.PublishActResultDTO - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:33 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { - PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); - //内容审核(活动标题、招募要求、活动内容图文) - this.auditAct(formDTO); - logger.info("发布活动,审核成功"); - - //构造属性保存活动属性,活动内容 - ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); - actInfoDao.insert(actInfoEntity); - - List actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); - for(ActContentEntity actContentEntity:actContentEntityList){ - actContentDao.insert(actContentEntity); - } - //插入一条操作日志 - ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); - actOperationRecEntity.setActId(actInfoEntity.getId()); - actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH); - actOperationRecEntity.setNoticeUser(false); - actOperationRecDao.insert(actOperationRecEntity); - - //删除所有的草稿 - this.deleteDraft(); - publishActResultDTO.setActId(actInfoEntity.getId()); - - return publishActResultDTO; - } - - /** - * @return com.epmet.entity.ActInfoEntity - * @param formDTO - * @author yinzuomei - * @description 发布活动-构造act_info - * @Date 2020/7/21 20:00 - **/ - private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { - ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); - //活动名额类型(0-不限名额,1-固定名额) - if(actInfoEntity.getActQuota()==0){ - actInfoEntity.setActQuotaCategory(false); - }else{ - actInfoEntity.setActQuotaCategory(true); - } - actInfoEntity.setSignUpStartTime(new Date()); - actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); - - //1已经总结0未总结 - actInfoEntity.setSummaryFlag(false); - if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ - //调用gov_org服务获取当前组织的上一级机关id TODO - Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); - if(result.success()&&null!=result.getData()){ - actInfoEntity.setPid(result.getData().getPid()); - }else{ - logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); - } - }else{ - actInfoEntity.setPid(""); - } - return actInfoEntity; - } - - /** - * @return java.util.List - * @param actContent - * @param actId - * @author yinzuomei - * @description 发布活动-构造活动详情act_content - * @Date 2020/7/21 19:59 - **/ - private List constructActContent(List actContent, String actId) { - List list=new ArrayList<>(); - int orderNum=1; - for(PublishActContentFormDTO actContentFormDTO:actContent){ - ActContentEntity actContentEntity=new ActContentEntity(); - actContentEntity.setActId(actId); - actContentEntity.setContent(actContentFormDTO.getContent()); - actContentEntity.setContentType(actContentFormDTO.getContentType()); - actContentEntity.setOrderNum(orderNum); - list.add(actContentEntity); - orderNum++; - } - return list; - } - - /** - * @return void - * @param formDTO - * @author yinzuomei - * @description 活动相关内容审核(活动标题、招募要求、活动内容图文) - * @Date 2020/7/21 19:20 - **/ - private void auditAct(PublishActInfoFormDTO formDTO) { - //1、活动标题 - if (StringUtils.isNotBlank(formDTO.getTitle())) { - this.auditActTitle(formDTO.getTitle()); - } - //2、活动封面 - if(StringUtils.isNotBlank(formDTO.getCoverPic())){ - this.auditActCoverPic(formDTO.getCoverPic()); - } - - //3、招募要求 - if (StringUtils.isNotBlank(formDTO.getRequirement())) { - this.auditActRequirement(formDTO.getRequirement()); - } - //4、活动内容 - if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ - return; - } - List textList=new ArrayList<>(); - List imgList=new ArrayList<>(); - for(PublishActContentFormDTO actContent:formDTO.getActContent()){ - if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ - textList.add(actContent.getContent()); - }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ - imgList.add(actContent.getContent()); - } - } - this.auditActContent(textList,imgList); - } - - /** - * @return void - * @param textList - * @param imgList - * @author yinzuomei - * @description 活动详情审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActContent(List textList, List imgList) { - //审核活动详情中的内容 - if(null!=textList&&textList.size()>0){ - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - textList.forEach(content -> { - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setContent(content); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - }); - Result contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!contentSyncScanRes.success()) { - logger.error("活动详情内容审核接口失败,返参:", JSON.toJSONString(contentSyncScanRes)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!contentSyncScanRes.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); - } - } - logger.info("活动详情内容审核成功"); - } - if(null!=imgList&&imgList.size()>0){ - //审核活动详情中的图片 - ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); - imgList.forEach(url -> { - ImgTaskDTO task = new ImgTaskDTO(); - task.setDataId(UUID.randomUUID().toString().replace("-", "")); - task.setUrl(url); - imgScanParamDTO.getTasks().add(task); - }); - Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); - if (!imgScanResult.success()){ - logger.error("活动详情图片审核接口失败,返参:", JSON.toJSONString(imgScanResult)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!imgScanResult.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.ACT_CONTENT_IMG_SCAN_FAILED.getCode()); - } - } - logger.info("活动详情图片审核成功"); - } - } - - /** - * @return void - * @param requirement - * @author yinzuomei - * @description 活动招募条件审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActRequirement(String requirement) { - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setContent(requirement); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!textSyncScanResult.success()) { - logger.error("活动报名条件审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - logger.error("活动报名条件审核失败,报名条件:",requirement); - throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); - } - } - logger.info("活动报名条件审核成功"); - } - - /** - * @return void - * @param coverPic - * @author yinzuomei - * @description 活动封面图片审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActCoverPic(String coverPic) { - ImgScanParamDTO coverPicScanParamDTO = new ImgScanParamDTO(); - ImgTaskDTO coverImgtask = new ImgTaskDTO(); - coverImgtask.setDataId(UUID.randomUUID().toString().replace("-", "")); - coverImgtask.setUrl(coverPic); - coverPicScanParamDTO.getTasks().add(coverImgtask); - Result coverPicScanRes = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), coverPicScanParamDTO); - if (!coverPicScanRes.success()){ - logger.error("活动封面审核失败接口返回失败,返参:",JSON.toJSONString(coverPicScanRes)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!coverPicScanRes.getData().isAllPass()) { - logger.error("活动封面审核失败,封面图片地址:",coverPic); - throw new RenException(EpmetErrorCode.ACT_COVER_PIC_SCAN_FAILED.getCode()); - } - } - logger.info("活动封面审核成功"); - } - - /** - * @return void - * @param title - * @author yinzuomei - * @description 活动标题审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActTitle(String title) { - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setContent(title); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!textSyncScanResult.success()) { - logger.error("活动标题审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - logger.error("活动标题审核失败,标题内容:",title); - throw new RenException(EpmetErrorCode.ACT_TITLE_SCAN_FAILED.getCode()); - } - } - logger.info("活动标题审核通过"); - } - /** * @return java.util.List * @param actContent diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java new file mode 100644 index 0000000000..0a78b35470 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -0,0 +1,1019 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.MqConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.*; +import com.epmet.constant.ActConstant; +import com.epmet.constant.ActMessageConstant; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.dao.*; +import com.epmet.dto.*; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.dto.form.work.*; +import com.epmet.dto.result.ActSponsorResultDTO; +import com.epmet.dto.result.work.*; +import com.epmet.entity.*; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.*; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:37 + */ +@Service +public class WorkActServiceImpl implements WorkActService { + private Logger logger = LogManager.getLogger(WorkActServiceImpl.class); + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private LoginUserUtil loginUserUtil; + @Autowired + private ActInfoDao actInfoDao; + @Autowired + private LatestActInfoService latestActInfoService; + @Autowired + private ActContentDao actContentDao; + @Autowired + private ActOperationRecDao actOperationRecDao; + @Autowired + private ActInfoService actInfoService; + @Autowired + private ActUserRelationDao actUserRelationDao; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private ActStatisticalService actStatisticalService; + @Autowired + private ActUserRelationService actUserRelationService; + @Autowired + private HeartUserInfoDao heartUserInfoDao; + @Autowired + private HeartUserInfoService heartUserInfoService; + @Autowired + private ActSummaryDao actSummaryDao; + + /** + * @return void + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + @Override + public void deleteDraft() { + String currentUserId=loginUserUtil.getLoginUserId(); + if(StringUtils.isNotBlank(currentUserId)){ + latestActInfoService.deleteAllDraft(currentUserId); + } + } + + /** + * @return com.epmet.dto.result.work.SponsorResultDTO + * @author yinzuomei + * @description 活动主办方 + * @Date 2020/7/23 20:37 + **/ + @Override + public SponsorResultDTO querySponsorList() { + String staffId=loginUserUtil.getLoginUserId(); + if(StringUtils.isNotBlank(staffId)){ + Result result=govOrgOpenFeignClient.querySponsorList(staffId); + if(result.success()&&null!=result.getData()){ + SponsorResultDTO sponsorResultDTO=new SponsorResultDTO(); + sponsorResultDTO.setAgencyId(result.getData().getAgencyId()); + sponsorResultDTO.setAgencyName(result.getData().getAgencyName()); + sponsorResultDTO.setAgencyGridList(ConvertUtils.sourceToTarget(result.getData().getAgencyGridList(), Grid.class)); + return sponsorResultDTO; + } + } + logger.error("当前用户id获取为空"); + return null; + } + + /** + * @param formDTO + * @return com.epmet.dto.result.work.PublishActResultDTO + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:33 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { + //构造属性保存活动属性,活动内容 + ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); + //校验参数 + this.checkPublishFormDTO(actInfoEntity); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditAct(formDTO); + logger.info("发布活动,审核成功"); + + actInfoDao.insert(actInfoEntity); + + List actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(actInfoEntity.getId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH); + actOperationRecEntity.setNoticeUser(false); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(actInfoEntity.getId()); + + return publishActResultDTO; + } + + /** + * @return void + * @param actInfoEntity + * @author yinzuomei + * @description 第一次发布 + * @Date 2020/7/24 16:45 + **/ + private void checkPublishFormDTO(ActInfoEntity actInfoEntity) { + //1、活动预计开始时间、活动预计结束时间 + if(actInfoEntity.getActStartTime().compareTo(actInfoEntity.getActEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); + } + //2、签到开始时间、签到结束时间 + if(actInfoEntity.getSignInStartTime().compareTo(actInfoEntity.getSignInEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); + } + int n=actInfoEntity.getSignUpEndTime().compareTo(actInfoEntity.getActStartTime()); + //3、报名截止时间(应该在活动预计开始时间之前) + if(n!=-1){ + throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); + } + } + + public static void main(String[] args) { + SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + try { + Date yesterDate=format.parse("2020-07-26 13:00:00"); + Date today=format.parse("2020-07-27 13:00:00"); + Date tommorrow=format.parse("2020-07-28 13:00:00"); + Date today1=format.parse("2020-07-27 13:00:00"); + System.out.println(yesterDate.compareTo(today)); + System.out.println(tommorrow.compareTo(today)); + System.out.println(today.compareTo(today1)); + } catch (ParseException e) { + e.printStackTrace(); + } + + } + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 活动相关内容审核(活动标题、招募要求、活动内容图文) + * @Date 2020/7/21 19:20 + **/ + private void auditAct(PublishActInfoFormDTO formDTO) { + //1、活动标题 + if (StringUtils.isNotBlank(formDTO.getTitle())) { + this.auditActTitle(formDTO.getTitle()); + } + //2、活动封面 + if(StringUtils.isNotBlank(formDTO.getCoverPic())){ + this.auditActCoverPic(formDTO.getCoverPic()); + } + + //3、招募要求 + if (StringUtils.isNotBlank(formDTO.getRequirement())) { + this.auditActRequirement(formDTO.getRequirement()); + } + //4、活动内容 + if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ + return; + } + List textList=new ArrayList<>(); + List imgList=new ArrayList<>(); + for(PublishActContentFormDTO actContent:formDTO.getActContent()){ + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ + textList.add(actContent.getContent()); + }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ + imgList.add(actContent.getContent()); + } + } + this.auditActContent(textList,imgList); + } + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 重新发布活动,内容审核 + * @Date 2020/7/27 14:01 + **/ + private void auditRePublishAct(RePublishFormDTO formDTO) { + //1、活动标题 + if (StringUtils.isNotBlank(formDTO.getTitle())) { + this.auditActTitle(formDTO.getTitle()); + } + //2、活动封面 + if(StringUtils.isNotBlank(formDTO.getCoverPic())){ + this.auditActCoverPic(formDTO.getCoverPic()); + } + + //3、招募要求 + if (StringUtils.isNotBlank(formDTO.getRequirement())) { + this.auditActRequirement(formDTO.getRequirement()); + } + //4、活动内容 + if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ + return; + } + List textList=new ArrayList<>(); + List imgList=new ArrayList<>(); + for(PublishActContentFormDTO actContent:formDTO.getActContent()){ + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ + textList.add(actContent.getContent()); + }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ + imgList.add(actContent.getContent()); + } + } + this.auditActContent(textList,imgList); + } + + /** + * @return com.epmet.entity.ActInfoEntity + * @param formDTO + * @author yinzuomei + * @description 发布活动-构造act_info + * @Date 2020/7/21 20:00 + **/ + private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { + ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); + //报名开始、报名截止、活动预计开始、活动预计截止、签到开始、签到截止 + actInfoEntity.setSignUpEndTime(DateUtils.minStrToSecondDate(formDTO.getSignUpEndTime())); + actInfoEntity.setSignInStartTime(DateUtils.minStrToSecondDate(formDTO.getSignInStartTime())); + actInfoEntity.setSignInEndTime(DateUtils.minStrToSecondDate(formDTO.getSignInEndTime())); + actInfoEntity.setActStartTime(DateUtils.minStrToSecondDate(formDTO.getActStartTime())); + actInfoEntity.setActEndTime(DateUtils.minStrToSecondDate(formDTO.getActEndTime())); + //活动名额类型(0-不限名额,1-固定名额) + if(actInfoEntity.getActQuota()==0){ + actInfoEntity.setActQuotaCategory(false); + }else{ + actInfoEntity.setActQuotaCategory(true); + } + Date nowDate=new Date(); + actInfoEntity.setSignUpStartTime(nowDate); + actInfoEntity.setCreatedTime(nowDate); + actInfoEntity.setUpdatedTime(nowDate); + actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); + + //1已经总结0未总结 + actInfoEntity.setSummaryFlag(false); + if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ + //调用gov_org服务获取当前组织的上一级机关id + Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); + if(result.success()&&null!=result.getData()){ + actInfoEntity.setPid(result.getData().getPid()); + }else{ + logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); + } + }else{ + actInfoEntity.setPid(StrConstant.EPMETY_STR); + } + return actInfoEntity; + } + + /** + * @return com.epmet.entity.ActInfoEntity + * @param formDTO + * @author yinzuomei + * @description 重新发布=构造act_info + * @Date 2020/7/27 14:02 + **/ + private ActInfoEntity constructRePublishActInfo(RePublishFormDTO formDTO) { + ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); + //报名开始、报名截止、活动预计开始、活动预计截止、签到开始、签到截止 + actInfoEntity.setSignUpEndTime(DateUtils.minStrToSecondDate(formDTO.getSignUpEndTime())); + actInfoEntity.setSignInStartTime(DateUtils.minStrToSecondDate(formDTO.getSignInStartTime())); + actInfoEntity.setSignInEndTime(DateUtils.minStrToSecondDate(formDTO.getSignInEndTime())); + actInfoEntity.setActStartTime(DateUtils.minStrToSecondDate(formDTO.getActStartTime())); + actInfoEntity.setActEndTime(DateUtils.minStrToSecondDate(formDTO.getActEndTime())); + //活动名额类型(0-不限名额,1-固定名额) + if(actInfoEntity.getActQuota()==0){ + actInfoEntity.setActQuotaCategory(false); + }else{ + actInfoEntity.setActQuotaCategory(true); + } + Date nowDate=new Date(); + actInfoEntity.setSignUpStartTime(nowDate); + actInfoEntity.setCreatedTime(nowDate); + actInfoEntity.setUpdatedTime(nowDate); + actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); + + //1已经总结0未总结 + actInfoEntity.setSummaryFlag(false); + if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ + //调用gov_org服务获取当前组织的上一级机关id + Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); + if(result.success()&&null!=result.getData()){ + actInfoEntity.setPid(result.getData().getPid()); + }else{ + logger.warn("重新发布活动,根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); + } + }else{ + actInfoEntity.setPid(StrConstant.EPMETY_STR); + } + return actInfoEntity; + } + + /** + * @return java.util.List + * @param actContent + * @param actId + * @author yinzuomei + * @description 发布活动-构造活动详情act_content + * @Date 2020/7/21 19:59 + **/ + private List constructActContent(List actContent, String actId) { + List list=new ArrayList<>(); + int orderNum=1; + for(PublishActContentFormDTO actContentFormDTO:actContent){ + ActContentEntity actContentEntity=new ActContentEntity(); + actContentEntity.setActId(actId); + actContentEntity.setContent(actContentFormDTO.getContent()); + actContentEntity.setContentType(actContentFormDTO.getContentType()); + actContentEntity.setOrderNum(orderNum); + list.add(actContentEntity); + orderNum++; + } + return list; + } + + /** + * @return void + * @param textList + * @param imgList + * @author yinzuomei + * @description 活动详情审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActContent(List textList, List imgList) { + //审核活动详情中的内容 + if(null!=textList&&textList.size()>0){ + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + textList.forEach(content -> { + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(content); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + }); + Result contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!contentSyncScanRes.success()) { + logger.error("活动详情内容审核接口失败,返参:", JSON.toJSONString(contentSyncScanRes)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!contentSyncScanRes.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); + } + } + logger.info("活动详情内容审核成功"); + } + if(null!=imgList&&imgList.size()>0){ + //审核活动详情中的图片 + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + imgList.forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(url); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + logger.error("活动详情图片审核接口失败,返参:", JSON.toJSONString(imgScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.ACT_CONTENT_IMG_SCAN_FAILED.getCode()); + } + } + logger.info("活动详情图片审核成功"); + } + } + + /** + * @return void + * @param requirement + * @author yinzuomei + * @description 活动招募条件审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActRequirement(String requirement) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(requirement); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("活动报名条件审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error("活动报名条件审核失败,报名条件:",requirement); + throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); + } + } + logger.info("活动报名条件审核成功"); + } + + /** + * @return void + * @param coverPic + * @author yinzuomei + * @description 活动封面图片审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActCoverPic(String coverPic) { + ImgScanParamDTO coverPicScanParamDTO = new ImgScanParamDTO(); + ImgTaskDTO coverImgtask = new ImgTaskDTO(); + coverImgtask.setDataId(UUID.randomUUID().toString().replace("-", "")); + coverImgtask.setUrl(coverPic); + coverPicScanParamDTO.getTasks().add(coverImgtask); + Result coverPicScanRes = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), coverPicScanParamDTO); + if (!coverPicScanRes.success()){ + logger.error("活动封面审核失败接口返回失败,返参:", JSON.toJSONString(coverPicScanRes)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!coverPicScanRes.getData().isAllPass()) { + logger.error("活动封面审核失败,封面图片地址:",coverPic); + throw new RenException(EpmetErrorCode.ACT_COVER_PIC_SCAN_FAILED.getCode()); + } + } + logger.info("活动封面审核成功"); + } + + /** + * @return void + * @param title + * @author yinzuomei + * @description 活动标题审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActTitle(String title) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(title); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("活动标题审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error("活动标题审核失败,标题内容:",title); + throw new RenException(EpmetErrorCode.ACT_TITLE_SCAN_FAILED.getCode()); + } + } + logger.info("活动标题审核通过"); + } + + /** + * @param formDTO + * @return com.epmet.dto.result.work.InProgressActResultDTO + * @author yinzuomei + * @description 进行中活动列表 + * @Date 2020/7/23 21:24 + **/ + @Override + public List queryInProgressList(ActListCommonFormDTO formDTO) { + List list = actInfoDao.selectInprogress(formDTO.getCustomerId()); + Date nowDate = new Date(); + for (InProgressActResultDTO inProgressActResultDTO : list) { +// 活动状态:报名中:signing_up;截止报名: end_sign_up; 已开始: in_progress; 已报满: enough + if (nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == -1 + || nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == 0) { + //截止报名时间之前(包含报名时间截止时间点) + if (!inProgressActResultDTO.getActQuotaCategory()) { + //如果是不限制名额,则显示报名中 + inProgressActResultDTO.setStatus("signing_up"); + continue; + } else { + //固定名额,且已报名人数<活动需要人数显示报名中 + if (inProgressActResultDTO.getActQuota() > inProgressActResultDTO.getSignedUp()) { + inProgressActResultDTO.setStatus("signing_up"); + continue; + } else if (inProgressActResultDTO.getActQuota().equals(inProgressActResultDTO.getSignedUp())) { + inProgressActResultDTO.setStatus("enough"); + continue; + } + } + } else if (nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == 1 + || nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == -1) { + //活动报名截止-活动预计开始之间显示截止报名 + inProgressActResultDTO.setStatus("end_sign_up"); + continue; + } else if (nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == 1 + || nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == 0) { + //活动预计开始时间点之后,包含活动预计开始时间点,显示 已开始 + inProgressActResultDTO.setStatus("in_progress"); + continue; + } + } + return list; + } + + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:11 + **/ + @Override + public List queryCanceledList(ActListCommonFormDTO formDTO) { + return actInfoDao.selectCanceledList(formDTO.getCustomerId()); + } + + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + @Override + public List queryFinishedList(ActListCommonFormDTO formDTO) { + return actInfoDao.selectFinishedList(formDTO.getCustomerId()); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + @Override + public void cancelAct(CancelActFormDTO formDTO) { + ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); + if(null==actInfoDTO){ + logger.error("act_info is null"); + return ; + } + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //插入取消活动操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(formDTO.getActId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_CANCEL); + actOperationRecEntity.setNoticeUser(true); + actOperationRecEntity.setRemark(formDTO.getCancelReason()); + actOperationRecDao.insert(actOperationRecEntity); + //更新活动标识,改为已取消 + actInfoDTO.setCancelReason(formDTO.getCancelReason()); + actInfoDTO.setCancelTime(actOperationRecEntity.getCreatedTime()); + actInfoDTO.setActStatus(ActConstant.ACT_STATUS_CANCELED); + actInfoService.update(actInfoDTO); + //查询已经通过审核的用户,发送消息 + List userIdList=actUserRelationDao.selectUserIdList(formDTO.getActId(),ActConstant.ACT_USER_STATUS_PASSED); + if(null!=userIdList&&userIdList.size()>0){ + List userMessageFormDTOS=new ArrayList<>(); + for(String userId:userIdList){ + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setCustomerId(actInfoDTO.getCustomerId()); + userMessageFormDTO.setUserId(userId); + userMessageFormDTO.setGridId(StrConstant.STAR); + userMessageFormDTO.setApp(AppClientConstant.APP_RESI); + userMessageFormDTO.setTitle(ActMessageConstant.TITLE); + userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); + userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.ACT_CANCELED, + actInfoDTO.getTitle(), + formDTO.getCancelReason())); + userMessageFormDTOS.add(userMessageFormDTO); + } + Result sendMessageRes= epmetMessageOpenFeignClient.saveUserMessageList(userMessageFormDTOS); + if(sendMessageRes.success()){ + logger.info("给审核通过的用户发送消息成功"); + } + } + + } + + /** + * @param actId + * @return void + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + @Override + public CanceledActDetailResultDTO canceledDetail(String actId) { + CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId); + if(null!=canceledActDetailResultDTO){ + canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId)); + if(canceledActDetailResultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + canceledActDetailResultDTO.setIsMyPublish(true); + }else{ + canceledActDetailResultDTO.setIsMyPublish(false); + } + } + return canceledActDetailResultDTO; + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 已结束-保存活动实际开始结束时间 + * @Date 2020/7/26 19:49 + **/ + @Override + public void saveActualTime(SaveActualTimeFormDTO formDTO) { + if(formDTO.getActualStartTime().compareTo(formDTO.getActualEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_ACTUAL_START_TIME_ERROR.getCode()); + } + ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); + Date actualStartTime= DateUtils.minStrToSecondDate(formDTO.getActualStartTime()); + actInfoDTO.setActualStartTime(actualStartTime); + Date actualEndTime= DateUtils.minStrToSecondDate(formDTO.getActualEndTime()); + actInfoDTO.setActualEndTime(actualEndTime); + actInfoDTO.setServiceMin(DateUtils.calculateMin(actualStartTime,actualEndTime)); + actInfoService.update(actInfoDTO); + } + + /** + * @param formDTO + * @return com.epmet.dto.result.work.FinishedActDetailResultDTO + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:02 + **/ + @Override + public FinishedActDetailResultDTO finishedDeatil(ActIdFormDTO formDTO) { + FinishedActDetailResultDTO resultDTO = actInfoDao.selectFinishedDetail(formDTO.getActId()); + if (null != resultDTO) { + List list = actContentDao.selectByActId(formDTO.getActId()); + resultDTO.setActContent(list); + if(resultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + resultDTO.setIsMyPublish(true); + }else{ + resultDTO.setIsMyPublish(false); + } + } + return resultDTO; + } + + /** + * @param actId + * @return com.epmet.dto.result.work.InProgressActDetailResultDTO + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:34 + **/ + @Override + public InProgressActDetailResultDTO inProgressDetail(String actId) { + InProgressActDetailResultDTO resultDTO = actInfoDao.selectInProgressDetail(actId); + if (null != resultDTO) { + List list = actContentDao.selectByActId(actId); + resultDTO.setActContent(list); + if(resultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + resultDTO.setIsMyPublish(true); + }else{ + resultDTO.setIsMyPublish(false); + } + } + return resultDTO; + } + + /** + * @param actId + * @return void + * @author yinzuomei + * @description 已结束-确认结束活动 + * @Date 2020/7/26 21:48 + **/ + @Override + public void finishAct(String actId) { + ActInfoDTO actInfoDTO=actInfoService.get(actId); + if(null==actInfoDTO){ + logger.error("act_info is null"); + return; + } + //校验是否可以结束 + this.checkActInfoDTO(actInfoDTO); + //act_info表改为已完成 + actInfoDTO.setActStatus(ActConstant.ACT_STATUS_FINISHED); + actInfoService.update(actInfoDTO); + //发放爱心时长、参与活动并获得积分的次数 + updateHeartUserInfo(actInfoDTO); + //保存结束活动日志 + this.saveActOperationRec(actId); + //生成统计表 + this.saveActStatistical(actId); + //发放积分调用事件 + if(actInfoDTO.getReward()>0){ + this.grantActPoints(actInfoDTO); + } + } + + private void grantActPoints(ActInfoDTO actInfoDTO) { + //查询已经给分的用户 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), FieldConstant.ID, actInfoDTO.getId()) + .eq("PROCESS_FLAG",ActConstant.HANDLED) + .eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE); + List actUserRelationEntityList=actUserRelationDao.selectList(wrapper); + if(null==actUserRelationEntityList||actUserRelationEntityList.size()<1){ + logger.info("不存在给分的记录,无需发送消息时间"); + return; + } + //查询当前用户所属组织信息 + Result userResult=govOrgOpenFeignClient.getAgencyByStaff(loginUserUtil.getLoginUserId()); + if(!userResult.success()||null==userResult.getData()){ + logger.error(String.format("根据staffId查询所属的组织机构失败,staffId=%s",loginUserUtil.getLoginUserId())); + } + String opAgencyId=userResult.getData().getId(); + //备注 + String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_REMARK,actInfoDTO.getTitle()); + MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); + //mq的事件类型 + mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); + //事件code + mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); + List actPointEventMsgList=new ArrayList<>(); + for(ActUserRelationEntity actUserRelationEntity:actUserRelationEntityList){ + ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + actPointEventMsg.setOpAgencyId(opAgencyId); + actPointEventMsg.setCustomerId(actInfoDTO.getCustomerId()); + actPointEventMsg.setUserId(actUserRelationEntity.getUserId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setPoint(actInfoDTO.getReward()); + actPointEventMsg.setIsCommon(true); + actPointEventMsg.setRemark(remark); + actPointEventMsgList.add(actPointEventMsg); + } + mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error("活动积分发放失败"); + } + } + + private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { + List actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR); + for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){ + HeartUserInfoDTO heartUserInfoDTO=heartUserInfoDao.selectByUserId(actUserRelation.getUserId()); + if(null==heartUserInfoDTO){ + continue; + } + if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ + heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1); + } + //爱心时长发放(签到的。未签到但是有积分的) + if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){ + //已签到的 + heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + }else{ + //未签到,但是有积分的 + if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ + heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + } + } + heartUserInfoService.update(heartUserInfoDTO); + } + } + + private void saveActStatistical(String actId) { + ActStatisticalDTO actStatisticalDTO=new ActStatisticalDTO(); + actStatisticalDTO.setActId(actId); + //报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) + actStatisticalDTO.setSignupNum(actUserRelationDao.selectCountUser(actId,StrConstant.EPMETY_STR)); + // 待审核总数 + actStatisticalDTO.setAuditingNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_AUDITING)); + //审核不通过总人数 + actStatisticalDTO.setPassedNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_PASSED)); + //审核不通过总人数 + actStatisticalDTO.setRefusedNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_REFUSED)); + //取消报名的人数 + actStatisticalDTO.setCanceldNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_CANCELD)); + //活动已签到人数 + actStatisticalDTO.setSignedInUserNum(actUserRelationDao.selectCountSinedIn(actId)); + //发放积分总人数 + actStatisticalDTO.setRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_AGREE)); + //拒绝发放积分总人数 + actStatisticalDTO.setDenyRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_DENY)); + actStatisticalService.save(actStatisticalDTO); + } + + private void saveActOperationRec(String actId) { + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(actId); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_FINISH); + actOperationRecEntity.setNoticeUser(false); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + } + + private ActInfoDTO checkActInfoDTO(ActInfoDTO actInfoDTO) { + //只有我发布的活动,我可以就结束 + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //待处理事项为空时才可以结束活动 + List list=actUserRelationDao.selectInProgress(actInfoDTO.getId()); + if(null!=list&&list.size()>0){ + throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode()); + } + //先填写实际开始时间、实际结束时间 + if(null==actInfoDTO.getActualStartTime()||null==actInfoDTO.getActualEndTime()){ + throw new RenException(EpmetErrorCode.ACTUAL_TIME.getCode()); + } + return actInfoDTO; + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 保存添加回顾 + * @Date 2020/7/27 10:45 + **/ + @Override + public void summaryAct(SummaryActFormDTO formDTO) { + ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); + if(null==actInfoDTO){ + logger.info("act_info is null"); + return; + } + if(!actInfoDTO.getActStatus().equals(ActConstant.ACT_STATUS_FINISHED)){ + //先结束活动,才能添加回顾 + throw new RenException(EpmetErrorCode.ACTUAL_NOT_FINISHED.getCode()); + } + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + //只有我发布的活动,才可以添加回顾 + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //审核 + List textList=new ArrayList<>(); + List imgList=new ArrayList<>(); + for(PublishActContentFormDTO actContent:formDTO.getActContent()){ + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ + textList.add(actContent.getContent()); + }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ + imgList.add(actContent.getContent()); + } + } + this.auditActContent(textList,imgList); + //插入act_summary记录 + int orderNum=1; + for(PublishActContentFormDTO actContentFormDTO:formDTO.getActContent()){ + ActSummaryEntity actSummaryEntity=new ActSummaryEntity(); + actSummaryEntity.setActId(formDTO.getActId()); + actSummaryEntity.setContent(actContentFormDTO.getContent()); + actSummaryEntity.setContentType(actContentFormDTO.getContentType()); + actSummaryEntity.setOrderNum(orderNum); + actSummaryDao.insert(actSummaryEntity); + orderNum++; + } + //更新act_info表的SUMMARY_FLAG=true + actInfoDTO.setSummaryFlag(true); + actInfoService.update(actInfoDTO); + } + + /** + * @param actId + * @return com.epmet.dto.result.work.ReEditActInfoResultDTO + * @author yinzuomei + * @description 重新编辑-获取活动详情 + * @Date 2020/7/27 13:36 + **/ + @Override + public ReEditActInfoResultDTO getActInfo(String actId) { + ActInfoDTO actInfoDTO=actInfoService.get(actId); + if(null==actInfoDTO){ + logger.error("act_info is null"); + return null; + } + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + if(!ActConstant.ACT_STATUS_PUBLISHED.equals(actInfoDTO.getActStatus())){ + throw new RenException("只有进行中的活动才可以编辑"); + } + ReEditActInfoResultDTO resultDTO= ConvertUtils.sourceToTarget(actInfoDTO, ReEditActInfoResultDTO.class); + resultDTO.setActId(actId); + List actContent=actContentDao.selectByActId(actId); + resultDTO.setActContent(actContent); + return resultDTO; + } + + /** + * @param rePublishFormDTO + * @return com.epmet.dto.result.work.PublishActResultDTO + * @author yinzuomei + * @description 重新发布活动 + * @Date 2020/7/27 13:55 + **/ + @Override + public PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO) { + ActInfoDTO originalActInfo=actInfoService.get(rePublishFormDTO.getActId()); + if(null==originalActInfo){ + logger.error("act_info is null"); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + if(!ActConstant.ACT_STATUS_PUBLISHED.equals(originalActInfo.getActStatus())){ + throw new RenException("只有进行中的活动才可以编辑"); + } + //构造属性保存活动属性,活动内容 + ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); + //校验参数 + this.checkPublishFormDTO(newActInfoEntity); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditRePublishAct(rePublishFormDTO); + logger.info("重新发布活动,审核成功"); + + newActInfoEntity.setId(rePublishFormDTO.getActId()); + actInfoDao.updateById(newActInfoEntity); + //删除原来的 + actContentDao.updateDelFlagByActId(rePublishFormDTO.getActId()); + //插入编辑后的活动详情 + List actContentEntityList=this.constructActContent(rePublishFormDTO.getActContent(),rePublishFormDTO.getActId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(rePublishFormDTO.getActId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_UPDATE); + actOperationRecEntity.setNoticeUser(rePublishFormDTO.getNoticePassedPeople()); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(rePublishFormDTO.getActId()); + //发送消息通知-暂时不做了 + /*if(rePublishFormDTO.getNoticePassedPeople()){ + this.noticePassedPeople(originalActInfo,newActInfoEntity); + }*/ + return publishActResultDTO; + } + + private void noticePassedPeople(ActInfoDTO originalActInfo, ActInfoEntity newActInfoEntity) { + /* List actUserRelationDTOList=actUserRelationDao.selectAuditingAndPassedList(originalActInfo.getId()); + if(null==actUserRelationDTOList||actUserRelationDTOList.size()<1){ + logger.info("不存在待审核人员、已经审核用户,无需发送站内信"); + return; + } + String originalTitle=originalActInfo.getTitle(); + + //活动地点、活动预计开始时间、活动预计结束时间、活动积分、签到时间开始、签到结束时间、签到地点*/ + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index a28beae020..c2f121e972 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -1,13 +1,29 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ActConstant; +import com.epmet.constant.ActMessageConstant; +import com.epmet.constant.ReadFlagConstant; import com.epmet.dao.ActInfoDao; +import com.epmet.dao.ActUserLogDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActUserLogDTO; import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.HeartUserInfoDTO; -import com.epmet.dto.form.work.AuditingActUserFormDTO; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.work.*; +import com.epmet.entity.ActInfoEntity; +import com.epmet.entity.ActUserLogEntity; +import com.epmet.entity.ActUserRelationEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.ActUserRelationService; import com.epmet.service.HeartUserInfoService; @@ -18,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -37,6 +54,14 @@ public class WorkActUserServiceImpl implements WorkActUserService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private ActInfoDao actInfoDao; + @Autowired + private ActUserLogDao actUserLogDao; + @Autowired + private ActUserRelationDao actUserRelationDao; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private LoginUserUtil loginUserUtil; /** * @param formDTO * @return java.util.List @@ -45,7 +70,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/21 22:25 **/ @Override - public List getAuditingList(AuditingActUserFormDTO formDTO) { + public List getAuditingList(ActIdFormDTO formDTO) { List list=new ArrayList<>(); //查询出待审核的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_AUDITING); @@ -56,7 +81,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询出待审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_AUDITING); //根据待审核的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ AuditingActUserResultDTO auditingDTO=new AuditingActUserResultDTO(); auditingDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -87,7 +112,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/22 15:16 **/ @Override - public List getPassedList(AuditingActUserFormDTO formDTO) { + public List getPassedList(ActIdFormDTO formDTO) { List resultList=new ArrayList<>(); //查询已通过的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_PASSED); @@ -98,7 +123,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询已通过审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_PASSED); //根据已通过的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ PassedActUserResultDTO passedDTO=new PassedActUserResultDTO(); passedDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -130,7 +155,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/22 15:50 **/ @Override - public List getRejectedlist(AuditingActUserFormDTO formDTO) { + public List getRejectedlist(ActIdFormDTO formDTO) { List resultList=new ArrayList<>(); //查询已拒绝的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_REFUSED); @@ -141,7 +166,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询已拒绝审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_REFUSED); //根据已拒绝的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ RejectedActUserResultDTO rejectedDTO=new RejectedActUserResultDTO(); rejectedDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -174,7 +199,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/22 16:35 **/ @Override - public List getCanceledList(AuditingActUserFormDTO formDTO) { + public List getCanceledList(ActIdFormDTO formDTO) { List resultList=new ArrayList<>(); //查询已取消的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_CANCELD); @@ -185,7 +210,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询已取消审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_CANCELD); //根据已取消的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ CanceledActUserResultDTO cancelDTO=new CanceledActUserResultDTO(); cancelDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -241,7 +266,323 @@ public class WorkActUserServiceImpl implements WorkActUserService { return actInfo; } - private Boolean getVolunteerFlag(String userId) { + /** + * @param formDTO + * @return com.epmet.dto.result.work.AuditingUserDetailResultDTO + * @author yinzuomei + * @description 报名审核-待审核人员详情 + * @Date 2020/7/22 22:44 + **/ + @Override + public AuditingUserDetailResultDTO queryAuditingUserDetail(AactUserDetailFormDTO formDTO) { + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + UserBaseInfoResultDTO userBaseInfo=queryUserBaseInfo(actUserRelationDTO.getUserId()); + AuditingUserDetailResultDTO resultDTO=new AuditingUserDetailResultDTO(); + //基本信息赋值 + resultDTO.setActUserRelationId(actUserRelationDTO.getId()); + resultDTO.setActId(actUserRelationDTO.getActId()); + resultDTO.setUserId(actUserRelationDTO.getUserId()); + resultDTO.setRealName(userBaseInfo.getRealName()); + resultDTO.setGender(userBaseInfo.getGender()); + resultDTO.setMobile(userBaseInfo.getMobile()); + resultDTO.setIdNum(userBaseInfo.getIdNum()); + resultDTO.setAddress(userBaseInfo.getStreet()+userBaseInfo.getDistrict()+userBaseInfo.getBuildingAddress()); + resultDTO.setSignUpTime(actUserRelationDTO.getCreatedTime()); + /** + * 当前状态(已报名/待审核auditing, + 审核通过passed, + 审核不通过refused + 取消报名canceld, + ) + */ + resultDTO.setStatus(actUserRelationDTO.getStatus()); + HistoricalActInfo historicalActInfo=this.getHistoricalActInfo(actUserRelationDTO.getUserId()); + resultDTO.setHistoricalActInfo(historicalActInfo); + if(ActConstant.ACT_USER_STATUS_AUDITING.equals(resultDTO.getStatus())){ + //被拒绝过,才赋值 + Integer refusedCount=actUserLogDao.selectRefusedCount(actUserRelationDTO.getActId(),actUserRelationDTO.getUserId()); + if(null!=refusedCount&&refusedCount>0){ + ActUserLogDTO latestRefused=actUserLogDao.selectLatestRefused(actUserRelationDTO.getActId(),actUserRelationDTO.getUserId()); + HistoricalAuditResult historicalAuditResult=new HistoricalAuditResult(); + historicalAuditResult.setLatestAuditTime(latestRefused.getCreatedTime()); + historicalAuditResult.setLatestRefusedReason(latestRefused.getReason()); + historicalAuditResult.setRefusedCountDesc(String.format("已拒绝%s次",refusedCount)); + resultDTO.setHistoricalAuditResult(historicalAuditResult); + } + }else if(ActConstant.ACT_USER_STATUS_PASSED.equals(resultDTO.getStatus())||ActConstant.ACT_USER_STATUS_REFUSED.equals(resultDTO.getStatus())){ + AuditResult auditResult=new AuditResult(); + auditResult.setAuditTime(actUserRelationDTO.getAuditTime()); + auditResult.setRefusedReason(actUserRelationDTO.getFailureReason()); + resultDTO.setAuditResult(auditResult); + }else if(ActConstant.ACT_USER_STATUS_CANCELD.equals(resultDTO.getStatus())){ + CancelResult cancelResult=new CancelResult(); + cancelResult.setCancelReason(actUserRelationDTO.getCancelReason()); + cancelResult.setCancelTime(actUserRelationDTO.getCancelTime()); + resultDTO.setCancelResult(cancelResult); + } + resultDTO.setVolunteerFlag(getVolunteerFlag(actUserRelationDTO.getUserId())); + return resultDTO; + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 报名审核-人员历史活动情况 + * @Date 2020/7/23 16:16 + **/ + @Override + public UserHistoricalActResultDTO queryUserHistoricalAct(UserHistoricalActFormDTO formDTO) { + UserHistoricalActResultDTO resultDTO=new UserHistoricalActResultDTO(); + UserBaseInfoResultDTO userBaseInfoResultDTO=this.queryUserBaseInfo(formDTO.getUserId()); + //基本信息 + resultDTO.setUserId(formDTO.getUserId()); + resultDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + resultDTO.setNickName(userBaseInfoResultDTO.getNickname()); + resultDTO.setRealName(userBaseInfoResultDTO.getRealName()); + //参与活动统计值 + HistoricalActInfo historicalActInfo=getHistoricalActInfo(formDTO.getUserId()); + resultDTO.setSignInActNum(historicalActInfo.getSignInActNum()); + resultDTO.setSignUpActNum(historicalActInfo.getSignUpActNum()); + resultDTO.setObtainPointsActNum(historicalActInfo.getObtainPointsActNum()); + //历史活动列表 + resultDTO.setActInfoList(actUserRelationDao.selectAllByUserId(formDTO.getUserId())); + return resultDTO; + } + + /** + * @param actUserRelationId + * @return void + * @author yinzuomei + * @description 报名审核-审核通过 + * @Date 2020/7/23 17:30 + **/ + @Override + public void auditPass(String actUserRelationId) { + ActUserRelationEntity actUserRelationEntity=actUserRelationDao.selectById(actUserRelationId); + if(null==actUserRelationEntity||!ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserRelationEntity.getStatus())){ + logger.info("当前用户不处理待审核状态"); + return ; + } + ActInfoEntity actInfo = actInfoDao.selectById(actUserRelationEntity.getActId()); + if(null==actInfo){ + logger.error("查询活动为空actId="+actUserRelationEntity.getActId()); + return; + } + if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + if(actInfo.getActStatus().equals(ActConstant.ACT_STATUS_CANCELED)){ + logger.info("活动已经取消,无需处理"); + return; + } + Date auditTime=new Date(); + actUserRelationEntity.setStatus(ActConstant.ACT_USER_STATUS_PASSED); + actUserRelationEntity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); + actUserRelationEntity.setAuditTime(auditTime); + actUserRelationEntity.setFailureReason(StrConstant.EPMETY_STR); + //更新关系记录表改为已通过 + actUserRelationDao.updateById(actUserRelationEntity); + + ActUserLogEntity actUserLogEntity=new ActUserLogEntity(); + actUserLogEntity.setActId(actUserRelationEntity.getActId()); + actUserLogEntity.setUserId(actUserRelationEntity.getUserId()); + actUserLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_PASSED); + actUserLogEntity.setReason(StrConstant.EPMETY_STR); + actUserLogEntity.setCreatedTime(auditTime); + //插入一条日志 + actUserLogDao.insert(actUserLogEntity); + //给居民发消息 + this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_PASSED,actInfo); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 报名审核-拒绝报名 + * @Date 2020/7/23 18:14 + **/ + @Override + public void auditRefuse(AuditUserFormDTO formDTO) { + ActUserRelationEntity actUserRelationEntity=actUserRelationDao.selectById(formDTO.getActUserRelationId()); + if(null==actUserRelationEntity||!ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserRelationEntity.getStatus())){ + logger.info("当前用户不处理待审核状态"); + return ; + } + ActInfoEntity actInfo = actInfoDao.selectById(actUserRelationEntity.getActId()); + if(null==actInfo){ + logger.error("查询活动为空actId="+actUserRelationEntity.getActId()); + return; + } + if(actInfo.getActStatus().equals(ActConstant.ACT_STATUS_CANCELED)){ + logger.info("活动已经取消,无需处理"); + return; + } + if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + Date auditTime=new Date(); + actUserRelationEntity.setStatus(ActConstant.ACT_USER_STATUS_REFUSED); + actUserRelationEntity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); + actUserRelationEntity.setAuditTime(auditTime); + //拒绝理由必填 + actUserRelationEntity.setFailureReason(formDTO.getRejectReason()); + //更新关系记录表改为已拒绝 + actUserRelationDao.updateById(actUserRelationEntity); + ActUserLogEntity actUserLogEntity=new ActUserLogEntity(); + actUserLogEntity.setActId(actUserRelationEntity.getActId()); + actUserLogEntity.setUserId(actUserRelationEntity.getUserId()); + actUserLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_REFUSED); + actUserLogEntity.setReason(StrConstant.EPMETY_STR); + actUserLogEntity.setCreatedTime(auditTime); + //插入一条日志 + actUserLogDao.insert(actUserLogEntity); + //给居民发消息 + this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_REFUSED,actInfo); + } + + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:17 + **/ + @Override + public List queryJoinUserList(ActIdFormDTO formDTO) { + List list=actInfoDao.queryJoinUserList(formDTO.getActId()); + if(null!=list&&list.size()>0){ + //查询已通过审核的人员id集合 + List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_PASSED); + //根据已通过的人员集合,查询出用户基本信息 + List userInfoList=this.queryUserBaseInfoList(userIdList); + for(JoinedUserResultDTO joinedUserResultDTO:list){ + //积分描述赋值 + if(ActConstant.ACT_USER_STATUS_AGREE.equals(joinedUserResultDTO.getRewardFlag())){ + joinedUserResultDTO.setPointsDes(String.format("积分+%s",joinedUserResultDTO.getReward())); + }else if(ActConstant.ACT_USER_STATUS_DENY.equals(joinedUserResultDTO.getRewardFlag())){ + joinedUserResultDTO.setPointsDes("积分+0"); + } + //志愿者标识赋值 + joinedUserResultDTO.setVolunteerFlag(this.getVolunteerFlag(joinedUserResultDTO.getUserId())); + //基础信息赋值 + for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ + if(joinedUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ + joinedUserResultDTO.setRealName(userBaseInfo.getRealName()); + joinedUserResultDTO.setNickName(userBaseInfo.getNickname()); + joinedUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + break; + } + + } + } + } + return list; + } + + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:54 + **/ + @Override + public List queryCanceledUserList(ActIdFormDTO formDTO) { + List list=actInfoDao.queryCanceledUserList(formDTO.getActId()); + if(null!=list&&list.size()>0){ + //查询已取消报名的人员id集合 + List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_CANCELD); + //根据已取消报名的人员集合,查询出用户基本信息 + List userInfoList=this.queryUserBaseInfoList(userIdList); + for(CanceledUserResultDTO canceledUserResultDTO:list){ + //志愿者标识赋值 + canceledUserResultDTO.setVolunteerFlag(this.getVolunteerFlag(canceledUserResultDTO.getUserId())); + //基础信息赋值 + for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ + if(canceledUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ + canceledUserResultDTO.setRealName(userBaseInfo.getRealName()); + canceledUserResultDTO.setNickName(userBaseInfo.getNickname()); + canceledUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + break; + } + + } + } + } + return list; + } + + /** + * @param actUserRelationEntity + * @param type + * @return void + * @author yinzuomei + * @description 报名审核通过,拒绝通知居民 + * @Date 2020/7/23 18:01 + **/ + private void saveUserMessage(ActUserRelationEntity actUserRelationEntity, String type,ActInfoEntity actInfo) { + try { + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setCustomerId(actInfo.getCustomerId()); + userMessageFormDTO.setUserId(actUserRelationEntity.getUserId()); + userMessageFormDTO.setGridId(StrConstant.STAR); + userMessageFormDTO.setApp(AppClientConstant.APP_RESI); + userMessageFormDTO.setTitle(ActMessageConstant.TITLE); + userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); + if (ActConstant.ACT_USER_STATUS_PASSED.equals(type)) { + userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.AUDIT_PASSED, actInfo.getTitle())); + } else if (ActConstant.ACT_USER_STATUS_REFUSED.equals(type)) { + userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.AUDIT_REFUSED, actInfo.getTitle(), actUserRelationEntity.getFailureReason())); + } + Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); + if (result.success()) { + logger.info("审核成功,已成功发送站内信"); + }else{ + logger.error("审核成功,发送站内信失败"+ JSON.toJSONString(result)); + } + } catch (Exception e) { + logger.error("审核结果,发送站内信异常", e.getMessage()); + } + } + + /** + * @return com.epmet.dto.result.work.HistoricalActInfo + * @param userId + * @author yinzuomei + * @description 用户历史活动情况 + * @Date 2020/7/23 15:56 + **/ + private HistoricalActInfo getHistoricalActInfo(String userId) { + HistoricalActInfo historicalActInfo=new HistoricalActInfo(); + /** + * 实际参加活动个数(已经签到的) + */ + Integer signInActNum=actUserRelationDao.countSignInActNum(userId); + historicalActInfo.setSignInActNum(signInActNum); + /** + * 报名活动个数(act_user_realation) + */ + Integer signUpActNum=actUserRelationDao.countSignUpActNum(userId); + historicalActInfo.setSignUpActNum(signUpActNum); + /** + * 获得积分活动个数 + */ + Integer obtainPointsActNum=actUserRelationDao.countObtainPointsActNum(userId); + historicalActInfo.setObtainPointsActNum(obtainPointsActNum); + return historicalActInfo; + } + + /** + * @return java.lang.Boolean + * @param userId + * @author yinzuomei + * @description 根据用户id判断是否志愿者 + * @Date 2020/7/24 12:51 + **/ + @Override + public Boolean getVolunteerFlag(String userId) { HeartUserInfoDTO heartUserInfoDTO=heartUserInfoService.getByUserId(userId); //true: 是志愿者 false : 不是志愿者 if(null!=heartUserInfoDTO){ @@ -257,7 +598,8 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) * @Date 2020/7/22 10:38 **/ - private List queryUserBaseInfo(List userIdList) { + @Override + public List queryUserBaseInfoList(List userIdList) { List userInfoList=new ArrayList<>(); if(null==userIdList||userIdList.size()==0){ return userInfoList; @@ -271,4 +613,23 @@ public class WorkActUserServiceImpl implements WorkActUserService { } return userInfoList; } + + /** + * @return com.epmet.dto.result.UserBaseInfoResultDTO + * @param userId + * @author yinzuomei + * @description 根据用户id获取用户基本信息 + * @Date 2020/7/23 12:52 + **/ + @Override + public UserBaseInfoResultDTO queryUserBaseInfo(String userId) { + List userIdList = new ArrayList<>(); + userIdList.add(userId); + //调用epemet_user服务获取用户的基本信息 + Result> resultUserList = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!resultUserList.success() || resultUserList.getData().size() < 1 || null == resultUserList.getData().get(0)) { + throw new RenException("查询用户基本信息失败"); + } + return resultUserList.getData().get(0); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java new file mode 100644 index 0000000000..4bb60ab49f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java @@ -0,0 +1,94 @@ +package com.epmet.utils; + +import com.alibaba.nacos.client.utils.StringUtils; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; +import org.springframework.beans.factory.annotation.Value; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; +import java.util.UUID; + +/** + * 文字、图片合法性校验 + * + * @author zhangyong + * @date 2020-07-15 14:26 + */ +@Slf4j +public class ValidityVerification { + + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; + + /** + * 文本校验 + * @param context 被校验的文本,,不能超过10000 + * @param businessEnum 业务枚举,定义校验失败后,输出的日志信息 + * @return void + * @auther zhangyong + * @Date 14:42 2020-07-15 + **/ + public void textScanVerification(String context, String businessEnum){ + if (StringUtils.isNotBlank(context)) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(context); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + // 业务枚举:例如:评论话题失败,评论内容为:%s" + log.error(String.format(businessEnum, context)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + } + + /** + * 图片列表校验 + * @param imgList 被校验的图片列表 + * @param businessEnum 业务枚举,定义校验失败后,输出的日志信息 + * + * @return void + * @auther zhangyong + * @Date 14:42 2020-07-15 + **/ + public void imgScanVerification(List imgList, String businessEnum){ + if (null != imgList && NumConstant.ZERO != imgList.size()){ + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + imgList.forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(url); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + // 业务枚举:例如:评论话题失败,评论内容为:%s" + log.error(String.format(businessEnum)); + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); + } + } + } + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml index 8571a47da1..72477fb20d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml @@ -118,17 +118,19 @@ pagehelper: helper-dialect: mysql reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 -#亿联云消息网关 -elink: - mq: - appId: @elink.mq.appId@ #项目接入亿联云的应用Id - token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret - host: @elink.mq.host@ #亿联云消息网关服务地址 - sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 + openapi: scan: server: url: @openapi.scan.server.url@ method: imgSyncScan: /imgSyncScan - textSyncScan: /textSyncScan \ No newline at end of file + textSyncScan: /textSyncScan + +#亿联云消息网关 +elink: + mq: + appId: @elink.mq.appId@ #项目接入亿联云的应用Id + token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret + host: @elink.mq.host@ #亿联云消息网关服务地址 + sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml index 512e302761..aacc15fdab 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml @@ -5,6 +5,8 @@ + + ${appname} @@ -125,11 +127,13 @@ 15 - - + ERROR ACCEPT DENY + ${webHook} + ${secret} + ${appname} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml index 4f6c46667e..6a0027bd5e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml @@ -17,5 +17,24 @@ + + + + + UPDATE act_content ac + SET ac.DEL_FLAG = '1' + WHERE + ac.ACT_ID = #{actId} + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 3f9eb4a072..370150c73d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -66,9 +66,10 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' + AND = ]]> NOW() -- 报名截止时间 >= 当前时间 AND (i.ACT_QUOTA_CATEGORY = 0 OR i.ACT_QUOTA > IFNULL(c.signupNum, 0)) -- 不限名额或者报名人数未报满 AND i.CUSTOMER_ID = #{customerId} ORDER BY i.ACT_QUOTA_CATEGORY DESC,i.CREATED_TIME DESC @@ -91,9 +92,10 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' + AND = ]]> NOW() -- 报名截止时间 >= 当前时间 AND i.ACT_QUOTA_CATEGORY = 1 -- 固定名额 AND i.ACT_QUOTA = IFNULL(c.signupNum, 0) -- 名额已满 AND i.CUSTOMER_ID = #{customerId} @@ -117,7 +119,7 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 > 当前时间 并且 报名截止时间 < 当前时间 报名已结束,活动未开始 未开始 AND ( ]]> NOW() AND NOW() ) @@ -143,10 +145,10 @@ IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名) FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 <= 当前时间 并且活动结束时间 >= 当前时间 进行中 - AND ( NOW() AND = ]]> NOW() ) + AND ( NOW() AND = ]]> NOW() ) AND i.ACT_STATUS != 'canceled' AND i.CUSTOMER_ID = #{customerId} ORDER BY i.CREATED_TIME DESC @@ -169,9 +171,10 @@ IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名) FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' - AND i.ACT_STATUS = 'finished' + AND i.ACT_STATUS != 'canceled' + AND NOW() AND i.CUSTOMER_ID = #{customerId} ORDER BY i.CREATED_TIME DESC LIMIT #{pageNo}, #{pageSize} @@ -192,7 +195,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'auditing' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'auditing' @@ -215,7 +218,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'passed' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'passed' @@ -238,7 +241,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'refused' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'refused' @@ -261,7 +264,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'canceld' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND NOW() -- 活动结束时间 < 当前时间, 活动已结束 @@ -375,4 +378,289 @@ ai.DEL_FLAG = '0' AND ai.id =#{actId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml index 6ebfea5ed7..6b3c8d92ea 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml @@ -19,5 +19,64 @@ + + - \ No newline at end of file + + + + + INSERT INTO act_live_rec ( + ID, + ACT_ID, + USER_ID, + LONGITUDE, + LATITUDE, + ADDRESS, + `DESC`, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + VALUES + ( #{id}, + #{actId}, + #{userId}, + #{longitude}, + #{latitude}, + #{address}, + #{desc}, + 0, + 0, + #{userId}, + now(), + #{userId}, + now()) + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml index 9da8bf431c..322fda60fb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml @@ -7,7 +7,6 @@ - diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml index 6ac88d72a1..c1e6956935 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml @@ -21,5 +21,38 @@ - - \ No newline at end of file + + INSERT INTO act_sign_in_rec ( + ID, + ACT_ID, + USER_ID, + LONGITUDE, + LATITUDE, + ADDRESS, + `DESC`, + SYNC_LIVE, + LIVE_ID, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + VALUES + ( #{id}, + #{actId}, + #{userId}, + #{longitude}, + #{latitude}, + #{address}, + #{desc}, + #{syncLive}, + #{liveId}, + 0, + 0, + #{userId}, + now(), + #{userId}, + now()) + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml index 7fd6faa626..4381ff3e2d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml @@ -12,8 +12,6 @@ - - diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml index f71666b3c1..6ff1b956d0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml @@ -17,5 +17,18 @@ - - \ No newline at end of file + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml index 67716c10d3..ed56feda4b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml @@ -16,6 +16,40 @@ + + + + - - \ No newline at end of file + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index f7531ff65a..0b98a68f39 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -33,7 +33,9 @@ act_user_relation aur WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` = #{status} + + AND aur.`STATUS` = #{status} + AND aur.ACT_ID = #{actId} order by aur.CREATED_TIME desc @@ -46,7 +48,9 @@ act_user_relation aur WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` =#{status} + + AND aur.`STATUS` =#{status} + AND aur.ACT_ID = #{actId} order by aur.CREATED_TIME desc @@ -58,7 +62,233 @@ act_user_relation aur WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` =#{status} + + AND aur.`STATUS` =#{status} + AND aur.ACT_ID = #{actId} - \ No newline at end of file + + + + + + UPDATE act_user_relation + SET + + STATUS = #{status}, + + + CANCEL_TIME = NOW(), + CANCEL_REASON = #{cancelReason}, + + + SIGN_IN_FLAG = #{signInFlag}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = NOW() + WHERE + DEL_FLAG = '0' + AND ACT_ID = #{actId} + AND USER_ID = #{userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE act_user_relation + SET + DEL_FLAG = '1', + + UPDATED_BY = #{userId}, + + UPDATED_TIME = NOW() + WHERE + DEL_FLAG = '0' + AND ACT_ID = #{actId} + AND USER_ID = #{userId} + + + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml index 341370c3f7..9908c46e37 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml @@ -29,4 +29,52 @@ hui.DEL_FLAG = '0' AND hui.USER_ID =#{userId} - \ No newline at end of file + + + + + + + + + UPDATE heart_user_info + SET + + VOLUNTEER_FLAG = 1, + + + KINDNESS_TIME = #{kindnessTime}, + + + PARTICIPATION_NUM = #{participationNum}, + + + OBTAIN_POINT_NUM = #{obtainPointNum}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = now() + WHERE DEL_FLAG = '0' + AND USER_ID = #{userId} + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml index 68f536b24d..c11277cc32 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml @@ -50,4 +50,9 @@ ORDER BY lac.ORDER_NUM ASC + + + + delete from latest_act_content where ACT_ID=#{actId} + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml index 28b43cd8cf..a2e33b2245 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml @@ -118,4 +118,9 @@ lai.DEL_FLAG = '0' AND lai.ID = #{actDraftId} + + + + update latest_act_info set DEL_FLAG='1' where id=#{id} + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml index 48854253bb..3555334a07 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml @@ -17,5 +17,31 @@ + - \ No newline at end of file + + UPDATE volunteer_info + SET + + CUSTOMER_ID = #{customerId}, + + + VOLUNTEER_INTRODUCE = #{volunteerIntroduce}, + + + VOLUNTEER_SIGNATURE = #{volunteerSignature}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = now() + WHERE DEL_FLAG = '0' + AND USER_ID = #{userId} + + diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml index 9fc81b43c5..2749306424 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-job-server:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-job-server:0.3.23 ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index 76ac6ca878..b8f1def9d3 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -22,6 +22,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:47 */ +//@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = EpmetMessageOpenFeignClientFallback.class,url = "http://127.0.0.1:8085") @FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = EpmetMessageOpenFeignClientFallback.class) public interface EpmetMessageOpenFeignClient { /** diff --git a/epmet-module/epmet-oss/epmet-oss-client/pom.xml b/epmet-module/epmet-oss/epmet-oss-client/pom.xml index e88c7004ce..8a27707939 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-client/pom.xml @@ -26,6 +26,21 @@ io.springfox springfox-swagger-ui + + io.github.openfeign.form + feign-form + 3.8.0 + + + io.github.openfeign.form + feign-form-spring + 3.8.0 + + + commons-fileupload + commons-fileupload + 1.3.3 + diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java new file mode 100644 index 0000000000..a154d381a4 --- /dev/null +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto; + +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/24 10:10 + */ +@Data +public class QrCodeDTO implements Serializable { + private static final long serialVersionUID = -1787470699926486609L; + private byte[] qrCode; + private MultipartFile media; +} 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 1a64ebab62..47daa888cc 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 @@ -8,12 +8,15 @@ package com.epmet.feign; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.feign.fallback.OssFeignClientFallback; import feign.codec.Encoder; import feign.form.spring.SpringFormEncoder; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.UploadDTO; import org.springframework.cloud.openfeign.FeignClient; 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.RequestPart; @@ -25,17 +28,23 @@ import org.springframework.web.multipart.MultipartFile; * @author Mark sunlightcs@gmail.c om * @since 1.1.0 */ -@FeignClient(name = "renren-oss-server", configuration = OssFeignClient.MultipartSupportConfig.class) +@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class, fallback = + OssFeignClientFallback.class) public interface OssFeignClient { /** * 文件上传 - * @param file 文件 + * @param media 文件 * @return 返回路径 */ - @PostMapping(value = "oss/file/upload", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, - consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - Result upload(@RequestPart("file") MultipartFile file); + @PostMapping(value = "oss/file/uploadwximg", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + Result uploadWxImg(@RequestPart(value = "media") MultipartFile media); + + + @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + Result uploadQrCode(@RequestPart(value = "file") MultipartFile file); + + @Configuration class MultipartSupportConfig { @Bean public Encoder feignFormEncoder() { 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 f1bb26a963..0158f7f017 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 @@ -1,15 +1,17 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

* https://www.renren.io - * + *

* 版权所有,侵权必究! */ 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.UploadDTO; +import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; @@ -23,8 +25,14 @@ import org.springframework.web.multipart.MultipartFile; @Component public class OssFeignClientFallback implements OssFeignClient { - @Override - public Result upload(MultipartFile file) { - return new Result().error(); - } + @Override + public Result uploadWxImg(MultipartFile media) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadWxImg", media); + } + + @Override + public Result uploadQrCode(MultipartFile file) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file); + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml index 3cfb7ad834..6460e6170d 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml @@ -3,7 +3,7 @@ services: epmet-oss-server: container_name: epmet-oss-server-dev # image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-oss-server:0.3.2 - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.22 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.23 ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index 36377c819b..1b8463505e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.22 + 0.3.23 com.epmet epmet-oss 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 4367e4e62e..5b3e3bee6b 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 @@ -98,7 +98,7 @@ public class OssController { @PostMapping("upload") @ApiOperation(value = "上传文件") - public Result upload(@RequestParam("file") MultipartFile file) throws Exception { + public Result upload(@RequestPart("file") MultipartFile file) throws Exception { if (file.isEmpty()) { return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); } @@ -141,6 +141,15 @@ public class OssController { return ossService.uploadImg(file); } + @PostMapping("uploadwximg") + public Result uploadWxImg(@RequestPart("media") MultipartFile media) { + return ossService.uploadImg(media); + } + + @PostMapping("uploadqrcode") + public Result uploadQrCode(@RequestPart(value = "file") MultipartFile file) { + return ossService.uploadImg(file); + } /** * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件,这里不再使用通用的接口 * 针对每一个业务新建上传接口) diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java new file mode 100644 index 0000000000..d8a7fee9cb --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** +* desc:积分规则Id详情获取 规则列表 + * @author jianjun liu + * @date 2020-07-22 15:28 + **/ +@Data +public class PointDetailFormDTO implements Serializable { + private static final long serialVersionUID = 7587939716742608164L; + /** + * 积分规则Id + */ + @NotBlank(message = "积分规则Id不能为空") + private String ruleId; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java new file mode 100644 index 0000000000..5d3c6dabfa --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java @@ -0,0 +1,89 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * desc:积分规则保存/修改 规则列表 + * + * @author jianjun liu + * @date 2020-07-22 15:28 + **/ +@Data +public class PointRuleFormDTO implements Serializable { + private static final long serialVersionUID = -3228252683629912008L; + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String customerId; + + /** + * 积分规则Id + */ + @NotBlank(message = "积分规则Id不能为空", groups = UpdateGroup.class) + private String ruleId; + + /** + * 功能Id + */ + @NotBlank(message = "功能Id不能为空", groups = {AddGroup.class}) + private String functionId; + + /** + * 积分规则名称 + */ + @NotBlank(message = "积分规则名称不能为空", groups = AddGroup.class) + private String ruleName; + /** + * 积分 + */ + @NotNull(message = "积分不能为空", groups = {UpdateGroup.class}) + private Integer point; + + /** + * 是否开启 + */ + @NotBlank(message = "是否开启不能为空", groups = {UpdateGroup.class}) + private String enabledFlag; + /** + * 是否启用 + */ + @NotNull(message = "积分上限不能为空", groups = {UpdateGroup.class}) + private Integer upLimit; + + /** + * 积分上限描述 + */ + private String upLimitDesc; + + //=======系统添加时的属性====== + /** + * 规则说明 事件说明 + */ + @NotBlank(message = "规则描述不能为空", groups = AddGroup.class) + private String ruleDesc; + + /** + * 事件CODE 来自事件表 + */ + @NotBlank(message = "事件code不能为空", groups = AddGroup.class) + private String eventCode; + + /** + * 操作类型 加积分:plus;减积分:minus + */ + private String operateType; + /** + * 获得积分单位 次:time;分钟:minute;小时:hour + */ + @NotBlank(message = "积分单位不能为空", groups = AddGroup.class) + private String pointUnit; + +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java new file mode 100644 index 0000000000..93566a19b3 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** +* desc:根据功能Id获取 规则列表 + * @author jianjun liu + * @date 2020-07-22 15:28 + **/ +@Data +public class PointRuleListFormDTO implements Serializable { + private static final long serialVersionUID = -1918653281170340608L; + /** + * 功能Id + */ + @NotBlank(message = "功能Id不能为空") + private String functionId; + @NotBlank(message = "客户Id不能为空") + private String customerId; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java new file mode 100644 index 0000000000..817b94d7c1 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分规则-获取客户功能列表 result + * @author jianjun liu + * @date 2020-07-22 14:43 + **/ +@Data +public class CustomerFunctionResultDTO implements Serializable { + private static final long serialVersionUID = -3761765064811136295L; + + private String functionId; + private String functionName; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java new file mode 100644 index 0000000000..8ed856dc91 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分规则-详情 result + * @author jianjun liu + * @date 2020-07-22 14:43 + **/ +@Data +public class PointDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 2426172750860788081L; + private String ruleId; + private String ruleName; + private String ruleDesc; + private Integer point; + private String pointUnit; + private String upLimit; + private String enabledFlag; + private String upLimitDesc; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java new file mode 100644 index 0000000000..bf8e546806 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分规则-列表 result + * @author jianjun liu + * @date 2020-07-22 14:43 + **/ +@Data +public class PointRuleResultDTO implements Serializable { + + private static final long serialVersionUID = -2327977101138032573L; + private String ruleId; + private String ruleName; + private String ruleDesc; + /** + * 拼接好的 积分值/单位 + */ + private String pointValue; +} diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml index 60480da477..d37df7459f 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: epmet-point-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.1 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.2 ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 31263dd1a3..1b8007a7b7 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.0.1 + 0.0.2 epmet-point com.epmet @@ -69,6 +69,12 @@ 2.0.0 compile + + com.epmet + oper-customize-client + 2.0.0 + compile + com.epmet epmet-user-client @@ -122,7 +128,7 @@ 6379 123456 - false + true 122.152.200.70:8848 fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b @@ -131,6 +137,9 @@ false + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -163,6 +172,9 @@ true + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -195,8 +207,11 @@ true + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 - \ No newline at end of file + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java new file mode 100644 index 0000000000..eefb1d8b4d --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java @@ -0,0 +1,42 @@ +package com.epmet.common.enu; + +/** + * 系积分系统-积分单位枚举类 + * dev|test|prod + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum PointUnitEnum { + TIME("time", "次"), + MINUTE("minute", "分种"), + HOUR("hour", "小时"), + ; + + private String code; + private String desc; + + + PointUnitEnum(String code, String name) { + this.code = code; + this.desc = name; + } + + public static PointUnitEnum getEnum(String code) { + PointUnitEnum[] values = PointUnitEnum.values(); + for (PointUnitEnum value : values) { + if (code != null && value.getCode().equals(code)) { + return value; + } + } + return null; + } + + public String getCode() { + return code; + } + + public String getDesc() { + return desc; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java new file mode 100644 index 0000000000..5ae3c00775 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java @@ -0,0 +1,44 @@ +package com.epmet.common.enu; + +/** + * @author jianjun liu + * @date 2020-06-04 21:39 + **/ +public enum SysResponseEnum { + /** + * + * 业务代码枚举类 + * + * 编码样式:【CCCBBOOXX】 + * 编码示例说明: + * CCC 中心编码&业务系统 (112(与端口号一致)-积分系统服务) + * BB 业务类型(00-默认 ) + * OO 操作类型(00-默认) + * XX 具体编码(00-成功,01-失败,02-参数错误,10-异常 99-系统错误) + * + */ + /*通用枚举 */ + EXCEPTION(10001,"系统异常"), + + + /*积分规则 业务 01*/ + THIRD_SERVICE_ERROR(112010001,"调用第三方接口异常"), + POINT_RULE_IS_NOT_EXIST(112010002,"积分规则不存在"), + POINT_ENABLE_FLAG_PARAM_ERROR(112010003,"积分规则开启状态参数错误"), + ; + + private Integer code; + private String msg; + SysResponseEnum(Integer code, String msg){ + this.code = code; + this.msg = msg; + } + + public Integer getCode() { + return code; + } + + public String getMsg() { + return msg; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java index e7e1a33c7f..d8e6ceac75 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java @@ -30,8 +30,8 @@ public class MqSubcribeConfig { event.setBelongAppId("202007161443499985fa2d397436d10356542134c8f008c48"); event.setEventClass("epmet_heart"); event.setEventTag("active_send_point"); - String callbackUrl = "http://192.168.51.49/point/callback/sendPoint"; - callbackUrl = ""; + String callbackUrl = "http://192.168.1.119/point/callback/sendPoint"; + //callbackUrl = ""; event.setCallbackUrl(callbackUrl); List subscribeFormDTOList = new ArrayList<>(); subscribeFormDTOList.add(event); diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java new file mode 100644 index 0000000000..5c9dc10f67 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java @@ -0,0 +1,51 @@ +package com.epmet.controller; + +import com.alibaba.fastjson.JSON; +import com.epmet.common.enu.PointUnitEnum; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.service.PointRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author jianjun liu + * @date 2020-06-04 20:39 + **/ +@RestController +@RequestMapping("opback") +public class BackDoorController { + @Autowired + private PointRuleService pointRuleService; + + /** + * desc:添加规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "addpointrule") + public Result add(@RequestBody PointRuleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + pointRuleService.add(null, formDTO); + return new Result().ok(true); + } + + public static void main(String[] args) { + PointRuleFormDTO formDTO = new PointRuleFormDTO(); + formDTO.setPoint(0); + formDTO.setUpLimit(0); + //微笑山东 + formDTO.setCustomerId("57a648d230bf459b18ea23fc278c3de7"); + formDTO.setRuleDesc("认证志愿者会获得积分"); + formDTO.setEventCode("register_volunteer"); + formDTO.setPointUnit(PointUnitEnum.TIME.getCode()); + System.out.println(JSON.toJSONString(formDTO)); + + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java index aeaca6e25d..51146befb0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java @@ -2,12 +2,17 @@ package com.epmet.controller; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.dto.form.mq.ReceiveMqMsg; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.service.UserPointActionLogService; import dto.form.SendPointFormDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -16,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController; * * @date: 2020/7/21 9:04 * @author: jianjun liu - * email:liujianjun@git.elinkit.com.cn */ @Slf4j @RestController @@ -24,6 +28,9 @@ import org.springframework.web.bind.annotation.RestController; public class MqPointCallbackController { private Logger logger = LogManager.getLogger(MqPointCallbackController.class); + @Autowired + private UserPointActionLogService userPointActionLogService; + /** * desc:爱心活动积分发放 * @@ -38,8 +45,62 @@ public class MqPointCallbackController { return "success"; } SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class); + try { + //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + } catch (Exception e) { + logger.error("activeSendPoint consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } log.info("activeSendPoint consumer success,formDTO:{}", JSON.toJSONString(formDTO)); return "success"; } + + /** + * desc:爱心互助-志愿者注册消息 + * + * @param mqMsg + * @return + */ + @RequestMapping("registervolunteer") + public String registerVolunteer(ReceiveMqMsg mqMsg) { + log.debug("registerVolunteer receive mqMsg:{}", JSON.toJSONString(mqMsg)); + if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { + log.warn("registerVolunteer mqMsg is empty"); + return "success"; + } + BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class); + try { + //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + } catch (Exception e) { + logger.error("registerVolunteer consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } + log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formDTO)); + return "success"; + } + + /** + * desc:爱心互助-发布实况消息 + * + * @param mqMsg + * @return + */ + @RequestMapping("pubactivelive") + public String pubActiveLive(ReceiveMqMsg mqMsg) { + log.debug("pubActiveLive receive mqMsg:{}", JSON.toJSONString(mqMsg)); + if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { + log.warn("pubActiveLive mqMsg is empty"); + return "success"; + } + BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class); + try { + //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + } catch (Exception e) { + logger.error("pubActiveLive consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } + log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formDTO)); + return "success"; + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java new file mode 100644 index 0000000000..a0c7f479dd --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java @@ -0,0 +1,100 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.form.PointDetailFormDTO; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.result.CustomerFunctionResultDTO; +import com.epmet.dto.result.PointDetailResultDTO; +import com.epmet.dto.result.PointRuleResultDTO; +import com.epmet.service.PointRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 积分规则controller + * + * @author jianjun liu + * @date 2020-07-22 14:39 + **/ +@RestController +@RequestMapping("rule") +public class PointRuleController { + @Autowired + private PointRuleService pointRuleService; + + /** + * desc:积分规则-获取客户有积分规则的功能列表 + * + * @param tokenDTO + * @return + */ + @PostMapping(value = "functionlist") + public Result> getFunctionList(@LoginUser TokenDto tokenDTO) { + return new Result>().ok(pointRuleService.getFunctionList(tokenDTO.getCustomerId())); + } + + /** + * desc:根据功能id获取积分规则 + * + * @param tokenDTO + * @param formDTO + * @return + */ + @PostMapping(value = "list") + public Result> list(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(pointRuleService.list(formDTO)); + } + + /** + * desc:根据规则id获取积分规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "detail") + public Result detail(@RequestBody PointDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(pointRuleService.detail(formDTO)); + } + + /** + * desc:根据功能id获取积分规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "update") + public Result update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + pointRuleService.update(tokenDTO,formDTO); + return new Result().ok(true); + } + + /** + * desc:添加规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "add") + public Result add(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + pointRuleService.add(tokenDTO,formDTO); + return new Result().ok(true); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java index 3ab8e48b42..2c8f5a214a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.PointRuleListFormDTO; import com.epmet.entity.PointRuleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 积分规则表 @@ -29,5 +33,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PointRuleDao extends BaseDao { - + + /** + * desc:获取该客户下有规则的功能Id + * + * @param customerId + * @return + */ + List selectFunctionIds(@Param("customerId") String customerId); + + /** + * desc:获取该客户下有规则的功能Id + * + * @param formDTO + * @return + */ + List selectListByFunctionId(PointRuleListFormDTO formDTO); + + int updateByCustomerId(PointRuleEntity entity); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java similarity index 88% rename from epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java index 2721c88716..a959af0219 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java @@ -18,7 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.SysOperateLogEntity; +import com.epmet.entity.RuleOperateLogEntity; import org.apache.ibatis.annotations.Mapper; /** @@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-07-20 */ @Mapper -public interface SysOperateLogDao extends BaseDao { +public interface RuleOperateLogDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java index affd55595e..dff7131269 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java @@ -18,12 +18,11 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; +import java.util.Objects; /** * 积分规则表 @@ -58,10 +57,10 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String eventCode; - /** - * 事件名称 来自事件表 - */ - private String eventName; + /** + * 功能分组Id + */ + private String functionId; /** * 操作类型 加积分:add;减积分:subtract @@ -81,7 +80,7 @@ public class PointRuleEntity extends BaseEpmetEntity { /** * 获得积分值 */ - private Integer pointNum; + private Integer point; /** * 获得积分单位 次:time;分钟:minute;小时:hour @@ -93,4 +92,27 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String enabledFlag; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + PointRuleEntity entity = (PointRuleEntity) o; + return Objects.equals(customerId, entity.customerId) && + Objects.equals(ruleName, entity.ruleName) && + Objects.equals(ruleDesc, entity.ruleDesc) && + Objects.equals(eventCode, entity.eventCode) && + Objects.equals(functionId, entity.functionId) && + Objects.equals(operateType, entity.operateType) && + Objects.equals(upLimit, entity.upLimit) && + Objects.equals(upLimitDesc, entity.upLimitDesc) && + Objects.equals(point, entity.point) && + Objects.equals(pointUnit, entity.pointUnit) && + Objects.equals(enabledFlag, entity.enabledFlag); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, functionId, operateType, upLimit, upLimitDesc, point, pointUnit, enabledFlag); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java similarity index 84% rename from epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java index 4068bba53b..b1bfa7c61a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 积分系统操作记录表 * @@ -33,8 +30,8 @@ import java.util.Date; */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("sys_operate_log") -public class SysOperateLogEntity extends BaseEpmetEntity { +@TableName("rule_operate_log") +public class RuleOperateLogEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -44,14 +41,9 @@ public class SysOperateLogEntity extends BaseEpmetEntity { private String customerId; /** - * 操作对象ID - */ - private String objectId; - - /** - * 对象类型 规则:rule + * 规则ID */ - private String objectType; + private String ruleId; /** * 操作类型 新建:add,编辑:edit,删除:del; @@ -66,7 +58,7 @@ public class SysOperateLogEntity extends BaseEpmetEntity { /** * 变更前数据 JSON串 */ - private String befordData; + private String beforeData; /** * 变更后数据 JSON串 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java index 3c84c43cad..fa53b5be05 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java @@ -18,12 +18,16 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.PointRuleDTO; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.PointDetailFormDTO; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.result.CustomerFunctionResultDTO; +import com.epmet.dto.result.PointDetailResultDTO; +import com.epmet.dto.result.PointRuleResultDTO; import com.epmet.entity.PointRuleEntity; import java.util.List; -import java.util.Map; /** * 积分规则表 @@ -34,62 +38,22 @@ import java.util.Map; public interface PointRuleService extends BaseService { /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-20 + * desc:根据用户id获取积分规则-功能列表 + * @param customerId + * @return */ - PageData page(Map params); + List getFunctionList(String customerId); - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-20 - */ - List list(Map params); + /** + * desc:根据客户Id 及功能Id获取规则列表 + * @param formDTO + * @return + */ + List list(PointRuleListFormDTO formDTO); - /** - * 单条查询 - * - * @param id - * @return PointRuleDTO - * @author generator - * @date 2020-07-20 - */ - PointRuleDTO get(String id); + PointDetailResultDTO detail(PointDetailFormDTO formDTO); - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-20 - */ - void save(PointRuleDTO dto); + void update(TokenDto tokenDTO, PointRuleFormDTO formDTO); - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-20 - */ - void update(PointRuleDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-20 - */ - void delete(String[] ids); + void add(TokenDto tokenDTO, PointRuleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java index 962df38027..46e78037ec 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java @@ -20,7 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.SysOperateLogDTO; -import com.epmet.entity.SysOperateLogEntity; +import com.epmet.entity.RuleOperateLogEntity; import java.util.List; import java.util.Map; @@ -31,7 +31,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-20 */ -public interface SysOperateLogService extends BaseService { +public interface SysOperateLogService extends BaseService { /** * 默认分页 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index c64ccfdc35..a0ef4fed91 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -17,23 +17,44 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.alibaba.fastjson.JSON; +import com.epmet.common.enu.PointUnitEnum; +import com.epmet.common.enu.SysResponseEnum; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.CommonOperateTypeEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.PointRuleDao; -import com.epmet.dto.PointRuleDTO; +import com.epmet.dao.RuleOperateLogDao; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.CustomerFunctionListFormDTO; +import com.epmet.dto.form.PointDetailFormDTO; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.result.CustomerFunctionResultDTO; +import com.epmet.dto.result.DefaultFunctionListResultDTO; +import com.epmet.dto.result.PointDetailResultDTO; +import com.epmet.dto.result.PointRuleResultDTO; import com.epmet.entity.PointRuleEntity; +import com.epmet.entity.RuleOperateLogEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.PointRuleService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; -import java.util.Map; +import java.util.stream.Collectors; /** * 积分规则表 @@ -41,60 +62,133 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-20 */ +@Slf4j @Service public class PointRuleServiceImpl extends BaseServiceImpl implements PointRuleService { - - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, PointRuleDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, PointRuleDTO.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 PointRuleDTO get(String id) { - PointRuleEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, PointRuleDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(PointRuleDTO dto) { - PointRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointRuleEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(PointRuleDTO dto) { - PointRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointRuleEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private RuleOperateLogDao ruleOperateLogDao; + + @Override + public List getFunctionList(String customerId) { + List result = new ArrayList<>(); + CustomerFunctionListFormDTO formDTO = new CustomerFunctionListFormDTO(); + formDTO.setCustomerId(customerId); + Result> openedFunctionResult = operCustomizeOpenFeignClient.getOpenedFunctionList(formDTO); + if (!openedFunctionResult.success()) { + log.warn("getFunctionList getOpenedFunctionList fail,result:{}", JSON.toJSONString(openedFunctionResult)); + throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getCode(), SysResponseEnum.THIRD_SERVICE_ERROR.getMsg()); + } + List resultData = openedFunctionResult.getData(); + if (CollectionUtils.isEmpty(resultData)) { + log.warn("getFunctionList customerId:{} have opened any function", customerId); + return result; + } + List functionIds = baseDao.selectFunctionIds(customerId); + if (CollectionUtils.isEmpty(functionIds)) { + log.warn("getFunctionList customerId:{} have any pointRules", customerId); + return result; + } + return resultData.stream().filter(function -> functionIds.contains(function.getFunctionId())) + .map(fun -> ConvertUtils.sourceToTarget(fun, CustomerFunctionResultDTO.class)) + .collect(Collectors.toList()); + } + + @Override + public List list(PointRuleListFormDTO formDTO) { + List result = new ArrayList<>(); + List list = baseDao.selectListByFunctionId(formDTO); + if (CollectionUtils.isEmpty(list)) { + log.warn("list functionId:{} return empty", formDTO.getFunctionId()); + return result; + } + result = list.stream().map(pointRuleEntity -> { + PointRuleResultDTO resultDTO = new PointRuleResultDTO(); + resultDTO.setRuleId(pointRuleEntity.getId()); + resultDTO.setRuleName(pointRuleEntity.getRuleName()); + resultDTO.setRuleDesc(pointRuleEntity.getRuleDesc()); + PointUnitEnum pointUnitEnum = PointUnitEnum.getEnum(pointRuleEntity.getPointUnit()); + if (pointRuleEntity == null || pointRuleEntity.getPoint() == null) { + log.error("list ruleId:{} have not pointUnit or pointNum,pointRule:{}", JSON.toJSONString(pointRuleEntity)); + return null; + } + resultDTO.setPointValue(pointRuleEntity.getPoint().toString().concat("分").concat(StrConstant.SEPARATOR).concat(pointUnitEnum.getDesc())); + return resultDTO; + }).filter(fun -> fun != null).collect(Collectors.toList()); + return result; + } + + @Override + public PointDetailResultDTO detail(PointDetailFormDTO formDTO) { + PointRuleEntity pointRuleEntity = baseDao.selectById(formDTO.getRuleId()); + if (pointRuleEntity == null) { + throw new RenException(SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getCode(), SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getMsg()); + } + PointDetailResultDTO resultDTO = ConvertUtils.sourceToTarget(pointRuleEntity, PointDetailResultDTO.class); + resultDTO.setRuleId(pointRuleEntity.getId()); + resultDTO.setEnabledFlag(NumConstant.ONE_STR.equals(pointRuleEntity.getEnabledFlag()) ? "true" : "false"); + return resultDTO; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TokenDto tokenDTO, PointRuleFormDTO formDTO) { + validateEnableFlag(formDTO); + PointRuleEntity entityDB = baseDao.selectById(formDTO.getRuleId()); + //数据库不存在或者客户Id不相等 则抛出异常 + if (entityDB == null || !entityDB.getCustomerId().equals(formDTO.getCustomerId())) { + throw new RenException(SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getCode(), SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getMsg()); + } + PointRuleEntity entityNew = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class); + entityNew.setId(formDTO.getRuleId()); + entityNew.setEnabledFlag(StrConstant.TRUE.equals(formDTO.getEnabledFlag()) ? "1" : "0"); + if (entityDB.equals(entityNew)) { + log.warn("update ignore tow entity is same"); + return; + } + baseDao.updateByCustomerId(entityNew); + insertOperateRecord(tokenDTO, entityNew, entityDB, CommonOperateTypeEnum.EDIT.getCode()); + } + + private void validateEnableFlag(PointRuleFormDTO formDTO) { + if (StringUtils.isNotBlank(formDTO.getEnabledFlag()) && !StrConstant.TRUE.equals(formDTO.getEnabledFlag()) && !StrConstant.FALSE.equals(formDTO.getEnabledFlag())) { + throw new RenException(SysResponseEnum.POINT_ENABLE_FLAG_PARAM_ERROR.getCode(), SysResponseEnum.POINT_ENABLE_FLAG_PARAM_ERROR.getMsg()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void add(TokenDto tokenDTO, PointRuleFormDTO formDTO) { + validateEnableFlag(formDTO); + PointRuleEntity entity = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class); + baseDao.insert(entity); + insertOperateRecord(tokenDTO, entity, null, CommonOperateTypeEnum.ADD.getCode()); + } + + private void insertOperateRecord(TokenDto tokenDTO, PointRuleEntity entityNew, PointRuleEntity entityDB, String opType) { + RuleOperateLogEntity record = new RuleOperateLogEntity(); + if (tokenDTO != null) { + CustomerStaffDTO userInfo = getCustomerStaff(tokenDTO.getUserId()); + record.setOpUser(userInfo.getRealName()); + } else { + record.setOpUser(Constant.APP_USER_FLAG); + } + record.setCustomerId(entityNew.getCustomerId()); + record.setRuleId(entityNew.getId()); + record.setOpType(opType); + record.setBeforeData(entityDB == null ? null : JSON.toJSONString(entityDB)); + record.setAfterData(JSON.toJSONString(entityNew)); + ruleOperateLogDao.insert(record); + } + + private CustomerStaffDTO getCustomerStaff(String userId) { + Result resultStaff = epmetUserOpenFeignClient.getCustomerStaff(userId); + if (!resultStaff.success() || null == resultStaff.getData()) { + throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getMsg()); + } + return resultStaff.getData(); + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java index 59604433bf..b309d3f7a0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java @@ -20,12 +20,12 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.dao.SysOperateLogDao; +import com.epmet.dao.RuleOperateLogDao; import com.epmet.dto.SysOperateLogDTO; -import com.epmet.entity.SysOperateLogEntity; +import com.epmet.entity.RuleOperateLogEntity; import com.epmet.service.SysOperateLogService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -42,11 +42,11 @@ import java.util.Map; * @since v1.0.0 2020-07-20 */ @Service -public class SysOperateLogServiceImpl extends BaseServiceImpl implements SysOperateLogService { +public class SysOperateLogServiceImpl extends BaseServiceImpl implements SysOperateLogService { @Override public PageData page(Map params) { - IPage page = baseDao.selectPage( + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); @@ -55,15 +55,15 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, SysOperateLogDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; @@ -71,21 +71,21 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl + + ${appname} @@ -125,11 +127,13 @@ 15 - - + ERROR ACCEPT DENY + ${webHook} + ${secret} + ${appname} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml index 539d926b29..481ab2dc18 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml @@ -9,11 +9,10 @@ - - + @@ -23,6 +22,18 @@ - - + + + + UPDATE point_rule + SET + POINT = #{point,jdbcType=INTEGER}, + ENABLED_FLAG = #{enabledFlag,jdbcType=VARCHAR}, + UP_LIMIT = #{upLimit,jdbcType=INTEGER} + WHERE id = #{id,jdbcType=VARCHAR} and CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml similarity index 71% rename from epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml rename to epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml index 0fe2621044..0569aa74b5 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml @@ -1,16 +1,15 @@ - + - + - - + - + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java index 2a4c2227fc..458176f17d 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java @@ -83,6 +83,11 @@ public class CodeCustomerDTO implements Serializable { */ private String status; + /** + * 二维码 + */ + private String qrCode; + /** * 乐观锁 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java index c668daeaea..65fa58f1cd 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java @@ -61,7 +61,7 @@ public class CodeOperationHistoryDTO implements Serializable { /** * 描述 */ - private String describe; + private String description; /** * 乐观锁 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java new file mode 100644 index 0000000000..6223eafc66 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java @@ -0,0 +1,86 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @CreateTime 2020/7/24 9:22 + */ +@Data +public class AuthResultRecordFormDTO implements Serializable { + + private static final long serialVersionUID = -5359209459022630868L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 第三方平台AppId 第三方平台AppId + */ + private String componentAppId; + + /** + * 微信返回创建时间 微信返回创建时间 + */ + private Date wechatCreateTime; + + /** + * 通知类型 + */ + private String InfoType; + + /** + * 授权方AppId + */ + private String AuthorizerAppid; + + /** + * 授权码(auth_code) + */ + private String AuthorizationCode; + + /** + * 授权码过期时间 + */ + private Date ExpiredTime; + + /** + * 预授权码 + */ + private String PreAuthCode; + + /** + * 删除状态 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java index 2004536f1c..1340896baf 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java @@ -44,6 +44,11 @@ public class AuthorizationInfoFormDTO implements Serializable { */ private String clientType; + /** + * 权限列表 + */ + private String funcInfo; + private Integer delFlag = 0; private String createdBy = "APP_USER"; diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java index 2e5528ea64..08f038f317 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java @@ -34,6 +34,11 @@ public class AuthorizerAccessTokenFormDTO implements Serializable { */ private String authAppid; + /** + * 客户端类型:resi居民端,work:工作端 + */ + private String clientType; + /** * 客户ID */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java index e854b15992..2806aa1145 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java @@ -20,6 +20,7 @@ public class CodeCommonFormDTO implements Serializable { * 代码ID */ private String codeId; - private Integer page; - private Integer limit; + private String path; + private Integer page = 1; + private Integer limit = 999; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java new file mode 100644 index 0000000000..a4ac48fe47 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/24 16:31 + */ +@Data +public class OpenAppIdFormDTO implements Serializable { + + private static final long serialVersionUID = 4181403694668558506L; + + /** + * 客户端类型 + */ + private String clientType; + + /** + * 客户ID + */ + private String customerId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterByAuthFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterByAuthFormDTO.java index 2d067fd589..c8c1288c12 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterByAuthFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterByAuthFormDTO.java @@ -2,43 +2,20 @@ package com.epmet.dto.form; import lombok.Data; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; import java.io.Serializable; /** * @Author sun - * @Description 运营端-根据授权状态和初始化状态获取客户列表(不分页)-接口入参 + * @Description 运营端-根据初始化状态获取公众号注册的客户列表-接口入参 */ @Data public class RegisterByAuthFormDTO implements Serializable { private static final long serialVersionUID = -6547893374373422628L; - public interface AddUserInternalGroup { - } - - /** - * 居民端是否授权(0:未授权,1:已授权) - * */ - @NotNull(message = "居民端是否授权不能为空", groups = { AddUserInternalGroup.class }) - private Integer resiAuth; - - /** - * 工作端是否授权(0:未授权,1:已授权) - * */ - @NotNull(message = "工作端是否授权不能为空", groups = { AddUserInternalGroup.class }) - private Integer workAuth; - /** * 初始化状态(0:已初始化、1:未初始化) * */ - @NotNull(message = "初始化状态不能为空", groups = { AddUserInternalGroup.class }) private Integer initState; - /** - * 所属端 resi:居民端 work:工作端 - */ - private String client; - } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java new file mode 100644 index 0000000000..773ff2d54e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/23 9:09 + */ +@Data +public class RemoveBindFormDTO implements Serializable { + + private static final long serialVersionUID = 1920195626466407047L; + + public interface RemoveBind extends CustomerClientShowGroup {} + + /** + * 客户端类型 resi:居民端 , work:工作端 + */ + @NotBlank(message = "客户端类型不能为空",groups = {RemoveBindFormDTO.RemoveBind.class}) + private String clientType; + + private String customerId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java index e88d58e3f9..222250510f 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java @@ -39,88 +39,104 @@ public class SubmitAuditFormDTO implements Serializable { /** * 预览信息(小程序页面截图和操作录屏) */ - private List previewInfo; + private PreviewInfoBean previewInfo; /** * 用户生成内容场景(UGC)信息安全声明 */ - private List ugcDeclare; + private UgcDeclareBean ugcDeclare; @NoArgsConstructor @Data - private static class ItemListBean { + public static class ItemListBean { /** * 小程序的页面,可通过获取小程序的页面列表接口获得 */ + @SerializedName("address") private String address; /** * 小程序的标签,用空格分隔,标签至多 10 个,标签长度至多 20 */ + @SerializedName("tag") private String tag; /** * 一级类目名称 */ + @SerializedName("first_class") private String firstClass; /** * 二级类目名称 */ + @SerializedName("second_class") private String secondClass; /** * 三级类目名称 */ + @SerializedName("third_class") private String thirdClass; /** * 一级类目的 ID */ + @SerializedName("first_id") private String firstId; /** * 二级类目的 ID */ + @SerializedName("second_id") private String secondId; /** * 三级类目的 ID */ + @SerializedName("third_id") private String thirdId; /** * 小程序页面的标题,标题长度至多 32 */ + @SerializedName("title") private String title; } @NoArgsConstructor @Data - private static class PreviewInfoBean { + public static class PreviewInfoBean { /** * 录屏mediaid列表,可以通过提审素材上传接口获得 */ + @SerializedName("Video_id_list") private List videoIdList; /** * 截屏mediaid列表,可以通过提审素材上传接口获得 */ + @SerializedName("pic_id_list") private List picIdList; } @NoArgsConstructor @Data - private static class UgcDeclareBean { + public static class UgcDeclareBean { /** * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 */ + @SerializedName("scene") private List scene; /** * 当scene选其他时的说明,不超时256字 */ + @SerializedName("other_scene_desc") private String otherSceneDesc; /** * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 */ + @SerializedName("method") private List method; /** * 是否有审核团队, 0.无,1.有,默认0 */ + @SerializedName("has_audit_team") private Integer hasAuditTeam; /** * 说明当前对UGC内容的审核机制,不超过256字 */ + @SerializedName("audit_desc") private String auditDesc; } } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java index 64f3483f55..64a2b42e87 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java @@ -38,9 +38,9 @@ public class UploadListFormDTO implements Serializable { /** * 页数 */ - private Integer page; + private Integer pageNo; /** * 页面条数 */ - private Integer limit; + private Integer pageSize; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java new file mode 100644 index 0000000000..2198a52459 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-手机号注册-接口返参 + */ +@Data +public class RegisterResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * userId + */ + private String userId; + + /** + * 用户微信openid + */ + private String openId; + + /** + * 用户微信unionId + */ + private String unionId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java index 5a91825392..ff62e37885 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java @@ -3,12 +3,10 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.dto.form.WxLoginFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; -import com.epmet.dto.result.InitCustomerResultDTO; -import com.epmet.dto.result.PublicCustomerResultDTO; -import com.epmet.dto.result.SaveUserResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.fallback.EpmetThirdFeignClientFallback; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.cloud.openfeign.FeignClient; @@ -106,4 +104,13 @@ public interface EpmetThirdFeignClient { **/ @PostMapping(value = "third/customermp/getcustomermsg/{appId}") Result getCustomerMsg(@PathVariable("appId") String appId); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 用户登陆,新增访问记录数据 + **/ + @PostMapping(value = "third/pacustomer/register") + Result register(@RequestBody RegisterFormDTO formDTO); } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java index fda713210f..d3d97faa1a 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java @@ -4,12 +4,10 @@ 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.UserWechatDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.dto.form.WxLoginFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; -import com.epmet.dto.result.InitCustomerResultDTO; -import com.epmet.dto.result.PublicCustomerResultDTO; -import com.epmet.dto.result.SaveUserResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetThirdFeignClient; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.stereotype.Component; @@ -65,4 +63,9 @@ public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient { public Result getCustomerMsg(String appId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getCustomerMsg", appId); } + + @Override + public Result register(RegisterFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "register", formDTO); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 494df190a6..9ee4c50dfa 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.39 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.65 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml index 60cf655960..c396270821 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.14 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.58 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 6c831bfb2f..a8b968cfb6 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.39 + 0.0.65 com.epmet @@ -135,6 +135,18 @@ 2.0.0 compile + + com.epmet + epmet-oss-client + 2.0.0 + compile + + + org.springframework + spring-test + 5.1.12.RELEASE + compile + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index 5e72094a57..1bc5e3b98b 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -22,9 +22,12 @@ public interface ModuleConstant { String AUTHORIZATION_CODE_HUMP = "AuthorizationCode"; String UNAUTHORIZED = "unauthorized"; String AUTHORIZED = "authorized"; + String UPDATE_AUTHORIZED = "updateauthorized"; String NULL_CHAR = ""; String SUCCESS = "success"; String AUTHORIZER_APP_ID_HUMP = "AuthorizerAppid"; + String PRE_AUTH_CODE_HUMP = "PreAuthCode"; + String AUTHORIZATION_CODE_EXPIRED_TIME = "AuthorizationCodeExpiredTime"; // 获取 component_access_token 如下 String COMPONENT_APPID = "component_appid"; @@ -65,13 +68,16 @@ public interface ModuleConstant { String COMPONENT_APP_ID = "component_appid"; String AUTHORIZER_APP_ID = "authorizer_appid"; String AUTHORIZER_INFO = "authorizer_info"; - String MINI_PROGRAM_INFO = "miniprograminfo"; + String MINI_PROGRAM_INFO = "MiniProgramInfo"; String BUSINESS_INFO = "business_info"; String CATEGORIES = "categories"; String NETWORK = "network"; //代码审核结果推送 如下 String EVENT = "Event"; + String MSG_TYPE = "MsgType"; + String EVENT_LOW = "event"; + String TEXT = "text"; String WEAPP_AUDIT_SUCCESS = "weapp_audit_success"; //审核通过 String WEAPP_AUDIT_FAIL = "weapp_audit_fail"; //审核不通过 String WEAPP_AUDIT_DELAY = "weapp_audit_delay"; //审核延后 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index cbed19f1c2..c381b4e2f3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -6,10 +6,6 @@ package com.epmet.constant; */ public interface PaConstant { - /** - * 手机号注册 - */ - String PHONE_EXCEPTION = "手机号已存在,不允许再次注册"; /** * 更新用户信息失败 */ @@ -22,6 +18,14 @@ public interface PaConstant { * 保存用户访问记录数据失败 */ String SAVE_VISITED_EXCEPTION = "保存用户访问记录数据失败"; + /** + * 保存用户数据失败 + */ + String SAVE_USER_EXCEPTION = "保存用户数据失败"; + /** + * 保存用户微信基本数据失败 + */ + String SAVE_WECHAT_EXCEPTION = "保存用户微信信息失败"; /** * 组织级别对应的key、name @@ -66,4 +70,8 @@ public interface PaConstant { * 获取客户信息失败 */ String SELECT_CUSTOMER_EXCEPTION = "获取客户信息失败"; + /** + * 获取访问记录表数据失败失败 + */ + String SELECT_VISITED_EXCEPTION = "获取访问记录表数据失败"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java index 13fa20c226..c6cbaa6894 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java @@ -44,7 +44,7 @@ public interface ThirdRedisKeyConstant { /** * authorization_info 授权信息 */ - String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo"; + String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo:"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java index 2e4e5e7083..b7dc98d4b4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java @@ -46,7 +46,7 @@ public interface ThirdRunTimeInfoConstant { String END_GET_AUTH_INFO = "=====================结束获取【authorization_info】====================="; - String CREATE_AND_BIND_SUCCESS = "创建开放平台帐号并绑定公众号/小程序"; + String CREATE_AND_BIND_SUCCESS = "开始创建开放平台帐号并绑定公众号/小程序"; String BIND_SUCCESS = "绑定公众号/小程序到开放平台"; @@ -82,4 +82,6 @@ public interface ThirdRunTimeInfoConstant { String VERIFY_TICKET = "msgSignature = %s, timeStamp = %s, nonce = %s, encryptType = %s, signature = %s"; + String REFRESH_AUTH_ACCESS_TOKEN = "查询到新的 授权方【access_token】"; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java index 45c8a65cb4..0ef2d05e5a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java @@ -5,6 +5,8 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.form.OpenAppIdFormDTO; +import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.service.AppLetAuthorizationService; import org.springframework.beans.factory.annotation.Autowired; @@ -36,4 +38,28 @@ public class AppLetAuthorizationController { return new Result().ok(goToAuthResultDTO); } + /** + * @Description 将公众号/小程序从开放平台帐号下解绑 + * @param tokenDto + * @param formDTO + * @author zxc + */ + @PostMapping("removeBind") + public Result removeBind(@LoginUser TokenDto tokenDto , @RequestBody RemoveBindFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,RemoveBindFormDTO.RemoveBind.class); + appLetAuthorizationService.removeBind(tokenDto,formDTO); + return new Result(); + } + + /** + * @Description 查看小程序绑定的开放平台账号 + * @param formDTO + * @author zxc + */ + @PostMapping("getopenappidbyauthappid") + public Result getOpenAppId( @RequestBody OpenAppIdFormDTO formDTO){ + String openAppId = appLetAuthorizationService.getOpenAppId(formDTO); + return new Result().ok(openAppId); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java index c24e502e47..0c61ff9ac2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java @@ -49,7 +49,7 @@ public class CodeController { * @date 2020/7/17 16:22 */ @PostMapping("getextjson") - public Result getExtJson(CodeUploadFormDTO formDTO) { + public Result getExtJson(@RequestBody CodeUploadFormDTO formDTO) { String extJson = codeService.getExtJson(formDTO); return new Result().ok(extJson); } @@ -161,9 +161,9 @@ public class CodeController { * @date 2020/7/16 10:16 */ @PostMapping("history") - public Result history(@RequestBody CodeCommonFormDTO formDTO) { + public Result> history(@RequestBody CodeCommonFormDTO formDTO) { PageData result = codeService.history(formDTO); - return new Result().ok(result); + return new Result>().ok(result.getList()); } /** @@ -175,7 +175,7 @@ public class CodeController { * @date 2020/7/17 11:20 */ @PostMapping("mediaupload") - public Result mediaUpload(@RequestBody MediaUploadFormDTO formDTO) { + public Result mediaUpload(MediaUploadFormDTO formDTO) { String result = codeService.mediaUpload(formDTO); return new Result().ok(result); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java index 519a1a4cc4..144b38aace 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java @@ -45,11 +45,8 @@ public class PaCustomerController { * @Description 公众号-手机号注册 **/ @PostMapping("register") - public Result register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class); - formDTO.setUserId(tokenDTO.getUserId()); - paCustomerService.register(formDTO); - return new Result(); + public Result register(@RequestBody RegisterFormDTO formDTO) { + return new Result().ok(paCustomerService.register(formDTO)); } /** @@ -124,11 +121,11 @@ public class PaCustomerController { * @param formDTO * @return * @Author sun - * @Description 根据授权状态和初始化状态获取客户列表(不分页) + * @Description 根据初始化状态获取公众号注册的客户列表 **/ @PostMapping(value = "registerbyauth") public Result> registerByAuth(@LoginUser TokenDto tokenDTO, @RequestBody RegisterByAuthFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, RegisterByAuthFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO); return new Result>().ok( paCustomerService.registerByAuth(formDTO)); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java index 1cb35bb666..90139540e1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java @@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j; import org.dom4j.DocumentException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -25,10 +26,10 @@ public class WarrantController { @Autowired private WarrantService warrantService; - @RequestMapping(value ="/{APPID}/callback") - public void acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, + @PostMapping(value ="/{APPID}/callback") + public String acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, HttpServletResponse response)throws IOException, DocumentException, AesException { - warrantService.acceptMessageAndEvent(request, appid, response); + return warrantService.acceptMessageAndEvent(request, appid, response); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java index ca98874003..42bb397220 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.AuthResultRecordFormDTO; import com.epmet.entity.AuthResultRecordEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface AuthResultRecordDao extends BaseDao { + + /** + * @Description 插入授权结果记录 + * @param formDTO + * @author zxc + */ + void insertAuthResultRecord(AuthResultRecordFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index 3e98b5a623..3d26bcffab 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AuthorizationInfoDTO; import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; +import com.epmet.dto.result.AuthCodeResultDTO; import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.entity.AuthorizationInfoEntity; import org.apache.ibatis.annotations.Mapper; @@ -44,13 +45,6 @@ public interface AuthorizationInfoDao extends BaseDao { */ void insertAuthorizationInfo(AuthorizationInfoFormDTO formDTO); - /** - * @Description 逻辑删除授权信息 - * @param customerId - * @author zxc - */ - void updateOldAuthorizationInfo(@Param("customerId")String customerId); - /** * 根据客户ID,客户端类型获取授权信息 * @author zhaoqifeng @@ -60,7 +54,13 @@ public interface AuthorizationInfoDao extends BaseDao { * @return com.epmet.dto.AuthorizationInfoDTO */ AuthorizationInfoDTO getAuthInfoByCustomer(@Param("customerId") String customerId, @Param("clientType") String clientType); - void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType); + + /** + * @Description 逻辑删除授权信息 + * @param authAppId + * @author zxc + */ + void updateOldAuthorizationInfo(@Param("authAppId")String authAppId); /** * @Description 查询即将过期的 authorizer_access_token @@ -81,6 +81,13 @@ public interface AuthorizationInfoDao extends BaseDao { * @param customerId * @author zxc */ - void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); + void deleteOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); + + /** + * @Description 根据 authAppId 查询客户ID和客户端类型 + * @param authAppId + * @author zxc + */ + AuthCodeResultDTO selectCustomerIdByAuthAppId(@Param("authAppId")String authAppId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java index 4ea9771d2c..9e5571029e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.BindingAccountFormDTO; import com.epmet.entity.BindingAccountEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 公众号/小程序绑定开放平台帐号表 @@ -37,5 +38,13 @@ public interface BindingAccountDao extends BaseDao { * @author zxc */ void insertBindingAccount(BindingAccountFormDTO formDTO); + + /** + * @Description 更新绑定状态 + * @param customerId + * @param authAppId + * @author zxc + */ + void updateBindStatus(@Param("customerId")String customerId,@Param("clientType")String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java index 67d38d540c..10a5710c6e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java @@ -45,7 +45,7 @@ public interface ComponentAccessTokenDao extends BaseDao { * @Description 根据appId查询客户信息 **/ PaCustomerDTO selectCustomerByAppId(@Param("appId") String appId); + + /** + * @Description 校验此小程序是不是绑定别的客户端 + * @param authAppId + * @param clientType + * @author zxc + */ + Integer checkBind(String authAppId,String clientType); + + /** + * @Description 根据客户Id和客户端类型查询AppId + * @param customerId + * @param clientType + * @author zxc + */ + String getAppId(@Param("customerId")String customerId,@Param("clientType")String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java index 2ec5ef1588..00913eac71 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java @@ -41,6 +41,13 @@ public interface OpenPlatformAccountDao extends BaseDao { * @param formDTO * @return * @Author sun - * @Description 根据所属端授权状态、初始化状态查询客户列表数据 + * @Description 根据初始化状态获取公众号注册的客户列表 **/ List selectCustomerList(RegisterByAuthFormDTO formDTO); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java index d1910601c7..943bb0a132 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java @@ -18,8 +18,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.PaUserVisitedDTO; import com.epmet.entity.PaUserVisitedEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 公众号登陆记录表 @@ -29,5 +31,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PaUserVisitedDao extends BaseDao { - + + /** + * @param openId + * @return + * @Author sun + * @Description 根据openId查询登陆访问记录数据,按时间倒序 + **/ + PaUserVisitedDTO selectByOpenId(@Param("openId") String openId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java index 8d3f6a6351..78d08c42dc 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java @@ -23,6 +23,8 @@ import com.epmet.entity.PaUserWechatEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 公众号用户信息 * @@ -38,7 +40,7 @@ public interface PaUserWechatDao extends BaseDao { * @Author sun * @Description 根据openId查询user_wechat表信息 **/ - PaUserWechatDTO selectWechatByOpenId(@Param("openId") String openId); + List selectWechatByOpenId(@Param("openId") String openId); /** * @param dto diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java index 5bd2485033..3f84ef9a4a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java @@ -83,4 +83,10 @@ public class CodeCustomerEntity extends BaseEpmetEntity { */ private String status; + /** + * 二维码 + */ + private String qrCode; + + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java index fe56ddd312..706351f4f7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java @@ -61,6 +61,6 @@ public class CodeOperationHistoryEntity extends BaseEpmetEntity { /** * 描述 */ - private String describe; + private String description; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 9317ce418e..50de85c556 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -121,8 +121,20 @@ public class RedisThird { * @author zxc */ public void setAuthInfo(AuthorizationInfoResultDTO authInfo,String customerId,String clientType){ - String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY+ThirdRedisKeyConstant.COLON+customerId+ThirdRedisKeyConstant.COLON+clientType; - redisUtils.set(key,authInfo,-1); + Map map = BeanUtil.beanToMap(authInfo, false, true); + String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType; + redisUtils.hMSet(key, map,NOT_EXPIRE); + } + + /** + * @Description 获取授权信息 + * @param customerId + * @param clientType + * @author zxc + */ + public Map getAuthInfo(String customerId,String clientType){ + String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + customerId + ThirdRedisKeyConstant.COLON + clientType; + return redisUtils.hGetAll(key); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java index 30fa445a54..fd659764b9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java @@ -2,6 +2,8 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.form.OpenAppIdFormDTO; +import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.result.GoToAuthResultDTO; /** @@ -17,4 +19,19 @@ public interface AppLetAuthorizationService { */ GoToAuthResultDTO goToAuth(TokenDto tokenDto, GoToAuthFormDTO formDTO); + /** + * @Description 将公众号/小程序从开放平台帐号下解绑 + * @param tokenDto + * @param formDTO + * @author zxc + */ + void removeBind(TokenDto tokenDto, RemoveBindFormDTO formDTO); + + /** + * @Description 查看小程序绑定的开放平台账号 + * @param formDTO + * @author zxc + */ + String getOpenAppId(OpenAppIdFormDTO formDTO); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java index 87bd164d01..a48b2b7d88 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java @@ -105,7 +105,7 @@ public interface PaCustomerService extends BaseService { * @Author sun * @Description 公众号-手机号注册 **/ - void register(RegisterFormDTO formDTO); + RegisterResultDTO register(RegisterFormDTO formDTO); /** * @return @@ -158,7 +158,7 @@ public interface PaCustomerService extends BaseService { * @param formDTO * @return * @Author sun - * @Description 根据授权状态和初始化状态获取客户列表(不分页) + * @Description 根据初始化状态获取公众号注册的客户列表 **/ List registerByAuth(RegisterByAuthFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java index 31c520d793..bc873038ac 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java @@ -99,5 +99,5 @@ public interface PaUserWechatService extends BaseService { * @Author sun * @Description 根据openId查询user_wechat表信息 **/ - PaUserWechatDTO getWechatByOpenId(String openId); + List getWechatByOpenId(String openId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java index 4ae4cfd5e1..9393704594 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java @@ -13,6 +13,6 @@ import java.io.IOException; */ public interface WarrantService { - void acceptMessageAndEvent(HttpServletRequest request,String appid,HttpServletResponse response)throws IOException, DocumentException, AesException; + String acceptMessageAndEvent(HttpServletRequest request,String appid,HttpServletResponse response)throws IOException, DocumentException, AesException; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java index a80fe2b76a..b28550c54c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -1,9 +1,22 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.constant.ModuleConstant; +import com.epmet.dao.BindingAccountDao; +import com.epmet.dao.CustomerMpDao; +import com.epmet.dao.OpenPlatformAccountDao; import com.epmet.dao.PaCustomerAgencyDao; import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.form.OpenAppIdFormDTO; +import com.epmet.dto.form.RemoveBindFormDTO; +import com.epmet.dto.result.AuthorizationInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; +import com.epmet.redis.RedisThird; import com.epmet.service.AppLetAuthorizationService; import com.epmet.service.ComponentVerifyTicketService; import com.epmet.wxapi.constant.WxMaCodeConstant; @@ -12,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.Map; + /** * @Author zxc * @CreateTime 2020/7/10 15:52 @@ -24,6 +39,17 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic private PaCustomerAgencyDao paCustomerAgencyDao; @Autowired private ComponentVerifyTicketService componentVerifyTicketService; + @Autowired + private ComponentVerifyTicketServiceImpl componentVerifyTicketServiceImpl; + @Autowired + private OpenPlatformAccountDao openPlatformAccountDao; + @Autowired + private CustomerMpDao customerMpDao; + @Autowired + private RedisThird redisThird; + @Autowired + private BindingAccountDao bindingAccountDao; + @Value("${third.platform.appId}") private String componentAppId; @@ -44,4 +70,55 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic result.setUrl(authUrl); return result; } + + /** + * @Description 将公众号/小程序从开放平台帐号下解绑 + * @param tokenDto + * @param formDTO + * @author zxc + */ + @Override + public void removeBind(TokenDto tokenDto, RemoveBindFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String clientType = formDTO.getClientType(); + //查询openAppId + String openAppId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); + //查询appId + String authAppId = customerMpDao.getAppId(customerId, clientType); + Map authInfo = redisThird.getAuthInfo(customerId, clientType); + AuthorizationInfoResultDTO authorizationInfo = componentVerifyTicketServiceImpl.mapToEntity(authInfo, AuthorizationInfoResultDTO.class); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); + jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.UN_BIND + authorizationInfo.getAuthorizer_access_token(), JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + if (!map.get(ModuleConstant.ERR_CODE).equals(NumConstant.ZERO)){ + log.error("解绑失败" + data); + throw new RenException("解绑失败" + data); + } + bindingAccountDao.updateBindStatus(customerId,clientType); + + } + + /** + * @Description 查看小程序绑定的开放平台账号 + * @param formDTO + * @author zxc + */ + @Override + public String getOpenAppId(OpenAppIdFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String clientType = formDTO.getClientType(); + String authAppId = customerMpDao.getAppId(customerId, clientType); + Map authInfo = redisThird.getAuthInfo(customerId, clientType); + AuthorizationInfoResultDTO authorizationInfo = componentVerifyTicketServiceImpl.mapToEntity(authInfo, AuthorizationInfoResultDTO.class); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.UN_BIND + authorizationInfo.getAuthorizer_access_token(), JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + if (map.containsKey(ModuleConstant.OPEN_APP_ID)){ + return map.get(ModuleConstant.OPEN_APP_ID).toString(); + } + return map.get(ModuleConstant.ERR_MSG).toString(); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java index f2e9d5fd4c..1962b917a9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java @@ -107,7 +107,7 @@ public class CodeCustomerServiceImpl extends BaseServiceImpl list = baseDao.selectCodeList(formDTO); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index 4b9bfe1757..fbaaef13fc 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -1,12 +1,12 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.epmet.commons.tools.constant.NumConstant; 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.DateUtils; -import com.epmet.commons.tools.utils.MultipartFileToFileUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CodeConstant; import com.epmet.dao.AuthorizationInfoDao; @@ -15,22 +15,22 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.OperCrmOpenFeignClient; +import com.epmet.feign.OssFeignClient; import com.epmet.service.*; -import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; -import com.epmet.wxapi.param.WxMaCodeCommitReq; -import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; -import com.epmet.wxapi.param.WxMaNewsReq; +import com.epmet.wxapi.param.*; import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -63,6 +63,10 @@ public class CodeServiceImpl implements CodeService { private CodeMediaService codeMediaService; @Autowired private CodeExtService codeExtService; + @Autowired + private OssFeignClient ossFeignClient; + @Autowired + private PaCustomerService paCustomerService; @Override public List templateList() { @@ -97,11 +101,20 @@ public class CodeServiceImpl implements CodeService { return codeExtDTO.getExtJson(); } + public static void main(String[] args) { + String json = "{\"extEnable\":true,\"extAppid\":\"wx2679392c4cc2af22\",\"directCommit\":false,\"ext\":{\"extAppid\":\"wx2679392c4cc2af22\",\"footbar\":{\"work\":{\"name\":\"工作\",\"pageTile\":\"工作\"},\"org\":{\"name\":\"组织\",\"pageTile\":\"组织\"},\"data\":{\"name\":\"数据\",\"pageTile\":\"数据\"},\"find\":{\"name\":\"更多\",\"pageTile\":\"更多\"}}}}"; + WxExtJson wxExtJson = JSONObject.parseObject(json, WxExtJson.class); + wxExtJson.setExtAppid("123456"); + wxExtJson.getExt().setExtAppid("123456"); + String extJson = JSON.toJSONString(wxExtJson); + System.out.println(extJson); + } + @Override @Transactional(rollbackFor = Exception.class) public void upload(CodeUploadFormDTO formDTO) { //是否授权 - if (customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { + if (!customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -113,20 +126,24 @@ public class CodeServiceImpl implements CodeService { throw new RenException("第三方配置不是有效的Json"); } + WxExtJson wxExtJson = JSONObject.parseObject(formDTO.getExtJson(), WxExtJson.class); + wxExtJson.setExtAppid(authInfo.getAuthorizerAppid()); + wxExtJson.getExt().setExtAppid(authInfo.getAuthorizerAppid()); + String extJson = JSON.toJSONString(wxExtJson); CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); if (null == codeExtDTO) { codeExtDTO = new CodeExtDTO(); codeExtDTO.setCustomerId(formDTO.getCustomerId()); codeExtDTO.setClientType(formDTO.getClientType()); codeExtDTO.setAppId(authInfo.getAuthorizerAppid()); - codeExtDTO.setExtJson(formDTO.getExtJson()); + codeExtDTO.setExtJson(extJson); codeExtService.save(codeExtDTO); } - codeExtDTO.setExtJson(formDTO.getExtJson()); + codeExtDTO.setExtJson(extJson); codeExtService.update(codeExtDTO); WxMaCodeCommitReq request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeCommitReq.class); - request.setExtJson(formDTO.getExtJson()); + request.setExtJson(extJson); //调用微信API上传代码 WxResult wxResult = wxMaCodeService.commit(authInfo.getAuthorizerAccessToken(), request); //上传失败,抛出异常 @@ -137,17 +154,15 @@ public class CodeServiceImpl implements CodeService { //获取客户信息 CustomerDTO customerDTO = new CustomerDTO(); customerDTO.setId(formDTO.getCustomerId()); - Result customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); - if (!customerInfo.success()) { - throw new RenException(customerInfo.getCode(), customerInfo.getMsg()); - } + PaCustomerDTO paCustomerDTO = paCustomerService.get(formDTO.getCustomerId()); //将之前上传信息删除 codeCustomerService.deleteCode(formDTO.getCustomerId(), formDTO.getClientType()); //将上传信息存入表中 CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); - codeCustomerDTO.setCustomerName(customerInfo.getData().getCustomerName()); - codeCustomerDTO.setExtJson(formDTO.getExtJson()); + codeCustomerDTO.setCustomerName(paCustomerDTO.getCustomerName()); + codeCustomerDTO.setExtJson(extJson); + codeCustomerDTO.setAppId(authInfo.getAuthorizerAppid()); codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); codeCustomerService.save(codeCustomerDTO); @@ -156,39 +171,40 @@ public class CodeServiceImpl implements CodeService { @Override public PageData uploadList(UploadListFormDTO formDTO) { - //获取小程序调用令牌 - AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); - if (null == authInfo) { - throw new RenException("未授权"); - } List auditingList = codeCustomerService.getAuditingCodeList(); - auditingList.forEach(code -> { - //获取审核结果信息 - CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); - //调用微信API获取最新审核状态 - WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); - request.setAuditId(auditResult.getAuditId()); - WxResult wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); - if (wxAuditResult.success()) { - WxMaAuditStatusResult result = wxAuditResult.getData(); - if (result.getStatus() == NumConstant.ZERO) { - code.setStatus(CodeConstant.AUDIT_SUCCESS); - auditResult.setResult(CodeConstant.AUDIT_SUCCESS); - codeOperationHistoryService.updateDescribe(code.getId(), "审核成功"); - } else if (result.getStatus() == NumConstant.ONE) { - code.setStatus(CodeConstant.AUDIT_FAILED); - auditResult.setResult(CodeConstant.AUDIT_FAILED); - auditResult.setReason(result.getReason()); - codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); - } else if (result.getStatus() == NumConstant.FOUR) { - code.setStatus(CodeConstant.DELAY); - auditResult.setResult(CodeConstant.DELAY); - codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); + if (null != auditingList && auditingList.size() > NumConstant.ZERO) { + auditingList.forEach(code -> { + //获取小程序调用令牌 + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(code.getCustomerId(), code.getClientType()); + //获取审核结果信息 + CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); + //调用微信API获取最新审核状态 + WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); + request.setAuditId(auditResult.getAuditId()); + WxResult wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); + if (wxAuditResult.success()) { + WxMaAuditStatusResult result = wxAuditResult.getData(); + if (result.getStatus() == NumConstant.ZERO) { + code.setStatus(CodeConstant.AUDIT_SUCCESS); + auditResult.setResult(CodeConstant.AUDIT_SUCCESS); + codeOperationHistoryService.updateDescribe(code.getId(), "审核成功"); + } else if (result.getStatus() == NumConstant.ONE) { + code.setStatus(CodeConstant.AUDIT_FAILED); + auditResult.setResult(CodeConstant.AUDIT_FAILED); + auditResult.setReason(result.getReason()); + auditResult.setScreenShot(result.getScreenshot()); + codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); + } else if (result.getStatus() == NumConstant.FOUR) { + code.setStatus(CodeConstant.DELAY); + auditResult.setResult(CodeConstant.DELAY); + auditResult.setReason(result.getReason()); + codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); + } + codeCustomerService.update(code); + codeAuditResultService.update(auditResult); } - codeCustomerService.update(code); - codeAuditResultService.update(auditResult); - } - }); + }); + } return codeCustomerService.getCodeList(formDTO); } @@ -197,7 +213,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -205,21 +221,35 @@ public class CodeServiceImpl implements CodeService { if (null == authInfo) { throw new RenException("未授权"); } + //调用微信API上提交审核 - WxMaCodeSubmitAuditRequest request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeSubmitAuditRequest.class); + WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest(); + request.setVersionDesc(formDTO.getVersionDesc()); + request.setFeedbackInfo(formDTO.getFeedbackInfo()); + request.setFeedbackStuff(formDTO.getFeedbackStuff()); + request.setItemList(formDTO.getItemList()); + request.setPreviewInfo(formDTO.getPreviewInfo()); + request.setUgcDeclare(formDTO.getUgcDeclare()); WxResult wxResult = wxMaCodeService.submitAudit(authInfo.getAuthorizerAccessToken(), request); if (!wxResult.success()) { saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT, wxResult.getErrorMsg()); throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); } - //将数据存入代码审核表 - CodeAuditResultDTO codeAuditResultDTO = new CodeAuditResultDTO(); - codeAuditResultDTO.setCustomerId(codeCustomerDTO.getCustomerId()); - codeAuditResultDTO.setCodeId(codeCustomerDTO.getId()); - codeAuditResultDTO.setAuditId(wxResult.getData()); - codeAuditResultDTO.setResult(CodeConstant.AUDITING); - codeAuditResultService.save(codeAuditResultDTO); + //获取审核结果信息 + CodeAuditResultDTO codeAuditResultDTO = codeAuditResultService.getAuditResultByCodeId(formDTO.getCodeId()); + if (null == codeAuditResultDTO) { + //将数据存入代码审核表 + codeAuditResultDTO = new CodeAuditResultDTO(); + codeAuditResultDTO.setCustomerId(codeCustomerDTO.getCustomerId()); + codeAuditResultDTO.setCodeId(codeCustomerDTO.getId()); + codeAuditResultDTO.setAuditId(wxResult.getData()); + codeAuditResultDTO.setResult(CodeConstant.AUDITING); + codeAuditResultService.save(codeAuditResultDTO); + } else { + codeAuditResultDTO.setResult(CodeConstant.AUDITING); + codeAuditResultService.update(codeAuditResultDTO); + } //更新代码表状态 codeCustomerDTO.setStatus(CodeConstant.AUDITING); codeCustomerService.update(codeCustomerDTO); @@ -232,7 +262,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取审核结果信息 @@ -277,7 +307,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -308,7 +338,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); @@ -342,18 +372,27 @@ public class CodeServiceImpl implements CodeService { QrCodeResultDTO result = new QrCodeResultDTO(); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); + if (null != codeCustomerDTO.getQrCode()) { + result.setQrcode(codeCustomerDTO.getQrCode()); + return result; + } //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); //调用微信API获取获取体验版二维码 - WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), null); + WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), formDTO.getPath()); + MultipartFile file = null; + file = new MockMultipartFile("file", "QRCode.jpg", "image/jpeg", wxResult.getData()); + Result uploadResult = ossFeignClient.uploadQrCode(file); + codeCustomerDTO.setQrCode(uploadResult.getData().getUrl()); + codeCustomerService.update(codeCustomerDTO); + result.setQrcode(uploadResult.getData().getUrl()); if (!wxResult.success()) { throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); } - result.setQrcode(wxResult.getData()); return result; } @@ -370,7 +409,8 @@ public class CodeServiceImpl implements CodeService { @Override public String mediaUpload(MediaUploadFormDTO formDTO) { try { - File file = MultipartFileToFileUtils.multipartFileToFile(formDTO.getMedia()); + Result uploadWxImg = ossFeignClient.uploadWxImg(formDTO.getMedia()); + File file = new File(uploadWxImg.getData().getUrl()); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //获取小程序调用令牌 @@ -383,7 +423,7 @@ public class CodeServiceImpl implements CodeService { CodeMediaDTO codeMediaDTO = new CodeMediaDTO(); codeMediaDTO.setCodeId(formDTO.getCodeId()); codeMediaDTO.setMediaId(wxResult.getData().getMediaId()); - codeMediaDTO.setMediaName(formDTO.getMedia().getName()); + codeMediaDTO.setMediaName(formDTO.getMedia().getOriginalFilename()); codeMediaDTO.setMediaType(wxResult.getData().getType()); codeMediaService.save(codeMediaDTO); return wxResult.getData().getMediaId(); @@ -399,7 +439,7 @@ public class CodeServiceImpl implements CodeService { operationDTO.setCodeId(codeId); operationDTO.setVersion(version); operationDTO.setOperation(operation); - operationDTO.setDescribe(describe); + operationDTO.setDescription(describe); codeOperationHistoryService.save(operationDTO); } @@ -420,5 +460,33 @@ public class CodeServiceImpl implements CodeService { } } + private byte[] toPrimitives(Byte[] oBytes) { + byte[] bytes = new byte[oBytes.length]; + for (int i = 0; i < oBytes.length; i++) { + bytes[i] = oBytes[i]; + } + return bytes; + } + + private void byteToFile(byte[] bytes) + { + try + { + // 根据绝对路径初始化文件 + File localFile = new File("."); + if (!localFile.exists()) + { + localFile.createNewFile(); + } + // 输出流 + OutputStream os = new FileOutputStream(localFile); + os.write(bytes); + os.close(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 30517d5cb7..85986d041e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -1,7 +1,9 @@ package com.epmet.service.impl; +import cn.hutool.core.convert.Convert; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.alibaba.nacos.client.config.utils.IOUtils; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; @@ -12,10 +14,8 @@ import com.epmet.constant.ThirdRedisKeyConstant; import com.epmet.constant.ThirdRunTimeInfoConstant; import com.epmet.dao.*; import com.epmet.dto.form.*; -import com.epmet.dto.result.AuthCodeResultDTO; -import com.epmet.dto.result.AuthorizationInfoResultDTO; -import com.epmet.dto.result.CreateOpenResultDTO; -import com.epmet.dto.result.WillOverDueResultDTO; +import com.epmet.dto.result.*; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.mpaes.WXBizMsgCrypt; import com.epmet.mpaes.WXXmlToMapUtil; import com.epmet.redis.RedisThird; @@ -32,9 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.*; @@ -79,6 +77,10 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe private MiniCategoryInfoDao miniCategoryInfoDao; @Autowired private BusinessInfoDao businessInfoDao; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private AuthResultRecordDao authResultRecordDao; @Value("${third.platform.appId}") private String componentAppId; @@ -109,20 +111,17 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String nonce = request.getParameter(ModuleConstant.NONCE); String encryptType = request.getParameter(ModuleConstant.ENCRYPT_TYPE); String signature = request.getParameter(ModuleConstant.SIGNATURE); - log.info(String.format(ThirdRunTimeInfoConstant.VERIFY_TICKET,msgSignature,timeStamp,nonce,encryptType,signature)); // 从请求中读取整个post数据 InputStream inputStream; String postData = null; inputStream = request.getInputStream(); postData= IOUtils.toString(inputStream,ModuleConstant.UTF8); - log.info("postData = "+postData); WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt(token,aesKey,componentAppId); String msg = wxBizMsgCrypt.decryptMsg(msgSignature, timeStamp, nonce, postData); log.info(String.format(ThirdRunTimeInfoConstant.MSG,msg)); // 将xml转为map Map result = WXXmlToMapUtil.xmlToMap(msg); - String infotype = result.get(ModuleConstant.INFO_TYPE); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized??? - log.info(infotype); + String infotype = result.get(ModuleConstant.INFO_TYPE); switch (infotype){ case ModuleConstant.TICKET_UNDERLINE_KEY: //接收票据 【component_verify_ticket】 String ComponentVerifyTicket = result.get(ModuleConstant.TICKET_KEY); @@ -133,29 +132,22 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe ticketFormDTO.setComponentAppId(componentAppId); ticketFormDTO.setComponentVerifyTicket(ComponentVerifyTicket); //先逻辑删 - ticketDao.updateOldComponentVerifyTicket(); + ticketDao.deleteOldComponentVerifyTicket(); ticketDao.insertComponentVerifyTicket(ticketFormDTO); log.info(ModuleConstant.TICKET_UNDERLINE_KEY+":"+ComponentVerifyTicket); break; case ModuleConstant.AUTHORIZED: //授权成功 - // 更改customer_mp 授权信息,appId,并绑定 -// String authAppId = result.get(ModuleConstant.APP_ID); - String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP); - log.info("=============================="+authCode); - AuthCodeResultDTO authCodeResultDTO = authCodeDao.selectCustomerIdByAuthCode(authCode); - String clientType = authCodeResultDTO.getClientType(); - String customerId = authCodeResultDTO.getCustomerId(); - Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); - String authAppId = authorizerRefreshToken.get("authorizerAppid").toString(); - this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType); -// this.authInfoByAuthCode(authCode, customerId,clientType); - authCodeDao.updateAppId(customerId,clientType,authAppId); - this.saveAuthAccountInfo(customerId,authAppId,clientType); -// customerMpDao.updateAuthorizationFlag(authAppId); + this.disposeAuthResult(result); + break; case ModuleConstant.UNAUTHORIZED://用户取消授权 //todo 取消授权 String authorizerAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP); customerMpDao.updateAuthorizationFlag(authorizerAppId); + this.disposeAuthResult(result); + break; + case ModuleConstant.UPDATE_AUTHORIZED://授权变更 + this.disposeAuthResult(result); + break; } } catch (Exception e) { log.error(e.getMessage()); @@ -170,6 +162,24 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe return ModuleConstant.SUCCESS; } + /** + * @Description 授权结果插入 + * @param result + * @author zxc + */ + @Transactional(rollbackFor = Exception.class) + public void disposeAuthResult(Map result){ + Map tempMap = result; + Map data = tempMap; + AuthResultRecordFormDTO authResultRecord = mapToEntity(data, AuthResultRecordFormDTO.class); + authResultRecord.setWechatCreateTime(this.sToDate(result.get(ModuleConstant.CREATE_TIME))); + if (result.containsKey(ModuleConstant.AUTHORIZATION_CODE_EXPIRED_TIME)) { + authResultRecord.setExpiredTime(this.sToDate(result.get(ModuleConstant.AUTHORIZATION_CODE_EXPIRED_TIME))); + } + authResultRecord.setComponentAppId(componentAppId); + authResultRecordDao.insertAuthResultRecord(authResultRecord); + } + /** * @Description 定时获取 (令牌,component_access_token) 第三方与微信交互使用的component_access_token * 每十分钟执行一次,判断是否有马上超时的(15分钟以内算马上超时) @@ -191,24 +201,26 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); Map hashMap = JSON.parseObject(post, Map.class); - String componentAccessToken = hashMap.get(COMPONENT_ACCESS_TOKEN).toString(); - Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); - Date expiresInTime = this.countExpirationTime(expiresIn.toString()); - if (StringUtils.isNotEmpty(componentAccessToken)) { - //令牌信息存DB - ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); - formDTO.setComponentAccessToken(componentAccessToken); - formDTO.setExpiresInTime(expiresInTime); - //先逻辑删,在插入 - log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); - componentAccessTokenDao.updateOldComponentAccessToken(); - componentAccessTokenDao.insertComponentAccessToken(formDTO); - //存缓存 - redisThird.setComponentAccessToken(componentAccessToken); - } else { - throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); + if (!hashMap.containsKey(ModuleConstant.ERR_MSG)) { + String componentAccessToken = hashMap.get(COMPONENT_ACCESS_TOKEN).toString(); + Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); + Date expiresInTime = this.countExpirationTime(expiresIn.toString()); + if (StringUtils.isNotEmpty(componentAccessToken)) { + //令牌信息存DB + ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); + formDTO.setComponentAccessToken(componentAccessToken); + formDTO.setExpiresInTime(expiresInTime); + //先逻辑删,在插入 + log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); + componentAccessTokenDao.deleteOldComponentAccessToken(); + componentAccessTokenDao.insertComponentAccessToken(formDTO); + //存缓存 + redisThird.setComponentAccessToken(componentAccessToken); + } else { + throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); + } + log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } - log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } } @@ -222,31 +234,27 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe public String preAuthCode() { log.info(START_GET_PRE_AUTH_CODE); String preAuthCode = ""; - try { - String accessToken = redisThird.getComponentAccessToken(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); - String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); - log.info(String.format(POST_RESULT,post)); - Map hashMap = JSON.parseObject(post, Map.class); - preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString(); - Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); - Date expiresInTime = this.countExpirationTime(expiresIn.toString()); - if (StringUtils.isNotEmpty(preAuthCode)) { - //预授权码 存DB - PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); - formDTO.setPreAuthToken(preAuthCode); - formDTO.setExpiresInTime(expiresInTime); - //先逻辑删除,在插入DB - preAuthTokenDao.updateOldPreAuthCode(); - preAuthTokenDao.insertPreAuthToken(formDTO); - //预授权码 放入缓存 - redisThird.setPreAuthCode(preAuthCode); - } else { - throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); - } - } catch (Exception e) { - e.printStackTrace(); + String accessToken = redisThird.getComponentAccessToken(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); + String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); + log.info(String.format(POST_RESULT,post)); + Map hashMap = JSON.parseObject(post, Map.class); + preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString(); + Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); + Date expiresInTime = this.countExpirationTime(expiresIn.toString()); + if (StringUtils.isNotEmpty(preAuthCode)) { + //预授权码 存DB + PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); + formDTO.setPreAuthToken(preAuthCode); + formDTO.setExpiresInTime(expiresInTime); + //先逻辑删除,在插入DB + preAuthTokenDao.updateOldPreAuthCode(); + preAuthTokenDao.insertPreAuthToken(formDTO); + //预授权码 放入缓存 + redisThird.setPreAuthCode(preAuthCode); + } else { + throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); } log.info(END_GET_PRE_AUTH_CODE); return preAuthCode; @@ -283,28 +291,13 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe authInfoDTO.setExpiresInTime(expiresInTime); authInfoDTO.setCustomerId(customerId); authInfoDTO.setClientType(clientType); - //先逻辑删除,在插入 - authorizationInfoDao.updateOldAuthorizationInfo(customerId,clientType); - authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); - // 2. 权限列表 - log.info(START_INSERT_FUNC_INFO); - List funcInfos = new ArrayList<>(); List func_info = authorizationInfoResultDTO.getFunc_info(); log.info("权限列表信息:"+func_info); - /*func_info.forEach(func -> { - func.forEach((key,value) -> { - FuncInfoFormDTO fu = new FuncInfoFormDTO(); - fu.setFuncscopeCategory((String) key); - Map funcScope = (Map) value; - fu.setFuncscopeId(funcScope.get(ModuleConstant.ID).toString()); - fu.setAuthorizationInfoAppid(authAppId); - fu.setCustomerId(customerId); - funcInfos.add(fu); - }); - });*/ - // todo 先逻辑删除,在插入 - /*funcInfoDao.updateOldFuncInfo(customerId,authAppId); - funcInfoDao.insertFuncInfo(funcInfos);*/ + String funcInfo = JSON.toJSONString(func_info); + authInfoDTO.setFuncInfo(funcInfo); + //先逻辑删除,在插入 + authorizationInfoDao.updateOldAuthorizationInfo(authAppId); + authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); // 授权信息放入缓存 redisThird.setAuthInfo(authorizationInfoResultDTO,customerId,clientType); //authorizer_refresh_token 放入缓存 @@ -338,27 +331,35 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String componentAccessToken = redisThird.getComponentAccessToken(); String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_AUTHORIZER_TOKEN_URL + componentAccessToken, JSON.toJSONString(jsonObject)).getData(); Map map = JSON.parseObject(data, HashMap.class); - //authorizer_access_token - String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); - String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); - String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); - Date expiresInTime = this.countExpirationTime(expiresIn); - //更新DB - AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); - AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); - BeanUtils.copyProperties(formDTO,authorizationInfo); - authorizationInfo.setAuthorizerAppid(authAppId); - formDTO.setAuthorizerAccessToken(authorizerAccessToken); - formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); - formDTO.setExpiresInTime(expiresInTime); - formDTO.setCustomerId(customerId); - formDTO.setAuthAppid(authAppId); - //先逻辑删除,在插入 - authorizationInfoDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId(),clientType); - authorizationInfoDao.insertAuthorizerAccessToken(formDTO); - - //缓存 refreshAuthorizerAccessToken - redisThird.setAuthorizerRefreshToken(authorizationInfo); + if (!map.containsKey(ModuleConstant.ERR_CODE)) { + log.info(REFRESH_AUTH_ACCESS_TOKEN); + String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); + String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); + String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); + Date expiresInTime = this.countExpirationTime(expiresIn); + //更新DB + AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); + formDTO.setAuthorizerAccessToken(authorizerAccessToken); + formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); + formDTO.setExpiresInTime(expiresInTime); + formDTO.setCustomerId(customerId); + formDTO.setAuthAppid(authAppId); + formDTO.setClientType(clientType); + AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); + BeanUtils.copyProperties(formDTO,authorizationInfo); + authorizationInfo.setAuthorizerAppid(authAppId); + //先逻辑删除,在插入 + authorizationInfoDao.deleteOldAuthorizerAccessToken(customerId, clientType); + authorizationInfoDao.insertAuthorizerAccessToken(formDTO); + //缓存 refreshAuthorizerAccessToken + redisThird.setAuthorizerRefreshToken(authorizationInfo); + AuthorizationInfoResultDTO resultDTO = new AuthorizationInfoResultDTO(); + resultDTO.setAuthorizer_access_token(authorizerAccessToken); + resultDTO.setAuthorizer_refresh_token(authorizerRefreshToken); + resultDTO.setAuthorizer_appid(authAppId); + resultDTO.setExpires_in(7200); + redisThird.setAuthInfo(resultDTO,customerId,clientType); + } }); log.info("更新authorizer_access_token成功"); } @@ -375,27 +376,31 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe public void redirectUri(TokenDto tokenDto, @RequestBody AuthCodeAndTimeFromDTO authCodeAndTime){ log.info("开始执行回调URL"); String authCode = authCodeAndTime.getAuthCode(); - String client = authCodeAndTime.getClientType(); + String clientType = authCodeAndTime.getClientType(); String expiresIn = authCodeAndTime.getExpiresIn(); - String customerId = tokenDto.getCustomerId(); - customerId = "f530774b31e0609a3c7f0f83794cda0c"; + String customerId = this.getLoginUserCustomerId(tokenDto); Date expiresInTime = this.countExpirationTime(expiresIn); - if (StringUtils.isBlank(customerId)||StringUtils.isBlank(client)||StringUtils.isBlank(authCode)||StringUtils.isBlank(expiresIn)){ - log.info("客户ID = "+customerId+", 客户端类型为 = "+client+", 授权码为 = "+authCode+", 有效期 = "+expiresIn); - } //authCode存数据库 AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setAuthCode(authCode); formDTO.setExpiresInTime(expiresInTime); - formDTO.setClientType(client); - //授权方AppId + formDTO.setClientType(clientType); formDTO.setCustomerId(customerId); log.info(formDTO.toString()); - authCodeDao.deleteCustomerAuthCode(customerId,client); + authCodeDao.deleteCustomerAuthCode(customerId,clientType); authCodeDao.insertRedirectAuthCode(formDTO); //authCode存缓存 redisThird.setAuthCode(formDTO); - this.authInfoByAuthCode(authCode, customerId,client); + // 1. 开始获取授权信息(使用授权码) + AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, customerId, clientType); + String authAppId = authorizationInfoResultDTO.getAuthorizer_appid(); + // 2. 创建开放平台账号并绑定 或者 直接绑定开放平台 + this.createAndBindOpenAccount(customerId,authAppId,clientType); + // 3. 更新 customer_mp 表授权状态和AuthAppId + this.updateCustomerMpAppId(customerId,authAppId,clientType); + authCodeDao.updateAppId(customerId,clientType,authAppId); + // 4. 保存授权方账户信息 + this.saveAuthAccountInfo(customerId,authAppId,clientType); log.info("回调结束"); } @@ -456,18 +461,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe //todo 小程序配置的类目信息插入 List categoryInfoList = new ArrayList<>(); List categories = (List) miniProgramInfo.get(ModuleConstant.CATEGORIES); - categories.forEach(category -> { - category.forEach((key,value) -> { - MiniCategoryInfoFormDTO categoryInfo = new MiniCategoryInfoFormDTO(); - categoryInfo.setCustomerId(customerId); - categoryInfo.setClientType(clientType); - categoryInfo.setCategorySort(key.toString()); - categoryInfo.setCategoryName(value.toString()); - categoryInfo.setPrimaryId(primaryId); - categoryInfoList.add(categoryInfo); + if (categories.size() != NumConstant.ZERO) { + categories.forEach(category -> { + category.forEach((key, value) -> { + MiniCategoryInfoFormDTO categoryInfo = new MiniCategoryInfoFormDTO(); + categoryInfo.setCustomerId(customerId); + categoryInfo.setClientType(clientType); + categoryInfo.setCategorySort(key.toString()); + categoryInfo.setCategoryName(value.toString()); + categoryInfo.setPrimaryId(primaryId); + categoryInfoList.add(categoryInfo); + }); }); - }); - miniCategoryInfoDao.insertCategoryInfo(categoryInfoList); + miniCategoryInfoDao.insertCategoryInfo(categoryInfoList); + } }else { log.info("授权方为公众号 并 开始插入信息"); PaInfoFormDTO paInfoFormDTO = this.mapToEntity(authorizerInfo, PaInfoFormDTO.class); @@ -493,89 +500,107 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } /** - * @Description 1.创建开放平台账号并绑定 2.回填 customer_mp appId + * @Description 回填 customer_mp appId , 更改授权状态 * @param * @author zxc */ @Transactional(rollbackFor = Exception.class) - public void updateCustomerMpAppIdAndCreateOpenPlatform(String customerId,String authAppId,String clientType){ - log.info("开始创建开放平台账号并绑定"); - Integer authCount = customerMpDao.selectAuthCount(customerId); - String openPlatformId = null; + public void updateCustomerMpAppId(String customerId,String authAppId,String clientType){ + log.info("==========回填customer_mp开始=========="); + Integer checkBindCount = customerMpDao.checkBind(authAppId, clientType); + if (checkBindCount == NumConstant.ZERO) { + AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); + formDTO.setClientType(clientType); + formDTO.setAuthAppId(authAppId); + formDTO.setCustomerId(customerId); + //回填customer_mp的appId 只需以上三个字段 + customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); + } + log.info("==========回填customer_mp结束=========="); + } + + public void createAndBindOpenAccount(String customerId,String authAppId,String clientType){ Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); String authorizerAccessToken = authorizerRefreshToken.get("authorizerAccessToken").toString(); - if (authCount==NumConstant.ZERO){ - log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); - //没有任何一个小程序/公众号授权,【先创建,再绑定】 - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); - // 此处的 access_token 为 【authorizer_access_token】 - String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); - Map map = JSON.parseObject(data, Map.class); - CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); - createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); - createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG)); - createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID)); - switch (createOpen.getErrCode()){ - case NumConstant.ONE: - log.info(CREATE_AND_BIND_SUCCESS); - break; - case NumConstant.ONE_NEG: - throw new RenException(SYSTEM_ERROR); - case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: - throw new RenException(INVALID_APP_ID); - case ModuleConstant.EIGHTY_NINE_THOUSAND: - throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + JSONObject bindInfoForm = new JSONObject(); + bindInfoForm.put(ModuleConstant.LOW_APP_ID,authAppId); + String bindResult = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_OPEN_GET + authorizerAccessToken, JSON.toJSONString(bindInfoForm)).getData(); + Map bindInfo = JSON.parseObject(bindResult, Map.class); + boolean bindStatus = bindInfo.containsKey(ModuleConstant.OPEN_APP_ID); + if (bindStatus != true) { + log.info(CREATE_AND_BIND_SUCCESS); + Integer authCount = customerMpDao.selectAuthCount(customerId); + String openPlatformId = null; + if (authCount > 0) { + openPlatformId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); } - CreateOpenFormDTO coForm = new CreateOpenFormDTO(); - coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID)); - coForm.setCustomerId(customerId); - //插入 open_platform_account 表 - openPlatformAccountDao.insertOpenPlatFormAccount(coForm); - openPlatformId = coForm.getId(); - }else if (authCount>NumConstant.ZERO){ - log.info("该客户已创建过开放平台账号,直接绑定"); - String openAppId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.LOW_APP_ID,componentAppId); - jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); - String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerRefreshToken, JSON.toJSONString(jsonObject)).getData(); - Map map = JSON.parseObject(data, Map.class); - CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); - createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); - createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG)); - switch (createOpen.getErrCode()){ - case NumConstant.ONE: - log.info(BIND_SUCCESS); - break; - case NumConstant.ONE_NEG: - throw new RenException(SYSTEM_ERROR); - case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: - throw new RenException(INVALID_APP_ID); - case ModuleConstant.EIGHTY_NINE_THOUSAND: - throw new RenException(ACCOUNT_HAS_BOUND_OPEN); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: - throw new RenException(NOT_SAME_CONTRACTOR); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: - throw new RenException(NOT_ALLOWED_OPERATE); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: - throw new RenException(TO_LIMIT); + if (authCount == NumConstant.ZERO) { + log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); + //没有任何一个小程序/公众号授权,【先创建,再绑定】 + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID, authAppId); + // 此处的 access_token 为 【authorizer_access_token】 + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + openPlatformId = map.get(ModuleConstant.OPEN_APP_ID).toString(); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode((Integer) map.get(ModuleConstant.ERR_CODE)); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); + createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID).toString()); + switch (createOpen.getErrCode()) { + case NumConstant.ZERO: + log.info(CREATE_AND_BIND_SUCCESS); + CreateOpenFormDTO coForm = new CreateOpenFormDTO(); + coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID).toString()); + coForm.setCustomerId(customerId); + //插入 open_platform_account 表 + openPlatformAccountDao.deleteOldOpenPlatFprmAccount(customerId); + openPlatformAccountDao.insertOpenPlatFormAccount(coForm); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + } + } else if (authCount > NumConstant.ZERO) { + log.info("该客户已创建过开放平台账号,直接绑定"); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID, authAppId); + jsonObject.put(ModuleConstant.OPEN_APP_ID, openPlatformId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode((Integer) map.get(ModuleConstant.ERR_CODE)); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); + switch (createOpen.getErrCode()) { + case NumConstant.ZERO: + log.info(BIND_SUCCESS); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: + throw new RenException(NOT_SAME_CONTRACTOR); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: + throw new RenException(NOT_ALLOWED_OPERATE); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: + throw new RenException(TO_LIMIT); + } } + //插入 binding_account + BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); + bindingAccount.setOpenPlatformAccountId(openPlatformId); + bindingAccount.setAuthAppId(authAppId); + bindingAccount.setClientType(clientType); + bindingAccount.setCustomerId(customerId); + bindingAccountDao.insertBindingAccount(bindingAccount); + log.info("创建绑定账号结束"); } - AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); - formDTO.setClientType(clientType); - formDTO.setAuthAppId(authAppId); - formDTO.setCustomerId(customerId); - //回填customer_mp的appId 只需以上三个字段 - customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); - //插入 binding_account - BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); - bindingAccount.setOpenPlatformAccountId(openPlatformId); - bindingAccount.setAuthAppId(authAppId); - bindingAccount.setClientType(clientType); - bindingAccount.setCustomerId(customerId); - bindingAccountDao.insertBindingAccount(bindingAccount); - log.info("创建绑定账号结束"); } /** @@ -620,4 +645,28 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe date.setTime(l); return date; } + + /** + * @Description 查询客户Id + * @param tokenDto + * @author zxc + */ + public String getLoginUserCustomerId(TokenDto tokenDto){ + LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); + BeanUtils.copyProperties(tokenDto,dto); + LoginUserDetailsResultDTO data = epmetUserOpenFeignClient.getLoginUserDetails(dto).getData(); + return data.getCustomerId(); + } + + /** + * @Description 时间戳(秒级)转换 Date + * @param t + * @author zxc + */ + public Date sToDate(String t){ + Long aLong = Long.valueOf(t + "000"); + Date date = new Date(); + date.setTime(aLong); + return date; + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index 63290cfb9f..432066c3da 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -154,14 +154,9 @@ public class PaCustomerServiceImpl extends BaseServiceImpl userList = paUserDao.selectUserByPhone(formDTO.getPhone()); - if (null != userList && userList.size() > NumConstant.ZERO) { - throw new RenException(PaConstant.PHONE_EXCEPTION); - } - - //2.校验验证码是否正确 + public RegisterResultDTO register(RegisterFormDTO formDTO) { + RegisterResultDTO resultDTO = new RegisterResultDTO(); + //0.校验验证码是否正确 String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, formDTO.getPhone()); String rightSmsCode = (String) redisUtils.get(smsCodeKey); if (!formDTO.getSmsCode().equals(rightSmsCode)) { @@ -169,31 +164,87 @@ public class PaCustomerServiceImpl extends BaseServiceImpl userList = paUserDao.selectUserByPhone(formDTO.getPhone()); + if (null != userList && userList.size() > NumConstant.ZERO) { + throw new RenException(EpmetErrorCode.MOBILE_USED.getCode()); } - //2.访问记录表新增数据 - PaUserWechatDTO dto = new PaUserWechatDTO(); - dto.setUserId(formDTO.getUserId()); - PaUserWechatEntity wechatEntity = paUserWechatDao.selectWechatByUserId(dto); - if (null == wechatEntity) { - throw new RenException(PaConstant.SELECT_WECHAT_EXCEPTION); - } - PaUserVisitedEntity visitedEntity = new PaUserVisitedEntity(); - visitedEntity.setUserId(formDTO.getUserId()); - visitedEntity.setWxOpenId(wechatEntity.getWxOpenId()); - visitedEntity.setOpenId(wechatEntity.getWxOpenId()); - visitedEntity.setPhone(formDTO.getPhone()); - if (paUserVisitedDao.insert(visitedEntity) < NumConstant.ONE) { - throw new RenException(PaConstant.SAVE_VISITED_EXCEPTION); + //2.根据token中的userId查询pa_user表数据,根据手机号是否为空判断后续是新增还是更新user数据 + PaUserEntity paUserEntity = paUserDao.selectById(formDTO.getUserId()); + + //3.手机号不为空说明是同一个微信用户用第二个手机号注册,手机为空说明当前微信用户用第一个手机号注册 + if(null != paUserEntity.getPhone() && StringUtils.isNotBlank(paUserEntity.getPhone())){ + //手机号不为空说明是同一个微信用户用第二个手机号注册,新增user和user_wechat表数据 + //3-1.user表新增数据 + PaUserEntity userEntity = new PaUserEntity(); + userEntity.setPhone(formDTO.getPhone()); + userEntity.setRealName(formDTO.getSurName()); + userEntity.setGender(formDTO.getGender().toString()); + if (paUserDao.insert(userEntity) < NumConstant.ONE) { + throw new RenException(PaConstant.SAVE_USER_EXCEPTION); + } + + //3-2.根据token中的userId查询用户的微信信息 + PaUserWechatDTO dto = new PaUserWechatDTO(); + dto.setUserId(formDTO.getUserId()); + PaUserWechatEntity wechatEntity = paUserWechatDao.selectWechatByUserId(dto); + if (null == wechatEntity) { + throw new RenException(PaConstant.SELECT_WECHAT_EXCEPTION); + } + + //3-3.新增用户微信信息 + wechatEntity.setId(null); + wechatEntity.setUserId(userEntity.getId()); + if (paUserWechatDao.insert(wechatEntity) < NumConstant.ONE) { + throw new RenException(PaConstant.SAVE_WECHAT_EXCEPTION); + } + + //3-4.访问记录表新增数据 + PaUserVisitedEntity visitedEntity = new PaUserVisitedEntity(); + visitedEntity.setUserId(userEntity.getId()); + visitedEntity.setWxOpenId(wechatEntity.getWxOpenId()); + visitedEntity.setOpenId(wechatEntity.getWxOpenId()); + visitedEntity.setPhone(formDTO.getPhone()); + if (paUserVisitedDao.insert(visitedEntity) < NumConstant.ONE) { + throw new RenException(PaConstant.SAVE_VISITED_EXCEPTION); + } + resultDTO.setUserId(userEntity.getId()); + resultDTO.setOpenId(wechatEntity.getWxOpenId()); + resultDTO.setUnionId(null == wechatEntity.getUnionId() ? "" : wechatEntity.getUnionId()); + }else { + //手机为空说明当前微信用户用第一个手机号注册,更新user表数据 + //3-1.pa_user表更新数据 + PaUserEntity userEntity = new PaUserEntity(); + userEntity.setId(formDTO.getUserId()); + userEntity.setPhone(formDTO.getPhone()); + userEntity.setRealName(formDTO.getSurName()); + userEntity.setGender(formDTO.getGender().toString()); + if (paUserDao.updateById(userEntity) < NumConstant.ONE) { + throw new RenException(PaConstant.UPDATE_USER_EXCEPTION); + } + + //3-2.访问记录表新增数据 + PaUserWechatDTO dto = new PaUserWechatDTO(); + dto.setUserId(formDTO.getUserId()); + PaUserWechatEntity wechatEntity = paUserWechatDao.selectWechatByUserId(dto); + if (null == wechatEntity) { + throw new RenException(PaConstant.SELECT_WECHAT_EXCEPTION); + } + PaUserVisitedEntity visitedEntity = new PaUserVisitedEntity(); + visitedEntity.setUserId(formDTO.getUserId()); + visitedEntity.setWxOpenId(wechatEntity.getWxOpenId()); + visitedEntity.setOpenId(wechatEntity.getWxOpenId()); + visitedEntity.setPhone(formDTO.getPhone()); + if (paUserVisitedDao.insert(visitedEntity) < NumConstant.ONE) { + throw new RenException(PaConstant.SAVE_VISITED_EXCEPTION); + } + resultDTO.setUserId(userEntity.getId()); + resultDTO.setOpenId(wechatEntity.getWxOpenId()); + resultDTO.setUnionId(null == wechatEntity.getUnionId() ? "" : wechatEntity.getUnionId()); } + + return resultDTO; } /** @@ -437,29 +488,12 @@ public class PaCustomerServiceImpl extends BaseServiceImpl registerByAuth(RegisterByAuthFormDTO formDTO) { - List resultList = new ArrayList<>(); - //1.根据是否初始化和居民端授权状态查询客户列表信息 - formDTO.setClient(PaConstant.CLIENT_RESI); - List list1 = baseDao.selectCustomerList(formDTO); - - //2.根据是否初始化和工作端授权状态查询客户列表信息 - formDTO.setClient(PaConstant.CLIENT_WORK); - List list2 = baseDao.selectCustomerList(formDTO); - - //3.取交集数据 - list1.forEach(dto->{ - list2.forEach(cu->{ - if(dto.getCustomerId().equals(cu.getCustomerId())){ - resultList.add(dto); - } - }); - }); - return resultList; + return baseDao.selectCustomerList(formDTO); } } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java index dfdb56af5f..d5acc59fb5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java @@ -20,15 +20,19 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.constant.PaConstant; import com.epmet.dao.PaCustomerDao; import com.epmet.dao.PaUserDao; +import com.epmet.dao.PaUserVisitedDao; import com.epmet.dao.PaUserWechatDao; import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.PaUserDTO; +import com.epmet.dto.PaUserVisitedDTO; import com.epmet.dto.PaUserWechatDTO; import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.dto.result.SaveUserResultDTO; @@ -39,6 +43,8 @@ import com.epmet.service.PaUserService; import com.epmet.service.PaUserWechatService; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -55,7 +61,7 @@ import java.util.Map; */ @Service public class PaUserServiceImpl extends BaseServiceImpl implements PaUserService { - + private Logger logger = LogManager.getLogger(PaUserServiceImpl.class); @Autowired private PaUserRedis paUserRedis; @Autowired @@ -64,6 +70,8 @@ public class PaUserServiceImpl extends BaseServiceImpl private PaCustomerDao paCustomerDao; @Autowired private PaUserWechatDao paUserWechatDao; + @Autowired + private PaUserVisitedDao paUserVisitedDao; @Override public PageData page(Map params) { @@ -127,11 +135,11 @@ public class PaUserServiceImpl extends BaseServiceImpl @Transactional(rollbackFor = Exception.class) public SaveUserResultDTO saveUser(WxMpUser wxMpUser) { SaveUserResultDTO resultDTO = new SaveUserResultDTO(); - //1.根据openId查询user_wechat表是否存在用户信息 - PaUserWechatDTO wechatDTO = paUserWechatService.getWechatByOpenId(wxMpUser.getOpenId()); + //1.根据openId查询user_wechat表是否存在用户信息(user表和user_wechat表数据时多对多关系) + List wechatDTO = paUserWechatService.getWechatByOpenId(wxMpUser.getOpenId()); //2.不存在则新增用户信息,存在则更新user_wechat表信息 - if (null == wechatDTO || null == wechatDTO.getId()) { + if (null == wechatDTO || wechatDTO.size() < NumConstant.ONE) { //2.1、user表新增数据 PaUserEntity userEntity = new PaUserEntity(); baseDao.insert(userEntity); @@ -151,18 +159,27 @@ public class PaUserServiceImpl extends BaseServiceImpl resultDTO.setUserId(userEntity.getId()); } else { - //2.3、更新user_wechat表数据 - PaUserWechatEntity wechatEntity = ConvertUtils.sourceToTarget(wechatDTO, PaUserWechatEntity.class); - wechatEntity.setGender(wxMpUser.getSex().toString()); - wechatEntity.setNickname(wxMpUser.getNickname()); - wechatEntity.setHeadImgUrl(null == wxMpUser.getHeadImgUrl() ? "" : wxMpUser.getHeadImgUrl()); - wechatEntity.setCountry(null == wxMpUser.getCountry() ? "" : wxMpUser.getCountry()); - wechatEntity.setProvince(null == wxMpUser.getProvince() ? "" : wxMpUser.getProvince()); - wechatEntity.setCity(null == wxMpUser.getCity() ? "" : wxMpUser.getCity()); - wechatEntity.setLanguage(null == wxMpUser.getLanguage() ? "" : wxMpUser.getLanguage()); - paUserWechatService.updateById(wechatEntity); - - resultDTO.setUserId(wechatDTO.getUserId()); + //2.3、批量更新user_wechat表数据 + List wechatEntity = ConvertUtils.sourceToTarget(wechatDTO, PaUserWechatEntity.class); + for(PaUserWechatEntity entity : wechatEntity){ + entity.setGender(wxMpUser.getSex().toString()); + entity.setNickname(wxMpUser.getNickname()); + entity.setHeadImgUrl(null == wxMpUser.getHeadImgUrl() ? "" : wxMpUser.getHeadImgUrl()); + entity.setCountry(null == wxMpUser.getCountry() ? "" : wxMpUser.getCountry()); + entity.setProvince(null == wxMpUser.getProvince() ? "" : wxMpUser.getProvince()); + entity.setCity(null == wxMpUser.getCity() ? "" : wxMpUser.getCity()); + entity.setLanguage(null == wxMpUser.getLanguage() ? "" : wxMpUser.getLanguage()); + } + paUserWechatService.updateBatchById(wechatEntity); + + //2.4、根据openid查询用户登陆访问记录表数据,按登陆时间倒序 + PaUserVisitedDTO visitedDTO = paUserVisitedDao.selectByOpenId(wxMpUser.getOpenId()); + if (null == visitedDTO || "".equals(visitedDTO.getUserId())) { + logger.error("根据openid查询用户访问记录表数据失败,openid->"+wxMpUser.getOpenId()); + throw new RenException(PaConstant.SELECT_VISITED_EXCEPTION); + } + + resultDTO.setUserId(visitedDTO.getUserId()); } //3.返回userId diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java index 9fb9089c5e..46726a9823 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java @@ -108,7 +108,7 @@ public class PaUserWechatServiceImpl extends BaseServiceImpl getWechatByOpenId(String openId) { return baseDao.selectWechatByOpenId(openId); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java index b49c04788e..c55f647789 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java @@ -65,14 +65,14 @@ public class WarrantServiceImpl implements WarrantService { */ @Transactional(rollbackFor = Exception.class) @Override - public void acceptMessageAndEvent(HttpServletRequest request, String appId, HttpServletResponse response)throws IOException, DocumentException, AesException { + public String acceptMessageAndEvent(HttpServletRequest request, String appId, HttpServletResponse response)throws IOException, DocumentException, AesException { log.info("appId:"+ appId); request.setCharacterEncoding(ModuleConstant.UTF8); String msgSignature = request.getParameter(ModuleConstant.MSG_SIGNATURE); String timeStamp = request.getParameter(ModuleConstant.TIMESTAMP); String nonce = request.getParameter(ModuleConstant.NONCE); if (!StringUtils.isNotBlank(msgSignature)) { - return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息 + return ModuleConstant.SUCCESS;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息 } InputStream inputStream; String postData = null; @@ -90,34 +90,39 @@ public class WarrantServiceImpl implements WarrantService { // 将xml转为map Map result = WXXmlToMapUtil.multilayerXmlToMap(msg); Map xml = (Map) result.get(ModuleConstant.XML); - Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); - CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(xml, CodeAuditRecordFormDTO.class); - codeAuditRecord.setWechatCreateTime(new Date(createTime)); - String toUserName = codeAuditRecord.getToUserName();//小程序原始ID - CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); - String clientType = customerIdAndClientResultDTO.getClientType(); - String customerId = customerIdAndClientResultDTO.getCustomerId(); - TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); - String authAppId = templateAndAppId.getAuthAppId(); - String templateId = templateAndAppId.getTemplateId(); - codeAuditRecord.setClientType(clientType); - codeAuditRecord.setCustomerId(customerId); - codeAuditRecord.setAuthAppId(authAppId); - codeAuditRecord.setTemplateId(templateId); - //插入 代码审核 记录 - codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); - // 修改 code_audit_result 中的代码审核结果 - String event = codeAuditRecord.getEvent(); - String codeResult = null; - switch (event){ - case ModuleConstant.WEAPP_AUDIT_SUCCESS: - codeResult = ModuleConstant.AUDIT_SUCCESS; - case ModuleConstant.WEAPP_AUDIT_FAIL: - codeResult = ModuleConstant.AUDIT_FAILED; - case ModuleConstant.WEAPP_AUDIT_DELAY: - codeResult = ModuleConstant.DELAY; + if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.EVENT_LOW)) { + Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); + CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(xml, CodeAuditRecordFormDTO.class); + codeAuditRecord.setWechatCreateTime(new Date(createTime)); + String toUserName = codeAuditRecord.getToUserName();//小程序原始ID + CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); + String clientType = customerIdAndClientResultDTO.getClientType(); + String customerId = customerIdAndClientResultDTO.getCustomerId(); + TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); + String authAppId = templateAndAppId.getAuthAppId(); + String templateId = templateAndAppId.getTemplateId(); + codeAuditRecord.setClientType(clientType); + codeAuditRecord.setCustomerId(customerId); + codeAuditRecord.setAuthAppId(authAppId); + codeAuditRecord.setTemplateId(templateId); + //插入 代码审核 记录 + codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); + // 修改 code_audit_result 中的代码审核结果 + String event = codeAuditRecord.getEvent(); + String codeResult = null; + switch (event) { + case ModuleConstant.WEAPP_AUDIT_SUCCESS: + codeResult = ModuleConstant.AUDIT_SUCCESS; + case ModuleConstant.WEAPP_AUDIT_FAIL: + codeResult = ModuleConstant.AUDIT_FAILED; + case ModuleConstant.WEAPP_AUDIT_DELAY: + codeResult = ModuleConstant.DELAY; + } + String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); + codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); + }else if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.TEXT)){ + } - String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); - codeAuditResultDao.updateAuditResult(customerId,codeCustomerId,codeResult); + return ModuleConstant.SUCCESS; } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index e98f7a4701..9302f876ff 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -33,16 +33,18 @@ public interface WxMaCodeConstant { /** * 前端地址 【授权之后的跳转的地址】 */ - String WEB_URL = "https://epmet-cloud.elinkservice.cn/third/mpweb/page/#/info?clientType="; + String WEB_URL = "https://epmet-cloud.elinkservice.cn/third/mpweb/page/#/info?clientType="; /** * 授权注册页面扫码授权 * component_appid:第三方AppId * pre_auth_code:预授权码 * redirect_uri:回调url(获取授权码) + * 上面url为扫码形式 + * 下面注释url为按钮形式 */ -// String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; - String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s#wechat_redirect"; + String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; +// String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s#wechat_redirect"; /** * 创建开放平台帐号并绑定公众号/小程序 @@ -54,11 +56,26 @@ public interface WxMaCodeConstant { */ String API_BIND_OPEN = "https://api.weixin.qq.com/cgi-bin/open/bind?access_token="; + /** + *公众号/小程序从开放平台帐号下解绑 + */ + String UN_BIND = "https://api.weixin.qq.com/cgi-bin/open/unbind?access_token="; + + /** + * 获取公众号/小程序所绑定的开放平台帐号 + */ + String OPEN_GET = "https://api.weixin.qq.com/cgi-bin/open/get?access_token="; + /** * 获取授权方的帐号基本信息 */ String API_GET_AUTHORIZER_INFO = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token="; + /** + * 获取公众号/小程序所绑定的开放平台帐号 + */ + String API_OPEN_GET = "https://api.weixin.qq.com/cgi-bin/open/get?access_token="; + /** * 为授权的小程序帐号上传小程序代码. */ @@ -143,4 +160,11 @@ public interface WxMaCodeConstant { * 新增临时素材 */ String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain"; + + /** + * 新增临时素材 + */ + String GET_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/gettemplatelist"; + + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java new file mode 100644 index 0000000000..8d6b843126 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java @@ -0,0 +1,118 @@ +package com.epmet.wxapi.param; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/27 9:19 + */ +@NoArgsConstructor +@Data +public class WxExtJson implements Serializable { + + private static final long serialVersionUID = -559311391779774945L; + @JSONField(ordinal = 1) + private boolean extEnable; + @JSONField(ordinal = 2) + private String extAppid; + @JSONField(ordinal = 3) + private boolean directCommit; + @JSONField(ordinal = 4) + private ExtBean ext; + + @NoArgsConstructor + @Data + public static class ExtBean { + @JSONField(ordinal = 1) + private String extAppid; + @JSONField(ordinal = 2) + private FootbarBean footbar; + @NoArgsConstructor + @Data + private static class FootbarBean { + @JSONField(ordinal = 1) + private WorkBean work; + @JSONField(ordinal = 2) + private OrgBean org; + @JSONField(ordinal = 3) + private DataBean data; + @JSONField(ordinal = 4) + private FindBean find; + @JSONField(ordinal = 5) + private GardenBean garden; + @JSONField(ordinal = 6) + private IssueBean issue; + @JSONField(ordinal = 7) + private GroupBean group; + + @NoArgsConstructor + @Data + private static class WorkBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class OrgBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class DataBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class FindBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class GardenBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + + } + + @NoArgsConstructor + @Data + private static class IssueBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class GroupBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + } + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java index c9fa07b8e4..38a074576f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java @@ -1,5 +1,6 @@ package com.epmet.wxapi.param; +import com.epmet.dto.form.SubmitAuditFormDTO; import com.google.gson.annotations.SerializedName; import lombok.Data; import lombok.NoArgsConstructor; @@ -36,110 +37,16 @@ public class WxMaCodeSubmitAuditRequest implements Serializable { * 审核项列表(选填,至多填写 5 项) */ @SerializedName("item_list") - private List itemList; + private List itemList; /** * 预览信息(小程序页面截图和操作录屏) */ @SerializedName("preview_info") - private List previewInfo; + private SubmitAuditFormDTO.PreviewInfoBean previewInfo; /** * 用户生成内容场景(UGC)信息安全声明 */ @SerializedName("ugc_declare") - private List ugcDeclare; + private SubmitAuditFormDTO.UgcDeclareBean ugcDeclare; - @NoArgsConstructor - @Data - private static class ItemListBean { - /** - * 小程序的页面,可通过获取小程序的页面列表接口获得 - */ - @SerializedName("address") - private String address; - /** - * 小程序的标签,用空格分隔,标签至多 10 个,标签长度至多 20 - */ - @SerializedName("tag") - private String tag; - /** - * 一级类目名称 - */ - @SerializedName("first_class") - private String firstClass; - /** - * 二级类目名称 - */ - @SerializedName("second_class") - private String secondClass; - /** - * 三级类目名称 - */ - @SerializedName("third_class") - private String thirdClass; - /** - * 一级类目的 ID - */ - @SerializedName("first_id") - private String firstId; - /** - * 二级类目的 ID - */ - @SerializedName("second_id") - private String secondId; - /** - * 三级类目的 ID - */ - @SerializedName("third_id") - private String thirdId; - /** - * 小程序页面的标题,标题长度至多 32 - */ - @SerializedName("title") - private String title; - } - - @NoArgsConstructor - @Data - private static class PreviewInfoBean { - /** - * 录屏mediaid列表,可以通过提审素材上传接口获得 - */ - @SerializedName("Video_id_list") - private List videoIdList; - /** - * 截屏mediaid列表,可以通过提审素材上传接口获得 - */ - @SerializedName("pic_id_list") - private List picIdList; - } - - @NoArgsConstructor - @Data - private static class UgcDeclareBean { - /** - * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 - */ - @SerializedName("scene") - private List scene; - /** - * 当scene选其他时的说明,不超时256字 - */ - @SerializedName("other_scene_desc") - private String otherSceneDesc; - /** - * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 - */ - @SerializedName("method") - private List method; - /** - * 是否有审核团队, 0.无,1.有,默认0 - */ - @SerializedName("has_audit_team") - private Integer hasAuditTeam; - /** - * 说明当前对UGC内容的审核机制,不超过256字 - */ - @SerializedName("audit_desc") - private String auditDesc; - } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java new file mode 100644 index 0000000000..694dd0f262 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java @@ -0,0 +1,23 @@ +package com.epmet.wxapi.param; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/17 17:44 + */ +@Data +@Component +@ConfigurationProperties(prefix = "third.domain") +public class WxMaDomainDTO { + private List requestDomain; + private List wsRequestDomain; + private List uploadDomain; + private List downloadDomain; + private List webviewDomain; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index 111dff5f06..dca678a55e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -48,7 +48,7 @@ public interface WxMaCodeService { * @author zhaoqifeng * @date 2020/7/10 15:25 */ - WxResult getQrCode(String accessToken, String path); + WxResult getQrCode(String accessToken, String path); /** * 获取授权小程序帐号的可选类目. diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java index 8ae28634de..ed715cb344 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.constant.ThirdRedisKeyConstant; import com.epmet.dto.UserWechatDTO; import com.epmet.wxapi.constant.WxLoginConstant; import com.epmet.wxapi.service.WxLoginService; @@ -45,29 +46,37 @@ public class WxLoginServiceImpl implements WxLoginService { map.put("js_code", wxCode); map.put("grant_type", "authorization_code"); map.put("component_appid", componentAppId); - String componentAccessToken = (String) redisUtils.get("epmet:wechartthird:componentaccesstoken"); + String componentAccessToken = (String) redisUtils.get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY); map.put("component_access_token", componentAccessToken); String resultStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.WXCODE_BY_OPENID, map).getData(); HashMap hashMap = JSON.parseObject(resultStr, HashMap.class); - if (null != hashMap.get("errorCode")) { + if (null != hashMap.get("errcode")) { logger.error("wxcode换取openid接口调用失败"); - throw new RenException(hashMap.get("errorMsg")); + throw new RenException(hashMap.get("errmsg")); } String openid = hashMap.get("openid"); String sessionKey = hashMap.get("session_key"); - //2.换取用户基本信息 + UserWechatDTO dto = new UserWechatDTO(); + dto.setWxOpenId(openid); + dto.setSessionKey(sessionKey); + + /*//2.换取用户基本信息 //小程序access_token - String access_token = (String) redisUtils.get("epmet:wechartthird:authinfo" + ":" + customerId + ":" + clientType); + Map accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType); + if(null==accessMap.get("authorizer_access_token")){ + logger.error("获取缓存中小程序access_token失败"); + throw new RenException("access_token获取失败"); + } Map hash = new HashMap<>(); - hash.put("access_token", access_token); + hash.put("access_token", accessMap.get("authorizer_access_token")); hash.put("openid", openid); hash.put("lang", "zh_CN"); String getStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.OPENID_TO_INFORMATION, map).getData(); HashMap resultMap = JSON.parseObject(getStr, HashMap.class); - if (null != resultMap.get("errorCode")) { + if (null != resultMap.get("errcode")) { logger.error("openid和access_token换取微信用户基本信息接口调用失败"); - throw new RenException(resultMap.get("errorMsg")); + throw new RenException(resultMap.get("errormsg")); } //3.返回结果 @@ -81,7 +90,7 @@ public class WxLoginServiceImpl implements WxLoginService { dto.setCountry(resultMap.get("country")); dto.setProvince(resultMap.get("province")); dto.setCity(resultMap.get("city")); - dto.setLanguage(resultMap.get("language")); + dto.setLanguage(resultMap.get("language"));*/ return dto; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index dfc9bb5cc9..97f7cac543 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -11,10 +11,11 @@ import com.epmet.wxapi.service.WxMaCodeService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; +import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; @@ -30,21 +31,14 @@ import java.util.List; public class WxMaCodeServiceImpl implements WxMaCodeService { private static final String ERR_CODE = "errcode"; private static final String ERR_MSG = "errmsg"; - @Value("${third.domain.requestdomain}") - private List requestDomain; - @Value("${third.domain.wsrequestdomain}") - private List wsRequestDomain; - @Value("${third.domain.uploaddomain}") - private List uploadDomain; - @Value("${third.domain.downloaddomain}") - private List downloadDomain; - @Value("${third.domain.webviewdomain}") - private List webviewDomain; + + @Autowired + private WxMaDomainDTO wxMaDomainDTO; @Override public WxResult> getTemplateList(String accessToken) { WxResult> result = new WxResult<>(); - String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + String url = WxMaCodeConstant.GET_TEMPLATE_URL + "?" + "access_token=" + accessToken; Result templateListResult = HttpClientManager.getInstance().sendGet(url, null); if (!templateListResult.success()) { result.setErrorCode(templateListResult.getCode()); @@ -54,7 +48,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { Gson gson = new Gson(); WxMaTemplateListResult templateList = gson.fromJson(templateListResult.getData(), WxMaTemplateListResult.class); result.setErrorCode(templateList.getErrCode()); - result.setErrorMsg(templateList.getErrMsg()); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(templateList.getErrCode())); result.setData(templateList.getTemplateList()); return result; } @@ -76,17 +70,18 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { } @Override - public WxResult getQrCode(String accessToken, String path) { - WxResult result = new WxResult<>(); - StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken); + public WxResult getQrCode(String accessToken, String path) { + WxResult result = new WxResult<>(); + StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token=").append(accessToken); if (StringUtils.isNotBlank(path)) { try { - url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); + url.append("&path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } - Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); + Result qrCodeResult = HttpClientManager.getInstance().getByteArray(url.toString(), null); + if (!qrCodeResult.success()) { result.setErrorCode(qrCodeResult.getCode()); result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(qrCodeResult.getCode())); @@ -153,7 +148,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { @Override public WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) { WxResult result = new WxResult<>(); - String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + String url = WxMaCodeConstant.GET_AUDIT_STATUS_URL + "?" + "access_token=" + accessToken; Result statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); if (!statusResult.success()) { result.setErrorCode(statusResult.getCode()); @@ -213,6 +208,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { return result; } Gson gson = new Gson(); + InputStream inputStream = gson.fromJson(statusResult.getData(), InputStream.class); WxMaNewsResult newsResult = gson.fromJson(statusResult.getData(), WxMaNewsResult.class); result.ok(newsResult); return result; @@ -224,10 +220,10 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { String url = WxMaCodeConstant.MODIFY_DOMAIN_URL + "?" + "access_token=" + accessToken; WxMaModifyDomainReq request = new WxMaModifyDomainReq(); request.setAction("set"); - request.setRequestDomain(requestDomain); - request.setUploadDomain(uploadDomain); - request.setWsRequestDomain(wsRequestDomain); - request.setDownloadDomain(downloadDomain); + request.setRequestDomain(wxMaDomainDTO.getRequestDomain()); + request.setUploadDomain(wxMaDomainDTO.getUploadDomain()); + request.setWsRequestDomain(wxMaDomainDTO.getWsRequestDomain()); + request.setDownloadDomain(wxMaDomainDTO.getDownloadDomain()); Result modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); if (!modifyResult.success()) { result.setErrorCode(modifyResult.getCode()); @@ -246,7 +242,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { String url = WxMaCodeConstant.SET_WEBVIEW_DOMAIN_URL + "?" + "access_token=" + accessToken; WxMaSetWebviewDomainReq request = new WxMaSetWebviewDomainReq(); request.setAction("set"); - request.setWebViewDomain(webviewDomain); + request.setWebViewDomain(wxMaDomainDTO.getWebviewDomain()); Result modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); if (!modifyResult.success()) { result.setErrorCode(modifyResult.getCode()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml index 34cba72036..82188b3697 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml @@ -105,8 +105,13 @@ third: aesKey: d6dbde92c67e11eabac1c03fd56f7847qazxswedcvg token: 1ae5f230c67f11eabac1c03fd56f7847 domain: - requestdomain: "https://epmet-cloud.elinkservice.cn" - wsrequestdomain: "https://epmet-cloud.elinkservice.cn" - uploaddomain: "https://epmet-cloud.elinkservice.cn" - downloaddomain: "https://epmet-cloud.elinkservice.cn" - webviewdomain: "https://epmet-cloud.elinkservice.cn" \ No newline at end of file + requestDomain: + - https://epmet-cloud.elinkservice.cn + wsRequestDomain: + - https://epmet-cloud.elinkservice.cn + uploadDomain: + - https://epmet-cloud.elinkservice.cn + downloadDomain: + - https://epmet-cloud.elinkservice.cn + webviewDomain: + - https://epmet-cloud.elinkservice.cn \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml index d0c2ba2654..9cc47df530 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml @@ -3,4 +3,25 @@ + + + INSERT INTO auth_result_record ( ID, COMPONENT_APP_ID, WECHAT_CREATE_TIME, INFO_TYPE, AUTHORIZER_APP_ID, AUTHORIZATION_CODE, EXPIRES_IN_TIME, PRE_AUTH_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE(UUID(),'-',''), + #{componentAppId}, + #{wechatCreateTime}, + #{InfoType}, + #{AuthorizerAppid}, + #{AuthorizationCode}, + #{ExpiredTime}, + #{PreAuthCode}, + #{delFlag}, + #{revision}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index 406a9fd06c..ec104db583 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -5,7 +5,7 @@ - INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, FUNC_INFO, CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( REPLACE ( UUID(), '-', '' ), @@ -14,6 +14,7 @@ #{authorizerAccessToken}, #{expiresInTime}, #{authorizerRefreshToken}, + #{funcInfo}, #{clientType}, #{delFlag}, #{createdBy}, @@ -25,7 +26,7 @@ - update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} + update authorization_info set del_flag = 1 where authorizer_appid = #{authAppId} @@ -41,7 +42,6 @@ WHERE del_flag = 0 AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) 900 - AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) > 0 @@ -65,9 +65,10 @@ - - update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} - + + delete from authorization_info where customer_id = #{customerId} AND client_type = #{clientType} + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml index 8547b41dcf..c745f40578 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml @@ -15,10 +15,19 @@ #{clientType}, #{delFlag}, #{revision}, - #{createDBy}, + #{createdBy}, NOW(), #{updatedBy}, NOW() ) + + + + UPDATE binding_account + SET del_flag = 1 + WHERE + customer_id = #{customerId} + AND client_type = #{clientType} + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml index 22d77316e6..dbfe38c5e7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml @@ -31,8 +31,8 @@ cc.USER_VERSION AS "version", cc.USER_DESC AS "codeInfo", cc.STATUS, - DATE_FORMAT(cc.CREATED_TIME,'%Y-%m-%d') AS "uploadTime", - IFNULL(DATE_FORMAT(car.CREATED_TIME,'%Y-%m-%d'),'') AS "auditTime", + DATE_FORMAT(cc.CREATED_TIME,'%Y-%m-%d %T') AS "uploadTime", + IFNULL(DATE_FORMAT(car.CREATED_TIME,'%Y-%m-%d %T'),'') AS "auditTime", car.AUDIT_ID FROM code_customer cc LEFT JOIN code_audit_result car ON cc.ID = car.CODE_ID AND car.DEL_FLAG = '0' diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml index 277beabe35..2e18d09f58 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml @@ -9,7 +9,7 @@ - + @@ -19,16 +19,16 @@ UPDATE code_operation_history SET - `DESCRIBE` = #{describe} + `DESCRIPTION` = #{describe} WHERE CODE_ID = #{codeId} AND OPERATION = 'audit' SELECT COMPONENT_ACCESS_TOKEN FROM component_access_token - WHERE delFlag = '0' + WHERE DEL_FLAG = '0' diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml index ba33593a48..c875223478 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml @@ -21,9 +21,9 @@ - - update component_verify_ticket set del_flag = 1 - + + DELETE FROM component_verify_ticket WHERE del_flag = 0 + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index 4612ca8c88..2024c79005 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -21,13 +21,12 @@ @@ -37,7 +36,7 @@ WHERE customer_id = #{customerId} AND del_flag = '0' - AND client = #{client} + AND client = #{clientType} @@ -51,7 +50,7 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml index efaa55adad..4b4842e478 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml @@ -12,7 +12,7 @@ VALUES ( REPLACE ( UUID(), '-', '' ), - #{openAppId}, + #{openid}, #{customerId}, #{delFlag}, #{revision}, @@ -23,12 +23,17 @@ ) + + + UPDATE open_platform_account set del_flag = 1 where customer_id = #{customerId} + + SELECT - pc.id AS "customerId", - pc.customer_name AS "customerName" + id AS "customerId", + customer_name AS "customerName" FROM - pa_customer pc - INNER JOIN customer_mp cm ON pc.id = cm.customer_id + pa_customer WHERE - pc.del_flag = '0' - AND cm.del_flag = '0' - AND pc.is_initialize = #{initState} - - AND cm.client = #{client} - AND cm.AUTHORIZATION_FLAG = #{resiAuth} - - - AND cm.client = #{client} - AND cm.AUTHORIZATION_FLAG = #{workAuth} + del_flag = '0' + + AND is_initialize = #{initState} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml index 9023e43184..76a3d7fee6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml @@ -3,5 +3,21 @@ + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/GovFootBarFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/GovFootBarFormDTO.java new file mode 100644 index 0000000000..79951ec2a3 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/GovFootBarFormDTO.java @@ -0,0 +1,11 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class GovFootBarFormDTO { + //@NotBlank(message = "客户ID不能为空") + private String customerId; +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml index f1539c2d78..cb7563abee 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.32 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.33 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 53ce3a23bc..7a38a7a7e5 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.32 + 0.3.33 com.epmet gov-mine diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java index 93fef03372..d1ab11b618 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java @@ -1,9 +1,11 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.feign.OperCustomizeFeignClient; +import com.epmet.dto.form.GovFootBarFormDTO; +import com.epmet.feign.OperCustomizeOpenFeignClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; @@ -18,19 +20,21 @@ import java.util.List; public class AppController { @Autowired - private OperCustomizeFeignClient operCustomizeFeign; + private OperCustomizeOpenFeignClient operCustomizeFeign; /** * 查询 - * @param formDTO * @return */ @PostMapping("getcustomerfootbars") - public Result> getCustomerFootBars(@RequestBody CustomerFootBarFormDTO formDTO) { - Result> result = operCustomizeFeign.getCustomerfootbars(formDTO); + public Result> getCustomerFootBars(@RequestBody GovFootBarFormDTO input) { + CustomerFootBarFormDTO form = new CustomerFootBarFormDTO(); + form.setCustomerId(input.getCustomerId()); + form.setAppType(AppClientConstant.APP_GOV); + Result> result = operCustomizeFeign.getCustomerfootbars(form); if (CollectionUtils.isEmpty(result.getData())) { - formDTO.setCustomerId("default"); - result = operCustomizeFeign.getCustomerfootbars(formDTO); + form.setCustomerId("default"); + result = operCustomizeFeign.getCustomerfootbars(form); } return result; } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java deleted file mode 100644 index a645d0d44b..0000000000 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.epmet.feign; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerFootBarDTO; -import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.feign.fallback.OperCustomizeFeignClientFallBack; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; - -@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) -public interface OperCustomizeFeignClient { - - @PostMapping(value = "/oper/customize/customerfootbar/customerfootbars", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO); - -} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java deleted file mode 100644 index 6f343f3857..0000000000 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java +++ /dev/null @@ -1,22 +0,0 @@ -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.CustomerFootBarDTO; -import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.dto.form.CustomerHomeFormDTO; -import com.epmet.dto.result.HomeDesignByCustomerResultDTO; -import com.epmet.feign.OperCustomizeFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class OperCustomizeFeignClientFallBack implements OperCustomizeFeignClient { - - @Override - public Result> getCustomerfootbars(CustomerFootBarFormDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerfootbars",formDTO); - } -} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorGridInfo.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorGridInfo.java new file mode 100644 index 0000000000..d0d0fa1d86 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorGridInfo.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:58 + */ +@Data +public class ActSponsorGridInfo implements Serializable { + private static final long serialVersionUID = -2797565581047800011L; + /** + * 网格Id + */ + private String gridId = ""; + /** + * 机关-网格名称 + */ + private String agencyGridName = ""; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorResultDTO.java new file mode 100644 index 0000000000..f7f7c955a1 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:46 + */ +@Data +public class ActSponsorResultDTO implements Serializable { + /** + * 机关组织Id + */ + private String agencyId = ""; + /** + * 机关组织名称 + */ + private String agencyName = ""; + /** + * 机关下网格列表信息 + */ + private List agencyGridList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 68391842db..2f8b962253 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -158,6 +158,16 @@ public interface GovOrgOpenFeignClient { @PostMapping("/gov/org/grid/gridsbystaffid/{staffId}") Result> listGridsbystaffid(@PathVariable("staffId") String staffId); + /** + * @return com.epmet.commons.tools.utils.Result + * @param staffId + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:47 + **/ + @PostMapping("/gov/org/customeragency/querysponsorlist/{staffId}") + Result querySponsorList(@PathVariable("staffId") String staffId); + /** * * @Description 根据网格id查询网格名称 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index f6ca2691ee..552bd16006 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -92,6 +92,18 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "listGridsbystaffid", staffId); } + /** + * @param staffId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:47 + **/ + @Override + public Result querySponsorList(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "querySponsorList", staffId); + } + @Override public Result getGridNameByGridId(BelongGridNameFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridNameByGridId", formDTO); diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index d1c7b78043..0b247eae18 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.75 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.76 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml index a6e6dd4760..a912b71cc2 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-org-server:0.3.74 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-org-server:0.3.76 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 191856ef70..3d9f8fd97c 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.75 + 0.3.76 com.epmet gov-org diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 6177a24ce6..83250c4c17 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -181,4 +181,16 @@ public class CustomerAgencyController { public Result getPublishAgencyList(@PathVariable("staffId") String staffId) { return new Result().ok(customerAgencyService.getPublishAgencyList(staffId)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param staffId + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:50 + **/ + @PostMapping("querysponsorlist/{staffId}") + Result querySponsorList(@PathVariable("staffId") String staffId){ + return new Result().ok(customerAgencyService.querySponsorList(staffId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 7f980cb8c8..8cfef54079 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -18,7 +18,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.result.ActSponsorGridInfo; import com.epmet.dto.result.StaffListResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; @@ -80,4 +82,22 @@ public interface CustomerStaffAgencyDao extends BaseDao selectActSponsorGrid(String staffId); + + /** + * @return com.epmet.dto.CustomerAgencyDTO + * @param staffId + * @author yinzuomei + * @description 根据staffId,查询我所属的组织信息 + * @Date 2020/7/23 21:10 + **/ + CustomerAgencyDTO selectMyAgency(String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 66586aeec4..cacba8512e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -169,4 +169,13 @@ public interface CustomerAgencyService extends BaseService * @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位 **/ PublishAgencyListResultDTO getPublishAgencyList(String staffId); + + /** + * @return com.epmet.dto.result.ActSponsorResultDTO + * @param staffId + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:50 + **/ + ActSponsorResultDTO querySponsorList(String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 23b07f5b93..69a1d4ec87 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -810,5 +810,25 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl list=customerStaffAgencyDao.selectActSponsorGrid(staffId); + resultDTO.setAgencyGridList(list); + return resultDTO; + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index 21d9cf139c..222d4cc6d3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -117,4 +117,28 @@ + + + + \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java new file mode 100644 index 0000000000..5a58975a7d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java @@ -0,0 +1,97 @@ +/** + * 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.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class CustomerAppDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小程序的appId + */ + private String appId; + + /** + * resi,work + */ + private String client; + + /** + * app的secret + */ + private String secret; + + /** + * 0:停用,1:启用 + */ + private Integer enableFlag; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.java new file mode 100644 index 0000000000..21b46fc61c --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.java @@ -0,0 +1,55 @@ +/** + * 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.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 客户表 app redis 缓存对象 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class CustomerAppRedisDTO implements Serializable { + private static final long serialVersionUID = -1619187268905620766L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小程序的appId + */ + private String appId; + + /** + * resi,work + */ + private String client; + + /** + * app的secret + */ + private String secret; + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java new file mode 100644 index 0000000000..bed538b63b --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java @@ -0,0 +1,42 @@ +/** + * 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.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class CustomerAppSecretFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 小程序的appId + */ + @NotBlank(message = "小程序Id不能为空") + private String appId; +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java index b14ab6036d..59a01476e7 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java @@ -1,13 +1,16 @@ package com.epmet.feign; +import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerDTO; -import org.springframework.cloud.openfeign.FeignClient; - -import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -21,6 +24,21 @@ public interface OperCrmOpenFeignClient { * @param dto * @return */ - @PostMapping("/oper/crm/getcostomerInfo") + @PostMapping("/oper/crm/customer/getcostomerInfo") Result getCustomerInfo(CustomerDTO dto); + + /** + * 获取客户appId信息 + * @param dto + * @return + */ + @PostMapping("/oper/crm/customerapp/getsecretbyappid") + Result getSecretByAppId(CustomerAppSecretFormDTO dto); + + /** + * 获取所有已配置的app信息 + * @return + */ + @PostMapping("/oper/crm/customerapp/getconfigallapp") + Result> getConfigAllApp(); } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java index 39594aa4fe..81b74a4f7c 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java @@ -3,10 +3,14 @@ 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.CustomerAppDTO; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.feign.OperCrmOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -19,4 +23,20 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result getCustomerInfo(CustomerDTO dto) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); } + + /** + * 获取客户appId信息 + * + * @param dto + * @return + */ + @Override + public Result getSecretByAppId(CustomerAppSecretFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getSecretByAppId", dto); + } + + @Override + public Result> getConfigAllApp() { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getConfigAllApp", null); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml index 1c4f6845ca..19e846598d 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.28 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.55 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml index f2e667a0b5..baadb6b7b9 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.55 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml index ddaa785107..56bcdfbcfe 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.55 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index d1eaf5367f..4fb5098016 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.28 + 0.3.55 com.epmet oper-crm diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java new file mode 100644 index 0000000000..8d6315e4aa --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java @@ -0,0 +1,89 @@ +/** + * 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.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +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.dto.CustomerAppDTO; +import com.epmet.dto.form.CustomerAppSecretFormDTO; +import com.epmet.service.CustomerAppService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 客户表 app表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@RestController +@RequestMapping("customerapp") +public class CustomerAppController { + + @Autowired + private CustomerAppService customerAppIdService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerAppIdService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerAppDTO data = customerAppIdService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerAppDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerAppIdService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerAppDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerAppIdService.update(dto); + return new Result(); + } + @PostMapping("getsecretbyappid") + public Result getSecretByAppId(@RequestBody CustomerAppSecretFormDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, DefaultGroup.class); + return new Result().ok(customerAppIdService.selectSecretByAppId(dto.getAppId())); + } + @PostMapping("getconfigallapp") + public Result> getConfigAllApp(){ + List configAllApp = customerAppIdService.getConfigAllApp(); + return new Result>().ok(configAllApp); + } + + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index c8c17dcfad..508f0ba09b 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -197,7 +197,7 @@ public class CustomerController { /** * - * 添加管理员 + * 添加根管理员(不能被取消角色的管理员) * @param form * @return */ diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java new file mode 100644 index 0000000000..b69ea9fe11 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java @@ -0,0 +1,35 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CustomerAppEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Mapper +public interface CustomerAppDao extends BaseDao { + + String selectSecretByAppId(@Param("appId") String appId); +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java new file mode 100644 index 0000000000..89d62c233d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java @@ -0,0 +1,63 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_app") +public class CustomerAppEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小程序的appId + */ + private String appId; + + /** + * resi,work + */ + private String client; + + /** + * app的secret + */ + private String secret; + + /** + * 0:停用,1:启用 + */ + private Integer enableFlag; + +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppService.java new file mode 100644 index 0000000000..db6c5de4a3 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppService.java @@ -0,0 +1,94 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CustomerAppDTO; +import com.epmet.entity.CustomerAppEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +public interface CustomerAppService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerAppIdDTO + * @author generator + * @date 2020-07-27 + */ + CustomerAppDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-27 + */ + void save(CustomerAppDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-27 + */ + void update(CustomerAppDTO dto); + + /** + * desc:获取客户app secret + * @param appId + * @return + */ + String selectSecretByAppId(String appId); + + List getConfigAllApp(); +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java new file mode 100644 index 0000000000..c245f3a06e --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java @@ -0,0 +1,130 @@ +/** + * 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.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.CustomerAppDao; +import com.epmet.dto.CustomerAppDTO; +import com.epmet.dto.CustomerAppRedisDTO; +import com.epmet.entity.CustomerAppEntity; +import com.epmet.service.CustomerAppService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.SetOperations; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.PostConstruct; +import java.util.List; +import java.util.Map; + +/** + * 客户表 app表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Slf4j +@Service +public class CustomerAppServiceImpl extends BaseServiceImpl implements CustomerAppService { + @Autowired + private RedisTemplate redisTemplate; + + @PostConstruct + private void initApp2Redis() { + SetOperations appSet = redisTemplate.opsForSet(); + List configAllApp = this.getConfigAllApp(); + if (!CollectionUtils.isEmpty(configAllApp)) { + String appKey = RedisKeys.getCustomerAppKey(); + List redisDTOS = ConvertUtils.sourceToTarget(configAllApp, CustomerAppRedisDTO.class); + if (CollectionUtils.isEmpty(redisDTOS)) { + log.error("initApp2Redis fail,convert return null"); + return; + } + redisDTOS.forEach(app -> appSet.add(appKey, app)); + log.info("initApp2Redis success"); + } + } + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerAppDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerAppDTO.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 CustomerAppDTO get(String id) { + CustomerAppEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerAppDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerAppDTO dto) { + CustomerAppEntity entity = ConvertUtils.sourceToTarget(dto, CustomerAppEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerAppDTO dto) { + CustomerAppEntity entity = ConvertUtils.sourceToTarget(dto, CustomerAppEntity.class); + updateById(entity); + } + + @Override + public String selectSecretByAppId(String appId) { + return baseDao.selectSecretByAppId(appId); + } + + @Override + public List getConfigAllApp() { + List entities = baseDao.selectList(null); + List customerAppDTOS = ConvertUtils.sourceToTarget(entities, CustomerAppDTO.class); + return customerAppDTOS; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 2dc57cd47f..238a90a94a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -158,7 +158,7 @@ public class CustomerServiceImpl extends BaseServiceImpl>> managersResult = epmetUserFeignClient.getStaffsInRoleOfOrgs(staffRoleFormDTO); if (managersResult.success()) { Map> rootAgencyManagerMap = managersResult.getData(); @@ -250,7 +250,8 @@ public class CustomerServiceImpl extends BaseServiceImpl getRoleResult = epmetUserFeignClient.getRoleOfCustomer(customerRoleForm); if (!getRoleResult.success()) { log.error("查询客户具有指定RoleKey的角色信息失败:".concat(getRoleResult.toString())); diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml new file mode 100644 index 0000000000..599ef18c59 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java index 73b4c7b500..1d5218fd4b 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java @@ -10,4 +10,8 @@ public class CustomerFootBarFormDTO { //@NotBlank(message = "客户ID不能为空") private String customerId; + // 哪一个端:gov,resi + @NotBlank(message = "app类型不能为空") + private String appType; + } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 9e81857ef7..62c90892f6 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -1,9 +1,26 @@ package com.epmet.feign; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; import org.springframework.cloud.openfeign.FeignClient; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerFunctionListFormDTO; +import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -14,4 +31,9 @@ import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeOpenFeignClientFallback.class) public interface OperCustomizeOpenFeignClient { + @PostMapping(value = "/oper/customize/customerfootbar/customerfootbars", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO); + + @PostMapping(value = "/oper/customize/customerfunction/getOpenedFunctionList", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index 5c2271f1b3..3958e89268 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -1,8 +1,20 @@ 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.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +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.CustomerFunctionListFormDTO; +import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.OperCustomizeOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -11,11 +23,17 @@ import org.springframework.stereotype.Component; */ @Component public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFeignClient { + @Override + public Result> getCustomerfootbars(CustomerFootBarFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerfootbars", formDTO); + } /** - * 从缓存中查询已登录用户的基本信息以及角色等相关信息 + * 获取客户已开通的功能列表 * * @return */ - //@PostMapping(value = "/epmetuser/user/loginuserdetails", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - //Result getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto); + @Override + public Result> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO){ + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getOpenedFunctionList", formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml index 3ddc8108ca..859970bc4c 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-customize-server: container_name: oper-customize-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.23 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.24 ports: - "8089:8089" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index 47611b8c4a..73c01696fa 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.23 + 0.3.24 com.epmet oper-customize diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java index 895cbf6840..1be0943b60 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java @@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotBlank; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -104,8 +105,9 @@ public class CustomerFootBarController { public Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); String customerId = formDTO.getCustomerId(); + String appType = formDTO.getAppType(); - List footbars = customerFootBarService.listCustomerFootBars(customerId); + List footbars = customerFootBarService.listCustomerFootBars(customerId, appType); List barDTOS = new LinkedList<>(); footbars.forEach(barEntity -> { CustomerFootBarDTO barDTO = new CustomerFootBarDTO(); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java index 7c2bbda050..45f4a7ed95 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java @@ -133,8 +133,8 @@ public class CustomerFunctionController { * @param formDTO * @return */ - @PostMapping("customeropenedfunction") - public Result> customerOpenedFunction(@RequestBody CustomerFunctionListFormDTO formDTO) { - return new Result>().ok(customerFunctionService.customerOpenedFunction(formDTO)); + @PostMapping("getOpenedFunctionList") + public Result> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO) { + return new Result>().ok(customerFunctionService.getOpenedFunctionList(formDTO)); } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java index f22bc917ad..480e148b60 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java @@ -33,5 +33,6 @@ import java.util.List; @Mapper public interface CustomerFootBarDao extends BaseDao { - List listCustomerFootBars(@Param("customerId") String customerId); + List listCustomerFootBars(@Param("customerId") String customerId, + @Param("appType") String appType); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java index 8bfc92afb1..2161fc4bdc 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java @@ -48,6 +48,8 @@ public class CustomerFootBarEntity extends BaseEpmetEntity { */ private String barKey; + private String appType; + /** * 页面标题 */ @@ -63,4 +65,6 @@ public class CustomerFootBarEntity extends BaseEpmetEntity { */ private String selectedIconPath; + private Integer order; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java index f3a793793d..f38eab950d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java @@ -93,5 +93,5 @@ public interface CustomerFootBarService extends BaseService listCustomerFootBars(String customerId); + List listCustomerFootBars(String customerId, String appType); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java index 17fcb2be66..70b5c55404 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java @@ -118,5 +118,5 @@ public interface CustomerFunctionService extends BaseService customerOpenedFunction(CustomerFunctionListFormDTO formDTO); + List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java index 15336d92fc..417555be13 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java @@ -102,8 +102,8 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl listCustomerFootBars(String customerId) { - return baseDao.listCustomerFootBars(customerId); + public List listCustomerFootBars(String customerId, String appType) { + return baseDao.listCustomerFootBars(customerId, appType); } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java index 7c68f32ec1..8d57b09cdb 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -41,15 +42,15 @@ import com.epmet.entity.CustomerFunctionEntity; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerFunctionRedis; import com.epmet.service.CustomerFunctionService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 客户功能权限表 @@ -57,162 +58,185 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 */ +@Slf4j @Service public class CustomerFunctionServiceImpl extends BaseServiceImpl implements CustomerFunctionService { - @Autowired - private CustomerFunctionRedis customerFunctionRedis; - @Autowired - private FunctionDao functionDao; - @Autowired - private OperCrmFeignClient operCrmFeignClient; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, CustomerFunctionDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, CustomerFunctionDTO.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 CustomerFunctionDTO get(String id) { - CustomerFunctionEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, CustomerFunctionDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(CustomerFunctionDTO dto) { - CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(CustomerFunctionDTO dto) { - CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 运营端-获取客户功能(已勾选、未勾选)详情列表 - **/ - @Override - public CustomerFunctionListResultDTO customerFunctionList(CustomerFunctionListFormDTO formDTO) { - CustomerFunctionListResultDTO resultDTO = new CustomerFunctionListResultDTO(); - //1:调用oper-crm服务。查询客户基本信息 - Result result = operCrmFeignClient.queryCustomerInfo(formDTO.getCustomerId()); - if (!result.success() || null == result.getData()) { - throw new RenException(CustomerFunctionConstant.SELECT_CUSTOMER_EXCEPTION); - } - CustomerDTO customerDTO = result.getData(); - resultDTO.setCustomerId(customerDTO.getId()); - resultDTO.setCustomerName(customerDTO.getCustomerName()); - resultDTO.setLogo(customerDTO.getLogo()); - - //2:查询所有已上架功能列表(默认、定制功能) - List funList = functionDao.selectShopFunctionList(NumConstant.ONE); - if(null==funList||funList.size() csList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); - - //4:封装数据,客户已拥有但已下架的功能不展示 - List defaultFunctionList = new ArrayList<>(); - List customizedFunctionList = new ArrayList<>(); - funList.forEach(fun -> { - //默认功能 - if (fun.getFunctionGroup() == NumConstant.ZERO) { - DefaultFunctionListResultDTO df = new DefaultFunctionListResultDTO(); - df.setFunctionId(fun.getId()); - df.setFunctionName(fun.getFunctionName()); - csList.forEach(cs -> { - if (fun.getId().equals(cs.getFunctionId())) { - df.setFlag(true); - } - }); - defaultFunctionList.add(df); - } - //定制功能 - if (fun.getFunctionGroup() == NumConstant.ONE) { - CustomizedFunctionListResultDTO cf = new CustomizedFunctionListResultDTO(); - cf.setFunctionId(fun.getId()); - cf.setFunctionName(fun.getFunctionName()); - csList.forEach(cs -> { - if (fun.getId().equals(cs.getFunctionId())) { - cf.setFlag(true); - } - }); - customizedFunctionList.add(cf); - } - }); - resultDTO.setDefaultFunctionList(defaultFunctionList); - resultDTO.setCustomizedFunctionList(customizedFunctionList); - return resultDTO; - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 运营端-保存客户功能关系数据 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveCustomerFunction(SaveCustomerFunctionFormDTO formDTO) { - //1:逻辑删除旧的客户功能关联数据 - baseDao.updateByCustomerId(formDTO.getCustomerId()); - - //2:批量新增新的客户功能关系数据 - List entityList = new ArrayList<>(); - formDTO.getDefaultFunctionList().forEach(dfId -> { - CustomerFunctionEntity entity = new CustomerFunctionEntity(); - entity.setCustomerId(formDTO.getCustomerId()); - entity.setFunctionId(dfId); - entityList.add(entity); - }); - formDTO.getCustomizedFunctionList().forEach(cfId -> { - CustomerFunctionEntity entity = new CustomerFunctionEntity(); - entity.setCustomerId(formDTO.getCustomerId()); - entity.setFunctionId(cfId); - entityList.add(entity); - }); - insertBatch(entityList); - } - - @Override - public List customerOpenedFunction(CustomerFunctionListFormDTO formDTO) { - return null; - } + @Autowired + private CustomerFunctionRedis customerFunctionRedis; + @Autowired + private FunctionDao functionDao; + @Autowired + private OperCrmFeignClient operCrmFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerFunctionDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerFunctionDTO.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 CustomerFunctionDTO get(String id) { + CustomerFunctionEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerFunctionDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerFunctionDTO dto) { + CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerFunctionDTO dto) { + CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 运营端-获取客户功能(已勾选、未勾选)详情列表 + **/ + @Override + public CustomerFunctionListResultDTO customerFunctionList(CustomerFunctionListFormDTO formDTO) { + CustomerFunctionListResultDTO resultDTO = new CustomerFunctionListResultDTO(); + //1:调用oper-crm服务。查询客户基本信息 + Result result = operCrmFeignClient.queryCustomerInfo(formDTO.getCustomerId()); + if (!result.success() || null == result.getData()) { + throw new RenException(CustomerFunctionConstant.SELECT_CUSTOMER_EXCEPTION); + } + CustomerDTO customerDTO = result.getData(); + resultDTO.setCustomerId(customerDTO.getId()); + resultDTO.setCustomerName(customerDTO.getCustomerName()); + resultDTO.setLogo(customerDTO.getLogo()); + + //2:查询所有已上架功能列表(默认、定制功能) + List funList = functionDao.selectShopFunctionList(NumConstant.ONE); + if (null == funList || funList.size() < NumConstant.ONE) { + return resultDTO; + } + + //3:查询当前客户已拥有的功能 + List csList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); + + //4:封装数据,客户已拥有但已下架的功能不展示 + List defaultFunctionList = new ArrayList<>(); + List customizedFunctionList = new ArrayList<>(); + funList.forEach(fun -> { + //默认功能 + if (fun.getFunctionGroup() == NumConstant.ZERO) { + DefaultFunctionListResultDTO df = new DefaultFunctionListResultDTO(); + df.setFunctionId(fun.getId()); + df.setFunctionName(fun.getFunctionName()); + csList.forEach(cs -> { + if (fun.getId().equals(cs.getFunctionId())) { + df.setFlag(true); + } + }); + defaultFunctionList.add(df); + } + //定制功能 + if (fun.getFunctionGroup() == NumConstant.ONE) { + CustomizedFunctionListResultDTO cf = new CustomizedFunctionListResultDTO(); + cf.setFunctionId(fun.getId()); + cf.setFunctionName(fun.getFunctionName()); + csList.forEach(cs -> { + if (fun.getId().equals(cs.getFunctionId())) { + cf.setFlag(true); + } + }); + customizedFunctionList.add(cf); + } + }); + resultDTO.setDefaultFunctionList(defaultFunctionList); + resultDTO.setCustomizedFunctionList(customizedFunctionList); + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 运营端-保存客户功能关系数据 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveCustomerFunction(SaveCustomerFunctionFormDTO formDTO) { + //1:逻辑删除旧的客户功能关联数据 + baseDao.updateByCustomerId(formDTO.getCustomerId()); + + //2:批量新增新的客户功能关系数据 + List entityList = new ArrayList<>(); + formDTO.getDefaultFunctionList().forEach(dfId -> { + CustomerFunctionEntity entity = new CustomerFunctionEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setFunctionId(dfId); + entityList.add(entity); + }); + formDTO.getCustomizedFunctionList().forEach(cfId -> { + CustomerFunctionEntity entity = new CustomerFunctionEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setFunctionId(cfId); + entityList.add(entity); + }); + insertBatch(entityList); + } + + @Override + public List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())) { + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + List result = new ArrayList<>(); + //查询所有已上架功能列表(默认、定制功能) + List funList = functionDao.selectFunctionList(); + if (CollectionUtils.isEmpty(funList)) { + return result; + } + //查询当前客户已拥有的功能 + List openedList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(openedList)) { + log.warn("getOpenedFunctionList customerId:{} have any function", formDTO.getCustomerId()); + return result; + } + Set openedFunIdSet = openedList.stream().map(CustomerFunctionDTO::getFunctionId).collect(Collectors.toSet()); + return funList.stream().filter(fun -> openedFunIdSet.contains(fun.getId())) + .map(fun -> { + DefaultFunctionListResultDTO resultDTO = new DefaultFunctionListResultDTO(); + resultDTO.setFunctionId(fun.getId()); + resultDTO.setFunctionName(fun.getFunctionName()); + return resultDTO; + }).collect(Collectors.toList()); + } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql new file mode 100644 index 0000000000..dc5ac2da3f --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql @@ -0,0 +1,11 @@ +alter table customer_foot_bar add column `app_type` varchar(20) not null after `CUSTOMER_ID`; +alter table customer_foot_bar add column `order` int(2) not null after `SELECTED_ICON_PATH`; + +update customer_foot_bar set `app_type`='gov' , `order`=1 where CUSTOMER_ID='default' and BAR_KEY='work'; +update customer_foot_bar set `app_type`='gov' , `order`=2 where CUSTOMER_ID='default' and BAR_KEY='org'; +update customer_foot_bar set `app_type`='gov' , `order`=3 where CUSTOMER_ID='default' and BAR_KEY='data'; +update customer_foot_bar set `app_type`='gov' , `order`=4 where CUSTOMER_ID='default' and BAR_KEY='find'; + +INSERT INTO epmet_oper_customize.customer_foot_bar (ID, CUSTOMER_ID, app_type, BAR_KEY, BAR_NAME, PAGE_TITLE, ICON_PATH, SELECTED_ICON_PATH, `order`, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'default', 'resi', 'garden', '党建园地', '党建园地', null, null, 1, 0, 0, 'APP_USER', now(), 'APP_USER', now()); +INSERT INTO epmet_oper_customize.customer_foot_bar (ID, CUSTOMER_ID, app_type, BAR_KEY, BAR_NAME, PAGE_TITLE, ICON_PATH, SELECTED_ICON_PATH, `order`, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'default', 'resi', 'issue', '党群议事', '党群议事', null, null, 2, 0, 0, 'APP_USER', now(), 'APP_USER', now()); +INSERT INTO epmet_oper_customize.customer_foot_bar (ID, CUSTOMER_ID, app_type, BAR_KEY, BAR_NAME, PAGE_TITLE, ICON_PATH, SELECTED_ICON_PATH, `order`, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'default', 'resi', 'group', '楼院小组', '楼院小组', null, null, 3, 0, 0, 'APP_USER', now(), 'APP_USER', now()); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml index a11df38ba6..e41b42ddb3 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml @@ -7,9 +7,11 @@ + + @@ -21,13 +23,31 @@ diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml index a8b5a7a663..20aac7e3ec 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-guide-server:0.3.17 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-guide-server:0.3.18 ports: - "8091:8091" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml index 3aef647382..3fde6f4ec8 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-guide-server:0.3.17 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-guide-server:0.3.18 ports: - "8091:8091" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index d93427f6b0..48851b561e 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.17 + 0.3.18 com.epmet resi-guide diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java new file mode 100644 index 0000000000..b29c4099d7 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java @@ -0,0 +1,10 @@ +package com.epmet.resi.mine.dto.from; + +import lombok.Data; + +@Data +public class ResiFootBarFormDTO { + + private String customerId; + +} diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml index 8e4d0f9d56..7863b22fa0 100644 --- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.29 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.30 ports: - "8094:8094" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index 37e10716a0..73700bf6ec 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.29 + 0.3.30 com.epmet resi-mine @@ -83,6 +83,13 @@ 2.0.0 compile + + + com.epmet + oper-customize-client + 2.0.0 + compile + diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java new file mode 100644 index 0000000000..a446f0dc1b --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java @@ -0,0 +1,39 @@ +package com.epmet.modules.app.controller; + +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.resi.mine.dto.from.ResiFootBarFormDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("app") +public class AppController { + + @Autowired + private OperCustomizeOpenFeignClient operCustomizeFeign; + + @PostMapping("footbar") + public Result getResiFootBars(@RequestBody ResiFootBarFormDTO input) { + CustomerFootBarFormDTO form = new CustomerFootBarFormDTO(); + form.setCustomerId(input.getCustomerId()); + form.setAppType(AppClientConstant.APP_RESI); + Result> result = operCustomizeFeign.getCustomerfootbars(form); + if (CollectionUtils.isEmpty(result.getData())) { + form.setCustomerId("default"); + result = operCustomizeFeign.getCustomerfootbars(form); + } + return result; + + } + +} diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 5137c630ed..a9f630c5e0 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.23 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.24 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 15c4000109..41652ae4d5 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.24 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index be5e1ee040..20bfb7607a 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.24 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 747107e901..97029c52f2 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.23 + 0.3.24 epmet-openapi-scan jar diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java index a23795e538..8d7aa5d4d0 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java @@ -9,9 +9,15 @@ package com.epmet.openapi.scan.common.constant; public class SysConstant { public static final String UTF8 = "utf-8"; + /** + * 文本审核最大任务数 + */ + public static final Integer MAX_TASK_SIZE = 100; - public static final Integer MAX_TEXT_TASKS = 100; - public static final Integer MAX_IMG_TASKS = 10; + /** + * 图片审核最大任务数 + */ + public static final Integer MAX_SCAN_IMG_TASK_SIZE = 10; public static final String CODE = "code"; public static final String DATA = "data"; diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 3756eb1764..2a5db725e2 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.openapi.scan.support.result.ScanTaskResult; import com.epmet.openapi.scan.support.result.SceneDetailResult; import com.epmet.openapi.scan.support.result.SyncScanResult; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; import org.apache.http.HttpStatus; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -53,29 +54,19 @@ public class ScanServiceImpl implements ScanService { textScanParam.setBizType(bizType); List textTasks = textScanParam.getTasks(); - if (CollectionUtils.isEmpty(textTasks) || textTasks.size() > SysConstant.MAX_TEXT_TASKS) { - return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg()); + if (CollectionUtils.isEmpty(textTasks) || textTasks.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); } - TextScanRequest textScanRequest = new TextScanRequest(); - textScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - textScanRequest.setEncoding(SysConstant.UTF8); - textScanRequest.setRegionId(regionId); + TextScanRequest textScanRequest = getTextScanRequest(); try { textScanRequest.setHttpContent(JSON.toJSONString(textScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { log.error("sendTextScan parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); } - - /** - * 请务必设置超时时间 - */ - textScanRequest.setConnectTimeout(3000); - textScanRequest.setReadTimeout(6000); - try { SyncScanResult textScanResult = executeSyncText(textScanRequest); return new Result().ok(textScanResult); @@ -85,24 +76,63 @@ public class ScanServiceImpl implements ScanService { } } + private TextScanRequest getTextScanRequest() { + TextScanRequest textScanRequest = new TextScanRequest(); + textScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + textScanRequest.setEncoding(SysConstant.UTF8); + textScanRequest.setRegionId(regionId); + textScanRequest.setConnectTimeout(3000); + textScanRequest.setReadTimeout(6000); + return textScanRequest; + } + @Override public Result sendSyncImgScan(ImgScanParam imgScanParam) { - ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); - imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - imageSyncScanRequest.setEncoding(SysConstant.UTF8); - imageSyncScanRequest.setRegionId(regionId); - //默认参数 // 鉴黄 暴恐涉政 imgScanParam.setScenes(ImgSceneEnum.getImgSceneList()); imgScanParam.setBizType(bizType); List imgTasks = imgScanParam.getTasks(); - if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_IMG_TASKS) { - return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg()); + if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); + } + if (imgTasks.size() <= SysConstant.MAX_SCAN_IMG_TASK_SIZE) { + return doScanImg(imgScanParam); } + log.info("sendSyncImgScan tasks size:{} over 10", imgTasks.size()); + List> partition = ListUtils.partition(imgTasks, SysConstant.MAX_SCAN_IMG_TASK_SIZE); + SyncScanResult finalResult = new SyncScanResult(); + for (List tasks : partition) { + ImgScanParam scanParam = new ImgScanParam(); + scanParam.setBizType(imgScanParam.getBizType()); + scanParam.setScenes(imgScanParam.getScenes()); + scanParam.setTasks(tasks); + scanParam.setCallback(imgScanParam.getCallback()); + scanParam.setSeed(imgScanParam.getSeed()); + Result partResult = doScanImg(scanParam); + try { + Thread.sleep(5L); + } catch (InterruptedException e) { + log.error("sendSyncImgScan InterruptedException"); + } + if (partResult.success()) { + SyncScanResult data = partResult.getData(); + finalResult.getSuccessDataIds().addAll(data.getSuccessDataIds()); + finalResult.getFailDataIds().addAll(data.getFailDataIds()); + finalResult.getDetails().addAll(data.getDetails()); + } else { + return partResult; + } + } + return new Result().ok(finalResult); + + } + + private Result doScanImg(ImgScanParam imgScanParam) { + ImageSyncScanRequest imageSyncScanRequest = getImgScanRequest(); try { imageSyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { @@ -110,12 +140,6 @@ public class ScanServiceImpl implements ScanService { return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); } - /** - * 请务必设置超时时间 - */ - imageSyncScanRequest.setConnectTimeout(3000); - imageSyncScanRequest.setReadTimeout(6000); - try { SyncScanResult scanResult = executeSyncImg(imageSyncScanRequest); return new Result().ok(scanResult); @@ -125,6 +149,17 @@ public class ScanServiceImpl implements ScanService { } } + private ImageSyncScanRequest getImgScanRequest() { + ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); + imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + imageSyncScanRequest.setEncoding(SysConstant.UTF8); + imageSyncScanRequest.setRegionId(regionId); + imageSyncScanRequest.setConnectTimeout(3000); + imageSyncScanRequest.setReadTimeout(6000); + return imageSyncScanRequest; + } + public SyncScanResult executeSyncText(AcsRequest textScanRequest) { SyncScanResult result = new SyncScanResult(); try { diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java index c50589d7ce..8dcb757f64 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java @@ -39,8 +39,4 @@ public class SyncScanResult implements Serializable { } return isAllPass; } - - public void setAllPass(boolean allPass) { - isAllPass = allPass; - } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java index 4d82df0d1f..3a8361be2c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java @@ -9,6 +9,11 @@ public class RoleKeyConstants { */ public static final String ROLE_KEY_MANAGER = "manager"; + /** + * 根管理员(不能通过工作端取消的角色,且不会再工作端显示) + */ + public static final String ROLE_KEY_ROOT_MANAGER = "root_manager"; + /** * 党建负责人 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 67ffff8fb1..c765ec0a28 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -140,6 +140,15 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/staffrole/staffroles") Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); + /** + * @param customerStaffFormDTO + * @return + * @Author sun + * @Description 根据手机号+客户id获取工作人员基本信息 + **/ + @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfo", consumes = MediaType.APPLICATION_JSON_VALUE) + Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO customerStaffFormDTO); + /** * @param userIdList * @return com.epmet.commons.tools.utils.Result> @@ -150,6 +159,28 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/userbaseinfo/queryuserbaseinfo") Result> queryUserBaseInfo(@RequestBody List userIdList); + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:13 2020-07-23 + **/ + @GetMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}") + Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId); + + /** + * 同步-居民基础信息、用户微信信息 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:37 2020-07-23 + **/ + @PostMapping("epmetuser/user/updateUserBaseAndWxUserInfo") + Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO formDTO); + /** * @Description 新增或保存用户基本信息 * @param baseInfo diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index a6403a0448..39c71e8e9f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -88,6 +88,11 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff", staffRoleFormDTO); } + @Override + public Result getCustomerStaffInfo(CustomerStaffFormDTO customerStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfo", customerStaffFormDTO); + } + /** * @param userIdList * @return com.epmet.commons.tools.utils.Result> @@ -100,6 +105,16 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryUserBaseInfo", userIdList); } + @Override + public Result> getUserRoleInfoByUserId(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); + } + + @Override + public Result updateUserBaseAndWxUserInfo(WxUserInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateUserBaseAndWxUserInfo", formDTO); + } + /** * @Description 新增或保存用户基本信息 * @param baseInfo diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 88d224e76e..4523fe51aa 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.76 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.81 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml index 9aaabd5324..e1725c6df6 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.75 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.81 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-test.yml b/epmet-user/epmet-user-server/deploy/docker-compose-test.yml index 0cc2683457..3a291ea73e 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-test.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-server:0.3.75 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-server:0.3.81 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 69a426911b..cda0f4cf4f 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.76 + 0.3.81 com.epmet epmet-user diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java index ffd2e1f5c7..773bc61a08 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java @@ -28,6 +28,7 @@ public class UserController { @Autowired private UserService userService; + /** * @param formDTO * @return com.epmet.commons.tools.utils.Result @@ -127,4 +128,19 @@ public class UserController { public Result saveWxUser(@RequestBody WxUserFormDTO formDTO){ return new Result().ok(userService.saveWxUser(formDTO)); } + + /** + * 居民端个人信息-同步用户微信信息 + * 供Feign调用 + * + * @param wxUserInfoFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:51 2020-07-23 + **/ + @PostMapping("updateUserBaseAndWxUserInfo") + public Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { ; + ValidatorUtils.validateEntity(wxUserInfoFormDTO); + return userService.updateWxUserInfo(wxUserInfoFormDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java index f442da6e7f..7a1bbbe99d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java @@ -120,4 +120,16 @@ public class UserRoleController { } -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + @GetMapping("getuserroleinfobyuserid/{userId}") + public Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId) { + return userRoleService.getUserRoleInfoByUserId(userId); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 5cf2cd03b7..6de16bc4f8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -98,4 +98,6 @@ public interface StaffRoleDao extends BaseDao { * @return java.util.List */ List selectStaffRoles(@Param("staffId") String staffId); + + List listStaffRoleEntytiesByStaffIdAndOrgId(@Param("agencyId") String agencyId, @Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java index 989c20b2f1..58b864bce3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java @@ -18,16 +18,18 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserRoleDTO; import com.epmet.dto.form.UserRoleFormDTO; import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.entity.UserRoleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 用户角色关系表 + * 用户角色关系表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-30 @@ -52,4 +54,13 @@ public interface UserRoleDao extends BaseDao { **/ List getUserRoleList(UserRoleFormDTO userRoleFormDTO); -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + Result> getUserRoleInfoByUserId(@Param("userId") String userId); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index f3913d588b..e6c238a53f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -148,4 +148,6 @@ public interface StaffRoleService extends BaseService { * @return java.util.List */ List getStaffRoles(String staffId); + + List getStaffRoleEntytiesByStaffIdAndOrgId(String agencyId, String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java index a22191edb0..c431331236 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java @@ -113,4 +113,13 @@ public interface UserRoleService extends BaseService { */ Result saveUserRole(UserRoleDTO userRoleDTO); -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + Result> getUserRoleInfoByUserId(String userId); +} 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 00975b17de..08b4b4d2b1 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 @@ -31,6 +31,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerStaffConstant; +import com.epmet.constant.RoleKeyConstants; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; @@ -57,6 +58,7 @@ import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; @@ -248,14 +250,17 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); //获取工作人员角色 List staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); - List staffRoleList = roleList.stream().map(p -> { - StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); - staffRoleResultDTO.setRoleId(p.getId()); - staffRoleResultDTO.setRoleName(p.getRoleName()); - staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); - staffRoleResultDTO.setSelected(false); - return staffRoleResultDTO; - }).collect(Collectors.toList()); + List staffRoleList = roleList + .stream() + .filter(p -> !RoleKeyConstants.ROLE_KEY_ROOT_MANAGER.equals(p.getRoleKey())) + .map(p -> { + StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); + staffRoleResultDTO.setRoleId(p.getId()); + staffRoleResultDTO.setRoleName(p.getRoleName()); + staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); + staffRoleResultDTO.setSelected(false); + return staffRoleResultDTO; + }).collect(Collectors.toList()); staffRoleList.forEach(role -> staffRoles.forEach(staffRole -> { if (role.getRoleId().equals(staffRole.getId())) { @@ -341,11 +346,18 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl staffRoleEntytiesByStaffIdAndOrgId = staffRoleService.getStaffRoleEntytiesByStaffIdAndOrgId(fromDTO.getAgencyId(), fromDTO.getStaffId()); + List roleIds = new ArrayList<>(); + if (!CollectionUtils.isEmpty(staffRoleEntytiesByStaffIdAndOrgId)) { + roleIds = staffRoleEntytiesByStaffIdAndOrgId.stream().map(sr -> sr.getRoleId()).collect(Collectors.toList()); + } + // redis缓存角色修改 UpdateCachedRolesFormDTO updateRolesForm = new UpdateCachedRolesFormDTO(); updateRolesForm.setOrgId(fromDTO.getAgencyId()); updateRolesForm.setStaffId(fromDTO.getStaffId()); - updateRolesForm.setRoleIds(fromDTO.getRoles()); + updateRolesForm.setRoleIds(roleIds); try { Result result = authFeignClient.updateCachedRoles(updateRolesForm); if (!result.success()) { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index 38a4924eef..231ab010ea 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -19,7 +19,6 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.epmet.commons.mybatis.annotation.DataFilter; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; @@ -36,9 +35,7 @@ import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.result.CustomerStaffRoleResultDTO; import com.epmet.dto.result.CustomerStaffRoleListResultDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.StaffRolesResultDTO; -import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.StaffRoleEntity; import com.epmet.redis.StaffRoleRedis; import com.epmet.service.StaffRoleService; @@ -180,4 +177,9 @@ public class StaffRoleServiceImpl extends BaseServiceImpl getStaffRoleEntytiesByStaffIdAndOrgId(String agencyId, String staffId) { + return baseDao.listStaffRoleEntytiesByStaffIdAndOrgId(agencyId, staffId); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java index 3650de51fc..4c0eafdad9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java @@ -132,4 +132,9 @@ public class UserRoleServiceImpl extends BaseServiceImpl> getUserRoleInfoByUserId(String userId) { + return baseDao.getUserRoleInfoByUserId(userId); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql new file mode 100644 index 0000000000..31f2f20fdb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql @@ -0,0 +1 @@ +INSERT INTO epmet_user.gov_staff_role_template (ID, ROLE_KEY, ROLE_NAME, ORG_TYPE, FULL_TIME_ONLY, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'root_manager', '根管理员', 'agency', 1, 0, 0, 'APP_USER', now(), 'APP_USER', now()); \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 94ae4b700d..b02425c697 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -17,11 +17,11 @@ update - staff_role - set DEL_FLAG = '1' - where STAFF_ID = #{staffId} - and ORG_ID = #{orgId} - and DEL_FLAG = '0' + staff_role sr inner join gov_staff_role gsr on (sr.ROLE_ID = gsr.ID and gsr.ROLE_KEY != 'root_manager') + set sr.DEL_FLAG = '1' + where sr.STAFF_ID = #{staffId} + and sr.ORG_ID = #{orgId} + and sr.DEL_FLAG = '0' @@ -156,4 +156,12 @@ AND gsr.del_flag = '0' AND sr.staff_id = #{staffId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml index af3e8cbfbb..803fa40621 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml @@ -71,4 +71,21 @@ - \ No newline at end of file + +