Browse Source
# Conflicts: # epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java # epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java # epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java # epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyImgDataEntity.javamaster
456 changed files with 17562 additions and 639 deletions
@ -0,0 +1,21 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/19 上午10:26 |
|||
*/ |
|||
public interface SsoConstant { |
|||
|
|||
/** |
|||
* 酒城e通appId |
|||
*/ |
|||
String WINE_CITY_E_OPEN_APP_ID = "64929543"; |
|||
|
|||
String USER_INFO_IS_NULL = "【jcetApiService.getUserInfoByTicket(formDTO.getTicket()】结果为空......"; |
|||
|
|||
String INSERT_UPDATE_USER_FAILURE = "新增或更新user_weChat失败......"; |
|||
|
|||
String USER_ID_IS_NULL = "userId为空,生成token失败......"; |
|||
String CUSTOMER_ID_IS_NULL = "customerId为空,缓存放置token失败......"; |
|||
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.thirdplat.apiservice.jcet.JcetApiService; |
|||
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.SsoEnteOrgFormDTO; |
|||
import com.epmet.dto.form.SsoLoginFormDTO; |
|||
import com.epmet.dto.result.SsoLoginResultDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
import com.epmet.service.SsoService; |
|||
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 zxc |
|||
* @DateTime 2021/1/18 下午4:33 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("sso") |
|||
public class SsoController { |
|||
|
|||
@Autowired |
|||
private SsoService ssoService; |
|||
|
|||
@Autowired |
|||
private JcetApiService jcetApiService; |
|||
|
|||
/** |
|||
* @Description 0、入口:得到token |
|||
* @Param formDTO |
|||
* @author zxc |
|||
* @date 2021/1/18 下午4:59 |
|||
*/ |
|||
@PostMapping("resi/login") |
|||
public Result<SsoLoginResultDTO> ssoLogin(@RequestBody SsoLoginFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); |
|||
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoLogin(formDTO)); |
|||
} |
|||
|
|||
@PostMapping("test") |
|||
public Result<ThirdPlatUserInfo> testssoLogin(){ |
|||
ThirdPlatUserInfo userInfoByTicket = null; |
|||
try { |
|||
userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return new Result<ThirdPlatUserInfo>().ok(userInfoByTicket); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Author sun |
|||
* @Description 1、ticket自动登录获取内部token |
|||
**/ |
|||
@PostMapping("work/login") |
|||
public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoLoginFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); |
|||
return new Result<UserTokenResultDTO>().ok(ssoService.ssoWorkLogin(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Author sun |
|||
* @Description 4、自动进入组织-返回token |
|||
**/ |
|||
@PostMapping(value = "work/enterorg") |
|||
public Result<UserTokenResultDTO> enterOrg(@RequestBody SsoEnteOrgFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO, SsoEnteOrgFormDTO.AddUserShowGroup.class, SsoEnteOrgFormDTO.AddUserInternalGroup.class); |
|||
UserTokenResultDTO userTokenResultDTO = ssoService.enterOrg(formDTO); |
|||
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
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 4、自动进入组织-返回token |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class SsoEnteOrgFormDTO implements Serializable { |
|||
public interface AddUserInternalGroup {} |
|||
public interface AddUserShowGroup extends CustomerClientShowGroup {} |
|||
/** |
|||
* wxCode |
|||
*/ |
|||
@NotBlank(message = "ticket不能为空",groups = {AddUserInternalGroup.class}) |
|||
private String ticket; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
@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; |
|||
|
|||
/** |
|||
* resi;居民段,gov:工作端 |
|||
*/ |
|||
@NotBlank(message = "app不能为空",groups = SsoLoginFormDTO.SsoLoginForm.class) |
|||
private String app; |
|||
|
|||
/** |
|||
* app;居民段,app:工作端 |
|||
*/ |
|||
@NotBlank(message = "client不能为空",groups = SsoLoginFormDTO.SsoLoginForm.class) |
|||
private String client; |
|||
} |
|||
|
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:43 |
|||
*/ |
|||
@Data |
|||
public class SsoLoginFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -6543952487970013031L; |
|||
|
|||
public interface SsoLoginForm{} |
|||
|
|||
/** |
|||
* sso票据,有效期为300秒 |
|||
*/ |
|||
@NotBlank(message = "sso票据不能为空",groups = SsoLoginForm.class) |
|||
private String ticket; |
|||
|
|||
/** |
|||
* 三方平台应用AppId |
|||
*/ |
|||
@NotBlank(message = "三方平台应用AppId不能为空",groups = SsoLoginForm.class) |
|||
private String appId; |
|||
|
|||
/** |
|||
* app类型 resi;居民段,gov:工作端 |
|||
*/ |
|||
@NotBlank(message = "app不能为空",groups = SsoLoginForm.class) |
|||
private String app; |
|||
|
|||
/** |
|||
* app;居民段,app:工作端 |
|||
*/ |
|||
@NotBlank(message = "client不能为空",groups = SsoLoginForm.class) |
|||
private String client; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:45 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class SsoLoginResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 3491079788196180035L; |
|||
|
|||
private String token = ""; |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.redis; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午5:09 |
|||
*/ |
|||
@Component |
|||
public class SsoRedis { |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* @Description token放入缓存 |
|||
* @Param user |
|||
* @Param expire |
|||
* @author zxc |
|||
* @date 2021/1/18 下午5:10 |
|||
*/ |
|||
public void set(TokenDto user, long expire) { |
|||
if (user == null) { |
|||
return; |
|||
} |
|||
String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getUserId()); |
|||
//bean to map
|
|||
Map<String, Object> map = BeanUtil.beanToMap(user, false, true); |
|||
redisUtils.hMSet(key, map, expire); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.SsoEnteOrgFormDTO; |
|||
import com.epmet.dto.form.SsoLoginFormDTO; |
|||
import com.epmet.dto.result.SsoLoginResultDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:34 |
|||
*/ |
|||
public interface SsoService { |
|||
|
|||
/** |
|||
* @Description 0、入口:得到token |
|||
* @Param formDTO |
|||
* @author zxc |
|||
* @date 2021/1/18 下午4:59 |
|||
*/ |
|||
SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO); |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Author sun |
|||
* @Description 1、ticket自动登录获取内部token |
|||
**/ |
|||
UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO); |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Author sun |
|||
* @Description 4、自动进入组织-返回token |
|||
**/ |
|||
UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO); |
|||
} |
@ -0,0 +1,469 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.common.token.constant.LoginConstant; |
|||
import com.epmet.commons.thirdplat.apiservice.AbstractApiService; |
|||
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.security.dto.GovTokenDto; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.*; |
|||
import com.epmet.dto.*; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.*; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.feign.OperCrmOpenFeignClient; |
|||
import com.epmet.jwt.JwtTokenProperties; |
|||
import com.epmet.jwt.JwtTokenUtils; |
|||
import com.epmet.redis.SsoRedis; |
|||
import com.epmet.service.SsoService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2021/1/18 下午4:35 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class SsoServiceImpl implements SsoService { |
|||
|
|||
Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
@Autowired |
|||
private SsoRedis ssoRedis; |
|||
|
|||
@Autowired |
|||
private JwtTokenUtils jwtTokenUtils; |
|||
|
|||
@Autowired |
|||
private JwtTokenProperties jwtTokenProperties; |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private OperCrmOpenFeignClient operCrmOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private CpUserDetailRedis cpUserDetailRedis; |
|||
|
|||
/** |
|||
* @Description 0、入口:得到token |
|||
* @Param formDTO |
|||
* @author zxc |
|||
* @date 2021/1/18 下午4:59 |
|||
*/ |
|||
@Override |
|||
public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) { |
|||
String customerId = getCustomerId(formDTO.getAppId()); |
|||
String userId = ""; |
|||
|
|||
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); |
|||
if (!apiServiceResult.success()) { |
|||
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg()); |
|||
} |
|||
|
|||
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) { |
|||
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); |
|||
} |
|||
|
|||
ThirdPlatUserInfo userInfo; |
|||
try { |
|||
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); |
|||
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); |
|||
} catch (Exception e) { |
|||
throw new RenException(e.getMessage()); |
|||
} |
|||
|
|||
if (null == userInfo){ |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空"); |
|||
} |
|||
UserInfoFormDTO userInfoFormDTO = new UserInfoFormDTO(); |
|||
userInfoFormDTO.setApp(formDTO.getApp()); |
|||
userInfoFormDTO.setUid(userInfo.getOpenId()); |
|||
userInfoFormDTO.setName(userInfo.getName()); |
|||
userInfoFormDTO.setMobile(userInfo.getMobile()); |
|||
|
|||
Result<UserDTO> userDTOResult = epmetUserOpenFeignClient.saveUserInfo(userInfoFormDTO); |
|||
if (!userDTOResult.success()){ |
|||
throw new RenException("【SSO登录】新增或更新user_weChat失败"); |
|||
} |
|||
userId = userDTOResult.getData().getId(); |
|||
|
|||
if (StringUtils.isBlank(userId)){ |
|||
throw new RenException("【SSO登录】userId为空,生成token失败"); |
|||
} |
|||
//生成业务token
|
|||
String token = this.generateToken(formDTO.getApp(),formDTO.getClient(), userId); |
|||
//存放Redis
|
|||
|
|||
if (StringUtils.isBlank(customerId)){ |
|||
throw new RenException("【SSO登录】customerId为空,缓存放置token失败"); |
|||
} |
|||
this.disposeTokenDto(formDTO, userId, token, customerId); |
|||
return new SsoLoginResultDTO(token); |
|||
} |
|||
|
|||
/** |
|||
* @Description token放缓存 |
|||
* @Param formDTO |
|||
* @Param userId |
|||
* @Param token |
|||
* @Param customerId |
|||
* @author zxc |
|||
* @date 2021/1/18 下午5:32 |
|||
*/ |
|||
public void disposeTokenDto(SsoLoginFormDTO formDTO, String userId, String token, String customerId){ |
|||
int expire = jwtTokenProperties.getExpire(); |
|||
TokenDto tokenDto = new TokenDto(); |
|||
tokenDto.setCustomerId(customerId); |
|||
tokenDto.setApp(formDTO.getApp()); |
|||
tokenDto.setClient(formDTO.getClient()); |
|||
tokenDto.setUserId(userId); |
|||
tokenDto.setToken(token); |
|||
tokenDto.setUpdateTime(System.currentTimeMillis()); |
|||
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); |
|||
ssoRedis.set(tokenDto, expire); |
|||
log.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); |
|||
} |
|||
|
|||
/** |
|||
* @Description 居民端登陆生成业务token的key |
|||
* @Param app |
|||
* @Param client |
|||
* @Param userId |
|||
* @author zxc |
|||
* @date 2021/1/18 下午5:14 |
|||
*/ |
|||
private String generateToken(String app,String client, String userId) { |
|||
Map<String, Object> map = new HashMap<>(16); |
|||
map.put("app", app); |
|||
map.put("client", client); |
|||
map.put("userId", userId); |
|||
String token = jwtTokenUtils.createToken(map); |
|||
log.info("app:" + app + ";client:" + client + ";userId:" + userId + ";生成token[" + token + "]"); |
|||
return token; |
|||
} |
|||
|
|||
/** |
|||
* @Description 获取customerId |
|||
* @Param appId |
|||
* @author zxc |
|||
* @date 2021/1/19 下午1:47 |
|||
*/ |
|||
public String getCustomerId(String appId){ |
|||
JSONObject jsonObject = new JSONObject(); |
|||
String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/"; |
|||
String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + appId, JSON.toJSONString(jsonObject)).getData(); |
|||
log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data); |
|||
JSONObject toResult = JSON.parseObject(data); |
|||
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); |
|||
if (null != toResult.get("code")) { |
|||
mapToResult.setCode(((Integer) toResult.get("code")).intValue()); |
|||
} |
|||
if (!mapToResult.success()) { |
|||
log.error(String.format("根据appId查询客户信息失败,对应appId->" + appId)); |
|||
throw new RenException(mapToResult.getMsg()); |
|||
} |
|||
Object publicCustomerResultDTO = mapToResult.getData(); |
|||
JSONObject json = JSON.parseObject(publicCustomerResultDTO.toString()); |
|||
Map<String, Object> map = (Map) json.get("customer"); |
|||
PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); |
|||
log.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer); |
|||
return customer.getId(); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Author sun |
|||
* @Description 1、ticket自动登录获取内部token |
|||
**/ |
|||
@Override |
|||
public UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO) { |
|||
|
|||
//1.根据appId查询客户id
|
|||
String customerId = getCustomerId(formDTO.getAppId()); |
|||
|
|||
//2.客户Id换取第三方apiService,根据ticket换取华为Id
|
|||
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); |
|||
if (!apiServiceResult.success()) { |
|||
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg()); |
|||
} |
|||
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) { |
|||
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); |
|||
} |
|||
ThirdPlatUserInfo userInfo; |
|||
try { |
|||
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); |
|||
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); |
|||
} catch (Exception e) { |
|||
throw new RenException(e.getMessage()); |
|||
} |
|||
if (null == userInfo){ |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空"); |
|||
} |
|||
|
|||
//3.根据华为openId查询用户是否存在历史登陆信息
|
|||
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserOpenFeignClient.getLatestStaffWechatLoginRecord(userInfo.getOpenId()); |
|||
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { |
|||
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); |
|||
throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode()); |
|||
} |
|||
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); |
|||
|
|||
//4.记录staff_wechat
|
|||
this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), userInfo.getOpenId()); |
|||
|
|||
//5.记录登录日志
|
|||
this.saveStaffLoginRecord(staffLatestAgencyResultDTO); |
|||
|
|||
//6.获取用户token
|
|||
String token = this.generateGovWxmpToken(staffLatestAgencyResultDTO.getStaffId(), formDTO.getApp(), formDTO.getClient()); |
|||
|
|||
//7.保存到redis
|
|||
this.saveLatestGovTokenDto(staffLatestAgencyResultDTO, userInfo, token); |
|||
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); |
|||
userTokenResultDTO.setToken(token); |
|||
|
|||
return userTokenResultDTO; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* @param userId openid |
|||
* @Author sun |
|||
* @Description 保存微信和当前登录用户关系 |
|||
**/ |
|||
private Result savestaffwechat(String userId, String openid) { |
|||
StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); |
|||
staffWechatFormDTO.setUserId(userId); |
|||
staffWechatFormDTO.setWxOpenId(openid); |
|||
return epmetUserOpenFeignClient.saveStaffWechat(staffWechatFormDTO); |
|||
} |
|||
/** |
|||
* @param latestStaffWechatLoginDTO |
|||
* @Author sun |
|||
* @Description 保存登录日志 |
|||
**/ |
|||
private Result saveStaffLoginRecord(StaffLatestAgencyResultDTO latestStaffWechatLoginDTO) { |
|||
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); |
|||
staffLoginAgencyRecordFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); |
|||
staffLoginAgencyRecordFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId()); |
|||
staffLoginAgencyRecordFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId()); |
|||
staffLoginAgencyRecordFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile()); |
|||
staffLoginAgencyRecordFormDTO.setAgencyId(latestStaffWechatLoginDTO.getAgencyId()); |
|||
Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); |
|||
return staffLoginRecordResult; |
|||
} |
|||
/** |
|||
* @Description 生成政府端小程序业务token Key |
|||
* @Author sun |
|||
**/ |
|||
private String generateGovWxmpToken(String staffId, String app, String client) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("app", app); |
|||
map.put("client", client); |
|||
map.put("userId", staffId); |
|||
String token = jwtTokenUtils.createToken(map); |
|||
logger.info("app:" + app + ";client:" + client + ";userId:" + staffId + ";生成token[" + token + "]"); |
|||
return token; |
|||
} |
|||
/** |
|||
* @Description 保存tokenDto到redis |
|||
* @Author sun |
|||
**/ |
|||
private void saveLatestGovTokenDto(StaffLatestAgencyResultDTO staffLatestAgency, ThirdPlatUserInfo userInfo, String token) { |
|||
int expire = jwtTokenProperties.getExpire(); |
|||
GovTokenDto govTokenDto = new GovTokenDto(); |
|||
govTokenDto.setApp(LoginConstant.APP_GOV); |
|||
govTokenDto.setClient(LoginConstant.CLIENT_WXMP); |
|||
govTokenDto.setUserId(staffLatestAgency.getStaffId()); |
|||
govTokenDto.setOpenId(userInfo.getOpenId()); |
|||
govTokenDto.setSessionKey(""); |
|||
govTokenDto.setUnionId(""); |
|||
govTokenDto.setToken(token); |
|||
govTokenDto.setUpdateTime(System.currentTimeMillis()); |
|||
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); |
|||
govTokenDto.setRootAgencyId(staffLatestAgency.getAgencyId()); |
|||
govTokenDto.setCustomerId(staffLatestAgency.getCustomerId()); |
|||
|
|||
//设置部门,网格,角色列表
|
|||
govTokenDto.setDeptIdList(getDeptartmentIdList(staffLatestAgency.getStaffId())); |
|||
govTokenDto.setGridIdList(getGridIdList(staffLatestAgency.getStaffId())); |
|||
CustomerAgencyDTO agency = getAgencyByStaffId(staffLatestAgency.getStaffId()); |
|||
if (agency != null) { |
|||
govTokenDto.setAgencyId(agency.getId()); |
|||
govTokenDto.setRoleList(queryGovStaffRoles(staffLatestAgency.getStaffId(), agency.getId())); |
|||
} |
|||
govTokenDto.setOrgIdPath(getOrgIdPath(staffLatestAgency.getStaffId())); |
|||
|
|||
cpUserDetailRedis.set(govTokenDto, expire); |
|||
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); |
|||
} |
|||
public Set<String> getDeptartmentIdList(String staffId) { |
|||
try { |
|||
Result<List<DepartmentListResultDTO>> deptListResult = govOrgOpenFeignClient.getDepartmentListByStaffId(staffId); |
|||
if (deptListResult.success()) { |
|||
if (!CollectionUtils.isEmpty(deptListResult.getData())) { |
|||
Set<String> deptIdLists = deptListResult.getData().stream().map(dept -> dept.getDepartmentId()).collect(Collectors.toSet()); |
|||
return deptIdLists; |
|||
} |
|||
} else { |
|||
logger.error("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg()); |
|||
} |
|||
} catch (Exception e) { |
|||
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|||
logger.error("登录:查询部门列表异常:{}", errorStackTrace); |
|||
} |
|||
return null; |
|||
} |
|||
/** |
|||
* 根据工作人员ID查询网格ID列表 |
|||
* @param staffId |
|||
*/ |
|||
public Set<String> getGridIdList(String staffId) { |
|||
Result<List<GridByStaffResultDTO>> result = govOrgOpenFeignClient.listGridsbystaffid(staffId); |
|||
if (!result.success()) { |
|||
logger.error("登录:查询网格列表,远程调用返回错误:{}", result.getMsg()); |
|||
return null; |
|||
} else { |
|||
List<GridByStaffResultDTO> grids = result.getData(); |
|||
return grids.stream().map(grid -> grid.getGridId()).collect(Collectors.toSet()); |
|||
} |
|||
} |
|||
/** |
|||
* 根据staffId查询所属的组织机构 |
|||
* |
|||
* @param staffId |
|||
*/ |
|||
public CustomerAgencyDTO getAgencyByStaffId(String staffId) { |
|||
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(staffId); |
|||
if (!result.success()) { |
|||
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); |
|||
return null; |
|||
} |
|||
return result.getData(); |
|||
} |
|||
/** |
|||
* 查询人员在某机关单位下的角色列表 |
|||
* @param staffId orgId |
|||
*/ |
|||
public List<GovTokenDto.Role> queryGovStaffRoles(String staffId, String orgId) { |
|||
StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); |
|||
formDTO.setStaffId(staffId); |
|||
formDTO.setOrgId(orgId); |
|||
Result<List<GovStaffRoleDTO>> gridResult = epmetUserOpenFeignClient.getRolesOfStaff(formDTO); |
|||
if (!CollectionUtils.isEmpty(gridResult.getData())) { |
|||
//return gridResult.getData().stream().map(role -> role.getId()).collect(Collectors.toSet());
|
|||
return ConvertUtils.sourceToTarget(gridResult.getData(), GovTokenDto.Role.class); |
|||
} |
|||
return null; |
|||
} |
|||
/** |
|||
* 查询工作人员的OrgIdPath |
|||
* @param staffId |
|||
*/ |
|||
public String getOrgIdPath(String staffId) { |
|||
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(staffId); |
|||
if (!result.success()) { |
|||
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); |
|||
return null; |
|||
} |
|||
CustomerAgencyDTO agency = result.getData(); |
|||
if (agency != null) { |
|||
if ("0".equals(agency.getPid())) { |
|||
// 顶级
|
|||
return agency.getId(); |
|||
} else { |
|||
return agency.getPids().concat(":").concat(agency.getId()); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @Author sun |
|||
* @Description 4、自动进入组织-返回token |
|||
**/ |
|||
@Override |
|||
public UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO) { |
|||
//1、需要校验要登录的客户,是否被禁用
|
|||
CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO(); |
|||
customerStaffFormDTO.setCustomerId(formDTO.getCustomerId()); |
|||
customerStaffFormDTO.setMobile(formDTO.getMobile()); |
|||
Result<CustomerStaffDTO> 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(); |
|||
|
|||
//2.客户Id换取第三方apiService,根据ticket换取华为Id
|
|||
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId())); |
|||
if (!apiServiceResult.success()) { |
|||
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg()); |
|||
} |
|||
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) { |
|||
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); |
|||
} |
|||
ThirdPlatUserInfo userInfo; |
|||
try { |
|||
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); |
|||
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); |
|||
} catch (Exception e) { |
|||
throw new RenException(e.getMessage()); |
|||
} |
|||
if (null == userInfo){ |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空"); |
|||
} |
|||
|
|||
//3、记录staff_wechat,并记录用户激活状态,激活时间
|
|||
this.savestaffwechat(customerStaff.getUserId(), userInfo.getOpenId()); |
|||
|
|||
//4、记录登录日志
|
|||
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = new StaffLatestAgencyResultDTO(); |
|||
staffLatestAgencyResultDTO.setCustomerId(formDTO.getCustomerId()); |
|||
staffLatestAgencyResultDTO.setStaffId(customerStaff.getUserId()); |
|||
staffLatestAgencyResultDTO.setWxOpenId(userInfo.getOpenId()); |
|||
staffLatestAgencyResultDTO.setMobile(formDTO.getMobile()); |
|||
staffLatestAgencyResultDTO.setAgencyId(formDTO.getRootAgencyId()); |
|||
this.saveStaffLoginRecord(staffLatestAgencyResultDTO); |
|||
|
|||
//5.1、获取用户token
|
|||
String token = this.generateGovWxmpToken(customerStaff.getUserId(), formDTO.getApp(), formDTO.getClient()); |
|||
//5.2、保存到redis
|
|||
StaffLatestAgencyResultDTO staffLatestAgency = new StaffLatestAgencyResultDTO(); |
|||
staffLatestAgency.setAgencyId(formDTO.getRootAgencyId()); |
|||
staffLatestAgency.setCustomerId(formDTO.getCustomerId()); |
|||
staffLatestAgency.setStaffId(customerStaff.getUserId()); |
|||
this.saveLatestGovTokenDto(staffLatestAgency, userInfo, token); |
|||
|
|||
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); |
|||
userTokenResultDTO.setToken(token); |
|||
return userTokenResultDTO; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
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"> |
|||
<parent> |
|||
<artifactId>epmet-commons</artifactId> |
|||
<groupId>com.epmet</groupId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>epmet-commons-rocketmq</artifactId> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.apache.rocketmq</groupId> |
|||
<artifactId>rocketmq-spring-boot-starter</artifactId> |
|||
<version>2.0.1</version> |
|||
</dependency> |
|||
</dependencies> |
|||
</project> |
@ -0,0 +1,21 @@ |
|||
package com.epmet.commons.rocketmq.constants; |
|||
|
|||
/** |
|||
* 消费者组常量 |
|||
*/ |
|||
public interface ConsomerGroupConstants { |
|||
|
|||
/** |
|||
* 初始化客户角色消费者组 |
|||
*/ |
|||
String INIT_CUSTOMER_ROLES_GROUP = "init_customer_roles_group"; |
|||
/** |
|||
* 初始化客户自定义消费者组 |
|||
*/ |
|||
String INIT_CUSTOMER_COMPONENTS_GROUP = "init_customer_components_group"; |
|||
/** |
|||
* 初始化客户组织机构信息分组 |
|||
*/ |
|||
String INIT_CUSTOMER_ORG_ROLES_GROUP = "init_customer_org_roles_group"; |
|||
|
|||
} |
@ -0,0 +1,5 @@ |
|||
package com.epmet.commons.rocketmq.constants; |
|||
|
|||
public interface TopicConstants { |
|||
String INIT_CUSTOMER = "init_customer"; |
|||
} |
@ -0,0 +1,148 @@ |
|||
package com.epmet.commons.rocketmq.messages; |
|||
|
|||
public class InitCustomerMQMsg { |
|||
|
|||
private String customerId; |
|||
|
|||
private InitCustomerAgency agency; |
|||
|
|||
private InitCustomerStaff staff; |
|||
|
|||
public static class InitCustomerStaff { |
|||
private String agencyId; |
|||
private Integer gender; |
|||
private String mobile; |
|||
private String name; |
|||
private String workType; |
|||
|
|||
public String getAgencyId() { |
|||
return agencyId; |
|||
} |
|||
|
|||
public void setAgencyId(String agencyId) { |
|||
this.agencyId = agencyId; |
|||
} |
|||
|
|||
public Integer getGender() { |
|||
return gender; |
|||
} |
|||
|
|||
public void setGender(Integer gender) { |
|||
this.gender = gender; |
|||
} |
|||
|
|||
public String getMobile() { |
|||
return mobile; |
|||
} |
|||
|
|||
public void setMobile(String mobile) { |
|||
this.mobile = mobile; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getWorkType() { |
|||
return workType; |
|||
} |
|||
|
|||
public void setWorkType(String workType) { |
|||
this.workType = workType; |
|||
} |
|||
} |
|||
|
|||
public static class InitCustomerAgency { |
|||
private String agencyId; |
|||
private String organizationName; |
|||
private String level; |
|||
private String areaCode; |
|||
private String province; |
|||
private String city; |
|||
private String district; |
|||
|
|||
public String getAgencyId() { |
|||
return agencyId; |
|||
} |
|||
|
|||
public void setAgencyId(String agencyId) { |
|||
this.agencyId = agencyId; |
|||
} |
|||
|
|||
public String getOrganizationName() { |
|||
return organizationName; |
|||
} |
|||
|
|||
public void setOrganizationName(String organizationName) { |
|||
this.organizationName = organizationName; |
|||
} |
|||
|
|||
public String getLevel() { |
|||
return level; |
|||
} |
|||
|
|||
public void setLevel(String level) { |
|||
this.level = level; |
|||
} |
|||
|
|||
public String getAreaCode() { |
|||
return areaCode; |
|||
} |
|||
|
|||
public void setAreaCode(String areaCode) { |
|||
this.areaCode = areaCode; |
|||
} |
|||
|
|||
public String getProvince() { |
|||
return province; |
|||
} |
|||
|
|||
public void setProvince(String province) { |
|||
this.province = province; |
|||
} |
|||
|
|||
public String getCity() { |
|||
return city; |
|||
} |
|||
|
|||
public void setCity(String city) { |
|||
this.city = city; |
|||
} |
|||
|
|||
public String getDistrict() { |
|||
return district; |
|||
} |
|||
|
|||
public void setDistrict(String district) { |
|||
this.district = district; |
|||
} |
|||
} |
|||
|
|||
public String getCustomerId() { |
|||
return customerId; |
|||
} |
|||
|
|||
public void setCustomerId(String customerId) { |
|||
this.customerId = customerId; |
|||
} |
|||
|
|||
public InitCustomerAgency getAgency() { |
|||
return agency; |
|||
} |
|||
|
|||
public void setAgency(InitCustomerAgency agency) { |
|||
this.agency = agency; |
|||
} |
|||
|
|||
public InitCustomerStaff getStaff() { |
|||
return staff; |
|||
} |
|||
|
|||
public void setStaff(InitCustomerStaff staff) { |
|||
this.staff = staff; |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
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"> |
|||
<parent> |
|||
<artifactId>epmet-commons</artifactId> |
|||
<groupId>com.epmet</groupId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>epmet-commons-thirdplat</artifactId> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-tools</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
</project> |
@ -0,0 +1,36 @@ |
|||
package com.epmet.commons.thirdplat; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO; |
|||
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTokenFormDTO; |
|||
import com.epmet.commons.thirdplat.encrypt.SignUtils; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
public class DemoApp { |
|||
|
|||
private static String appid = "soXDEoM1"; |
|||
private static String appsecret = "V7ea0KnlYt7eSyzc"; |
|||
|
|||
public static void main(String[] args) throws UnsupportedEncodingException { |
|||
|
|||
//SsoToken ssoToken = new SsoToken();
|
|||
//ssoToken.setSsoToken("wxz");
|
|||
|
|||
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); |
|||
ssoTicket.setSsoTicket("wxz"); |
|||
|
|||
int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length; |
|||
|
|||
Map<String, Object> headers = new HashMap(); |
|||
long timestamp = System.currentTimeMillis(); |
|||
headers.put("openTimestamp", String.valueOf(timestamp)); |
|||
headers.put("openAppId", appid); |
|||
String encryptContent = appid + timestamp + bodyLength; |
|||
headers.put("openSign", SignUtils.generate(encryptContent, appsecret)); |
|||
System.out.println(headers); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.epmet.commons.thirdplat.apiservice; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; |
|||
import com.epmet.commons.thirdplat.dto.result.jcet.JcetResult; |
|||
import com.epmet.commons.thirdplat.properties.ThirdplatProps; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
|
|||
public abstract class AbstractApiService { |
|||
|
|||
protected ThirdplatProps thirdplatProps; |
|||
|
|||
/** |
|||
* 通过ticket查询用户信息 |
|||
* @param ticket |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public abstract ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws Exception; |
|||
|
|||
/** |
|||
* @Description 解析请求结果 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.01.19 09:53 |
|||
*/ |
|||
protected <R> R parseResult(Result<String> thResult, Class<R> resultType) { |
|||
if (!thResult.success()) { |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg())); |
|||
} |
|||
|
|||
JcetResult jcetResult = JSON.parseObject(thResult.getData(), JcetResult.class); |
|||
if (!jcetResult.isSuccess()) { |
|||
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), |
|||
jcetResult.getMsg().concat(",错误码:") + jcetResult.getCode()); |
|||
} |
|||
|
|||
JSONObject jo = (JSONObject) jcetResult.getData(); |
|||
return jo.toJavaObject(resultType); |
|||
} |
|||
} |
@ -0,0 +1,113 @@ |
|||
package com.epmet.commons.thirdplat.apiservice.jcet; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.thirdplat.apiservice.AbstractApiService; |
|||
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; |
|||
import com.epmet.commons.thirdplat.constants.JcetConstants; |
|||
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO; |
|||
import com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO; |
|||
import com.epmet.commons.thirdplat.encrypt.SignUtils; |
|||
import com.epmet.commons.thirdplat.properties.JcetThirdplatProps; |
|||
import com.epmet.commons.thirdplat.properties.ThirdplatProps; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
public class JcetApiService extends AbstractApiService { |
|||
|
|||
Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
private JcetThirdplatProps jcetThirdplatProps; |
|||
|
|||
public JcetApiService(ThirdplatProps props) { |
|||
this.thirdplatProps = props; |
|||
jcetThirdplatProps = props.getJcet(); |
|||
} |
|||
|
|||
/** |
|||
* @return |
|||
* @Description 通过第三方平台ticket获取用户信息 |
|||
* @author wxz |
|||
* @date 2021.01.19 10:26 |
|||
*/ |
|||
public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException { |
|||
|
|||
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); |
|||
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket); |
|||
|
|||
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); |
|||
ssoTicket.setSsoTicket(ticket); |
|||
|
|||
String domain = jcetThirdplatProps.getDomain(); |
|||
Result<String> result = HttpClientManager.getInstance().sendPost( |
|||
domain.concat(JcetConstants.URL_GET_USER_BY_TICKET), |
|||
domain.startsWith("https://"), |
|||
JSON.toJSONString(ssoTicket), |
|||
getHeaders(ssoTicket)); |
|||
|
|||
try { |
|||
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); |
|||
} catch (Exception e) { |
|||
//e.printStackTrace();
|
|||
} |
|||
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); |
|||
|
|||
JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class); |
|||
|
|||
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); |
|||
userInfo.setOpenId(resultDTO.getId()); |
|||
userInfo.setName(resultDTO.getName()); |
|||
userInfo.setMobile(resultDTO.getMobile()); |
|||
return userInfo; |
|||
} |
|||
|
|||
/** |
|||
* @return |
|||
* @Description 通过token获取用户信息 |
|||
* @author wxz |
|||
* @date 2021.01.19 10:28 |
|||
*/ |
|||
//public JcetUserInfoResultDTO getUserInfoByToken(String token) throws UnsupportedEncodingException {
|
|||
// SsoTokenFormDTO ssoToken = new SsoTokenFormDTO();
|
|||
// ssoToken.setSsoToken(token);
|
|||
//
|
|||
// HashMap<String, Object> paramMap = new HashMap<>();
|
|||
// paramMap.put(JcetConstants.PLAT_TOKEN_NAME, token);
|
|||
//
|
|||
// String domain = jcetThirdplatProps.getDomain();
|
|||
//
|
|||
// Result<String> result = HttpClientManager.getInstance().sendGet(
|
|||
// domain.concat(JcetConstants.URL_GET_USER_BY_TOKEN),
|
|||
// domain.startsWith("https://"),
|
|||
// paramMap,
|
|||
// getHeaders(ssoToken));
|
|||
//
|
|||
// JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class);
|
|||
// return resultDTO;
|
|||
//}
|
|||
|
|||
/** |
|||
* 获取请求所需要的头信息 |
|||
* |
|||
* @param contentObject |
|||
* @return |
|||
* @throws UnsupportedEncodingException |
|||
*/ |
|||
private Map<String, String> getHeaders(Object contentObject) throws UnsupportedEncodingException { |
|||
int bodyLength = JSON.toJSONString(contentObject).getBytes("utf-8").length; |
|||
|
|||
Map<String, String> headers = new HashMap(); |
|||
long timestamp = System.currentTimeMillis(); |
|||
headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, String.valueOf(timestamp)); |
|||
headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, jcetThirdplatProps.getAppkey()); |
|||
String encryptContent = jcetThirdplatProps.getAppkey() + timestamp + bodyLength; |
|||
headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, jcetThirdplatProps.getAppsecret())); |
|||
return headers; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.commons.thirdplat.bean; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ThirdPlatUserInfo { |
|||
private String openId; |
|||
private String name; |
|||
private String mobile; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.epmet.commons.thirdplat.config; |
|||
|
|||
import com.epmet.commons.thirdplat.apiservice.jcet.JcetApiService; |
|||
import com.epmet.commons.thirdplat.constants.ApiServiceBeansConstants; |
|||
import com.epmet.commons.thirdplat.properties.ThirdplatProps; |
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* 第三方平台的相关配置 |
|||
*/ |
|||
@Configuration |
|||
@EnableConfigurationProperties(ThirdplatProps.class) |
|||
public class ThirdplatConfig { |
|||
|
|||
/** |
|||
* @Description 酒城e通的apiService,这个name需要注册进数据库,使用的时候去数据库根据客户id找对应的apiService出来用 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.01.20 13:50 |
|||
*/ |
|||
@Bean(name = ApiServiceBeansConstants.JCET_API_SERVICE) |
|||
public JcetApiService JcetApiService(ThirdplatProps props) { |
|||
return new JcetApiService(props); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
package com.epmet.commons.thirdplat.constants; |
|||
|
|||
/** |
|||
* ApiService常量 |
|||
*/ |
|||
public interface ApiServiceBeansConstants { |
|||
// 酒城e通apiService
|
|||
String JCET_API_SERVICE = "jcetApiService"; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.commons.thirdplat.constants; |
|||
|
|||
public interface JcetConstants { |
|||
|
|||
String URL_GET_USER_BY_TICKET = "/openapi-cgw/openapi-login/sso/getUserInfoByTicket"; |
|||
String URL_GET_USER_BY_TOKEN = "/openapi-cgw/openapi-login/sso/getUserInfoByToken"; |
|||
|
|||
String PLAT_TICKET_NAME = "ssoTicket"; |
|||
String PLAT_TOKEN_NAME = "ssoToken"; |
|||
|
|||
String PLAT_HEADER_OPEN_TIMESTAMP = "openTimestamp"; |
|||
String PLAT_HEADER_OPEN_APP_ID = "openAppId"; |
|||
String PLAT_HEADER_OPEN_SIGN = "openSign"; |
|||
} |
@ -0,0 +1,8 @@ |
|||
package com.epmet.commons.thirdplat.dto.form.jcet; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class SsoTicketFormDTO { |
|||
private String ssoTicket; |
|||
} |
@ -0,0 +1,8 @@ |
|||
package com.epmet.commons.thirdplat.dto.form.jcet; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class SsoTokenFormDTO { |
|||
private String ssoToken; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.commons.thirdplat.dto.result.jcet; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class JcetResult { |
|||
|
|||
private boolean success; |
|||
private String msg; |
|||
private Object data; |
|||
private int code; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.epmet.commons.thirdplat.dto.result.jcet; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class JcetUserInfoResultDTO { |
|||
private String id; |
|||
/** |
|||
* 用户名称 |
|||
*/ |
|||
private String userName; |
|||
/** |
|||
* 手机号码 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 邮箱 |
|||
*/ |
|||
private String email; |
|||
|
|||
/** |
|||
* sessionId,用于维持在线状态 |
|||
*/ |
|||
private String oaSessionId; |
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.commons.thirdplat.encrypt; |
|||
|
|||
|
|||
import com.epmet.commons.tools.exception.RenException; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
import java.nio.charset.Charset; |
|||
import java.security.MessageDigest; |
|||
import java.security.NoSuchAlgorithmException; |
|||
|
|||
public class EncryptUtils { |
|||
private final static char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
|||
/** |
|||
* 32位 MD5加密 |
|||
* |
|||
* @param s |
|||
* @return |
|||
*/ |
|||
public static String md5Hex(String s) throws UnsupportedEncodingException { |
|||
byte[] result = digest("MD5", s.getBytes(Charset.defaultCharset())); |
|||
return hex(result); |
|||
} |
|||
/** |
|||
* 32 位 sha256加密 |
|||
* |
|||
* @param s |
|||
* @return |
|||
*/ |
|||
public static String sha256(String s) { |
|||
byte[] result = digest("SHA-256", s.getBytes(Charset.defaultCharset())); |
|||
return hex(result); |
|||
} |
|||
private static byte[] digest(String algorithm, byte[] data) { |
|||
try { |
|||
MessageDigest digest = MessageDigest.getInstance(algorithm); |
|||
digest.update(data, 0, data.length); |
|||
return digest.digest(); |
|||
} catch (NoSuchAlgorithmException e) { |
|||
throw new RenException(algorithm + " error", e); |
|||
} |
|||
} |
|||
private static String hex(byte[] data) { |
|||
char[] result = new char[data.length * 2]; |
|||
int c = 0; |
|||
for (byte b : data) { |
|||
result[c++] = HEX_DIGITS[(b >> 4) & 0xf]; |
|||
result[c++] = HEX_DIGITS[b & 0xf]; |
|||
} |
|||
return new String(result); |
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.commons.thirdplat.encrypt; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
|
|||
public class SignUtils { |
|||
public static String generate(String content, String secret) throws UnsupportedEncodingException { |
|||
String sign = EncryptUtils.sha256(content); |
|||
sign = EncryptUtils.md5Hex(sign + secret); |
|||
return sign; |
|||
} |
|||
|
|||
public static void main(String[] args) { |
|||
System.out.println(777); |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.commons.thirdplat.properties; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 酒城e通三方平台配置 |
|||
*/ |
|||
@Data |
|||
public class JcetThirdplatProps { |
|||
private String domain; |
|||
private String appkey; |
|||
private String appsecret; |
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.epmet.commons.thirdplat.properties; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
|
|||
@Data |
|||
@ConfigurationProperties(prefix = "thirdplat") |
|||
public class ThirdplatProps { |
|||
|
|||
private JcetThirdplatProps jcet; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/4 20:49 |
|||
*/ |
|||
@Data |
|||
public class AgencyNode<T> implements Serializable { |
|||
|
|||
private String areaCode; |
|||
|
|||
private String parentAreaCode; |
|||
|
|||
/** |
|||
* 子节点列表 |
|||
*/ |
|||
private List<T> subAgencyList = new ArrayList<>(); |
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
|
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/4 20:49 |
|||
*/ |
|||
public class AgencyTreeUtils { |
|||
|
|||
/** |
|||
* 根据pid,构建树节点 |
|||
*/ |
|||
public static <T extends AgencyNode> List<T> build(List<T> agencyNodes, String parentAreaCode) { |
|||
//pid不能为空
|
|||
AssertUtils.isNull(parentAreaCode, "parentAreaCode"); |
|||
|
|||
List<T> treeList = new ArrayList<>(); |
|||
for (T agencyNode : agencyNodes) { |
|||
if (parentAreaCode.equals(agencyNode.getParentAreaCode())) { |
|||
treeList.add(findChildren(agencyNodes, agencyNode)); |
|||
} |
|||
} |
|||
|
|||
return treeList; |
|||
} |
|||
|
|||
/** |
|||
* 查找子节点 |
|||
*/ |
|||
private static <T extends AgencyNode> T findChildren(List<T> agencyNodes, T rootNode) { |
|||
for (T agencyNode : agencyNodes) { |
|||
if (rootNode.getAreaCode().equals(agencyNode.getParentAreaCode())) { |
|||
rootNode.getSubAgencyList().add(findChildren(agencyNodes, agencyNode)); |
|||
} |
|||
} |
|||
return rootNode; |
|||
} |
|||
|
|||
/** |
|||
* 构建树节点 |
|||
*/ |
|||
public static <T extends AgencyNode> List<T> build(List<T> agencyNodes) { |
|||
List<T> result = new ArrayList<>(); |
|||
|
|||
//list转map
|
|||
Map<String, T> nodeMap = new LinkedHashMap<>(agencyNodes.size()); |
|||
for (T agencyNode : agencyNodes) { |
|||
nodeMap.put(agencyNode.getAreaCode(), agencyNode); |
|||
} |
|||
|
|||
for (T node : nodeMap.values()) { |
|||
T parent = nodeMap.get(node.getParentAreaCode()); |
|||
if (parent != null && !(node.getAreaCode().equals(parent.getAreaCode()))) { |
|||
parent.getSubAgencyList().add(node); |
|||
continue; |
|||
} |
|||
|
|||
result.add(node); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dataaggre.dto.govissue.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/24 12:12 |
|||
*/ |
|||
@Data |
|||
public class IssueInfoDTO { |
|||
private String issueId; |
|||
private String gridId; |
|||
private String topicId; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dataaggre.dto.govproject.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 项目分布(实时只适用于e事通客户)入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/24 11:04 |
|||
*/ |
|||
@Data |
|||
public class ProjectDistributionFormDTO implements Serializable { |
|||
private String gridId; |
|||
@NotBlank(message = "customerId不能为空") |
|||
private String customerId; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dataaggre.dto.govproject.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 项目分布(实时只适用于e事通客户)返参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/24 11:05 |
|||
*/ |
|||
@Data |
|||
public class ProjectDistributionResultDTO implements Serializable { |
|||
private String projectId; |
|||
private String projectTitle; |
|||
private String statusDesc; |
|||
private String longitude; |
|||
private String latitude; |
|||
// @JsonIgnore
|
|||
private String issueId; |
|||
// @JsonIgnore
|
|||
private String statusCode; |
|||
private String gridId; |
|||
} |
@ -1,8 +1,14 @@ |
|||
package com.epmet.dataaggre.service.resigroup; |
|||
|
|||
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/12/25 上午9:21 |
|||
*/ |
|||
public interface ResiGroupService { |
|||
List<ResiTopicDTO> selectTopicInfoByIds(@Param("topicIds") List<String> topicIds); |
|||
} |
|||
|
@ -0,0 +1,59 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 项目(事件)数量分析按组织_按月统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-01-27 |
|||
*/ |
|||
@Data |
|||
public class ScreenProjectQuantityOrgMonthlyDTO implements Serializable { |
|||
private static final long serialVersionUID = 6821188282305837207L; |
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 日期yyyyMMdd |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 当前组织内,本月新增的项目数量:转项目日期在当前月份内 |
|||
*/ |
|||
private Integer projectIncr; |
|||
|
|||
/** |
|||
* 截止到当前月份:累计项目总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.form.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 【事件分析】效率分析 入参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/1 18:27 |
|||
*/ |
|||
@Data |
|||
public class EfficiencyAnalysisFormDTO extends ScreenCommonFormDTO{ |
|||
/** |
|||
* 网格:grid; 街道:street |
|||
*/ |
|||
@NotBlank(message = "type不能为空:网格:grid; 街道:street") |
|||
private String type; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.epmet.dto.form.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 近12个月【事件分析】月度数量分析 入参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/1 16:34 |
|||
*/ |
|||
@Data |
|||
public class QueryQuantityMonthlyFormDTO extends ScreenCommonFormDTO{ |
|||
private static final long serialVersionUID = 8848067533647648347L; |
|||
|
|||
/** |
|||
* 每月项目增量:incr;累计项目数量:sum |
|||
*/ |
|||
@NotBlank(message = "type不能为空:每月项目增量:incr;累计项目数量:sum") |
|||
private String type ; |
|||
|
|||
/** |
|||
* 截止到某月格式:yyyyMM;可为空 |
|||
*/ |
|||
private String endMonthId; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.form.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 大屏通用入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
*/ |
|||
@Data |
|||
public class ScreenCommonFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -5959152175751211940L; |
|||
/** |
|||
* 来源于请求头中的customerId |
|||
*/ |
|||
private String customerId; |
|||
/** |
|||
* 当前要查询的组织id |
|||
*/ |
|||
private String agencyId; |
|||
} |
@ -0,0 +1,49 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 组织机构信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-21 |
|||
*/ |
|||
@Data |
|||
public class ScreenCustomerAgencyDTO implements Serializable { |
|||
private static final long serialVersionUID = 6328123559936824470L; |
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织名称 |
|||
*/ |
|||
private String agencyName; |
|||
|
|||
/** |
|||
* 机关级别(社区级:community, |
|||
乡(镇、街道)级:street, |
|||
区县级: district, |
|||
市级: city |
|||
省级:province) |
|||
*/ |
|||
private String level; |
|||
|
|||
/** |
|||
* 行政地区编码 |
|||
*/ |
|||
private String areaCode; |
|||
|
|||
/** |
|||
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 |
|||
*/ |
|||
private String parentAreaCode; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.result.commonservice; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 003、新增街道或者社区地区编码 入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/5 17:39 |
|||
*/ |
|||
@Data |
|||
public class AddAreaCodeDictResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 7505566589581480619L; |
|||
private String code; |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.epmet.dto.result.plugins; |
|||
|
|||
import com.epmet.commons.tools.utils.AgencyNode; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 008、当前用户的数据权限(多客户版本) 返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/3 20:33 |
|||
*/ |
|||
@Data |
|||
public class AgencyNodeDTO extends AgencyNode<AgencyNodeDTO> implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3745920378557792529L; |
|||
/** |
|||
* 直属机关Id |
|||
* */ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 直属机关名称 |
|||
* */ |
|||
private String agencyName; |
|||
|
|||
/** |
|||
* 机关级别(社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province) |
|||
* */ |
|||
private String level; |
|||
|
|||
/** |
|||
* 当前agencyId所属的客户id add02.03 |
|||
* */ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 直属机关直属网格列表 |
|||
* */ |
|||
private List<GridNodeDTO> gridList = new ArrayList<>(); |
|||
|
|||
/** |
|||
* 直属机关直属部门列表 |
|||
* */ |
|||
private List<DeptNodeDTO> departmentList = new ArrayList<>(); |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.dto.result.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 【146体系】竞标管理-列表 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/1/22 13:37 |
|||
*/ |
|||
@Data |
|||
public class BidInfoResultDTO { |
|||
private String bidName; |
|||
private String statusDesc; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dto.result.plugins; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 【146体系】合同监督-列表 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/1/22 13:30 |
|||
*/ |
|||
@Data |
|||
public class ContractResultDTO { |
|||
private String contractListName; |
|||
@JsonFormat(pattern = "yyyy.MM.dd", timezone = "GMT+8") |
|||
private Date dueDate; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.result.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 部门信息 |
|||
* @ClassName ExtDeptResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-17 17:16 |
|||
*/ |
|||
@Data |
|||
public class DeptNodeDTO implements Serializable { |
|||
private static final long serialVersionUID = 1792371558965832432L; |
|||
|
|||
/** |
|||
* 部门Id |
|||
* */ |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
* */ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 当前deptId所属的customerId add02.03 |
|||
* */ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 当前deptId对应的地区编码 add02.03 |
|||
* */ |
|||
private String areaCode; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.result.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 008、当前用户的数据权限(多客户版本) 返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/3 20:33 |
|||
*/ |
|||
@Data |
|||
public class GridNodeDTO implements Serializable { |
|||
private static final long serialVersionUID = -4531574240525562587L; |
|||
|
|||
/** |
|||
* 网格Id |
|||
* */ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
* */ |
|||
private String gridName; |
|||
|
|||
/** |
|||
* 当前gridId所属的客户id add02.03 |
|||
* */ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 当前gridId对应的地区编码 add02.03 |
|||
* */ |
|||
private String areaCode; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.result.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 【146体系】清单列表 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/1/22 13:23 |
|||
*/ |
|||
@Data |
|||
public class OneListResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -1578923862757670664L; |
|||
private String listName; |
|||
private String listId; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.dto.result.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 【事件分析】效率分析 返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/1 18:23 |
|||
*/ |
|||
@Data |
|||
public class EfficiencyAnalysisResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 7291513498972998552L; |
|||
|
|||
/** |
|||
* 可能是网格名,也可能是组织名 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 解决率: 带%:90.74% |
|||
*/ |
|||
private String resolvedRatioStr; |
|||
|
|||
/** |
|||
* 解决率数值 90.74 |
|||
*/ |
|||
private BigDecimal resolvedRatio; |
|||
|
|||
/** |
|||
* 方便查找日志 |
|||
*/ |
|||
private String customerId; |
|||
private String agencyId; |
|||
private String gridId; |
|||
private String dateId; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.dto.result.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 【事件分析】数量统计查询 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/1/29 16:39 |
|||
*/ |
|||
@Data |
|||
public class ProjectQuantityResultDTO { |
|||
/** |
|||
* 事件总数 |
|||
*/ |
|||
private Integer projectTotal; |
|||
|
|||
/** |
|||
* 已解决数 |
|||
*/ |
|||
private Integer resolvedNum; |
|||
|
|||
/** |
|||
* 解决率,带%号的字符串 |
|||
*/ |
|||
private String resolvedRatio; |
|||
|
|||
/** |
|||
* 事件总数,带%号的字符串 |
|||
*/ |
|||
private String satisfactionRatio; |
|||
|
|||
/** |
|||
* 方便查找日志 |
|||
*/ |
|||
private String customerId; |
|||
private String agencyId; |
|||
private String dateId; |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.result.screen; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 近12个月【事件分析】月度数量分析 返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/1 16:57 |
|||
*/ |
|||
@Data |
|||
public class QueryQuantityMonthlyResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -9214182002720799008L; |
|||
|
|||
/** |
|||
* 横坐标集合 |
|||
*/ |
|||
private List<String> xAxis; |
|||
|
|||
/** |
|||
* 每个月的项目增量或者累计数量,根据入参type决定 |
|||
*/ |
|||
private List<Integer> yAxis; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.result.plugins.AgencyNodeDTO; |
|||
import com.epmet.feign.impl.DataReportOpenFeignClientFallBack; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
|
|||
/** |
|||
* 本服务对外开放的API,其他服务通过引用此client调用该服务 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/3 22:05 |
|||
*/ |
|||
// @FeignClient(name = ServiceConstant.DATA_REPORT_SERVER, fallback = DataReportOpenFeignClientFallBack.class,url = "localhost:8109")
|
|||
@FeignClient(name = ServiceConstant.DATA_REPORT_SERVER, fallback = DataReportOpenFeignClientFallBack.class) |
|||
public interface DataReportOpenFeignClient { |
|||
/** |
|||
* @param agencyId |
|||
* @description 查询当前组织及下级组织树 |
|||
* @Date 2021/2/3 22:05 |
|||
**/ |
|||
@GetMapping("/data/report/screen/agency/querystaffagencytree/{agencyId}") |
|||
Result<AgencyNodeDTO> queryStaffAgencyTree(@PathVariable("agencyId") String agencyId); |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.feign.impl; |
|||
|
|||
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.result.plugins.AgencyNodeDTO; |
|||
import com.epmet.feign.DataReportOpenFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
public class DataReportOpenFeignClientFallBack implements DataReportOpenFeignClient { |
|||
/** |
|||
* @param agencyId |
|||
* @description 查询当前组织及下级组织树 |
|||
* @Date 2021/2/3 22:05 |
|||
**/ |
|||
@Override |
|||
public Result<AgencyNodeDTO> queryStaffAgencyTree(String agencyId) { |
|||
return ModuleUtils.feignConError(ServiceConstant.DATA_REPORT_SERVER, "queryStaffAgencyTree",agencyId); |
|||
} |
|||
} |
@ -0,0 +1,127 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 工作日志资源字典表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-02-23 |
|||
*/ |
|||
@Data |
|||
public class ScreenCustomerWorkRecordDictDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键(客户每次上传,直接根据customerId全删全增) |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 数据更新至日期eg:20200101 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 资源id |
|||
*/ |
|||
private String dictId; |
|||
|
|||
/** |
|||
* 父资源ID;如果是一级分类pid=0 |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 资源类型 |
|||
*/ |
|||
private String resourceType; |
|||
|
|||
/** |
|||
* 资源编码 |
|||
*/ |
|||
private String resourceCode; |
|||
|
|||
/** |
|||
* 资源标签名 |
|||
*/ |
|||
private String resourceLabel; |
|||
|
|||
/** |
|||
* 显示标识:0否,1是 |
|||
*/ |
|||
private String showFlag; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 数据类别 :party:支部建设; union:联合建设;党员志愿服务:voluntaryservice;所有的一级分类需要对应到这三个key中 |
|||
*/ |
|||
private String dataType; |
|||
|
|||
/** |
|||
* 当前资源属于几级,例如:1、2、3、4.... |
|||
*/ |
|||
private Integer level; |
|||
|
|||
/** |
|||
* 逻辑删除标识 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,117 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 工作日志-组织按日统计(累计值) |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-02-23 |
|||
*/ |
|||
@Data |
|||
public class ScreenWorkRecordOrgDailyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 日期Id:yyyyMMdd |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 组织Idor网格id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 组织名称或者网格名 |
|||
*/ |
|||
private String orgName; |
|||
|
|||
/** |
|||
* 会议类型编码;对应screen_customer_work_record_dict的资源编码 |
|||
*/ |
|||
private String meetingCode; |
|||
|
|||
/** |
|||
* 随手记类型编码;对应screen_customer_work_record_dict的资源编码 |
|||
*/ |
|||
private String typeCode; |
|||
|
|||
/** |
|||
* 组织次数 |
|||
*/ |
|||
private Integer organizeTotal; |
|||
|
|||
/** |
|||
* 参与人数 |
|||
*/ |
|||
private Integer participateUserTotal; |
|||
|
|||
/** |
|||
* 平均参与人数 |
|||
*/ |
|||
private Integer avgParticipateUserTotal; |
|||
|
|||
/** |
|||
* 删除标识 0未删除;1已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,117 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.plugins; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 工作日志-组织按月统计(增量) |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-02-23 |
|||
*/ |
|||
@Data |
|||
public class ScreenWorkRecordOrgMonthlyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 月份Id:yyyyMM |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 组织Idor网格id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 组织名称或者网格名 |
|||
*/ |
|||
private String orgName; |
|||
|
|||
/** |
|||
* 会议类型编码;对应screen_customer_work_record_dict的资源编码 |
|||
*/ |
|||
private String meetingCode; |
|||
|
|||
/** |
|||
* 随手记类型编码;对应screen_customer_work_record_dict的资源编码 |
|||
*/ |
|||
private String typeCode; |
|||
|
|||
/** |
|||
* 组织次数 |
|||
*/ |
|||
private Integer organizeTotal; |
|||
|
|||
/** |
|||
* 参与人数 |
|||
*/ |
|||
private Integer participateUserTotal; |
|||
|
|||
/** |
|||
* 平均参与人数 |
|||
*/ |
|||
private Integer avgParticipateUserTotal; |
|||
|
|||
/** |
|||
* 删除标识 0未删除;1已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.epmet.plugins.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 5、【工作日志】本机及下级排名 通用入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/23 23:08 |
|||
*/ |
|||
@Data |
|||
public class WorkRecordRankFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -2934835714413031036L; |
|||
/** |
|||
* party:支部建设; union:联建共建;党员志愿服务:voluntaryservice |
|||
*/ |
|||
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建;党员志愿服务:voluntaryservice") |
|||
private String dataType; |
|||
|
|||
/** |
|||
* 当前组织id |
|||
*/ |
|||
@NotBlank(message = "agencyId不能为空") |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 默认显示前3 |
|||
*/ |
|||
@NotNull(message = "topRow不能为空") |
|||
private Integer topRow; |
|||
|
|||
@NotBlank(message = "customerId不能为空") |
|||
private String customerId; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.plugins.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 5、【工作日志】本机及下级排名 返参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/23 23:11 |
|||
*/ |
|||
@AllArgsConstructor |
|||
@Data |
|||
public class WorkRecordRankResultDTO implements Serializable { |
|||
/** |
|||
* 总参与人数 |
|||
*/ |
|||
private Integer participateUserTotal; |
|||
|
|||
/** |
|||
*组织次数 |
|||
*/ |
|||
private Integer participateTotal; |
|||
|
|||
/** |
|||
*下级排行列表 |
|||
*/ |
|||
private List<WorkRecordSubRank> subRankList; |
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.epmet.plugins.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 下级排行列表 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/23 23:21 |
|||
*/ |
|||
@Data |
|||
public class WorkRecordSubRank implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2450978606865910110L; |
|||
|
|||
private String orgId; |
|||
|
|||
/** |
|||
* 组织名称或者是网格名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 总参与人数 |
|||
*/ |
|||
private Integer participateUserTotal; |
|||
|
|||
/** |
|||
* 组织次数 |
|||
*/ |
|||
private Integer participateTotal; |
|||
} |
@ -0,0 +1,65 @@ |
|||
package com.epmet.datareport.controller.plugins; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.datareport.service.plugins.OfsService; |
|||
import com.epmet.dto.result.plugins.BidInfoResultDTO; |
|||
import com.epmet.dto.result.plugins.ContractResultDTO; |
|||
import com.epmet.dto.result.plugins.OneListResultDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestHeader; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 146体系数据查询 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/1/22 12:58 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("plugins/ofs") |
|||
public class OfsController { |
|||
@Autowired |
|||
private OfsService ofsService; |
|||
|
|||
/** |
|||
* @param customerId |
|||
* @author yinzuomei |
|||
* @description 【146体系】清单列表 |
|||
* @Date 2021/1/22 13:36 |
|||
**/ |
|||
@PostMapping("list") |
|||
public Result<List<OneListResultDTO>> oneList(@RequestHeader("CustomerId") String customerId){ |
|||
if(StringUtils.isNotBlank(customerId)){ |
|||
return new Result().ok(ofsService.queryOneList(customerId)); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* @param customerId |
|||
* @author yinzuomei |
|||
* @description 【146体系】合同监督-列表 |
|||
* @Date 2021/1/22 13:36 |
|||
**/ |
|||
@PostMapping("contractlist") |
|||
public Result<List<ContractResultDTO>> queryContractList(@RequestHeader("CustomerId") String customerId){ |
|||
if(StringUtils.isNotBlank(customerId)){ |
|||
return new Result().ok(ofsService.queryContractList(customerId)); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("bidlist") |
|||
public Result<List<BidInfoResultDTO>> bidList(@RequestHeader("CustomerId") String customerId){ |
|||
if(StringUtils.isNotBlank(customerId)){ |
|||
return new Result().ok(ofsService.queryBidList(customerId)); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.datareport.controller.plugins; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService; |
|||
import com.epmet.plugins.form.WorkRecordRankFormDTO; |
|||
import com.epmet.plugins.result.WorkRecordRankResultDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 大屏工作日志相关输出接口 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2021/2/21 19:51 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("plugins/workrecord") |
|||
public class WorkRecordController { |
|||
@Autowired |
|||
private ScreenWorkRecordOrgDailyService screenWorkRecordOrgDailyService; |
|||
//todo 工作日志是否要添加area_code、parent_area_code、orgType;插件是否可以提供;也可以采集的时候赋值
|
|||
//5、【工作日志】本机及下级排名
|
|||
//NEI接口地址:https://nei.netease.com/interface/detail/?pid=57068&id=348966
|
|||
//返参中的当前组织的参与人数、组织次数 直接sum所有下级的值;
|
|||
//下级根据当前组织的areaCode查询下级列表,再去查询screen_work_record_org_daily
|
|||
//legend来源于screen_customer_work_record_dict表 level=2,dataType=party
|
|||
|
|||
@PostMapping("ranklist") |
|||
public Result<WorkRecordRankResultDTO> rankList(@RequestHeader("CustomerId")String customerId, @RequestBody WorkRecordRankFormDTO formDTO){ |
|||
formDTO.setCustomerId(customerId); |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return new Result<WorkRecordRankResultDTO>().ok(screenWorkRecordOrgDailyService.rankList(formDTO)); |
|||
} |
|||
|
|||
|
|||
//6、【工作日志】近12月趋势图
|
|||
//NEI接口地址:https://nei.netease.com/interface/detail/?pid=57068&id=348967
|
|||
//可以下级组织+下级网格 orgId 直接 in
|
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.datareport.dao.evaluationindex.screen; |
|||
|
|||
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO; |
|||
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 2021-01-27 |
|||
*/ |
|||
@Mapper |
|||
public interface ScreenProjectGridDailyDao{ |
|||
|
|||
/** |
|||
* @param customerId |
|||
* @param areaCode |
|||
* @author yinzuomei |
|||
* @description 下级网格的效率(解决率)列表 |
|||
**/ |
|||
List<EfficiencyAnalysisResultDTO> queryGridEfficiencyAnalysis(@Param("customerId") String customerId, @Param("areaCode") String areaCode); |
|||
} |
@ -0,0 +1,48 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.datareport.dao.evaluationindex.screen; |
|||
|
|||
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO; |
|||
import com.epmet.dto.result.screen.ProjectQuantityResultDTO; |
|||
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 2021-01-27 |
|||
*/ |
|||
@Mapper |
|||
public interface ScreenProjectOrgDailyDao { |
|||
|
|||
/** |
|||
* @author yinzuomei |
|||
* @description 【事件分析】数量统计查询 |
|||
**/ |
|||
ProjectQuantityResultDTO queryQuantity(@Param("customerId") String customerId, @Param("agencyId")String agencyId); |
|||
|
|||
/** |
|||
* @param areaCode |
|||
* @author yinzuomei |
|||
* @description 下级组织的效率(解决率)列表 |
|||
**/ |
|||
List<EfficiencyAnalysisResultDTO> queryEfficiencyAnalysis(@Param("customerId")String customerId,@Param("areaCode") String areaCode); |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue