635 changed files with 26327 additions and 1513 deletions
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2022/10/20 14:21 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class ComplementLogOperationDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7563210356670229204L; |
|||
|
|||
private String staffId; |
|||
|
|||
private String orgId; |
|||
private String orgIdPath; |
|||
} |
|||
@ -0,0 +1,122 @@ |
|||
package com.epmet.mq.listener.listener; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.auth.constants.AuthOperationEnum; |
|||
import com.epmet.commons.rocketmq.constants.MQUserPropertys; |
|||
import com.epmet.commons.rocketmq.messages.CheckMQMsg; |
|||
import com.epmet.commons.rocketmq.messages.LoginMQMsg; |
|||
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.commons.tools.utils.SpringContextUtils; |
|||
import com.epmet.entity.LogOperationEntity; |
|||
import com.epmet.mq.listener.bean.log.LogOperationHelper; |
|||
import com.epmet.mq.listener.bean.log.OperatorInfo; |
|||
import com.epmet.service.LogOperationService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; |
|||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; |
|||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; |
|||
import org.apache.rocketmq.common.message.MessageExt; |
|||
import org.redisson.api.RLock; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
|
|||
import java.util.List; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* @author zxc |
|||
* @Description 查询明文或者导出操作日志监听器 |
|||
*/ |
|||
public class CheckAndExportOperationLogListener implements MessageListenerConcurrently { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
private RedisUtils redisUtils; |
|||
|
|||
@Override |
|||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { |
|||
|
|||
if (redisUtils == null) { |
|||
redisUtils = SpringContextUtils.getBean(RedisUtils.class); |
|||
} |
|||
|
|||
try { |
|||
msgs.forEach(msg -> consumeMessage(msg)); |
|||
} catch (Exception e) { |
|||
logger.error(ExceptionUtils.getErrorStackTrace(e)); |
|||
return ConsumeConcurrentlyStatus.RECONSUME_LATER; |
|||
} |
|||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; |
|||
} |
|||
|
|||
private void consumeMessage(MessageExt messageExt) { |
|||
String tags = messageExt.getTags(); |
|||
String msg = new String(messageExt.getBody()); |
|||
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL); |
|||
logger.info("查询明文或者导出操作日志监听器-收到消息内容:{}", msg); |
|||
CheckMQMsg msgObj = JSON.parseObject(msg, CheckMQMsg.class); |
|||
|
|||
//获取操作人信息
|
|||
OperatorInfo operatorInfo = LogOperationHelper.getInstance().getOperatorInfo(msgObj.getUserId()); |
|||
LogOperationEntity logEntity = new LogOperationEntity(); |
|||
logEntity.setCategory("data_tm"); |
|||
logEntity.setType(msgObj.getType()); |
|||
logEntity.setTypeDisplay(msgObj.getTypeDisplay()); |
|||
logEntity.setIp(msgObj.getIp()); |
|||
logEntity.setFromApp(msgObj.getFromApp()); |
|||
logEntity.setFromClient(msgObj.getFromClient()); |
|||
logEntity.setTargetId(""); |
|||
logEntity.setCustomerId(operatorInfo.getCustomerId()); |
|||
logEntity.setOperatorId(msgObj.getUserId()); |
|||
logEntity.setOperatorName(operatorInfo.getName()); |
|||
logEntity.setOperatorMobile(operatorInfo.getMobile()); |
|||
logEntity.setOperatingTime(msgObj.getOperateTime()); |
|||
logEntity.setContent(msgObj.getContent()); |
|||
logEntity.setOrgId(msgObj.getOrgId()); |
|||
logEntity.setOrgIdPath(msgObj.getOrgIdPath()); |
|||
|
|||
DistributedLock distributedLock = null; |
|||
RLock lock = null; |
|||
try { |
|||
distributedLock = SpringContextUtils.getBean(DistributedLock.class); |
|||
lock = distributedLock.getLock(String.format("lock:auth_operation_log:%s:%s", logEntity.getType(), logEntity.getOperatorId()), |
|||
30L, 30L, TimeUnit.SECONDS); |
|||
SpringContextUtils.getBean(LogOperationService.class).log(logEntity); |
|||
} catch (RenException e) { |
|||
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
|
|||
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
|||
} catch (Exception e) { |
|||
// 不是我们自己抛出的异常,可以让MQ重试
|
|||
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
|||
throw e; |
|||
} finally { |
|||
distributedLock.unLock(lock); |
|||
} |
|||
|
|||
if (StringUtils.isNotBlank(pendingMsgLabel)) { |
|||
try { |
|||
removePendingMqMsgCache(pendingMsgLabel); |
|||
} catch (Exception e) { |
|||
logger.error("【查询明文或者导出操作日志监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @description |
|||
* |
|||
* @param pendingMsgLabel |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.10.14 16:32:32 |
|||
*/ |
|||
private void removePendingMqMsgCache(String pendingMsgLabel) { |
|||
String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel); |
|||
redisUtils.delete(key); |
|||
//logger.info("【登录操作事件监听器】删除pendingMsgLabel成功:{}", pendingMsgLabel);
|
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
|
|||
ALTER TABLE log_operation MODIFY COLUMN CATEGORY varchar(64) not null COMMENT '操作类型大类。例如login和logout都属于login大类。项目立项,项目流转,项目结案都属于项目大类;data_tm:数据脱敏;'; |
|||
@ -0,0 +1,3 @@ |
|||
|
|||
alter table log_operation add COLUMN ORG_ID VARCHAR(32) comment '组织ID' AFTER ID; |
|||
alter table log_operation add COLUMN ORG_ID_PATH VARCHAR(255) comment '组织ID全路径,包括组织ID' AFTER ORG_ID; |
|||
@ -0,0 +1,30 @@ |
|||
|
|||
-- 相成的 |
|||
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1587017193115787265', 'dangerAreaLevel', '风险地区级别', '', 0, 0, 0, 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:42:39', 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:42:39'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1587017335055228929', 1587017193115787265, '低风险', '0', '0', '', 0, 0, 0, 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:43:13', 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:43:13'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1587017381859467265', 1587017193115787265, '中风险', '1', '0', '', 1, 0, 0, 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:43:24', 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:43:24'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1587017428642734082', 1587017193115787265, '高风险', '2', '0', '', 2, 0, 0, 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:43:35', 'ae867bb9d5c2760b3f090f3e3bcdf4c7', '2022-10-31 17:43:35'); |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
-- 字典表新增数据【自己的】 |
|||
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2100000000000000001', 'traffic_type', '交通方式', '交通方式【行程上报】', '36', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2100000000000000002', 'sojourn_history', '7天内旅居史情况', '7天内旅居史情况【行程上报】', '37', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2100000000000000004', 'trip_data_type', '行程记录类型', '行程记录类型【行程上报】', '39', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
|
|||
|
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5100000000000000001', '2100000000000000001', '飞机', '1', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5100000000000000002', '2100000000000000001', '动车', '2', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5100000000000000003', '2100000000000000001', '火车', '3', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5100000000000000004', '2100000000000000001', '自驾', '4', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5100000000000000005', '2100000000000000001', '其他', '5', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5200000000000000001', '2100000000000000002', '高风险', '2', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5200000000000000002', '2100000000000000002', '中风险', '1', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5200000000000000003', '2100000000000000002', '低风险', '0', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5200000000000000004', '2100000000000000002', '无风险', '3', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5400000000000000001', '2100000000000000004', '省内', '1', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5400000000000000002', '2100000000000000004', '省外', '2', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5400000000000000003', '2100000000000000004', '市内', '3', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5400000000000000004', '2100000000000000004', '县内', '4', '0', '', '0', '0', '0', 'APP_USER', '2022-10-31 18:23:27', 'APP_USER', '2022-10-31 18:23:27'); |
|||
@ -0,0 +1,33 @@ |
|||
package com.epmet.commons.rocketmq.messages; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
public class CheckMQMsg { |
|||
|
|||
/** |
|||
* 谁登录 |
|||
*/ |
|||
private String userId; |
|||
|
|||
private String content; |
|||
|
|||
private String typeDisplay; |
|||
private String type; |
|||
|
|||
/** |
|||
* 操作时间 |
|||
*/ |
|||
private Date operateTime; |
|||
|
|||
private String ip; |
|||
|
|||
private String fromApp; |
|||
|
|||
private String fromClient; |
|||
private String orgId; |
|||
private String orgIdPath; |
|||
|
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package com.epmet.commons.tools.dto.commondto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/10/11 13:08 |
|||
*/ |
|||
@Data |
|||
public class IcEventComDTO implements Serializable { |
|||
private static final long serialVersionUID = -5166489408303997740L; |
|||
/** |
|||
* 事件Id |
|||
*/ |
|||
private String icEventId; |
|||
/** |
|||
* 事件内容 |
|||
*/ |
|||
private String eventContent; |
|||
/** |
|||
* 处理中:processing;已办结:closed_case |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 0:已回复 1:已转项目 2:已转需求3:转议题 |
|||
*/ |
|||
private String operationType; |
|||
|
|||
/** |
|||
* 项目、需求ID、议题id |
|||
*/ |
|||
private String operationId; |
|||
} |
|||
|
|||
@ -0,0 +1,65 @@ |
|||
package com.epmet.commons.tools.dto.commondto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/10/11 13:06 |
|||
*/ |
|||
@Data |
|||
public class TopicInfoComDTO implements Serializable { |
|||
private static final long serialVersionUID = 4242861917113716511L; |
|||
/** |
|||
* 话题id |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 话题内容 |
|||
*/ |
|||
private String topicContent; |
|||
|
|||
/** |
|||
* 图片列表 |
|||
*/ |
|||
private List<String> topicImgs; |
|||
|
|||
/** |
|||
* 话题语音-2022.10.10 |
|||
*/ |
|||
private List<String> topicVoices; |
|||
|
|||
/** |
|||
* 话题发表人(山东路168-尹女士) |
|||
*/ |
|||
private String publishedUser; |
|||
|
|||
/** |
|||
* 话题发表时间 (时间戳 毫秒级) |
|||
*/ |
|||
private Long publishedTime; |
|||
|
|||
|
|||
private String releaseTime; |
|||
|
|||
/** |
|||
* 小组类型(ordinary:楼院小组 branch:支部小组) |
|||
*/ |
|||
private String groupType; |
|||
|
|||
/** |
|||
* 话题所属小组id |
|||
*/ |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 话题所属小组名称 |
|||
*/ |
|||
private String groupName; |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,28 @@ |
|||
package com.epmet.commons.tools.dto.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2022/9/26 17:04 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class YtDataSyncResDTO { |
|||
private int code = 200; |
|||
private String msg = "请求成功"; |
|||
/** |
|||
* 响应数据 |
|||
*/ |
|||
private String data; |
|||
private int total; |
|||
|
|||
public YtDataSyncResDTO(int code, String msg, String data) { |
|||
this.code = code; |
|||
this.msg = msg; |
|||
this.data = data; |
|||
} |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
package com.epmet.commons.tools.dto.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* @Description 核算采样结果 |
|||
* @Author yzm |
|||
* @Date 2022/9/26 17:04 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class YtHscyResDTO { |
|||
private int code = 200; |
|||
private String msg = "请求成功"; |
|||
/** |
|||
* 响应数据 |
|||
*/ |
|||
private List<YtHscyResDetail> data; |
|||
private int total; |
|||
|
|||
@Data |
|||
public static class YtHscyResDetail { |
|||
private String id; |
|||
private String name; |
|||
private String card_type; |
|||
private String card_no; |
|||
private String create_by; |
|||
/** |
|||
* 采样时间 |
|||
*/ |
|||
private String create_time; |
|||
private String sys_org_code; |
|||
private String sample_tube; |
|||
private String package_id; |
|||
private String city; |
|||
private String uuid; |
|||
private String county; |
|||
private String depart_ids; |
|||
private Object depart_name; |
|||
/** |
|||
* 采样点名称 |
|||
*/ |
|||
private String realname; |
|||
private String upload_time; |
|||
private Object sd_id; |
|||
private Object sd_batch; |
|||
private Object sd_operation; |
|||
private Object sd_time; |
|||
private String inserttime; |
|||
} |
|||
|
|||
/*{ |
|||
"id":"1570924677539635484", |
|||
"name":"杨XX",//姓名
|
|||
"card_type":"1",//证件类型
|
|||
"card_no":"37************0813",//证件号码
|
|||
"create_by":"370613594",//采样点账号
|
|||
"create_time":"2022-09-17 07:15:22",//采样时间
|
|||
"sys_org_code":"370613",//部门代码
|
|||
"sample_tube":"GCJ-0825-0441",//采样管号
|
|||
"package_id":"bcj00208083952",//采样包号
|
|||
"city":"烟台市",//城市
|
|||
"uuid":"6225684525062602095",//
|
|||
"county":"莱山区",//区县
|
|||
"depart_ids":"未填写",//街道
|
|||
"depart_name":null,//部门名称
|
|||
"realname":"采样点327",//采样点名称
|
|||
"upload_time":"2022-09-17 07:56:45",//自增时间戳
|
|||
"sd_id":null, |
|||
"sd_batch":null, |
|||
"sd_operation":null, |
|||
"sd_time":null, |
|||
"inserttime":"2022-09-17 09:36:20"//省大数据局返还烟台入库时间
|
|||
}*/ |
|||
|
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
package com.epmet.commons.tools.dto.result; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* @Description 根据身份证号和姓名查询公安部备案信息 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class YtSfhyxxcxdsjjResDTO { |
|||
private int code = 200; |
|||
private List<Result> result; |
|||
@Data |
|||
public static class Result { |
|||
//身份证号
|
|||
private String GMSFHM; |
|||
//姓名
|
|||
private String XM; |
|||
} |
|||
} |
|||
@ -0,0 +1,133 @@ |
|||
package com.epmet.commons.tools.redis.common.bean; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2022/10/19 14:26 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class CustomerStaffInfoDTOCache implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6967736754443092229L; |
|||
|
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 关联User表的主键Id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 账户 |
|||
*/ |
|||
private String userAccount; |
|||
|
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 性别0.未知,1男,2.女 |
|||
*/ |
|||
private Integer gender; |
|||
|
|||
/** |
|||
* 邮箱 |
|||
*/ |
|||
private String email; |
|||
|
|||
/** |
|||
* 手机号-唯一键 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* fulltime专职parttime兼职 |
|||
*/ |
|||
private String workType; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headPhoto; |
|||
|
|||
/** |
|||
* inactive未激活,active已激活 |
|||
*/ |
|||
private String activeFlag; |
|||
|
|||
/** |
|||
* 激活时间 |
|||
*/ |
|||
private Date activeTime; |
|||
|
|||
/** |
|||
* 未禁用enable,已禁用diabled |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
*/ |
|||
private String roleName; |
|||
|
|||
/** |
|||
* 登录密码 |
|||
*/ |
|||
private String password; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String idCard; |
|||
} |
|||
@ -0,0 +1,539 @@ |
|||
package com.epmet.commons.tools.redis.common.bean; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2022/10/17 15:40 |
|||
* @DESC |
|||
*/ |
|||
@Data |
|||
public class IcResiUserInfoCache implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3644143706074015380L; |
|||
|
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 所属小区ID |
|||
*/ |
|||
private String villageId; |
|||
|
|||
/** |
|||
* 所属楼宇Id |
|||
*/ |
|||
private String buildId; |
|||
|
|||
/** |
|||
* 单元id |
|||
*/ |
|||
private String unitId; |
|||
|
|||
/** |
|||
* 所属家庭Id |
|||
*/ |
|||
private String homeId; |
|||
|
|||
/** |
|||
* 是否本地户籍 |
|||
*/ |
|||
private String isBdhj; |
|||
|
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 性别 |
|||
*/ |
|||
private String gender; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String idCard; |
|||
|
|||
/** |
|||
* 出生日期 |
|||
*/ |
|||
private String birthday; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remarks; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String contacts; |
|||
|
|||
/** |
|||
* 联系人电话 |
|||
*/ |
|||
private String contactsMobile; |
|||
|
|||
/** |
|||
* 九小场所url |
|||
*/ |
|||
private String ninePlace; |
|||
|
|||
/** |
|||
* 是否党员 |
|||
*/ |
|||
private String isParty; |
|||
|
|||
/** |
|||
* 是否低保户 |
|||
*/ |
|||
private String isDbh; |
|||
|
|||
/** |
|||
* 是否保障房 |
|||
*/ |
|||
private String isEnsureHouse; |
|||
|
|||
/** |
|||
* 是否失业 |
|||
*/ |
|||
private String isUnemployed; |
|||
|
|||
/** |
|||
* 是否育龄妇女 |
|||
*/ |
|||
private String isYlfn; |
|||
|
|||
/** |
|||
* 是否退役军人 |
|||
*/ |
|||
private String isVeterans; |
|||
|
|||
/** |
|||
* 是否统战人员 |
|||
*/ |
|||
private String isUnitedFront; |
|||
|
|||
/** |
|||
* 是否信访人员 |
|||
*/ |
|||
private String isXfry; |
|||
|
|||
/** |
|||
* 是否志愿者 |
|||
*/ |
|||
private String isVolunteer; |
|||
|
|||
/** |
|||
* 是否老年人 |
|||
*/ |
|||
private String isOldPeople; |
|||
|
|||
/** |
|||
* 是否空巢 |
|||
*/ |
|||
private String isKc; |
|||
|
|||
/** |
|||
* 是否失独 |
|||
*/ |
|||
private String isSd; |
|||
|
|||
/** |
|||
* 是否失能 |
|||
*/ |
|||
private String isSn; |
|||
|
|||
/** |
|||
* 是否失智 |
|||
*/ |
|||
private String isSz; |
|||
|
|||
/** |
|||
* 是否残疾 |
|||
*/ |
|||
private String isCj; |
|||
|
|||
/** |
|||
* 是否大病 |
|||
*/ |
|||
private String isDb; |
|||
|
|||
/** |
|||
* 是否慢病 |
|||
*/ |
|||
private String isMb; |
|||
|
|||
/** |
|||
* 是否特殊人群 |
|||
*/ |
|||
private String isSpecial; |
|||
|
|||
/** |
|||
* 是否租户【是:1 否:0】 |
|||
*/ |
|||
private String isTenant; |
|||
|
|||
/** |
|||
* 是否是流动人口【是:1 否:0】 |
|||
*/ |
|||
private String isFloating; |
|||
|
|||
/** |
|||
* 是否新阶层人士【是:1 否:0】 |
|||
*/ |
|||
private String isXjc; |
|||
|
|||
/** |
|||
* 文化程度【字典表】 |
|||
*/ |
|||
private String culture; |
|||
|
|||
/** |
|||
* 文化程度备注 |
|||
*/ |
|||
private String cultureRemakes; |
|||
|
|||
/** |
|||
* 特长【字典表】 |
|||
*/ |
|||
private String specialSkill; |
|||
|
|||
/** |
|||
* 兴趣爱好 |
|||
*/ |
|||
private String hobby; |
|||
|
|||
/** |
|||
* 兴趣爱好备注 |
|||
*/ |
|||
private String hobbyRemakes; |
|||
|
|||
/** |
|||
* 宗教信仰 |
|||
*/ |
|||
private String faith; |
|||
|
|||
/** |
|||
* 宗教信仰备注 |
|||
*/ |
|||
private String faithRemakes; |
|||
|
|||
/** |
|||
* 残疾类别【字典表】 |
|||
*/ |
|||
private String cjlb; |
|||
|
|||
/** |
|||
* 残疾登记(状况)【字典表】 |
|||
*/ |
|||
private String cjzk; |
|||
|
|||
/** |
|||
* 残疾证号 |
|||
*/ |
|||
private String cjzh; |
|||
|
|||
/** |
|||
* 残疾说明 |
|||
*/ |
|||
private String cjsm; |
|||
|
|||
/** |
|||
* 有无监护人【yes no】 |
|||
*/ |
|||
private String ynJdr; |
|||
|
|||
/** |
|||
* 有无技能特长【yes no】 |
|||
*/ |
|||
private String ynJntc; |
|||
|
|||
/** |
|||
* 有无劳动能力 |
|||
*/ |
|||
private String ynLdnl; |
|||
|
|||
/** |
|||
* 有无非义务教育阶段助学【yes no】 |
|||
*/ |
|||
private String ynFywjyjdzx; |
|||
|
|||
/** |
|||
* 所患大病 |
|||
*/ |
|||
private String shdb; |
|||
|
|||
/** |
|||
* 患大病时间 |
|||
*/ |
|||
private String dbsj; |
|||
|
|||
/** |
|||
* 所患慢性病 |
|||
*/ |
|||
private String shmxb; |
|||
|
|||
/** |
|||
* 患慢性病时间 |
|||
*/ |
|||
private String mxbsj; |
|||
|
|||
/** |
|||
* 是否参保 |
|||
*/ |
|||
private String isCb; |
|||
|
|||
/** |
|||
* 自付金额 |
|||
*/ |
|||
private String zfje; |
|||
|
|||
/** |
|||
* 救助金额 |
|||
*/ |
|||
private String jzje; |
|||
|
|||
/** |
|||
* 救助时间[yyyy-MM-dd] |
|||
*/ |
|||
private String jzsj; |
|||
|
|||
/** |
|||
* 享受救助明细序号 |
|||
*/ |
|||
private String jzmxxh; |
|||
|
|||
/** |
|||
* 健康信息备注 |
|||
*/ |
|||
private String healthRemakes; |
|||
|
|||
/** |
|||
* 工作单位 |
|||
*/ |
|||
private String gzdw; |
|||
|
|||
/** |
|||
* 职业 |
|||
*/ |
|||
private String zy; |
|||
|
|||
/** |
|||
* 离退休时间 |
|||
*/ |
|||
private String ltxsj; |
|||
|
|||
/** |
|||
* 工作信息备注 |
|||
*/ |
|||
private String workRemake; |
|||
|
|||
/** |
|||
* 退休金额 |
|||
*/ |
|||
private String txje; |
|||
|
|||
/** |
|||
* 月收入 |
|||
*/ |
|||
private String ysr; |
|||
|
|||
/** |
|||
* 是否经济低保 |
|||
*/ |
|||
private String isJjdb; |
|||
|
|||
/** |
|||
* 籍贯 |
|||
*/ |
|||
private String jg; |
|||
|
|||
/** |
|||
* 户籍所在地 |
|||
*/ |
|||
private String hjszd; |
|||
|
|||
/** |
|||
* 现居住地 |
|||
*/ |
|||
private String xjzd; |
|||
|
|||
/** |
|||
* 人户情况 |
|||
*/ |
|||
private String rhzk; |
|||
|
|||
/** |
|||
* 居住信息备注 |
|||
*/ |
|||
private String jzxxRemakes; |
|||
|
|||
/** |
|||
* 民族【字典表】 |
|||
*/ |
|||
private String mz; |
|||
|
|||
/** |
|||
* 与户主关系【字典表】 |
|||
*/ |
|||
private String yhzgx; |
|||
|
|||
/** |
|||
* 居住情况【字典表】 |
|||
*/ |
|||
private String jzqk; |
|||
|
|||
/** |
|||
* 婚姻状况【字典表】 |
|||
*/ |
|||
private String hyzk; |
|||
|
|||
/** |
|||
* 配偶情况【字典表】 |
|||
*/ |
|||
private String poqk; |
|||
|
|||
/** |
|||
* 有无赡养人 |
|||
*/ |
|||
private String ynSyr; |
|||
|
|||
/** |
|||
* 与赡养人关系【字典表】 |
|||
*/ |
|||
private String ysyrgx; |
|||
|
|||
/** |
|||
* 赡养人电话 |
|||
*/ |
|||
private String syrMobile; |
|||
|
|||
/** |
|||
* 家庭信息备注 |
|||
*/ |
|||
private String jtxxRemakes; |
|||
|
|||
/** |
|||
* 用户状态【0:正常;1:迁出;2:注销】 |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 用户详细状态:01:新增、02:导入、03:迁入、04:新生、11:迁出、21死亡 |
|||
*/ |
|||
private String subStatus; |
|||
|
|||
|
|||
/** |
|||
* 删除标识 0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 预留字段1 |
|||
*/ |
|||
private String field1; |
|||
|
|||
/** |
|||
* 预留字段2 |
|||
*/ |
|||
private String field2; |
|||
|
|||
/** |
|||
* 预留字段3 |
|||
*/ |
|||
private String field3; |
|||
|
|||
/** |
|||
* 预留字段4 |
|||
*/ |
|||
private String field4; |
|||
|
|||
/** |
|||
* 预留字段5 |
|||
*/ |
|||
private String field5; |
|||
|
|||
/** |
|||
* 预留字段6 |
|||
*/ |
|||
private String field6; |
|||
|
|||
/** |
|||
* 预留字段7 |
|||
*/ |
|||
private String field7; |
|||
|
|||
/** |
|||
* 预留字段8 |
|||
*/ |
|||
private String field8; |
|||
|
|||
/** |
|||
* 预留字段9 |
|||
*/ |
|||
private String field9; |
|||
|
|||
/** |
|||
* 预留字段10 |
|||
*/ |
|||
private String field10; |
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
|
|||
package com.epmet.commons.tools.utils.api.yt; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:组织机构数据 实体类 |
|||
* @author liujianjun |
|||
*/ |
|||
@Data |
|||
public class OrgData implements Serializable { |
|||
|
|||
/** |
|||
* 联系人姓名 |
|||
*/ |
|||
private String contact; |
|||
/** |
|||
* 联系电话号码 |
|||
*/ |
|||
private String contactTelephoneNumber; |
|||
|
|||
/** |
|||
* 详细地址 |
|||
*/ |
|||
private String detailAddress; |
|||
|
|||
/** |
|||
* 组织机构第一名称 |
|||
*/ |
|||
private String firstNameOfOrganization; |
|||
|
|||
/** |
|||
* 组织机构全称 |
|||
*/ |
|||
private String nameOfOrganization; |
|||
|
|||
/** |
|||
* 排序号码 |
|||
*/ |
|||
private String orderNumber; |
|||
|
|||
/** |
|||
* 组织机构简称 |
|||
*/ |
|||
private String organizatioNabbreviation; |
|||
|
|||
/** |
|||
* 组织机构ID |
|||
*/ |
|||
private String organizationId; |
|||
|
|||
/** |
|||
* 组织机构级别 |
|||
*/ |
|||
private String organizationLevel; |
|||
|
|||
/** |
|||
* 组织机构路径 |
|||
*/ |
|||
private String organizationPath; |
|||
|
|||
/** |
|||
* 组织机构类型 |
|||
*/ |
|||
private String organizationType; |
|||
/** |
|||
* 注册类型 |
|||
*/ |
|||
private String registrationType; |
|||
/** |
|||
* 统一社会信用代码 |
|||
*/ |
|||
private String unifiedSocialCreditId; |
|||
|
|||
/** |
|||
* 上级ID |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* orgId全路径 |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 上级组织名 |
|||
*/ |
|||
private String parentOrgName; |
|||
|
|||
} |
|||
@ -0,0 +1,199 @@ |
|||
package com.epmet.commons.tools.utils.api.yt; |
|||
|
|||
import com.fasterxml.jackson.core.JsonProcessingException; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import org.apache.commons.codec.binary.Base64; |
|||
import org.bouncycastle.jce.provider.BouncyCastleProvider; |
|||
|
|||
import javax.crypto.BadPaddingException; |
|||
import javax.crypto.Cipher; |
|||
import javax.crypto.IllegalBlockSizeException; |
|||
import javax.crypto.SecretKey; |
|||
import javax.crypto.spec.SecretKeySpec; |
|||
import java.nio.charset.Charset; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.security.InvalidKeyException; |
|||
import java.security.Security; |
|||
|
|||
/** |
|||
* 烟台的认证中心-国密sm4加解密 |
|||
*/ |
|||
public class SM4UtilsForYanTai { |
|||
private static String SM4_KEY = "yaweisoftware@xy"; |
|||
//编码格式
|
|||
private static final Charset encryptCharset = StandardCharsets.UTF_8; |
|||
|
|||
public enum Algorithm { |
|||
SM4("SM4","SM4","国密四,key长16byte"); |
|||
private String keyAlgorithm; |
|||
private String transformation; |
|||
private String description;//描述
|
|||
Algorithm(String keyAlgorithm, String transformation, String description) { |
|||
this.keyAlgorithm = keyAlgorithm; |
|||
this.transformation = transformation; |
|||
this.description = description; |
|||
} |
|||
public String getKeyAlgorithm() { |
|||
return this.keyAlgorithm; |
|||
} |
|||
public String getTransformation() { |
|||
return this.transformation; |
|||
} |
|||
public String getDescription() { |
|||
return this.description; |
|||
} |
|||
} |
|||
|
|||
private static final String PROVIDER_NAME = "BC"; |
|||
static { |
|||
Security.addProvider(new BouncyCastleProvider()); |
|||
} |
|||
|
|||
/** |
|||
* 自定字符串产生密钥 |
|||
* @param algorithm 加解密算法 |
|||
* @param keyStr 密钥字符串 |
|||
* @param charset 编码字符集 |
|||
* @return 密钥 |
|||
*/ |
|||
public static SecretKey genKeyByStr(Algorithm algorithm, String keyStr, Charset charset) { |
|||
return readKeyFromBytes(algorithm, keyStr.getBytes(charset)); |
|||
} |
|||
|
|||
/** |
|||
* 根据指定字节数组产生密钥 |
|||
* @param algorithm 加解密算法 |
|||
* @param keyBytes 密钥字节数组 |
|||
* @return 密钥 |
|||
*/ |
|||
public static SecretKey readKeyFromBytes(Algorithm algorithm, byte[] keyBytes) { |
|||
return new SecretKeySpec(keyBytes, algorithm.getKeyAlgorithm()); |
|||
} |
|||
|
|||
/****************************加密*********************************/ |
|||
/** |
|||
* 加密字符串,并进行base64编码 |
|||
* @param algorithm 加解密算法 |
|||
* @param key 密钥 |
|||
* @param data 明文 |
|||
* @param charset 编码字符集 |
|||
* @return 密文 |
|||
* @throws InvalidKeyException 密钥错误 |
|||
*/ |
|||
public static String encryptBase64(Algorithm algorithm, SecretKey key, String data, Charset charset) throws InvalidKeyException { |
|||
return Base64.encodeBase64String(encrypt(algorithm, key, data.getBytes(charset))); |
|||
} |
|||
|
|||
/** |
|||
* 加密字节数组 |
|||
* @param algorithm 加解密算法 |
|||
* @param key 密钥 |
|||
* @param data 明文 |
|||
* @return 密文 |
|||
* @throws InvalidKeyException 密钥错误 |
|||
*/ |
|||
public static byte[] encrypt(Algorithm algorithm, SecretKey key, byte[] data) throws InvalidKeyException { |
|||
try { |
|||
return cipherDoFinal(algorithm, Cipher.ENCRYPT_MODE, key, data); |
|||
} catch (BadPaddingException e) { |
|||
throw new RuntimeException(e);//明文没有具体格式要求,不会出错。所以这个异常不需要外部捕获。
|
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 加解密字节数组 |
|||
* @param algorithm 加解密算法 |
|||
* @param opmode 操作:1加密,2解密 |
|||
* @param key 密钥 |
|||
* @param data 数据 |
|||
* @throws InvalidKeyException 密钥错误 |
|||
* @throws BadPaddingException 解密密文错误(加密模式没有) |
|||
*/ |
|||
private static byte[] cipherDoFinal(Algorithm algorithm, int opmode, SecretKey key, byte[] data) throws InvalidKeyException, BadPaddingException { |
|||
Cipher cipher; |
|||
try { |
|||
cipher = Cipher.getInstance(algorithm.getTransformation(), PROVIDER_NAME); |
|||
} catch (Exception e) { |
|||
//NoSuchAlgorithmException:加密算法名是本工具类提供的,如果错了业务没有办法处理。所以这个异常不需要外部捕获。
|
|||
//NoSuchProviderException:Provider是本工具类提供的,如果错了业务没有办法处理。所以这个异常不需要外部捕获。
|
|||
//NoSuchPaddingException:没有特定的填充机制,与环境有关,业务没有办法处理。所以这个异常不需要外部捕获。
|
|||
throw new RuntimeException(e); |
|||
} |
|||
cipher.init(opmode, key); |
|||
try { |
|||
return cipher.doFinal(data); |
|||
} catch (IllegalBlockSizeException e) { |
|||
throw new RuntimeException(e);//业务不需要将数据分块(好像由底层处理了),如果错了业务没有办法处理。所以这个异常不需要外部捕获。
|
|||
} |
|||
} |
|||
|
|||
/****************************解密*********************************/ |
|||
/** |
|||
* 对字符串先进行base64解码,再解密 |
|||
* @param algorithm 加解密算法 |
|||
* @param key 密钥 |
|||
* @param data 密文 |
|||
* @param charset 编码字符集 |
|||
* @return 明文 |
|||
* @throws InvalidKeyException 密钥错误 |
|||
* @throws BadPaddingException 密文错误 |
|||
*/ |
|||
public static String decryptBase64(Algorithm algorithm, SecretKey key, String data, Charset charset) |
|||
throws InvalidKeyException, BadPaddingException { |
|||
return new String(decrypt(algorithm, key, Base64.decodeBase64(data)), charset); |
|||
} |
|||
|
|||
/** |
|||
* 解密字节数组 |
|||
* @param algorithm 加解密算法 |
|||
* @param key 密钥 |
|||
* @param data 密文 |
|||
* @return 明文 |
|||
* @throws InvalidKeyException 密钥错误 |
|||
* @throws BadPaddingException 密文错误 |
|||
*/ |
|||
public static byte[] decrypt(Algorithm algorithm, SecretKey key, byte[] data) throws InvalidKeyException, BadPaddingException { |
|||
return cipherDoFinal(algorithm, Cipher.DECRYPT_MODE, key, data); |
|||
} |
|||
|
|||
public static String Encrypt(String data) throws InvalidKeyException { |
|||
SecretKey key = genKeyByStr(Algorithm.SM4, SM4_KEY, encryptCharset); |
|||
return encryptBase64(Algorithm.SM4, key, data, encryptCharset); |
|||
} |
|||
public static String Decrypt(String data) throws BadPaddingException, InvalidKeyException { |
|||
SecretKey key = genKeyByStr(Algorithm.SM4, SM4_KEY, encryptCharset); |
|||
return decryptBase64(Algorithm.SM4, key, data, encryptCharset); |
|||
} |
|||
//加密
|
|||
public static String dealEncryptData(Object data) throws JsonProcessingException, InvalidKeyException { |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
String dataString = ""; |
|||
try { |
|||
if(data instanceof String){ |
|||
dataString = (String) data; |
|||
}else { |
|||
dataString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(data); |
|||
} |
|||
String dataEncrypt = Encrypt(dataString); |
|||
return dataEncrypt; |
|||
}catch (Exception e){ |
|||
return dataString; |
|||
} |
|||
} |
|||
//解密
|
|||
public static String dealDecryptData(Object data) throws JsonProcessingException, BadPaddingException, InvalidKeyException { |
|||
String dataString = ""; |
|||
try { |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
if (data instanceof String) { |
|||
dataString = (String) data; |
|||
} else { |
|||
dataString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(data); |
|||
} |
|||
String dataDecrypt = Decrypt(dataString); |
|||
return dataDecrypt; |
|||
}catch (Exception e){ |
|||
return dataString; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,184 @@ |
|||
package com.epmet.commons.tools.utils.api.yt; |
|||
|
|||
|
|||
import org.bouncycastle.jce.provider.BouncyCastleProvider; |
|||
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils; |
|||
|
|||
import javax.crypto.Cipher; |
|||
import javax.crypto.KeyGenerator; |
|||
import javax.crypto.spec.SecretKeySpec; |
|||
import java.security.*; |
|||
import java.util.Arrays; |
|||
|
|||
/** |
|||
* sm4加密算法工具类 |
|||
* |
|||
* @explain sm4加密、解密与加密结果验证 可逆算法 |
|||
* @Autor:jingyao |
|||
*/ |
|||
public class TestMs4 { |
|||
static { |
|||
Security.addProvider(new BouncyCastleProvider()); |
|||
} |
|||
|
|||
private static final String ENCODING = "UTF-8"; |
|||
public static final String ALGORITHM_NAME = "SM4"; |
|||
// 加密算法/分组加密模式/分组填充方式
|
|||
// PKCS5Padding-以8个字节为一组进行分组加密
|
|||
// 定义分组加密模式使用:PKCS5Padding
|
|||
public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS5Padding"; |
|||
// 128-32位16进制;256-64位16进制
|
|||
public static final int DEFAULT_KEY_SIZE = 128; |
|||
|
|||
/** |
|||
* 生成ECB暗号 |
|||
* |
|||
* @param algorithmName 算法名称 |
|||
* @param mode 模式 |
|||
* @param key |
|||
* @return |
|||
* @throws Exception |
|||
* @explain ECB模式(电子密码本模式:Electronic codebook) |
|||
*/ |
|||
private static Cipher generateEcbCipher(String algorithmName, int mode, byte[] key) throws Exception { |
|||
Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME); |
|||
Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME); |
|||
cipher.init(mode, sm4Key); |
|||
return cipher; |
|||
} |
|||
|
|||
/** |
|||
* 自动生成密钥 |
|||
* |
|||
* @return |
|||
* @throws NoSuchAlgorithmException |
|||
* @throws NoSuchProviderException |
|||
* @explain |
|||
*/ |
|||
public static byte[] generateKey() throws Exception { |
|||
return generateKey(DEFAULT_KEY_SIZE); |
|||
} |
|||
|
|||
|
|||
//加密******************************************
|
|||
|
|||
/** |
|||
* @param keySize |
|||
* @return |
|||
* @throws Exception |
|||
* @explain 系统产生秘钥 |
|||
*/ |
|||
public static byte[] generateKey(int keySize) throws Exception { |
|||
KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME); |
|||
kg.init(keySize, new SecureRandom()); |
|||
return kg.generateKey().getEncoded(); |
|||
} |
|||
|
|||
/** |
|||
* sm4加密 |
|||
* |
|||
* @param hexKey 16进制密钥(忽略大小写) |
|||
* @param paramStr 待加密字符串 |
|||
* @return 返回16进制的加密字符串 |
|||
* @throws Exception |
|||
* @explain 加密模式:ECB 密文长度不固定,会随着被加密字符串长度的变化而变化 |
|||
*/ |
|||
public static String encryptEcb(String hexKey, String paramStr) throws Exception { |
|||
String cipherText = ""; |
|||
// 16进制字符串-->byte[]
|
|||
byte[] keyData = ByteUtils.fromHexString(hexKey); |
|||
// String-->byte[]
|
|||
byte[] srcData = paramStr.getBytes(ENCODING); |
|||
// 加密后的数组
|
|||
byte[] cipherArray = encrypt_Ecb_Padding(keyData, srcData); |
|||
// byte[]-->hexString
|
|||
cipherText = ByteUtils.toHexString(cipherArray); |
|||
return cipherText; |
|||
} |
|||
|
|||
/** |
|||
* 加密模式之Ecb |
|||
* |
|||
* @param key |
|||
* @param data |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static byte[] encrypt_Ecb_Padding(byte[] key, byte[] data) throws Exception { |
|||
Cipher cipher = generateEcbCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, key);//声称Ecb暗号,通过第二个参数判断加密还是解密
|
|||
return cipher.doFinal(data); |
|||
} |
|||
|
|||
//解密****************************************
|
|||
|
|||
/** |
|||
* sm4解密 |
|||
* |
|||
* @param hexKey 16进制密钥 |
|||
* @param cipherText 16进制的加密字符串(忽略大小写) |
|||
* @return 解密后的字符串 |
|||
* @throws Exception |
|||
* @explain 解密模式:采用ECB |
|||
*/ |
|||
public static String decryptEcb(String hexKey, String cipherText) throws Exception { |
|||
// 用于接收解密后的字符串
|
|||
String decryptStr = ""; |
|||
// hexString-->byte[]
|
|||
byte[] keyData = ByteUtils.fromHexString(hexKey); |
|||
// hexString-->byte[]
|
|||
byte[] cipherData = ByteUtils.fromHexString(cipherText); |
|||
// 解密
|
|||
byte[] srcData = decrypt_Ecb_Padding(keyData, cipherData); |
|||
// byte[]-->String
|
|||
decryptStr = new String(srcData, ENCODING); |
|||
return decryptStr; |
|||
} |
|||
|
|||
/** |
|||
* 解密 |
|||
* |
|||
* @param key |
|||
* @param cipherText |
|||
* @return |
|||
* @throws Exception |
|||
* @explain |
|||
*/ |
|||
public static byte[] decrypt_Ecb_Padding(byte[] key, byte[] cipherText) throws Exception { |
|||
Cipher cipher = generateEcbCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, key);//生成Ecb暗号,通过第二个参数判断加密还是解密
|
|||
return cipher.doFinal(cipherText); |
|||
} |
|||
|
|||
/** |
|||
* 校验加密前后的字符串是否为同一数据 |
|||
* |
|||
* @param hexKey 16进制密钥(忽略大小写) |
|||
* @param cipherText 16进制加密后的字符串 |
|||
* @param paramStr 加密前的字符串 |
|||
* @return 是否为同一数据 |
|||
* @throws Exception |
|||
* @explain |
|||
*/ |
|||
public static boolean verifyEcb(String hexKey, String cipherText, String paramStr) throws Exception { |
|||
// 用于接收校验结果
|
|||
boolean flag = false; |
|||
// hexString-->byte[]
|
|||
byte[] keyData = ByteUtils.fromHexString(hexKey); |
|||
// 将16进制字符串转换成数组
|
|||
byte[] cipherData = ByteUtils.fromHexString(cipherText); |
|||
// 解密
|
|||
byte[] decryptData = decrypt_Ecb_Padding(keyData, cipherData); |
|||
// 将原字符串转换成byte[]
|
|||
byte[] srcData = paramStr.getBytes(ENCODING); |
|||
// 判断2个数组是否一致
|
|||
flag = Arrays.equals(decryptData, srcData); |
|||
return flag; |
|||
} |
|||
|
|||
public static void main(String[] args) throws Exception { |
|||
String text = "5d22ea44c7599a48f0d4446b1b7fbb4bb8353922df437d39c3a38549c0f2549cbd021ada00a8be83027ae06203c3daea2eedc5bd0875c7e509c7049045c5349577f2c21bcec328a5ea0bf341191e5bdba978566dddd16f1cf1928ff5cbd826dd33289fb45a8a04585f1f24ab04f59426371a5a0a0f2ee3e7b00d2bdfba7810524ce4c33130eda077546fa4c4191d0117f7a44e1cadac6c69a7d437653be1f958a459e0f025d471e09ab4636c38013032948ffb0827040ed6f3436be090f545186928a7b0b2bfc65782452606607ce8555ba130caacad73998da704428a07276a2699889c9872eebba5de8b72cdbe88705483293b00ab3ecb3aa57d283a4ecab40b71bc0a10e9ec626f07b2293255349fb2270d37e81c5c3d0de0b0f0706ed1872f60f039ce2e51effc39aef9747d67457e072cf3170a9c19589c1bab1a7d9d80"; |
|||
String s = TestMs4.decryptEcb("dbcff4c9f4774e6cb56080f279149d59", text); |
|||
System.out.println(s); |
|||
} |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,50 @@ |
|||
|
|||
package com.epmet.commons.tools.utils.api.yt; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:认证中心-用户信息 |
|||
* @author liujianjun |
|||
*/ |
|||
@Data |
|||
public class UserData implements Serializable { |
|||
|
|||
/** |
|||
* 性别:todo 不知道是什么值 |
|||
*/ |
|||
private String gender; |
|||
/** |
|||
* 手机号码 |
|||
*/ |
|||
private String mobileTelephoneNumber; |
|||
private String orderNumber; |
|||
/** |
|||
* 职务 |
|||
*/ |
|||
private String position; |
|||
/** |
|||
* 职级 |
|||
*/ |
|||
private String positionLevel; |
|||
/** |
|||
* 电话号码 |
|||
*/ |
|||
private String telephoneNumber; |
|||
/** |
|||
* 用户编码/id |
|||
*/ |
|||
private String userGuid; |
|||
/** |
|||
* 用户姓名 |
|||
*/ |
|||
private String userName; |
|||
/** |
|||
* 人员路径 |
|||
*/ |
|||
private String userPath; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,327 @@ |
|||
package com.epmet.commons.tools.utils.api.yt; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.fasterxml.jackson.core.JsonProcessingException; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.jetbrains.annotations.NotNull; |
|||
|
|||
import javax.crypto.BadPaddingException; |
|||
import java.security.InvalidKeyException; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* desc: |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2022/10/17 3:57 下午 |
|||
* @version: 1.0 |
|||
*/ |
|||
@Slf4j |
|||
public class YantaiApi { |
|||
private static final String SSO_SERVER = "http://172.20.46.155:8080/sso/"; |
|||
/** |
|||
* 相当于 appKey |
|||
*/ |
|||
private static final String CLIENT_ID = "1000009"; |
|||
/** |
|||
* 相当于 appSecret 用于解密 他们重定向回来的code 解密他们的token 获取用户嘻嘻 |
|||
*/ |
|||
private static final String CLIENT_SECRET = "a1f9879119bc4080ab5575f832b7d98b"; |
|||
/** |
|||
* 调用sso后台api接口的 秘钥 |
|||
*/ |
|||
private static final String SSO_API_TOKEN = "iJCDUgCBV/Zk5FkkaxLypA=="; |
|||
/** |
|||
* 政务网地址 |
|||
*/ |
|||
private static final String SSO_BACKGROUND_SERVER_URL = "http://172.20.46.155:8082/"; |
|||
/** |
|||
* 互联网地址 |
|||
*/ |
|||
//private static final String SSO_BACKGROUND_SERVER_URL = "http://120.220.248.247:8081/";
|
|||
|
|||
/** |
|||
* desc:根据组织id获取本级组织信息 |
|||
* |
|||
* @param organizationId |
|||
* @return |
|||
*/ |
|||
public static OrgData getOuInfoByOuGuid(String organizationId) { |
|||
try { |
|||
if (StringUtils.isBlank(organizationId)) { |
|||
throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|||
} |
|||
//加密
|
|||
String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId); |
|||
//pwd = URLEncoder.encode(pwd, "UTF-8");
|
|||
String url = SSO_BACKGROUND_SERVER_URL + "person/ouinfo/getOuInfoByOuGuid"; |
|||
|
|||
Map<String, Object> paramMap = new HashMap<>(); |
|||
paramMap.put("organizationId",organizationIdEn); |
|||
|
|||
log.info("getOuInfoByOuGuid request param:{} url:{}",paramMap, url); |
|||
Result<String> result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap()); |
|||
log.info("getOuInfoByOuGuid request result:{}", result); |
|||
if (!result.success()){ |
|||
return new OrgData(); |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(result.getData()); |
|||
String secondCode = jsonObject.getString("code"); |
|||
String secondMessage = jsonObject.getString("message"); |
|||
if (!"200".equals(secondCode)) { |
|||
log.warn("getOuInfoByOuGuid 接口错误"); |
|||
return new OrgData(); |
|||
} |
|||
//解密
|
|||
String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); |
|||
OrgData orgData = JSON.parseObject(data, OrgData.class); |
|||
log.info("getChildOuInfoByGuid request real result:{}", JSON.toJSONString(orgData)); |
|||
return orgData; |
|||
} catch (Exception e) { |
|||
log.error("getChildOuInfoByGuid exception", e); |
|||
} |
|||
return new OrgData(); |
|||
} |
|||
|
|||
/** |
|||
* desc:根据组织id获取下级组织 |
|||
* |
|||
* @param organizationId |
|||
* @return |
|||
*/ |
|||
public static List<OrgData> getChildOuInfoByGuid(String organizationId) { |
|||
try { |
|||
if (StringUtils.isBlank(organizationId)) { |
|||
throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|||
} |
|||
//加密
|
|||
String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId); |
|||
//pwd = URLEncoder.encode(pwd, "UTF-8");
|
|||
String url = SSO_BACKGROUND_SERVER_URL + "person/ouinfo/getChildOuInfoByGuid"; |
|||
|
|||
Map<String, Object> paramMap = new HashMap<>(); |
|||
paramMap.put("organizationId",organizationIdEn); |
|||
|
|||
log.info("getChildOuInfoByGuid request param:{} url:{}",paramMap, url); |
|||
Result<String> result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap()); |
|||
log.info("getChildOuInfoByGuid request result:{}", result); |
|||
if (!result.success()){ |
|||
return new ArrayList<>(); |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(result.getData()); |
|||
String secondCode = jsonObject.getString("code"); |
|||
String secondMessage = jsonObject.getString("message"); |
|||
if (!"200".equals(secondCode)) { |
|||
log.warn("getChildOuInfoByGuid 接口错误"); |
|||
return new ArrayList<>(); |
|||
} |
|||
//解密
|
|||
String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); |
|||
List<OrgData> orgData = JSON.parseArray(data, OrgData.class); |
|||
log.info("getChildOuInfoByGuid request real result:{}", JSON.toJSONString(orgData)); |
|||
return orgData; |
|||
} catch (Exception e) { |
|||
log.error("getChildOuInfoByGuid exception", e); |
|||
} |
|||
return new ArrayList<>(); |
|||
} |
|||
|
|||
/** |
|||
* desc:根据组织id获取下级组织 |
|||
* |
|||
* @param organizationId |
|||
* @return |
|||
*/ |
|||
public static List<UserData> getUserByOuGuid(String organizationId) { |
|||
try { |
|||
if (StringUtils.isBlank(organizationId)) { |
|||
throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|||
} |
|||
//加密
|
|||
String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(organizationId); |
|||
//pwd = URLEncoder.encode(pwd, "UTF-8");
|
|||
String url = SSO_BACKGROUND_SERVER_URL + "person/userInfo/getUserByOuGuid"; |
|||
|
|||
|
|||
Map<String, Object> paramMap = new HashMap<>(); |
|||
paramMap.put("organizationId",organizationIdEn); |
|||
log.info("getUserByOuGuid request param: url:{},param:{}", url, paramMap); |
|||
Result<String> result = HttpClientManager.getInstance().sendGet(url, paramMap, getApiHeaderMap()); |
|||
log.info("getUserByOuGuid request result:{}", result); |
|||
if (!result.success()){ |
|||
return new ArrayList<>(); |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(result.getData()); |
|||
String secondCode = jsonObject.getString("code"); |
|||
String secondMessage = jsonObject.getString("message"); |
|||
if (!"200".equals(secondCode)) { |
|||
log.warn("getUserByOuGuid 接口错误"); |
|||
return new ArrayList<>(); |
|||
} |
|||
//解密
|
|||
String data = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); |
|||
List<UserData> userData = JSON.parseArray(data, UserData.class); |
|||
log.info("getUserByOuGuid request real result:{}", JSON.toJSONString(userData)); |
|||
return userData; |
|||
} catch (Exception e) { |
|||
log.error("getUserByOuGuid exception", e); |
|||
} |
|||
return new ArrayList<>(); |
|||
} |
|||
|
|||
/** |
|||
* desc:根据组织id获取下级组织 |
|||
* |
|||
* @param code |
|||
* @return |
|||
*/ |
|||
public static YantaiSSOUser getLoginToken(String code) { |
|||
try { |
|||
if (StringUtils.isBlank(code)) { |
|||
throw new EpmetException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); |
|||
} |
|||
//加密
|
|||
String organizationIdEn = SM4UtilsForYanTai.dealEncryptData(code); |
|||
//pwd = URLEncoder.encode(pwd, "UTF-8");
|
|||
log.info("getLoginToken加密组织Id = " + organizationIdEn); |
|||
String url = SSO_SERVER + "logintoken?client_id=" + CLIENT_ID + "&client_code=" + code; |
|||
|
|||
Map<String, Object> headerMap = new HashMap<>(); |
|||
Map<String, Object> paramMap = new HashMap<>(); |
|||
log.info("getUserByOuGuid request param: url:{},header:{}", url, headerMap); |
|||
Result<String> result = HttpClientManager.getInstance().sendGet(url, paramMap, headerMap); |
|||
if (!result.success() || StringUtils.isBlank(result.getData())) { |
|||
log.info("getUserByOuGuid fail result:{}", JSON.toJSONString(result)); |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取token为空", "获取token为空"); |
|||
} |
|||
log.info("getUserByOuGuid request result:{}", result); |
|||
JSONObject jsonObject = JSONObject.parseObject(result.getData()); |
|||
//解密
|
|||
String errcode = jsonObject.getString("errcode"); |
|||
if (!NumConstant.ZERO_STR.equals(errcode)) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取token失败", "获取token失败"); |
|||
} |
|||
String sencondData = jsonObject.getString("data"); |
|||
log.info("getLoginToken jiami data:{}", sencondData); |
|||
//String data = SM4UtilsForYanTai.dealDecryptData(sencondData);
|
|||
|
|||
|
|||
String data = TestMs4.decryptEcb(CLIENT_SECRET, sencondData); |
|||
log.info("getLoginToken jiemi data:{}", sencondData); |
|||
YantaiSSOUser userData = JSON.parseObject(data, YantaiSSOUser.class); |
|||
log.info("getUserByOuGuid request real result:{}", JSON.toJSONString(userData)); |
|||
String userInfoMobile = getUserInfoMobile(userData.getUserGuid()); |
|||
userData.setMobile(userInfoMobile); |
|||
return userData; |
|||
} catch (Exception e) { |
|||
log.error("getUserByOuGuid exception", e); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static String getUserInfoMobile(String userId) { |
|||
try { |
|||
|
|||
String userIdEn = SM4UtilsForYanTai.dealEncryptData(userId); |
|||
|
|||
String serverUrl = SSO_BACKGROUND_SERVER_URL + "person/userInfo/getUserByUserGuid"; |
|||
//String serverUrl = "http://120.220.248.247:8081/person/userInfo/getUserByUserGuid";
|
|||
Map<String, Object> param = new HashMap<>(); |
|||
param.put("userGuid", userIdEn); |
|||
|
|||
Result<String> result = HttpClientManager.getInstance().sendGet(serverUrl, param, getApiHeaderMap()); |
|||
System.out.println(JSON.toJSONString(result)); |
|||
if (!result.success() || StringUtils.isBlank(result.getData())) { |
|||
log.info("getUserInfoMobile fail result:{}", JSON.toJSONString(result)); |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取用户信息失败", "获取用户信息失败"); |
|||
} |
|||
String data = result.getData(); |
|||
log.info("getUserInfoMobile jiami data:{}", JSON.parseObject(data)); |
|||
JSONObject jsonObject = JSON.parseObject(data); |
|||
String secondCode = jsonObject.getString("code"); |
|||
String secondMessage = jsonObject.getString("message"); |
|||
if (!"200".equals(secondCode)) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取人员信息接口返回失败" + secondMessage, "获取人员信息接口返回失败" + secondMessage); |
|||
} |
|||
String data1 = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); |
|||
String telephoneNumber = JSON.parseObject(data1).getString("mobileTelephoneNumber"); |
|||
log.info("getUserInfoMobile jiemi data:{}", telephoneNumber); |
|||
return telephoneNumber; |
|||
} catch (Exception e) { |
|||
log.error("getUserInfoMobile exception", e); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@NotNull |
|||
private static Map<String, Object> getApiHeaderMap() { |
|||
Map<String, Object> headerMap = new HashMap<>(); |
|||
try { |
|||
JSONObject token = new JSONObject(); |
|||
token.put("token", SSO_API_TOKEN); |
|||
// token.put("token","iJCDUgCBV/Zk5FkkaxLypA==");
|
|||
token.put("expiration", System.currentTimeMillis()); |
|||
|
|||
String tokanStr = SM4UtilsForYanTai.dealEncryptData(token.toString()); |
|||
headerMap.put("Authorization", "Bearer " + tokanStr); |
|||
} catch (Exception e) { |
|||
log.error("getApiHeaderMap exception", e); |
|||
} |
|||
return headerMap; |
|||
} |
|||
|
|||
public static void main(String[] args) throws BadPaddingException, InvalidKeyException, JsonProcessingException { |
|||
|
|||
//testGetUserByUserId();
|
|||
|
|||
//code只能用一次
|
|||
//getLoginToken("0d554bccfbac4be3846d643252daf92b");
|
|||
|
|||
String organizationId = "44e05de9-34fa-48f6-b89f-02838d792cf9"; |
|||
OrgData ouInfoByOuGuid = getOuInfoByOuGuid(organizationId); |
|||
System.out.println("ouInfoByOuGuid:"+JSON.toJSONString(ouInfoByOuGuid)); |
|||
List<OrgData> childOuInfoByGuid = getChildOuInfoByGuid(organizationId); |
|||
System.out.println("childOuInfoByGuid:"+JSON.toJSONString(childOuInfoByGuid)); |
|||
//先用他说的有人的组织id联调
|
|||
//String orgId = "2b271845-ed51-48aa-9935-00b9e7e06311";
|
|||
//orgId = "2b271845-ed51-48aa-9935-00b9e7e05778";
|
|||
List<UserData> userByOuGuid = getUserByOuGuid(organizationId); |
|||
System.out.println("getUserByOuGuid:"+JSON.toJSONString(userByOuGuid)); |
|||
|
|||
Map<String, Object> apiHeaderMap = getApiHeaderMap(); |
|||
System.out.println(apiHeaderMap); |
|||
//testGetUserByUserId();
|
|||
} |
|||
|
|||
private static void testGetUserByUserId() throws JsonProcessingException, InvalidKeyException, BadPaddingException { |
|||
String testUserId = "0ffd76e2-27b5-4b33-be9a-186f9f878bf1"; |
|||
|
|||
String serverUrl = SSO_BACKGROUND_SERVER_URL +"person/userInfo/getUserByUserGuid"; |
|||
//String serverUrl = "http://120.220.248.247:8081/person/userInfo/getUserByUserGuid";
|
|||
Map<String, Object> param = new HashMap<>(); |
|||
param.put("userGuid", SM4UtilsForYanTai.dealEncryptData(testUserId)); |
|||
Result<String> stringResult = HttpClientManager.getInstance().sendGet(serverUrl, param, getApiHeaderMap()); |
|||
System.out.println(JSON.toJSONString(stringResult)); |
|||
|
|||
String data = stringResult.getData(); |
|||
JSONObject jsonObject = JSON.parseObject(data); |
|||
String secondCode = jsonObject.getString("code"); |
|||
String secondMessage = jsonObject.getString("message"); |
|||
System.out.println(secondCode); |
|||
System.out.println(secondMessage); |
|||
String data1 = SM4UtilsForYanTai.dealDecryptData(jsonObject.getString("data")); |
|||
System.out.println("======" + data1); |
|||
String s = SM4UtilsForYanTai.dealDecryptData("EsOeQX+A8+GG26lzLnuKeuylkBDRFcTbF+gE/jURIzddlVI8RToQQhzK4EHy0WfpS/L4dSAJC93UyVLJhj+r/pup2RFq/GjpH7Md+1Mjg3dM+eyDuGql71bUrldQwJXYnHrQm3Mn7tk5m2eLhEVNkFvdELjuy3Kg8YihZXf2Sox+kxtmK4DSIn/gxhVCoUneWeL0cA6JGHI6jNuq97rzgcNK3Mwen8MxOoWP3n3r+kIpwZCwIlL70MrBjIZ6FHIhcxpqL82gpLSe1K0TFgeWw+9PMo1yv4cGZn7rU86TDlQFoDP86dVa1jrBoyUmW/vvLXrMKwfBaiv9/EUzcCLZWYxEwH93n0X/NYCYem3pfv4uXk5A7/D+Npgj9OKCEIz0ROn0UW5NiXI5Vibz0dywaq4sfsR/LiwjV81QOGY9tsHzN2+MnyTVpQg1l7looNnq1j+wwLneS0aDmbTqBLEn/baph/Hnr2L/9HYpWfXkhz93XRNAdsbxhXdG5ZIiJSwNasHinPR3e2Hmn/02GOsBPFUifbyNUtslt4RS/gwboonBoXz8wrmXi+PfzUXwN8f2CKdBNEHl72USp70NtBSJUPAkHdXZEQPgGRped63Z9GA="); |
|||
System.out.println("sssssss:" + s); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
|
|||
package com.epmet.commons.tools.utils.api.yt; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* sso:认证中心 用户信息 |
|||
* @author liujianjun |
|||
*/ |
|||
@Data |
|||
public class YantaiSSOUser implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2794280342919451106L; |
|||
|
|||
/** |
|||
* 他说这个是手机号 |
|||
*/ |
|||
private String clientId; |
|||
private String departmentCode; |
|||
private String expirationTime; |
|||
private String ip; |
|||
private String issueTime; |
|||
private String registerGuid; |
|||
private String registerName; |
|||
private String userGuid; |
|||
private String userName; |
|||
|
|||
/** |
|||
* 二次请求结果 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.form.stats; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 人房信息查询dto |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UserHouseStatsQueryFormDTO { |
|||
|
|||
private String orgId; |
|||
private String orgType; |
|||
|
|||
@NotBlank(message = "dateId不能为空") |
|||
private String dateId; |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.epmet.stats; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 人房信息统计 |
|||
*/ |
|||
@Data |
|||
public class UserHouseStatsResultDTO { |
|||
private Integer houseTotal = 0; |
|||
private Integer zzHouseTotal = 0; |
|||
private Integer czHouseTotal = 0; |
|||
private Integer xzHouseTotal = 0; |
|||
private Integer userTotal = 0; |
|||
private Integer czUserTotal = 0; |
|||
private Integer ldUserTotal = 0; |
|||
private Integer usingCommunityNum = 0; |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
package com.epmet.datareport.controller.stats; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.datareport.service.stats.UserHouseStatsService; |
|||
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; |
|||
import com.epmet.stats.UserHouseStatsResultDTO; |
|||
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; |
|||
|
|||
@RestController |
|||
@RequestMapping("userHouse") |
|||
public class UserHouseController { |
|||
|
|||
@Autowired |
|||
private UserHouseStatsService userHouseStatsService; |
|||
|
|||
/** |
|||
* 通过dateId查询人房统计信息 |
|||
* @param input |
|||
* @return |
|||
*/ |
|||
@PostMapping("getUserHouseDailyStatsByDateId") |
|||
public Result<UserHouseStatsResultDTO> getUserHouseDailyStatsByDateId(@RequestBody UserHouseStatsQueryFormDTO input) { |
|||
ValidatorUtils.validateEntity(input); |
|||
String orgId = input.getOrgId(); |
|||
String orgType = input.getOrgType(); |
|||
String dateId = input.getDateId(); |
|||
|
|||
UserHouseStatsResultDTO r = userHouseStatsService.getUserHouseDailyStats(orgId, orgType, dateId); |
|||
return new Result<UserHouseStatsResultDTO>().ok(r); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
package com.epmet.datareport.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
|
|||
/** |
|||
* 人房信息统计数,按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-27 |
|||
*/ |
|||
@Mapper |
|||
public interface FactAgencyUserHouseDailyDao extends BaseDao<FactAgencyUserHouseDailyEntity> { |
|||
|
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
package com.epmet.datareport.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
|
|||
/** |
|||
* 网格的人房信息统计数,按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-27 |
|||
*/ |
|||
@Mapper |
|||
public interface FactGridUserHouseDailyDao extends BaseDao<FactGridUserHouseDailyEntity> { |
|||
|
|||
} |
|||
@ -0,0 +1,115 @@ |
|||
package com.epmet.datareport.entity.stats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 人房信息统计数,按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-27 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_agency_user_house_daily") |
|||
public class FactAgencyUserHouseDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 数据更新至:yyyyMMdd; |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* agency_id所属的机关级别(社区级:community, |
|||
乡(镇、街道)级:street, |
|||
区县级: district, |
|||
市级: city |
|||
省级:province) |
|||
*/ |
|||
private String level; |
|||
|
|||
/** |
|||
* 组织i所属的组织id |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 组织i所有上级id |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 小区总数 |
|||
*/ |
|||
private Integer neighbourhoodsCount; |
|||
|
|||
/** |
|||
* 房屋总数 |
|||
*/ |
|||
private Integer houseCount; |
|||
|
|||
/** |
|||
* 自住房屋总数 |
|||
*/ |
|||
private Integer houseSelfCount; |
|||
|
|||
/** |
|||
* 出租房屋总数 |
|||
*/ |
|||
private Integer houseLeaseCount; |
|||
|
|||
/** |
|||
* 闲置房屋总数 |
|||
*/ |
|||
private Integer houseIdleCount; |
|||
|
|||
/** |
|||
* 居民总数 |
|||
*/ |
|||
private Integer userCount; |
|||
|
|||
/** |
|||
* 常住居民总数 |
|||
*/ |
|||
private Integer userResiCount; |
|||
|
|||
/** |
|||
* 流动居民总数 |
|||
*/ |
|||
private Integer userFloatCount; |
|||
|
|||
/** |
|||
* 当日新增房屋数 |
|||
*/ |
|||
private Integer houseIncr; |
|||
|
|||
/** |
|||
* 当日修改房屋数 |
|||
*/ |
|||
private Integer houseModify; |
|||
|
|||
/** |
|||
* 当日新增居民数 |
|||
*/ |
|||
private Integer userIncr; |
|||
|
|||
/** |
|||
* 当日修改居民数 |
|||
*/ |
|||
private Integer userModify; |
|||
|
|||
} |
|||
@ -0,0 +1,106 @@ |
|||
package com.epmet.datareport.entity.stats; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 网格的人房信息统计数,按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-27 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_grid_user_house_daily") |
|||
public class FactGridUserHouseDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 数据更新至:yyyyMMdd; |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格所属的组织id |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 网格所有上级id |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 小区总数 |
|||
*/ |
|||
private Integer neighbourhoodsCount; |
|||
|
|||
/** |
|||
* 房屋总数 |
|||
*/ |
|||
private Integer houseCount; |
|||
|
|||
/** |
|||
* 自住房屋总数 |
|||
*/ |
|||
private Integer houseSelfCount; |
|||
|
|||
/** |
|||
* 出租房屋总数 |
|||
*/ |
|||
private Integer houseLeaseCount; |
|||
|
|||
/** |
|||
* 闲置房屋总数 |
|||
*/ |
|||
private Integer houseIdleCount; |
|||
|
|||
/** |
|||
* 居民总数 |
|||
*/ |
|||
private Integer userCount; |
|||
|
|||
/** |
|||
* 常住居民总数 |
|||
*/ |
|||
private Integer userResiCount; |
|||
|
|||
/** |
|||
* 流动居民总数 |
|||
*/ |
|||
private Integer userFloatCount; |
|||
|
|||
/** |
|||
* 当日新增房屋数 |
|||
*/ |
|||
private Integer houseIncr; |
|||
|
|||
/** |
|||
* 当日修改房屋数 |
|||
*/ |
|||
private Integer houseModify; |
|||
|
|||
/** |
|||
* 当日新增居民数 |
|||
*/ |
|||
private Integer userIncr; |
|||
|
|||
/** |
|||
* 当日修改居民数 |
|||
*/ |
|||
private Integer userModify; |
|||
|
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.epmet.datareport.service.stats; |
|||
|
|||
import com.epmet.stats.UserHouseStatsResultDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
/** |
|||
* 人房统计service |
|||
*/ |
|||
public interface UserHouseStatsService { |
|||
|
|||
/** |
|||
* 查询指定dateId的人房统计信息 |
|||
* @param orgId |
|||
* @param orgType |
|||
* @param dateId |
|||
* @return |
|||
*/ |
|||
UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId); |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
package com.epmet.datareport.service.stats.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.datareport.dao.stats.FactAgencyUserHouseDailyDao; |
|||
import com.epmet.datareport.dao.stats.FactGridUserHouseDailyDao; |
|||
import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity; |
|||
import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity; |
|||
import com.epmet.datareport.service.stats.UserHouseStatsService; |
|||
import com.epmet.stats.UserHouseStatsResultDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@DataSource(DataSourceConstant.STATS) |
|||
public class UserHouseStatsServiceImpl implements UserHouseStatsService { |
|||
|
|||
@Autowired |
|||
private FactGridUserHouseDailyDao factGridUserHouseDailyDao; |
|||
|
|||
@Autowired |
|||
private FactAgencyUserHouseDailyDao factAgencyUserHouseDailyDao; |
|||
|
|||
@Override |
|||
public UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId) { |
|||
// 没有传参,使用当前登录人的
|
|||
if (StringUtils.isEmpty(orgId) || StringUtils.isEmpty(orgType)) { |
|||
String userId = EpmetRequestHolder.getLoginUserId(); |
|||
String customerId = EpmetRequestHolder.getLoginUserCustomerId(); |
|||
|
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|||
if (null == staffInfo) { |
|||
throw new EpmetException(String.format("查询工作人员%s缓存信息失败:%s", userId)); |
|||
} |
|||
|
|||
orgId = staffInfo.getAgencyId(); |
|||
orgType = "agency"; |
|||
} |
|||
|
|||
// 结果对象初始化
|
|||
UserHouseStatsResultDTO result = new UserHouseStatsResultDTO(); |
|||
|
|||
if ("agency".equals(orgType)) { |
|||
// 查询的目标是组织
|
|||
LambdaQueryWrapper<FactAgencyUserHouseDailyEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(FactAgencyUserHouseDailyEntity::getDateId, dateId); |
|||
query.eq(FactAgencyUserHouseDailyEntity::getAgencyId, orgId); |
|||
FactAgencyUserHouseDailyEntity agencyDailyStats = factAgencyUserHouseDailyDao.selectOne(query); |
|||
if (agencyDailyStats != null) { |
|||
result.setHouseTotal(agencyDailyStats.getHouseCount()); |
|||
result.setCzHouseTotal(agencyDailyStats.getHouseLeaseCount()); |
|||
result.setXzHouseTotal(agencyDailyStats.getHouseIdleCount()); |
|||
result.setZzHouseTotal(agencyDailyStats.getHouseSelfCount()); |
|||
result.setUserTotal(agencyDailyStats.getUserCount()); |
|||
result.setCzUserTotal(agencyDailyStats.getUserResiCount()); |
|||
result.setLdUserTotal(agencyDailyStats.getUserFloatCount()); |
|||
} |
|||
} else { |
|||
// 查询的目标是网格
|
|||
LambdaQueryWrapper<FactGridUserHouseDailyEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(FactGridUserHouseDailyEntity::getDateId, dateId); |
|||
query.eq(FactGridUserHouseDailyEntity::getGridId, orgId); |
|||
FactGridUserHouseDailyEntity gridDailyStats = factGridUserHouseDailyDao.selectOne(query); |
|||
if (gridDailyStats != null) { |
|||
result.setHouseTotal(gridDailyStats.getHouseCount()); |
|||
result.setCzHouseTotal(gridDailyStats.getHouseLeaseCount()); |
|||
result.setXzHouseTotal(gridDailyStats.getHouseIdleCount()); |
|||
result.setZzHouseTotal(gridDailyStats.getHouseSelfCount()); |
|||
result.setUserTotal(gridDailyStats.getUserCount()); |
|||
result.setCzUserTotal(gridDailyStats.getUserResiCount()); |
|||
result.setLdUserTotal(gridDailyStats.getUserFloatCount()); |
|||
} |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.datareport.dao.stats.FactAgencyUserHouseDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity" id="factAgencyUserHouseDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="level" column="LEVEL"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="neighbourhoodsCount" column="NEIGHBOURHOODS_COUNT"/> |
|||
<result property="houseCount" column="HOUSE_COUNT"/> |
|||
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/> |
|||
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/> |
|||
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/> |
|||
<result property="userCount" column="USER_COUNT"/> |
|||
<result property="userResiCount" column="USER_RESI_COUNT"/> |
|||
<result property="userFloatCount" column="USER_FLOAT_COUNT"/> |
|||
<result property="houseIncr" column="HOUSE_INCR"/> |
|||
<result property="houseModify" column="HOUSE_MODIFY"/> |
|||
<result property="userIncr" column="USER_INCR"/> |
|||
<result property="userModify" column="USER_MODIFY"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
</mapper> |
|||
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.datareport.dao.stats.FactGridUserHouseDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity" id="factGridUserHouseDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="neighbourhoodsCount" column="NEIGHBOURHOODS_COUNT"/> |
|||
<result property="houseCount" column="HOUSE_COUNT"/> |
|||
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/> |
|||
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/> |
|||
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/> |
|||
<result property="userCount" column="USER_COUNT"/> |
|||
<result property="userResiCount" column="USER_RESI_COUNT"/> |
|||
<result property="userFloatCount" column="USER_FLOAT_COUNT"/> |
|||
<result property="houseIncr" column="HOUSE_INCR"/> |
|||
<result property="houseModify" column="HOUSE_MODIFY"/> |
|||
<result property="userIncr" column="USER_INCR"/> |
|||
<result property="userModify" column="USER_MODIFY"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
</mapper> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue