diff --git a/epmet-admin/epmet-admin-server/pom.xml b/epmet-admin/epmet-admin-server/pom.xml index c9903ba390..1bd83b7e49 100644 --- a/epmet-admin/epmet-admin-server/pom.xml +++ b/epmet-admin/epmet-admin-server/pom.xml @@ -136,6 +136,7 @@ false + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -172,6 +173,7 @@ false + false 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -205,6 +207,7 @@ true + true 192.168.10.161:9876 epmet_message @@ -238,6 +241,7 @@ true + true 192.168.11.187:9876;192.168.11.184:9876 epmet_message diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java index ef71399b7d..8c07d1279d 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java @@ -2,8 +2,11 @@ package com.epmet.mq.listener; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.mq.listener.listener.AuthOperationLogListener; +import com.epmet.mq.listener.listener.PointOperationLogListener; import com.epmet.mq.listener.listener.ProjectOperationLogListener; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; @@ -15,54 +18,15 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; +public class RocketMQConsumerRegister extends MQAbstractRegister { - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(nameServer, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener()); - register(nameServer, ConsomerGroupConstants.PROJECT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectOperationLogListener()); - } - } catch (MQClientException e) { - e.printStackTrace(); - } - } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener()); + register(consumerProperties, ConsomerGroupConstants.PROJECT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectOperationLogListener()); + register(consumerProperties, ConsomerGroupConstants.POINT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.POINT, "*", new PointOperationLogListener()); - return instanceName; + // ...其他监听器类似 } - -} +} \ No newline at end of file diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java new file mode 100644 index 0000000000..f953c35edc --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java @@ -0,0 +1,91 @@ +package com.epmet.mq.listener.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg; +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.utils.SpringContextUtils; +import com.epmet.entity.LogOperationEntity; +import com.epmet.enums.SystemMessageTypeEnum; +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 wxz + * @Description 积分相关日志监听器 + + * @return + * @date 2021.06.21 10:13 + */ +public class PointOperationLogListener implements MessageListenerConcurrently { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { + 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 opeType = messageExt.getTags(); + String msg = new String(messageExt.getBody()); + logger.info("积分操作日志监听器-收到消息内容:{}", msg); + PointRuleChangedMQMsg msgObj = JSON.parseObject(msg, PointRuleChangedMQMsg.class); + + String content = StringUtils.isBlank(msgObj.getOperationBrief()) ? "" : msgObj.getOperationBrief(); + + OperatorInfo operatorInfo = LogOperationHelper.getInstance().getOperatorInfo(msgObj.getOperatorId()); + + LogOperationEntity logEntity = new LogOperationEntity(); + logEntity.setCategory(messageExt.getTopic()); + logEntity.setType(opeType); + logEntity.setTypeDisplay(SystemMessageTypeEnum.getTypeDisplay(opeType)); + logEntity.setTargetId(msgObj.getRuleId()); + logEntity.setIp(msgObj.getIp()); + logEntity.setFromApp(msgObj.getFromApp()); + logEntity.setFromClient(msgObj.getFromClient()); + logEntity.setCustomerId(operatorInfo.getCustomerId()); + logEntity.setOperatorId(msgObj.getOperatorId()); + logEntity.setOperatorMobile(operatorInfo.getMobile()); + logEntity.setOperatorName(operatorInfo.getName()); + logEntity.setOperatingTime(msgObj.getOperatingTime()); + logEntity.setContent(content); + + DistributedLock distributedLock = null; + RLock lock = null; + try { + distributedLock = SpringContextUtils.getBean(DistributedLock.class); + lock = distributedLock.getLock(String.format("lock:point_operation_log:%s:%s", logEntity.getType(), logEntity.getTargetId()), + 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); + } + } +} diff --git a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml index 0d9082cec3..74c6bc2567 100644 --- a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml +++ b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml @@ -136,4 +136,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ \ No newline at end of file diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index 41f9469ec2..29283f6b01 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java @@ -290,7 +290,7 @@ public class SsoServiceImpl implements SsoService { //3.根据华为openId查询用户是否存在历史登陆信息 Result 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())); + logger.warn(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(); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 4d848f2dcf..39b8d0d9ed 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -164,7 +164,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol //2.根据openid查询用户是否存在历史登陆信息 Result latestStaffWechat = epmetUserOpenFeignClient.getLatestStaffWechatLoginRecord(userWechatDTO.getWxOpenId()); if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { - logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); + logger.warn(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(); @@ -486,7 +486,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol dto.setMobile(formDTO.getMobile()); Result> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto); if (!customerStaffResult.success()) { - logger.error(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + logger.warn(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); throw new RenException(customerStaffResult.getCode()); } //2、密码是否正确 @@ -529,7 +529,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol if(result.success()&&null!=result.getData()){ return result.getData(); } - logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s", + logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER, formDTO.getMobile(), formDTO.getPassword(), diff --git a/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java b/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java index caad8b0869..14d4210afa 100644 --- a/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java +++ b/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java @@ -2,7 +2,6 @@ package io.renren; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; - @SpringBootApplication public class GeneratorApplication { diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java index f0afe84833..de796f3760 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java @@ -97,10 +97,18 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { } public Object getCustomerIdByFieldValue(MetaObject metaObject) { - if (metaObject.hasSetter(FieldConstant.CUSTOMER_ID_HUMP)) { - return loginUserUtil.getLoginUserCustomerId(); + if (!metaObject.hasSetter(FieldConstant.CUSTOMER_ID_HUMP)) { + // 如果该entity对象,没有customerId属性,那么返回null; + return null; } - return null; + + Object customerId; + customerId = getFieldValByName(FieldConstant.CUSTOMER_ID_HUMP, metaObject); + if (customerId != null && !customerId.equals("")) { + // 看entity是否手动设置了,设置了就用设置的 + return customerId; + } + return loginUserUtil.getLoginUserCustomerId(); } public Object getCreatedTimeByFieldValue(MetaObject metaObject) { diff --git a/epmet-commons/epmet-commons-rocketmq/pom.xml b/epmet-commons/epmet-commons-rocketmq/pom.xml index 346f055ccc..75b7a9d1a5 100644 --- a/epmet-commons/epmet-commons-rocketmq/pom.xml +++ b/epmet-commons/epmet-commons-rocketmq/pom.xml @@ -26,5 +26,10 @@ org.projectlombok lombok + + com.epmet + epmet-commons-tools + 2.0.0 + diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index ef5970dbb3..890d19acf1 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -37,8 +37,12 @@ public interface ConsomerGroupConstants { String AUTH_OPERATION_LOG_GROUP = "auth_operation_log_group"; /** - * 项目操作日志小肥猪 + * 项目操作日志消费组 */ String PROJECT_OPERATION_LOG_GROUP = "project_operation_log_group"; + /** + * 积分操作消费组 + */ + String POINT_OPERATION_LOG_GROUP = "point_operation_log_group"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index 70d4e006f8..8fe36aa53a 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -2,6 +2,7 @@ package com.epmet.commons.rocketmq.constants; /** * 话题列表常量,其他服务要想发送消息到mq,则应当引入epmet-commons-rocketmq模块,并且使用此常量 + * 用于mq中的topic */ public interface TopicConstants { /** @@ -21,4 +22,9 @@ public interface TopicConstants { * 认证 */ String AUTH = "auth"; + + /** + * 积分系统话题 + */ + String POINT = "point"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PointRuleChangedMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PointRuleChangedMQMsg.java new file mode 100644 index 0000000000..073d18821c --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PointRuleChangedMQMsg.java @@ -0,0 +1,33 @@ +package com.epmet.commons.rocketmq.messages; + +import lombok.Data; + +import java.util.Date; + +/** + * 积分规则变动消息体 + */ +@Data +public class PointRuleChangedMQMsg { + /** + * 操作简介 + */ + private String operationBrief; + + /** + * 规则的id + */ + private String ruleId; + /** + * 谁操作的 + */ + private String operatorId; + + private String ip; + + private String fromApp; + + private String fromClient; + + private Date operatingTime; +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java deleted file mode 100644 index 71a8fea41c..0000000000 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.epmet.commons.rocketmq.register; - -import lombok.Data; -import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; - -import java.io.Serializable; - -/** - * desc:mq 消费配置类 - * - * @author: LiuJanJun - * @date: 2021/4/30 2:39 下午 - * @version: 1.0 - */ -@Data -public class ConsumerConfigProperties implements Serializable { - - private static final long serialVersionUID = 2069676324708473773L; - /** - * 消费者组 - */ - private String consumerGroup; - /** - * 主题 - */ - private String topic; - /** - * 标签 - */ - private String tag = "*"; - /** - * 最小消费的线程数 - */ - private int consumeThreadMin = 2; - /** - * 最大消费的线程数 - */ - private int consumeThreadMax = 4; - /** - * 消费监听器 - */ - private MessageListenerConcurrently consumerListener; -} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java new file mode 100644 index 0000000000..b1ca887c59 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java @@ -0,0 +1,77 @@ +package com.epmet.commons.rocketmq.register; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; +import org.apache.rocketmq.client.consumer.listener.MessageListener; +import org.apache.rocketmq.client.exception.MQClientException; +import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; + +/** + * @author wxz + * @Description 父类抽象注册器 + * @date 2021.07.14 15:38:21 + */ +@Slf4j +public abstract class MQAbstractRegister { + + /** + * @Description 注册所有监听器,由子类实现,做具体监听器的注册 + * @return + * @author wxz + * @date 2021.07.14 15:48 + */ + public abstract void registerAllListeners(String env, MQConsumerProperties consumerProperties); + + /** + * @Description 真正执行注册的方法,供子类直接调用,子类也可以覆盖该方法 + * @return + * @author wxz + * @date 2021.07.14 15:56 + */ + public void register(MQConsumerProperties consumerProperties, String group, MessageModel messageModel, String topic, String subExpression, MessageListener listener) { + try { + String nameServer = consumerProperties.getNameServer(); + Integer consumeThreadMin = consumerProperties.getConsumeThreadMin(); + Integer consumeThreadMax = consumerProperties.getConsumeThreadMax(); + String instanceName = buildInstanceName(); + // 实例化消费者 + DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); + + // 设置NameServer的地址 + consumer.setNamesrvAddr(nameServer); + consumer.setMessageModel(messageModel); + consumer.setInstanceName(instanceName); + // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 + consumer.subscribe(topic, subExpression); + // 注册回调实现类来处理从broker拉取回来的消息 + consumer.registerMessageListener(listener); + if (consumeThreadMin != null) { + consumer.setConsumeThreadMin(consumeThreadMin); + } + if (consumeThreadMax != null) { + consumer.setConsumeThreadMax(consumeThreadMax); + } + // 启动消费者实例 + consumer.start(); + log.info(String.format("监听器注册完成,消费者组:%s,Topic:%s,Tag:%s,实例名称:%s", group, topic, subExpression, instanceName)); + } catch (Exception e) { + log.error(String.format("监听器注册失败,消费者组:%s,Topic:%s,Tag:%s。详细信息:%s", group, topic, subExpression, ExceptionUtils.getErrorStackTrace(e))); + } + } + + /** + * @Description 构造实例名称 + * @return + * @author wxz + * @date 2021.07.14 15:56 + */ + private String buildInstanceName() { + String instanceName = ""; + for (int i = 0; i < 4; i++) { + int t = (int) (Math.random() * 10); + instanceName = instanceName.concat(t + ""); + } + return instanceName; + } +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java new file mode 100644 index 0000000000..76af70e0e2 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java @@ -0,0 +1,29 @@ +package com.epmet.commons.rocketmq.register; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * @Description 注册属性 + * @author wxz + * @date 2021.07.14 15:33:16 +*/ +@Data +@ConfigurationProperties(prefix = "rocketmq") +public class MQConsumerProperties { + + /** + * nameServer + */ + private String nameServer; + + /** + * 最小消费线程数 + */ + private Integer consumeThreadMin; + /** + * 最大消费线程数 + */ + private Integer consumeThreadMax; + +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java deleted file mode 100644 index 3387b55931..0000000000 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.epmet.commons.rocketmq.register; - -import lombok.extern.slf4j.Slf4j; -import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; -import org.apache.rocketmq.client.exception.MQClientException; -import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; -import org.springframework.beans.factory.annotation.Value; - -import javax.annotation.PostConstruct; - -/** - * desc:注册mq监听器 - * - * @author liujianjun - */ -@Slf4j -public abstract class MQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String namesrvAddr; - - public abstract ConsumerConfigProperties getConsumerProperty(); - - - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerMQListener() { - ConsumerConfigProperties consumerProperty = getConsumerProperty(); - log.info("registerAllListeners consumers:{} success", consumerProperty); - //本地环境不注册 - //if (!"local".equals(env)) { - try { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(consumerProperty.getConsumerGroup()); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(namesrvAddr); - consumer.setMessageModel(MessageModel.CLUSTERING); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(consumer.getConsumerGroup(), consumerProperty.getTag()); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(consumerProperty.getConsumerListener()); - consumer.setConsumeThreadMin(consumerProperty.getConsumeThreadMin()); - consumer.setConsumeThreadMax(consumerProperty.getConsumeThreadMax()); - // 启动消费者实例 - consumer.start(); - } catch (MQClientException e) { - log.info("registerMQListener exception", e); - } - - //} - - } - - /** - * desc: 因为docker-compose部署有问题 所有自己命名 - * - * @param - * @return java.lang.String - * @author LiuJanJun - * @date 2021/4/30 5:00 下午 - */ - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } -} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java new file mode 100644 index 0000000000..77e3d178f7 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java @@ -0,0 +1,35 @@ +package com.epmet.commons.rocketmq.register; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; + +/** + * @author wxz + * @Description MQ注册配置类 + * @date 2021.07.14 15:36:24 + */ +@Configuration +@ConditionalOnProperty(prefix = "rocketmq", name = "enable", havingValue = "true", matchIfMissing = false) +@EnableConfigurationProperties(MQConsumerProperties.class) +@Slf4j +public class MQRegisterConfiguration { + + @Value("${spring.profiles.active}") + private String env; + @Autowired + private MQConsumerProperties consumerProperties; + @Autowired + private MQAbstractRegister mqRegister; + + @PostConstruct + public void register() { + mqRegister.registerAllListeners(env, consumerProperties); + log.info("监听器注册动作执行完毕"); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index 9ff138efe7..49681043e0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -136,4 +136,13 @@ public interface Constant { String CREATED_TIME = "created_time"; String DEFAULT_CUSTOMER = "default"; + + /** + * 省级:province; 市级: city; 区县级: district ;乡(镇、街道)级:street ;社区级:community + */ + String PROVINCE = "province"; + String CITY = "city"; + String DISTRICT = "district"; + String STREET = "street"; + String COMMUNITY = "community"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index 25cfa3e0b2..c601d2fd71 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -86,4 +86,14 @@ public interface StrConstant { String SPECIAL_CUSTOMER = "150282ed25c14ff0785e7e06283b6283"; //平音客户 String PY_CUSTOMER = "6f203e30de1a65aab7e69c058826cd80"; + + /** + * 单位积分,积分上限,积分说明,积分事件 + */ + String POINT_CHANGE = "将%s调整为%s"; + + /** + * 积分规则修改的头 + */ + String POINT_CHANGE_HEAD = "修改了%s规则,"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index ff5e18b091..8c8fd0dab3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -170,7 +170,8 @@ public enum RequirePermissionEnum { * 更多-日志记录 */ MORE_PATROL_RECORD_LIST("more_patrol_record_list","更多:日志记录:巡查记录:列表","巡查记录列表"), - MORE_SYSTEM_LOG_LIST("MORE_SYSTEM_LOG_LIST","更多:日志记录:系统日志:列表","系统日志列表"), + MORE_SYSTEM_LOG_LIST("more_system_log_list","更多:日志记录:系统日志:列表","系统日志列表"), + MORE_GRID_MEMBER_STATS_ANALYSIS("more_grid_member_stats_analysis", "更多:网格员数据分析", "更多:网格员数据分析"), /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 2538492bb8..43c5468cc3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -129,6 +129,7 @@ public enum EpmetErrorCode { OPER_UPLOAD_IMG_TYPE_ERROR(8716, "请上传PNG格式的图片"), OPER_UPLOAD_IMG_SIZE_ERROR(8717, "请上传200*200的图片"), OPER_CORS_CONFIG_ERROR(8718, "跨域配置错误"), + ACCESS_CONFIG_ERROR(8719, "权限配置错误"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), @@ -186,7 +187,11 @@ public enum EpmetErrorCode { SIGN_IN_TIME_PASSED(8912,"当前时间已超过签到时间"), INVITATION_NOT_EXIST(8913,"链接不存在"), NOTICE_EXPIRATION_TIME(8914,"通知过期时间不能早于当前时间"), - NOTICE_BE_OVERDUE(8915,"通知已过期不允许再次变更"); + NOTICE_BE_OVERDUE(8915,"通知已过期不允许再次变更"), + + SAME_RULE_NAME(8916,"该积分事件已存在,请重新调整保存"), + UP_LIMIT_POINT(8917,"积分上限需为单位积分倍数,请重新调整保存"), + BADGE_CHECK(8918,""); private int code; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java index 3064252ce7..6837104b36 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java @@ -25,22 +25,16 @@ public class ExceptionUtils { * @return 返回异常信息 */ public static String getErrorStackTrace(Exception ex){ - return getErrorStackTraceOfThrowable(ex); + return getThrowableErrorStackTrace(ex); } - /** - * @Description Throwable级别的错误信息 - * @return - * @author wxz - * @date 2021.07.07 14:37 - */ - public static String getErrorStackTraceOfThrowable(Throwable t) { + public static String getThrowableErrorStackTrace(Throwable ex) { StringWriter sw = null; PrintWriter pw = null; try { sw = new StringWriter(); pw = new PrintWriter(sw, true); - t.printStackTrace(pw); + ex.printStackTrace(pw); }finally { try { if(pw != null) { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 68c417c580..6f5e7bf1f3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -469,4 +469,8 @@ public class RedisKeys { public static String getCorsConfigKey() { return rootPrefix.concat("sys:cors"); } + + public static String getProjectChangedMsgDistinceKey(String customerId) { + return rootPrefix.concat("project_changed:consume:").concat(customerId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index 3a556da632..c2988b67f9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -446,6 +446,22 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_PATTERN_YYYYMM); } + /** + * @Description 获取指定 月份的前n月 返回yyyyMM + * @Param beforeMonth + * @Param monthId + * @author zxc + * @date 2021/7/9 2:44 下午 + */ + public static String getBeforeNMonthByMonth(int beforeMonth, String monthId){ + StringBuilder builder = new StringBuilder(monthId); + builder.insert(NumConstant.FOUR,"-"); + builder.insert(builder.length(),"-01"); + LocalDate parse = LocalDate.parse(builder.toString()); + LocalDate localDate = parse.minusMonths(beforeMonth); + return localDate.toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); + } + /** * @return java.util.List 返回yyyyMMdd * @param startTime yyyyMMdd @@ -847,4 +863,15 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_TIME_PATTERN); } + /** + * @Author sun + * @Description 获取当前日期几个自然月之前的日期(yyyy-MM-dd HH:mm:ss) + **/ + public static String getBeforeMonthDate(int beforMonth, String dateType){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, - beforMonth); + Date date = c.getTime(); + return DateUtils.format(date,dateType); + } + } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 6d62b56d53..dc71150423 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -233,6 +233,9 @@ lb://epmet-openapi-adv-server + + https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 + SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd @@ -361,6 +364,9 @@ lb://epmet-openapi-adv-server + + https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 + SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd @@ -458,6 +464,9 @@ lb://epmet-openapi-adv-server + + https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 + SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd @@ -552,6 +561,9 @@ lb://epmet-openapi-adv-server + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index d21ec692c5..caf1ca5530 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -16,7 +16,6 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.util.AntPathMatcher; -import org.springframework.util.MultiValueMap; import org.springframework.web.server.ServerWebExchange; /** @@ -73,6 +72,7 @@ public class ExternalAuthProcessor extends AuthProcessor { } if (!inPaths) { + logger.error("auth 401 ,uri:{}",requestUri); throw new RenException(EpmetErrorCode.ERR401.getCode(), "所请求的url并未对外部应用开放"); } diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 4259540d53..dce0862481 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -476,11 +476,24 @@ epmet: # 外部应用认证,使用AccessToken等头进行认证 externalOpenUrls: - /data/report/** - - /data/stats/** - /epmet/ext/** - /epmetuser/customerstaff/customerlist - /message/template/** - /data/aggregator/project/projectdistribution + - /data/aggregator/epmetuser/open-staffdetail + #stats external包下 公共的类只外部暴露方法 纯外部使用的 暴漏整个 + - /data/stats/statsuser/gm-uploadevent + - /data/stats/statsuser/gm-uploaddata + - /data/stats/indexcalculate/all + - /data/stats/kcscreencoll/** + - /data/stats/indexcollect/** + - /data/stats/anscreencoll/** + - /data/stats/plugin/** + - /data/stats/screencoll/** + - /data/stats/project/** + - /data/stats/basereport/** + - /data/stats/governance/** + # 对外开放接口认证白名单 externalAuthUrlsWhiteList: @@ -494,3 +507,8 @@ jwt: secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet] #token有效时长,默认7天,单位秒 expire: 604800 + +dingTalk: + robot: + webHook: @dingTalk.robot.webHook@ + secret: @dingTalk.robot.secret@ diff --git a/epmet-gateway/src/main/resources/logback-spring.xml b/epmet-gateway/src/main/resources/logback-spring.xml index dfb3c43f5d..876bbde4e8 100644 --- a/epmet-gateway/src/main/resources/logback-spring.xml +++ b/epmet-gateway/src/main/resources/logback-spring.xml @@ -5,6 +5,8 @@ + + ${appname} @@ -131,13 +133,21 @@ ACCEPT DENY + + + ERROR + ACCEPT + DENY + ${webHook} + ${secret} + ${appname} + - + - diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java index a7da3d564b..b3083d658e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/OrgConstant.java @@ -7,4 +7,8 @@ package com.epmet.dataaggre.constant; public interface OrgConstant { String AGENCY = "agency"; String GRID = "grid"; + String PROVINCE = "province"; + String CITY = "city"; + String DISTRICT = "district"; + } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java index 82315c125f..14bfa2c51b 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgencyGovrnFormDTO.java @@ -33,6 +33,14 @@ public class AgencyGovrnFormDTO implements Serializable { * 街道解决占比:street */ private String type; + /** + * 组织级别 + */ + private String level; + /** + * 组织地区码 + */ + private String areaCode; public interface Agency extends CustomerClientShowGroup {} } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java index 7e5407a8ef..d760cd834f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/GovrnRatioFormDTO.java @@ -28,6 +28,8 @@ public class GovrnRatioFormDTO implements Serializable { * 日维度Id[日期,不传值默认查前一天的【格式:20210101】] */ private String dateId; + private String areaCode; + private String level; public interface AgencyGrid extends CustomerClientShowGroup {} } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java index 144368c26e..8b0f229204 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyGroupResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //党群小组总数 private Integer groupTotal = 0; //楼院小组总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java index 5bece9dab4..a13f9d158b 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyIssueResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //议题总数 private Integer issueTotal = 0; //表决中总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java index 33aa889ad4..63b0c512ca 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyProjectResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //项目总数 private Integer projectTotal = 0; //处理中总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java index bad0896389..3712128526 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyTopicResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //话题总数 private Integer topicTotal = 0; //热议中总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java index a60c3ad76b..d1cc92cd8f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java @@ -19,6 +19,10 @@ public class SubAgencyUserResultDTO implements Serializable { private String agencyId; //组织名称 private String agencyName; + //机关级别[社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province + private String level; + //行政地区编码 + private String areaCode; //用户总数 private Integer userTotal = 0; //党员总数 diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java index 9e569488d2..b6d866eda6 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java @@ -93,6 +93,11 @@ public class GovStaffRoleDTO implements Serializable { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 */ diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java index 5c38ca8a2c..731a3de81d 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java @@ -58,6 +58,16 @@ public class GovStaffRoleTemplateDTO implements Serializable { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + /** * */ diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java new file mode 100644 index 0000000000..45ad8c8d62 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 网格员相关统计formdto + * @author wxz + * @date 2021.07.05 15:46:23 +*/ +@Data +public class GridMemberStatsFormDTO { + + public interface IssueProjectStats {} + + @NotBlank(message = "网格ID不能为空", groups = {IssueProjectStats.class}) + private String gridId; + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java new file mode 100644 index 0000000000..4d3d81aebe --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 对外接口--查询工作人员基本信息-接口入参 + * @Auth sun + */ +@Data +public class OpenStaffDetailFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = OpenStaffDetailFormDTO.Open.class) + private String customerId; + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = OpenStaffDetailFormDTO.Open.class) + private String mobile; + public interface Open extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java index 4945b5de46..4de304f917 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java @@ -24,7 +24,7 @@ public class StaffListFormDTO implements Serializable { @NotNull(message = "最近时间不能为空", groups = StaffListFormDTO.Staff.class) private Integer time; /** - * 排序字段【巡查总次数:patrolTotal;最近开始巡查时间:latestPatrolledTime】 + * 排序字段【巡查总次数:patrolTotal;最近开始巡查时间:latestPatrolledTime;上报项目数: reportProjectCount;巡查总时长:totalTime】 */ @NotBlank(message = "排序条件不能为空", groups = StaffListFormDTO.Staff.class) private String sortCode; diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java new file mode 100644 index 0000000000..9707a14f67 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 对外接口--查询工作人员基本信息-接口返参 + * @Auth sun + */ +@Data +public class OpenStaffDetailResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //工作人员用户id + private String staffId = ""; + //工作人员姓名 + private String staffName = ""; + //手机号 + private String mobile = ""; + //用户所属组织id + private String agencyId = ""; + //用户所属组织全路径名称 + private String agencyAllName = ""; + //客户Id + private String customerId = ""; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java new file mode 100644 index 0000000000..8e99eec996 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 个人中心-网格员巡查记录-接口入参 + * @Auth sun + */ +@Data +public class PersonalPatrolListResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //巡查总次数;巡查总时长;立项事件数 + private String key; + //key对应值 + private String value; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java index 15f2647e88..53bf3715c1 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.dto.epmetuser.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -28,5 +29,11 @@ public class StaffListResultDTO implements Serializable { private String gender = "0"; //正在巡查中:patrolling;否则返回空字符串 private String status = ""; + //上报项目数 + private Integer reportProjectCount; + //巡查总时长 + private String totalTime = ""; + @JsonIgnore + private Integer timeNum; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java new file mode 100644 index 0000000000..3b2c818967 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerAgencyDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dataaggre.dto.evaluationindex; + +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; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java new file mode 100644 index 0000000000..e57fd42ac5 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenCustomerGridDTO.java @@ -0,0 +1,119 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dto.evaluationindex; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 网格(党支部)信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-26 + */ +@Data +public class ScreenCustomerGridDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID 主键ID + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格id + */ + private String gridId; + + /** + * 组织名称 + */ + private String gridName; + + /** + * 网格所属组织id + */ + private String parentAgencyId; + + /** + * 坐标区域 + */ + private String areaMarks; + + /** + * 中心点位 + */ + private String centerMark; + + /** + * 党支部(=网格)的位置 + */ + private String partyMark; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + + /** + * 所有上级ID,用英文逗号分开 + */ + private String allParentIds; + private String pid; + private String pids; + +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java new file mode 100644 index 0000000000..6542b8eb1c --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/ScreenGovernRankDataDailyDTO.java @@ -0,0 +1,161 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dto.evaluationindex; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 基层治理-治理能力排行数据(按月统计) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-24 + */ +@Data +public class ScreenGovernRankDataDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 年Id + */ + private String yearId; + + /** + * 月份Id + */ + private String monthId; + + /** + * 数据更新至:yyyyMMdd + */ + private String dateId; + + /** + * 组织类别 agency:组织;部门:department;网格:grid + */ + private String orgType; + + /** + * 组织Id 可以为网格,机关id + */ + private String orgId; + + /** + * 上级组织Id + */ + private String parentId; + + /** + * 组织名称 + */ + private String orgName; + + /** + * 响应率 + */ + private BigDecimal responseRatio; + + /** + * 解决率 + */ + private BigDecimal resolvedRatio; + + /** + * 自治率 + */ + private BigDecimal governRatio; + + /** + * 满意率 + */ + private BigDecimal satisfactionRatio; + + /** + * 响应数 + */ + private Integer responseCount; + /** + * 项目转入次数 + */ + private Integer transferCount; + /** + * 解决项目数 + */ + private Integer resolvedCount; + /** + * 已关闭项目数 + */ + private Integer closedCount; + /** + * 自治项目数 + */ + private Integer governCount; + /** + * 满意项目数 + */ + private Integer satisfactionCount; + /** + * 已关闭项目(由议题转的项目)数 + */ + private Integer closedProjectCount; + + /** + * 删除标识 0未删除;1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java new file mode 100644 index 0000000000..1803db4c96 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class GridMemberDataAnalysisFromDTO { + + public interface listGridMemberDatas {} + + private List gridIds; + + // 搜索的人员姓名 + private String searchedStaffName; + private String month; + @NotBlank(message = "排序规则不能为空", groups = { listGridMemberDatas.class }) + private String sort; + private Integer pageNo = 1; + private Integer pageSize = 10; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java new file mode 100644 index 0000000000..b431cfafab --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.govorg.result; + +import lombok.Data; + +@Data +public class GridMemberDataAnalysisResultDTO { + + private String gridId; + private String staffId; + private String staffName; + private String orgName; + + private Integer projectCount; + private Integer issueToProjectCount; + private Integer closedIssueCount; + private Integer projectResponseCount; + private Integer projectTransferCount; + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java new file mode 100644 index 0000000000..2dfc6a5c1b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java @@ -0,0 +1,39 @@ +package com.epmet.dataaggre.enums; + +import java.util.ArrayList; +import java.util.List; + +public enum GridMemberDataAnalysisEnums { + + SORT_SORT_PROJECT_COUNT("projectCount", "project_count"), + SORT_ISSUE_TO_PROJECT_COUNT("issueToProjectCount", "issue_to_project_count"), + SORT_CLOSED_ISSUE_COUNT("closedIssueCount", "closed_issue_count"), + SORT_PROJECT_RESPONSE_COUNT("projectResponseCount", "project_response_count"), + SORT_PROJECT_TRANSFER_COUNT("projectTransferCount", "project_transfer_count"), + SORT_PROJECT_CLOSED_COUNT("projectClosedCount", "project_closed_count"); + + private String key; + private String value; + + GridMemberDataAnalysisEnums(String key, String value) { + this.key = key; + this.value = value; + } + + public static GridMemberDataAnalysisEnums get(String key) { + for (GridMemberDataAnalysisEnums gm : GridMemberDataAnalysisEnums.values()) { + if (gm.key.equals(key)) { + return gm; + } + } + return null; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index bd535ae77c..39a634fb76 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -7,12 +7,18 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.GridMemberStatsFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.OpenStaffDetailResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PersonalPatrolListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -20,7 +26,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Author zxc @@ -33,6 +42,9 @@ public class EpmetUserController { @Autowired private EpmetUserService epmetUserService; + @Autowired + private DataStatsService dataStatsService; + /** * @Param formDTO @@ -79,5 +91,113 @@ public class EpmetUserController { return new Result().ok(epmetUserService.patrolDateList(formDTO)); } + /** + * @Param formDTO + * @Description 【更多-巡查记录-人员巡查记录列表】 + * @author sun + */ + @PostMapping("staffpatrollist") + @RequirePermission(requirePermission = RequirePermissionEnum.MORE_PATROL_RECORD_LIST) + public Result> staffPatrolList(@LoginUser TokenDto tokenDto, @RequestBody StaffListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, StaffListFormDTO.Staff.class); + if (!"patrolTotal".equals(formDTO.getSortCode()) && !"latestPatrolledTime".equals(formDTO.getSortCode()) + && !"reportProjectCount".equals(formDTO.getSortCode()) && !"totalTime".equals(formDTO.getSortCode())) { + throw new RenException("参数错误,排序条件值错误"); + } + if (formDTO.getTime() != 1 && formDTO.getTime() != 3) { + throw new RenException("参数错误,最近时间值不正确"); + } + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(epmetUserService.staffPatrolList(formDTO)); + } + + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + @PostMapping("personalpatrollist") + public Result> personalPatrolList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(epmetUserService.personalPatrolList(tokenDto.getUserId())); + } + + /** + * @Description 网格员项目议题统计数据 + * @return + * @author wxz + * @date 2021.07.05 15:49 + */ + @PostMapping("/gridmember/issueprojectstats") + public Result>> getGridMemberIssueProjectStats(@LoginUser TokenDto loginUser) { + String userId = loginUser.getUserId(); + + GridMemberDataAnalysisResultDTO data = dataStatsService.getGridMemberIssueProjectStats(userId); + List> result = convertToMapList(data); + return new Result>>().ok(result); + } + + /** + * @Description 将议题项目统计数据转为前端需要的格式 + * @return + * @author wxz + * @date 2021.07.05 16:35 + */ + private List> convertToMapList(GridMemberDataAnalysisResultDTO data) { + Integer projectCount = data == null ? 0 : data.getProjectCount(); + Integer closedIssueCount = data == null ? 0 : data.getClosedIssueCount(); + Integer issueToProjectCount = data == null ? 0 : data.getIssueToProjectCount(); + Integer projectClosedCount = data == null ? 0 : data.getProjectClosedCount(); + Integer projectResponseCount = data == null ? 0 : data.getProjectResponseCount(); + Integer projectTransferCount = data == null ? 0 : data.getProjectTransferCount(); + + HashMap projectCountMap = new HashMap<>(); + projectCountMap.put("key", "直接立项数"); + projectCountMap.put("value", projectCount); + projectCountMap.put("type", "project"); + + HashMap closedIssueCountMap = new HashMap<>(); + closedIssueCountMap.put("key", "议题转项目数"); + closedIssueCountMap.put("value", issueToProjectCount); + closedIssueCountMap.put("type", "project"); + + HashMap issueClosedCountMap = new HashMap<>(); + issueClosedCountMap.put("key", "议题关闭数"); + issueClosedCountMap.put("value", closedIssueCount); + issueClosedCountMap.put("type", "issue"); + + HashMap projectResponseCountMap = new HashMap<>(); + projectResponseCountMap.put("key", "项目响应数"); + projectResponseCountMap.put("value", projectResponseCount); + projectResponseCountMap.put("type", "project"); + + HashMap projectTransferCountMap = new HashMap<>(); + projectTransferCountMap.put("key", "项目吹哨数"); + projectTransferCountMap.put("value", projectTransferCount); + projectTransferCountMap.put("type", "project"); + + HashMap projectClosedCountMap = new HashMap<>(); + projectClosedCountMap.put("key", "项目结案数"); + projectClosedCountMap.put("value", projectClosedCount); + projectClosedCountMap.put("type", "project"); + + ArrayList> maps = new ArrayList<>(6); + maps.add(projectCountMap); + maps.add(closedIssueCountMap); + maps.add(issueClosedCountMap); + maps.add(projectResponseCountMap); + maps.add(projectTransferCountMap); + maps.add(projectClosedCountMap); + return maps; + } + /** + * @Param formDTO + * @Description 对外接口--查询工作人员基本信息 + * @author sun + */ + @PostMapping("open-staffdetail") + public Result openStaffDetail(@RequestBody OpenStaffDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, OpenStaffDetailFormDTO.Open.class); + return new Result().ok(epmetUserService.openStaffDetail(formDTO)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 262aff38c3..064669c50d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -1,20 +1,35 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.govorg.form.GridMemberDataAnalysisFromDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.AgencyGridListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; +import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums; +import com.epmet.dataaggre.service.AggreGridService; import com.epmet.dataaggre.service.govorg.GovOrgService; +import com.epmet.dto.result.PublicAndInternalFileResultDTO; +import org.apache.commons.lang3.StringUtils; +import org.apache.xmlbeans.impl.xb.xsdschema.Public; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; +import java.util.PriorityQueue; /** * @Author zxc @@ -27,6 +42,12 @@ public class GovOrgController { @Autowired private GovOrgService govOrgService; + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private AggreGridService aggreGridService; + /** * @param tokenDTO @@ -51,4 +72,51 @@ public class GovOrgController { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(govOrgService.queryNextLevelAreaCodeList(formDTO)); } + + /** + * @Description 网格员统计,列表查询 + * @return + * @author wxz + * @date 2021.07.05 11:14 + */ + @PostMapping("gridmemberdataanalysis") + @RequirePermission(requirePermission = RequirePermissionEnum.MORE_GRID_MEMBER_STATS_ANALYSIS) + public Result getGridMemberDataAnalysis(@RequestBody GridMemberDataAnalysisFromDTO input) { + ValidatorUtils.validateEntity(input, GridMemberDataAnalysisFromDTO.listGridMemberDatas.class); + + List gridIds = input.getGridIds(); + String month = input.getMonth(); + Integer pageNo = input.getPageNo(); + Integer pageSize = input.getPageSize(); + String sort = input.getSort(); + String searchedStaffName = input.getSearchedStaffName(); + String loginUserId = loginUserUtil.getLoginUserId(); + + // 排序字段检验 + GridMemberDataAnalysisEnums sortType; + if ((sortType = GridMemberDataAnalysisEnums.get(sort)) == null ) { + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(), "未知的排序方式"); + } + + // 用户登录状态判断 + if (StringUtils.isBlank(loginUserId)) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询网格员统计数据失败"); + } + + // 月份格式判断 + if (StringUtils.isNotBlank(month)) { + if (!month.matches("\\d{4}/\\d{2}")) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "月份格式错误:" + month); + } else { + month = month.replace("/", ""); + } + } + + // 网格id为空处理 + if (CollectionUtils.isEmpty(gridIds)) { + gridIds = new ArrayList<>(); + } + List resultList = aggreGridService.getGridMemberDataAnalysis(gridIds, searchedStaffName, loginUserId, month, sortType.getValue(), pageNo, pageSize); + return new Result().ok(resultList); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java index b49b16fc0c..d157058b2e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java @@ -25,6 +25,7 @@ import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity; +import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -41,43 +42,43 @@ public interface DataStatsDao { * @Description 查询组织下注册用户最新日统计数据 * @author sun */ - AgencyBasicDataResultDTO getAgnecyRegUser(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgnecyRegUser(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 查询组织下最新群组日统计数据 * @author sun */ - AgencyBasicDataResultDTO getAgnecyGroup(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgnecyGroup(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 查询组织下最新状态话题-机关日统计数据表 * @author sun */ - List getAgencyTopic(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgencyTopic(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 查询组织下最新转议题话题-机关日统计数据表 * @author sun */ - AgencyBasicDataResultDTO.Topic getAgencyTopicShiftIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgencyTopicShiftIssue(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 热议中话题-机关日统计数据 * @author sun */ - AgencyBasicDataResultDTO.Topic getAgencyTopicHotDiscuss(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgencyTopicHotDiscuss(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 查询组织下最新议题日统计数据 * @author sun */ - AgencyBasicDataResultDTO getAgencyIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgencyIssue(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 查询组织下最新项目日统计数据 * @author sun */ - AgencyBasicDataResultDTO getAgencyProject(@Param("agencyId") String agencyId, @Param("dateId") String dateId); + List getAgencyProject(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); /** * @Description 查询当前组织的直属下级组织信息 @@ -242,4 +243,14 @@ public interface DataStatsDao { * @author sun */ List getGridGovern(@Param("gridIds") List gridIds, @Param("dateId") String dateId); + + /** + * 根据组织Id查询事件治理指数 + * @author zhaoqifeng + * @date 2021/6/25 15:08 + * @param agencyIds + * @param dateId + * @return com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity + */ + List getAgencyGovernDaily(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java new file mode 100644 index 0000000000..a8ea0bcc94 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dao.datastats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; +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-07-05 + */ +@Mapper +public interface FactGridMemberStatisticsDailyDao extends BaseDao { + + /** + * @Description 查询网格员统计数据 + * @return + * @author wxz + * @date 2021.07.05 13:19 + */ + List listGridMemberDataStats(@Param("gridIds") List gridIds, + @Param("searchedStaffName") String searchedStaffName, + @Param("month") String month, + @Param("sort") String sort); + + /** + * @Description 查询网格员议题项目统计数据 + * @return + * @author wxz + * @date 2021.07.05 16:17 + */ + GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(@Param("staffId") String staffId); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java index 9d3004c815..b3ca304972 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java @@ -18,8 +18,10 @@ package com.epmet.dataaggre.dao.epmetuser; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 政府工作人员表 @@ -29,5 +31,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffDao extends BaseDao { - + + /** + * @Description 按staffId查询基础信息 + * @author sun + */ + CustomerStaffDTO selectByMobile(@Param("customerId") String customerId, @Param("mobile") String mobile); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java index 5c6cb03bdb..36385a7cbd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java @@ -23,6 +23,7 @@ import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -41,4 +42,15 @@ public interface StaffPatrolRecordDao extends BaseDao { */ List selectPatrolList(StaffListFormDTO formDTO); + /** + * @Description 按条件查询巡查业务数据V2 + * @author sun + */ + List selectStaffPatrolList(StaffListFormDTO formDTO); + + /** + * @Description 汇总查询当前工作人员所有巡查记录数据 + * @author sun + */ + StaffListResultDTO selectPersonalPatrolList(@Param("staffId") String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java index c9084a0b4b..197b4e05e6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java @@ -18,9 +18,14 @@ package com.epmet.dataaggre.dao.evaluationindex; import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * @Author sun * @Description 指标统计服务 @@ -34,4 +39,60 @@ public interface EvaluationIndexDao { * @author sun */ GovrnRatioResultDTO getAgnecyOrGridGoverRatio(@Param("orgId") String orgId, @Param("orgType") String orgType, @Param("dateId") String dateId); + + /** + * @Description 查询areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表 + * @author sun + */ + List getAgencyByAreaCodeAgencyId(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode); + + /** + * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查 + * @author sun + */ + List getSubAgencyList(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode); + + /** + * @Description 查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + * @author sun + */ + List getSubGridList(@Param("agencyId") String agencyId); + + /** + * 根据组织Id查询治理指数 + * @author zhaoqifeng + * @date 2021/6/25 16:36 + * @param agencyIds + * @param dateId + * @return java.util.List + */ + ScreenGovernRankDataDailyDTO getGovernRankList(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); + + /** + * 获取组织信息 + * @author zhaoqifeng + * @date 2021/6/29 13:58 + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + */ + ScreenCustomerAgencyDTO getAgencyInfo(@Param("agencyId") String agencyId); + + /** + * @Description 查询agencyId对应组织信息 + * @author sun + */ + ScreenCustomerAgencyDTO getByAgencyId(@Param("agencyId") String agencyId); + + /** + * @Description 存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的但是存在父子客户关系的客户组织列表 + * @author sun + */ + List getAgencyIdsByAgencyId(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List list); + + /** + * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查且是在当前客户和子客户范围内查询 + * @author sun + */ + List getSubAgencyListByAgency(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List list); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java index cc73cc2c1f..3fcc8655ed 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java @@ -62,4 +62,10 @@ public interface CustomerGridDao extends BaseDao { * @Description 查询工作人员所属组织下网格列表 **/ List gridListByStaffId(@Param("staffId") String staffId); + + /** + * @Description 有网格列表的查询网格基本信息,没有的查询工作人员所属组织级下级所有的网格信息 + * @author sun + */ + List getGridInfoList(@Param("gridIds") List gridIds, @Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java index f8b58c698b..445e796c61 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO; import com.epmet.dataaggre.entity.govorg.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; @@ -38,4 +39,9 @@ public interface CustomerStaffAgencyDao extends BaseDao selectUsedAreaCodeList(String areaCode); + + /** + * 根据customerId查询其所有下级子客户id + * @author zhaoqifeng + * @date 2021/6/29 11:04 + * @param customerId + * @return java.util.List + */ + List selectAllSubCustomerIds(String customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java new file mode 100644 index 0000000000..d709731f77 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactAgencyGovernDailyEntity.java @@ -0,0 +1,174 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.entity.datastats; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 组织的治理指数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-24 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_agency_govern_daily") +public class FactAgencyGovernDailyEntity 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; + + /** + * 界面展示:问题解决总数=1+2+3+4+5+6+7+8 + */ + private Integer problemResolvedCount; + + /** + * 界面展示:党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数 + */ + private BigDecimal groupSelfGovernRatio; + + /** + * 界面展示:网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal gridSelfGovernRatio; + + /** + * 界面展示:社区解决占比=COMMUNITY_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal communityClosedRatio; + + /** + * 界面展示:街道解决占比=STREET_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal streetClosedRatio; + + /** + * 界面展示:区直部门解决占比=DISTRICT_DEPT_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal districtDeptClosedRatio; + + /** + * 1、当前组织内,话题关闭已解决数 + */ + private Integer topicResolvedCount; + + /** + * 2、当前组织内,话题关闭无需解决数 + */ + private Integer topicUnResolvedCount; + + /** + * 3、当前组织内,议题关闭已解决数 + */ + private Integer issueResolvedCount; + + /** + * 4、当前组织内,议题关闭无需解决数 + */ + private Integer issueUnResolvedCount; + + /** + * 5、当前组织内:来源于议题的项目:结案已解决数 + */ + private Integer issueProjectResolvedCount; + + /** + * 6、当前组织内:来源于议题的项目:结案无需解决数 + */ + private Integer issueProjectUnResolvedCount; + + /** + * 7、当前组织内:项目立项,结案已解决数;默认为0, + */ + private Integer approvalProjectResolvedCount; + + /** + * 8、当前组织内:项目立项,结案无需解决数;默认为0, + */ + private Integer approvalProjectUnResolvedCount; + + /** + * 9、当前组织内,未出小组即未转议题的:话题关闭已解决数 + */ + private Integer inGroupTopicResolvedCount; + + /** + * 10、当前组织内,未出小组即未转议题的:话题关闭无需解决数 + */ + private Integer inGroupTopicUnResolvedCount; + + /** + * 未出当前网格的,结案项目数 + */ + private Integer gridSelfGovernProjectTotal; + + /** + * 当前组织内结案的项目中:由社区结案的项目总数 + */ + private Integer communityClosedCount; + + /** + * 当前组织内结案的项目中:由街道结案的项目总数 + */ + private Integer streetClosedCount; + + /** + * 当前组织内结案的项目中:由区直部门结案的项目总数 + */ + private Integer districtDeptClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java new file mode 100644 index 0000000000..dbcc2d5f26 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java @@ -0,0 +1,131 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.entity.datastats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_daily") +public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java index d10c281e10..be03ad7913 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java @@ -63,6 +63,11 @@ public class GovStaffRoleEntity extends BaseEpmetEntity { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 */ diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java index 24e77d5ef3..aa6b1e6db9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java @@ -58,4 +58,14 @@ public class GovStaffRoleTemplateEntity extends BaseEpmetEntity { */ private Integer fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java new file mode 100644 index 0000000000..3702bbb319 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.service; + +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; + +import java.util.List; + +/** + * @Description 聚合的网格相关service,不指定具体的数据源,它调用其他子service,子service中指定具体数据源 + * @author wxz + * @date 2021.07.05 13:06:35 +*/ +public interface AggreGridService { + /** + * @Description 网格员数据统计列表查询 + * @return + * @author wxz + * @date 2021.07.05 11:17 + */ + List getGridMemberDataAnalysis(List gridIds, String searchedStaffName, String currStaffId, String month, String sort, Integer pageNo, Integer pageSize); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java index 8b08a765d2..36ec2943db 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java @@ -3,9 +3,11 @@ package com.epmet.dataaggre.service.datastats; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; +import java.security.PrivateKey; import java.util.List; /** @@ -159,4 +161,25 @@ public interface DataStatsService { * @author sun */ GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO); + + /** + * @Description 查询网格员统计数据列表 + * @return + * @author wxz + * @date 2021.07.05 13:13 + */ + List listGridMemberDataStats(List gridIds, + String searchedStaffName, + String month, + String sort, + Integer pageNo, + Integer pageSize); + + /** + * @Description 单个网格员议题项目统计数据 + * @return + * @author wxz + * @date 2021.07.05 16:05 + */ + GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index b61338b163..bfa9a29710 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -1,20 +1,30 @@ package com.epmet.dataaggre.service.datastats.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.dao.datastats.DataStatsDao; +import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity; +import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; +import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.github.pagehelper.PageHelper; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -42,6 +52,11 @@ public class DataStatsServiceImpl implements DataStatsService { private DataStatsDao dataStatsDao; @Autowired private EvaluationIndexService indexService; + @Autowired + private CustomerRelation customerRelation; + + @Autowired + private FactGridMemberStatisticsDailyDao factGridMemberStatisticsDailyDao; /** @@ -52,6 +67,7 @@ public class DataStatsServiceImpl implements DataStatsService { @Override public AgencyBasicDataResultDTO agencyBasicData(AgenctBasicDataFormDTO formDTO) { AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO(); + List agencyList = new ArrayList<>(); resultDTO.setAgencyId(formDTO.getAgencyId()); NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMaximumFractionDigits(NumConstant.THREE); @@ -63,78 +79,100 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setDateId(format.format(yesterday)); } + //0.根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表 + agencyList = indexService.getAgencyIdsByAgencyId(formDTO.getAgencyId()); + agencyList.add(formDTO.getAgencyId()); + //1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】 - AgencyBasicDataResultDTO user = dataStatsDao.getAgnecyRegUser(formDTO.getAgencyId(), formDTO.getDateId()); - if (null != user) { - resultDTO.setUserTotal(user.getUserTotal()); - resultDTO.setResiTotal(user.getResiTotal()); - resultDTO.setResiRatio(user.getResiTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getResiTotal() / (float) user.getUserTotal()))); - resultDTO.setPartyMemberTotal(user.getPartyMemberTotal()); - resultDTO.setPartyMemberRatio(user.getPartyMemberTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getPartyMemberTotal() / (float) user.getUserTotal()))); - } + List userList = dataStatsDao.getAgnecyRegUser(agencyList, formDTO.getDateId()); + int userTotal = 0; + int resiTotal = 0; + int partyMemberTotal = 0; + for (AgencyBasicDataResultDTO u : userList){ + userTotal+=u.getUserTotal(); + resiTotal+=u.getResiTotal(); + partyMemberTotal+=u.getPartyMemberTotal(); + } + resultDTO.setUserTotal(userTotal); + resultDTO.setResiTotal(resiTotal); + resultDTO.setResiRatio(resultDTO.getResiTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getResiTotal() / (float) resultDTO.getUserTotal()))); + resultDTO.setPartyMemberTotal(partyMemberTotal); + resultDTO.setPartyMemberRatio(resultDTO.getPartyMemberTotal() == 0 || resultDTO.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPartyMemberTotal() / (float) resultDTO.getUserTotal()))); //2.查询组织下最新群组日统计数据 - AgencyBasicDataResultDTO group = dataStatsDao.getAgnecyGroup(formDTO.getAgencyId(), formDTO.getDateId()); - if (null != group) { - resultDTO.setGroupTotal(group.getGroupTotal()); - resultDTO.setOrdinaryTotal(group.getOrdinaryTotal()); - resultDTO.setOrdinaryRatio(group.getOrdinaryTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getOrdinaryTotal() / (float) group.getGroupTotal()))); - resultDTO.setBranchTotal(group.getBranchTotal()); - resultDTO.setBranchRatio(group.getBranchTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getBranchTotal() / (float) group.getGroupTotal()))); - } + List groupList = dataStatsDao.getAgnecyGroup(agencyList, formDTO.getDateId()); + int groupTotal = 0; + int ordinaryTotal = 0; + int branchTotal = 0; + for (AgencyBasicDataResultDTO g : groupList){ + groupTotal+=g.getGroupTotal(); + ordinaryTotal+=g.getOrdinaryTotal(); + branchTotal+=g.getBranchTotal(); + } + resultDTO.setGroupTotal(groupTotal); + resultDTO.setOrdinaryTotal(ordinaryTotal); + resultDTO.setOrdinaryRatio(resultDTO.getOrdinaryTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getOrdinaryTotal() / (float) resultDTO.getGroupTotal()))); + resultDTO.setBranchTotal(branchTotal); + resultDTO.setBranchRatio(resultDTO.getBranchTotal() == 0 || resultDTO.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getBranchTotal() / (float) resultDTO.getGroupTotal()))); //3.查询组织下最新话题日统计数据 //状态话题-机关日统计数据表最新日期三种状态数据 //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念 - List topic = dataStatsDao.getAgencyTopic(formDTO.getAgencyId(), formDTO.getDateId()); + List topic = dataStatsDao.getAgencyTopic(agencyList, formDTO.getDateId()); //转议题话题-机关日统计数据表 - AgencyBasicDataResultDTO.Topic topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(formDTO.getAgencyId(), formDTO.getDateId()); + List topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(agencyList, formDTO.getDateId()); //热议中话题-机关日统计数据 - AgencyBasicDataResultDTO.Topic hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(formDTO.getAgencyId(), formDTO.getDateId()); - AtomicReference closedTotal = new AtomicReference<>(0); - if (topic.size() > NumConstant.ZERO) { - resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount))); - topic.forEach(t -> { - if (t.getTopicStatus().equals("closed")) { - closedTotal.set(t.getTopicCount()); - } - }); - } + List hotdiscuss = dataStatsDao.getAgencyTopicHotDiscuss(agencyList, formDTO.getDateId()); + //话题总数 + resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount))); + int closedTotal = topic.stream().filter(t -> t.getTopicStatus().equals("closed")).mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum(); //转议题 - if (null != topicSHiftIssue) { - resultDTO.setShiftIssueTotal(topicSHiftIssue.getShiftedIssueTotal()); - resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); - } + int shiftIssueTotal = topicSHiftIssue.stream().mapToInt(AgencyBasicDataResultDTO.Topic::getShiftedIssueTotal).sum(); + resultDTO.setShiftIssueTotal(shiftIssueTotal); + resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal()))); //热议中 - if (null != hotdiscuss) { - resultDTO.setDiscussingTotal(hotdiscuss.getTopicCount()); - resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); - } + int discussingTotal = hotdiscuss.stream().mapToInt(AgencyBasicDataResultDTO.Topic::getTopicCount).sum(); + resultDTO.setDiscussingTotal(discussingTotal); + resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); //已处理 - resultDTO.setClosedTopicTotal(closedTotal.get()); + resultDTO.setClosedTopicTotal(closedTotal); resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal()))); //4.查询组织下最新议题日统计数据 - AgencyBasicDataResultDTO issue = dataStatsDao.getAgencyIssue(formDTO.getAgencyId(), formDTO.getDateId()); - if (null != issue) { - resultDTO.setIssueTotal(issue.getIssueTotal()); - resultDTO.setVotingTotal(issue.getVotingTotal()); - resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal()))); - resultDTO.setClosedIssueTotal(issue.getClosedIssueTotal()); - resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal()))); - resultDTO.setShiftProjectTotal(issue.getShiftProjectTotal()); - resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal()))); - } + List issueList = dataStatsDao.getAgencyIssue(agencyList, formDTO.getDateId()); + int issueTotal = 0; + int votingTotal = 0; + int closedIssueTotal = 0; + int shiftProjectTotal = 0; + for (AgencyBasicDataResultDTO i : issueList){ + issueTotal+=i.getIssueTotal(); + votingTotal+=i.getVotingTotal(); + closedIssueTotal+=i.getClosedIssueTotal(); + shiftProjectTotal+=i.getShiftProjectTotal(); + } + resultDTO.setIssueTotal(issueTotal); + resultDTO.setVotingTotal(votingTotal); + resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal()))); + resultDTO.setClosedIssueTotal(closedIssueTotal); + resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal()))); + resultDTO.setShiftProjectTotal(shiftProjectTotal); + resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal()))); //5.查询组织下最新项目日统计数据 - AgencyBasicDataResultDTO project = dataStatsDao.getAgencyProject(formDTO.getAgencyId(), formDTO.getDateId()); - if (null != project) { - resultDTO.setProjectTotal(project.getProjectTotal()); - resultDTO.setPendingTotal(project.getPendingTotal()); - resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal()))); - resultDTO.setClosedProjectTotal(project.getClosedProjectTotal()); - resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal()))); - } + List projectList = dataStatsDao.getAgencyProject(agencyList, formDTO.getDateId()); + int projectTotal = 0; + int pendingTotal = 0; + int closedProjectTotal = 0; + for (AgencyBasicDataResultDTO p : projectList){ + projectTotal+=p.getProjectTotal(); + pendingTotal+=p.getPendingTotal(); + closedProjectTotal+=p.getClosedProjectTotal(); + } + resultDTO.setProjectTotal(projectTotal); + resultDTO.setPendingTotal(pendingTotal); + resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal()))); + resultDTO.setClosedProjectTotal(closedProjectTotal); + resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal()))); return resultDTO; } @@ -258,23 +296,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("user"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); if (subAgencyList.size() < NumConstant.ONE) { return resultList; } - List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); //2.查询直属下级组织注册用户日统计数据,默认按用户总数降序 List list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); //3.封装数据 - for (DimAgencyEntity sub : subAgencyList) { + for (ScreenCustomerAgencyDTO sub : subAgencyList) { SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO(); - dto.setAgencyId(sub.getId()); + dto.setAgencyId(sub.getAgencyId()); dto.setAgencyName(sub.getAgencyName()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); for (SubAgencyUserResultDTO u : list) { - if (sub.getId().equals(u.getAgencyId())) { + if (sub.getAgencyId().equals(u.getAgencyId())) { dto.setUserTotal(u.getUserTotal()); dto.setPartyMemberTotal(u.getPartyMemberTotal()); dto.setResiTotal(u.getResiTotal()); @@ -327,23 +367,23 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("user"); } - //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + List gridList = indexService.getSubGridList(formDTO.getAgencyId()); if (gridList.size() < NumConstant.ONE) { return resultList; } - List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); //2.查询网格层级注册用户日统计数据,默认按用户总数降序 List list = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId()); //3.封装数据 - for (DimGridEntity gr : gridList) { + for (ScreenCustomerGridDTO gr : gridList) { SubGridUserResultDTO dto = new SubGridUserResultDTO(); - dto.setGridId(gr.getId()); + dto.setGridId(gr.getGridId()); dto.setGridName(gr.getGridName()); for (SubGridUserResultDTO re : list) { - if (gr.getId().equals(re.getGridId())) { + if (gr.getGridId().equals(re.getGridId())) { dto.setUserTotal(re.getUserTotal()); dto.setPartyMemberTotal(re.getPartyMemberTotal()); dto.setResiTotal(re.getResiTotal()); @@ -394,23 +434,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("group"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); if (subAgencyList.size() < NumConstant.ONE) { return resultList; } - List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); //2.查询直属下级组织小组日统计数据,默认按群组总数降序 List list = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId()); //3.封装数据 - for (DimAgencyEntity sub : subAgencyList) { + for (ScreenCustomerAgencyDTO sub : subAgencyList) { SubAgencyGroupResultDTO dto = new SubAgencyGroupResultDTO(); - dto.setAgencyId(sub.getId()); + dto.setAgencyId(sub.getAgencyId()); dto.setAgencyName(sub.getAgencyName()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); for (SubAgencyGroupResultDTO u : list) { - if (sub.getId().equals(u.getAgencyId())) { + if (sub.getAgencyId().equals(u.getAgencyId())) { dto.setGroupTotal(u.getGroupTotal()); dto.setOrdinaryTotal(u.getOrdinaryTotal()); dto.setBranchTotal(u.getBranchTotal()); @@ -460,23 +502,23 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("group"); } - //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + List gridList = indexService.getSubGridList(formDTO.getAgencyId()); if (gridList.size() < NumConstant.ONE) { return resultList; } - List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); //2.查询网格层级小组日统计数据,默认按群组总数降序 List list = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId()); //3.封装数据并返回 - for (DimGridEntity gr : gridList) { + for (ScreenCustomerGridDTO gr : gridList) { SubGridGroupResultDTO dto = new SubGridGroupResultDTO(); - dto.setGridId(gr.getId()); + dto.setGridId(gr.getGridId()); dto.setGridName(gr.getGridName()); for (SubGridGroupResultDTO re : list) { - if (gr.getId().equals(re.getGridId())) { + if (gr.getGridId().equals(re.getGridId())) { dto.setGroupTotal(re.getGroupTotal()); dto.setOrdinaryTotal(re.getOrdinaryTotal()); dto.setBranchTotal(re.getBranchTotal()); @@ -527,12 +569,12 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("topic"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); if (subAgencyList.size() < NumConstant.ONE) { return resultList; } - List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); //2.查询直属下级组织状态话题-日统计数据 //机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念 @@ -548,7 +590,7 @@ public class DataStatsServiceImpl implements DataStatsService { AtomicInteger shiftIssueTotal = new AtomicInteger(0); AtomicInteger hotdiscussTotal = new AtomicInteger(0); topic.forEach(t -> { - if (t.getAgencyId().equals(sub.getId())) { + if (t.getAgencyId().equals(sub.getAgencyId())) { topicTotal.addAndGet(t.getTopicCount()); if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); @@ -556,18 +598,20 @@ public class DataStatsServiceImpl implements DataStatsService { } }); topicShiftIssue.forEach(t -> { - if (t.getAgencyId().equals(sub.getId())) { + if (t.getAgencyId().equals(sub.getAgencyId())) { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); hotdiscuss.forEach(t -> { - if (t.getAgencyId().equals(sub.getId())) { + if (t.getAgencyId().equals(sub.getAgencyId())) { hotdiscussTotal.addAndGet(t.getTopicCount()); } }); - resultDTO.setAgencyId(sub.getId()); + resultDTO.setAgencyId(sub.getAgencyId()); resultDTO.setAgencyName(sub.getAgencyName()); + resultDTO.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + resultDTO.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setDiscussingTotal(hotdiscussTotal.get()); resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal()))); @@ -621,12 +665,12 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("topic"); } - //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + List gridList = indexService.getSubGridList(formDTO.getAgencyId()); if (gridList.size() < NumConstant.ONE) { return resultList; } - List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); //2.查询网格层级话题数据 //查询网格层级状态话题-日统计数据 机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数 @@ -642,7 +686,7 @@ public class DataStatsServiceImpl implements DataStatsService { AtomicInteger shiftIssueTotal = new AtomicInteger(0); AtomicInteger hotdiscussTotal = new AtomicInteger(0); topic.forEach(t -> { - if (t.getGridId().equals(gr.getId())) { + if (t.getGridId().equals(gr.getGridId())) { topicTotal.addAndGet(t.getTopicCount()); if (t.getTopicStatus().equals("closed")) { closedTotal.set(t.getTopicCount()); @@ -650,17 +694,17 @@ public class DataStatsServiceImpl implements DataStatsService { } }); topicShiftIssue.forEach(t -> { - if (t.getGridId().equals(gr.getId())) { + if (t.getGridId().equals(gr.getGridId())) { shiftIssueTotal.addAndGet(t.getShiftedIssueTotal()); } }); hotdiscuss.forEach(t -> { - if (t.getGridId().equals(gr.getId())) { + if (t.getGridId().equals(gr.getGridId())) { hotdiscussTotal.addAndGet(t.getTopicCount()); } }); - resultDTO.setGridId(gr.getId()); + resultDTO.setGridId(gr.getGridId()); resultDTO.setGridName(gr.getGridName()); resultDTO.setTopicTotal(topicTotal.get()); resultDTO.setDiscussingTotal(hotdiscussTotal.get()); @@ -714,23 +758,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("issue"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); if (subAgencyList.size() < NumConstant.ONE) { return resultList; } - List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); //2.查询直属下级组织议题日统计数据,默认按议题总数降序 List list = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId()); //3.封装数据 - for (DimAgencyEntity sub : subAgencyList) { + for (ScreenCustomerAgencyDTO sub : subAgencyList) { SubAgencyIssueResultDTO dto = new SubAgencyIssueResultDTO(); - dto.setAgencyId(sub.getId()); + dto.setAgencyId(sub.getAgencyId()); dto.setAgencyName(sub.getAgencyName()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); for (SubAgencyIssueResultDTO u : list) { - if (sub.getId().equals(u.getAgencyId())) { + if (sub.getAgencyId().equals(u.getAgencyId())) { dto.setIssueTotal(u.getIssueTotal()); dto.setVotingTotal(u.getVotingTotal()); dto.setClosedIssueTotal(u.getClosedIssueTotal()); @@ -784,23 +830,23 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("issue"); } - //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + List gridList = indexService.getSubGridList(formDTO.getAgencyId()); if (gridList.size() < NumConstant.ONE) { return resultList; } - List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); //2.查询网格层级议题日统计数据,默认按议题总数降序 List list = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId()); //3.封装数据 - for (DimGridEntity gr : gridList) { + for (ScreenCustomerGridDTO gr : gridList) { SubGridIssueResultDTO dto = new SubGridIssueResultDTO(); - dto.setGridId(gr.getId()); + dto.setGridId(gr.getGridId()); dto.setGridName(gr.getGridName()); for (SubGridIssueResultDTO re : list) { - if (gr.getId().equals(re.getGridId())) { + if (gr.getGridId().equals(re.getGridId())) { dto.setIssueTotal(re.getIssueTotal()); dto.setVotingTotal(re.getVotingTotal()); dto.setClosedIssueTotal(re.getClosedIssueTotal()); @@ -854,23 +900,25 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("project"); } - //1.查询当前组织的直属下级组织信息【机关维度】 - List subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId()); + //1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + List subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); if (subAgencyList.size() < NumConstant.ONE) { return resultList; } - List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + List agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); //2.查询直属下级组织项目日统计数据,默认按项目总数降序 List list = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId()); //3.封装数据 - for (DimAgencyEntity sub : subAgencyList) { + for (ScreenCustomerAgencyDTO sub : subAgencyList) { SubAgencyProjectResultDTO dto = new SubAgencyProjectResultDTO(); - dto.setAgencyId(sub.getId()); + dto.setAgencyId(sub.getAgencyId()); dto.setAgencyName(sub.getAgencyName()); + dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); + dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); for (SubAgencyProjectResultDTO u : list) { - if (sub.getId().equals(u.getAgencyId())) { + if (sub.getAgencyId().equals(u.getAgencyId())) { dto.setProjectTotal(u.getProjectTotal()); dto.setPendingTotal(u.getPendingTotal()); dto.setClosedProjectTotal(u.getClosedProjectTotal()); @@ -920,23 +968,23 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setType("project"); } - //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + //1.查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + List gridList = indexService.getSubGridList(formDTO.getAgencyId()); if (gridList.size() < NumConstant.ONE) { return resultList; } - List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); //2.查询网格层级项目日统计数据,默认按项目总数降序 List list = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId()); //3.封装数据 - for (DimGridEntity gr : gridList) { + for (ScreenCustomerGridDTO gr : gridList) { SubGridProjectResultDTO dto = new SubGridProjectResultDTO(); - dto.setGridId(gr.getId()); + dto.setGridId(gr.getGridId()); dto.setGridName(gr.getGridName()); for (SubGridProjectResultDTO re : list) { - if (gr.getId().equals(re.getGridId())) { + if (gr.getGridId().equals(re.getGridId())) { dto.setProjectTotal(re.getProjectTotal()); dto.setPendingTotal(re.getPendingTotal()); dto.setClosedProjectTotal(re.getClosedProjectTotal()); @@ -1078,6 +1126,7 @@ public class DataStatsServiceImpl implements DataStatsService { public AgencyGovrnResultDTO agencyGovrn(AgencyGovrnFormDTO formDTO) { AgencyGovrnResultDTO resultDTO = new AgencyGovrnResultDTO(); resultDTO.setAgencyId(formDTO.getAgencyId()); + resultDTO.setLevel(formDTO.getLevel()); NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMaximumFractionDigits(NumConstant.THREE); @@ -1087,6 +1136,42 @@ public class DataStatsServiceImpl implements DataStatsService { SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); formDTO.setDateId(format.format(yesterday)); } + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { + if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { + List subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); + if (CollectionUtils.isEmpty(subAgencyIds)) { + subAgencyIds = new ArrayList<>(); + } + subAgencyIds.add(formDTO.getAgencyId()); + List list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId()); + if (CollectionUtils.isNotEmpty(list)) { + //问题解决总数 + Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getProblemResolvedCount).sum(); + //未出小组即未转议题的:话题关闭已解决数 + Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getInGroupTopicResolvedCount).sum(); + //未出小组即未转议题的:话题关闭无需解决数 + Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getInGroupTopicUnResolvedCount).sum(); + //未出当前网格的,结案项目数 + Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity::getGridSelfGovernProjectTotal).sum(); + //由社区结案的项目总数 + Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getCommunityClosedCount).sum(); + //由街道结案的项目总数 + Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getStreetClosedCount).sum(); + //由区直部门结案的项目总数 + Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getDistrictDeptClosedCount).sum(); + + resultDTO.setProblemResolvedCount(problemResolvedCount); + resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); + resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); + resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); + resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); + resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); + + return resultDTO; + } + } + } //1.按日期查询当前组织事件治理指数 List agencyIds = new ArrayList<>(); agencyIds.add(formDTO.getAgencyId()); @@ -1125,6 +1210,18 @@ public class DataStatsServiceImpl implements DataStatsService { return resultList; } List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { + List subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode()); + agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); + subAgencyList = subAgencies.stream().map(item -> { + DimAgencyEntity entity = new DimAgencyEntity(); + entity.setId(item.getAgencyId()); + entity.setAgencyName(item.getAgencyName()); + entity.setLevel(item.getLevel()); + return entity; + }).collect(Collectors.toList()); + } //2.按日期查询所有下级组织的事件治理指数 List list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId()); @@ -1223,22 +1320,22 @@ public class DataStatsServiceImpl implements DataStatsService { } //1.查询组织直属网格列表【网格维度】 - List gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId()); + List gridList = indexService.getSubGridList(formDTO.getAgencyId()); if (gridList.size() < NumConstant.ONE) { return resultList; } - List gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList()); + List gridIds = gridList.stream().map(ScreenCustomerGridDTO::getGridId).collect(Collectors.toList()); //2.按日期查找组织直属网格事件治理指数列表 List list = dataStatsDao.getGridGovern(gridIds, formDTO.getDateId()); //3.封装数据 - for (DimGridEntity gr : gridList) { + for (ScreenCustomerGridDTO gr : gridList) { GridGovrnResultDTO dto = new GridGovrnResultDTO(); - dto.setGridId(gr.getId()); + dto.setGridId(gr.getGridId()); dto.setGridName(gr.getGridName()); for (GridGovrnResultDTO re : list) { - if (gr.getId().equals(re.getGridId())) { + if (gr.getGridId().equals(re.getGridId())) { dto.setProblemResolvedCount(re.getProblemResolvedCount()); dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio()); dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio()); @@ -1290,6 +1387,19 @@ public class DataStatsServiceImpl implements DataStatsService { SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); formDTO.setDateId(format.format(yesterday)); } + if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { + if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { + ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), agencyDTO.getAreaCode(), formDTO.getDateId()); + resultDTO.setGovernRatio(getPercentage(governData.getGovernCount(), governData.getClosedCount())); + resultDTO.setResolvedRatio(getPercentage(governData.getResolvedCount(), governData.getClosedCount())); + resultDTO.setResponseRatio(getPercentage(governData.getResponseCount(), governData.getTransferCount())); + resultDTO.setSatisfactionRatio(getPercentage(governData.getSatisfactionCount(), governData.getClosedProjectCount())); + return resultDTO; + } + } + } //1.按类型、日期查询治理指数下响应解决满意自治四个统计率 GovrnRatioResultDTO dto = indexService.governRatio(formDTO); @@ -1302,4 +1412,31 @@ public class DataStatsServiceImpl implements DataStatsService { return resultDTO; } + @Override + public List listGridMemberDataStats(List gridIds, + String searchedStaffName, + String month, + String sort, + Integer pageNo, + Integer pageSize) { + + PageHelper.startPage(pageNo, pageSize); + return factGridMemberStatisticsDailyDao.listGridMemberDataStats(gridIds, searchedStaffName, month, sort); + } + + @Override + public GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId) { + return factGridMemberStatisticsDailyDao.getGridMemberIssueProjectStats( staffId); + } + private String getPercentage(Integer countInt, Integer totalInt) { + if (NumConstant.ZERO == totalInt) { + return "0%"; + } + BigDecimal count = new BigDecimal(countInt); + BigDecimal total = new BigDecimal(totalInt); + BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); + BigDecimal ratio = count.multiply(hundred).divide(total, NumConstant.ONE, RoundingMode.HALF_UP); + return ratio.toString().concat("%"); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 359fcbe7a0..027e36fb8a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -1,12 +1,10 @@ package com.epmet.dataaggre.service.epmetuser; +import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import java.util.List; @@ -64,4 +62,23 @@ public interface EpmetUserService { */ List staffGridRole(List forms, String staffName); + /** + * @Param formDTO + * @Description 【更多-巡查记录-人员巡查记录列表】 + * @author sun + */ + List staffPatrolList(StaffListFormDTO formDTO); + + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + List personalPatrolList(String staffId); + /** + * @Param formDTO + * @Description 对外接口--查询工作人员基本信息 + * @author sun + */ + OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 175525d16d..326bb24f20 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -4,15 +4,19 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetuser.CustomerStaffDao; import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao; import com.epmet.dataaggre.dao.epmetuser.StaffRoleDao; import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao; +import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; +import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.*; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; @@ -25,6 +29,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.NumberFormat; import java.util.*; import java.util.stream.Collectors; @@ -49,6 +55,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { private StaffPatrolRecordService staffPatrolRecordService; @Resource private StaffRoleDao staffRoleDao; + @Resource + private CustomerStaffDao customerStaffDao; /** * @Description 根据UserIds查询 @@ -247,5 +255,115 @@ public class EpmetUserServiceImpl implements EpmetUserService { return result; } + /** + * @Param formDTO + * @Description 【更多-巡查记录-人员巡查记录列表】 + * @author sun + */ + @Override + public List staffPatrolList(StaffListFormDTO formDTO) { + List resultList = new ArrayList<>(); + //1.查询网格信息供后续封装数据使用 + List list = govOrgService.getGridInfoList(formDTO.getGridIds(), formDTO.getUserId()); + if (CollectionUtils.isEmpty(formDTO.getGridIds())) { + formDTO.setGridIds(list.stream().map(CustomerGridDTO::getId).collect(Collectors.toList())); + } + + //2.按条件分页查询业务数据 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //起始查询日期 + formDTO.setPatrolStartTime(DateUtils.getBeforeMonthDate(formDTO.getTime(), "yyyyMMdd")); + resultList = staffPatrolRecordDao.selectStaffPatrolList(formDTO); + + //3.封装数据并返回 + resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); + //NumberFormat numberFormat = NumberFormat.getInstance(); + //numberFormat.setMaximumFractionDigits(NumConstant.ZERO); + resultList.forEach(re -> { + String totalTime = "0分钟"; + if (re.getTimeNum() > NumConstant.ZERO) { + int num = re.getTimeNum() / 60; + int hour = num / 60; + int minute = num % 60; + totalTime = (hour < 1 ? "" : hour + "小时") + (minute < 1 ? "" : minute + "分钟"); + } + re.setTotalTime(totalTime == "" ? "0分钟" : totalTime); + //re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h"); + //re.setTotalTime(re.getTimeNum() / 60 + "分钟"); + list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); + }); + + return resultList; + } + + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + @Override + public List personalPatrolList(String staffId) { + LinkedList resultList = new LinkedList<>(); + //1.汇总查询当前工作人员所有巡查记录数据 + StaffListResultDTO resultDTO = staffPatrolRecordDao.selectPersonalPatrolList(staffId); + if (null == resultDTO) { + return resultList; + } + //2.封装数据并返回 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.ZERO); + PersonalPatrolListResultDTO personal1 = new PersonalPatrolListResultDTO(); + personal1.setKey("总次数"); + personal1.setValue(resultDTO.getPatrolTotal().toString()); + resultList.add(personal1); + PersonalPatrolListResultDTO personal2 = new PersonalPatrolListResultDTO(); + personal2.setKey("总时长"); + //personal2.setValue(resultDTO.getTimeNum() / 60 + "分钟"); + String totalTime = "0分钟"; + if (resultDTO.getTimeNum() > NumConstant.ZERO) { + int num = resultDTO.getTimeNum() / 60; + int hour = num / 60; + int minute = num % 60; + totalTime = (hour < 1 ? "" : hour + "小时") + (minute < 1 ? "" : minute + "分钟"); + } + personal2.setValue(totalTime == "" ? "0分钟" : totalTime); + resultList.add(personal2); + PersonalPatrolListResultDTO personal3 = new PersonalPatrolListResultDTO(); + personal3.setKey("事件数"); + personal3.setValue(resultDTO.getReportProjectCount().toString()); + resultList.add(personal3); + + return resultList; + } + /** + * @Param formDTO + * @Description 对外接口--查询工作人员基本信息 + * @author sun + */ + @Override + public OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO) { + OpenStaffDetailResultDTO resultDTO = new OpenStaffDetailResultDTO(); + //1.按staffId查询基础信息 + CustomerStaffDTO staffDTO = customerStaffDao.selectByMobile(formDTO.getCustomerId(), formDTO.getMobile()); + if (null == staffDTO) { + return resultDTO; + } + + //2.查询工作人员所属组织信息 + CustomerAgencyDTO agencyDTO = govOrgService.gridByAgencyId(formDTO.getCustomerId(), staffDTO.getUserId()); + + //3.封装数据并返回 + resultDTO.setCustomerId(formDTO.getCustomerId()); + if (null != agencyDTO) { + resultDTO.setAgencyId(agencyDTO.getId()); + resultDTO.setAgencyAllName(agencyDTO.getAllParentName()); + } + resultDTO.setStaffId(staffDTO.getUserId()); + resultDTO.setStaffName(staffDTO.getRealName()); + resultDTO.setMobile(formDTO.getMobile()); + + return resultDTO; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java index 909a3dc208..43be38a84f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java @@ -2,6 +2,11 @@ package com.epmet.dataaggre.service.evaluationindex; import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO; import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; + +import java.util.List; /** * @Author sun @@ -15,4 +20,55 @@ public interface EvaluationIndexService { * @author sun */ GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO); + + /** + * @Description 查询areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表 + * @author sun + */ + List getAgencyByAreaCodeAgencyId(String agencyId, String areaCode); + + /** + * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查 + * @author sun + */ + List getSubAgencyList(String agencyId, String areaCode); + + /** + * @Description 查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + * @author sun + */ + List getSubGridList(String agencyId); + + /** + * 根据组织ID获取治理指数 + * @author zhaoqifeng + * @date 2021/6/25 16:33 + * @param agencyId + * @param areaCode + * @param dateId + * @return java.util.List + */ + ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId); + + /** + * 获取组织信息 + * @author zhaoqifeng + * @date 2021/6/29 13:57 + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + */ + ScreenCustomerAgencyDTO getAgencyInfo(String agencyId); + + /** + * @Description 根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表 + * @author sun + */ + List getAgencyIdsByAgencyId(String agencyId); + + /** + * @Description 查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查 + * @author sun + */ + List getSubAgencyListByAgency(String agencyId); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java index bec7bafd90..fc9e6b8ba6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java @@ -7,14 +7,21 @@ import com.epmet.dataaggre.dao.datastats.DataStatsDao; import com.epmet.dataaggre.dao.evaluationindex.EvaluationIndexDao; import com.epmet.dataaggre.dto.datastats.form.GovrnRatioFormDTO; import com.epmet.dataaggre.dto.datastats.result.GovrnRatioResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO; +import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; +import java.util.List; /** * @Author sun @@ -26,6 +33,8 @@ import java.util.Date; public class EvaluationIndexServiceImpl implements EvaluationIndexService { @Autowired private EvaluationIndexDao evaluationIndexDao; + @Autowired + private CustomerRelation customerRelation; /** * @Param formDTO @@ -37,4 +46,99 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { return evaluationIndexDao.getAgnecyOrGridGoverRatio(formDTO.getOrgId(),formDTO.getOrgType(),formDTO.getDateId()); } + /** + * @Description 查询areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表 + * @author sun + */ + @Override + public List getAgencyByAreaCodeAgencyId(String agencyId, String areaCode) { + return evaluationIndexDao.getAgencyByAreaCodeAgencyId(agencyId,areaCode); + } + + /** + * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查 + * @author sun + */ + @Override + public List getSubAgencyList(String agencyId, String areaCode) { + return evaluationIndexDao.getSubAgencyList(agencyId,areaCode); + } + + /** + * @Description 查询指标库组织直属网格列表【这个客户组织网格数据包括小程序的和项目上报的】 + * @author sun + */ + @Override + public List getSubGridList(String agencyId) { + return evaluationIndexDao.getSubGridList(agencyId); + } + + /** + * 根据组织ID获取治理指数 + * + * @param agencyId + * @param areaCode + * @param dateId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/25 16:33 + */ + @Override + public ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId) { + List agencyIdList = getAgencyByAreaCodeAgencyId(agencyId, areaCode); + if (CollectionUtils.isEmpty(agencyIdList)) { + agencyIdList = new ArrayList<>(); + } + agencyIdList.add(agencyId); + return evaluationIndexDao.getGovernRankList(agencyIdList, dateId); + } + + /** + * 获取组织信息 + * + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + * @author zhaoqifeng + * @date 2021/6/29 13:57 + */ + @Override + public ScreenCustomerAgencyDTO getAgencyInfo(String agencyId) { + return evaluationIndexDao.getAgencyInfo(agencyId); + } + + /** + * @Description 根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表 + * @author sun + */ + @Override + public List getAgencyIdsByAgencyId(String agencyId) { + //1.查询agencyId对应组织信息 + ScreenCustomerAgencyDTO dto = evaluationIndexDao.getByAgencyId(agencyId); + //2.判断客户是否存在子客户 + List list = customerRelation.haveSubCustomer(dto.getCustomerId()); + if (!CollectionUtils.isNotEmpty(list)) { + return new ArrayList<>(); + } + //3.存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的但是存在父子客户关系的客户组织列表 + return evaluationIndexDao.getAgencyIdsByAgencyId(agencyId, dto.getAreaCode(), list); + } + + /** + * @Description 查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查且是在当前客户和子客户范围内查询 + * @author sun + */ + @Override + public List getSubAgencyListByAgency(String agencyId) { + //1.查询agencyId对应组织信息 + ScreenCustomerAgencyDTO dto = evaluationIndexDao.getByAgencyId(agencyId); + //2.判断客户是否存在子客户 + List list = customerRelation.haveSubCustomer(dto.getCustomerId()); + if (!CollectionUtils.isNotEmpty(list)) { + return evaluationIndexDao.getSubAgencyListByAgency(agencyId, null, null); + } else { + list.add(dto.getCustomerId()); + return evaluationIndexDao.getSubAgencyListByAgency(null, dto.getAreaCode(), list); + } + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 8008242d5f..8cfd4a2276 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.service.govorg; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; @@ -59,4 +60,16 @@ public interface GovOrgService { * @author sun */ List selectGridStaffByGridIds(List gridIds, String staffName); + + /** + * @Description 查询网格信息或查询当前人员所属组织下所有网格信息 + * @author sun + */ + List getGridInfoList(List gridIds, String staffId); + + /** + * @Description 查询工作人员所属组织信息 + * @author sun + */ + CustomerAgencyDTO gridByAgencyId(String customerId, String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 29ed9208cf..31b5f9272c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao; import com.epmet.dataaggre.dao.govorg.CustomerGridDao; import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao; import com.epmet.dataaggre.dao.govorg.CustomerStaffGridDao; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; @@ -264,4 +265,24 @@ public class GovOrgServiceImpl implements GovOrgService { return result; } + /** + * @Description 查询网格信息或查询当前人员所属组织下所有网格信息 + * @author sun + */ + @Override + public List getGridInfoList(List gridIds, String staffId) { + //1.有网格列表的查询网格基本信息,没有的查询工作人员所属组织级下级所有的网格信息 + List list = customerGridDao.getGridInfoList(gridIds, staffId); + return list; + } + + /** + * @Description 查询工作人员所属组织信息 + * @author sun + */ + @Override + public CustomerAgencyDTO gridByAgencyId(String customerId, String staffId) { + return customerStaffAgencyDao.selectAgencyByStaffId(customerId, staffId); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java new file mode 100644 index 0000000000..d2fc60ad35 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java @@ -0,0 +1,51 @@ +package com.epmet.dataaggre.service.impl; + +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.service.AggreGridService; +import com.epmet.dataaggre.service.datastats.DataStatsService; +import com.epmet.dataaggre.service.govorg.GovOrgService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class AggreGridServiceImpl implements AggreGridService { + + @Autowired + private GovOrgService govOrgService; + + @Autowired + private DataStatsService dataStatsService; + + @Override + public List getGridMemberDataAnalysis( + List gridIds, + String searchedStaffName, + String currStaffId, + String month, + String sort, + Integer pageNo, + Integer pageSize) { + + //1.得到网格id列表 + Map gridIdAndName = new HashMap<>(); + List grids = govOrgService.getGridInfoList(gridIds, currStaffId); + grids.forEach(g -> { + gridIds.add(g.getId()); + gridIdAndName.put(g.getId(), g.getGridName()); + }); + + //2.查询列表,并且填充内容 + List records = dataStatsService.listGridMemberDataStats(gridIds, searchedStaffName, month, sort, pageNo, pageSize); + records.forEach(r -> r.setOrgName(gridIdAndName.get(r.getGridId()))); + return records; + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java index af0dc94e88..71d96fe17b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java @@ -10,4 +10,13 @@ import java.util.List; */ public interface CustomerRelation { List selectUsedAreaCodeList(String areaCode); + + /** + * 是否有子客户 + * @author zhaoqifeng + * @date 2021/6/29 11:06 + * @param customerId + * @return List + */ + List haveSubCustomer(String customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java index 045232e1a7..af5f40e53f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java @@ -5,6 +5,7 @@ import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.opercrm.CustomerRelationDao; import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,4 +28,17 @@ public class CustomerRelationImpl implements CustomerRelation { public List selectUsedAreaCodeList(String areaCode) { return customerRelationDao.selectUsedAreaCodeList(areaCode); } + + /** + * 是否有子客户 + * + * @param customerId + * @return boolean + * @author zhaoqifeng + * @date 2021/6/29 11:06 + */ + @Override + public List haveSubCustomer(String customerId) { + return customerRelationDao.selectAllSubCustomerIds(customerId); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml index fb5757da88..7b4361e463 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml @@ -12,9 +12,10 @@ fact_reg_user_agency_daily WHERE del_flag = '0' - AND agency_id = #{agencyId} AND date_id = #{dateId} - LIMIT 1 + + agency_id = #{agencyId} + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml new file mode 100644 index 0000000000..fdbb6fdc04 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + member.id, + member.date_id, + member.month_id, + member.year_id, + member.customer_id, + member.agency_id, + member.grid_id, + member.pid, + member.pids, + member.staff_id, + member.staff_name, + member.project_count, + member.issue_to_project_count, + member.closed_issue_count, + member.project_response_count, + member.project_transfer_count, + member.project_closed_count, + member.project_incr, + member.issue_to_project_incr, + member.closed_issue_incr, + member.project_response_incr, + member.project_transfer_incr, + member.project_closed_incr, + member.del_flag, + member.revision, + member.created_by, + member.created_time, + member.updated_by, + member.updated_time + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml index 43e15095e4..3b1b0c9db3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml @@ -3,4 +3,16 @@ + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml index 662ce08625..ce078c21f3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml @@ -51,4 +51,70 @@ --> + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml index a0c2e0c245..d248aa13df 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml @@ -20,4 +20,158 @@ AND date_id = #{dateId} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml index 92cffd9271..2ca96e0edd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml @@ -99,4 +99,52 @@ ) + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index 50269ca116..763c06694b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -16,4 +16,18 @@ AND user_id = #{userId} + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml index 169a44070f..439efdb207 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/opercrm/CustomerRelationDao.xml @@ -14,4 +14,13 @@ AND cr.AREA_CODE LIKE concat(#{areaCode}, '%') AND cr.AREA_CODE != #{areaCode} + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java index 04d4896995..e2d3f77953 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java @@ -13,8 +13,9 @@ import java.util.List; */ @Data public class AgencyInfoDTO implements Serializable { - private String agencyId; - private String areaCode; - private List subAgencyIds; - private List subGridIds; + private String currentAgencyId; + private String currentAgencyName; + private String currentAreaCode; + private List subAgencies; + private List subGrids; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerAgencyCommonDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerAgencyCommonDTO.java new file mode 100644 index 0000000000..3a1078fd69 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerAgencyCommonDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * screen_customer_agency + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/13 15:31 + */ +@Data +public class ScreenCustomerAgencyCommonDTO implements Serializable { + private static final long serialVersionUID = -6222325433226628163L; + private String agencyId; + private String agencyName; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridCommonDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridCommonDTO.java new file mode 100644 index 0000000000..2578a6c482 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridCommonDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * screen_customer_grid + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/13 15:32 + */ +@Data +public class ScreenCustomerGridCommonDTO implements Serializable { + private static final long serialVersionUID = -4405092094598416917L; + private String gridId; + private String gridName; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridDTO.java new file mode 100644 index 0000000000..10c2a503c3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenCustomerGridDTO.java @@ -0,0 +1,119 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 网格(党支部)信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-26 + */ +@Data +public class ScreenCustomerGridDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID 主键ID + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格id + */ + private String gridId; + + /** + * 组织名称 + */ + private String gridName; + + /** + * 网格所属组织id + */ + private String parentAgencyId; + + /** + * 坐标区域 + */ + private String areaMarks; + + /** + * 中心点位 + */ + private String centerMark; + + /** + * 党支部(=网格)的位置 + */ + private String partyMark; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + + /** + * 所有上级ID,用英文逗号分开 + */ + private String allParentIds; + private String pid; + private String pids; + private String areaCode; +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java new file mode 100644 index 0000000000..003e925379 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 15:26 + */ +@Data +public class AgencyDetailMulticFormDTO implements Serializable { + private static final long serialVersionUID = 6603177626712295270L; + /** + * 内部错误分组 + * */ + public interface AddUserInternalGroup{} + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空" , groups = {AddUserInternalGroup.class}) + private String agencyId; + + + /** + * 当前登录用户所属的客户id + */ + private String customerId; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/project/MassesDiscontentFormV2DTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/project/MassesDiscontentFormV2DTO.java new file mode 100644 index 0000000000..55df09cdfe --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/project/MassesDiscontentFormV2DTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.form.project; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 群众不满列表查询入参DTO,从指标库取值 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 10:55 + */ +@Data +public class MassesDiscontentFormV2DTO implements Serializable { + public interface MassesDiscontentFormV2 { + } + + /** + * 时间区间,三个月:threeMonth;半年:sixMonth;一年:twelveMonth + * 一个月按照30天,三个月90天,半年180天,一年365天 + */ + @NotBlank(message = "timeSection不能为空,取值:三个月:threeMonth;半年:sixMonth;一年:twelveMonth", groups = MassesDiscontentFormV2.class) + private String timeSection; + + /** + * asc:分数由低到高 + * desc:分数由高到低 + */ + @NotBlank(message = "sortType不能为空,取值:asc:分数由低到高;desc:分数由高到低", groups = MassesDiscontentFormV2.class) + private String sortType; + + /** + * 组织ID + */ + @NotBlank(message = "agencyId不能为空", groups = MassesDiscontentFormV2.class) + private String agencyId; + + @NotNull(message = "pageNo不能为空", groups = MassesDiscontentFormV2.class) + private Integer pageNo; + + @NotNull(message = "pageSize不能为空", groups = MassesDiscontentFormV2.class) + private Integer pageSize; + + /** + * 当前agency对应的区域编码,由前端传入,前端从/data/report/screen/agency/agencydetail这取值 + */ + private String areaCode; + + + + + //以下属性无需前端传入 + private String startDate; + private String endDate; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java new file mode 100644 index 0000000000..7b34abcec9 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java @@ -0,0 +1,104 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 15:31 + */ +@Data +public class AgencyDetailMulticResultDTO implements Serializable { + /** + * 机关组织Id + */ + private String agencyId = ""; + + /** + * 组织名称 + */ + private String agencyName = ""; + + /** + * 机关级别(社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level = ""; + + /** + * 地区编码 + */ + private String areaCode = ""; + + /** + * 【省份】名称 + */ + private String province = ""; + + /** + * 【城市】名称 + */ + private String city = ""; + + /** + * 【区县】名称 + */ + private String district = ""; + + /** + * 本机关的所有上级机关 + */ + private List parentList; + + /** + * 街道 + */ + private String street=""; + + /** + * 社区 + */ + private String community=""; + + /** + * open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参 + */ + private String areaCodeSwitch; + + /** + * 组织区划的名称 + */ + private String areaName; + + /** + * 当前组织对应客户根组织级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String rootlevel; + + + //以下参数是06.24新增 + private String rootAgencyId; + private String parentAreaCode; + /** + * 是否有字客户 + */ + private Boolean haveSubCustomer; + + /** + * 子客户列表 + */ + private List subCustomerIds; + + // @JsonIgnore + /** + * 当前agencyId所属的客户id + */ + private String customerId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java new file mode 100644 index 0000000000..60683bf779 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取组织机构信息接口-本机关的所有上级机关信息 + * + * @author sun + */ +@Data +public class ParentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String id = ""; + /** + * 机关组织名称 + */ + private String name = ""; + + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java index 5ceeca49a7..a07fa65053 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java @@ -46,4 +46,14 @@ public class ScreenCustomerAgencyDTO implements Serializable { * 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 */ private String parentAreaCode; + + /** + * 父级id ,顶级,此列为0 + */ + private String pid; + + /** + * 所有上级ID,用逗号(英文)分开 + */ + private String pids; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/MassesDiscontentResultV2DTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/MassesDiscontentResultV2DTO.java new file mode 100644 index 0000000000..627edc6daa --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/MassesDiscontentResultV2DTO.java @@ -0,0 +1,69 @@ +package com.epmet.dto.result.project; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * 群众不满列表查询返参DTO,从指标库取值 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/24 11:02 + */ +@Data +public class MassesDiscontentResultV2DTO implements Serializable { + private static final long serialVersionUID = 403953150174574960L; + /** + * 项目ID + */ + private String projectId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 话题所在网格 + */ + private String gridName; + + /** + * 话题图片 + */ + private List photos; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 项目分类标签 + */ + private String projectCategory; + + /** + * 项目评价分数 + * 直接取整数位展示 + */ + private BigDecimal score; + + @JsonIgnore + private String customerId; + @JsonIgnore + private String parentAgencyId; + @JsonIgnore + private String areaCode; + + public MassesDiscontentResultV2DTO() { + this.gridName = ""; + this.photos = new ArrayList<>(); + this.topicContent = ""; + this.projectCategory = ""; + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java index b97139c8ff..245d3f7d04 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java @@ -19,6 +19,7 @@ package com.epmet.evaluationindex.index.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -37,20 +38,24 @@ public class IndexExplainFormDTO implements Serializable { /** * 客户id */ + @NotBlank(message = "客户ID不能为空") private String customerId; /** * 组织级别(网格级:grid;社区级:community;乡(镇、街道)级:street;区县级: district;市级: city;省级:province) */ + @NotBlank(message = "组织级别不能为空") private String orgLevel; /** * 组织id */ + @NotBlank(message = "组织ID不能为空") private String orgId; /** * 月份Id */ + @NotBlank(message = "月份不能为空") private String monthId; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java index 1ade73b168..1d5f837199 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java @@ -1,5 +1,6 @@ package com.epmet.evaluationindex.index.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.util.ArrayList; @@ -49,5 +50,8 @@ public class IndexExplainResult { */ private String tableDesc; + @JsonIgnore + private String indexCode; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java index d6ca46a913..1186e7ff70 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java @@ -23,6 +23,15 @@ public class IndexScoreResult implements Serializable { */ private BigDecimal score; + /** + * 本级分数 + */ + private BigDecimal selfScore; + /** + * 下级分数 + */ + private BigDecimal subScore; + /** * 指标对应的权重 */ @@ -43,4 +52,9 @@ public class IndexScoreResult implements Serializable { */ private String valueType; + /** + * 是否是总分 + */ + private Boolean isTotal; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java index 166c9c2aa9..fcba02911c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyFormDTO.java @@ -21,4 +21,9 @@ public class AgencyFormDTO implements Serializable { @NotBlank(message = "机关Id不能为空" , groups = CommonAgencyIdGroup.class) private String agencyId; + + /** + * 平阴县默认穿370124,跟随8个街道点击事件,传入街道的areaCode + * */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java index 542c2e5b48..b5aeaf83ee 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java @@ -3,7 +3,6 @@ package com.epmet.evaluationindex.screen.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -22,4 +21,16 @@ public class FineExampleFormDTO implements Serializable { */ @NotBlank(message = "机关ID不能为空",groups = {FineExample.class}) private String agencyId; + + /** + * 目前只有平阴在传,默认赋值:370124,跟随8个街道变化 + */ + private String areaCode; + + /** + * 当前token中的客户id + */ + @NotBlank(message = "token中的customerId不能为空",groups = {FineExample.class}) + private String customerId; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java index 42a67c936f..ce778cf651 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/RootAgencyFormDTO.java @@ -21,4 +21,9 @@ public class RootAgencyFormDTO implements Serializable { @NotBlank(message = "组织ID不能为空",groups = {RootAgencyFormDTO.AddUserInternalGroup.class}) private String agencyId; + /** + * token中客户Id + */ + private String customerId; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResult.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResult.java index 051af134ba..5a010ea45b 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResult.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResult.java @@ -39,4 +39,19 @@ public class MonthBarchartResult implements Serializable { * 治理能力分数,权重 */ private BigDecimal governAblityWeight; + + /** + * 党建能力 原始得分 + */ + private BigDecimal partyOriginScore = new BigDecimal(0.0); + + /** + * 治理能力 原始得分 + */ + private BigDecimal governOriginScore = new BigDecimal(0.0); + + /** + * 服务能力 原始得分 + */ + private BigDecimal serviceOriginScore = new BigDecimal(0.0); } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResultDTO.java index 8a8da975f1..c86efe0c28 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthBarchartResultDTO.java @@ -55,4 +55,19 @@ public class MonthBarchartResultDTO implements Serializable { * 治理能力分数,权重 */ private List governAblityWeightData; + + /** + * 党建能力 原始得分 + */ + private List partyOriginScore; + + /** + * 治理能力 原始得分 + */ + private List governOriginScore; + + /** + * 服务能力 原始得分 + */ + private List serviceOriginScore; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthPieChartResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthPieChartResultDTO.java index de0b16022b..b9abf888d1 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthPieChartResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/MonthPieChartResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.evaluationindex.screen.dto.result; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * @Author zxc @@ -28,6 +29,34 @@ public class MonthPieChartResultDTO implements Serializable { */ private Double governAbility = 0.0; + /** + * 党建能力 原始得分 + */ + private BigDecimal partyOriginScore = new BigDecimal(0.0); + + /** + * 治理能力 原始得分 + */ + private BigDecimal governOriginScore = new BigDecimal(0.0); + + /** + * 服务能力 原始得分 + */ + private BigDecimal serviceOriginScore = new BigDecimal(0.0); + + /** + * 服务能力权重(保留一位小数) + */ + private Double serviceAblityWeight=0.0; + /** + * 党建能力权重(保留一位小数) + */ + private Double partyDevWeight=0.0; + /** + * 治理能力权重(保留一位小数) + */ + private Double governAblityWeight=0.0; + /** * 月份Id */ diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java index 1c7391dd93..ece032ba4d 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Set; @@ -24,6 +25,11 @@ public class ScreenProjectDetailResultDTO implements Serializable { * 项目id */ private String projectId; + /** + * 项目标题,06.25新增,工作端小程序难点赌点+群众不满详情用 + */ + private String projectTitle; + /** * 议题内容,其实就是项目内容 */ @@ -66,6 +72,11 @@ public class ScreenProjectDetailResultDTO implements Serializable { */ private List processList; + /** + * 满意度得分 06.25新增,这个返参目前大屏和工作端小程序都没有用到,工作端小程序详情的得分是取得列表返回去的值 + */ + private BigDecimal score; + @Data public static class processDTO{ private String processId; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java index 94e4f20546..3e02aa4e96 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; /** * @Description 用户参与各项指标以及增长查询结果dto * @ClassName UserJoinIndicatorGrowthRateResultDTO - * @Auth wangc + * @author wangc * @Date 2020-08-21 16:07 */ @Data @@ -16,25 +16,33 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { private static final long serialVersionUID = -8830240350298414599L; private String id; - + /** + * 总参与数 + * */ private Integer total; + /** + * 总参与数:月增长 + * */ private BigDecimal monthIncr; /** - * incr上升, decr下降 + * 总参与数:incr上升, decr下降 * */ private String monthTrend; + /** + * 人均议题 + * */ private BigDecimal averageIssue; /** - * 较上月百分比 + * 人均议题:较上月百分比 * */ private BigDecimal issueCompareLatestMonth; /** - * 较上月趋势:incr上升,decr下降 + * 人均议题:较上月趋势:incr上升,decr下降 * */ private String issueCompareLatestTrend; @@ -43,7 +51,13 @@ public class UserJoinIndicatorGrowthRateResultDTO implements Serializable { */ private BigDecimal averageJoin; + /** + * 平均参与度: 较上月百分比 + */ private BigDecimal joinCompareLatestMonth; + /** + * 平均参与度:较上月趋势:incr上升,decr下降 + */ private String joinCompareLatestTrend; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java index 91f3d027e9..84776cf8b1 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordSubRank.java @@ -31,4 +31,6 @@ public class WorkRecordSubRank implements Serializable { * 组织次数 */ private Integer participateTotal; + + private String isDefault; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java index 7b07db5c72..ac850effbe 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java @@ -22,4 +22,11 @@ public interface ProjectConstant { String PROCESS_FAILURE = "查询项目进展失败......"; + /** + * 三个月,六个月,12个月 + */ + String THREE_MONTH = "threeMonth"; + String SIX_MONTH = "sixMonth"; + String TWELVE_MONTH = "twelveMonth"; + String YESTERDAY = "yesterday"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java index 5a3936db6a..8f62ab848e 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/DifficultyRankFormDTO.java @@ -40,4 +40,15 @@ public class DifficultyRankFormDTO implements Serializable { * 组织类型: 网格:grid ; 组织:agency */ private String orgType; + + /** + * 当前agency对应的区域编码,由前端传入,前端从/data/report/screen/agency/agencydetail这取值 + */ + private String areaCode; + + //以下属性无需前端赋值 + /** + * 当前登录用户所属客户id + */ + private String customerId; } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java index f781d62d15..f3d1967599 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDifficultRankResultDTO.java @@ -3,7 +3,6 @@ package com.epmet.project.dto.result; import lombok.Data; import java.io.Serializable; -import java.util.ArrayList; import java.util.List; /** @@ -25,11 +24,17 @@ public class ProjectDifficultRankResultDTO implements Serializable { * 项目标题 * */ private String title; - + // 3个街道和产品这边状态码不一样.. /** * 状态: 待处理: pending; 结案closed * */ private String statusCode; + // pending 处理中 + // closed 已结案 + // 10 已结案 + // 5 已关闭 + // 0 处理中 + private String statusDesc; /** * 社区-网格名 diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java index 2c867a6398..9aaf0b6050 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectNextAgencyResultDTO.java @@ -1,9 +1,9 @@ package com.epmet.project.dto.result; +import com.epmet.commons.tools.constant.StrConstant; import lombok.Data; import java.io.Serializable; -import java.util.List; /** * @Description 难点赌点-当前登录人员本级一级下一级组织机构/网格 返参DTO @@ -30,5 +30,15 @@ public class ProjectNextAgencyResultDTO implements Serializable { * */ private String orgType; + /** + * orgId对应的areaCode。 只有当前客户有子客户时,才会返回指,否则返回null或者空字符串 + * */ + private String areaCode; + public ProjectNextAgencyResultDTO(){ + this.orgId= StrConstant.EPMETY_STR; + this.orgName= StrConstant.EPMETY_STR; + this.orgType= StrConstant.EPMETY_STR; + this.areaCode= StrConstant.EPMETY_STR; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java index dd34c3c42d..3f174a32b2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java @@ -24,17 +24,25 @@ public class IndexConstant { public static final String ZB_CN = "指标"; public static final String BEN_JI_CN = "本级"; public static final String XIA_JI_CN = "下级"; + public static final String BEN_JI_EN = "self"; + public static final String XIA_JI_EN = "sub"; public static final String ZI_SHEN = "zishen"; public static final String XIA_JI = "xiaji"; public static final String THRESHOLD_TEXT = "给定阈值%d%%,超过阈值不加分"; public static final String TABLE_DESC = "详见下表:"; public static final String INDEX_SCORE_TITLE = "当月指数"; - public static final String INDEX_SCORE_DESC = "自然月周期内,当月指数得分=党建指数得分*相关权重+治理指数得分*相关权重+服务指数得分*相关权重"; + public static final String INDEX_SCORE_DESC = "自然月周期内,当月指数得分#(totalScore)#=党建指数得分#(dangjiannengli)#*相关权重#(dangjiannengliweight)#" + + "+治理指数得分#(zhilinengli)#*相关权重#(zhilinengliweight)#+服务指数得分#(fuwunengli)#*相关权重#(fuwunengliweight)#"; public static final String INDEX_DISTRINCT_TABLE1_INDEX_CODE = "suoyoujiedaozlnlpjz"; + public static final String INDEX_DISTRINCT_TABLE2_INDEX_CODE = "suoyouzhishubmzlnlpjz"; public static final String ZHI_LI_NENG_LI = "zhilinengli"; + public static final String PATTERN_FIX = "#"; public static final String PATTERN_D = "d"; + public static final String PATTERN_WEIGHT = "weight"; + public static final String PATTERN_TOTAL = "totalScore"; public static final String QUAN_QU_ZHI_LI_INDEX_CODE = "quanquxiangguan:zhilinengli"; + public static final String PATTERN_ALL = "[#][^#]+[#]"; /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java index 3a2f5cfebb..29d8cb939b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java @@ -1,5 +1,7 @@ package com.epmet.datareport.controller.fact; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.fact.FactIndexService; @@ -98,8 +100,9 @@ public class FactIndexController { * @author sun */ @PostMapping("index/rootagency") - public Result rootAgency(@RequestBody RootAgencyFormDTO formDTO) { + public Result rootAgency(@LoginUser TokenDto tokenDto, @RequestBody RootAgencyFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(factIndexService.rootAgency(formDTO)); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java index abac68a416..e248a6ac35 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java @@ -17,12 +17,15 @@ package com.epmet.datareport.controller.index; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.index.IndexExplainService; import com.epmet.evaluationindex.index.form.IndexExplainFormDTO; import com.epmet.evaluationindex.index.form.IndexScoreFormDTO; import com.epmet.evaluationindex.index.result.IndexExplainResult; import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; +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.RequestBody; @@ -56,6 +59,8 @@ public class IndexExplainController { */ @PostMapping("detail") public Result> getScoreDetail(@RequestBody IndexExplainFormDTO formDTO){ + formDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId()); + ValidatorUtils.validateEntity(formDTO); Result> ok = new Result>().ok(indexExplainService.getScoreDetail(formDTO)); return ok; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java index 2f704b6b16..6f485e507e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java @@ -11,6 +11,8 @@ import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantity import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; import com.epmet.datareport.service.project.ProjectService; import com.epmet.dto.form.ProcessListFormDTO; +import com.epmet.dto.form.project.MassesDiscontentFormV2DTO; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.project.constant.ProjectConstant; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; @@ -114,6 +116,21 @@ public class ProjectController { return new Result>().ok(projectService.getDifficultyRank(param)); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 难点赌点-耗时最长|涉及部门最多|处理次数 返回该组织下所有的难点堵点的 数据 + * 2021.06.21新增次API,多客户版本,eg:平阴县的工作人员可以看到8个街道的难点赌点 + * @Date 2021/6/23 13:09 + **/ + @PostMapping("difficultyrank-multic") + public Result> difficultyRankMultic(@RequestHeader("CustomerId") String customerId,@RequestBody DifficultyRankFormDTO formDTO){ + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, DifficultyRankFormDTO.DifficultyRankInternalGroup.class); + return new Result>().ok(projectService.difficultyRankMultic(formDTO)); + } + /** * @Description 难点赌点-耗时最长|涉及部门最多|处理次数 * @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321614 @@ -127,6 +144,20 @@ public class ProjectController { return new Result>().ok(projectService.getMyNextAgency(tokenDto)); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param tokenDto + * @author yinzuomei + * @description 001、难点堵点-组织下拉框 + * 需求描述:下拉框显示当前用户所属组织和下级组织 ;1)如果当前用户是街道工作人员, 显示所属街道和该街道下的社区+直属网格;2)如果当前用户是社区人员, 显示所属社区和该社区下的网格+直属网格。 + * 210622: 新增此API, 后端改为从指标库取值 , 保证平阴县的工作人员,看到的下拉框是平阴县、以及8个街道 + * @Date 2021/6/22 14:20 + **/ + @PostMapping("mynextagency-multic") + public Result> myNextAgencyMultic(@LoginUser TokenDto tokenDto){ + return new Result>().ok(projectService.myNextAgencyMultic(tokenDto.getUserId(),tokenDto.getCustomerId())); + } + /** * 002、项目分类字典查询 * 查询当前客户的父客户下,项目分类字典 @@ -140,4 +171,18 @@ public class ProjectController { public Result> categoryDict(@RequestHeader("CustomerId") String customerId) { return new Result>().ok(projectService.getCategoryDict(customerId)); } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 群众不满列表,改为从指标库的screen_project_data取值 + * sql里面写死<75分的展示 + * @Date 2021/6/24 11:13 + **/ + @PostMapping("massesdiscontent-multic") + public Result> queryMassesDiscontentMultic(@RequestBody MassesDiscontentFormV2DTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MassesDiscontentFormV2DTO.MassesDiscontentFormV2.class); + return new Result>().ok(projectService.queryMassesDiscontentMultic(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java index 1eba0b727c..6c71a15009 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java @@ -1,10 +1,14 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.dto.form.AddAreaCodeDictFormDTO; +import com.epmet.dto.form.AgencyDetailMulticFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; @@ -110,4 +114,19 @@ public class AgencyController { } return new Result<>(); } + + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 工作端小程序-数据上面的 当前组织调用此接口 + * @Date 2021/6/24 15:29 + **/ + @PostMapping("agencydetail-multic") + public Result queryAgencyDetailMultiC(@LoginUser TokenDto tokenDto, @RequestBody AgencyDetailMulticFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AgencyDetailMulticFormDTO.AddUserInternalGroup.class); + return new Result().ok(agencyService.queryAgencyDetailMultiC(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java index bbd0039e71..f5615c15bd 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java @@ -30,7 +30,8 @@ public class PartyMemberLeadController { * @date 2020/8/20 1:56 下午 */ @PostMapping("fineexample") - public Result fineExample(@RequestBody FineExampleFormDTO fineExampleFormDTO){ + public Result fineExample(@RequestHeader("CustomerId") String customerId,@RequestBody FineExampleFormDTO fineExampleFormDTO){ + fineExampleFormDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(fineExampleFormDTO, FineExampleFormDTO.FineExample.class); return new Result().ok(partyMemberLeadService.fineExample(fineExampleFormDTO)); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 986a880aac..04c509de8b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -17,6 +17,9 @@ package com.epmet.datareport.dao.evaluationindex.screen; +import com.epmet.dto.ScreenCustomerAgencyCommonDTO; +import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.dto.result.plugins.DeptNodeDTO; @@ -98,7 +101,7 @@ public interface ScreenCustomerAgencyDao { * @Description 根据组织ID判断是否根组织 * @author sun */ - int selectRootAgency(@Param("agencyId") String agencyId); + int selectRootAgency(@Param("agencyId") String agencyId, @Param("customerId") String customerId); /** * desc: 根据orgId获取组织信息 @@ -161,7 +164,7 @@ public interface ScreenCustomerAgencyDao { **/ List getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); - List selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); + List selectSubAgencyIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); /** * @Description 根据agencyId查询网格 @@ -170,4 +173,35 @@ public interface ScreenCustomerAgencyDao { * @date 2021/6/8 1:27 下午 */ List selectGrid(@Param("agencyId")String agencyId,@Param("areaCode")String areaCode); + + /** + * 查询当前组织的下一级组织,可根据areaCode查询,也可根据pid查询 + * + * @param areaCode + * @param pid + * @return java.util.List + */ + List selectNextAgencyList(@Param("areaCode") String areaCode, @Param("pid") String pid, @Param("allCustomerIds") List allCustomerIds); + + /** + * 查询当前组织的下面的网格,可根据areaCode查询,也可根据parentAgencyId查询 + * + * @param areaCode + * @param parentAgencyId + * @return java.util.List + */ + List selectGridDTOList(@Param("areaCode") String areaCode, @Param("parentAgencyId") String parentAgencyId,@Param("allCustomerIds") List allCustomerIds); + + List selectPAgencyById(@Param("listStr")List pidList); + + /** + * @return com.epmet.dto.result.ScreenCustomerAgencyDTO + * @param customerId + * @author yinzuomei + * @description 根据客户id,返回当前客户下的跟组织信息 + * @Date 2021/6/24 17:43 + **/ + ScreenCustomerAgencyDTO selectCustomerRootAgency(String customerId); + + ScreenCustomerAgencyDTO selectByAreaCode(String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java index e0484794e6..abf21dd119 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.evaluationindex.screen; +import com.epmet.dto.ScreenCustomerGridCommonDTO; import com.epmet.evaluationindex.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -81,5 +82,5 @@ public interface ScreenCustomerGridDao { */ List selectGridInfo(@Param("agencyId")String agencyId); - List selectSubGridIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); + List selectSubGridIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index 976c3c85b4..18a3795b05 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -127,4 +127,6 @@ public interface ScreenIndexDataMonthlyDao{ @Param("yearId") String yearId, @Param("areaCode") String areaCode, @Param("topNum") int topNum); + + List selectKczSubAgencyOrGridIndexMonthlyRank(SubAgencyIndexRankYMFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java index 6735487317..2fb33f60d5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataYearlyDao.java @@ -51,4 +51,7 @@ public interface ScreenIndexDataYearlyDao{ * @Date 09:38 2020-09-08 **/ List selectAnNingSubAgencyIndexYearlyRank(SubAgencyIndexRankYMFormDTO formDTO); + + + List selectKczSubAgencyIndexYearlyRank(SubAgencyIndexRankYMFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java index 5bc3077e85..0983d7c047 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java @@ -21,8 +21,6 @@ import com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; - /** * 党建引领-先锋模范数据 * @@ -43,12 +41,11 @@ public interface ScreenPioneerDataDao{ /** * @Description 根据地区码查询先锋模范 * @param areaCode - * @param customerId - * @param customerIds - 子级客户列表 + * @param dataEndTime 默认是昨天yyyyMMdd * @return com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO * @author wangc * @date 2021.02.24 15:39 */ - FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode")String areaCode,@Param("customerId")String customerId,@Param("list") List customerIds); + FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode") String areaCode, @Param("dataEndTime") String dataEndTime); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java index 57a9829f1d..147d12ef3f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencyScoreDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.fact; +import com.epmet.evaluationindex.index.result.IndexScoreResult; import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO; import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; @@ -24,6 +25,7 @@ import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO; import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO; import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.LinkedList; import java.util.List; @@ -57,4 +59,6 @@ public interface FactIndexAgencyScoreDao { * @author sun */ LinkedList selectAgencyMonthWeightScoreList(MonthScoreListFormDTO formDTO); + + List selectAgencyScoreList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("monthId") String monthId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java index d0bfc62ac5..f5784b5a56 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunityScoreDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.fact; +import com.epmet.evaluationindex.index.result.IndexScoreResult; import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO; import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; @@ -24,6 +25,7 @@ import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO; import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO; import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.LinkedList; import java.util.List; @@ -57,4 +59,6 @@ public interface FactIndexCommunityScoreDao { * @author sun */ LinkedList selectCommunityMonthWeightScoreList(MonthScoreListFormDTO formDTO); + + List selectComunityScoreList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("monthId") String monthId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java index c94fdb23a3..c98582ec77 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridScoreDao.java @@ -17,6 +17,7 @@ package com.epmet.datareport.dao.fact; +import com.epmet.evaluationindex.index.result.IndexScoreResult; import com.epmet.evaluationindex.screen.dto.form.AblityIndexFormDTO; import com.epmet.evaluationindex.screen.dto.form.MonthScoreListFormDTO; import com.epmet.evaluationindex.screen.dto.form.ScoreListFormDTO; @@ -24,6 +25,7 @@ import com.epmet.evaluationindex.screen.dto.result.AblityIndexResultDTO; import com.epmet.evaluationindex.screen.dto.result.MonthScoreListResultDTO; import com.epmet.evaluationindex.screen.dto.result.ScoreListResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.LinkedList; import java.util.List; @@ -57,4 +59,7 @@ public interface FactIndexGridScoreDao { * @author sun */ LinkedList selectGridMonthWeightScoreList(MonthScoreListFormDTO formDTO); + + List selectGridScoreList(@Param("customerId") String customerId, @Param("orgId") String orgId, @Param("monthId") String monthId); + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java index d27a4eee75..3f323c0dd5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java @@ -55,16 +55,16 @@ public interface ScreenWorkRecordOrgDailyDao extends BaseDao customerIds); + WorkRecordSubRank selectCurrentAgency(@Param("agencyId") String agencyId, + @Param("dateId")String dateId, + @Param("typeCodeList")List typeCodeList); + + List selectCustomerTypeCode(@Param("dataType")String dataType, @Param("customerId")String customerId); + + + WorkRecordSubRank selectUpToCalAgency(@Param("agencyId")String agencyId, + @Param("dateId")String dateId, + @Param("typeCodeList") List typeCodeList); - List selectCurrentAgency(@Param("agencyId") String agencyId, - @Param("dataType")String dataType, - @Param("customerId")String customerId, - @Param("dateId")String dateId); + WorkRecordSubRank selectUpToCalGrid(@Param("gridId")String gridId, @Param("dateId")String dateId, @Param("typeCodeList")List typeCodeList); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java index 870c25a6d2..d323c244c8 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/project/ProjectDao.java @@ -1,5 +1,6 @@ package com.epmet.datareport.dao.project; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.project.dto.FactAgencyProjectDailyDTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.result.*; @@ -66,6 +67,14 @@ public interface ProjectDao { **/ List difficultyRank(DifficultyRankFormDTO difficultyRankFormDTO); + /** + * 工作端-数据:难点赌点列表查询V2,多客户版本 + * + * @param formDTO + * @return com.epmet.project.dto.result.ProjectDifficultRankResultDTO + */ + List difficultyRankV2(DifficultyRankFormDTO formDTO); + /** * @Description 查询难点堵点的图片list * @param @@ -74,4 +83,21 @@ public interface ProjectDao { * @date 2020.10.20 10:13 **/ List getDifficultyImgList(String eventId); + + /** + * @return java.util.List + * @param agencyId + * @param areaCode + * @param startDate + * @param endDate + * @param sortType + * @author yinzuomei + * @description 群众不满列表,改为从指标库的screen_project_data取值 sql里面写死<75分的展示 + * @Date 2021/6/24 13:16 + **/ + List selectMassesDiscontentMultic(@Param("agencyId") String agencyId, + @Param("areaCode") String areaCode, + @Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("sortType") String sortType); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java new file mode 100644 index 0000000000..f9bdc24a1e --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java @@ -0,0 +1,39 @@ +package com.epmet.datareport.redis; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.map.MapUtil; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/29 15:46 + */ +@Component +public class DataReportRedis { + @Autowired + private RedisUtils redisUtils; + private String agencyDetailKeyPrefix="epmet:screen:"; + + public AgencyDetailMulticResultDTO queryAgencyDetailMulticResultDTO(String customerId, String agencyId) { + String agencyDetailKey=agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId); + Map map = redisUtils.hGetAll(agencyDetailKey); + if (MapUtil.isEmpty(map)) { + return null; + } + AgencyDetailMulticResultDTO dto = BeanUtil.mapToBean(map, AgencyDetailMulticResultDTO.class, true); + return dto; + } + + public void setAgencyDetailMulticResultDTO(String customerId, String agencyId, AgencyDetailMulticResultDTO agencysResultDTO) { + String agencyDetailKey = agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId); + Map map = BeanUtil.beanToMap(agencysResultDTO); + redisUtils.hMSet(agencyDetailKey, map, RedisUtils.DEFAULT_EXPIRE); + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java index 572fb3b4b8..ae40c88329 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.datareport.service.evaluationindex.index.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.enums.OrgLevelEnum; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; @@ -67,13 +68,19 @@ public class IndexExplainServiceImpl implements IndexExplainService { @Autowired private FactIndexGridSubScoreDao gridSubScoreDao; @Autowired + private FactIndexGridScoreDao gridScoreDao; + @Autowired private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao; @Autowired private FactIndexCommunitySubScoreDao communitySubScoreDao; @Autowired + private FactIndexCommunityScoreDao communityScoreDao; + @Autowired private FactIndexAgencySubScoreDao agencySubScoreDao; @Autowired private FactIndexDeptSubScoreDao deptSubScoreDao; + @Autowired + private FactIndexAgencyScoreDao agencyScoreDao; @Override @@ -83,6 +90,7 @@ public class IndexExplainServiceImpl implements IndexExplainService { first.setTitle(IndexConstant.INDEX_SCORE_TITLE); first.setMeaning(IndexConstant.INDEX_SCORE_DESC); results.add(first); + List explainDTOList = indexExplainDao.getIndexExplainTreeByOrgType(formDTO.getOrgLevel()); if (CollectionUtils.isEmpty(explainDTOList)) { return null; @@ -100,20 +108,33 @@ public class IndexExplainServiceImpl implements IndexExplainService { results.add(result); result.setTitle(explainDTO.getTitle()); result.setMeaning(explainDTO.getMeaning()); + result.setIndexCode(explainDTO.getIndexCode()); //全区相关的服务能力的含义中 有权重 所以特殊处理下 if (explainDTO.getOrgLevel().equals(OrgLevelEnum.DISTRICT.getCode()) && IndexConstant.ZLZS_CN.equals(explainDTO.getTitle())) { - List detailResults = detailEntityMap.get(IndexConstant.QUAN_QU_ZHI_LI_INDEX_CODE); - detailResults.forEach(index -> { - String newMeaning = result.getMeaning().replaceFirst(IndexConstant.PATTERN_D, - index.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString()); + + //获取分数 补充下 + IndexScoreFormDTO ablityListFormDTO = new IndexScoreFormDTO(); + ablityListFormDTO.setCustomerId(formDTO.getCustomerId()); + ablityListFormDTO.setOrgId(formDTO.getOrgId()); + ablityListFormDTO.setAllParentIndexCode(explainDTO.getIndexCode()); + ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId()); + List scoreResults = agencySubScoreDao.selectSubScore(ablityListFormDTO); + scoreResults.forEach(e -> { + String newMeaning = result.getMeaning().replaceFirst(e.getIndexCode(), e.getScore().toString()) + .replaceFirst(IndexConstant.PATTERN_D, + e.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString()); result.setMeaning(newMeaning); }); } + + //设置表格数据 setTableData(formDTO, detailEntityMap, explainDTO, result); //子节点 setChildren(formDTO, detailEntityMap, result, explainDTO, explainDTO.getChildren()); + //设置 新的含义 带分数的 + setCurrentMonthScore(formDTO, first, result); } return results; @@ -124,6 +145,72 @@ public class IndexExplainServiceImpl implements IndexExplainService { return indexDictDao.selectIndexDict(formDTO.getIndexCode()); } + private void setCurrentMonthScore(IndexExplainFormDTO formDTO, IndexExplainResult first, IndexExplainResult second) { + + String orgLevel = formDTO.getOrgLevel(); + OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel); + List list = null; + + switch (anEnum) { + case GRID: + list = gridScoreDao.selectGridScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId()); + break; + case COMMUNITY: + list = communityScoreDao.selectComunityScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId()); + break; + case STREET: + list = agencyScoreDao.selectAgencyScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId()); + + break; + case DISTRICT: + list = agencyScoreDao.selectAgencyScoreList(formDTO.getCustomerId(), formDTO.getOrgId(), formDTO.getMonthId()); + break; + default: + log.error("暂不支持更高级别的查询,level:{}", orgLevel); + } + + setNewMeaningWithScore(list, first, second); + + + } + + private void setNewMeaningWithScore(List list, IndexExplainResult first, IndexExplainResult second) { + String firstMeaning = first.getMeaning(); + String secondMeaning = second.getMeaning(); + for (IndexScoreResult score : list) { + String indexCode = score.getIndexCode(); + if (score.getIsTotal()) { + firstMeaning = firstMeaning.replaceFirst(IndexConstant.PATTERN_TOTAL, score.getScore().toString()); + continue; + } + + firstMeaning = firstMeaning.replaceFirst(indexCode, score.getScore().toString()).replace(indexCode.concat(IndexConstant.PATTERN_WEIGHT), score.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString() + "%"); + if (second.getIndexCode().contains(score.getIndexCode())) { + secondMeaning = secondMeaning.replaceFirst(IndexConstant.PATTERN_TOTAL, score.getScore().toString()) + .replaceFirst(IndexConstant.BEN_JI_EN, score.getSelfScore().toString()) + .replaceFirst(IndexConstant.XIA_JI_EN, score.getSubScore().toString()); + } + } + if (CollectionUtils.isEmpty(list)) { + firstMeaning = firstMeaning.replaceAll(IndexConstant.PATTERN_ALL, StrConstant.EPMETY_STR); + secondMeaning = secondMeaning.replaceAll(IndexConstant.PATTERN_ALL, StrConstant.EPMETY_STR); + } + + first.setMeaning(firstMeaning.replaceAll(IndexConstant.PATTERN_FIX, StrConstant.EPMETY_STR)); + second.setMeaning(secondMeaning.replaceAll(IndexConstant.PATTERN_FIX, StrConstant.EPMETY_STR)); + } + + public static void main(String[] args) { + String patern = "(?<=\\{).*?(?=(\\}|$))"; + patern = "[#][^#]+[#]"; + String str = "1234#qwert#134"; + + System.out.println(str.replaceAll(patern, "")); + String str2 = "自然月周期内,当月指数得分P(totalScore)P=党建指数得分#(65.7)#*相关权重#(40%)#+治理指数得分#(68.2)#*相关权重#(40%)#+服务指数得分#(77.5)#*相关权重#(20%)#"; + String totalP = "P".concat(IndexConstant.PATTERN_TOTAL).concat("P"); + System.out.println(str2.replaceFirst(totalP, "")); + } + private void setTableData(IndexExplainFormDTO formDTO, Map> detailEntityMap, IndexExplainTreeDTO explainDTO, IndexExplainResult result) { if (NumConstant.ONE == explainDTO.getIsSearch()) { List realScoreList = null; @@ -174,6 +261,9 @@ public class IndexExplainServiceImpl implements IndexExplainService { List indexGroupDetailEntities = new ArrayList<>(); for (IndexGroupDetailResult index : detailResults) { if (IndexConstant.INDEX_DISTRINCT_TABLE1_INDEX_CODE.equals(index.getIndexCode())) { + String newMeaning = result.getMeaning().replaceFirst(IndexConstant.PATTERN_D, + index.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.ZERO, BigDecimal.ROUND_HALF_UP).toString()); + result.setMeaning(newMeaning); indexGroupDetailEntities.add(index); setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, indexGroupDetailEntities); //不下钻 @@ -251,14 +341,14 @@ public class IndexExplainServiceImpl implements IndexExplainService { } } - private List setDefaultTableData(String orgLevel, String type, Map> detailEntityMap, - IndexExplainResult result, String allIndexCodePath, List indexGroupDetailEntities) { + private void setDefaultTableData(String orgLevel, String type, Map> detailEntityMap, + IndexExplainResult result, String allIndexCodePath, List indexGroupDetailEntities) { if (indexGroupDetailEntities == null) { indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); } if (CollectionUtils.isEmpty(indexGroupDetailEntities)) { log.warn("setDefaultTableData allINdexCodePath:{} is config error", allIndexCodePath); - return null; + return; } List tableList = new ArrayList<>(); List threlodList = new ArrayList<>(); @@ -287,7 +377,6 @@ public class IndexExplainServiceImpl implements IndexExplainService { result.setTableDataList(tableList); result.setThresholdList(threlodList); result.setTableDesc(IndexConstant.TABLE_DESC); - return tableList; } private void setChildren(IndexExplainFormDTO formDTO, Map> detailEntityMap, IndexExplainResult result, IndexExplainTreeDTO parentNode, List children) { @@ -305,10 +394,6 @@ public class IndexExplainServiceImpl implements IndexExplainService { result.setChildren(childrenList); } - public static void main(String[] args) { - - } - private List getTableHeaders(String type, String allIndexCode, String orgLevel) { List headers = new ArrayList<>(); OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java index 4f11f160ab..aa142bed95 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java @@ -1,11 +1,14 @@ package com.epmet.datareport.service.evaluationindex.screen; import com.epmet.dto.AgencyInfoDTO; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; +import com.epmet.dto.form.AgencyDetailMulticFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; -import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; +import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; @@ -73,4 +76,32 @@ public interface AgencyService { List getNextAgencyIds(String areaCode,String agencyId); AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId); + + /** + * 查询当前组织的下一级组织,可根据areaCode查询,也可根据pid查询 + * + * @param areaCode + * @param pid + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + List queryNextAgencyList(String areaCode, String pid,List allSubCustomerIds); + + /** + * 查询当前组织的下面的网格,可根据areaCode查询,也可根据parentAgencyId查询 + * + * @param areaCode + * @param parentAgencyId + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + List queryGridList(String areaCode, String parentAgencyId,List allSubCustomerIds); + + /** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @param formDTO + * @return com.epmet.dto.result.AgencyDetailMulticResultDTO + */ + AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 535362f3ea..c6dc8deba2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -2,20 +2,28 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.AgencyTreeUtils; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.datareport.redis.DataReportRedis; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.dto.AgencyInfoDTO; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; +import com.epmet.dto.form.AgencyDetailMulticFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; +import com.epmet.dto.result.AgencyDetailMulticResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; -import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; +import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO; +import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO; import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; @@ -25,6 +33,8 @@ import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.exceptions.TooManyResultsException; @@ -33,6 +43,8 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -52,6 +64,12 @@ public class AgencyServiceImpl implements AgencyService { private ScreenCustomerGridDao screenCustomerGridDao; @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private DataReportRedis dataReportRedis; /** * @Description 1、组织机构树 @@ -316,10 +334,177 @@ public class AgencyServiceImpl implements AgencyService { @Override public AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId) { AgencyInfoDTO agencyInfoDTO=new AgencyInfoDTO(); - agencyInfoDTO.setAgencyId(agencyId); - agencyInfoDTO.setAreaCode(areaCode); - agencyInfoDTO.setSubAgencyIds(screenCustomerAgencyDao.selectSubAgencyIds(areaCode,agencyId)); - agencyInfoDTO.setSubGridIds(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId)); + agencyInfoDTO.setCurrentAgencyId(agencyId); + agencyInfoDTO.setCurrentAreaCode(areaCode); + agencyInfoDTO.setSubAgencies(screenCustomerAgencyDao.selectSubAgencyIds(areaCode,agencyId)); + agencyInfoDTO.setSubGrids(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId)); return agencyInfoDTO; } + + /** + * 查询当前组织的下一级组织,可根据areaCode查询,也可根据pid查询 + * + * @param areaCode + * @param pid + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + @Override + public List queryNextAgencyList(String areaCode, String pid,List allSubCustomerIds) { + return screenCustomerAgencyDao.selectNextAgencyList(areaCode,pid,allSubCustomerIds); + } + + /** + * 查询当前组织的下面的网格,可根据areaCode查询,也可根据parentAgencyId查询 + * + * @param areaCode + * @param parentAgencyId + * @param allSubCustomerIds 当前客户的所有子客户 + * @return java.util.List + */ + @Override + public List queryGridList(String areaCode, String parentAgencyId,List allSubCustomerIds) { + return screenCustomerAgencyDao.selectGridDTOList(areaCode,parentAgencyId,allSubCustomerIds); + } + + /** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @param formDTO + * @return com.epmet.dto.result.AgencyDetailMulticResultDTO + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO) { + AgencyDetailMulticResultDTO agencysResultDTO =dataReportRedis.queryAgencyDetailMulticResultDTO(formDTO.getCustomerId(),formDTO.getAgencyId()); + if (null != agencysResultDTO) { + log.info("queryAgencyDetailMultiC从redis取值入参:"+ JSON.toJSONString(formDTO)); + return agencysResultDTO; + } + agencysResultDTO = new AgencyDetailMulticResultDTO(); + List parentList = new ArrayList<>(); + agencysResultDTO.setParentList(parentList); + + //1:查询本机关详细信息 + ScreenCustomerAgencyDTO customerAgencyDTO = screenCustomerAgencyDao.selectByAgencyId(formDTO.getAgencyId()); + if (null == customerAgencyDTO) { + return agencysResultDTO; + } + agencysResultDTO = ConvertUtils.sourceToTarget(customerAgencyDTO, AgencyDetailMulticResultDTO.class); + //当前组织的客户id。 + agencysResultDTO.setCustomerId(customerAgencyDTO.getCustomerId()); + + //2、当前登录用户所属客户,的跟级组织 + ScreenCustomerAgencyDTO rootAgency=screenCustomerAgencyDao.selectCustomerRootAgency(formDTO.getCustomerId()); + agencysResultDTO.setRootlevel(rootAgency.getLevel()); + agencysResultDTO.setRootAgencyId(rootAgency.getAgencyId()); + + //3、当前登录用户所属客户,是否开启了area_code开关 + // 这个接口返回areaCodeSwitch应该没有啥用...先注释吧 + /*Result govOrgRes=govOrgOpenFeignClient.getAreaCodeSwitch(formDTO.getCustomerId()); + log.info("当前登录用户所属客户,是否开启了area_code开关,返参:"+ JSON.toJSONString(govOrgRes)); + if(govOrgRes.success()&&StringUtils.isNotBlank(govOrgRes.getData())){ + agencysResultDTO.setAreaCodeSwitch(govOrgRes.getData()); + }else{ + agencysResultDTO.setAreaCodeSwitch("closed"); + }*/ + agencysResultDTO.setAreaCodeSwitch("closed"); + + + //4、如果当前客户不存在子客户则areaCode置为空 + Result> crmRes=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); + if (crmRes.success() &&CollectionUtils.isEmpty(crmRes.getData())) { + //不存在子客户,则areaCode相关返参都默认为空字符串 + agencysResultDTO.setAreaCode(StrConstant.EPMETY_STR); + agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); + agencysResultDTO.setParentAreaCode(StrConstant.EPMETY_STR); + agencysResultDTO.setHaveSubCustomer(false); + agencysResultDTO.setSubCustomerIds(new ArrayList<>()); + }else{ + agencysResultDTO.setAreaName(agencysResultDTO.getAgencyName()); + agencysResultDTO.setHaveSubCustomer(true); + agencysResultDTO.setSubCustomerIds(crmRes.getData()); + } + + log.info("当前组织的客户id="+agencysResultDTO.getCustomerId()+";当前登录用户所属的客户id="+formDTO.getCustomerId()); + if(agencysResultDTO.getHaveSubCustomer()){ + if (formDTO.getCustomerId().equals(agencysResultDTO.getCustomerId()) + && (StringUtils.isBlank(customerAgencyDTO.getPids()) + ||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid()))) { + log.info(String.format("1)当前组织agencyId=%s,为根基组织,不需要查询parentList",formDTO.getAgencyId())); + agencysResultDTO.setParentList(parentList); + }else{ + // 5、多客户时根据area_code查询上级,自下向上,查询到当前客户的跟组织即可stop + log.info("多客户版本parentList、level要重新赋值;agencysResultDTO.getParentAreaCode()="+agencysResultDTO.getParentAreaCode()); + ScreenCustomerAgencyDTO parentAgency=screenCustomerAgencyDao.selectByAreaCode(agencysResultDTO.getParentAreaCode()); + if (null != parentAgency) { + agencysResultDTO.setLevel(getAgencyLevelMultiC(parentAgency)); + List temp = getParentListMultic(parentList, parentAgency, formDTO.getCustomerId(), agencysResultDTO.getRootAgencyId()); + agencysResultDTO.setParentList(temp); + } + } + }else{ + //单客户 + //6:查询当前组织的所有上级组织,按自上而下层级顺序 + if (formDTO.getCustomerId().equals(agencysResultDTO.getCustomerId()) + && (StringUtils.isBlank(customerAgencyDTO.getPids()) + ||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid()))) { + log.info(String.format("2)当前组织agencyId=%s,为根基组织,不需要查询parentList",formDTO.getAgencyId())); + agencysResultDTO.setParentList(parentList); + }else{ + List pidList =new ArrayList<>(); + if(customerAgencyDTO.getPids().contains(StrConstant.COLON)){ + pidList= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COLON)); + }else if(customerAgencyDTO.getPids().contains(StrConstant.COMMA)){ + pidList= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COMMA)); + } + if(!CollectionUtils.isEmpty(pidList)){ + //单客户,存在上级时查询... + agencysResultDTO.setParentList(screenCustomerAgencyDao.selectPAgencyById(pidList)); + } + } + } + dataReportRedis.setAgencyDetailMulticResultDTO(formDTO.getCustomerId(),formDTO.getAgencyId(),agencysResultDTO); + return agencysResultDTO; + } + + private List getParentListMultic(List resList, ScreenCustomerAgencyDTO firstParent, String currentUserCustomerId, String rootAgencyId) { + ParentListResultDTO resultDTO = new ParentListResultDTO(); + resultDTO.setId(firstParent.getAgencyId()); + resultDTO.setName(firstParent.getAgencyName()); + resultDTO.setLevel(firstParent.getLevel()); + resultDTO.setAreaCode(firstParent.getAreaCode()); + resList.add(resultDTO); + if (firstParent.getCustomerId().equals(currentUserCustomerId) && firstParent.getAgencyId().equals(rootAgencyId)) { + Collections.reverse(resList); + return resList; + } else { + String parentAgencyAreaCode = firstParent.getParentAreaCode(); + if (StringUtils.isNotBlank(parentAgencyAreaCode)) { + parentAgencyAreaCode = parentAgencyAreaCode.replaceAll("(0)+$", ""); + } + ScreenCustomerAgencyDTO parentAgency = screenCustomerAgencyDao.selectByAreaCode(parentAgencyAreaCode); + if (null != parentAgency) { + return getParentListMultic(resList, parentAgency, currentUserCustomerId, rootAgencyId); + } else { + return resList; + } + } + } + + private String getAgencyLevelMultiC(ScreenCustomerAgencyDTO parentAgency) { + String level=StrConstant.EPMETY_STR; + if(null!=parentAgency){ + if(Constant.PROVINCE.equals(parentAgency.getLevel())){ + return Constant.CITY; + }else if(Constant.CITY.equals(parentAgency.getLevel())){ + return Constant.DISTRICT; + }else if(Constant.DISTRICT.equals(parentAgency.getLevel())){ + return Constant.STREET; + }else if(Constant.STREET.equals(parentAgency.getLevel())){ + return Constant.COMMUNITY; + } + } + return level; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index b74a777bd5..45eeb51736 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -110,6 +111,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { } PageHelper.startPage(NumConstant.ONE,param.getTopNum()); if (StringUtils.isNotEmpty(param.getAreaCode())){ + // 目前只有平阴大屏才会传areaCode,下面的sql限制住状态为:处理中 result = screenDifficultyDataDao.selectDifficultyByAreaCode(param.getAreaCode(),param.getType()); }else { result = screenDifficultyDataDao.selectDifficulty(param.getAgencyId(),param.getType()); @@ -132,30 +134,58 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { * @author wangc * @date 2020.08.20 14:37 **/ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) { - ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); - Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); - List subCustomers; - if(null == crmResp || !crmResp.success()|| org.apache.commons.collections4.CollectionUtils.isEmpty(crmResp.getData())) {subCustomers = null ;} - else {subCustomers = crmResp.getData();} + String monthId = dateUtils.getPreviousMonthId(NumConstant.ONE); + UserJoinIndicatorGrowthRateResultDTO latest = new UserJoinIndicatorGrowthRateResultDTO(); + if (StringUtils.isNotBlank(param.getAreaCode()) && "370124".equals(param.getAreaCode())) { + latest= screenUserJoinDao.selectUserJoinDataByAreaCode(param.getAreaCode(), monthId); + if (null == latest) { + log.warn(String.format("平阴县查询screen_user_join表为空,monthId:%s", monthId)); + return new PublicPartiProfileResultDTO(); + } + UserJoinIndicatorGrowthRateResultDTO beforeTwoMonth = screenUserJoinDao.selectUserJoinDataByAreaCode(param.getAreaCode(), dateUtils.getPreviousMonthId(NumConstant.TWO)); + if (null == beforeTwoMonth) { + log.warn(String.format("平阴县查询screen_user_join表为空,monthId:%s",dateUtils.getPreviousMonthId(NumConstant.TWO))); + return new PublicPartiProfileResultDTO(); + }else{ + //举例,today is 20210707 , latest是06月份的数据,beforeTwoMonth是05月份的数据 - String monthId = dateUtils.getCurrentMonthId(); - UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())? - screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : - screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); - //保证获取公众参与概率数据的最大可能性 - int time = NumConstant.TWELVE; - while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) { - time--; - monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); - latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ? - screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : - screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); - } + // 总参与数6月份比5月份增加了? + int incrTotal = latest.getTotal() - beforeTwoMonth.getTotal(); + // 总参与数月增长:增加的占5月份的占比??? + BigDecimal monthIncr = NumConstant.ZERO == beforeTwoMonth.getTotal() ? BigDecimal.ZERO : BigDecimal.valueOf(incrTotal / beforeTwoMonth.getTotal()); + latest.setMonthIncr(monthIncr); + latest.setMonthTrend(monthIncr.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); + + //人均议题数6月份比五月份增加了? + BigDecimal issueIncrTotal = latest.getAverageIssue().subtract(beforeTwoMonth.getAverageIssue()); + //人均议题数月增长:增加的占5月份的占比??? + BigDecimal issueCompareLatestMonth = BigDecimal.ZERO.compareTo(beforeTwoMonth.getAverageIssue()) == 0 ? BigDecimal.ZERO : issueIncrTotal.divide(beforeTwoMonth.getAverageIssue(), 2, RoundingMode.HALF_UP); + latest.setIssueCompareLatestMonth(issueCompareLatestMonth); + latest.setIssueCompareLatestTrend(issueCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); - if (null == latest) return new PublicPartiProfileResultDTO(); + // 平均参与度6月份比5月份增加了? + BigDecimal incrJoinCompareLatestMonth=latest.getJoinCompareLatestMonth().subtract(beforeTwoMonth.getJoinCompareLatestMonth()); + //平均参与度月增长:增加的占5月份的占比??? + BigDecimal joinCompareLatestMonth = BigDecimal.ZERO.compareTo(beforeTwoMonth.getJoinCompareLatestMonth()) == 0 ? BigDecimal.ZERO : incrJoinCompareLatestMonth.divide(beforeTwoMonth.getJoinCompareLatestMonth(), 2, RoundingMode.HALF_UP); + latest.setJoinCompareLatestMonth(joinCompareLatestMonth); + latest.setJoinCompareLatestTrend(joinCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr"); + } + } else { + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + //保证获取公众参与概率数据的最大可能性 + int time = NumConstant.TWELVE; + while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) { + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); + latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + } + } + if (null == latest) { + return new PublicPartiProfileResultDTO(); + } PublicPartiProfileResultDTO result = ConvertUtils.sourceToTarget(latest, PublicPartiProfileResultDTO.class); result.setMonthIncr(convertPercentStr(latest.getMonthIncr(), NumConstant.ZERO)); result.setJoinCompareLatestMonth(convertPercentStr(latest.getJoinCompareLatestMonth().abs(), NumConstant.ZERO)); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index 993c590f05..d945b93460 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java @@ -112,6 +112,9 @@ public class IndexServiceImpl implements IndexService { List serviceAblityWeightData = new ArrayList<>(); List partyDevWeightData = new ArrayList<>(); List governAblityWeightData = new ArrayList<>(); + List serviceOriginData = new ArrayList<>(); + List partyOriginData = new ArrayList<>(); + List governOriginData = new ArrayList<>(); // 1. x轴 if(StringUtils.isNotBlank(monthBarchartFormDTO.getMonthId())){ result.setXAxis(partyMemberLeadServiceImpl.getXproEndMonth(monthBarchartFormDTO.getMonthId())); @@ -132,6 +135,9 @@ public class IndexServiceImpl implements IndexService { serviceAblityWeightData.add(BigDecimal.ZERO); partyDevWeightData.add(BigDecimal.ZERO); governAblityWeightData.add(BigDecimal.ZERO); + serviceOriginData.add(BigDecimal.ZERO); + partyOriginData.add(BigDecimal.ZERO); + governOriginData.add(BigDecimal.ZERO); } result.setServiceAbilityData(serviceAbilityData); result.setPartyDevAbilityData(partyDevAbilityData); @@ -141,6 +147,9 @@ public class IndexServiceImpl implements IndexService { result.setServiceAblityWeightData(serviceAblityWeightData); result.setPartyDevWeightData(partyDevWeightData); result.setGovernAblityWeightData(governAblityWeightData); + result.setServiceOriginScore(serviceOriginData); + result.setPartyOriginScore(partyOriginData); + result.setGovernOriginScore(governOriginData); return result; } // 处理小数四舍五入 @@ -186,6 +195,10 @@ public class IndexServiceImpl implements IndexService { serviceAblityWeightData.add(BigDecimal.ZERO); partyDevWeightData.add(BigDecimal.ZERO); governAblityWeightData.add(BigDecimal.ZERO); + //原始分数默认0 + serviceOriginData.add(BigDecimal.ZERO); + partyOriginData.add(BigDecimal.ZERO); + governOriginData.add(BigDecimal.ZERO); //保持cursor不变 }else{ MonthBarchartResult data = collect.get(cursor); @@ -198,6 +211,11 @@ public class IndexServiceImpl implements IndexService { serviceAblityWeightData.add(null==data.getServiceAblityWeight()?BigDecimal.ZERO:data.getServiceAblityWeight()); partyDevWeightData.add(null==data.getPartyDevWeight()?BigDecimal.ZERO:data.getPartyDevWeight()); governAblityWeightData.add(null==data.getGovernAblityWeight()?BigDecimal.ZERO:data.getGovernAblityWeight()); + + //添加权重 + serviceOriginData.add(null==data.getServiceOriginScore()?BigDecimal.ZERO:data.getServiceOriginScore()); + partyOriginData.add(null==data.getPartyOriginScore()?BigDecimal.ZERO:data.getPartyOriginScore()); + governOriginData.add(null==data.getGovernOriginScore()?BigDecimal.ZERO:data.getGovernOriginScore()); //统计日期一致后移动游标 cursor++; } @@ -218,6 +236,11 @@ public class IndexServiceImpl implements IndexService { result.setServiceAblityWeightData(serviceAblityWeightData); result.setPartyDevWeightData(partyDevWeightData); result.setGovernAblityWeightData(governAblityWeightData); + //添加返回原始值 + //添加返回权重 + result.setServiceOriginScore(serviceOriginData); + result.setPartyOriginScore(partyOriginData); + result.setGovernOriginScore(governOriginData); return result; } @@ -260,13 +283,23 @@ public class IndexServiceImpl implements IndexService { List subAgencyIndexRankResultDTOS = new ArrayList<>(); if (ScreenConstant.YEAR_ID.equals(formDTO.getType())) { // 年 指数排行 - subAgencyIndexRankResultDTOS = screenIndexDataYearlyDao.selectAnNingSubAgencyIndexYearlyRank(formDTO); + if("1234085031077498881".equals(formDTO.getAgencyId())){ + // 孔村单独处理,查询下下级 + subAgencyIndexRankResultDTOS = screenIndexDataYearlyDao.selectKczSubAgencyIndexYearlyRank(formDTO); + }else{ + subAgencyIndexRankResultDTOS = screenIndexDataYearlyDao.selectAnNingSubAgencyIndexYearlyRank(formDTO); + } } else if (ScreenConstant.MONTH_ID.equals(formDTO.getType())) { // 月(上一个月) 指数排行 if (StringUtils.isBlank(formDTO.getMonthId())) { formDTO.setMonthId(DateUtils.getBeforeNMonth(1)); } - subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyOrGridIndexMonthlyRank(formDTO); + if("1234085031077498881".equals(formDTO.getAgencyId())){ + // 孔村单独处理,查询下下级 + subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectKczSubAgencyOrGridIndexMonthlyRank(formDTO); + }else{ + subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyOrGridIndexMonthlyRank(formDTO); + } subAgencyIndexRankResultDTOS.forEach(rank -> { rank.setPartyDevAbility(getRound(rank.getPartyDevAbility())); rank.setGovernAbility(getRound(rank.getGovernAbility())); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java index 150bde5417..06979f8b65 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java @@ -3,16 +3,13 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.*; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService; import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.ModuleConstant; -import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; import com.epmet.evaluationindex.screen.dto.form.ContactMassLineChartFormDTO; @@ -62,41 +59,39 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { private AgencyService screenCustomerAgencyService; /** - * @Description 1、先锋模范 * @param fineExampleFormDTO + * @Description 1、先锋模范 * @author zxc * @date 2020/8/20 1:56 下午 */ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) { - ScreenCustomerAgencyDTO agencyInfo = customerAgencyDao.selectByAgencyId(fineExampleFormDTO.getAgencyId()); - if(null == agencyInfo) throw new RenException("未找到对应的机关"); - String customerId = agencyInfo.getCustomerId(); - String areaCode = agencyInfo.getAreaCode(); - - Result> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); - List subCustomers; - if(null == crmResponse || !crmResponse.success()) - {subCustomers = null;} - else - {subCustomers = crmResponse.getData();} - FineExampleResultDTO fineExampleResultDTO; - if(CollectionUtils.isEmpty(subCustomers)) - fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); - else - fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(areaCode,customerId,subCustomers); - - if (null == fineExampleResultDTO) { - return new FineExampleResultDTO(); + FineExampleResultDTO fineExampleResultDTO; + if (StringUtils.isNotBlank(fineExampleFormDTO.getAreaCode())) { + //如果是平阴县的areaCode + if ("370124".equals(fineExampleFormDTO.getAreaCode())) { + String yesterDay = com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(1); + // 只有平阴的需要汇聚 8个街道的数 + fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(fineExampleFormDTO.getAreaCode(), yesterDay); + } else { + // 不是平阴的话,依然按照agencyId查询 + fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); } - fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); - fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); - fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); - fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); - fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); - fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); - return fineExampleResultDTO; + } else { + //单客户直接按照agencyId查询 + fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); + } + if (null == fineExampleResultDTO) { + return new FineExampleResultDTO(); + } + fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); + fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); + fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); + fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); + fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); + fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); + return fineExampleResultDTO; } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java index 7a5eeee0d1..80d2161ebb 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -486,7 +486,7 @@ public class FactIndexServiceImpl implements FactIndexService { public RootAgencyResultDTO rootAgency(RootAgencyFormDTO formDTO) { RootAgencyResultDTO resultDTO = new RootAgencyResultDTO(); //1.根据agencyId查询是否为根级组织 - int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId()); + int num = screenCustomerAgencyDao.selectRootAgency(formDTO.getAgencyId(), formDTO.getCustomerId()); if (num < NumConstant.ONE) { resultDTO.setIsRoot(false); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java index 0991305f4f..3c3cc0419b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java @@ -18,7 +18,6 @@ package com.epmet.datareport.service.plugins; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO; import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO; @@ -39,16 +38,6 @@ import java.util.Map; */ public interface ScreenWorkRecordOrgDailyService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2021-02-23 - */ - PageData page(Map params); - /** * 默认查询 * @@ -69,36 +58,6 @@ public interface ScreenWorkRecordOrgDailyService extends BaseService page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ScreenWorkRecordOrgDailyDTO.class); - } @Override public List list(Map params) { @@ -108,65 +95,69 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl customerIds=new ArrayList<>(); - Result> result=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); - // log.info("根据customerId查询其所有下级子客户id result: "+JSON.toJSONString(result)); - if (result.success() && CollectionUtils.isNotEmpty(result.getData())) { - customerIds.addAll(result.getData()); - } - customerIds.add(formDTO.getCustomerId()); - String dateId= baseDao.selectLatestDateId(customerIds); - if(StringUtils.isBlank(dateId)){ - dateId= com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); - log.warn("dateId 赋值为"+dateId+" ; selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds)); - } + //默认截止到前一天 + String dateId= com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); WorkRecordRankResultDTO returnDto = new WorkRecordRankResultDTO(); AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); - // log.info("agencyInfoDTO: "+JSON.toJSONString(agencyInfoDTO)); - //当前组织的自身的数据 - List currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(), - formDTO.getDataType(), - formDTO.getCustomerId(), - dateId); - //下级所有组织 - List subAgencyRankList = CollectionUtils.isNotEmpty(agencyInfoDTO.getSubAgencyIds()) ? baseDao.selectSubList( - agencyInfoDTO.getSubAgencyIds(), - formDTO.getDataType(), - formDTO.getCustomerId(), - dateId) : new ArrayList<>(); - //直属网格 - List subGridList = CollectionUtils.isNotEmpty(agencyInfoDTO.getSubGridIds()) ? baseDao.selectSubGridList( - agencyInfoDTO.getSubGridIds(), - formDTO.getDataType(), - formDTO.getCustomerId(), - dateId) : new ArrayList<>(); + log.info("agencyInfoDTO: "+JSON.toJSONString(agencyInfoDTO)); + + //随手记类型编码;对应screen_customer_work_record_dict的资源编码 + List typeCodeList=baseDao.selectCustomerTypeCode(formDTO.getDataType(),formDTO.getCustomerId()); + if(CollectionUtils.isEmpty(typeCodeList)){ + log.warn(String.format("当前customerId=%s,screen_customer_work_record_dict 为空")); + } + + //1)、当前组织的自身的数据 + WorkRecordSubRank currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(),dateId,typeCodeList); + //2)、下级所有组织 + List subAgencyRankList = new ArrayList<>(); + for(ScreenCustomerAgencyCommonDTO agencyCommonDTO:agencyInfoDTO.getSubAgencies()){ + WorkRecordSubRank agencyRes= baseDao.selectUpToCalAgency(agencyCommonDTO.getAgencyId(),dateId,typeCodeList); + if(null !=agencyRes){ + agencyRes.setOrgId(agencyCommonDTO.getAgencyId()); + agencyRes.setName(agencyCommonDTO.getAgencyName()); + agencyRes.setIsDefault("no"); + subAgencyRankList.add(agencyRes); + }else{ + WorkRecordSubRank agencyDefault=new WorkRecordSubRank(); + agencyDefault.setOrgId(agencyCommonDTO.getAgencyId()); + agencyDefault.setName(agencyCommonDTO.getAgencyName()); + agencyDefault.setParticipateTotal(0); + agencyDefault.setParticipateUserTotal(0); + agencyDefault.setIsDefault("yes"); + subAgencyRankList.add(agencyDefault); + } + + } + //3)、直属网格 + List subGridList=new ArrayList<>(); + for(ScreenCustomerGridCommonDTO gridCommonDTO:agencyInfoDTO.getSubGrids()){ + WorkRecordSubRank gridRes=baseDao.selectUpToCalGrid(gridCommonDTO.getGridId(),dateId,typeCodeList); + if (null != gridRes) { + gridRes.setIsDefault("no"); + subGridList.add(gridRes); + } else { + WorkRecordSubRank gridResDefault = new WorkRecordSubRank(); + gridResDefault.setOrgId(gridCommonDTO.getGridId()); + gridResDefault.setName(gridCommonDTO.getGridName()); + gridResDefault.setParticipateTotal(0); + gridResDefault.setParticipateUserTotal(0); + gridResDefault.setIsDefault("yes"); + subAgencyRankList.add(gridResDefault); + } + } + + if(CollectionUtils.isNotEmpty(subAgencyRankList)){ + returnDto.getSubRankList().addAll(subAgencyRankList); + } + if(CollectionUtils.isNotEmpty(subGridList)){ + returnDto.getSubRankList().addAll(subGridList); + } - returnDto.getSubRankList().addAll(subAgencyRankList); - returnDto.getSubRankList().addAll(subGridList); // log.info("returnDto.getSubRankList()="+returnDto.getSubRankList()); int participateUserTotal = 0; int participateTotal = 0; @@ -174,16 +165,24 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl= formDTO.getTopRow() ? - returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList()); + //按照组织次数降序排列 + if(CollectionUtils.isNotEmpty(returnDto.getSubRankList())){ + Collections.sort(returnDto.getSubRankList(), new Comparator() { + @Override + public int compare(WorkRecordSubRank o1, WorkRecordSubRank o2) { + return o2.getParticipateTotal().compareTo(o1.getParticipateTotal()); + } + }); + if(returnDto.getSubRankList().size() >= formDTO.getTopRow()){ + returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()); + } + } return returnDto; } @@ -262,9 +261,9 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl orgIds = new ArrayList<>(); - orgIds.addAll(agencyInfoDTO.getSubAgencyIds()); - orgIds.add(agencyInfoDTO.getAgencyId()); - orgIds.addAll(agencyInfoDTO.getSubGridIds()); + orgIds.addAll(agencyInfoDTO.getSubAgencies().stream().map(agency->agency.getAgencyId()).collect(Collectors.toSet())); + orgIds.add(agencyInfoDTO.getCurrentAgencyId()); + orgIds.addAll(agencyInfoDTO.getSubGrids().stream().map(grid->grid.getGridId()).collect(Collectors.toSet())); List list = screenWorkRecordOrgMonthlyDao.selectVoluntaryServiceTrendDTO(formDTO.getCustomerId(), orgIds, monthIdList.get(NumConstant.ZERO), diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java index 917113fe12..e2d1a06654 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java @@ -1,6 +1,8 @@ package com.epmet.datareport.service.project; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.project.MassesDiscontentFormV2DTO; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; @@ -62,6 +64,14 @@ public interface ProjectService { **/ List getDifficultyRank(DifficultyRankFormDTO param); + /** + * 难点赌点-耗时最长|涉及部门最多|处理次数 + * + * @param formDTO + * @return com.epmet.project.dto.result.ProjectDifficultRankResultDTO + */ + List difficultyRankMultic(DifficultyRankFormDTO formDTO); + /** * @Description 难点赌点-获取组织下拉框 * @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321614 @@ -80,4 +90,23 @@ public interface ProjectService { * @Date 14:26 2021-03-22 **/ List getCategoryDict(String customerId); + + /** + * 001、难点堵点-组织下拉框 + * 需求描述:下拉框显示当前用户所属组织和下级组织 ;1)如果当前用户是街道工作人员, 显示所属街道和该街道下的社区+直属网格;2)如果当前用户是社区人员, 显示所属社区和该社区下的网格+直属网格。 + * 210622: 新增此API, 后端改为从指标库取值 , 保证平阴县的工作人员,看到的下拉框是平阴县、以及8个街道 + * + * @param staffId 当前登录用户id + * @param currentCustomerId 当前客户id + * @return com.epmet.project.dto.result.ProjectNextAgencyResultDTO + */ + List myNextAgencyMultic(String staffId,String currentCustomerId); + + /** + * 群众不满列表,改为从指标库的screen_project_data取值,sql里面写死<75分的展示 + * + * @param formDTO + * @return com.epmet.dto.result.project.MassesDiscontentResultV2DTO + */ + List queryMassesDiscontentMultic(MassesDiscontentFormV2DTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java index 4d2df70470..33fd65dd1b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java @@ -4,20 +4,25 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.datareport.dao.project.ProjectDao; -import com.epmet.datareport.service.evaluationindex.screen.ScreenDifficultyDataService; +import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.project.ProjectService; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.dto.form.SubAgencyFormDTO; +import com.epmet.dto.form.project.MassesDiscontentFormV2DTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.project.MassesDiscontentResultV2DTO; import com.epmet.evaluationindex.screen.dto.result.DepartmentNameListResultDTO; import com.epmet.feign.*; import com.epmet.project.constant.ProjectConstant; @@ -25,12 +30,13 @@ import com.epmet.project.dto.CustomerCategoryDTO; import com.epmet.project.dto.FactAgencyProjectDailyDTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; -import com.epmet.project.dto.result.*; import com.epmet.project.dto.result.ProjectDetailResultDTO; +import com.epmet.project.dto.result.*; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -59,9 +65,6 @@ public class ProjectServiceImpl implements ProjectService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private GovProjectOpenFeignClient govProjectOpenFeignClient; - @Autowired - private ScreenDifficultyDataService screenDifficultyDataService; - @Autowired private GovOrgOpenFeignClient govOrgOpenFeignClient; @Autowired @@ -70,6 +73,10 @@ public class ProjectServiceImpl implements ProjectService { private GovIssueOpenFeignClient govIssueOpenFeignClient; @Autowired private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private AgencyService screenAgencyService; + @Autowired + private ScreenProjectDataDao screenProjectDataDao; /** * @Author sun @@ -357,6 +364,48 @@ public class ProjectServiceImpl implements ProjectService { return result; } + /** + * 难点赌点-耗时最长|涉及部门最多|处理次数 + * + * @param formDTO + * @return com.epmet.project.dto.result.ProjectDifficultRankResultDTO + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + @Override + public List difficultyRankMultic(DifficultyRankFormDTO formDTO) { + //1、查询当前客户是否包含子客户 + //多客户测试写死值,别忘了注释掉呀 + // formDTO.setCustomerId("613cc61a6b8ce4c70d21bd413dac72cc"); + // formDTO.setAgencyId("30705f91f1295ae77d372b868596a5e7"); + + //06.24决定areaCode让前端传入, 前端从前端从/data/report/screen/agency/agencydetail这取值取值 + /*Result> crmRes = operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + log.warn("❤当前客户存在子客户❤"); + //2、查询组织信息 + Result agencyResult = govOrgOpenFeignClient.getAgencyById(formDTO.getAgencyId()); + if (!agencyResult.success() || null == agencyResult.getData()) { + throw new RenException(String.format("查询组织信息异常,agencyId:%s", formDTO.getAgencyId())); + } + formDTO.setAreaCode(agencyResult.getData().getAreaCode()); + }*/ + // 只有平阴根据areaCode查询,其余的还是按照agencyId查询 + if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !"370124".equals(formDTO.getAreaCode())) { + formDTO.setAreaCode(StrConstant.EPMETY_STR); + } + // 3、升级原来的列表查询接口 + PageHelper.startPage(null == formDTO.getPageNo() ? NumConstant.ONE : formDTO.getPageNo(), formDTO.getTopNum()); + List result = projectDao.difficultyRankV2(formDTO); + for (int i = 0; i < result.size(); i++) { + List imgUrlList = projectDao.getDifficultyImgList(result.get(i).getProjectId()); + result.get(i).setImgUrlList(imgUrlList); + } + if (CollectionUtils.isEmpty(result)) { + return new ArrayList<>(); + } + return result; + } + @Override public List getCategoryDict(String customerId) { List result = new ArrayList<>(); @@ -394,4 +443,132 @@ public class ProjectServiceImpl implements ProjectService { } return result; } + + /** + * 001、难点堵点-组织下拉框 + * 需求描述:下拉框显示当前用户所属组织和下级组织 ;1)如果当前用户是街道工作人员, 显示所属街道和该街道下的社区+直属网格;2)如果当前用户是社区人员, 显示所属社区和该社区下的网格+直属网格。 + * 210622: 新增此API, 后端改为从指标库取值 , 保证平阴县的工作人员,看到的下拉框是平阴县、以及8个街道 + * + * @param staffId 当前登录用户id + * @param currentCustomerId 当前客户id + * @return com.epmet.project.dto.result.ProjectNextAgencyResultDTO + */ + @Override + public List myNextAgencyMultic(String staffId,String currentCustomerId) { + //多客户测试写死值,别忘了注释掉呀 + // staffId="3f04e397cc226e4e2f2531ac4363e3f9"; + // currentCustomerId="613cc61a6b8ce4c70d21bd413dac72cc"; + //1、当前工作人员所属组织信息 + Result staffResult = govOrgOpenFeignClient.getAgencyByStaff(staffId); + if (!staffResult.success() || null == staffResult.getData()) { + throw new RenException(String.format("查询当前工作人员所属组织信息异常,staffId:%s", staffId)); + } + List resultList = new ArrayList<>(); + ProjectNextAgencyResultDTO staffAgency = new ProjectNextAgencyResultDTO(); + staffAgency.setOrgId(staffResult.getData().getId()); + staffAgency.setOrgName(staffResult.getData().getOrganizationName()); + staffAgency.setOrgType("agency"); + staffAgency.setAreaCode(staffResult.getData().getAreaCode()); + resultList.add(staffAgency); + //2、查询指标库当前组织的下级组织 + List agencyDTOList =new ArrayList<>(); + Result> crmRes = operCrmOpenFeignClient.getAllSubCustomerIds(currentCustomerId); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + log.warn("❤当前客户存在子客户❤"); + crmRes.getData().add(currentCustomerId); + //如果包含子客户,则根据areaCode查询下一级 + agencyDTOList = screenAgencyService.queryNextAgencyList(staffResult.getData().getAreaCode(), StrConstant.EPMETY_STR,crmRes.getData()); + } else { + //当前客户没有子客户,根据agencyId查询下一级组织 + agencyDTOList = screenAgencyService.queryNextAgencyList(StrConstant.EPMETY_STR, staffResult.getData().getId(),null); + } + if (CollectionUtils.isNotEmpty(agencyDTOList)) { + agencyDTOList.forEach(agencyDTO -> { + ProjectNextAgencyResultDTO nextAgency = new ProjectNextAgencyResultDTO(); + nextAgency.setOrgId(agencyDTO.getAgencyId()); + nextAgency.setOrgName(agencyDTO.getAgencyName()); + nextAgency.setOrgType("agency"); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + //只有当前客户存在子客户时,才返回areaCode + nextAgency.setAreaCode(agencyDTO.getAreaCode()); + } + resultList.add(nextAgency); + }); + } + //3、查询指标库当前组织的下级网格 + List gridList = new ArrayList<>(); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + //如果包含子客户,则根据areaCode查询下一级网格 + crmRes.getData().add(currentCustomerId); + gridList=screenAgencyService.queryGridList(staffResult.getData().getAreaCode(), StrConstant.EPMETY_STR,crmRes.getData()); + } else { + //当前客户没有子客户,根据agencyId查询下一级网格 + gridList=screenAgencyService.queryGridList(StrConstant.EPMETY_STR,staffResult.getData().getId(),null); + } + if (CollectionUtils.isNotEmpty(gridList)) { + gridList.forEach(gridDTO -> { + ProjectNextAgencyResultDTO grid = new ProjectNextAgencyResultDTO(); + grid.setOrgId(gridDTO.getGridId()); + grid.setOrgName(gridDTO.getGridName()); + grid.setOrgType("grid"); + if (crmRes.success() && CollectionUtils.isNotEmpty(crmRes.getData())) { + //只有当前客户存在子客户时,才返回areaCode + grid.setAreaCode(gridDTO.getAreaCode()); + } + resultList.add(grid); + }); + } + return resultList; + } + + /** + * 群众不满列表,改为从指标库的screen_project_data取值,sql里面写死<75分的展示 + * + * @param formDTO + * @return com.epmet.dto.result.project.MassesDiscontentResultV2DTO + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public List queryMassesDiscontentMultic(MassesDiscontentFormV2DTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + formDTO.setEndDate(getDateId(ProjectConstant.YESTERDAY)); + formDTO.setStartDate(getDateId(formDTO.getTimeSection())); + log.info(JSON.toJSONString(formDTO,true)); + //已结案、并且来源于议题、在当前时间范围内的、 + List list = projectDao.selectMassesDiscontentMultic(formDTO.getAgencyId(), + formDTO.getAreaCode(), + formDTO.getStartDate(), + formDTO.getEndDate(), + formDTO.getSortType()); + list.forEach(project -> { + project.setPhotos(screenProjectDataDao.selectProjectImgs(project.getProjectId(), project.getCustomerId())); + }); + return list; + } + + /** + * @Description 处理时间 + * @Param dateType + * @author zxc + * @date 2021/5/18 2:28 下午 + */ + public String getDateId(String dateType){ + String result = DateUtils.getBeforeNDay(NumConstant.ONE); + switch (dateType) { + case ProjectConstant.THREE_MONTH: + result = DateUtils.getBeforeNDay(NumConstant.NINETY); + break; + case ProjectConstant.SIX_MONTH: + result = DateUtils.getBeforeNDay(NumConstant.ONE_HUNDRED_AND_EIGHTY); + break; + case ProjectConstant.TWELVE_MONTH: + result = DateUtils.getBeforeNDay(NumConstant.THREE_HUNDRED_AND_SIXTY_FIVE); + break; + case ProjectConstant.YESTERDAY: + result = DateUtils.getBeforeNDay(NumConstant.ONE); + break; + default: + } + return result; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java index bfc46d03bd..a087e1c3c6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java @@ -107,17 +107,17 @@ public class DateUtils { } /** - * @Description 得到上个月的monthId - * @param + * @Description 前n个月 + * @param beforeMonthNum * @return * @author wangc * @date 2020.08.20 10:19 **/ - public String getPreviousMonthId(){ + public String getPreviousMonthId(int beforeMonthNum){ SimpleDateFormat format = new SimpleDateFormat("yyyyMM"); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); // 设置为当前时间 - calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); // 设置为上一个月 + calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - beforeMonthNum); // 设置为上一个月 return format.format(calendar.getTime()); } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml index 68f17dd26c..5662edfaf7 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencyScoreDao.xml @@ -74,5 +74,22 @@ ORDER BY fact.month_id ASC + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml index bd45c22bc4..7c6be5ab92 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunityScoreDao.xml @@ -74,5 +74,22 @@ ORDER BY fact.month_id ASC + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml index 0458665057..a177451112 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridScoreDao.xml @@ -76,5 +76,22 @@ ORDER BY fact.month_id ASC + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml index 3f43d05337..4142b53239 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml @@ -3,19 +3,6 @@ - - + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml index d06d7ac03d..fced0091a6 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml @@ -267,6 +267,78 @@ DESC + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 03dcd38d40..0d940865f0 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -116,6 +116,7 @@ del_flag = '0' AND pid = '0' AND agency_id = #{agencyId} + AND customer_id = #{customerId} @@ -304,9 +306,10 @@ - SELECT - sca.AGENCY_ID as orgId + sca.AGENCY_ID as agencyId, + sca.AGENCY_NAME as agencyName FROM screen_customer_agency sca WHERE @@ -319,6 +322,7 @@ and sca.PID=#{agencyId} + order by CONVERT ( sca.AGENCY_NAME USING gbk ) ASC @@ -340,4 +344,93 @@ AND cg.ALL_PARENT_IDS LIKE CONCAT(#{agencyId}, '%') + + + + + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index 2d9f8e5deb..ac5f466642 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -122,9 +122,10 @@ GROUP BY scg.PARENT_AGENCY_ID - SELECT - m.GRID_ID as orgId + m.GRID_ID as gridId, + m.grid_name as gridName FROM screen_customer_grid m where m.DEL_FLAG = '0' @@ -136,5 +137,6 @@ and m.PARENT_AGENCY_ID=#{agencyId} + order by CONVERT ( m.grid_name USING gbk ) ASC \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml index 7f30a13cac..f69c5fe41e 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml @@ -14,7 +14,7 @@ diff.EVENT_IMG_URL AS imgUrl, IFNULL(diff.EVENT_CATEGORY_NAME,'') AS categoryName, diff.EVENT_RE_ORG AS handleDepts, - diff.EVENT_RE_ORG AS handleCount + diff.EVENT_HANDLED_COUNT AS handleCount FROM screen_difficulty_data diff WHERE @@ -63,13 +63,15 @@ diff.EVENT_IMG_URL AS imgUrl, IFNULL(diff.EVENT_CATEGORY_NAME,'') AS categoryName, diff.EVENT_RE_ORG AS handleDepts, - diff.EVENT_RE_ORG AS handleCount + diff.EVENT_HANDLED_COUNT AS handleCount FROM screen_difficulty_data diff left join screen_customer_grid scg on(diff.ORG_ID=scg.GRID_ID and scg.DEL_FLAG='0') WHERE diff.DEL_FLAG = '0' + and diff.ORG_TYPE='grid' + and diff.EVENT_STATUS_CODE in('pending','0') AND scg.AREA_CODE like concat(#{areaCode},'%') ORDER BY (CASE #{type} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml index dd04bb5130..26d9ac136c 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml @@ -23,7 +23,7 @@ AND rankData.PARENT_ID = #{agencyId} AND rankData.MONTH_ID = #{monthId} ORDER BY - (rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC + rankData.RESPONSE_RATIO DESC @@ -77,10 +77,7 @@ AND rankData.MONTH_ID =#{monthId} ) ORDER BY - RESPONSE_RATIO DESC, - RESOLVED_RATIO DESC, - GOVERN_RATIO DESC, - SATISFACTION_RATIO DESC + RESPONSE_RATIO DESC \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index f00cc4c23e..ce83c8e058 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -9,6 +9,12 @@ service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility, party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility, govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility, + ROUND(service_ablity,1) serviceOriginScore, + ROUND(party_dev_ablity,1) partyOriginScore, + ROUND(govern_ablity,1) governOriginScore, + SERVICE_ABLITY_WEIGHT serviceAblityWeight, + PARTY_DEV_WEIGHT partyDevWeight, + GOVERN_ABLITY_WEIGHT governAblityWeight, MONTH_ID FROM screen_index_data_monthly @@ -35,6 +41,9 @@ service_ablity * SERVICE_ABLITY_WEIGHT AS serviceAbility, party_dev_ablity * PARTY_DEV_WEIGHT AS partyDevAbility, govern_ablity * GOVERN_ABLITY_WEIGHT AS governAbility, + ROUND(service_ablity,1) serviceOriginScore, + ROUND(party_dev_ablity,1) partyOriginScore, + ROUND(govern_ablity,1) governOriginScore, SERVICE_ABLITY_WEIGHT as serviceAblityWeight, PARTY_DEV_WEIGHT as partyDevWeight, GOVERN_ABLITY_WEIGHT as governAblityWeight @@ -92,13 +101,13 @@ - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' @@ -206,13 +215,13 @@ - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' @@ -278,13 +287,13 @@ - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' @@ -385,4 +394,73 @@ ORDER BY (sy.govern_ablity+sy.party_dev_ablity+sy.service_ablity) DESC LIMIT #{topNum} + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml index ad0132dd85..78c494648b 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataYearlyDao.xml @@ -34,16 +34,16 @@ score.ORG_TYPE orgType FROM screen_index_data_yearly score - + - INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_grid org ON org.GRID_ID = score.ORG_ID AND org.DEL_FLAG = '0' - INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' + INNER JOIN screen_customer_agency org ON org.AGENCY_ID = score.ORG_ID AND org.DEL_FLAG = '0' - - INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = score.CUSTOMER_ID AND org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' + + INNER JOIN screen_customer_dept org ON org.DEPT_ID = score.ORG_ID AND org.DEL_FLAG = '0' @@ -65,4 +65,71 @@ ORDER BY index_total ${sort} LIMIT #{topNum} + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml index 6c176721d5..6908b80953 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml @@ -25,13 +25,7 @@ AND rankData.ALL_PARENT_IDS LIKE CONCAT('%',#{agencyId},'%') AND rankData.MONTH_ID = #{monthId} ORDER BY - (rankData.PARTY_TOTAL + rankData.GROUP_TOTAL + rankData.ISSUE_TOTAL + rankData.PROJECT_TOTAL + rankData.CLOSE_PROJECT_RATIO + rankData.SATISFACTION_RATIO) DESC, - rankData.PARTY_TOTAL DESC, - rankData.GROUP_TOTAL DESC, - rankData.ISSUE_TOTAL DESC, - rankData.PROJECT_TOTAL DESC, - rankData.CLOSE_PROJECT_RATIO DESC, - rankData.SATISFACTION_RATIO DESC + rankData.PARTY_TOTAL DESC @@ -60,12 +54,6 @@ and scg.AREA_CODE like CONCAT('%',#{areaCode},'%') AND rankData.MONTH_ID = #{monthId} ORDER BY - (rankData.PARTY_TOTAL + rankData.GROUP_TOTAL + rankData.ISSUE_TOTAL + rankData.PROJECT_TOTAL + rankData.CLOSE_PROJECT_RATIO + rankData.SATISFACTION_RATIO) DESC, - rankData.PARTY_TOTAL DESC, - rankData.GROUP_TOTAL DESC, - rankData.ISSUE_TOTAL DESC, - rankData.PROJECT_TOTAL DESC, - rankData.CLOSE_PROJECT_RATIO DESC, - rankData.SATISFACTION_RATIO DESC + rankData.PARTY_TOTAL DESC \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index 6534512f8a..b1f890b3a5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -33,34 +33,26 @@ diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index 0f0cb8c58c..543b9d3eb4 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -60,15 +60,17 @@ SELECT - scj.ID, - IFNULL(avg( scj.JOIN_TOTAL ),0) AS total, - IFNULL(ROUND( avg( scj.AVG_JOIN ), 1 ),0) AS averageJoin, - IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) AS monthIncr, - (case when IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) >0 then 'incr' - when IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) < 0 then 'decr' - else 'eq' - end )as monthTrend, - ROUND( IFNULL(avg( scj.AVG_ISSUE ),0), 1 ) AS averageIssue, - IFNULL(avg( scj.AVG_ISSUE_UP_RATE ),0) AS issueCompareLatestMonth, - ( - case when IFNULL(avg( scj.AVG_ISSUE_UP_RATE ),0) > 0 then 'incr' - when IFNULL(avg( scj.AVG_ISSUE_UP_RATE ),0) < 0 then 'decr' - else 'eq' - end - )as issueCompareLatestTrend, - IFNULL(avg( scj.AGVG_JOIN_UP_RATE) ,0) AS joinCompareLatestMonth, - ( - case when IFNULL(avg( scj.AGVG_JOIN_UP_RATE ),0) > 0 then 'incr' - when IFNULL(avg( scj.AGVG_JOIN_UP_RATE ),0) < 0 then 'decr' - else 'eq' - end - )as joinCompareLatestTrend + ifnull(sum(suj.JOIN_TOTAL),0) as total, + 0 as monthIncr, + ''as monthTrend, + round(IFNULL(sum(suj.avg_issue_fz)/sum(suj.avg_issue_fm),0),2) as averageIssue, + 0 as issueCompareLatestMonth, + '' as issueCompareLatestTrend, + round(ifnull(sum(suj.avg_join_fz)/sum(suj.avg_join_fm),0),2)as averageJoin, + 0 as joinCompareLatestMonth, + '' as joinCompareLatestTrend FROM - screen_user_join scj - LEFT JOIN screen_customer_agency agency ON scj.org_id = agency.agency_id + screen_user_join suj + INNER JOIN screen_customer_agency sca ON ( suj.ORG_ID = sca.AGENCY_ID AND sca.DEL_FLAG = '0' ) WHERE - scj.DEL_FLAG = '0' - AND scj.MONTH_ID = #{monthId} - AND agency.PARENT_AREA_CODE =#{areaCode} + suj.ORG_TYPE = 'agency' + AND sca.PARENT_AREA_CODE = #{areaCode} + AND suj.MONTH_ID = #{monthId} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyGroupTotalFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyGroupTotalFormDTO.java new file mode 100644 index 0000000000..c5fed7b1cf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyGroupTotalFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-组织群组总数-接口入参 + * @Auth sun + */ +@Data +public class AgencyGroupTotalFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {AgencyGroupTotalFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月份ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 当前组织及下级小组总数 + */ + private Integer groupTotal = 0; + + /** + * 当前组织及下级楼院小组总数 + */ + private Integer ordinaryTotal = 0; + + /** + * 当前组织及下级支部小组总数 + */ + private Integer branchTotal = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyHotTopicFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyHotTopicFormDTO.java new file mode 100644 index 0000000000..9fb08407ce --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyHotTopicFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-组织热议话题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyHotTopicFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {AgencyHotTopicFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 话题总数 + */ + private Integer topicTotal = 0; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status = ""; + + /** + * 状态话题数量 + */ + private Integer topicCount = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyIssueFormDTO.java new file mode 100644 index 0000000000..d57740cb12 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyIssueFormDTO.java @@ -0,0 +1,200 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织议题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyProjectFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyProjectFormDTO.java new file mode 100644 index 0000000000..7702a90a4b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyProjectFormDTO.java @@ -0,0 +1,146 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织项目数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyProjectFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyProjectForm extends CustomerClientShowGroup {} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyProjectForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 上级组织Id【dim_agency.pid】 + */ + private String parentId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal = 0; + + /** + * 截止当日处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal = 0; + + /** + * 截止当日处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio = new BigDecimal("0"); + + /** + * 截止当日已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal = 0; + + /** + * 截止当日已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal = 0; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal = 0; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio = new BigDecimal("0"); + + /** + * 当日项目总数 【当前组织及下级项目总数】 + */ + private Integer projectIncr = 0; + + /** + * 当日处理中项目数 【当前组织及下级前一日新增处理中项目数】 + */ + private Integer pendingIncr = 0; + + /** + * 当日已结案项目数 【当前组织及下级前一日新增结案项目数】 + */ + private Integer closedIncr = 0; + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr = 0; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyRegUserFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyRegUserFormDTO.java new file mode 100644 index 0000000000..bf7d2d3478 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyRegUserFormDTO.java @@ -0,0 +1,109 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织机关注册用户数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyRegUserFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {AgencyRegUserFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + BigDecimal bi = new BigDecimal(0); + /** + * 客户id + */ + private String customerId; + + /** + * 机关id + */ + private String agencyId; + + /** + * + */ + private String dateId; + + /** + * + */ + private String weekId = ""; + + /** + * + */ + private String yearId = ""; + + /** + * 注册用户总数 + */ + private Integer regTotal = 0; + + /** + * 居民总数 + */ + private Integer resiTotal = 0; + + /** + * 热心居民总数 + */ + private Integer warmHeartedTotal = 0; + + /** + * 党员总数 + */ + private Integer partymemberTotal = 0; + + /** + * 本日注册居民日增量 + */ + private Integer regIncr = 0; + + /** + * 本日热心居民日增量 + */ + private Integer warmIncr = 0; + + /** + * 本日党员认证日增量 + */ + private Integer partymemberIncr = 0; + + /** + * 居民总数占比 + */ + private BigDecimal resiProportion = bi; + + /** + * 党员总数占比 + */ + private BigDecimal partymemberProportion = bi; + + /** + * 热心居民占比 + */ + private BigDecimal warmHeartedProportion = bi; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicIssueFormDTO.java new file mode 100644 index 0000000000..046b947bec --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicIssueFormDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-组织话题转议题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyTopicIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyTopicIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyTopicIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 已转议题数量 + */ + private Integer issueTotal; + + /** + * 已转议题当日增量 + */ + private Integer issueIncr; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicStatusFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicStatusFormDTO.java new file mode 100644 index 0000000000..6bb5eac899 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/AgencyTopicStatusFormDTO.java @@ -0,0 +1,100 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-组织状态话题数据-接口入参 + * @Auth sun + */ +@Data +public class AgencyTopicStatusFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AgencyTopicStatusForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = AgencyTopicStatusForm.class) + private List dataList; + + @Data + public static class DataList { + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题状态ID 关联dim_topic_status表 + 讨论中 discussing + 已屏蔽 hidden + 已关闭 closed + 已转项目 shift_project + */ + private String topicStatusId; + + /** + * 话题数量 指定状态的话题数量 + */ + private Integer topicCount; + + /** + * 话题状态百分比 指定状态话题数/话题总数 + 总数在topic_total_agency_daily中 + */ + private BigDecimal topicProportion; + + /** + * 话题增量 单位时间内的状态话题的增加数 + */ + private Integer topicIncrement; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridGroupTotalFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridGroupTotalFormDTO.java new file mode 100644 index 0000000000..8fb2dc7e25 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridGroupTotalFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格群组总数-接口入参 + * @Auth sun + */ +@Data +public class GridGroupTotalFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {saveList.class}) + private List dataList; + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dim表 + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月份ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 网格下小组总数 + */ + private Integer groupTotal = 0; + + /** + * 网格下楼院小组总数 + */ + private Integer ordinaryTotal = 0; + + /** + * 网格下支部小组总数 + */ + private Integer branchTotal = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridHotTopicFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridHotTopicFormDTO.java new file mode 100644 index 0000000000..54d1029231 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridHotTopicFormDTO.java @@ -0,0 +1,88 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 基础数据上报-网格热议话题数据-接口入参 + * @Auth sun + */ +@Data +public class GridHotTopicFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {GridHotTopicFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + + /** + * 客户ID + */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID 关联网格dm表 + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId = ""; + + /** + * 月ID + */ + private String monthId = ""; + + /** + * 季度ID + */ + private String quarterId = ""; + + /** + * 年ID + */ + private String yearId = ""; + + /** + * 话题总数 + */ + private Integer topicTotal = 0; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status = ""; + + /** + * 状态话题数量 + */ + private Integer topicCount = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridIssueFormDTO.java new file mode 100644 index 0000000000..4fd03e434b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridIssueFormDTO.java @@ -0,0 +1,200 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格议题数据-接口入参 + * @Auth sun + */ +@Data +public class GridIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 周ID + */ + private String weekId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 当日议题增量 + */ + private Integer issueIncr; + + /** + * 议题总数 + */ + private Integer issueTotal; + + /** + * 当日已转项目的议题数增量 + */ + private Integer shiftProjectIncr; + + /** + * 已转项目的议题总数 + */ + private Integer shiftProjectTotal; + + /** + * 已转项目所占百分比 + */ + private BigDecimal shiftProjectPercent; + + /** + * 当日表决中议题数增量 + */ + private Integer votingIncr; + + /** + * 表决中议题总数 + */ + private Integer votingTotal; + + /** + * 表决中议题所占百分比 + */ + private BigDecimal votingPercent; + + /** + * 当日已关闭议题数增量 + */ + private Integer closedIncr; + + /** + * 当日已关闭议题中已解决数量 + */ + private Integer closedResolvedIncr; + + /** + * 当日已关闭议题中无需解决数量 + */ + private Integer closedUnresolvedIncr; + + /** + * 已关闭议题总数 + */ + private Integer closedTotal; + + /** + * 已关闭议题中已解决总数 + */ + private Integer closedResolvedTotal; + + /** + * 已关闭议题中未解决总数 + */ + private Integer closedUnresolvedTotal; + + /** + * 已关闭议题所占百分比 + */ + private BigDecimal closedPercent; + + /** + * 已关闭议题中已解决百分比 + */ + private BigDecimal closedResolvedPercent; + + /** + * 已关闭议题中未解决百分比 + */ + private BigDecimal closedUnresolvedPercent; + + /** + * 当日已结案议题数 + */ + private Integer closedCaseIncr; + + /** + * 当日已结案议题中已解决数 + */ + private Integer closedCaseResolvedIncr; + + /** + * 当日已结案议题中未解决数 + */ + private Integer closedCaseUnresolvedIncr; + + /** + * 已结案议题总数 + */ + private Integer closedCaseTotal; + + /** + * 已结案议题中已解决总数 + */ + private Integer closedCaseResolvedTotal; + + /** + * 已结案议题中未解决总数 + */ + private Integer closedCaseUnresolvedTotal; + + /** + * 已结案议题中已解决百分比 + */ + private BigDecimal closedCaseResolvedPercent; + + /** + * 已结案议题中未解决百分比 + */ + private BigDecimal closedCaseUnresolvedPercent; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridProjectFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridProjectFormDTO.java new file mode 100644 index 0000000000..b85f741c82 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridProjectFormDTO.java @@ -0,0 +1,145 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格项目数据-接口入参 + * @Auth sun + */ +@Data +public class GridProjectFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridProjectForm extends CustomerClientShowGroup {} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridProjectForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id 【dim_customer.id】 + */ + private String customerId; + + /** + * 机关Id 【dim_agency.id】 + */ + private String agencyId; + + /** + * 网格Id 【dim_grid.id】 + */ + private String gridId; + + /** + * 日维度Id 【dim_date.id】 + */ + private String dateId; + + /** + * 周维度Id 【dim_week.id】 + */ + private String weekId; + + /** + * 月维度Id 【dim_month.id】 + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年维度Id 【dim_year.id】 + */ + private String yearId; + + /** + * 截止当日网格下项目总数 【当前组织及下级项目总数】 + */ + private Integer projectTotal = 0; + + /** + * 截止当日网格下处理中项目数 【当前组织及下级所有未结案项目总数】 + */ + private Integer pendingTotal = 0; + + /** + * 截止当日网格下处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal pendingRatio = new BigDecimal("0"); + + /** + * 截止当日网格下已结案项目数 【当前组织及下级已结案项目总数】 + */ + private Integer closedTotal = 0; + + /** + * 截止当日网格下已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 + */ + private BigDecimal closedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 + */ + private Integer resolvedTotal = 0; + + /** + * 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 + */ + private BigDecimal resolvedRatio = new BigDecimal("0"); + + /** + * 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 + */ + private Integer unresolvedTotal = 0; + + /** + * 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 + */ + private BigDecimal unresolvedRatio = new BigDecimal("0"); + + /** + * 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 + */ + private Integer resolvedIncr = 0; + + /** + * 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 + */ + private Integer unresolvedIncr = 0; + + /** + * 当日网格下项目总数 【该网格下项目总数】 + */ + private Integer projectIncr = 0; + + /** + * 当日网格下处理中项目数 【该网格下未结案项目总数】 + */ + private Integer pendingIncr = 0; + + /** + * 当日网格下已结案项目数 【该网格下已结案项目总数】 + */ + private Integer closedIncr = 0; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridRegUserFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridRegUserFormDTO.java new file mode 100644 index 0000000000..84f18f226c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridRegUserFormDTO.java @@ -0,0 +1,114 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格注册用户数据-接口入参 + * @Auth sun + */ +@Data +public class GridRegUserFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 数据集合对象 + */ + @NotEmpty(message = "至少有一条数据", groups = {GridRegUserFormDTO.saveList.class}) + private List dataList; + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + public interface saveList extends CustomerClientShowGroup {} + + @Data + public static class DataList { + BigDecimal bi = new BigDecimal(0); + /** + * 客户id + */ + private String customerId; + + /** + * 机关id + */ + private String agencyId; + + /** + * 网格id + */ + private String gridId; + + /** + * 日维度Id + */ + private String dateId; + + /** + * 周维度Id + */ + private String weekId = ""; + + /** + * 年维度Id + */ + private String yearId = ""; + + /** + * 注册用户总数 + */ + private Integer regTotal = 0; + + /** + * 居民总数 + */ + private Integer resiTotal = 0; + + /** + * 热心居民总数 + */ + private Integer warmHeartedTotal = 0; + + /** + * 党员总数 + */ + private Integer partymemberTotal = 0; + + /** + * 本日注册居民日增量 + */ + private Integer regIncr = 0; + + /** + * 本日热心居民日增量 + */ + private Integer warmIncr = 0; + + /** + * 本日党员认证日增量 + */ + private Integer partymemberIncr = 0; + + /** + * 居民总数占比 + */ + private BigDecimal resiProportion = bi; + + /** + * 党员总数占比 + */ + private BigDecimal partymemberProportion = bi; + + /** + * 热心居民占比 + */ + private BigDecimal warmHeartedProportion = bi; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicIssueFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicIssueFormDTO.java new file mode 100644 index 0000000000..bd40463640 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicIssueFormDTO.java @@ -0,0 +1,85 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格话题转议题数据-接口入参 + * @Auth sun + */ +@Data +public class GridTopicIssueFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridTopicIssueForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridTopicIssueForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 新增转议题数 + */ + private Integer issueIncr; + + /** + * 转议题总数 + */ + private Integer issueTotal; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicStatusFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicStatusFormDTO.java new file mode 100644 index 0000000000..519ea28a37 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/GridTopicStatusFormDTO.java @@ -0,0 +1,99 @@ +package com.epmet.dto.basereport.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @Description 基础数据上报-网格状态话题数据-接口入参 + * @Auth sun + */ +@Data +public class GridTopicStatusFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface GridTopicStatusForm extends CustomerClientShowGroup{} + + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + /** + * 数据集合对象 + */ + @NotEmpty(message = "数据集合对象不能为空",groups = GridTopicStatusForm.class) + private List dataList; + + @Data + public static class DataList{ + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID 关联网格dm表 + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题状态ID 讨论中 discussing + 已屏蔽 hidden + 已关闭 closed + 已转项目 shift_project + */ + private String topicStatusId; + + /** + * 话题数量 + */ + private Integer topicCount; + + /** + * 话题状态占比 指定状态话题数/话题总数 + 总数在topic_total_grid_daily中 + */ + private BigDecimal topicProportion; + + /** + * 话题增量 + */ + private Integer topicIncrement; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/.gitkeep b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/result/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java new file mode 100644 index 0000000000..3a2fa60edf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/crm/CustomerRelationDTO.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.crm; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户关系表(01.14 add) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-03 + */ +@Data +public class CustomerRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 父级客户id;如果是顶级客户,此列=0 + */ + private String parentCustomerId; + + /** + * 当前客户的所有父级客户id,以英文冒号隔开,如果是顶级客户,此列=0 + */ + private String pids; + + /** + * 当前客户类型取值: external:外部客户,internal:内部客户 + */ + private String customerType; + + /** + * 父级客户类型取值: external:外部客户,internal:内部客户;如果是顶级客户,此列=0 + */ + private String parentCustomerType; + + /** + * open,closed是否启用 + */ + private String status; + + /** + * 当前客户级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) + */ + private String level; + + /** + * 当前客户的地区编码,实际就是根组织的area_code + */ + private String areaCode; + + /** + * 删除标识0未删除1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java new file mode 100644 index 0000000000..3f9c614f8a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactAgencyGovernDailyDTO.java @@ -0,0 +1,181 @@ +package com.epmet.dto.extract; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:32 + */ +@Data +public class FactAgencyGovernDailyDTO implements Serializable { + private static final long serialVersionUID = 4776545209536007717L; + private String id; + /** + * 客户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; + + /** + * 界面展示:问题解决总数=1+2+3+4+5+6+7+8 + */ + private Integer problemResolvedCount; + + /** + * 界面展示:党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数 + */ + private BigDecimal groupSelfGovernRatio; + + /** + * 界面展示:网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal gridSelfGovernRatio; + + /** + * 界面展示:社区解决占比=COMMUNITY_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal communityClosedRatio; + + /** + * 界面展示:街道解决占比=STREET_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal streetClosedRatio; + + /** + * 界面展示:区直部门解决占比=DISTRICT_DEPT_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal districtDeptClosedRatio; + + /** + * 1、当前组织内,话题关闭已解决数 + */ + private Integer topicResolvedCount; + + /** + * 2、当前组织内,话题关闭无需解决数 + */ + private Integer topicUnResolvedCount; + + /** + * 3、当前组织内,议题关闭已解决数 + */ + private Integer issueResolvedCount; + + /** + * 4、当前组织内,议题关闭无需解决数 + */ + private Integer issueUnResolvedCount; + + /** + * 5、当前组织内:来源于议题的项目:结案已解决数 + */ + private Integer issueProjectResolvedCount; + + /** + * 6、当前组织内:来源于议题的项目:结案无需解决数 + */ + private Integer issueProjectUnResolvedCount; + + /** + * 7、当前组织内:项目立项,结案已解决数;默认为0, + */ + private Integer approvalProjectResolvedCount; + + /** + * 8、当前组织内:项目立项,结案无需解决数;默认为0, + */ + private Integer approvalProjectUnResolvedCount; + + /** + * 9、当前组织内,未出小组即未转议题的:话题关闭已解决数 + */ + private Integer inGroupTopicResolvedCount; + + /** + * 10、当前组织内,未出小组即未转议题的:话题关闭无需解决数 + */ + private Integer inGroupTopicUnResolvedCount; + + /** + * 未出当前网格的,结案项目数 + */ + private Integer gridSelfGovernProjectTotal; + + /** + * 当前组织内结案的项目中:由社区结案的项目总数 + */ + private Integer communityClosedCount; + + /** + * 当前组织内结案的项目中:由街道结案的项目总数 + */ + private Integer streetClosedCount; + + /** + * 当前组织内结案的项目中:由区直部门结案的项目总数 + */ + private Integer districtDeptClosedCount; + + /** + * 删除标识 默认为0 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java new file mode 100644 index 0000000000..778ffcb9a4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactGridGovernDailyDTO.java @@ -0,0 +1,193 @@ +package com.epmet.dto.extract; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:34 + */ +@Data +public class FactGridGovernDailyDTO implements Serializable { + private static final long serialVersionUID = -5492115478082510064L; + private String id; + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属的组织id + */ + private String pid; + + /** + * 网格所有上级id + */ + private String pids; + + /** + * 界面展示:问题解决总数=1+2+3+4+5+6+7+8 + */ + private Integer problemResolvedCount; + + /** + * 界面展示:党群自治占比=(9+10)/PROBLEM_RESOLVED_COUNT; 此列存储的是小数 + */ + private BigDecimal groupSelfGovernRatio; + + /** + * 界面展示:网格自治占比=GRID_SELF_GOVERN_PROJECT_TOTAL/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal gridSelfGovernRatio; + + /** + * 界面展示:社区解决占比=COMMUNITY_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal communityClosedRatio; + + /** + * 界面展示:街道解决占比=STREET_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal streetClosedRatio; + + /** + * 界面展示:区直部门解决占比=DISTRICT_DEPT_CLOSED_COUNT/PROBLEM_RESOLVED_COUNT;此列存储的是小数 + */ + private BigDecimal districtDeptClosedRatio; + + /** + * 1、当前网格内,话题关闭已解决数 + */ + private Integer topicResolvedCount; + + /** + * 2、当前网格内,话题关闭无需解决数 + */ + private Integer topicUnResolvedCount; + + /** + * 3、当前网格内,议题关闭已解决数 + */ + private Integer issueResolvedCount; + + /** + * 4、当前网格内,议题关闭无需解决数 + */ + private Integer issueUnResolvedCount; + + /** + * 5、当前网格内:来源于议题的项目:结案已解决数 + */ + private Integer issueProjectResolvedCount; + + /** + * 6、当前网格内:来源于议题的项目:结案无需解决数 + */ + private Integer issueProjectUnResolvedCount; + + /** + * 7、当前网格内:项目立项,结案已解决数;默认为0, + */ + private Integer approvalProjectResolvedCount; + + /** + * 8、当前网格内:项目立项,结案无需解决数;默认为0, + */ + private Integer approvalProjectUnResolvedCount; + + /** + * 9、当前网格内,未出小组即未转议题的:话题关闭已解决数 + */ + private Integer inGroupTopicResolvedCount; + + /** + * 10、当前网格内,未出小组即未转议题的:话题关闭无需解决数 + */ + private Integer inGroupTopicUnResolvedCount; + + /** + * 11、来源于议题的项目,未出网格结案并且已解决的项目数 + */ + private Integer fromIssueResolvedInGridCount; + + /** + * 12、来源于议题的项目,未出网格结案并且无需解决的项目数 + */ + private Integer fromIssueUnResolvedInGridCount; + + /** + * 13、来源于项目立项的项目,未出网格结案,并且已解决的项目数;因现在网格不能立项,所以此列默认为0 + */ + private Integer fromAgencyResolvedInGridCount; + + /** + * 14、来源于项目立项的项目,未出网格结案,并且无需解决的项目数;因现在网格不能立项,所以此列默认为0 + */ + private Integer fromAgencyUnResolvedInGridCount; + + /** + * 15、未出当前网格的,结案项目数=11+12+13+14 + */ + private Integer gridSelfGovernProjectTotal; + + + /** + * 当前网格内出来的项目:由社区结案(已解决+未解决)的项目总数 + */ + private Integer communityClosedCount; + + /** + * 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数 + */ + private Integer streetClosedCount; + + /** + * 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数 + */ + private Integer districtDeptClosedCount; + + /** + * 删除标识 默认为0 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AgencyGovernDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AgencyGovernDailyFormDTO.java new file mode 100644 index 0000000000..3f1c3a1bc7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/AgencyGovernDailyFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.extract.form; + +import com.epmet.dto.extract.FactAgencyGovernDailyDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:28 + */ +@Data +public class AgencyGovernDailyFormDTO implements Serializable { + private static final long serialVersionUID = 106752296400100448L; + /** + * 当为true时后台将删除本月数据 + */ + private Boolean isFirst; + + /** + * yyyyMMdd + */ + private String dateId; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/BizDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/BizDataFormDTO.java new file mode 100644 index 0000000000..23f164afe3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/BizDataFormDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.extract.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * desc: 从业务数据抽取到统计库 dto + * + * @Author zxc + * @DateTime 2020/9/16 6:01 下午 + */ +@Data +public class BizDataFormDTO implements Serializable { + + + private static final long serialVersionUID = 2860395703825549825L; + + public interface ExtractForm extends CustomerClientShowGroup { + } + + @NotBlank(message = "客户ID不能为空", groups = ExtractForm.class) + private String customerId; + + @NotBlank(message = "dateId不能为空", groups = ExtractForm.class) + private String dateId; + + private String userId; + private String gridId; + + /** + * 开始时间 + */ + private String startDate; + /** + * 结束时间 + */ + private String endDate; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridGovernDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridGovernDailyFormDTO.java new file mode 100644 index 0000000000..173ba43011 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridGovernDailyFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.extract.form; + +import com.epmet.dto.extract.FactGridGovernDailyDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:36 + */ +@Data +public class GridGovernDailyFormDTO implements Serializable { + private static final long serialVersionUID = 1630151176835406040L; + /** + * 当为true时后台将删除本月数据 + */ + private Boolean isFirst; + + /** + * yyyyMMdd + */ + private String dateId; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java new file mode 100644 index 0000000000..a3386e6e37 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.extract.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc: 工作人员巡查统计参数 + * + * @author LiuJanJun + * @date 2021/6/29 10:19 上午 + */ +@Data +public class StaffPatrolStatsFormDTO implements Serializable { + + private static final long serialVersionUID = -3639860733213306581L; + private String customerId; + private String dateId; + private String staffId; + private String gridId; + /** + * 角色key + */ + private String roleKey; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java new file mode 100644 index 0000000000..bd1e2034f9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/SyncOrgInfoFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.extract.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/6 16:37 + */ +@Data +public class SyncOrgInfoFormDTO implements Serializable { + private static final long serialVersionUID = -3533276226280926966L; + @NotBlank(message = "孔村or榆山or锦水客户id不能为空") + private String fromCustomerId; + @NotBlank(message = "平阴客户id不能为空") + private String toCustomerId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java index f57927f65d..16a972293e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java @@ -15,6 +15,7 @@ public class OrgStatisticsResultDTO implements Serializable { private static final long serialVersionUID = 9221060553279124719L; private String customerId; private String agencyId; + private String staffId; private String level; private String orgId; private Integer count; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerGridInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerGridInfoDTO.java index 16ede875bb..88968cf57e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerGridInfoDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerGridInfoDTO.java @@ -1,6 +1,6 @@ package com.epmet.dto.indexcal; -import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import lombok.Data; import java.io.Serializable; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java new file mode 100644 index 0000000000..b792e6ea15 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.org; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 网格人员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +public class CustomerStaffGridDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + /** + * 组织ID + */ + private String agencyId; + /** + * 网格ID + */ + private String gridId; + /** + * 上级组织ID + */ + private String pid; + /** + * 所有上级组织ID + */ + private String pids; + /** + * 用户id, user.id + */ + private String staffId; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java index f72d2f3667..ef83c2160b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/plugins/ScreenWorkRecordCommonFormDTO.java @@ -18,6 +18,14 @@ public class ScreenWorkRecordCommonFormDTO implements Serializable { * 组织Id或者网格id */ private String orgId; + /** + * org_id的上级 + */ + private String pid; + /** + * org_id的所有上级英文冒号或者顿号隔开都可 + */ + private String pids; /** * 组织名称或者网格名 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/UpdateProjectSatisfactionScoreFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/UpdateProjectSatisfactionScoreFormDTO.java new file mode 100644 index 0000000000..f7b43d8e2f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/form/UpdateProjectSatisfactionScoreFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.project.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/7/11 14:42 + */ +@Data +public class UpdateProjectSatisfactionScoreFormDTO implements Serializable { + private static final long serialVersionUID = 8358341102854725024L; + private String projectId; + private String projectCustomerId; + private List customerIdList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java index 65e98b940b..2a707f9540 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java @@ -15,11 +15,12 @@ * along with this program. If not, see . */ -package com.epmet.dto; +package com.epmet.dto.screen; + +import lombok.Data; import java.io.Serializable; import java.util.Date; -import lombok.Data; /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java index 29d988da64..9a1bc174c1 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenGovernRankDataDailyDTO.java @@ -99,6 +99,35 @@ public class ScreenGovernRankDataDailyDTO implements Serializable { */ private BigDecimal satisfactionRatio; + /** + * 响应数 + */ + private Integer responseCount; + /** + * 项目转入次数 + */ + private Integer transferCount; + /** + * 解决项目数 + */ + private Integer resolvedCount; + /** + * 已关闭项目数 + */ + private Integer closedCount; + /** + * 自治项目数 + */ + private Integer governCount; + /** + * 满意项目数 + */ + private Integer satisfactionCount; + /** + * 已关闭项目(由议题转的项目)数 + */ + private Integer closedProjectCount; + /** * 删除标识 0未删除;1已删除 */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java index 1d42d5964f..fe859bfac0 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java @@ -180,5 +180,9 @@ public class ScreenProjectDataDTO implements Serializable { private String topicId; private Integer responseCount; + /** + * 满意度得分 + */ + private BigDecimal satisfactionScore; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java index da4781f803..f0f6422e94 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java @@ -1,9 +1,11 @@ package com.epmet.dto.screen.form; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; +import java.util.Date; /** * @description: @@ -47,7 +49,8 @@ public class ScreenProjectDataInfoFormDTO implements Serializable { /** * 事件时间 */ - private String projectCreateTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date projectCreateTime; /** * 上报人 @@ -112,4 +115,9 @@ public class ScreenProjectDataInfoFormDTO implements Serializable { * 议题图片地址 */ private String[] projectImgUrl; + + /** + * 满意度得分 + */ + private BigDecimal satisfactionScore; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/GovernRankDataDailyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/GovernRankDataDailyFormDTO.java new file mode 100644 index 0000000000..f5b4cdb15d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/GovernRankDataDailyFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.screencoll.form; + +import com.epmet.dto.screen.ScreenGovernRankDataDailyDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 10:04 + */ +@Data +public class GovernRankDataDailyFormDTO implements Serializable { + + private static final long serialVersionUID = 3485797660632260565L; + /** + * 当为true时后台将删除本月数据 + */ + private Boolean isFirst; + + /** + * yyyyMMdd + */ + private String dateId; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java index 7e79fce0b8..2bb7b50684 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java @@ -90,4 +90,29 @@ public class PioneerDataFormDTO implements Serializable { * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) */ private String dataEndTime; + + /** + * V2升级新增字段, 详见说明文档,对应 platIssueTotal + */ + private Integer issueRatioFm; + + /** + * V2升级新增字段, 详见说明文档,对应 platTopicTotal + */ + private Integer topicRatioFm; + + /** + * V2升级新增字段, 详见说明文档,对应 platShiftProjectTotal + */ + private Integer shiftProjectRatioFm; + + /** + * V2升级新增字段, 详见说明文档,对应 platClosedProjectTotal + */ + private Integer resolvedProjectRatioFm; + + /** + * V2升级新增字段, 详见说明文档,对应 platPublishIssueTotal + */ + private Integer publishIssueRatioFm; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java index b160224471..ce78cc21ca 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java @@ -50,6 +50,16 @@ public class UserJoinFormDTO implements Serializable { */ private BigDecimal avgIssue; + /** + * 人均议题分子 + */ + private Integer avgIssueFz; + + /** + * 人均议题分母 + */ + private Integer avgIssueFm; + /** * 总的参与次数 */ @@ -59,4 +69,14 @@ public class UserJoinFormDTO implements Serializable { * 平均参与度 */ private BigDecimal avgJoin; + + /** + * 平均参与度分子 + */ + private Integer avgJoinFz; + + /** + * 平均参与度分母 + */ + private Integer avgJoinFm; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java new file mode 100644 index 0000000000..6beb42f54d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java @@ -0,0 +1,191 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +public class FactGridMemberStatisticsDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 项目立项数日增量 + */ + private Integer projectCountIncr; + + /** + * 议题转项目数日增量 + */ + private Integer issueToProjectIncr; + + /** + * 议题关闭数日增量 + */ + private Integer closedIssueIncr; + + /** + * 项目响应数日增量 + */ + private Integer projectResponseIncr; + + /** + * 项目吹哨数日增量 + */ + private Integer projectTransferIncr; + + /** + * 项目结案数日增量 + */ + private Integer projectClosedIncr; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java new file mode 100644 index 0000000000..c5d1e237a7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java @@ -0,0 +1,146 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +public class FactGridMemberStatisticsMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java new file mode 100644 index 0000000000..576a4eb8a3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto.stats.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @Description 数据上报--网格员事件总数上报-接口入参 + * @Auth sun + */ +@Data +public class GmUploadDataFormDTO implements Serializable { + private static final long serialVersionUID = -9178779369245037701L; + /** + * 为true时需要删除历史数据 + */ + private Boolean isFirst; + //数据集合对象 + @NotEmpty(message = "数据集合对象不能为空",groups = UploadData.class) + private List dataList; + public interface UploadData extends CustomerClientShowGroup {} + + @Data + public static class DataList{ + //来源类型 external:外部,internal:内部 + private String sourceType; + //客户Id 【dim_customer.id】[接口传入的是来源数据的客户Id] + private String customerId; + //数据来源客户Id + private String parentCustomerId; + //机关Id 【dim_agency.id】 + private String agencyId; + //日维度Id 【dim_date.id】 + private String dateId; + //月维度Id 【dim_month.id】 + private String monthId; + //年维度Id 【dim_year.id】 + private String yearId; + //网格id + private String gridId; + //上级ID(网格所属Agency的上级组织Id) + private String pid; + //所有agencyId的上级组织ID(包含agencyId) + private String pids; + //工作人员id + private String staffId; + //工作人员姓名 + private String staffName; + //项目立项数,截止到当前dateId的总数 + private Integer projectCount; + //议题转项目数,截止到当前dateId的总数 + private Integer issueToProjectCount; + //议题关闭数,截止到当前dateId的总数 + private Integer closedIssueCount; + //项目响应数,截止到当前dateId的总数 + private Integer projectResponseCount; + //项目吹哨数,截止到当前dateId的总数 + private Integer projectTransferCount; + //项目结案数,dateId这一天的增量 + private Integer projectClosedCount; + //项目立项数,dateId这一天的增量 + private Integer projectIncr; + //议题转项目数,dateId这一天的增量 + private Integer issueToProjectIncr; + //议题关闭数,dateId这一天的增量 + private Integer closedIssueIncr; + //项目响应数,dateId这一天的增量 + private Integer projectResponseIncr; + //项目吹哨数,dateId这一天的增量 + private Integer projectTransferIncr; + //项目结案数,截止到当前dateId的总数 + private Integer projectClosedIncr; + + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java new file mode 100644 index 0000000000..d4ece8c8e5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto.stats.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 数据上报--网格员事件总数上报-接口入参 + * @Auth sun + */ +@Data +public class GmUploadEventFormDTO implements Serializable { + private static final long serialVersionUID = -9178779369245037701L; + //为true时需要删除历史数据 + private Boolean isFirst; + //数据集合对象 + @NotEmpty(message = "数据集合对象不能为空",groups = UploadEvent.class) + private List dataList; + public interface UploadEvent extends CustomerClientShowGroup {} + + @Data + public static class DataList{ + //来源类型 external:外部,internal:内部 + private String sourceType; + //客户Id 【dim_customer.id】[接口传入的是来源数据的客户Id] + private String customerId; + //数据来源客户Id + private String parentCustomerId; + //机关Id 【dim_agency.id】 + private String agencyId; + //日维度Id 【dim_date.id】 + private String dateId; + //周维度Id 【dim_week.id】 + private String weekId; + //月维度Id 【dim_month.id】 + private String monthId; + //季ID + private String quarterId; + //年维度Id 【dim_year.id】 + private String yearId; + //网格id + private String gridId; + //网格所有上级id + private String gridPids; + //产品这边工作人员用户id + private String staffId; + //巡查次数 + private Integer patrolTotal = 0; + //巡查时长 单位:秒 + private Integer totalTime = 0; + //事件数【立项项目数】 + private Integer reportProjectCount = 0; + //最新的巡查开始时间 + private Date latestPatrolTime; + //最新的巡查状态 正在巡查中:patrolling;结束:end + private String latestPatrolStatus = "end"; + + } + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerGridStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerGridStaffDTO.java new file mode 100644 index 0000000000..defbb16696 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerGridStaffDTO.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 政府工作人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-18 + */ +@Data +public class CustomerGridStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属组织id + */ + private String agencyId; + + /** + * 网格所属的所有组织id + */ + private String gridPids; + + /** + * 关联User表的主键Id + */ + private String userId; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java new file mode 100644 index 0000000000..a5458793dd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java @@ -0,0 +1,137 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 政府工作人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-18 + */ +@Data +public class CustomerStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 关联User表的主键Id + */ + private String userId; + + /** + * 真实姓名 + */ + 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; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffPatrolRecordResult.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffPatrolRecordResult.java new file mode 100644 index 0000000000..7239e34792 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffPatrolRecordResult.java @@ -0,0 +1,122 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Data +public class StaffPatrolRecordResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java new file mode 100644 index 0000000000..ba18432357 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/7/5 9:49 + */ +@Data +public class StaffRoleInfoDTO implements Serializable { + private static final long serialVersionUID = 5005209786187370928L; + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 用户ID + */ + private String staffId; + + /** + * 用户名 + */ + private String staffName; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java new file mode 100644 index 0000000000..64d3eb84e4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java @@ -0,0 +1,157 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +@Data +public class StatsStaffPatrolRecordDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 来源客户Id + */ + private String sourceCustomerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index dfafe94a1e..93d81104d5 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -3,13 +3,13 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; -import com.epmet.dto.extract.form.ExtractIndexFormDTO; -import com.epmet.dto.extract.form.ExtractOriginFormDTO; -import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack; +import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -22,7 +22,8 @@ import org.springframework.web.bind.annotation.RequestBody; * @author: jianjun liu */ //url="http://localhost:8108" -@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class) +//@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class, url = "http://localhost:6666") +@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = DataStatisticalOpenFeignClientFallBackFactory.class) public interface DataStatisticalOpenFeignClient { /** @@ -256,4 +257,21 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/vanguard/gridvanguardstats") Result gridVanguardStats(@RequestBody StatsFormDTO formDTO); + /** + * desc: 业务库按天统计 统一入库 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2021/7/2 3:04 下午 + */ + @PostMapping("/data/stats/bizData/stats/daily") + Result exeStatsDaily(@RequestBody BizDataFormDTO formDTO); + + /** + * @dscription 小组总数日统计和热议话题日统计任务 + * @author sun + */ + @PostMapping("/data/stats/statsgroup/groupandhottopic") + Result groupAndHotTopicTask(@RequestBody GroupTotalFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index d842746b35..7bf37b9ce7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -4,10 +4,9 @@ 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.StatsFormDTO; -import com.epmet.dto.extract.form.ExtractIndexFormDTO; -import com.epmet.dto.extract.form.ExtractOriginFormDTO; -import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; @@ -21,7 +20,7 @@ import org.springframework.stereotype.Component; * @author: jianjun liu * email:liujianjun@git.elinkit.com.cn */ -@Component +//@Component public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOpenFeignClient { /** @@ -256,4 +255,14 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result gridVanguardStats(StatsFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "gridVanguardStats", formDTO); } + + @Override + public Result exeStatsDaily(BizDataFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "exeStatsDaily", formDTO); + } + + @Override + public Result groupAndHotTopicTask(GroupTotalFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAndHotTopic", formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java new file mode 100644 index 0000000000..70768329c8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java @@ -0,0 +1,20 @@ +package com.epmet.feign.impl; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class DataStatisticalOpenFeignClientFallBackFactory implements FallbackFactory { + + private DataStatisticalOpenFeignClientFallBack fallback = new DataStatisticalOpenFeignClientFallBack(); + + @Override + public DataStatisticalOpenFeignClient create(Throwable cause) { + log.error(ExceptionUtils.getThrowableErrorStackTrace(cause));//自己写的工具类 + return fallback; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml index 670c9b1d5c..6e0f1082aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml @@ -9,10 +9,10 @@ services: volumes: - "/opt/epmet-cloud-logs/prod:/logs" environment: - RUN_INSTRUCT: "java -Xms256m -Xmx1024m -jar ./data-stats.jar" + RUN_INSTRUCT: "java -Xms256m -Xmx1524m -jar ./data-stats.jar" restart: "unless-stopped" deploy: resources: limits: cpus: '0.1' - memory: 1100M + memory: 1600M diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index d1b4c185c8..97f6c5eb85 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -256,6 +256,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.1.140:9876;192.168.1.141:9876 @@ -375,6 +376,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + local 192.168.1.140:9876;192.168.1.141:9876 @@ -493,6 +495,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.10.161:9876 @@ -609,6 +612,7 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + true 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java new file mode 100644 index 0000000000..0c6669c3bd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/BaseReportConstant.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/6/24 5:19 下午 + * @DESC + */ +public interface BaseReportConstant { + + String DATA_IS_NULL = "上传%s数据为空"; + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java new file mode 100644 index 0000000000..9219f505a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/GovernConstant.java @@ -0,0 +1,16 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/7/9 3:24 下午 + * @DESC + */ +public interface GovernConstant { + + /** + * 增长:incr;下降:decr; 相等 :eq; + */ + String INCR = "incr"; + String DECR = "decr"; + String EQ = "eq"; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java new file mode 100644 index 0000000000..7fe1add999 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java @@ -0,0 +1,46 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.BizDataFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description 用户统计 + * @ClassName StatsUserController + * @Auth wangc + * @Date 2020-06-23 15:18 + */ +@RestController +@RequestMapping("bizData/stats") +public class BizDataStatsController { + + @Autowired + private BizDataStatsService bizDataStatsService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 业务库统计数据 统一入库 + * @Date 2021/3/26 13:27 + **/ + @RequestMapping("daily") + public Result execute(@RequestBody BizDataFormDTO formDTO) { + bizDataStatsService.exeDailyAll(formDTO); + return new Result(); + } /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + **/ + @RequestMapping("patrol") + public Result execute(@RequestBody StaffPatrolStatsFormDTO formDTO) { + bizDataStatsService.executeStaffPatrolStats(formDTO); + return new Result(); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index a5317f5ba2..ca81ce0ba7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; @@ -22,7 +23,9 @@ import com.epmet.dto.StatsFormDTO; import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.form.SyncOrgInfoFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.project.form.UpdateProjectSatisfactionScoreFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; @@ -42,9 +45,13 @@ import com.epmet.service.evaluationindex.extract.todata.*; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.screen.*; +import com.epmet.service.org.CustomerAgencyService; +import com.epmet.service.org.CustomerGridService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; +import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -121,6 +128,10 @@ public class DemoController { private FactGridGovernDailyService factGridGovernDailyService; @Autowired private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Autowired + private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; + @Autowired + private DimCustomerService dimCustomerService; @GetMapping("testAlarm") public void testAlarm() { @@ -936,4 +947,57 @@ public class DemoController { return new Result(); } + @PostMapping("extractFactGridMemberDaily") + public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){ + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId()); + return new Result(); + } + + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 将产品内部客户,来源于议题并且已结案的项目,赋值满意度得分 + * @Date 2021/6/23 15:55 + **/ + @PostMapping("update-satisfaction-core") + public Result updateProjectSatisfactionScore(@RequestBody UpdateProjectSatisfactionScoreFormDTO formDTO){ + if(StringUtils.isNotBlank(formDTO.getProjectId())){ + screenProjectSettleService.updateProjectSatisfactionScore(formDTO.getProjectCustomerId(),null,formDTO.getProjectId()); + return new Result().ok("项目满意度得分更新成功"); + } + if(CollectionUtils.isNotEmpty(formDTO.getCustomerIdList())){ + formDTO.getCustomerIdList().forEach(customerId->{ + screenProjectSettleService.updateProjectSatisfactionScore(customerId,null,null); + log.info("更新完成"); + }); + }else{ + List customerIds=dimCustomerService.getAllCustomerId(); + customerIds.forEach(customerId->{ + screenProjectSettleService.updateProjectSatisfactionScore(customerId,null,null); + log.info("所有客户数据更新完成"); + }); + } + return new Result(); + } + + @Autowired + private CustomerAgencyService customerAgencyService; + @Autowired + private CustomerGridService customerGridService; + + + /** + * 将孔村、榆山、锦水3个街道的网格、组织插入到gov-org库的customer_grid、customer_agency + * + * @param formDTO + * @return Result + */ + @PostMapping("syncorginfo") + public Result syncOrgInfo(@RequestBody SyncOrgInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + customerAgencyService.sysAgencyInfo(formDTO.getFromCustomerId(), formDTO.getToCustomerId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 2cce1d4a19..49d462eaa0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.*; +import com.epmet.service.stats.DimCustomerService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -35,6 +36,8 @@ public class FactOriginExtractController { private ProjectExtractService projectExtractService; @Autowired private GroupExtractService groupExtractService; + @Autowired + private DimCustomerService dimCustomerService; /** * desc:抽取业务数据到统计库 @@ -92,7 +95,12 @@ public class FactOriginExtractController { @PostMapping("project") public Result projectData(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { - projectExtractService.saveOriginProjectDaily(extractOriginFormDTO); + List customerIds = dimCustomerService.selectCustomerIdPage(1, 100); + customerIds.forEach(customerId -> { + ExtractOriginFormDTO dto = new ExtractOriginFormDTO(); + dto.setCustomerId(customerId); + projectExtractService.saveOriginProjectDaily(dto); + }); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java index 9896ae6290..baa6fb21d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java @@ -1,10 +1,15 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.group.form.GroupTotalFormDTO; +import com.epmet.dto.stats.topic.form.TopicStatusFormDTO; import com.epmet.service.StatsGroupService; +import com.epmet.service.StatsTopicService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -18,9 +23,11 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("statsgroup") public class StatsGroupController { - + Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private StatsGroupService statsGroupService; + @Autowired + private StatsTopicService statsTopicService; /** * 网格数、小组数、网格下所有组内人数(不去重) @@ -81,5 +88,39 @@ public class StatsGroupController { return new Result(); } + /** + * @dscription 小组总数日统计和热议话题日统计任务 + * @author sun + */ + @PostMapping("/groupandhottopic") + public Result groupAndHotTopic(GroupTotalFormDTO formDTO) { + try { + statsGroupService.gridGroupTotal(formDTO); + logger.info("小组总数-网格日统计任务成功"); + } catch (Exception e) { + logger.error("小组总数-网格日统计任务:", e); + } + try { + statsGroupService.agencyGroupTotal(formDTO); + logger.info("小组总数-机关日统计任务成功"); + } catch (Exception e) { + logger.error("小组总数-机关日统计任务失败:", e); + } + TopicStatusFormDTO topic = ConvertUtils.sourceToTarget(formDTO, TopicStatusFormDTO.class); + try { + statsTopicService.gridTopicStatus(topic); + logger.info("热议中话题-网格日统计任务成功"); + } catch (Exception e) { + logger.error("热议中话题-网格日统计任务失败:", e); + } + try { + statsTopicService.agencyTopicStatus(topic); + logger.info("热议中话题-机关日统计任务成功"); + } catch (Exception e) { + logger.error("热议中话题-机关日统计任务失败:", e); + } + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java deleted file mode 100644 index 9c521b770a..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.epmet.controller; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.StatsFormDTO; -import com.epmet.service.StatsUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @Description 用户统计 - * @ClassName StatsUserController - * @Auth wangc - * @Date 2020-06-23 15:18 - */ -@RestController -@RequestMapping("statsuser") -public class StatsUserController { - - @Autowired - private StatsUserService statsUserService; - - /** - * @return com.epmet.commons.tools.utils.Result - * @param formDTO - * @description 工作端数据一期,用户分析:参与用户、注册用户分析 - * @Date 2021/3/26 13:27 - **/ - @RequestMapping("execute") - public Result execute(@RequestBody StatsFormDTO formDTO) { - statsUserService.partition(formDTO); - return new Result(); - } -} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java index 5b862b66ec..b2b4d55d18 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java new file mode 100644 index 0000000000..47610548ca --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java @@ -0,0 +1,201 @@ +package com.epmet.controller.external; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.basereport.form.*; +import com.epmet.service.BaseReportService; +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 sun + * @Description 部分基础数据上报 + */ +@RestController +@RequestMapping("basereport") +public class BaseReportController { + + @Autowired + private BaseReportService baseReportService; + + /** + * @Param formDTO + * @Description 网格注册用户数据 + * @author sun + */ + @PostMapping("gridreguser") + public Result gridRegUser(@RequestBody GridRegUserFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridRegUserFormDTO.saveList.class); + baseReportService.gridRegUser(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 组织机关注册用户数据 + * @author sun + */ + @PostMapping("agencyreguser") + public Result agencyRegUser(@RequestBody AgencyRegUserFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyRegUserFormDTO.saveList.class); + baseReportService.agencyRegUser(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 网格群组总数 + * @author sun + */ + @PostMapping("gridgrouptotal") + public Result gridGroupTotal(@RequestBody GridGroupTotalFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridGroupTotalFormDTO.saveList.class); + baseReportService.gridGroupTotal(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 组织群组总数 + * @author sun + */ + @PostMapping("agencygrouptotal") + public Result agencyGroupTotal(@RequestBody AgencyGroupTotalFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyGroupTotalFormDTO.saveList.class); + baseReportService.agencyGroupTotal(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 网格热议话题数据 + * @author sun + */ + @PostMapping("gridhottopic") + public Result gridHotTopic(@RequestBody GridHotTopicFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridHotTopicFormDTO.saveList.class); + baseReportService.gridHotTopic(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 组织热议话题数据 + * @author sun + */ + @PostMapping("agencyhottopic") + public Result agencyHotTopic(@RequestBody AgencyHotTopicFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyHotTopicFormDTO.saveList.class); + baseReportService.agencyHotTopic(formDTO); + return new Result(); + } + + /** + * @Description 网格状态话题数据-008 + * @Param formDTO + * @author zxc + * @date 2021/6/25 3:09 下午 + */ + @PostMapping("gridtopicstatus") + public Result gridTopicStatus(@RequestBody GridTopicStatusFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridTopicStatusFormDTO.GridTopicStatusForm.class); + baseReportService.gridTopicStatus(formDTO); + return new Result(); + } + + /** + * @Description 组织状态话题数据-007 + * @Param formDTO + * @author zxc + * @date 2021/6/25 3:09 下午 + */ + @PostMapping("agencytopicstatus") + public Result agencyTopicStatus(@RequestBody AgencyTopicStatusFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyTopicStatusFormDTO.AgencyTopicStatusForm.class); + baseReportService.agencyTopicStatus(formDTO); + return new Result(); + } + + /** + * @Description 网格话题转议题数据-006 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:51 下午 + */ + @PostMapping("gridtopicissue") + public Result gridTopicIssue(@RequestBody GridTopicIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridTopicIssueFormDTO.GridTopicIssueForm.class); + baseReportService.gridTopicIssue(formDTO); + return new Result(); + } + + /** + * @Description 组织话题转议题数据-005 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("agencytopicissue") + public Result agencyTopicIssue(@RequestBody AgencyTopicIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyTopicIssueFormDTO.AgencyTopicIssueForm.class); + baseReportService.agencyTopicIssue(formDTO); + return new Result(); + } + + /** + * @Description 网格议题数据-004 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("gridissue") + public Result gridIssue(@RequestBody GridIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridIssueFormDTO.GridIssueForm.class); + baseReportService.gridIssue(formDTO); + return new Result(); + } + + /** + * @Description 组织议题数据-003 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("agencyissue") + public Result agencyIssue(@RequestBody AgencyIssueFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyIssueFormDTO.AgencyIssueForm.class); + baseReportService.agencyIssue(formDTO); + return new Result(); + } + + /** + * @Description 网格项目数据-002 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("gridproject") + public Result gridProject(@RequestBody GridProjectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GridProjectFormDTO.GridProjectForm.class); + baseReportService.gridProject(formDTO); + return new Result(); + } + + /** + * @Description 组织项目数据-001 + * @Param formDTO + * @author zxc + * @date 2021/6/25 1:50 下午 + */ + @PostMapping("agencyproject") + public Result agencyProject(@RequestBody AgencyProjectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyProjectFormDTO.AgencyProjectForm.class); + baseReportService.agencyProject(formDTO); + return new Result(); + } + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java index 77f2ce51ec..f9e58a7df2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.indexcollect.form.*; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java new file mode 100644 index 0000000000..3c94792afa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java @@ -0,0 +1,73 @@ +package com.epmet.controller.external; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; +import com.epmet.dto.extract.form.GridGovernDailyFormDTO; +import com.epmet.dto.screencoll.form.GovernRankDataDailyFormDTO; +import com.epmet.service.GovernanceDataReportService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 治理能力数据上报 + * + * @author zhaoqifeng + * @date 2021/6/24 15:16 + */ +@RestController +@RequestMapping("governance") +public class GovernanceDataReportController { + + @Resource + private GovernanceDataReportService governanceDataReportService; + + + /** + * 基层治理-治理能力排行数据(按天统计) + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/24 10:02 + */ + @PostMapping("governrankdatadaily") + public Result governRankDataDaily(@RequestHeader("CustomerId") String customerId, @RequestBody GovernRankDataDailyFormDTO formDTO) { + governanceDataReportService.insertGovernRankDataDaily(formDTO, customerId); + return new Result(); + } + + + /** + * 组织的治理指数,按天统计 + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/24 15:38 + */ + @PostMapping("agencygoverndaily") + public Result agencyGovernDaily(@RequestHeader("CustomerId") String customerId, @RequestBody AgencyGovernDailyFormDTO formDTO) { + governanceDataReportService.insertAgencyGovernDaily(formDTO, customerId); + return new Result(); + } + + /** + * 网格的治理指数,按天统计 + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/24 15:38 + */ + @PostMapping("gridgoverndaily") + public Result gridGovernDaily(@RequestHeader("CustomerId") String customerId, @RequestBody GridGovernDailyFormDTO formDTO) { + governanceDataReportService.insertGridGovernDaily(formDTO, customerId); + return new Result(); + } + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java similarity index 97% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java index 9f2a4b06cd..29267ca44e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.RenException; @@ -147,7 +147,11 @@ public class IndexCalculateController { long start = System.currentTimeMillis(); Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); if (aBoolean) { - log.error("客户Id:{},monthId:{},全部指标计算完成,结果:{},总耗时:{}秒", formDTO.getCustomerId(), formDTO.getMonthId(), aBoolean, (System.currentTimeMillis() - start) / 1000); + log.error("客户Id:{},monthId:{},全部指标计算完成,结果:{},总耗时:{}秒", + formDTO.getCustomerId(), + formDTO.getMonthId(), + aBoolean, + (System.currentTimeMillis() - start) / 1000); } redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId())); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java similarity index 98% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java index 34269ee507..766a21dfa7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -27,13 +27,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_platform_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("homepage/platformsummary") public Result platFormSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -48,13 +48,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_issue_summary_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("issue/summary") public Result issueSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -69,13 +69,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table: screen_kc_issue_trend_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("issue/trend") public Result issueTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -90,13 +90,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_user_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("user/summary") public Result userSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -111,13 +111,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_volunteer_heat_rank_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("volunteer/heartrank") public Result volunteerHeartRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -132,13 +132,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_user_trend_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("user/userheartrank") public Result userHeartRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -153,13 +153,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_act_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("act/summary") public Result actSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -174,13 +174,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_act_trend_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("act/trend") public Result actTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -195,13 +195,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_volunteer_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("act/volunteersummary") public Result volunteerSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -216,13 +216,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_project_summary_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("project/summary") public Result projectSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -237,13 +237,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_project_category_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("project/categorysummary") public Result categorySummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -258,13 +258,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_project_satis_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("project/satisanalysis") public Result projectSatisanalysis(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -279,13 +279,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/summary") public Result newsSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -300,13 +300,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_trend_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/trend") public Result newsTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -321,13 +321,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_rank * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/hotrank") public Result newsHotRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -342,13 +342,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_category_analysis * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/categoryanalysis") public Result newsCategoryAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -363,13 +363,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_group_summary_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("group/summary") public Result groupSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -384,13 +384,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_group_detail_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("group/detail") public Result groupDetail(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -405,13 +405,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_topic_trend_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("group/topictrend") public Result groupTopicTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java index db45cca198..7d4c7e9c71 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java index 6cdc9ca44a..f142adbf6d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java new file mode 100644 index 0000000000..47ef13932f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java @@ -0,0 +1,65 @@ +package com.epmet.controller.external; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; +import com.epmet.service.StatsUserService; +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; + +/** + * @Description 用户统计 + * @ClassName StatsUserController + * @Auth wangc + * @Date 2020-06-23 15:18 + */ +@RestController +@RequestMapping("statsuser") +public class StatsUserController { + + @Autowired + private StatsUserService statsUserService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + * 自用的方法 不暴漏 + **/ + @RequestMapping("execute") + public Result execute(@RequestBody StatsFormDTO formDTO) { + statsUserService.partition(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + @PostMapping("gm-uploadevent") + public Result gmUploadEvent(@RequestBody GmUploadEventFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GmUploadEventFormDTO.UploadEvent.class); + statsUserService.gmUploadEvent(formDTO); + return new Result(); + } + + /** + * @Param formDTO + * @Description 数据上报--网格员数据分析上报 + * @author sun + */ + @PostMapping("gm-uploaddata") + public Result gmUploadData(@RequestBody GmUploadDataFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GmUploadDataFormDTO.UploadData.class); + statsUserService.gmUploadData(formDTO); + return new Result(); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java similarity index 97% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java index 33e7c281aa..02df903121 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.plugins; +package com.epmet.controller.external.plugins; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -19,16 +19,16 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("plugins/ofs") public class OfsController { - + @Autowired private OfsService ofsService; - + /** * @param customerId * @param formDTO * @author yinzuomei * @description 【146】一张清单 isFirst=true时,根据customerId先删除后增加 - * @Date 2021/1/22 10:19 + * @Date 2021/1/22 10:19 **/ @PostMapping("onelist-daily") public Result collOneList(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java similarity index 96% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java index 8bbce3e324..5ed27c3930 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.plugins; +package com.epmet.controller.external.plugins; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -35,7 +35,7 @@ public class WorkRecordColController { * 按月上传工作日志统计数据时,同步调用此接口上传字典信息 * @param customerId * @param data - * @return com.epmet.commons.tools.utils.Result + * @return com.epmet.commons.tools.utils.Result * @author wangc * @date 2021.02.04 16:16 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java index 11ec9c119c..db7fab8791 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.crm; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.entity.crm.CustomerRelationEntity; import org.apache.ibatis.annotations.Mapper; @@ -51,4 +52,11 @@ public interface CustomerRelationDao extends BaseDao { * @date 2021/3/23 上午10:21 */ List selectSubCustomer(@Param("customerId") String customerId); + + /** + * @Description 查询客户所属父客户信息 + * @author sun + */ + CustomerRelationDTO selectByCustomerId(@Param("customerId") String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java new file mode 100644 index 0000000000..111f4d923a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Mapper +public interface FactGridMemberStatisticsDailyDao extends BaseDao { + int deleteDataByCustomer(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("deleteSize") Integer deleteSize); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java new file mode 100644 index 0000000000..9d15a1cab5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Mapper +public interface FactGridMemberStatisticsMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 7154f5997e..5e9177adf7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.IssueLogDailyFormDTO; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -130,4 +131,43 @@ public interface FactOriginIssueLogDailyDao extends BaseDao + */ + List getIssueToProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 议题转项目增量 + * @author zhaoqifeng + * @date 2021/7/5 15:55 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getIssueToProjectIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 关闭议题数总量 + * @author zhaoqifeng + * @date 2021/7/5 16:37 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getClosedIssueCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 关闭议题数增量 + * @author zhaoqifeng + * @date 2021/7/5 16:38 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getClosedIssueIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java index ba3ddbce69..42e671c2b7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java @@ -135,23 +135,31 @@ public interface FactOriginIssueMainDailyDao extends BaseDao + */ + List getProjectResponseCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目响应增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectResponseIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目吹哨数 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectTransferCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目吹哨数增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectTransferIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目结案数 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectClosedCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目结案数增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectClosedIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 1c4aa60c18..7e8311778c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -122,6 +122,7 @@ public interface FactOriginProjectMainDailyDao extends BaseDao + */ + List getMemberProjectCountIncr(@Param("customerId")String customerId, @Param("dateId") String dateId); + + /** + * 获取项目立项数 + * @author zhaoqifeng + * @date 2021/7/5 14:49 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getMemberProjectCount(@Param("customerId")String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index b0dedb0db5..e6155e982e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; @@ -34,7 +35,6 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; /** * 组织机构信息 @@ -231,4 +231,17 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectByPid(@Param("customerId") String customerId, @Param("parentAgencyId")String parentAgencyId); + + List selectKcCommunity(String customerId); + + /** + * @Description 查询客户index库组织信息供数据封装使用 + * @author sun + */ + List selectByCustomerId(@Param("customerId") String customerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index 6aa2aacc1c..f45ebc06e4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -18,11 +18,11 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.dto.screen.ScreenProjectGridDailyDTO; import com.epmet.dto.screencoll.form.CustomerGridFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; @@ -216,4 +216,6 @@ public interface ScreenCustomerGridDao extends BaseDao * @date 2021/6/10 10:45 上午 */ List selectGridInfoList(@Param("customerId") String customerId, @Param("pids") String pids); + + List selectEntityByAgencyId(@Param("customerId") String customerId, @Param("parentAgencyId") String parentAgencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index 1cdb4a1e8d..4083242997 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -18,12 +18,12 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -46,4 +46,24 @@ public interface ScreenProjectDataDao extends BaseDao { void insertBatch(@Param("list") List list); void updateBatch(@Param("list") List list,@Param("dateId") String dateId); + + /** + * 根据项目ID删除数据 + * @author zhaoqifeng + * @date 2021/7/9 17:33 + * @param projectId + * @return int + */ + int deleteByProjectId(@Param("customerId") String customerId, @Param("projectId") String projectId); + + /** + * 根据项目ID删除数据 + * @author zhaoqifeng + * @date 2021/7/9 17:33 + * @param list + * @return int + */ + void deleteByProjectIds(@Param("customerId") String customerId, @Param("list") List list); + + int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java index 4904f32724..ff563a9f6e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java @@ -37,4 +37,6 @@ public interface ScreenProjectImgDataDao extends BaseDao list); void insertBatch(@Param("list") List list); + + int deleteByProjectId(@Param("customerId") String customerId, @Param("projectId") String projectId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java index b63726e8ac..02757feb13 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserJoinDao.java @@ -37,7 +37,6 @@ public interface ScreenUserJoinDao extends BaseDao { * 11、基层治理-公众参与 * 0) 查询上月的基础数据,可用来计算本月的增长率 * @param customerId - * @param yearId * @param monthId * @param orgIds 组织Id集合 * @return java.util.List @@ -45,7 +44,6 @@ public interface ScreenUserJoinDao extends BaseDao { * @Date 14:46 2020-08-21 **/ List selectLastMonthScreenUserJoinList(@Param("customerId") String customerId, - @Param("yearId") String yearId, @Param("monthId") String monthId, @Param("orgIds") String[] orgIds); @@ -62,6 +60,17 @@ public interface ScreenUserJoinDao extends BaseDao { Integer deleteUserJoin(@Param("customerId") String customerId, @Param("monthId") String monthId); + /** + * @Description 根据类别删除 + * @Param customerId + * @Param monthId + * @Param delFlag + * @author zxc + * @date 2021/7/9 2:21 下午 + */ + Integer deleteUserJoinByCategory(@Param("customerId") String customerId,@Param("monthId") String monthId, + @Param("delFlag") String delFlag); + /** * 11、基层治理-公众参与 * 2) 在批量新增 @@ -72,4 +81,14 @@ public interface ScreenUserJoinDao extends BaseDao { * @Date 10:52 2020-08-18 **/ void batchInsertUserJoin(@Param("list") List list, @Param("customerId")String customerId); + + /** + * @Description 根据月份查询screenUserJoin + * @Param customerId + * @Param monthId + * @Param flag :agency : grid + * @author zxc + * @date 2021/7/9 3:13 下午 + */ + List selectScreenUserJoin(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("flag")String flag); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index 875efb82e1..ac3043d843 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -26,7 +26,8 @@ public interface StatsIssueDao extends BaseDao { * @author zhaoqifeng * @date 2020/6/17 14:13 */ - List selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date); + List selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date, + @Param("gridList") List gridList); /** * 获取当前日期组织下议题增量 @@ -37,7 +38,8 @@ public interface StatsIssueDao extends BaseDao { * @author zhaoqifeng * @date 2020/6/18 9:55 */ - List selectAgencyIssueInc(@Param("customerId") String customerId, @Param("date") String date); + List selectAgencyIssueInc(@Param("customerId") String customerId, @Param("date") String date, + @Param("gridList") List gridList); /** * 已关闭议题统计 @@ -48,7 +50,8 @@ public interface StatsIssueDao extends BaseDao { * @author zhaoqifeng * @date 2020/6/18 14:41 */ - List selectAgencyClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date); + List selectAgencyClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date, + @Param("gridList") List gridList); /** * 已关闭议题增量 @@ -59,7 +62,8 @@ public interface StatsIssueDao extends BaseDao { * @author zhaoqifeng * @date 2020/6/18 14:41 */ - List selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); + List selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date, + @Param("gridList") List gridList); /** * @param issueEntity @@ -181,4 +185,14 @@ public interface StatsIssueDao extends BaseDao { List selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId); List selectCategory(@Param("customerId") String customerId, @Param("ids") Set set); + + + List getIssueTotalList(@Param("customerId") String customerId, @Param("date") String date); + + /** + * @Author sun + * @Description 查询议题库已删除网格下可能存在的项目Id集合 + **/ + List selectProjectByGrids(@Param("gridIds") List gridIds); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java index b8d9093631..a2123a127f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -77,4 +78,21 @@ public interface CustomerGridDao extends BaseDao { * @Date 2020/9/16 14:03 **/ List selectListGridInfo(String customerId); + + /** + * 查询工作人员网格关系 + * @author zhaoqifeng + * @date 2021/7/5 10:25 + * @param customerId + * @return java.util.List + */ + List getCustomerStaffGridList(@Param("customerId") String customerId); + + List getDelGridList(@Param("customerId") String customerId); + + /** + * @Author sun + * @Description 查询客户已删除网格列表 + **/ + List selectDelGridList(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java new file mode 100644 index 0000000000..20e3c6310a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.org; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; +import com.epmet.entity.org.CustomerStaffGridEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 客户网格人员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface CustomerStaffGridDao extends BaseDao { + + List selectGridStaffList(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index fc575d3024..5745ff7cca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -69,4 +69,6 @@ public interface StatsCustomerAgencyDao extends BaseDao { * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity */ CustomerAgencyEntity selectByDeptId(String deptId); + + CustomerAgencyEntity selecByAreaCode(@Param("customerId")String customerId, @Param("areaCode")String areaCode); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index 44e47f6f92..704aa3ee26 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -18,20 +18,17 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.ProjectDTO; -import com.epmet.dto.ProjectSatisfactionStatisticsDTO; import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.dto.project.ProjectCategoryDTO; import com.epmet.dto.project.ProjectGridDTO; import com.epmet.dto.project.ProjectPointDTO; import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; -import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -52,110 +49,149 @@ public interface ProjectDao extends BaseDao { /** * 已结案项目统计 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectAgencyClosedProjectTotal(@Param("customerId") String customerId, @Param("date") String date); /** * 已结案项目增量 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectAgencyClosedProjectInc(@Param("customerId") String customerId, @Param("date") String date); /** * 已结案项目统计 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectGridClosedProjectTotal(@Param("customerId") String customerId, @Param("date") String date); /** * 已结案项目增量 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectGridClosedProjectInc(@Param("customerId") String customerId, @Param("date") String date); /** * 获取项目信息 - * @author zhaoqifeng - * @date 2020/9/15 16:13 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/9/15 16:13 */ List selectProjectInfo(@Param("customerId") String customerId, @Param("date") String date); /** * 获取用户可滞留天数 - * @author zhaoqifeng - * @date 2020/9/28 10:16 + * * @param customerId * @return java.lang.String + * @author zhaoqifeng + * @date 2020/9/28 10:16 */ String selectParameterValueByKey(@Param("customerId") String customerId); /** - * @Description 查找客户项目超期参数 - * * @param customerId * @return java.util.List + * @Description 查找客户项目超期参数 * @author wangc * @date 2021.03.05 17:52 - */ + */ List selectProjectExceedParams(@Param("customerId") String customerId); /** - * @Description 批量查询项目信息 * @param ids * @return java.util.List + * @Description 批量查询项目信息 * @author wangc * @date 2021.03.08 10:32 - */ - List batchSelectProjectInfo(@Param("ids")List ids); + */ + List batchSelectProjectInfo(@Param("ids") List ids); /** - * @Description 查询项目的分类信息 * @param list * @return java.util.List + * @Description 查询项目的分类信息 * @author wangc * @date 2021.03.08 23:44 - */ - List selectProjectCategory(@Param("list")List list); + */ + List selectProjectCategory(@Param("list") List list); List getProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId); /** * 获取项目满意度 - * @author zhaoqifeng - * @date 2021/5/21 10:06 + * * @param customerId * @return java.util.List + * @author zhaoqifeng + * @date 2021/5/21 10:06 */ List selectProjectSatisfaction(@Param("customerId") String customerId); /** * 根据key查找value - * @author zhaoqifeng - * @date 2021/5/21 10:58 + * * @param customerId * @param parameterKey * @return java.lang.String + * @author zhaoqifeng + * @date 2021/5/21 10:58 */ String selectValueByKey(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey); + + List selectProjectListByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("projectOrigin") String projectOrigin); + + /** + * 计算某个项目的群满意度得分 + * + * @param customerId + * @param projectId + * @return 得分 + */ + BigDecimal selectProjectSatisfactionScore(@Param("customerId")String customerId, + @Param("projectId")String projectId); + + /** + * 查询当天(dateId)有评价记录的项目id + * + * @param customerId + * @param dateId + * @return + */ + List selectEvaluateProjectIds(@Param("customerId") String customerId, @Param("dateId")String dateId); + + /** + * 可根据状态筛选项目id + * + * @param customerId + * @param projectStatus 状态:待处理 pending,结案closed + * @return + */ + List selectClosedProjectIds(@Param("customerId")String customerId, + @Param("origin")String origin, + @Param("projectStatus")String projectStatus); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java new file mode 100644 index 0000000000..66a80a58fe --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/BaseReportDao.java @@ -0,0 +1,227 @@ +package com.epmet.dao.stats; + +import com.epmet.dto.basereport.form.AgencyProjectFormDTO; +import com.epmet.dto.basereport.form.AgencyRegUserFormDTO; +import com.epmet.dto.basereport.form.GridRegUserFormDTO; +import com.epmet.dto.basereport.form.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +@Mapper +public interface BaseReportDao { + + /** + * @Description 根据dateId删除客户网格注册用户数据 + * @author sun + */ + int delGridRegUser(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户网格注册用户数据 + * @author sun + */ + void insertBatchGridRegUser(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织注册用户数据 + * @author sun + */ + int delAgencyRegUser(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户组织注册用户数据 + * @author sun + */ + void insertBatchAgencyRegUser(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户网格群组总数数据 + * @author sun + */ + int delGridGroupTotal(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户网格群组总数数据 + * @author sun + */ + void insertBatchGridGroupTotal(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织群组总数数据 + * @author sun + */ + int delAgencyGroupTotal(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户组织群组总数数据 + * @author sun + */ + void insertBatchAgencyGroupTotal(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户网格热议话题数据 + * @author sun + */ + int delGridHotTopic(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户网格热议话题数据 + * @author sun + */ + void insertBatchGridHotTopic(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织热议话题数据 + * @author sun + */ + int delAgencyHotTopic(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增客户组织热议话题数据 + * @author sun + */ + void insertBatchAgencyHotTopic(@Param("list") List dataList); + + /** + * @Description 根据dateId删除客户组织项目数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/24 5:30 下午 + */ + int delAgencyProject(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增组织项目数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 9:14 上午 + */ + void insertAgencyProject(@Param("list")List dataList); + + /** + * @Description 根据dateId删除客户网格项目数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 10:36 上午 + */ + int delGridProject(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 批量新增网格项目数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 10:37 上午 + */ + void insertGridProject(@Param("list")List dataList); + + /** + * @Description 删除组织议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 10:53 上午 + */ + int delAgencyIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增组织议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 10:54 上午 + */ + void insertAgencyIssue(@Param("list")List dataList); + + /** + * @Description 删除网格议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 2:00 下午 + */ + int delGridIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增网格议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 2:00 下午 + */ + void insertGridIssue(@Param("list")List dataList); + + /** + * @Description 删除组织话题转议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 2:13 下午 + */ + int delAgencyTopicIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增组织话题转议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 2:14 下午 + */ + void insertAgencyTopicIssue(@Param("list")List dataList); + + /** + * @Description 删除网格话题转议题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 2:41 下午 + */ + int delGridTopicIssue(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 新增网格话题转议题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 2:41 下午 + */ + void insertGridTopicIssue(@Param("list")List dataList); + + /** + * @Description 删除组织状态话题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 3:17 下午 + */ + int delAgencyTopicStatus(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 增加组织状态话题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 3:18 下午 + */ + void insertAgencyTopicStatus(@Param("list")List dataList); + + /** + * @Description 删除网格状态话题数据 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/6/25 3:30 下午 + */ + int delGridTopicStatus(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 增加网格状态话题数据 + * @Param dataList + * @author zxc + * @date 2021/6/25 3:30 下午 + */ + void insertGridTopicStatus(@Param("list")List dataList); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java new file mode 100644 index 0000000000..8572bf2616 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DataStatsDao.java @@ -0,0 +1,45 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author sun + * @Description 数据统计服务 + */ +@Mapper +public interface DataStatsDao { + + /** + * @Description 数据上报--网格员数据分析上报--按客户Id和dateId删除历史数据 + * @author sun + */ + int delGmUploadData(String customerId, String dateId); + + /** + * @Description 数据上报--网格员数据分析上报--批量新增或修改数据 + * @author sun + */ + int saveOrUpGmUploadData(@Param("list") List list); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java new file mode 100644 index 0000000000..42233f31d6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java @@ -0,0 +1,57 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.user; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.user.StatsStaffPatrolRecordDailyEntity; +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-06-29 + */ +@Mapper +public interface StatsStaffPatrolRecordDailyDao extends BaseDao { + + /** + * desc: 请描述类的业务用途 + * + * @param insertList + * @return java.lang.Integer + * @author LiuJanJun + * @date 2021/7/9 1:57 下午 + */ + Integer insertBatch(@Param("list") List insertList); + + /** + * desc: 删除内部数据 + * + * @param formDTO + * @return int + * @author LiuJanJun + * @date 2021/7/9 2:03 下午 + */ + int deleteInternal(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index dabacfd7da..3d63f88ce5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -1,9 +1,15 @@ package com.epmet.dao.user; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -159,5 +165,33 @@ public interface UserDao { * @date 2021/6/8 5:21 下午 */ List selectStaffInfo(@Param("list") List staffUserIdList); + + List getStaffByRoleKey(@Param("customerId") String customerId, @Param("roleKey") String roleKey); + + /** + * desc: 根据角色key条件获取所有的人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 2:58 下午 + */ + List selectUserByRoleKey(StaffPatrolStatsFormDTO formDTO); + + List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO); + + List selectStaffPatrolListByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 + * @author sun + */ + int delGmUploadEvent(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * @Description 数据上报--网格员事件总数上报--批量新增或修改数据 + * @author sun + */ + int saveOrUpGmUploadEvent(@Param("list") List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java new file mode 100644 index 0000000000..27ac16cb34 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java @@ -0,0 +1,161 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_daily") +public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 项目立项数日增量 + */ + private Integer projectIncr; + + /** + * 议题转项目数日增量 + */ + private Integer issueToProjectIncr; + + /** + * 议题关闭数日增量 + */ + private Integer closedIssueIncr; + + /** + * 项目响应数日增量 + */ + private Integer projectResponseIncr; + + /** + * 项目吹哨数日增量 + */ + private Integer projectTransferIncr; + + /** + * 项目结案数日增量 + */ + private Integer projectClosedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java new file mode 100644 index 0000000000..86f5fa647c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_monthly") +public class FactGridMemberStatisticsMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java index be69a89f3d..aa3f6e3ca2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java @@ -148,4 +148,9 @@ public class FactOriginProjectMainDailyEntity extends BaseEpmetEntity { */ private String finishOrgIds; + /** + * 项目创建人(议题转项目或立项人) + */ + private String projectCreator; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java index 8bbe10f526..d2f2c16625 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenGovernRankDataDailyEntity.java @@ -18,13 +18,11 @@ package com.epmet.entity.evaluationindex.screen; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; import java.math.BigDecimal; -import java.util.Date; /** * 基层治理-治理能力排行数据(按月统计) @@ -99,4 +97,33 @@ public class ScreenGovernRankDataDailyEntity extends BaseEpmetEntity { */ private BigDecimal satisfactionRatio; + /** + * 响应数 + */ + private Integer responseCount; + /** + * 项目转入次数 + */ + private Integer transferCount; + /** + * 解决项目数 + */ + private Integer resolvedCount; + /** + * 已关闭项目数 + */ + private Integer closedCount; + /** + * 自治项目数 + */ + private Integer governCount; + /** + * 满意项目数 + */ + private Integer satisfactionCount; + /** + * 已关闭项目(由议题转的项目)数 + */ + private Integer closedProjectCount; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java index 2100e779bb..88977c1ff8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java @@ -63,71 +63,75 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { private String orgName; /** - * 党员参与议事 + * 1.1党员参与议事:何为参与?议题的表决行为次数总计 */ private Integer issueTotal; /** - * 01.12新增:PLAT_ISSUE_TOTAL 平台参与议事总数 + * 1.2平台参与议事总数 */ private Integer platIssueTotal; /** - * 党员参与议事占比 + * 1.3党员参与议事占比=issue_total/plat_issue_total */ private BigDecimal issueRatio; /** - * 党员发布话题 + * 2.1党员发布话题 */ private Integer topicTotal; /** - * 01.12新增:PLAT_TOPIC_TOTAL 当前组织维度,话题总数,TOPIC_RATIO的分母 + * 2.2当前组织维度,话题总数,TOPIC_RATIO的分母 */ private Integer platTopicTotal; /** - * 党员发布话题占比 + * 2.3党员发布话题占比 */ private BigDecimal topicRatio; /** - * 党员发布议题 + * 3.1党员发布议题总数:话题发布人是党员 */ private Integer publishIssueTotal; /** - * 01.12新增:PLAT_PUBLISH_ISSUE_TOTAL 当前组织维度,发布议题总数,PUBLISH_ISSUE_RATIO的分母,SHIFT_PROJECT_RATIO的分母 + * 3.2当前组织维度,发布议题总数,PUBLISH_ISSUE_RATIO的分母 */ private Integer platPublishIssueTotal; /** - * 党员发布议题占比 + * 3.3党员发布议题占比 */ private BigDecimal publishIssueRatio; /** - * 议题转项目数 + * 4.1党员议题转项目数:话题发布人党员+已经转为项目的议题总数 */ private Integer shiftProjectTotal; + /** + * 4.2当前组织维度,已经转为项目的议题总数,SHIFT_PROJECT_RATIO的分母.0708新增此列 + */ + private Integer platShiftProjectTotal; /** - * 议题转项目占比 + * 4.3议题转项目占比 */ private BigDecimal shiftProjectRatio; /** - * 解决项目总数 + * 5.1党员解决项目总数:话题发布人是党员的议题,转为项目并且已经解决 */ private Integer resolvedProjectTotal; /** - * 01.12新增:PLAT_CLOSED_PROJECT_TOTAL 当前组织维度,所有结案项目数,RESOLVED_PROJECT_RATIO的分母 + * 5.2当前组织维度,所有结案项目数,RESOLVED_PROJECT_RATIO的分母 */ private Integer platClosedProjectTotal; /** - * 解决项目总数占比 + * 5.3解决项目总数占比 */ private BigDecimal resolvedProjectRatio; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java index 9ef584bad8..52c9a19ab3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java @@ -144,5 +144,8 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity { */ private String allParentIds; - + /** + * 满意度得分 + */ + private BigDecimal satisfactionScore; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java index 138e19cd30..a0fc71b676 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java @@ -92,6 +92,16 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private BigDecimal avgIssue; + /** + * 人均议题分子 + */ + private Integer avgIssueFz; + + /** + * 人均议题分母 + */ + private Integer avgIssueFm; + /** * 人均议题较上月增长率(采集的时候后台自己计算) */ @@ -107,6 +117,16 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private BigDecimal avgJoin; + /** + * 平均参与度分子 + */ + private Integer avgJoinFz; + + /** + * 平均参与度分母 + */ + private Integer avgJoinFm; + /** * 平均参与度较上月增长率(采集的时候后台自己计算) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java index 4fbb9bfb83..f521f0aa60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java @@ -108,4 +108,9 @@ public class CustomerAgencyEntity extends BaseEpmetEntity { * 社区 */ private String community; + + /** + * 是否同步到统计库和指标库,1同步。0不同步 + */ + private String syncFlag; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java index 6c01df7df8..dc760a4b5e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java @@ -79,4 +79,9 @@ public class CustomerGridEntity extends BaseEpmetEntity { * 所有上级组织ID */ private String pids; + + /** + * 是否同步到统计库和指标库,1同步。0不同步 + */ + private String syncFlag; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java new file mode 100644 index 0000000000..bb94ef3ff2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.org; + +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 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_staff_grid") +public class CustomerStaffGridEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + private String customerId; + private String gridId; + private String userId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java new file mode 100644 index 0000000000..d0d3445589 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.user; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("stats_staff_patrol_record_daily") +public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java index ecc2d38a9b..852a5aec52 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java @@ -2,13 +2,18 @@ package com.epmet.mq; import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; 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.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactOriginExtractService; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import com.epmet.util.DimIdGenerator; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; @@ -18,6 +23,7 @@ import org.apache.rocketmq.common.message.MessageExt; import org.redisson.api.RLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.data.redis.core.RedisTemplate; import javax.annotation.PreDestroy; import java.util.Date; @@ -39,12 +45,16 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently private Logger logger = LoggerFactory.getLogger(getClass()); + private RedisUtils redisUtils; + @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { long start = System.currentTimeMillis(); try { - List customerIds = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList()); - customerIds.forEach(this::consumeMessage); + List msgStrs = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList()); + for (String msgStr : msgStrs) { + consumeMessage(msgStr); + } } catch (Exception e) { //失败不重发 logger.error("consumeMessage fail,msg:{}",e.getMessage()); @@ -61,6 +71,29 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently log.warn("consumeMessage msg body is blank"); return; } + + if (redisUtils == null) { + redisUtils = SpringContextUtils.getBean(RedisUtils.class); + } + + String redisKey = RedisKeys.getProjectChangedMsgDistinceKey(msgObj.getCustomerId()); + if (redisUtils.get(redisKey) == null) { + // 该线程启动消费之后,其他线程再收到该客户id的消费请求,则不消费 + redisUtils.set(redisKey, msg, 30); + try { + consumeMessage(msgObj); + } catch (Exception e) { + // 如果消费失败了,清楚该key,收到消息之后可以继续消费 + redisUtils.delete(redisKey); + throw e; + } + log.info("消费了项目变动消息,customer id:{}", msgObj.getCustomerId()); + } else { + log.info("该客户的项目变动消息刚刚消费,请等待30秒,customer id:{}", msgObj.getCustomerId()); + } + } + + public void consumeMessage(ProjectChangedMQMsg msgObj) { DistributedLock distributedLock = null; RLock lock = null; try { @@ -113,6 +146,7 @@ public class ProjectChangedCustomListener implements MessageListenerConcurrently } } } + @PreDestroy public void saveCalStatus() { //todo diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index c383ae1b41..33ee4218e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.EnvEnum; import lombok.extern.slf4j.Slf4j; @@ -14,57 +16,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; -@Slf4j @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; +public class RocketMQConsumerRegister extends MQAbstractRegister { - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener()); - } - } catch (MQClientException e) { - log.error("registerAllListeners exception", e); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener()); + // ...其他监听器类似 } - - public void register(String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - //一次批量拉去10条消息 - consumer.setConsumeMessageBatchMaxSize(NumConstant.TEN); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - -} +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/BaseReportService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/BaseReportService.java new file mode 100644 index 0000000000..50b5f3579d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/BaseReportService.java @@ -0,0 +1,109 @@ +package com.epmet.service; + + +import com.epmet.dto.basereport.form.*; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +public interface BaseReportService { + + /** + * @Param formDTO + * @Description 网格注册用户数据 + * @author sun + */ + void gridRegUser(GridRegUserFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织机关注册用户数据 + * @author sun + */ + void agencyRegUser(AgencyRegUserFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格群组总数 + * @author sun + */ + void gridGroupTotal(GridGroupTotalFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织群组总数 + * @author sun + */ + void agencyGroupTotal(AgencyGroupTotalFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格热议话题数据 + * @author sun + */ + void gridHotTopic(GridHotTopicFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织热议话题数据 + * @author sun + */ + void agencyHotTopic(AgencyHotTopicFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格状态话题数据-008 + * @author sun + */ + void gridTopicStatus(GridTopicStatusFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织状态话题数据-007 + * @author sun + */ + void agencyTopicStatus(AgencyTopicStatusFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格话题转议题数据-006 + * @author sun + */ + void gridTopicIssue(GridTopicIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织话题转议题数据-005 + * @author sun + */ + void agencyTopicIssue(AgencyTopicIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格议题数据-004 + * @author sun + */ + void gridIssue(GridIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织议题数据-003 + * @author sun + */ + void agencyIssue(AgencyIssueFormDTO formDTO); + + /** + * @Param formDTO + * @Description 网格项目数据-002 + * @author sun + */ + void gridProject(GridProjectFormDTO formDTO); + + /** + * @Param formDTO + * @Description 组织项目数据-001 + * @author sun + */ + void agencyProject(AgencyProjectFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/GovernanceDataReportService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/GovernanceDataReportService.java new file mode 100644 index 0000000000..db9808bf3f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/GovernanceDataReportService.java @@ -0,0 +1,48 @@ +package com.epmet.service; + +import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; +import com.epmet.dto.extract.form.GridGovernDailyFormDTO; +import com.epmet.dto.screencoll.form.GovernRankDataDailyFormDTO; + +/** + * 治理能力数据上报 + * + * @author zhaoqifeng + * @date 2021/6/24 15:18 + */ +public interface GovernanceDataReportService { + + /** + * 基层治理-治理能力排行数据(按天统计) + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 10:14 + */ + void insertGovernRankDataDaily(GovernRankDataDailyFormDTO formDTO, String customerId); + + /** + * 组织的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + void insertAgencyGovernDaily(AgencyGovernDailyFormDTO formDTO, String customerId); + + /** + * 网格的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + void insertGridGovernDaily(GridGovernDailyFormDTO formDTO, String customerId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index b920c0e29a..4096fcb500 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -28,7 +28,7 @@ public interface IssueService { * @param date * @return java.util.List */ - List getAgencyIssueTotal(String customerId, String date); + List getAgencyIssueTotal(String customerId, String date, List gridList); /** * 获取当前日期组织下议题增量 @@ -38,7 +38,7 @@ public interface IssueService { * @param date * @return java.util.List */ - List getAgencyIssueInc(String customerId, String date); + List getAgencyIssueInc(String customerId, String date, List gridList); /** * 获取截止当前日期组织下已关闭议题统计 @@ -48,7 +48,7 @@ public interface IssueService { * @param date * @return java.util.List */ - List getAgencyClosedIssueTotal(String customerId, String date); + List getAgencyClosedIssueTotal(String customerId, String date, List gridList); /** * 获取当前日期组织下已关闭议题增量 @@ -58,7 +58,7 @@ public interface IssueService { * @param date * @return java.util.List */ - List getAgencyClosedIssueInc(String customerId, String date); + List getAgencyClosedIssueInc(String customerId, String date, List gridList); /** * @param issueEntity @@ -183,4 +183,31 @@ public interface IssueService { * @date 2021.03.09 00:23 */ Map getIntegratedProjectCategory(Map> param,String customerId); + + /** + * 获取议题总数 + * @author zhaoqifeng + * @date 2021/7/20 16:20 + * @param customerId + * @param date + * @return java.util.List + */ + List getIssueTotalList(String customerId, String date); + + + /** + * 获取议题增量 + * @author zhaoqifeng + * @date 2021/7/20 16:20 + * @param customerId + * @param date + * @return java.util.List + */ + List getIssueIncrList(String customerId, String date); + + /** + * @Author sun + * @Description 查询议题库已删除网格下可能存在的项目Id集合 + **/ + List getProjectByGrids(List gridIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 44578a426a..fd5702c71b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -34,23 +34,23 @@ public class IssueServiceImpl implements IssueService { private StatsIssueDao statsIssueDao; @Override - public List getAgencyIssueTotal(String customerId, String date) { - return statsIssueDao.selectAgencyIssueTotal(customerId, date); + public List getAgencyIssueTotal(String customerId, String date, List gridList) { + return statsIssueDao.selectAgencyIssueTotal(customerId, date, gridList); } @Override - public List getAgencyIssueInc(String customerId, String date) { - return statsIssueDao.selectAgencyIssueInc(customerId, date); + public List getAgencyIssueInc(String customerId, String date, List gridList) { + return statsIssueDao.selectAgencyIssueInc(customerId, date, gridList); } @Override - public List getAgencyClosedIssueTotal(String customerId, String date) { - return statsIssueDao.selectAgencyClosedIssueTotal(customerId, date); + public List getAgencyClosedIssueTotal(String customerId, String date, List gridList) { + return statsIssueDao.selectAgencyClosedIssueTotal(customerId, date, gridList); } @Override - public List getAgencyClosedIssueInc(String customerId, String date) { - return statsIssueDao.selectAgencyClosedIssueInc(customerId, date); + public List getAgencyClosedIssueInc(String customerId, String date, List gridList) { + return statsIssueDao.selectAgencyClosedIssueInc(customerId, date, gridList); } /** @@ -169,4 +169,42 @@ public class IssueServiceImpl implements IssueService { return map; } + + /** + * 获取议题总数 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/20 16:20 + */ + @Override + public List getIssueTotalList(String customerId, String date) { + return null; + } + + /** + * 获取议题增量 + * + * @param customerId + * @param date + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/20 16:20 + */ + @Override + public List getIssueIncrList(String customerId, String date) { + return null; + } + + /** + * @Author sun + * @Description 查询议题库已删除网格下可能存在的项目Id集合 + **/ + @Override + public List getProjectByGrids(List gridIds) { + return statsIssueDao.selectProjectByGrids(gridIds); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java index db22288094..f09cf007a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java @@ -1,6 +1,8 @@ package com.epmet.service; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; /** * @author wangc @@ -17,4 +19,18 @@ public interface StatsUserService { * @date 2020.06.28 14:38 **/ void partition(StatsFormDTO formDTO); + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + void gmUploadEvent(GmUploadEventFormDTO formDTO); + + /** + * @Param formDTO + * @Description 数据上报--网格员数据分析上报 + * @author sun + */ + void gmUploadData(GmUploadDataFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java index dbc2cc03f9..d6f9e8e2d3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java @@ -1,5 +1,6 @@ package com.epmet.service.crm; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.entity.crm.CustomerEntity; import java.util.Date; @@ -10,4 +11,10 @@ public interface CustomerService { List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); List listValidCustomersByUpdatedTime(Date updatedTime, Date initTime); + + /** + * @Description 查询客户所属父客户信息 + * @author sun + */ + CustomerRelationDTO getByCustomerId(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java index 056df4e50e..84598562ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java @@ -3,6 +3,8 @@ package com.epmet.service.crm.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.crm.CustomerDao; +import com.epmet.dao.crm.CustomerRelationDao; +import com.epmet.dto.crm.CustomerRelationDTO; import com.epmet.entity.crm.CustomerEntity; import com.epmet.service.crm.CustomerService; import org.springframework.beans.factory.annotation.Autowired; @@ -17,6 +19,8 @@ public class CustomerServiceImpl implements CustomerService { @Autowired private CustomerDao customerDao; + @Autowired + private CustomerRelationDao customerRelationDao; @Override public List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { @@ -27,4 +31,13 @@ public class CustomerServiceImpl implements CustomerService { public List listValidCustomersByUpdatedTime(Date startTime, Date endTime) { return customerDao.listValidCustomersByUpdateTime(startTime, endTime); } + + /** + * @Description 查询客户所属父客户信息 + * @author sun + */ + @Override + public CustomerRelationDTO getByCustomerId(String customerId) { + return customerRelationDao.selectByCustomerId(customerId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java new file mode 100644 index 0000000000..062bd2c49c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.biz; + +import com.epmet.dto.extract.form.BizDataFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +public interface BizDataStatsService { + + /** + * desc:抽取所有业务数据到统计库 + * + * @param dataFormDTO + */ + void exeDailyAll(BizDataFormDTO dataFormDTO); + + void executeStaffPatrolStats(StaffPatrolStatsFormDTO formDTO); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java new file mode 100644 index 0000000000..fbeb7a391f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java @@ -0,0 +1,303 @@ +package com.epmet.service.evaluationindex.extract.biz.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.ProjectConstant; +import com.epmet.dto.ProjectDTO; +import com.epmet.dto.extract.form.BizDataFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; +import com.epmet.service.org.CustomerStaffService; +import com.epmet.service.project.ProjectService; +import com.epmet.service.stats.DimCustomerService; +import com.epmet.service.user.StatsStaffPatrolService; +import com.epmet.service.user.UserService; +import com.epmet.util.DimIdGenerator; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * desc:【天】业务库里的统计 + * + * @author: LiuJanJun + * @date: 2021/6/29 3:08 下午 + * @version: 1.0 + */ +@Slf4j +@Service +public class BizDataStatsServiceImpl implements BizDataStatsService { + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() + .setNameFormat("bizDataStats-pool-%d").build(); + ExecutorService threadPool = new ThreadPoolExecutor(3, 6, + 10L, TimeUnit.MINUTES, + new LinkedBlockingQueue<>(500), namedThreadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); + @Autowired + private CustomerStaffService customerStaffService; + @Autowired + private UserService userService; + @Autowired + private ProjectService projectService; + @Autowired + private StatsStaffPatrolService statsStaffPatrolService; + @Autowired + private DimCustomerService dimCustomerService; + + @Override + public void exeDailyAll(BizDataFormDTO dataFormDTO) { + String customerId = dataFormDTO.getCustomerId(); + + List customerIds = new ArrayList<>(); + if (StringUtils.isNotBlank(customerId)) { + //指定某个客户 + customerIds.add(customerId); + } else { + //查询全部客户 + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; + customerIds = dimCustomerService.selectCustomerIdPage(pageNo, pageSize); + if (org.springframework.util.CollectionUtils.isEmpty(customerIds)) { + log.error("exeDailyAll 获取客户Id为空"); + return; + } + } + customerIds.forEach(cId -> { + dataFormDTO.setCustomerId(cId); + log.info("exeDailyAll param:{}", JSON.toJSONString(dataFormDTO)); + submitJob(dataFormDTO); + }); + } + + @Override + public void executeStaffPatrolStats(StaffPatrolStatsFormDTO formDTO) { + //校正参数里的前一天日期的数据 + //获取所有网格员 + List allGridMembers = getAllGridMembers(formDTO); + if (CollectionUtils.isEmpty(allGridMembers)){ + log.warn("executeStaffPatrolStats have any gridMembers,param:{}",JSON.toJSONString(formDTO)); + return; + } + String yesterdayStr = getYesterdayString(formDTO); + StaffPatrolStatsFormDTO yesterdayParam = ConvertUtils.sourceToTarget(formDTO, StaffPatrolStatsFormDTO.class); + yesterdayParam.setDateId(yesterdayStr); + reloadStaffPatrolStatsData(yesterdayParam, allGridMembers); + + //初始化参数里日期的数据 如果当前时间在1分钟内 则初始化 + String todayDateDimId = DimIdGenerator.getDateDimId(new Date()); + if (todayDateDimId.equals(formDTO.getDateId())){ + //如果当前时间-1分钟还等于今天 则进行初始化操作 否则执行数据纠正 + String dateDimId = DimIdGenerator.getDateDimId(new Date(System.currentTimeMillis() - 1 * 60 * 1000)); + if (!dateDimId.equals(todayDateDimId)){ + initStaffPatrolTodayData(formDTO, allGridMembers); + }else{ + reloadStaffPatrolStatsData(formDTO, allGridMembers); + } + } + + } + + private void reloadStaffPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { + log.info("reloadStaffPatrolStatsData param:{}",JSON.toJSONString(formDTO)); + //获取昨日的巡查统计记录 + + //遍历网格员重新初始化数据 + List insertList = buildInitPatrolStatsData(formDTO, allGridMembers); + + Map yesterdayStatsMap = insertList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); + //获取昨日的巡查记录 + List yesterdayPatrolList = userService.selectStaffPatrolListByDateId(formDTO.getCustomerId(), formDTO.getDateId()); + + //获取昨日的立项项目数 + List yesterdayProjectList = projectService.selectProjectListByDateId(formDTO.getCustomerId(), formDTO.getDateId(), ProjectConstant.PROJECT_ORIGIN_AGENCY); + + //遍历网格员 设置其 巡查次数 巡查时常 上报项目数 + yesterdayPatrolList.forEach(patrolRecord -> { + String key = patrolRecord.getGrid().concat(patrolRecord.getStaffId()); + StatsStaffPatrolRecordDailyDTO patrolRecordDailyDTO = yesterdayStatsMap.get(key); + if (patrolRecordDailyDTO != null) { + long total = (patrolRecord.getPatrolEndTime().getTime() - patrolRecord.getPatrolStartTime().getTime()) / 1000; + if (patrolRecordDailyDTO.getTotalTime() == null) { + patrolRecordDailyDTO.setTotalTime(NumConstant.ZERO); + } + patrolRecordDailyDTO.setTotalTime(patrolRecordDailyDTO.getTotalTime() + (int) total); + if (patrolRecordDailyDTO.getPatrolTotal() == null) { + patrolRecordDailyDTO.setPatrolTotal(NumConstant.ZERO); + } + patrolRecordDailyDTO.setPatrolTotal(patrolRecordDailyDTO.getPatrolTotal() + NumConstant.ONE); + //如果巡查记录时间小于统计里的最新的时间 则更新 + if (patrolRecordDailyDTO.getLatestPatrolTime() == null || patrolRecordDailyDTO.getLatestPatrolTime().getTime() < patrolRecord.getPatrolStartTime().getTime()) { + patrolRecordDailyDTO.setLatestPatrolTime(patrolRecord.getPatrolStartTime()); + patrolRecordDailyDTO.setLatestPatrolStatus(patrolRecord.getStatus()); + } + } + }); + //填充项目数 + yesterdayProjectList.forEach(projectDTO -> { + + yesterdayPatrolList.forEach(patrol -> { + //项目立项时间 在巡查期间时 总数加1 + long projectCreateTime = projectDTO.getCreatedTime().getTime(); + //创建人为网格员 且时间在巡查期间的 则上报的项目数加1 + if (projectDTO.getCreatedBy().equals(patrol.getStaffId()) && projectCreateTime >= patrol.getPatrolStartTime().getTime() && projectCreateTime <= patrol.getPatrolEndTime().getTime()) { + String unqPatrolKey = getUnqPatrolKey(patrol.getGrid(), patrol.getStaffId()); + StatsStaffPatrolRecordDailyDTO recordDailyDTO = yesterdayStatsMap.get(unqPatrolKey); + if (recordDailyDTO == null) { + log.error("have project data but have any patrolRecordDaily,gridId:{},staffId:{}", patrol.getGrid(), patrol.getStaffId()); + return; + } + + recordDailyDTO.setReportProjectCount(recordDailyDTO.getReportProjectCount() + 1); + } + }); + }); + + Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList); + log.debug("initStaffPatrolStats insert rows:{}", effectRow); + } + + /** + * desc: 获取key + * + * @param gridId + * @param staffId + * @return java.lang.String + * @author LiuJanJun + * @date 2021/7/2 8:32 上午 + */ + private String getUnqPatrolKey(String gridId, String staffId) { + return gridId.concat(staffId); + } + + + @Nullable + private String getYesterdayString(StaffPatrolStatsFormDTO formDTO) { + Date dateParam = DateUtils.parse(formDTO.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD); + Date yesterdayDate = DateUtils.addDateDays(dateParam, -1); + return DateUtils.format(yesterdayDate, DateUtils.DATE_PATTERN_YYYYMMDD); + } + + private void initStaffPatrolTodayData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { + log.info("initStaffPatrolTodayData param:{}",JSON.toJSONString(formDTO)); + List insertList = buildInitPatrolStatsData(formDTO, allGridMembers); + Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList); + log.debug("initStaffPatrolStats insert rows:{}", effectRow); + } + + @NotNull + private List buildInitPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { + List lastStaffPatrolList = userService.selectLastStaffPatrolList(formDTO); + Map lastPatrolMap = lastStaffPatrolList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); + //构建数据 插入 + List insertList = new ArrayList<>(); + Date date = DateUtils.parse(formDTO.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD); + DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(date); + allGridMembers.forEach(gridMember -> { + StatsStaffPatrolRecordDailyDTO record = new StatsStaffPatrolRecordDailyDTO(); + record.setCustomerId(gridMember.getCustomerId()); + record.setGridId(gridMember.getGridId()); + record.setAgencyId(gridMember.getAgencyId()); + record.setGridPids(gridMember.getGridPids()); + record.setStaffId(gridMember.getUserId()); + record.setDateId(dimIdBean.getDateId()); + record.setWeekId(dimIdBean.getWeekId()); + record.setQuarterId(dimIdBean.getQuarterId()); + record.setYearId(dimIdBean.getYearId()); + record.setMonthId(dimIdBean.getMonthId()); + StatsStaffPatrolRecordDailyDTO recordDailyDTO = lastPatrolMap.get(gridMember.getGridId().concat(gridMember.getUserId())); + + record.setTotalTime(NumConstant.ZERO); + record.setPatrolTotal(NumConstant.ZERO); + record.setLatestPatrolStatus("end"); + record.setReportProjectCount(NumConstant.ZERO); + + record.setSourceType("internal"); + record.setSourceCustomerId(record.getCustomerId()); + //最后巡查时间 + record.setLatestPatrolTime(null); + if (recordDailyDTO != null) { + record.setLatestPatrolStatus(recordDailyDTO.getLatestPatrolStatus()); + record.setLatestPatrolTime(recordDailyDTO.getLatestPatrolTime()); + } + + insertList.add(record); + + }); + return insertList; + } + + private List getAllGridMembers(StaffPatrolStatsFormDTO formDTO) { + //获取所有的网格员 + //1.获取所有网格用户 + List allStaffList = customerStaffService.selectStaffGridList(formDTO); + if (CollectionUtils.isEmpty(allStaffList)) { + log.warn("reloadStaffPatrolStats customerId:{} have any staff,param:{}", formDTO.getCustomerId(), JSON.toJSONString(formDTO)); + return allStaffList; + } + //获取所有含有网格员角色的用户 + List gridMemberList = userService.selectUserListByRoleKey(formDTO); + if (CollectionUtils.isEmpty(gridMemberList)) { + log.warn("reloadStaffPatrolStats customerId:{} have any gridMembers,param:{}", formDTO.getCustomerId(), JSON.toJSONString(formDTO)); + return allStaffList; + } + List insertList = new ArrayList<>(); + + allStaffList.forEach(gridStaff -> gridMemberList.forEach(gridMember -> { + if (gridStaff.getUserId().equals(gridMember.getUserId())) { + insertList.add(gridStaff); + } + })); + log.debug("getAllGridMembers result:{},param:{}", JSON.toJSONString(insertList), JSON.toJSONString(formDTO)); + return insertList; + } + + private void submitJob(BizDataFormDTO param) { + if (StringUtils.isBlank(param.getDateId()) && (StringUtils.isBlank(param.getStartDate()) && StringUtils.isBlank(param.getEndDate()))) { + //如果没有设置开始日期、结束日期,默认查询今天 + param.setDateId(DimIdGenerator.getDateDimId(new Date())); + } + StaffPatrolStatsFormDTO formDTO = ConvertUtils.sourceToTarget(param, StaffPatrolStatsFormDTO.class); + boolean isRange = StringUtils.isBlank(formDTO.getDateId()); + List daysBetween = null; + if (isRange) { + daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); + } + List finalDaysBetween = daysBetween; + threadPool.submit(() -> { + if (!isRange) { + try { + //初始化form里的今天的数据 并纠正昨日的数据 + this.executeStaffPatrolStats(formDTO); + } catch (Exception e) { + log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(formDTO), e); + } + } else { + try { + for (String dateDimId : finalDaysBetween) { + formDTO.setDateId(dateDimId); + this.executeStaffPatrolStats(formDTO); + } + } catch (Exception e) { + log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(param), e); + } + } + }); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java index 0504164079..647d0650a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactAgencyGovernDailyService.java @@ -18,8 +18,11 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.FactAgencyGovernDailyDTO; import com.epmet.entity.evaluationindex.extract.FactAgencyGovernDailyEntity; +import java.util.List; + /** * 组织的治理指数,按天统计 * @@ -38,4 +41,23 @@ public interface FactAgencyGovernDailyService extends BaseService list); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java index 15447342ab..6d62d67c29 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridGovernDailyService.java @@ -18,9 +18,12 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.FactGridGovernDailyDTO; import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; +import java.util.List; + /** * 网格的治理指数,按天统计 * @@ -41,4 +44,22 @@ public interface FactGridGovernDailyService extends BaseService list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java new file mode 100644 index 0000000000..da2f35ce6f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +public interface FactGridMemberStatisticsDailyService extends BaseService { + /** + * 网格员数据统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2021/7/5 9:29 + */ + void extractGridMemberStatisticsDaily(String customerId, String dateId); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java new file mode 100644 index 0000000000..a8e08fc1f9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +public interface FactGridMemberStatisticsMonthlyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index 5bb46392f6..755b53adb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -19,9 +19,11 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import java.util.List; +import java.util.Map; /** * 议题记录附表 @@ -77,4 +79,26 @@ public interface FactOriginIssueLogDailyService extends BaseService> + */ + Map> getIssueToProjectCount(String customerId, String dateId, Integer type); + + /** + * 工作人员关闭议题数 + * @author zhaoqifeng + * @date 2021/7/5 16:40 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getClosedIssueCount(String customerId, String dateId, Integer type); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java index cf25f79ebb..f6e49aaeb5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueMainDailyService.java @@ -46,21 +46,24 @@ public interface FactOriginIssueMainDailyService extends BaseService */ Map getAgencyGridSelfDaily(String customerId, String dateId); + + /** + * 项目响应数 + * @author zhaoqifeng + * @date 2021/7/5 16:56 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectResponseCount(String customerId, String dateId, Integer type); + + /** + * 项目吹哨数 + * @author zhaoqifeng + * @date 2021/7/5 16:57 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectTransferCount(String customerId, String dateId, Integer type); + + /** + * 项目结案数 + * @author zhaoqifeng + * @date 2021/7/5 16:57 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectClosedCount(String customerId, String dateId, Integer type); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 0f55775b23..056de60e3e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -120,11 +120,12 @@ public interface FactOriginProjectMainDailyService extends BaseService> + */ + Map> getMemberProjectCount(String customerId, String dateId, Integer type); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java index 6629836e02..9cae42b818 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactAgencyGovernDailyServiceImpl.java @@ -17,10 +17,13 @@ package com.epmet.service.evaluationindex.extract.todata.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.*; import com.epmet.dao.evaluationindex.extract.FactAgencyGovernDailyDao; +import com.epmet.dto.extract.FactAgencyGovernDailyDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactAgencyGovernDailyEntity; @@ -301,6 +304,36 @@ public class FactAgencyGovernDailyServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FactAgencyGovernDailyEntity :: getCustomerId, customerId) + .eq(FactAgencyGovernDailyEntity :: getDateId, dateId); + return baseDao.delete(wrapper); + } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:56 + */ + @Override + public void insertBatch(List list) { + this.insertBatch(ConvertUtils.sourceToTarget(list, FactAgencyGovernDailyEntity.class)); + } + private FactAgencyGovernDailyEntity initEntity(DimAgencyDTO agency, String dateId) { FactAgencyGovernDailyEntity entity = new FactAgencyGovernDailyEntity(); entity.setCustomerId(agency.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java index 2a9b0e4120..56346813b5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridGovernDailyServiceImpl.java @@ -17,19 +17,19 @@ package com.epmet.service.evaluationindex.extract.todata.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DimObjectActionConstant; import com.epmet.constant.DimObjectStatusConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dao.evaluationindex.extract.FactGridGovernDailyDao; +import com.epmet.dto.extract.FactGridGovernDailyDTO; import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; import com.epmet.dto.extract.form.ExtractFactGridGovernDailyFromDTO; import com.epmet.dto.org.GridInfoDTO; -import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; -import com.epmet.entity.evaluationindex.extract.GovernGridClosedTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; -import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; +import com.epmet.entity.evaluationindex.extract.*; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; @@ -247,6 +247,36 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FactGridGovernDailyEntity :: getCustomerId, customerId) + .eq(FactGridGovernDailyEntity :: getDateId, dateId); + return baseDao.delete(wrapper); + } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2021/6/24 16:09 + */ + @Override + public void insertBatch(List list) { + this.insertBatch(ConvertUtils.sourceToTarget(list, FactGridGovernDailyEntity.class)); + } + private Map getGovernGridClosedTotalCommonDTOMap(String customerId, List gridIds) { Map resultMap = new HashMap<>(); for (String gridId : gridIds) { @@ -278,7 +308,7 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.IndexCalConstant; +import com.epmet.constant.RoleKeyConstants; +import com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; +import com.epmet.service.org.CustomerGridService; +import com.epmet.service.user.UserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Service +@Slf4j +public class FactGridMemberStatisticsDailyServiceImpl extends BaseServiceImpl implements FactGridMemberStatisticsDailyService { + + @Resource + private UserService userService; + @Resource + private CustomerGridService customerGridService; + @Resource + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Resource + private FactOriginIssueLogDailyService factOriginIssueLogDailyService; + @Resource + private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + + + /** + * 网格员数据统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2021/7/5 9:29 + */ + @Override + public void extractGridMemberStatisticsDaily(String customerId, String dateId) { + log.info("客户" + customerId + ",时间" + dateId + ",网格员数据统计开始"); + List staffGridList = customerGridService.getCustomerStaffGridList(customerId); + List staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) { + return; + } + Map staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId, + Function.identity())); + List list = staffGridList.stream().filter(p -> null != staffMap.get(p.getStaffId())).map(item -> { + StaffRoleInfoDTO staffInfo = staffMap.get(item.getStaffId()); + return initEntity(customerId, dateId, item, staffInfo); + }).collect(Collectors.toList()); + + //数据统计 + GetGridMemberData getGridMemberData = new GetGridMemberData(customerId, dateId).invoke(); + Map> projectCountMap = getGridMemberData.getProjectCountMap(); + Map> projectIncrMap = getGridMemberData.getProjectIncrMap(); + Map> issueToProjectCountMap = getGridMemberData.getIssueToProjectCountMap(); + Map> issueToProjectIncrMap = getGridMemberData.getIssueToProjectIncrMap(); + Map> closedIssueCountMap = getGridMemberData.getClosedIssueCountMap(); + Map> closedIssueIncrMap = getGridMemberData.getClosedIssueIncrMap(); + Map> projectResponseCountMap = getGridMemberData.getProjectResponseCountMap(); + Map> projectResponseIncrMap = getGridMemberData.getProjectResponseIncrMap(); + Map> projectTransferCountMap = getGridMemberData.getProjectTransferCountMap(); + Map> projectTransferIncrMap = getGridMemberData.getProjectTransferIncrMap(); + Map> projectClosedCountMap = getGridMemberData.getProjectClosedCountMap(); + Map> projectClosedIncrMap = getGridMemberData.getProjectClosedIncrMap(); + + list.forEach(item -> { + //赋值 + setEntityData(projectCountMap, projectIncrMap, issueToProjectCountMap, issueToProjectIncrMap, closedIssueCountMap, closedIssueIncrMap, + projectResponseCountMap, projectResponseIncrMap, projectTransferCountMap, projectTransferIncrMap, projectClosedCountMap, + projectClosedIncrMap, item); + + }); + + if (CollectionUtils.isNotEmpty(list)) { + int deleteNum; + do { + deleteNum = baseDao.deleteDataByCustomer(customerId, dateId, IndexCalConstant.DELETE_SIZE); + } while (deleteNum != NumConstant.ZERO); + //删除旧数据 + insertBatch(list); + } + log.info("客户" + customerId + ",时间" + dateId + ",网格员数据统计结束"); + } + + /** + * 数据赋值 + * @author zhaoqifeng + * @date 2021/7/7 10:57 + * @param projectCountMap + * @param projectIncrMap + * @param issueToProjectCountMap + * @param issueToProjectIncrMap + * @param closedIssueCountMap + * @param closedIssueIncrMap + * @param projectResponseCountMap + * @param projectResponseIncrMap + * @param projectTransferCountMap + * @param projectTransferIncrMap + * @param projectClosedCountMap + * @param projectClosedIncrMap + * @param item + * @return void + */ + private void setEntityData(Map> projectCountMap, Map> projectIncrMap, + Map> issueToProjectCountMap, Map> issueToProjectIncrMap, + Map> closedIssueCountMap, Map> closedIssueIncrMap, + Map> projectResponseCountMap, Map> projectResponseIncrMap, + Map> projectTransferCountMap, Map> projectTransferIncrMap, + Map> projectClosedCountMap, Map> projectClosedIncrMap, + FactGridMemberStatisticsDailyEntity item) { + //项目立项数 + List projectCount = projectCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectCount)) { + projectCount.forEach(dto -> { + if (item.getAgencyId().equals(dto.getAgencyId())) { + item.setProjectCount(dto.getCount()); + } + }); + } + //项目立项日增量 + List projectIncr = projectIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectIncr)) { + projectIncr.forEach(dto -> { + if (item.getAgencyId().equals(dto.getAgencyId())) { + item.setProjectIncr(dto.getCount()); + } + }); + } + //议题转项目数 + List issueToProjectCount = issueToProjectCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(issueToProjectCount)) { + issueToProjectCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setIssueToProjectCount(dto.getCount()); + } + }); + } + //议题转项目日增量 + List issueToProjectIncr = issueToProjectIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(issueToProjectIncr)) { + issueToProjectIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setIssueToProjectIncr(dto.getCount()); + } + }); + } + //议题关闭数 + List closedIssueCount = closedIssueCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(closedIssueCount)) { + closedIssueCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setClosedIssueCount(dto.getCount()); + } + }); + } + //议题关闭数日增量 + List closedIssueIncr = closedIssueIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(closedIssueIncr)) { + closedIssueIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setClosedIssueIncr(dto.getCount()); + } + }); + } + //项目响应数 + List projectResponseCount = projectResponseCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectResponseCount)) { + projectResponseCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectResponseCount(dto.getCount()); + } + }); + } + //项目响应数日增量 + List projectResponseIncr = projectResponseIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectResponseIncr)) { + projectResponseIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectResponseIncr(dto.getCount()); + } + }); + } + //项目吹哨数 + List projectTransferCount = projectTransferCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectTransferCount)) { + projectTransferCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectTransferCount(dto.getCount()); + } + }); + } + //项目吹哨数日增量 + List projectTransferIncr = projectTransferIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectTransferIncr)) { + projectTransferIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectTransferIncr(dto.getCount()); + } + }); + } + //项目响应数 + List projectClosedCount = projectClosedCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectClosedCount)) { + projectClosedCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectClosedCount(dto.getCount()); + } + }); + } + //项目响应数日增量 + List projectClosedIncr = projectClosedIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectClosedIncr)) { + projectClosedIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectClosedIncr(dto.getCount()); + } + }); + } + } + + /** + * 初始化Entity + * @author zhaoqifeng + * @date 2021/7/7 10:55 + * @param customerId + * @param dateId + * @param item + * @param staffInfo + * @return com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity + */ + private FactGridMemberStatisticsDailyEntity initEntity(String customerId, String dateId, CustomerStaffGridDTO item, StaffRoleInfoDTO staffInfo) { + FactGridMemberStatisticsDailyEntity entity = new FactGridMemberStatisticsDailyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(item.getAgencyId()); + entity.setGridId(item.getGridId()); + entity.setPid(item.getPid()); + entity.setPids(item.getPids()); + entity.setGridId(item.getGridId()); + entity.setYearId(dateId.substring(NumConstant.ZERO, NumConstant.FOUR)); + entity.setMonthId(dateId.substring(NumConstant.ZERO, NumConstant.SIX)); + entity.setDateId(dateId); + entity.setStaffId(item.getStaffId()); + entity.setStaffName(staffInfo.getStaffName()); + entity.setProjectCount(NumConstant.ZERO); + entity.setProjectIncr(NumConstant.ZERO); + entity.setIssueToProjectCount(NumConstant.ZERO); + entity.setIssueToProjectIncr(NumConstant.ZERO); + entity.setClosedIssueCount(NumConstant.ZERO); + entity.setClosedIssueIncr(NumConstant.ZERO); + entity.setProjectClosedCount(NumConstant.ZERO); + entity.setProjectClosedIncr(NumConstant.ZERO); + entity.setProjectResponseCount(NumConstant.ZERO); + entity.setProjectResponseIncr(NumConstant.ZERO); + entity.setProjectTransferCount(NumConstant.ZERO); + entity.setProjectTransferIncr(NumConstant.ZERO); + entity.setSourceType("internal"); + entity.setSourceCustomerId(customerId); + return entity; + } + + /** + * 网格员数据统计 + * @author zhaoqifeng + * @date 2021/7/7 10:55 + */ + private class GetGridMemberData { + private String customerId; + private String dateId; + private Map> projectCountMap; + private Map> projectIncrMap; + private Map> issueToProjectCountMap; + private Map> issueToProjectIncrMap; + private Map> closedIssueCountMap; + private Map> closedIssueIncrMap; + private Map> projectResponseCountMap; + private Map> projectResponseIncrMap; + private Map> projectTransferCountMap; + private Map> projectTransferIncrMap; + private Map> projectClosedCountMap; + private Map> projectClosedIncrMap; + + GetGridMemberData(String customerId, String dateId) { + this.customerId = customerId; + this.dateId = dateId; + } + + Map> getProjectCountMap() { + return projectCountMap; + } + + Map> getProjectIncrMap() { + return projectIncrMap; + } + + Map> getIssueToProjectCountMap() { + return issueToProjectCountMap; + } + + Map> getIssueToProjectIncrMap() { + return issueToProjectIncrMap; + } + + Map> getClosedIssueCountMap() { + return closedIssueCountMap; + } + + Map> getClosedIssueIncrMap() { + return closedIssueIncrMap; + } + + Map> getProjectResponseCountMap() { + return projectResponseCountMap; + } + + Map> getProjectResponseIncrMap() { + return projectResponseIncrMap; + } + + Map> getProjectTransferCountMap() { + return projectTransferCountMap; + } + + Map> getProjectTransferIncrMap() { + return projectTransferIncrMap; + } + + Map> getProjectClosedCountMap() { + return projectClosedCountMap; + } + + Map> getProjectClosedIncrMap() { + return projectClosedIncrMap; + } + + GetGridMemberData invoke() { + //项目立项数 + projectCountMap = factOriginProjectMainDailyService.getMemberProjectCount(customerId, dateId, + NumConstant.ZERO); + projectIncrMap = factOriginProjectMainDailyService.getMemberProjectCount(customerId, dateId, + NumConstant.ONE); + //议题转项目数 + issueToProjectCountMap = factOriginIssueLogDailyService.getIssueToProjectCount(customerId, dateId, + NumConstant.ZERO); + issueToProjectIncrMap = factOriginIssueLogDailyService.getIssueToProjectCount(customerId, dateId, + NumConstant.ONE); + //议题关闭数 + closedIssueCountMap = factOriginIssueLogDailyService.getClosedIssueCount(customerId, dateId, + NumConstant.ZERO); + closedIssueIncrMap = factOriginIssueLogDailyService.getClosedIssueCount(customerId, dateId, + NumConstant.ONE); + //项目响应数 + projectResponseCountMap = factOriginProjectLogDailyService.getProjectResponseCount(customerId, + dateId, NumConstant.ZERO); + projectResponseIncrMap = factOriginProjectLogDailyService.getProjectResponseCount(customerId, dateId + , NumConstant.ONE); + //项目吹哨数 + projectTransferCountMap = factOriginProjectLogDailyService.getProjectTransferCount(customerId, + dateId, NumConstant.ZERO); + projectTransferIncrMap = factOriginProjectLogDailyService.getProjectTransferCount(customerId, dateId + , NumConstant.ONE); + //项目结案数 + projectClosedCountMap = factOriginProjectLogDailyService.getProjectClosedCount(customerId, + dateId, NumConstant.ZERO); + projectClosedIncrMap = factOriginProjectLogDailyService.getProjectClosedCount(customerId, dateId + , NumConstant.ONE); + return this; + } + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java new file mode 100644 index 0000000000..19f4e54698 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsMonthlyDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsMonthlyService; +import org.springframework.stereotype.Service; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Service +public class FactGridMemberStatisticsMonthlyServiceImpl extends BaseServiceImpl implements FactGridMemberStatisticsMonthlyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java index 2ec8212d21..649391be59 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java @@ -237,7 +237,7 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { } }); - //网格、组织小组总数日统计 + /* //网格、组织小组总数日统计 threadPool.submit(() -> { GroupTotalFormDTO formDTO = new GroupTotalFormDTO(); formDTO.setCustomerId(param.getCustomerId()); @@ -295,7 +295,7 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { log.error("热议中话题-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e); } } - }); + });*/ submitProjectRelationData(param, finalDaysBetween); } @@ -303,9 +303,8 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { @Override public Future submitProjectRelationData(ExtractOriginFormDTO param, List finalDaysBetween) { Future submit = threadPool.submit(() -> { - ExtractOriginFormDTO paramNew = null; + ExtractOriginFormDTO paramNew = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class); if (CollectionUtils.isEmpty(finalDaysBetween)) { - paramNew = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class); try { projectExtractService.saveOriginProjectDaily(paramNew); } catch (Exception e) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index 9bde7a5a94..e05775938e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; @@ -32,8 +33,12 @@ import com.epmet.service.stats.DimAgencyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 议题记录附表 @@ -115,4 +120,52 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 15:52 + */ + @Override + public Map> getIssueToProjectCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getIssueToProjectCount(customerId, dateId); + } else { + list = baseDao.getIssueToProjectIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 工作人员关闭议题数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:40 + */ + @Override + public Map> getClosedIssueCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getClosedIssueCount(customerId, dateId); + } else { + list = baseDao.getClosedIssueIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java index c9db796c53..8906530ae8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueMainDailyServiceImpl.java @@ -66,27 +66,30 @@ public class FactOriginIssueMainDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 16:56 + */ + @Override + public Map> getProjectResponseCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectResponseCount(customerId, dateId); + } else { + list = baseDao.getProjectResponseIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 项目吹哨数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:57 + */ + @Override + public Map> getProjectTransferCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectTransferCount(customerId, dateId); + } else { + list = baseDao.getProjectTransferIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 项目结案数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:57 + */ + @Override + public Map> getProjectClosedCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectClosedCount(customerId, dateId); + } else { + list = baseDao.getProjectClosedIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 3e8b210781..0c65560d2e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -151,14 +151,15 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 14:48 + */ + @Override + public Map> getMemberProjectCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getMemberProjectCount(customerId, dateId); + } else { + list = baseDao.getMemberProjectCountIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 0ec9de39bb..d5dcfc50ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -89,38 +89,39 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { List pendingList = factOriginProjectMainDailyService.getPendingList(customerId); List finishOrgList = projectProcessService.getFinishOrg(customerId, dateString); if (!CollectionUtils.isEmpty(closedList)) { - List closeProjects = - pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { - FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); - entity.setId(process.getProjectId()); - entity.setProjectStatus(ProjectConstant.CLOSED); - entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); - entity.setUpdatedTime(process.getUpdatedTime()); - entity.setIsResolved(process.getIsResolved()); - return entity; - })).collect(Collectors.toList()); - - if (!CollectionUtils.isEmpty(finishOrgList)) { - closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { - String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); - String org = ""; - //取最短的ordIds中最后一个 则为最高级的那个orgIds - if (orgIds.length > NumConstant.ONE) { - org = orgIds[orgIds.length - 1]; - } else { - org = orgIds[0]; - } - if (StringUtils.isNotEmpty(dto.getGridId())) { - org = org + StrConstant.COLON + dto.getGridId(); - } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { - org = org + StrConstant.COLON + dto.getDepartmentId(); - } - close.setFinishOrgIds(org); - })); - } - //更新状态 - if (!closeProjects.isEmpty()) { - factOriginProjectMainDailyService.updateBatchById(closeProjects); + if(!CollectionUtils.isEmpty(pendingList)) { + List closeProjects = + pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { + FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); + entity.setId(process.getProjectId()); + entity.setProjectStatus(ProjectConstant.CLOSED); + entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); + entity.setUpdatedTime(process.getUpdatedTime()); + entity.setIsResolved(process.getIsResolved()); + return entity; + })).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(finishOrgList)) { + closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { + String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); + String org = ""; + //取最短的ordIds中最后一个 则为最高级的那个orgIds + if (orgIds.length > NumConstant.ONE) { + org = orgIds[orgIds.length - 1]; + } else { + org = orgIds[0]; + } + if (StringUtils.isNotEmpty(dto.getGridId())) { + org = org + StrConstant.COLON + dto.getGridId(); + } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { + org = org + StrConstant.COLON + dto.getDepartmentId(); + } + close.setFinishOrgIds(org); + })); + } + //更新状态 + if (!closeProjects.isEmpty()) { + factOriginProjectMainDailyService.updateBatchById(closeProjects); + } } } //获取项目信息 @@ -177,6 +178,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { } entity.setIsParty(NumConstant.ZERO_STR); entity.setIsOverdue(NumConstant.ZERO_STR); + entity.setProjectCreator(project.getCreatedBy()); return entity; }).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(issueList)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java index fe147887b0..c9fa1b17d7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java @@ -24,4 +24,14 @@ public interface ScreenProjectSettleService { */ void extractScreenData(ScreenCentralZoneDataFormDTO param); + /** + * 更新项目得分 + * + * @param customerId + * @param dateId //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数; dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 + * @param projectId 项目id可为空 + * @return void + */ + void updateProjectSatisfactionScore(String customerId,String dateId,String projectId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java index e93b4eba0c..93ab6289a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java @@ -348,7 +348,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -356,10 +362,16 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe List gridList = factOriginProjectLogDailyService.getGridSelfDaily(customerId, dateId); if (CollectionUtils.isNotEmpty(gridList)) { list.forEach(entity -> gridList.stream().filter(gridAbility -> entity.getOrgId().equals(gridAbility.getOrgId())).forEach(grid -> { - BigDecimal resolveCount = new BigDecimal(grid.getSum()); - BigDecimal selfCount = new BigDecimal(grid.getCount()); if (grid.getSum() != NumConstant.ZERO) { - entity.setGovernRatio(selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal resolveCount = new BigDecimal(grid.getSum()); + BigDecimal selfCount = new BigDecimal(grid.getCount()); + BigDecimal ratio = selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernCount(grid.getCount()); + entity.setClosedCount(grid.getSum()); + entity.setGovernRatio(ratio); } })); } @@ -371,7 +383,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); } })); } @@ -383,7 +401,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -422,7 +446,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -434,7 +464,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); } })); } @@ -445,7 +481,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setGovernCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -457,7 +499,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -495,7 +543,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); } })); } @@ -507,7 +561,14 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); + } })); } @@ -518,7 +579,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setGovernCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -530,7 +597,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -568,7 +641,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionCount(dto.getCount()); + entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -580,7 +659,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); } })); } @@ -591,7 +676,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setGovernCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -603,7 +694,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedCount(dto.getCount()); + entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 3041ba742e..65e4cd4669 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -2,10 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; -import com.epmet.constant.DimObjectStatusConstant; -import com.epmet.constant.IndexCalConstant; -import com.epmet.constant.OrgTypeConstant; -import com.epmet.constant.ProjectConstant; +import com.epmet.constant.*; import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; @@ -63,17 +60,18 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService gridList.forEach(entity -> { entity.setDataEndTime(dateId); String gridId = entity.getOrgId(); + //何为参与: 议题的表决行为次数总计 - //1、党员参与议事 + // 1.1党员参与议事:何为参与?议题的表决行为次数总计 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,gridId,null,null,NumConstant.ONE_STR)); log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员参与议事issueTotal="+entity.getIssueTotal()); - //01.12新增:平台参与议事总数 + // 1.2平台参与议事总数 int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); entity.setPlatIssueTotal(issueTotal); log.info("extractGridPioneerData 当前网格id=" + gridId + ";参与议事总数issueTotal=" + issueTotal); - //2、党员参与议事占比 + // 1.3党员参与议事占比=issue_total/plat_issue_total if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ @@ -82,17 +80,17 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService entity.setIssueRatio(issueRatio.setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } - //3、党员发布话题: + // 2.1党员发布话题 entity.setTopicTotal(getTopicTotal(customerId, gridId, null)); log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布话题topicTotal"+entity.getTopicTotal()); //当前网格内所有话题总数 int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId, null); log.info("extractGridPioneerData 当前网格id=" + gridId + ";当前网格内所有话题总数gridTopicTotal="+gridTopicTotal); - //01.12新增:PLAT_TOPIC_TOTAL 当前组织维度,话题总数 + // 2.2当前组织维度,话题总数,TOPIC_RATIO的分母 entity.setPlatTopicTotal(gridTopicTotal); - //4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率 + // 2.3党员发布话题占比 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { @@ -106,31 +104,46 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } //当前网格内所有议题总数 - int gridIssueTotal = getGridOrCommunityIssueTotal(customerId, gridId, null); + int gridIssueTotal = getGridOrCommunityIssueTotal(customerId, gridId, null,StrConstant.EPMETY_STR); log.info("extractGridPioneerData 当前网格id=" + gridId + ";当前网格内所有议题总数=" + gridIssueTotal); - //01.12新增:PLAT_PUBLISH_ISSUE_TOTAL 当前组织维度,发布议题总数 + // 3.2当前组织维度,发布议题总数,PUBLISH_ISSUE_RATIO的分母 entity.setPlatPublishIssueTotal(gridIssueTotal); - if (gridIssueTotal != NumConstant.ZERO) { - //5、党员发布议题 + //当前网格内,议题已经转为项目的总数 + int gridIssueToProjectTotal=getGridOrCommunityIssueTotal(customerId, gridId, null, IssueConstant.SHIFT_PROJECT); + // 4.2当前组织维度,已经转为项目的议题总数,SHIFT_PROJECT_RATIO的分母 + entity.setPlatShiftProjectTotal(gridIssueToProjectTotal); + + if (gridIssueTotal != NumConstant.ZERO && gridIssueToProjectTotal !=NumConstant.ZERO) { + // 3.1党员发布议题总数:话题发布人是党员 entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, gridId, null)); log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布议题publishIssueTotal"+entity.getPublishIssueTotal()); - //6、党员发布议题占比 : 占网格内所有议题的比率 + + // 3.3党员发布议题占比 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); }else{ BigDecimal publishIssueRatio=new BigDecimal((double)entity.getPublishIssueTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setPublishIssueRatio(publishIssueRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } - - //7、议题转项目数 - entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null)); - log.info("extractGridPioneerData 当前网格id=" + gridId +";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); - //8、议题转项目占比 : 占网格内议题总数的比率 - if(entity.getShiftProjectTotal() == NumConstant.ZERO){ + //按照贾总要求改为: + // 先锋模范的统计的是来源于居民端话题->议题-项目的。 + // 议题转项目占比(党员/用户):党员议题转项目/议题转项目数; + // 解决项目占比(党员/用户):党员已解决项目总数/已解决项目总数; + // 这个党员指的都是话题发布人是党员。 + + // 党员议题转项目数:当前网格内的项目,话题发布人是党员的; TOPIC_USER_IS_PARTY:创建话题用户身份标识。1:党员,0:非党员 + // 4.1党员议题转项目数:话题发布人党员+已经转为项目的议题总数 + entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null,NumConstant.ONE_STR)); + log.info("extractGridPioneerData 当前网格id=" + gridId +";党员议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); + + //8、党员议题转项目占比 : 占网格内议题转项目总数的比率 + if(entity.getShiftProjectTotal() == NumConstant.ZERO||gridIssueToProjectTotal ==NumConstant.ZERO){ + //4.3议题转项目占比 entity.setShiftProjectRatio(BigDecimal.ZERO); }else{ - BigDecimal shiftProjectRatio = new BigDecimal((double) entity.getShiftProjectTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal shiftProjectRatio = new BigDecimal((double) entity.getShiftProjectTotal() / gridIssueToProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + //4.3议题转项目占比 entity.setShiftProjectRatio(shiftProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } @@ -143,25 +156,22 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } - // 9、已解决项目 - entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, DimObjectStatusConstant.RESOLVED)); + // 5.1党员解决项目总数:话题发布人是党员的议题,转为项目并且已经解决 + entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, DimObjectStatusConstant.RESOLVED,ProjectConstant.CLOSED,NumConstant.ONE_STR)); log.info("extractGridPioneerData 当前网格id="+gridId+";已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); - - int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, null); + //已解决项目总数 + int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, DimObjectStatusConstant.RESOLVED,ProjectConstant.CLOSED,StrConstant.EPMETY_STR); log.info("extractGridPioneerData 当前网格id="+gridId+";总结项目closedProjectTotal="+closedProjectTotal); - // 01.12新增:PLAT_CLOSED_PROJECT_TOTAL 当前组织维度,所有结案项目数 + + // 5.2当前组织维度,所有结案项目数,RESOLVED_PROJECT_RATIO的分母 entity.setPlatClosedProjectTotal(closedProjectTotal); - // 10、占总结项目 - if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { + // 5.3解决项目总数占比 + if (entity.getResolvedProjectTotal() == NumConstant.ZERO ||closedProjectTotal == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { - if(closedProjectTotal == NumConstant.ZERO){ - entity.setResolvedProjectRatio(BigDecimal.ZERO); - }else { - BigDecimal resolvedProjectRatio = new BigDecimal((double) entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); - entity.setResolvedProjectRatio(resolvedProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); - } + BigDecimal resolvedProjectRatio = new BigDecimal((double) entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setResolvedProjectRatio(resolvedProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //01.12: 新增指标:平台参与议事总人数、平台参与议事党员数、平台参与议事的党员占比 entity.setPlatJoinUserTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, gridId, null, null,null)); @@ -206,60 +216,64 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService communityList.forEach(entity -> { entity.setDataEndTime(dateId); String communityId = entity.getOrgId(); - //1、党员参与议事 + // 1.1党员参与议事:何为参与?议题的表决行为次数总计 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,communityId,null,NumConstant.ONE_STR)); log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员参与议事issueTotal="+entity.getIssueTotal()); - //01.12新增 + // 1.2平台参与议事总数 int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); log.info("extractCommunityPioneerData 当前communityId="+communityId+";参与议事总数issueTotal="+issueTotal); entity.setPlatIssueTotal(issueTotal); + //1.3党员参与议事占比=issue_total/plat_issue_total if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ - //2、党员参与议事占比 entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } - //3、党员发布话题: + //2.1党员发布话题 entity.setTopicTotal(getTopicTotal(customerId, null, communityId)); log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员发布话题topicTotal="+entity.getTopicTotal()); - //01.12新增 - //当前社区内所有话题总数 + //2.2当前组织维度,话题总数,TOPIC_RATIO的分母 int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId); log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有话题总数communityTopicTotal="+communityTopicTotal); entity.setPlatTopicTotal(communityTopicTotal); - //4、党员发布话题占比: 社区内注册党员发布的话题总数占 社区内话题总数的 比率 + //2.3党员发布话题占比 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / communityTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } - //01.12新增 - //当前社区内所有议题总数 - int communityIssueTotal = getGridOrCommunityIssueTotal(customerId, null, communityId); + //3.2当前组织维度,发布议题总数,PUBLISH_ISSUE_RATIO的分母 + int communityIssueTotal = getGridOrCommunityIssueTotal(customerId, null, communityId,StrConstant.EPMETY_STR); log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有议题总数communityIssueTotal="+communityIssueTotal); entity.setPlatPublishIssueTotal(communityIssueTotal); - if (communityIssueTotal != NumConstant.ZERO) { - //5、党员发布议题 + int communityIssueToProjectTotal = getGridOrCommunityIssueTotal(customerId, null, communityId,IssueConstant.SHIFT_PROJECT); + //4.2当前组织维度,已经转为项目的议题总数,SHIFT_PROJECT_RATIO的分母.0708新增此列 + entity.setPlatShiftProjectTotal(communityIssueToProjectTotal); + + if (communityIssueTotal != NumConstant.ZERO && communityIssueToProjectTotal != NumConstant.ZERO) { + //3.1党员发布议题总数:话题发布人是党员 entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, null, communityId)); log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员发布议题publishIssueTotal="+entity.getPublishIssueTotal()); - //6、党员发布议题占比 : 占社区内所有议题的比率 + + //3.3党员发布议题占比 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / communityIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); - //7、议题转项目数 - entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId)); - log.info("extractCommunityPioneerData 当前communityId="+communityId+";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); - //8、议题转项目占比 : 占社区内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / communityIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + //4.1党员议题转项目数:话题发布人党员+已经转为项目的议题总数 + entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId,NumConstant.ONE_STR)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); + + //4.3议题转项目占比 + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / communityIssueToProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ log.info("extractCommunityPioneerData 当前communityId="+communityId+"communityIssueTotal =0"); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -269,19 +283,20 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } - // 9、已解决项目 - entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, DimObjectStatusConstant.RESOLVED)); + // 5.1党员解决项目总数:话题发布人是党员的议题,转为项目并且已经解决 + entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, DimObjectStatusConstant.RESOLVED, ProjectConstant.CLOSED, NumConstant.ONE_STR)); log.info("extractCommunityPioneerData 当前communityId="+communityId+";已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); - //01.12新增 - int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null); + // 5.2当前组织维度,所有结案项目数,RESOLVED_PROJECT_RATIO的分母 + int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null,ProjectConstant.CLOSED,StrConstant.EPMETY_STR); log.info("extractCommunityPioneerData 当前communityId="+communityId+";总结项目closedProjectTotal="+closedProjectTotal); entity.setPlatClosedProjectTotal(closedProjectTotal); + //5.3解决项目总数占比 if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { - // 10、占总结项目 + // 5.3解决项目总数占比 entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } @@ -314,60 +329,66 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService entity.setAgencyPath(entity.getAgencyPids().concat(StrConstant.COLON).concat(entity.getOrgId())); } log.info("extractExceptCommunityPioneerData 当前orgId="+entity.getOrgId()+";agencyPath="+entity.getAgencyPath()); - //1、党员参与议事 + //1.1党员参与议事:何为参与?议题的表决行为次数总计 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),NumConstant.ONE_STR)); log.info("extractExceptCommunityPioneerData 党员参与议事issueTotal="+entity.getIssueTotal()); - //01.12新增 + //1.2平台参与议事总数 int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); log.info("extractExceptCommunityPioneerData 平台参与议事issueTotal="+issueTotal); entity.setPlatIssueTotal(issueTotal); + //1.3党员参与议事占比=issue_total/plat_issue_total if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ - //2、党员参与议事占比 entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } - //3、党员发布话题: + //2.1党员发布话题 entity.setTopicTotal(getAgencyTopicTotal(customerId, entity.getAgencyPath(),NumConstant.ONE_STR)); log.info("extractExceptCommunityPioneerData 党员发布话题topicTotal="+entity.getTopicTotal()); - //01.12新增 - //当前组织内所有话题总数 + //2.2当前组织维度,话题总数,TOPIC_RATIO的分母 int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath(),null); log.info("extractExceptCommunityPioneerData 当前组织内所有话题总数agencyTopicTotal="+agencyTopicTotal); entity.setPlatTopicTotal(agencyTopicTotal); - //4、党员发布话题占比: 组织内注册党员发布的话题总数占 组织内话题总数的 比率 + //2.3党员发布话题占比 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / agencyTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } - //01.12新增 - //当前组织内所有议题总数 + //3.2当前组织维度,发布议题总数,PUBLISH_ISSUE_RATIO的分母 int agencyIssueTotal = getAgencyIssueTotal(customerId, entity.getAgencyPath()); log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal="+agencyIssueTotal); entity.setPlatPublishIssueTotal(agencyIssueTotal); - if (agencyIssueTotal != NumConstant.ZERO) { - //5、党员发布议题 + //4.2当前组织维度,已经转为项目的议题总数,SHIFT_PROJECT_RATIO的分母.0708新增此列 + int platShiftProjectTotal=getAgencyShiftProjectTotal(customerId, entity.getAgencyPath(),StrConstant.EPMETY_STR); + entity.setPlatShiftProjectTotal(platShiftProjectTotal); + + if (agencyIssueTotal != NumConstant.ZERO && platShiftProjectTotal != NumConstant.ZERO) { + //3.1党员发布议题总数:话题发布人是党员 entity.setPublishIssueTotal(getAgencyParyPublishIssueTotal(customerId, entity.getAgencyPath())); log.info("extractExceptCommunityPioneerData 党员发布议题publishIssueTotal="+entity.getPublishIssueTotal()); - //6、党员发布议题占比 : 占社区内所有议题的比率 + + //3.3党员发布议题占比 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); - //7、议题转项目数 - entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath())); + //4.1党员议题转项目数:话题发布人党员+已经转为项目的议题总数 + entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath(),NumConstant.ONE_STR)); log.info("extractExceptCommunityPioneerData 议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); - //8、议题转项目占比 : 占网格内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + + //4.3议题转项目占比 + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? + BigDecimal.ZERO : + new BigDecimal((double)entity.getShiftProjectTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal=0"); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -377,19 +398,21 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } - // 9、已解决项目 - entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), DimObjectStatusConstant.RESOLVED)); + // 5.1党员解决项目总数:话题发布人是党员的议题,转为项目并且已经解决 + entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), DimObjectStatusConstant.RESOLVED,NumConstant.ONE_STR)); log.info("extractExceptCommunityPioneerData 已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); - //01.12新增 - int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null); + //5.2当前组织维度,所有结案项目数,RESOLVED_PROJECT_RATIO的分母 + int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null,StrConstant.EPMETY_STR); log.info("extractExceptCommunityPioneerData 总结项目closedProjectTotal="+closedProjectTotal); entity.setPlatClosedProjectTotal(closedProjectTotal); + //5.3解决项目总数占比 if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { + //5.3解决项目总数占比 entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { - // 10、占总结项目 + // 5.3解决项目总数占比 entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } @@ -409,13 +432,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } //组织下:已解决项目 or 已结案项目总数 - private int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus) { - return factOriginProjectMainDailyService.getAgencyClosedProjectTotal(customerId,agencyPath,closedStatus, ProjectConstant.CLOSED); + private int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus,String isParty) { + return factOriginProjectMainDailyService.getAgencyClosedProjectTotal(customerId,agencyPath,closedStatus, ProjectConstant.CLOSED,isParty); } //组织下:议题转项目数 - private Integer getAgencyShiftProjectTotal(String customerId, String agencyPath) { - return factOriginIssueMainDailyService.getAgencyShiftProjectTotal(customerId,agencyPath); + private Integer getAgencyShiftProjectTotal(String customerId, String agencyPath,String topicUserIsParty) { + return factOriginIssueMainDailyService.getAgencyShiftProjectTotal(customerId,agencyPath,topicUserIsParty); } //组织内: 党员发布议题 @@ -440,10 +463,12 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService * @param gridId 网格id * @param communityId 社区的agencyId * @param closedStatus 结案状态:已解决 resolved,未解决 unresolved + * @param projectStatus :pending closed + * @param isParty 是否是党员 1:是 * @description 网格或者社区下: 已解决项目 **/ - private Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId, String communityId, String closedStatus) { - return factOriginProjectMainDailyService.getGridOrCommunityClosedProjectTotal(customerId, gridId, communityId, closedStatus,ProjectConstant.CLOSED); + private Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId, String communityId, String closedStatus,String projectStatus,String isParty) { + return factOriginProjectMainDailyService.getGridOrCommunityClosedProjectTotal(customerId, gridId, communityId, closedStatus,projectStatus,isParty); } /** @@ -484,10 +509,11 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService * @param customerId 客户id * @param gridId 网格id * @param communityId 社区的agencyId + * @param issueStatus 议题状态 voting 已转项目:shift_project 已关闭:closed_resloved * @description 网格或者社区下 :议题总数 **/ - private int getGridOrCommunityIssueTotal(String customerId, String gridId, String communityId) { - return factOriginIssueMainDailyService.getGridOrCommunityIssueTotal(customerId, gridId, communityId); + private int getGridOrCommunityIssueTotal(String customerId, String gridId, String communityId,String issueStatus) { + return factOriginIssueMainDailyService.getGridOrCommunityIssueTotal(customerId, gridId, communityId,issueStatus); } /** @@ -495,10 +521,11 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService * @param customerId 客户id * @param gridId 网格id * @param communityId 社区的agencyId + * @param topicUserIsParty 创建话题用户身份标识。1:党员,0:非党员 * @description 网格或者社区下: 议题转项目数 **/ - private Integer getGridOrCommunityShiftProjectTotal(String customerId, String gridId, String communityId) { - return factOriginIssueMainDailyService.getGridOrCommunityShiftProjectTotal(customerId, gridId, communityId); + private Integer getGridOrCommunityShiftProjectTotal(String customerId, String gridId, String communityId,String topicUserIsParty) { + return factOriginIssueMainDailyService.getGridOrCommunityShiftProjectTotal(customerId, gridId, communityId,topicUserIsParty); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index a6a916602d..c8080039cb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.GovernConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dto.extract.form.ExtractScreenFormDTO; @@ -76,6 +77,14 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { *

* 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 * + * + * ================================================================================================================ + * ================================================================================================================ + * 2021-07-09 新注释 + * 公众参与里的指标含义说明: + * 总参与:议题参与的次数(比如 表决 等行为,产品只有表决行为,其他三个街道 包含评论数、点赞数、点踩数) + * 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + * 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) * @return java.lang.Boolean * @author LiuJanJun * @date 2020/9/25 10:24 上午 @@ -86,9 +95,9 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { log.warn("extractTotalDataMonthly param is error,param:{}", JSON.toJSONString(formDTO)); return false; } - extractGridUserJoin(formDTO); - extractAgencyUserJoin(formDTO); - return null; + gridUserJoinCal(formDTO); + agencyUserJoinCal(formDTO); + return true; } private void extractGridUserJoin(ExtractScreenFormDTO formDTO) { @@ -178,7 +187,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); } } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); } private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { @@ -219,7 +228,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); Map orgMemberCount = new HashMap<>(); if (!CollectionUtils.isEmpty(issueTotal)) { - //获取每个网格的应表决人数 + //获取每个网格的应表决人数 (组成员数去重) List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); if (CollectionUtils.isEmpty(memberCountList)) { log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); @@ -253,12 +262,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } }); } - screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); - } - - public static void main(String[] args) { - BigDecimal bigDecimal = new BigDecimal(0); - bigDecimal = bigDecimal.add(new BigDecimal(0 / (1 * 1.0))); + screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); } private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map result) { @@ -274,7 +278,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { } else if (org instanceof DimAgencyEntity) { DimAgencyEntity agency = (DimAgencyEntity) org; entity.setCustomerId(agency.getCustomerId()); - entity.setOrgType(agency.getLevel()); + entity.setOrgType(OrgTypeConstant.AGENCY); entity.setOrgId(agency.getId()); entity.setParentId(agency.getPid()); entity.setOrgName(agency.getAgencyName()); @@ -282,13 +286,17 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setJoinTotal(0); entity.setJoinTotalUpRate(new BigDecimal("0")); - entity.setJoinTotalUpFlag(""); + entity.setJoinTotalUpFlag(GovernConstant.EQ); entity.setAvgIssue(new BigDecimal(0)); entity.setAvgIssueUpRate(new BigDecimal("0")); - entity.setAvgIssueUpFlag(""); + entity.setAvgIssueUpFlag(GovernConstant.EQ); entity.setAvgJoin(new BigDecimal(0)); entity.setAgvgJoinUpRate(new BigDecimal("0")); - entity.setAgvgJoinUpFlag(""); + entity.setAgvgJoinUpFlag(GovernConstant.EQ); + entity.setAvgIssueFz(NumConstant.ZERO); + entity.setAvgIssueFm(NumConstant.ZERO); + entity.setAvgJoinFz(NumConstant.ZERO); + entity.setAvgJoinFm(NumConstant.ZERO); result.put(entity.getOrgId(), entity); } @@ -304,4 +312,290 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { public Boolean extractPerTotalDataDaily(ExtractScreenFormDTO formDTO) { return null; } + + /** + * @Description 基层治理-公众参与【网格-月】 + * @Param formDTO + * @author zxc + * @date 2021/7/9 9:20 上午 + */ + public void gridUserJoinCal(ExtractScreenFormDTO formDTO){ + // 查询客户下所有网格 + List orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(orgList)) { + log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); + return; + } + //构建组织数据 + Map insertMap = new HashMap<>(16); + orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + //获取议题月份增量 + List issueTotal = factIssueGridMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(issueTotal)) { + return; + } + // 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数 + List userCountList = factRegUserGridMonthlyService.selectGridUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + if (CollectionUtils.isEmpty(userCountList)) { + return; + } + // list 转 map 以orgId为key + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); + for (FactIssueGridMonthlyEntity issue : issueTotal) { + String gridId = issue.getGridId(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + continue; + } + // 议题本月增长 + entity.setJoinTotal(issue.getIssueIncr()); + // 网格下 注册居民本月增量,党员认证本月增量,截止本月底居民总数 + GridUserCountResultDTO user = userCountMap.get(gridId); + if (user == null) { + continue; + } + // 议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + log.debug("issue:{}", JSON.toJSONString(issue)); + log.debug("user:{}", JSON.toJSONString(user)); + if (!user.getRegTotal().equals(0)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssueFz(issue.getIssueIncr()); + entity.setAvgIssueFm(user.getRegTotal()); + // 人均议题 + entity.setAvgIssue(avgIssueCount); + } + } + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.GRID_ID); + Map gridMemberCount = new HashMap<>(16); + // 议题月份增量不为空 + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个网格的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.GRID_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + return; + } + // 网格下的组员 + gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + /** + * 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:网格内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) + */ + // 根据网格ID分组 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + //遍历实际参与人数 + for (Map.Entry> entry : voteMap.entrySet()) { + String gridId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + continue; + } + List issueList = entry.getValue(); + BigDecimal realJoinCount = new BigDecimal(0); + // 网格下 议题个数 + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); + // 网格下 组员人数 + Integer memberCount = gridMemberCount.get(gridId); + for (IssueVoteUserCountResultDTO vote : issueList) { + // 每个议题参与人数求和 + realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); + } + if (votedByIssueCount.intValue() != NumConstant.ZERO) { + // 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数) + BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); + entity.setAvgJoinFz(Integer.valueOf(avgFz.toString())); + entity.setAvgJoinFm(Integer.valueOf(realJoinCount.toString())); + entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } + ArrayList dispose = dispose(formDTO, insertMap, OrgTypeConstant.GRID); + screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.GRID); + } + + /** + * @Description 基层治理-公众参与【组织-月】 + * @Param formDTO + * @author zxc + * @date 2021/7/9 9:20 上午 + */ + public void agencyUserJoinCal(ExtractScreenFormDTO formDTO){ + // 查询客户下的所有组织 + List agencyList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(agencyList)) { + log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); + return; + } + //构建组织数据 + Map insertMap = new HashMap<>(16); + agencyList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); + // 查询组织下 议题月增长,截止本月议题总数 + List issueTotal = factIssueAgencyMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + // 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数 + List userCountList = factRegUserAgencyMonthlyService.selectAgencyUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); + // 以agencyId为key + Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); + Set agencyIdSet = new HashSet<>(); + if (!CollectionUtils.isEmpty(issueTotal)) { + issueTotal.forEach(issue -> { + String agencyId = issue.getAgencyId(); + agencyIdSet.add(agencyId); + ScreenUserJoinEntity entity = insertMap.get(agencyId); + if (entity == null){ + return; + } + entity.setJoinTotal(issue.getIssueIncr()); + GridUserCountResultDTO user = userCountMap.get(agencyId); + // 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) + if (!user.getRegTotal().equals(NumConstant.ZERO)) { + BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()), NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + entity.setAvgIssueFz(issue.getIssueIncr()); + entity.setAvgIssueFm(user.getRegTotal()); + entity.setAvgIssue(avgIssueCount); + } + }); + List> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY); + partition.forEach(list -> { + //获取该月 表决的人数 + List voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); + Map orgMemberCount = new HashMap<>(16); + if (!CollectionUtils.isEmpty(issueTotal)) { + //获取每个组织的应表决人数 + List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); + if (CollectionUtils.isEmpty(memberCountList)) { + log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); + return; + } + // (k,v) = (agencyId,组织下的人) + orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); + } + // 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) + // 根据组织ID分组 + Map> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); + for (Map.Entry> entry : voteMap.entrySet()) { + String orgId = entry.getKey(); + ScreenUserJoinEntity entity = insertMap.get(orgId); + List issueList = entry.getValue(); + // 实际参与人数 + BigDecimal realJoinCount = new BigDecimal(NumConstant.ZERO); + // 组织下 的议题数 + BigDecimal votedByIssueCount = new BigDecimal(issueList.get(NumConstant.ZERO).getIssueCount()); + // 组织下应参与人数 + Integer memberCount = orgMemberCount.get(orgId); + for (IssueVoteUserCountResultDTO vote : issueList) { + realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); + } + if (votedByIssueCount.intValue() != 0) { + // 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数) + BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); + entity.setAvgJoin(realJoinCount.divide(votedByIssueCount, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + entity.setAvgJoinFz(Integer.valueOf(realJoinCount.toString())); + entity.setAvgJoinFm(Integer.valueOf(avgFz.toString())); + } + } + }); + } + ArrayList dispose = dispose(formDTO, insertMap, OrgTypeConstant.AGENCY); + screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.AGENCY); + } + + public ArrayList dispose(ExtractScreenFormDTO formDTO,Map insertMap,String flag) { + String beforeNMonthByMonth = DateUtils.getBeforeNMonthByMonth(NumConstant.ONE, formDTO.getMonthId()); + List screenUserJoinEntities = screenUserJoinService.selectScreenUserJoin(formDTO.getCustomerId(), beforeNMonthByMonth, flag); + ArrayList insertList = new ArrayList<>(insertMap.values()); + if (CollectionUtils.isEmpty(screenUserJoinEntities)) { + insertList.forEach(l -> { + // 总的参与次数较上月增长率 + if (l.getJoinTotal().equals(NumConstant.ZERO)) { + l.setJoinTotalUpFlag(GovernConstant.EQ); + l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); + } else if (l.getJoinTotal() > NumConstant.ZERO) { + l.setJoinTotalUpFlag(GovernConstant.INCR); + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + // 人均议题较上月增长率 + if (l.getAvgIssue().equals(NumConstant.ZERO_DECIMAL)) { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); + } else { + l.setAvgIssueUpFlag(GovernConstant.INCR); + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + // 平均参与度较上月增长率 + if (l.getAvgJoin().equals(NumConstant.ZERO_DECIMAL)) { + l.setAgvgJoinUpFlag(GovernConstant.EQ); + l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); + } else { + l.setAgvgJoinUpFlag(GovernConstant.INCR); + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + } + }); + } else { + insertList.forEach(l -> { + screenUserJoinEntities.forEach(s -> { + if (l.getOrgId().equals(s.getOrgId())) { + // 总的参与次数较上月增长率 + if (l.getJoinTotal() > s.getJoinTotal()) { + l.setJoinTotalUpFlag(GovernConstant.INCR); + if (s.getJoinTotal().compareTo(NumConstant.ZERO) == 0){ + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else if (l.getJoinTotal() < s.getJoinTotal()) { + l.setJoinTotalUpFlag(GovernConstant.DECR); + if (s.getJoinTotal().compareTo(NumConstant.ZERO) == 0){ + l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else { + l.setJoinTotalUpFlag(GovernConstant.EQ); + l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); + } + // 人均议题较上月增长率 + Integer re = l.getAvgIssue().compareTo(s.getAvgIssue()); + if (re.equals(NumConstant.ONE)) { + l.setAvgIssueUpFlag(GovernConstant.INCR); + if (s.getAvgIssue().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else if (re.equals(NumConstant.ONE_NEG)) { + l.setAvgIssueUpFlag(GovernConstant.DECR); + if (s.getAvgIssue().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else { + l.setAvgIssueUpFlag(GovernConstant.EQ); + l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); + } + // 平均参与度较上月增长率 + Integer avgJoinRe = l.getAvgJoin().compareTo(s.getAvgJoin()); + if (avgJoinRe.equals(NumConstant.ONE)) { + l.setAgvgJoinUpFlag(GovernConstant.INCR); + if (s.getAvgJoin().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else if (avgJoinRe.equals(NumConstant.ONE_NEG)) { + l.setAgvgJoinUpFlag(GovernConstant.DECR); + if (s.getAvgJoin().compareTo(NumConstant.ZERO_DECIMAL) == 0){ + l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); + }else { + l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin(),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); + } + } else { + l.setAgvgJoinUpFlag(GovernConstant.EQ); + l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); + } + } + }); + }); + } + return insertList; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index d2d37a4693..600786782c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -12,10 +12,12 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactAgencyGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsDailyService; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.stats.DimCustomerService; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -25,8 +27,7 @@ import org.springframework.util.CollectionUtils; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.concurrent.*; /** * @Author zxc @@ -35,6 +36,11 @@ import java.util.concurrent.Executors; @Service @Slf4j public class ScreenExtractServiceImpl implements ScreenExtractService { + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() + .setNameFormat("ScreenExtractServiceImpl-pool-%d").build(); + ExecutorService threadPool = new ThreadPoolExecutor(3, 6, + 10L, TimeUnit.MINUTES, + new LinkedBlockingQueue<>(500), namedThreadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); @Autowired private DimCustomerService dimCustomerService; @@ -76,6 +82,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private FactGridGovernDailyService factGridGovernDailyService; @Autowired private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Autowired + private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; /** * @param extractOriginFormDTO @@ -98,13 +106,17 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { if (StringUtils.isNotBlank(extractOriginFormDTO.getStartDate()) && StringUtils.isNotBlank(extractOriginFormDTO.getEndDate())) { List daysBetween = DateUtils.getDaysBetween(extractOriginFormDTO.getStartDate(), extractOriginFormDTO.getEndDate()); daysBetween.forEach(dateId -> { - extractDaily(customerId, dateId); + boolean isLastDay = false; + if (dateId.equals(daysBetween.get(daysBetween.size() - 1))) { + isLastDay = true; + } + extractDaily(customerId, dateId, isLastDay); }); } else if (StringUtils.isNotBlank(extractOriginFormDTO.getDateId())) { - extractDaily(customerId, extractOriginFormDTO.getDateId()); + extractDaily(customerId, extractOriginFormDTO.getDateId(), true); } else { String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); - extractDaily(customerId, dateId); + extractDaily(customerId, dateId, true); } }); } @@ -132,7 +144,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { } else if (StringUtils.isNotBlank(formDTO.getMonthId())) { extractMonthly(customerId, formDTO.getMonthId()); } else { - String monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-", "").substring(NumConstant.ZERO,NumConstant.SIX); + String monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-", "").substring(NumConstant.ZERO, NumConstant.SIX); extractMonthly(customerId, monthId); } }); @@ -143,129 +155,161 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { /** * @param customerId * @param dateId + * @param isLast 是否是最后一天 * @Description 按天计算 * @author zxc * @date 2020/9/24 10:16 上午 */ - public void extractDaily(String customerId, String dateId) { - //党员基本情况screen_cpc_base_data - try { - partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId,dateId); - }catch (Exception e){ - log.error("党员基本情况抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } - //先锋模范screen_pioneer_data - try { - pioneerDataExtractService.extractGridPioneerData(customerId, dateId); - }catch (Exception e){ - log.error("先锋模范【网格】抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } - try { - pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); - }catch (Exception e){ - log.error("先锋模范【社区】抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } - try { - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); - }catch (Exception e){ - log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } - //公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data - try { - publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId,dateId); - }catch (Exception e){ - log.error("公众参与排行抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } - - //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data - try { - ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); - param2.setCustomerId(customerId); - param2.setDateId(null); - log.info("【难点赌点数据上报开始------】 当前客户Id{}",param2.getCustomerId()); - //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); + public void extractDaily(String customerId, String dateId, boolean isLast) { + //等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁 + final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR); + threadPool.submit(() -> { + //党员基本情况screen_cpc_base_data + try { + partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); + } catch (Exception e) { + log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + //先锋模范screen_pioneer_data + if (isLast) { + try { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + } - screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); - log.info("【难点赌点数据上报结束------】 当前客户Id{}",param2.getCustomerId()); - }catch (Exception e){ - log.error("基层治理-难点赌点抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } + latch.countDown(); + log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + threadPool.submit(() -> { + //公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data + try { + publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); + } catch (Exception e) { + log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + if (isLast) { + //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data + try { + ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); + param2.setCustomerId(customerId); + param2.setDateId(null); + log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); + //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); - ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); - param.setCustomerId(customerId); - param.setDateId(dateId); - //中央区 screen_user_total_data - try { - screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); - }catch (Exception e){ - log.error("中央区抽取到大屏失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } + screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); + log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + } catch (Exception e) { + log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + } + latch.countDown(); + log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + threadPool.submit(() -> { + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + //中央区 screen_user_total_data + try { + screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); + } catch (Exception e) { + log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - // 项目(事件)分析按网格_按天统计 - screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); - }catch (Exception e){ - log.error("项目(事件)分析按网格_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } - try { - // 项目(事件)分析按组织_按天统计 - screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); - }catch (Exception e){ - log.error("项目(事件)分析按组织_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); - } + try { + // 项目(事件)分析按网格_按天统计 + screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + // 项目(事件)分析按组织_按天统计 + screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - //按天统计:网格内各个分类下的项目总数 - try{ - projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId); - }catch(Exception e){ - log.error("按天统计:网格内各个分类下的项目总数,customerId为:"+customerId+"dateId为:"+dateId, e); - } + //按天统计:网格内各个分类下的项目总数 + try { + projectCategoryGridDailyService.extractProjectCategoryData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } - // 按天统计:组织内各个分类下的项目总数 - try{ - projectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId); - }catch(Exception e){ - log.error("按天统计:组织内各个分类下的项目总数,customerId为:"+customerId+"dateId为:"+dateId, e); - } + // 按天统计:组织内各个分类下的项目总数 + try { + projectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } + latch.countDown(); + log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + threadPool.submit(() -> { + //治理能力排行screen_govern_rank_data + try { + governRankDataExtractService.extractGridDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractStreetDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - //治理能力排行screen_govern_rank_data - try { - governRankDataExtractService.extractGridDataDaily(customerId, dateId); - }catch (Exception e){ - log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); - }catch (Exception e){ - log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractStreetDataDaily(customerId, dateId); - }catch (Exception e){ - log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); - }catch (Exception e){ - log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); + extractFactGridGovernDailyFromDTO.setCustomerId(customerId); + extractFactGridGovernDailyFromDTO.setDateId(dateId); + factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); + } catch (Exception e) { + log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try{ - ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO=new ExtractFactGridGovernDailyFromDTO(); - extractFactGridGovernDailyFromDTO.setCustomerId(customerId); - extractFactGridGovernDailyFromDTO.setDateId(dateId); - factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); - }catch(Exception e){ - log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try{ - factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); - }catch(Exception e){ - log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + try { + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); + } catch (Exception e) { + log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + extractPartData(customerId, dateId); + latch.countDown(); + log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + try { + latch.await(); + } catch (InterruptedException e) { + log.error("extractDaily run exception", e); } - extractPartData(customerId, dateId); - log.info("===== extractDaily method end ======"); + log.info("===== extractDaily method end customerId:{}======",customerId); } @Override @@ -274,11 +318,18 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { param.setCustomerId(customerId); param.setDateId(dateId); - try{ + try { //大屏项目数据抽取_按天抽取 screenProjectSettleService.extractScreenData(param); - }catch (Exception e){ - log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); + } catch (Exception e) { + log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try{ + //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数 + //dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 + screenProjectSettleService.updateProjectSatisfactionScore(customerId,dateId,null); + }catch(Exception e){ + log.error("群众不满得分更新失败"); } } @@ -295,56 +346,56 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { //基层治理-公众参与screen_user_join try { publicPartExtractService.extractTotalDataMonthly(formDTO); - }catch (Exception e){ - log.error("基层治理-公众参与抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("基层治理-公众参与抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } //治理能力排行screen_govern_rank_data try { governRankDataExtractService.extractGridData(customerId, monthId); - }catch (Exception e){ - log.error("治理能力排行【网格】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("治理能力排行【网格】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { governRankDataExtractService.extractCommunityData(customerId, monthId); - }catch (Exception e){ - log.error("治理能力排行【社区】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("治理能力排行【社区】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { governRankDataExtractService.extractStreetData(customerId, monthId); - }catch (Exception e){ - log.error("治理能力排行【街道】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("治理能力排行【街道】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { governRankDataExtractService.extractDistrictData(customerId, monthId); - }catch (Exception e){ - log.error("治理能力排行【全区】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("治理能力排行【全区】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } //先进排行 screen_org_rank_data try { orgRankExtractService.extractGridData(customerId, monthId); - }catch (Exception e){ - log.error("先进排行【网格】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("先进排行【网格】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { orgRankExtractService.extractCommunityData(customerId, monthId); - }catch (Exception e){ - log.error("先进排行【社区】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("先进排行【社区】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { orgRankExtractService.extractStreetData(customerId, monthId); - }catch (Exception e){ - log.error("先进排行【街道】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("先进排行【街道】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { orgRankExtractService.extractDistrictData(customerId, monthId); - }catch (Exception e){ - log.error("先进排行【全区】抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("先进排行【全区】抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } // 党建引领 screen_party_branch_data,screen_party_link_masses_data try { partyGuideService.partyGuideExtract(formDTO); - }catch (Exception e){ - log.error("党建引领抽取到大屏失败,参数为:"+ JSON.toJSONString(formDTO), e); + } catch (Exception e) { + log.error("党建引领抽取到大屏失败,参数为:" + JSON.toJSONString(formDTO), e); } try { //基层治理 - 热心市民 screen_party_user_rank_data @@ -352,20 +403,20 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { param.setCustomerId(customerId); param.setDateId(monthId); screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param); - }catch(Exception e){ + } catch (Exception e) { log.error("大屏热心市民/党员得分数据写入失败,参数为:{}" + JSON.toJSONString(formDTO), e); } try { // 项目(事件)数量分析按网格_按月统计 screenProjectQuantityGridMonthlyService.extractionProjectGridMonthly(customerId, monthId); - }catch (Exception e){ - log.error("项目(事件)数量分析按网格_按月统计失败,参数为{}" + JSON.toJSONString(formDTO),e); + } catch (Exception e) { + log.error("项目(事件)数量分析按网格_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e); } try { // 项目(事件)数量分析按组织_按月统计 screenProjectQuantityOrgMonthlyService.extractionProjectOrgMonthly(customerId, monthId); - }catch (Exception e){ - log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO),e); + } catch (Exception e) { + log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e); } //此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量 ExecutorService pool = Executors.newSingleThreadExecutor(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index d40fbd8b6a..200dd05675 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -387,8 +387,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr name.deleteCharAt(name.length() - NumConstant.ONE); diffEntity.setEventCategoryCode(code.toString()); diffEntity.setEventCategoryName(name.toString()); - log.info("code:{}",code.toString()); - log.info("name:{}",name.toString()); + log.debug("code:{}",code.toString()); + log.debug("name:{}",name.toString()); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java index 781211b4bf..0b4a519efe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java @@ -102,6 +102,8 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic } else { meta.setLinkUserId(meta.getLinkName()); } + //项目满意度得分 + meta.setSatisfactionScore(projectService.calProjectSatisfactionScore(param.getCustomerId(),meta.getProjectId())); return meta; })).collect(Collectors.toList()); } @@ -170,4 +172,43 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic } + /** + * 更新项目得分 + * + * @param customerId + * @param dateId //dateId可以为空,如果为空重新计算当前客户下所有的项目的分数; dateId不为空,只计算当天存在评价记录的项目,更新项目对应的得分。 + * @param projectId 项目id可为空 + * @return void + */ + @Override + public void updateProjectSatisfactionScore(String customerId, String dateId,String projectId) { + log.info("customerId="+customerId+";dateId="+dateId+";projectId="+projectId); + if(StringUtils.isNotBlank(projectId)){ + BigDecimal calProjectSatisfactionScore = projectService.calProjectSatisfactionScore(customerId, projectId); + log.warn("单独计算projectId=" + projectId + "满意度得分:" + calProjectSatisfactionScore); + targetDbService.updateProjectSatisfactionScore(projectId,calProjectSatisfactionScore); + return; + } + List projectIds=new ArrayList<>(); + if(StringUtils.isNotBlank(dateId)){ + log.warn("按日期计算"); + List list=projectService.selectEvaluateProjectIds(customerId,dateId); + if(!CollectionUtils.isEmpty(list)){ + projectIds.addAll(list); + } + }else{ + log.warn("计算当前客户下,来源于议题已结案的项目对应的满意度得分"); + // 只有来源于议题的项目,才有分数 + List closedProjectIds=projectService.selectClosedProjectIds(customerId,"issue","closed"); + if(!CollectionUtils.isEmpty(closedProjectIds)){ + projectIds.addAll(closedProjectIds); + } + } + projectIds.forEach(id -> { + BigDecimal calProjectSatisfactionScore = projectService.calProjectSatisfactionScore(customerId, id); + log.warn("projectId=" + id + "满意度得分:" + calProjectSatisfactionScore); + targetDbService.updateProjectSatisfactionScore(id, calProjectSatisfactionScore); + }); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java index 994f8818fb..2f3edf7951 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java @@ -1,8 +1,8 @@ package com.epmet.service.evaluationindex.indexcal; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.support.normalizing.batch.CalculateResult; import com.epmet.support.normalizing.batch.IndexInputVO; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index bd9a5c8b5a..0b29ad3c72 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -19,8 +19,8 @@ import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDa import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao; import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.indexcal.*; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.entity.evaluationindex.indexcal.GridScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.GridSubScoreEntity; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 961970fc9b..b5d77983b0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -679,7 +679,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ partition.forEach(publish -> { List index1SampleValues = new ArrayList<>(); publish.forEach(c -> { - c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); +// c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -769,7 +769,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ governAvg.forEach(avg -> { List index1SampleValues = new ArrayList<>(); avg.forEach(c -> { - c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); +// c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -782,6 +782,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ } else { // 治理能力的六个五级指标 List> communityGovernAbility = disposeFiveLevel(form); + log.info("治理能力的六个五级指标==="+communityGovernAbility.toString()); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); }else{ @@ -860,7 +861,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); List index1SampleValues = new ArrayList<>(); serviceAvg.forEach(c -> { - c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); +// c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -962,6 +963,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ orgIds.forEach(org -> { SubCommunityAvgResultDTO s = new SubCommunityAvgResultDTO(); s.setAgencyId(org.getOrgId()); + s.setParentId(org.getPid()); subAvgScores.add(s); }); // 把除去孔村镇的数据赋值,孔村在下边单独处理 @@ -1016,7 +1018,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ kongCunGovernAbility.forEach(k -> { k.put("AGENCY_ID",k.get("AGENCY_ID")); - k.put("PARENT_ID",NumConstant.ZERO_STR); + k.put("PARENT_ID",k.get("PARENT_ID")); }); } if (!CollectionUtils.isEmpty(communityGovernAbility)){ @@ -1045,7 +1047,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ kongCunActivityCountList.forEach(k -> { k.put("AGENCY_ID",k.get("AGENCY_ID")); - k.put("PARENT_ID",NumConstant.ZERO_STR); + k.put("PARENT_ID",k.get("PARENT_ID")); }); } if (!CollectionUtils.isEmpty(ActivityCountList)){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 127479f37e..57c4a8370f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -16,7 +16,6 @@ import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; import com.epmet.dao.evaluationindex.indexcal.GridScoreDao; import com.epmet.dao.evaluationindex.indexcoll.*; import com.epmet.dao.evaluationindex.screen.*; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.result.AgencyMonthCountResultDTO; import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; @@ -24,6 +23,7 @@ import com.epmet.dto.indexcal.DeptScoreDTO; import com.epmet.dto.indexcollect.form.*; import com.epmet.dto.screen.FactIndexCommunityScoreDTO; import com.epmet.dto.screen.FactIndexGridScoreDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO; import com.epmet.dto.screencoll.form.IndexDataYearlyFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index 86fbe9e336..5ded177ae0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -17,17 +17,16 @@ package com.epmet.service.evaluationindex.screen; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; - -import java.util.List; - import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.org.CustomerAgencyEntity; +import java.util.List; import java.util.Map; /** @@ -114,4 +113,29 @@ public interface ScreenCustomerAgencyService{ * @date 2021/5/24 9:42 上午 */ ScreenCustomerAgencyEntity selectTopAgency(String customerId); + + /** + * 获取当前客户下的跟组织 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + ScreenCustomerAgencyEntity getRootAgency(String customerId); + + List getByPid(String customerId, String parentAgencyId); + + /** + * 查询出孔村的社区 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + List selectKcCommunity(String customerId); + + /** + * @Description 查询客户index库组织信息供数据封装使用 + * @author sun + */ + List getByCustomerId(String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index f2a40b11c0..1fb59aa3b5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -19,10 +19,10 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.dto.screen.ScreenProjectGridDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity; @@ -102,11 +102,13 @@ public interface ScreenCustomerGridService extends BaseService selectBelongGridInfo(String customerId,String level); + List selectBelongGridInfo(String customerId, String level); Integer updateCenterPointByName(String customerId, String title, List center); List selectGridInfoByCustomerId(String customerId); List selectGridInfoList(String customerId, String pids); + + List selectEntityByAgencyId(String customerId, String parentAgencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java index 0fa086cfb7..9775908921 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenGovernRankDataDailyService.java @@ -118,4 +118,23 @@ public interface ScreenGovernRankDataDailyService extends BaseService entityList); + + /** + * 删除数据 + * @author zhaoqifeng + * @date 2021/6/24 14:46 + * @param customerId + * @param dateId + * @return java.lang.Integer + */ + Integer deleteGovernRankDataDaily(String customerId, String dateId); + + /** + * 批量插入 + * @author zhaoqifeng + * @date 2021/6/24 15:24 + * @param list + * @return void + */ + void insertBatch(List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java index b6f2c25c15..7b82707c91 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java @@ -24,6 +24,7 @@ import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -124,4 +125,6 @@ public interface ScreenProjectDataService extends BaseService meta,List orient); + + int updateProjectSatisfactionScore(String projectId, BigDecimal calProjectSatisfactionScore); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java index 0a42c758a4..e3574393e8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserJoinService.java @@ -36,9 +36,20 @@ public interface ScreenUserJoinService extends BaseService * * @param formDTO * @param list + * @param delFlag 删除标志 agency,grid * @return java.lang.Boolean * @author LiuJanJun * @date 2020/9/27 4:40 下午 */ - Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list); + Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list,String delFlag); + + /** + * @Description 根据月份查询screenUserJoin + * @Param customerId + * @Param monthId + * @Param flag :agency : grid + * @author zxc + * @date 2021/7/9 3:13 下午 + */ + List selectScreenUserJoin(String customerId,String monthId,String flag); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 96019615ea..16ba642e62 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.constant.ScreenConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; @@ -267,5 +268,40 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ return screenCustomerAgencyDao.selectTopAgency(customerId); } + /** + * 获取当前客户下的跟组织 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + @Override + public ScreenCustomerAgencyEntity getRootAgency(String customerId) { + return screenCustomerAgencyDao.selectRootAgency(customerId); + } + + @Override + public List getByPid(String customerId, String parentAgencyId) { + return screenCustomerAgencyDao.selectByPid(customerId,parentAgencyId); + } + + /** + * 查询出孔村的社区 + * + * @param customerId + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity + */ + @Override + public List selectKcCommunity(String customerId) { + return screenCustomerAgencyDao.selectKcCommunity(customerId); + } + + /** + * @Description 查询客户index库组织信息供数据封装使用 + * @author sun + */ + @Override + public List getByCustomerId(String customerId) { + return screenCustomerAgencyDao.selectByCustomerId(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index b012accfe0..1ae24e2d25 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -26,10 +26,10 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.dto.screen.ScreenProjectGridDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity; @@ -210,4 +210,9 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectGridInfoList(String customerId, String pids) { return baseDao.selectGridInfoList(customerId,pids); } + + @Override + public List selectEntityByAgencyId(String customerId, String parentAgencyId) { + return baseDao.selectEntityByAgencyId(customerId,parentAgencyId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java index 3c48645963..ca03285245 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenGovernRankDataDailyServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; @@ -167,4 +168,36 @@ public class ScreenGovernRankDataDailyServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ScreenGovernRankDataDailyEntity :: getCustomerId, customerId) + .eq(ScreenGovernRankDataDailyEntity :: getDateId, dateId); + return baseDao.delete(wrapper); + } + + /** + * 批量插入 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:24 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void insertBatch(List list) { + this.insertBatch(ConvertUtils.sourceToTarget(list, ScreenGovernRankDataDailyEntity.class)); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index 7430c1abe7..14402b1f86 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -30,8 +30,8 @@ import com.epmet.constant.PingYinConstant; import com.epmet.constant.ScreenConstant; import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; -import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; +import com.epmet.dto.screen.ScreenCustomerGridDTO; import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO; import com.epmet.dto.screen.result.CategoryProjectResultDTO; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index bf8c212f6b..5e14db736e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; @@ -60,12 +61,6 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl page(Map params) { @@ -140,7 +135,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl deleteWrapper = new QueryWrapper<>(); - deleteWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()); - baseDao.delete(deleteWrapper); - QueryWrapper screenProjectImgDataEntityQueryWrapper = new QueryWrapper<>(); - screenProjectImgDataEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()); - screenProjectImgDataDao.delete(screenProjectImgDataEntityQueryWrapper); + baseDao.deleteByProjectId(param.getCustomerId(), item.getProjectId()); + screenProjectImgDataDao.deleteByProjectId(param.getCustomerId(), item.getProjectId()); //如果orgType未知,获取一下 // if ("unknown".equals(item.getOrgType())){ @@ -285,4 +270,9 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl implements ScreenUserJoinService { @Override - @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Transactional(rollbackFor = Exception.class) - public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list) { + public Boolean deleteAndInsertBatch(ExtractScreenFormDTO formDTO, List list, String delFlag) { if (formDTO == null || StringUtils.isBlank(formDTO.getCustomerId()) || StringUtils.isBlank(formDTO.getMonthId()) || CollectionUtils.isEmpty(list)) { log.error("deleteAndInsertBatch param is error"); return false; } int deleteNum; do { - deleteNum = baseDao.deleteUserJoin(formDTO.getCustomerId(), formDTO.getMonthId()); + deleteNum = baseDao.deleteUserJoinByCategory(formDTO.getCustomerId(), formDTO.getMonthId(),delFlag); } while (deleteNum != NumConstant.ZERO); @@ -72,7 +72,6 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl lastMonthJoinList = baseDao.selectLastMonthScreenUserJoinList(formDTO.getCustomerId(), - dimIdBean.getYearId(), dimIdBean.getMonthId(), orgIds); @@ -124,6 +123,19 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl selectScreenUserJoin(String customerId, String monthId, String flag) { + return baseDao.selectScreenUserJoin(customerId, monthId, flag); + } + /** * 计算 本月数值 相较于 上月数值,的增长率 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java index 28532046fb..3b96365fbe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.CompareConstant; import com.epmet.constant.DataSourceConstant; @@ -35,6 +36,7 @@ import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.service.evaluationindex.screen.ScreenEventImgDataService; import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -54,6 +56,7 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2020-05-11 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @@ -374,34 +377,36 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { orgIds[i] = formDTO.getDataList().get(i).getOrgId(); } - String[] lastMonth = this.lastMonthDate(); + /*String[] lastMonth = this.lastMonthDate(); // 获取上个月的基本数据 - String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE]; + String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE];*/ + String monthId= DateUtils.getBeforeNMonthByMonth(1,formDTO.getMonthId()); List lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId, - lastMonth[NumConstant.ZERO], - moneth, + monthId, orgIds); // 定义本月待添加数据的集合 List curMonthJoinEntityList = new ArrayList<>(); // 增加率计算 if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) { + log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId的上月已有数据集合长度="+lastMonthJoinList.size()); // 存在上个月的数据 (本月-上月)/上月 *100 for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) { for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) { if (formDTO.getDataList().get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())) { ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.getDataList().get(i), ScreenUserJoinEntity.class); - entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getJoinTotal(), formDTO.getDataList().get(j).getJoinTotal())); - entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getJoinTotal(), formDTO.getDataList().get(j).getJoinTotal())); - entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgIssue(), formDTO.getDataList().get(j).getAvgIssue())); - entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgIssue(), formDTO.getDataList().get(j).getAvgIssue())); - entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgJoin(), formDTO.getDataList().get(j).getAvgJoin())); - entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgJoin(), formDTO.getDataList().get(j).getAvgJoin())); + entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(j).getJoinTotal(), formDTO.getDataList().get(i).getJoinTotal())); + entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(j).getJoinTotal(), formDTO.getDataList().get(i).getJoinTotal())); + entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(j).getAvgIssue(), formDTO.getDataList().get(i).getAvgIssue())); + entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(j).getAvgIssue(), formDTO.getDataList().get(i).getAvgIssue())); + entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(j).getAvgJoin(), formDTO.getDataList().get(i).getAvgJoin())); + entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(j).getAvgJoin(), formDTO.getDataList().get(i).getAvgJoin())); curMonthJoinEntityList.add(entity); } } } } else { + log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId上月不存在数据。"); // 计算增长率后的 待新增数据 BigDecimal zero = new BigDecimal(NumConstant.ZERO); // 不存在上个月的数据 @@ -547,7 +552,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Override @Transactional(rollbackFor = Exception.class) public void insertPioneerData(PioneerDataListFormDTO formDTO, String customerId) { - if (formDTO.getIsFirst()) { + if (formDTO.getIsFirst() && !CollectionUtils.isEmpty(formDTO.getDataList())) { int deleteNum; do { deleteNum = screenPioneerDataDao.deletePioneerDataByCustomerId(customerId, IndexCalConstant.DELETE_SIZE); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java new file mode 100644 index 0000000000..b00c8cace6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java @@ -0,0 +1,302 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.BaseReportConstant; +import com.epmet.dao.stats.BaseReportDao; +import com.epmet.dto.basereport.form.*; +import com.epmet.service.BaseReportService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * @Author sun + * @Description 部分基础数据上报 + */ +@Service +@Slf4j +public class BaseReportServiceImpl implements BaseReportService { + + @Autowired + private BaseReportDao baseReportDao; + + + /** + * @Param formDTO + * @Description 网格注册用户数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridRegUser(GridRegUserFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridRegUser(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchGridRegUser(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 组织机关注册用户数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyRegUser(AgencyRegUserFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyRegUser(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchAgencyRegUser(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 网格群组总数 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridGroupTotal(GridGroupTotalFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridGroupTotal(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchGridGroupTotal(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 组织群组总数 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyGroupTotal(AgencyGroupTotalFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyGroupTotal(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchAgencyGroupTotal(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 网格热议话题数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridHotTopic(GridHotTopicFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridHotTopic(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchGridHotTopic(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 组织热议话题数据 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyHotTopic(AgencyHotTopicFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyHotTopic(formDTO.getDataList().get(0).getCustomerId(), formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseReportDao.insertBatchAgencyHotTopic(formDTO.getDataList()); + } + } + + /** + * @Param formDTO + * @Description 网格状态话题数据-008 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridTopicStatus(GridTopicStatusFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridTopicStatus(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridTopicStatus(p); + }); + } + + /** + * @Param formDTO + * @Description 组织状态话题数据-007 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyTopicStatus(AgencyTopicStatusFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyTopicStatus(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyTopicStatus(p); + }); + } + + /** + * @Param formDTO + * @Description 网格话题转议题数据-006 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridTopicIssue(GridTopicIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridTopicIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridTopicIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 组织话题转议题数据-005 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyTopicIssue(AgencyTopicIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyTopicIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyTopicIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 网格议题数据-004 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridIssue(GridIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 组织议题数据-003 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void agencyIssue(AgencyIssueFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyIssue(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyIssue(p); + }); + } + + /** + * @Param formDTO + * @Description 网格项目数据-002 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void gridProject(GridProjectFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delGridProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertGridProject(p); + }); + } + + /** + * @Param formDTO + * @Description 组织项目数据-001 + * @author sun + */ + @Override + public void agencyProject(AgencyProjectFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + baseReportDao.insertAgencyProject(p); + }); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java new file mode 100644 index 0000000000..63e588c647 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/GovernanceDataReportServiceImpl.java @@ -0,0 +1,112 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; +import com.epmet.dto.extract.form.GridGovernDailyFormDTO; +import com.epmet.dto.screencoll.form.GovernRankDataDailyFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenGovernRankDataDailyEntity; +import com.epmet.service.GovernanceDataReportService; +import com.epmet.service.evaluationindex.extract.todata.FactAgencyGovernDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; +import com.epmet.service.evaluationindex.screen.ScreenGovernRankDataDailyService; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/24 15:19 + */ +@Service +public class GovernanceDataReportServiceImpl implements GovernanceDataReportService { + @Resource + private ScreenGovernRankDataDailyService screenGovernRankDataDailyService; + @Resource + private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Resource + private FactGridGovernDailyService factGridGovernDailyService; + + + /** + * 基层治理-治理能力排行数据(按天统计) + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 10:14 + */ + @Override + public void insertGovernRankDataDaily(GovernRankDataDailyFormDTO formDTO, String customerId) { + if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.SIX) { + throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId()); + } + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = screenGovernRankDataDailyService.deleteGovernRankDataDaily(customerId, formDTO.getDateId()); + } while (deleteNum != NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + formDTO.getDataList().forEach(item -> item.setCustomerId(customerId)); + screenGovernRankDataDailyService.insertBatch(formDTO.getDataList()); + } + } + + /** + * 组织的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + @Override + public void insertAgencyGovernDaily(AgencyGovernDailyFormDTO formDTO, String customerId) { + if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.EIGHT) { + throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId()); + } + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = factAgencyGovernDailyService.deleteAgencyGovernData(customerId, formDTO.getDateId()); + } while (deleteNum != NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + formDTO.getDataList().forEach(item -> item.setCustomerId(customerId)); + factAgencyGovernDailyService.insertBatch(formDTO.getDataList()); + } + } + + /** + * 网格的治理指数,按天统计 + * + * @param formDTO + * @param customerId + * @return void + * @author zhaoqifeng + * @date 2021/6/24 15:40 + */ + @Override + public void insertGridGovernDaily(GridGovernDailyFormDTO formDTO, String customerId) { + if (StringUtils.isEmpty(formDTO.getDateId()) || formDTO.getDateId().length() != NumConstant.EIGHT) { + throw new RenException("dateId格式应为: yyyyMMdd,当前传入:" + formDTO.getDateId()); + } + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = factGridGovernDailyService.deleteGridGovernData(customerId, formDTO.getDateId()); + } while (deleteNum != NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + formDTO.getDataList().forEach(item -> item.setCustomerId(customerId)); + factGridGovernDailyService.insertBatch(formDTO.getDataList()); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java index 7c0a98776f..c359035647 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java @@ -17,6 +17,7 @@ import com.epmet.dto.stats.FactIssueGridMonthlyDTO; import com.epmet.entity.stats.*; import com.epmet.service.Issue.IssueService; import com.epmet.service.StatsIssueService; +import com.epmet.service.org.CustomerGridService; import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; @@ -57,6 +58,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { private FactIssueGridDailyService factIssueGridDailyService; @Autowired private FactIssueGridMonthlyService factIssueGridMonthlyService; + @Autowired + private CustomerGridService customerGridService; @Override public void agencyGridIssueStats(StatsFormDTO formDTO) { @@ -119,16 +122,17 @@ public class StatsIssueServiceImpl implements StatsIssueService { DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //清空数据 factIssueAgencyDailyService.deleteByCustomerId(customerId, dimId.getDateId()); + List gridList = customerGridService.getDelGridList(customerId); //获取当前客户下所有机关 List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //获取机关下议题各种状态的数目统计 - List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString, gridList); //获取机关下议题各种状态的数目增量 - List issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); + List issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString, gridList); //获取机关下已关闭议题统计 - List issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); + List issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString, gridList); //获取机关下已关闭议题增量 - List issueAgencyClosedIncList = issueService.getAgencyClosedIssueInc(customerId, dateString); + List issueAgencyClosedIncList = issueService.getAgencyClosedIssueInc(customerId, dateString, gridList); //已结案项目统计 List projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); //已结案项目增量 @@ -180,14 +184,15 @@ public class StatsIssueServiceImpl implements StatsIssueService { dimAgencyDTO.setCustomerId(customerId); //获取日期相关维度 DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + List gridList = customerGridService.getDelGridList(customerId); //清空数据 factIssueAgencyMonthlyService.deleteByCustomerId(customerId, dimId.getMonthId()); //获取当前客户下所有机关 List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //获取机关下议题各种状态的数目统计 - List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString, gridList); //获取机关下已关闭议题统计 - List issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); + List issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString, gridList); //已结案项目统计 List projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); //统计机关下议题各个指标月度增量 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index af00a87d3b..ca28b9fd3e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.entity.project.ProjectProcessEntity; import com.epmet.entity.stats.*; import com.epmet.service.Issue.IssueService; import com.epmet.service.StatsProjectService; +import com.epmet.service.org.CustomerGridService; import com.epmet.service.project.ProjectProcessService; import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; @@ -29,6 +30,7 @@ import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; /** * 数据统计-项目(独立于任何具体数据源外层的service) @@ -59,6 +61,8 @@ public class StatsProjectServiceImpl implements StatsProjectService { private FactGridProjectDailyService factGridProjectDailyService; @Autowired private FactGridProjectMonthlyService factGridProjectMonthlyService; + @Autowired + private CustomerGridService customerGridService; /** * @Author sun @@ -123,6 +127,31 @@ public class StatsProjectServiceImpl implements StatsProjectService { log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId); List processList = projectProcessService.getProcessList(projectEntity); + //20210721 sun 业务逻辑调整,网格删除,组织没有删除情况,相应的组织层级数据统计应舍弃以删除网格数据 start + //处理逻辑:查询已删除网格下项目Id,将已查询的项目、节点数据中的脏数据剔除【项目库有张表有网格Id,可以查出每个项目所属网格,但是关联该表后sql查询效率极低固舍弃此方案】 + //4-1.查询客户下已删除网格列表下存在的项目Id集合 + List list = customerGridService.getdelGridProjectIdList(customerId); + if (list.size() > NumConstant.ZERO) { + Map map = list.stream().collect(Collectors.toMap(String::toString, v -> v, (c1, c2) -> c1)); + //4-2.遍历删除项目主表查询的无效数据 + Iterator proiter = projectList.iterator(); + while (proiter.hasNext()) { + ProjectEntity next = proiter.next(); + if (map.containsKey(next.getId())) { + proiter.remove(); + } + } + //4-3.遍历删除项目节点表查询的无效数据 + Iterator iterator = processList.iterator(); + while (iterator.hasNext()) { + ProjectProcessEntity next = iterator.next(); + if (map.containsKey(next.getProjectId())) { + iterator.remove(); + } + } + } + //20210721 sun end + //5:机关层级日月统计 if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { //5.1:执行机关日数据统计 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index 0d35eede37..dc082b44ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -3,28 +3,40 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; +import com.epmet.dao.stats.DataStatsDao; import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.crm.CustomerRelationDTO; +import com.epmet.dto.stats.form.GmUploadDataFormDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.service.StatsUserService; +import com.epmet.service.crm.CustomerService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerService; import com.epmet.service.stats.user.UserStatisticalService; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; +import org.apache.commons.collections4.ListUtils; 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.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Calendar; import java.util.Date; +import java.util.Iterator; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; /** @@ -49,6 +61,13 @@ public class StatsUserServiceImpl implements StatsUserService { @Autowired private UserStatisticalService userStatisticalService; + @Autowired + private ScreenCustomerAgencyService screenCustomerAgencyService; + @Autowired + private DataStatsDao dataStatsDao; + @Autowired + private CustomerService customerService; + /** * @param formDTO 如果目标日期为空,则自动计算为T-1天 @@ -59,9 +78,9 @@ public class StatsUserServiceImpl implements StatsUserService { **/ @Override public void partition(StatsFormDTO formDTO) { - if(StringUtils.isBlank(formDTO.getDate())){ + if (StringUtils.isBlank(formDTO.getDate())) { //如果定时任务没有指定参数,默认数据更新至t-1,包含t-1这一天内的数据 - formDTO.setDate(DateUtils.getBeforeNDay(1,DateUtils.DATE_PATTERN)); + formDTO.setDate(DateUtils.getBeforeNDay(1, DateUtils.DATE_PATTERN)); } int pageNo = NumConstant.ONE; @@ -91,15 +110,15 @@ public class StatsUserServiceImpl implements StatsUserService { } /** - * @Description 生成用户统计数据 * @param customerId 客户Id - * @param date 目标日期 + * @param date 目标日期 * @return + * @Description 生成用户统计数据 * @author wangc * @date 2020.06.28 14:40 - **/ - void generate(String customerId,Date date){ - log.info("customerId:"+customerId+";date:"+DateUtils.format(date,DateUtils.DATE_TIME_PATTERN)); + **/ + void generate(String customerId, Date date) { + log.info("customerId:" + customerId + ";date:" + DateUtils.format(date, DateUtils.DATE_TIME_PATTERN)); //1.初始化时间参数 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); @@ -111,14 +130,14 @@ public class StatsUserServiceImpl implements StatsUserService { //2.初始化时间维度{"dateId":"20210325","monthId":"202103","quarterId":"2021Q1","weekId":"2021W13","yearId":"2021"} DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); - log.info("timeDimension:"+ JSON.toJSONString(timeDimension)); + log.info("timeDimension:" + JSON.toJSONString(timeDimension)); //3.初始化机关维度 - List agencies = dimAgencyService.getAllAgency(customerId); + List agencies = dimAgencyService.getAllAgency(customerId); //4.计算机关统计数据、生成唯一性统计数据 try { UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); userStatisticalService.insertUniquely(agencyData); - }catch(Exception e){ + } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_AGENCY_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage())); } @@ -126,8 +145,126 @@ public class StatsUserServiceImpl implements StatsUserService { try { UserStatisticalData gridData = userService.traverseGridUser(agencies, date, timeDimension); userStatisticalService.insertUniquely(gridData); - }catch(Exception e){ + } catch (Exception e) { log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage())); } } + + /** + * @Param formDTO + * @Description 数据上报--网格员事件总数上报 + * @author sun + */ + @Override + public void gmUploadEvent(GmUploadEventFormDTO formDTO) { + //1.数据上报只涉及数据库部分数据,其他数据都是计算出来的,所以不存在删除历史数据,有就更新没有就新增 + String customerId = formDTO.getDataList().get(0).getCustomerId(); + + //2.数据准备 + //2-1.查询当前客户index库组织信息供数据封装使用 + List agencyList = screenCustomerAgencyService.getByCustomerId(customerId); + //2-2.查询客户所属父客户信息 + CustomerRelationDTO crm = customerService.getByCustomerId(customerId); + if (null == crm) { + throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId)); + } + + //3.分批处理上传数据 + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + for (int i = 0; i < partition.size(); i++) { + List p = partition.get(i); + //4.封装数据并执行 + Iterator iterator = p.iterator(); + while (iterator.hasNext()) { + GmUploadEventFormDTO.DataList m = iterator.next(); + AtomicReference bl = new AtomicReference<>(false); + StringBuffer gridPids = new StringBuffer(""); + agencyList.forEach(ag -> { + if (m.getAgencyId().equals(ag.getId())) { + bl.set(true); + gridPids.append((StringUtils.isEmpty(ag.getPids()) || "0".equals(ag.getPids()) ? ag.getId() : ag.getPids().replaceAll(",", ":") + ":" + ag.getId())); + } + }); + if (bl.get()) { + m.setSourceType("external"); + m.setParentCustomerId(crm.getParentCustomerId()); + m.setGridPids(gridPids.toString()); + m.setPatrolTotal(NumConstant.ZERO); + m.setTotalTime(NumConstant.ZERO); + m.setLatestPatrolStatus("end"); + } else { + log.warn(String.format("网格员事件总数上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + iterator.remove(); + } + } + //批量新增或修改数据 + if (!CollectionUtils.isEmpty(p)) { + userService.saveOrUpGmUploadEvent(p); + } + } + + } + + /** + * @Param formDTO + * @Description 数据上报--网格员数据分析上报 + * @author sun + */ + @Override + public void gmUploadData(GmUploadDataFormDTO formDTO) { + String customerId = formDTO.getDataList().get(0).getCustomerId(); + //1.判断是否批量删除历史数据 + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = dataStatsDao.delGmUploadData(customerId, formDTO.getDataList().get(0).getDateId()); + } while (deleteNum > NumConstant.ZERO); + } + + //2.数据准备 + //2-1.查询当前客户index库组织信息供数据封装使用 + List agencyList = screenCustomerAgencyService.getByCustomerId(customerId); + //2-2.查询客户所属父客户信息 + CustomerRelationDTO crm = customerService.getByCustomerId(customerId); + if (null == crm) { + throw new RenException(String.format("未查询到子客户所属父客户信息,子客户Id->%s", customerId)); + } + + //3.分批处理上传数据 + List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); + for (int i = 0; i < partition.size(); i++) { + List p = partition.get(i); + //4.封装数据并执行 + Iterator iterator = p.iterator(); + while (iterator.hasNext()) { + GmUploadDataFormDTO.DataList m = iterator.next(); + AtomicReference bl = new AtomicReference<>(false); + StringBuffer pid = new StringBuffer(""); + StringBuffer pids = new StringBuffer(""); + agencyList.forEach(ag -> { + if (m.getAgencyId().equals(ag.getId())) { + bl.set(true); + pid.append(ag.getPid()); + pids.append((StringUtils.isEmpty(ag.getPids()) || "0".equals(ag.getPids()) ? ag.getId() : ag.getPids().replaceAll(",", ":") + ":" + ag.getId())); + } + }); + if (bl.get()) { + m.setSourceType("external"); + m.setParentCustomerId(crm.getParentCustomerId()); + m.setPid(pid.toString()); + m.setPids(pids.toString()); + } else { + log.warn(String.format("网格员数据分析上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + iterator.remove(); + } + } + //批量新增或修改数据 + if (!CollectionUtils.isEmpty(p)) { + dataStatsDao.saveOrUpGmUploadData(p); + } + } + + } + + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java index 0eb247471e..60991b69bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -48,4 +48,14 @@ public interface CustomerAgencyService { * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity */ CustomerAgencyEntity getAgencyByDeptId(String deptId); + + /** + * 将孔村、榆山、锦水3个街道的组织插入到gov-org库的customer_agency + * + * @param fromCustomerId + * @param toCustomerId + * @return Result + */ + void sysAgencyInfo(String fromCustomerId, String toCustomerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 2cdee8ccad..2da4de7518 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -1,15 +1,17 @@ package com.epmet.service.org; +import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import java.util.Date; import java.util.List; -public interface CustomerGridService { +public interface CustomerGridService extends BaseService { /** * 根据创建时间,截取时间段内的网格 * @param start @@ -50,4 +52,29 @@ public interface CustomerGridService { * @Date 2020/9/16 14:02 **/ List queryGridInfoList(String customerId); + + /** + * 查询工作人员网格关系 + * @author zhaoqifeng + * @date 2021/7/5 10:21 + * @param customerId + * @return java.util.List + */ + List getCustomerStaffGridList(String customerId); + + /** + * 获取已删除的grid + * @author zhaoqifeng + * @date 2021/7/20 16:33 + * @param customerId + * @return java.util.List + */ + List getDelGridList(String customerId); + + /** + * @Author sun + * @Description 查询客户下已删除网格列表下存在的项目Id集合 + **/ + List getdelGridProjectIdList(String customerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java new file mode 100644 index 0000000000..6f03097838 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java @@ -0,0 +1,22 @@ +package com.epmet.service.org; + +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface CustomerStaffService { + + /** + * desc: 条件获取 网格下的所有人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 3:13 下午 + */ + List selectStaffGridList(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index d603b6781c..66ea3b4b37 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -1,15 +1,24 @@ package com.epmet.service.org.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.StatsCustomerAgencyDao; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; import com.epmet.dto.org.result.OrgStaffDTO; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerAgencyEntity; +import com.epmet.entity.org.CustomerGridEntity; +import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.org.CustomerAgencyService; +import com.epmet.service.org.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.Date; @@ -21,6 +30,12 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { @Autowired private StatsCustomerAgencyDao customerAgencyDao; + @Autowired + private ScreenCustomerAgencyService screenCustomerAgencyService; + @Autowired + private ScreenCustomerGridService screenCustomerGridService; + @Autowired + private CustomerGridService customerGridService; @Override public List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { @@ -103,4 +118,157 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { public CustomerAgencyEntity getAgencyByDeptId(String deptId) { return customerAgencyDao.selectByDeptId(deptId); } + + /** + * 将孔村、榆山、锦水3个街道的组织插入到gov-org库的customer_agency + * + * @param fromCustomerId + * @param toCustomerId + * @return Result + */ + @Override + public void sysAgencyInfo(String fromCustomerId, String toCustomerId) { + // 1、查询出平阴县组织信息 + CustomerAgencyEntity pingYin = customerAgencyDao.selecByAreaCode(toCustomerId, "370124"); + // 2、查询出街道 + ScreenCustomerAgencyEntity street = screenCustomerAgencyService.getRootAgency(fromCustomerId); + CustomerAgencyEntity insertStreetEntity = new CustomerAgencyEntity(); + insertStreetEntity.setCustomerId(pingYin.getCustomerId()); + insertStreetEntity.setPid(pingYin.getId()); + if(!StringUtils.isEmpty(pingYin.getPids())){ + insertStreetEntity.setPids(pingYin.getPids().concat(StrConstant.COLON).concat(pingYin.getId())); + }else{ + insertStreetEntity.setPids(pingYin.getId()); + } + if(org.apache.commons.lang3.StringUtils.isNotBlank(pingYin.getAllParentName())){ + insertStreetEntity.setAllParentName(pingYin.getAllParentName().concat(StrConstant.HYPHEN).concat(pingYin.getOrganizationName())); + }else { + insertStreetEntity.setAllParentName(pingYin.getOrganizationName()); + } + insertStreetEntity.setOrganizationName(street.getAgencyName()); + insertStreetEntity.setLevel("street"); + insertStreetEntity.setAreaCode(street.getAreaCode()); + insertStreetEntity.setSyncFlag("0"); + insertStreetEntity.setTotalUser(0); + insertStreetEntity.setProvince("山东省"); + insertStreetEntity.setCity("济南市"); + insertStreetEntity.setDistrict(pingYin.getOrganizationName()); + insertStreetEntity.setStreet(street.getAgencyName()); + insertStreetEntity.setCommunity(StrConstant.EPMETY_STR); + insertStreetEntity.setParentAreaCode(pingYin.getAreaCode()); + insertStreetEntity.setId(street.getAgencyId()); + insertStreetEntity.setCreatedBy("APP_USER"); + insertStreetEntity.setUpdatedBy("APP_USER"); + // 3、插入街道 + if (null == customerAgencyDao.selectById(insertStreetEntity.getId())) { + customerAgencyDao.insert(insertStreetEntity); + } else { + customerAgencyDao.updateById(insertStreetEntity); + } + // 3.1、街道的直属网格 + this.insertCustomerGrid(street.getCustomerId(),street.getAgencyId(),insertStreetEntity); + + if ("2fe0065f70ca0e23ce4c26fca5f1d933".equals(fromCustomerId)) { + List kcCommunityList = screenCustomerAgencyService.selectKcCommunity(fromCustomerId); + for(ScreenCustomerAgencyEntity kcCommunity:kcCommunityList){ + CustomerAgencyEntity insertCommunityEntity = new CustomerAgencyEntity(); + insertCommunityEntity.setCustomerId(pingYin.getCustomerId()); + insertCommunityEntity.setPid(insertStreetEntity.getId()); + insertCommunityEntity.setPids(insertStreetEntity.getPids().concat(StrConstant.COLON).concat(insertStreetEntity.getId())); + insertCommunityEntity.setAllParentName(insertStreetEntity.getAllParentName().concat(StrConstant.HYPHEN).concat(insertStreetEntity.getOrganizationName())); + insertCommunityEntity.setOrganizationName(kcCommunity.getAgencyName()); + insertCommunityEntity.setLevel("community"); + insertCommunityEntity.setAreaCode(kcCommunity.getAreaCode()); + insertCommunityEntity.setSyncFlag(NumConstant.ZERO_STR); + insertCommunityEntity.setTotalUser(NumConstant.ZERO); + insertCommunityEntity.setProvince("山东省"); + insertCommunityEntity.setCity("济南市"); + insertCommunityEntity.setDistrict(pingYin.getOrganizationName()); + insertCommunityEntity.setStreet(insertStreetEntity.getOrganizationName()); + insertCommunityEntity.setCommunity(kcCommunity.getAgencyName()); + insertCommunityEntity.setParentAreaCode(insertStreetEntity.getAreaCode()); + insertCommunityEntity.setId(kcCommunity.getAgencyId()); + insertCommunityEntity.setCreatedBy("APP_USER"); + insertCommunityEntity.setUpdatedBy("APP_USER"); + CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(insertCommunityEntity.getId()); + if(null==customerAgencyEntity){ + // 4、插入社区 + customerAgencyDao.insert(insertCommunityEntity); + }else{ + customerAgencyDao.updateById(insertCommunityEntity); + } + // 4.1插入社区下的直属网格 + this.insertCustomerGrid(kcCommunity.getCustomerId(),kcCommunity.getAgencyId(),insertCommunityEntity); + } + } else { + // 4、查询出社区 + List communityList = screenCustomerAgencyService.getByPid(fromCustomerId,street.getAgencyId()); + for(ScreenCustomerAgencyEntity community:communityList){ + CustomerAgencyEntity insertCommunityEntity = new CustomerAgencyEntity(); + insertCommunityEntity.setCustomerId(pingYin.getCustomerId()); + insertCommunityEntity.setPid(insertStreetEntity.getId()); + insertCommunityEntity.setPids(insertStreetEntity.getPids().concat(StrConstant.COLON).concat(insertStreetEntity.getId())); + insertCommunityEntity.setAllParentName(insertStreetEntity.getAllParentName().concat(StrConstant.HYPHEN).concat(insertStreetEntity.getOrganizationName())); + insertCommunityEntity.setOrganizationName(community.getAgencyName()); + insertCommunityEntity.setLevel("community"); + insertCommunityEntity.setAreaCode(community.getAreaCode()); + insertCommunityEntity.setSyncFlag(NumConstant.ZERO_STR); + insertCommunityEntity.setTotalUser(NumConstant.ZERO); + insertCommunityEntity.setProvince("山东省"); + insertCommunityEntity.setCity("济南市"); + insertCommunityEntity.setDistrict(pingYin.getOrganizationName()); + insertCommunityEntity.setStreet(insertStreetEntity.getOrganizationName()); + insertCommunityEntity.setCommunity(community.getAgencyName()); + insertCommunityEntity.setParentAreaCode(insertStreetEntity.getAreaCode()); + insertCommunityEntity.setId(community.getAgencyId()); + insertCommunityEntity.setCreatedBy("APP_USER"); + insertCommunityEntity.setUpdatedBy("APP_USER"); + CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(insertCommunityEntity.getId()); + if(null==customerAgencyEntity){ + customerAgencyDao.insert(insertCommunityEntity); + }else{ + customerAgencyDao.updateById(insertCommunityEntity); + } + // 4.1插入社区下的直属网格 + this.insertCustomerGrid(community.getCustomerId(),community.getAgencyId(),insertCommunityEntity); + } + + } + } + + /** + * @return void + * @param customerId 孔村、榆山、锦水的客户id + * @param agencyId 孔村、榆山、锦水的组织id + * @param parentCustomerEntity 在平阴客户里,网格所属组织信息 + * @author yinzuomei + * @description 将3个街道的网格,插入到gov-org.customer_grid库 + * @Date 2021/7/7 9:54 + **/ + private void insertCustomerGrid(String customerId, String agencyId, CustomerAgencyEntity parentCustomerEntity) { + List gridEntityList = screenCustomerGridService.selectEntityByAgencyId(customerId, agencyId); + for (ScreenCustomerGridEntity gridEntity : gridEntityList) { + CustomerGridEntity insertGrid = new CustomerGridEntity(); + insertGrid.setId(gridEntity.getGridId()); + insertGrid.setCustomerId(parentCustomerEntity.getCustomerId()); + insertGrid.setGridName(gridEntity.getGridName()); + insertGrid.setAreaCode(gridEntity.getAreaCode()); + insertGrid.setSyncFlag(NumConstant.ZERO_STR); + insertGrid.setManageDistrict(gridEntity.getGridName()); + insertGrid.setTotalUser(NumConstant.ZERO); + insertGrid.setPid(gridEntity.getParentAgencyId()); + insertGrid.setCreatedBy("APP_USER"); + insertGrid.setUpdatedBy("APP_USER"); + if(StringUtils.isEmpty(parentCustomerEntity.getPids())){ + insertGrid.setPids(insertGrid.getPid()); + }else{ + insertGrid.setPids(parentCustomerEntity.getPids().concat(StrConstant.COLON).concat(insertGrid.getPid())); + } + if (null == customerGridService.selectById(insertGrid.getId())) { + customerGridService.insert(insertGrid); + } else { + customerGridService.updateById(insertGrid); + } + } + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index fa8018e1e1..4d4ab8bee0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -1,30 +1,37 @@ package com.epmet.service.org.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; +import com.epmet.service.Issue.IssueService; import com.epmet.service.org.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Date; import java.util.List; @Service @DataSource(DataSourceConstant.GOV_ORG) -public class CustomerGridServiceImpl implements CustomerGridService { +public class CustomerGridServiceImpl extends BaseServiceImpl implements CustomerGridService { @Autowired private CustomerGridDao customerGridDao; + @Autowired + private IssueService issueService; @Override public List listGridsByCreateTime(Date start, Date end) { - return customerGridDao.listGridsByCreateTime(start, end); + return baseDao.listGridsByCreateTime(start, end); } /** @@ -34,7 +41,7 @@ public class CustomerGridServiceImpl implements CustomerGridService { */ @Override public List selectAgencyGridTotalCount(List community, String dateId) { - return customerGridDao.selectAgencyGridTotalCount(community,dateId); + return baseDao.selectAgencyGridTotalCount(community,dateId); } /** @@ -45,12 +52,12 @@ public class CustomerGridServiceImpl implements CustomerGridService { */ @Override public List getCustomerGridIdList(String customerId, String dateId) { - return customerGridDao.getCustomerGridIdList(customerId, dateId); + return baseDao.getCustomerGridIdList(customerId, dateId); } @Override public List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) { - return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now); + return baseDao.listUpdatedGridsByUpdateTime(lastInitTime, now); } /** @@ -62,6 +69,50 @@ public class CustomerGridServiceImpl implements CustomerGridService { **/ @Override public List queryGridInfoList(String customerId) { - return customerGridDao.selectListGridInfo(customerId); + return baseDao.selectListGridInfo(customerId); + } + + /** + * 查询工作人员网格关系 + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/5 10:21 + */ + @Override + public List getCustomerStaffGridList(String customerId) { + return customerGridDao.getCustomerStaffGridList(customerId); } + + /** + * 获取已删除的grid + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/20 16:33 + */ + @Override + public List getDelGridList(String customerId) { + return customerGridDao.getDelGridList(customerId); + } + + /** + * @Author sun + * @Description 查询客户下已删除网格列表下存在的项目Id集合 + **/ + @Override + public List getdelGridProjectIdList(String customerId) { + List resultList = new ArrayList<>(); + //1.查询客户已删除网格列表 + List gridIds = customerGridDao.selectDelGridList(customerId); + if (gridIds.size() < NumConstant.ONE) { + return resultList; + } + //2.查询议题库已删除网格下可能存在的项目Id集合 + resultList = issueService.getProjectByGrids(gridIds); + return resultList; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java new file mode 100644 index 0000000000..fba61dd8bf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java @@ -0,0 +1,39 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.org.CustomerStaffGridDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; +import com.epmet.service.org.CustomerStaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/6/29 3:14 下午 + * @version: 1.0 + */ +@Service +@DataSource(DataSourceConstant.GOV_ORG) +public class CustomerStaffServiceImpl implements CustomerStaffService { + @Autowired + private CustomerStaffGridDao customerStaffGridDao; + + /** + * desc: 条件获取 网格下的所有人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 3:13 下午 + */ + @Override + public List selectStaffGridList(StaffPatrolStatsFormDTO formDTO) { + return customerStaffGridDao.selectGridStaffList(formDTO); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java index 7a6291717a..e082a9af8c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java @@ -35,6 +35,7 @@ import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.Arrays; import java.util.List; @@ -108,7 +109,7 @@ public class ScreenCustomerWorkRecordDictServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if (data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())) { int affectedRows = baseDao.deleteBatch(data.getCustomerId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 8f4d4f7c84..504a948c50 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.service.plugins.ScreenWorkRecordOrgDailyService; import com.google.common.collect.Lists; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; /** * 工作日志-组织按日统计(累计值) @@ -42,7 +43,7 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if (data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())) { int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java index 7ecd3c4eb6..a153cbac9e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java @@ -29,6 +29,7 @@ import com.epmet.service.plugins.ScreenWorkRecordOrgMonthlyService; import com.google.common.collect.Lists; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 工作日志-组织按月统计 @@ -51,7 +52,7 @@ public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if(data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())){ int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 36c3ebd05b..e826c9f9e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -27,6 +27,7 @@ import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.Set; @@ -162,4 +163,32 @@ public interface ProjectService extends BaseService { */ List getProjectSatisfaction(String customerId); + List selectProjectListByDateId(String customerId, String yesterdayStr, String projectOriginAgency); + /** + * 计算某个项目的群满意度得分 + * + * @param customerId + * @param projectId + * @return 得分 + */ + BigDecimal calProjectSatisfactionScore(String customerId,String projectId); + + /** + * 查询当天(dateId)有评价记录的项目id + * + * @param customerId + * @param dateId + * @return + */ + List selectEvaluateProjectIds(String customerId, String dateId); + + /** + * 可根据状态筛选项目id + * + * @param customerId + * @param origin :issue,agency + * @param projectStatus 状态:待处理 pending,结案closed + * @return + */ + List selectClosedProjectIds(String customerId,String origin ,String projectStatus); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 3581f920b1..f67bff807c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -196,5 +197,47 @@ public class ProjectServiceImpl extends BaseServiceImpl selectProjectListByDateId(String customerId, String dateId, String projectOrigin) { + return baseDao.selectProjectListByDateId(customerId,dateId,projectOrigin); + } + + /** + * 计算某个项目的群满意度得分 + * + * @param customerId + * @param projectId + * @return 得分 + */ + @Override + public BigDecimal calProjectSatisfactionScore(String customerId, String projectId) { + return baseDao.selectProjectSatisfactionScore(customerId,projectId); + } + + /** + * 查询当天(dateId)有评价记录的项目id + * + * @param customerId + * @param dateId + * @return + */ + @Override + public List selectEvaluateProjectIds(String customerId, String dateId) { + return baseDao.selectEvaluateProjectIds(customerId,dateId); + } + + /** + * 可根据状态筛选项目id + * + * @param customerId + * @param origin 来源:issue, agency + * @param projectStatus 状态:待处理 pending,结案closed + * @return + */ + @Override + public List selectClosedProjectIds(String customerId, String origin,String projectStatus) { + return baseDao.selectClosedProjectIds(customerId,origin,projectStatus); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index 36511421f3..1a13c7c5c4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -15,6 +15,7 @@ import com.epmet.service.org.CustomerAgencyService; import com.epmet.service.stats.ScreenCentralZoneDataExtractService; import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -184,6 +185,7 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon //For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 o.setGridMemberTotal(gridManagerMap.getOrDefault(orgId, NumConstant.ZERO)); }); - return result; + List newResult = result.stream().filter(o -> StringUtils.isNotBlank(o.getParentId())).collect(Collectors.toList()); + return newResult; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java new file mode 100644 index 0000000000..1f1f9cefff --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java @@ -0,0 +1,16 @@ +package com.epmet.service.user; + +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface StatsStaffPatrolService { + + Integer delAndInsertBatch(StaffPatrolStatsFormDTO formDTO, List insertList); + + List selectData(String customerId, String yesterdayStr); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index ebc01ebdb3..f45809be94 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -2,9 +2,15 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.util.DimIdGenerator; @@ -94,4 +100,41 @@ public interface UserService { * @return com.epmet.dto.user.OrgGridManagerTotalDTO */ Map queryOrgGridManager(String customerId,List orgStaffDTOList); + + /** + * 根据角色key查找工作人员 + * + * @author zhaoqifeng + * @date 2021/7/5 9:52 + * @param customerId + * @param roleKey + * @return java.util.List + */ + List getStaffByRoleKey(String customerId, String roleKey); + + /** + * desc: 请描述类的业务用途 + * + * @param formDTO + * @return + * @author LiuJanJun + * @date 2021/6/29 10:15 上午 + */ + List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO); + + List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO); + + List selectStaffPatrolListByDateId(String customerId, String yesterdayStr); + + /** + * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 + * @author sun [接口废弃,暂无使用] + */ + int delGmUploadEvent(String customerId, String dateId); + + /** + * @Description 数据上报--网格员事件总数上报--批量新增或修改数据 + * @author sun + */ + void saveOrUpGmUploadEvent(List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java new file mode 100644 index 0000000000..b07253b001 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java @@ -0,0 +1,48 @@ +package com.epmet.service.user.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.user.StatsStaffPatrolRecordDailyDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.user.StatsStaffPatrolRecordDailyEntity; +import com.epmet.service.user.StatsStaffPatrolService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/6/30 8:33 上午 + * @version: 1.0 + */ +@Slf4j +@DataSource(DataSourceConstant.EPMET_USER) +@Service +public class StatsStaffPatrolServiceImpl implements StatsStaffPatrolService { + @Autowired + private StatsStaffPatrolRecordDailyDao statsStaffPatrolRecordDailyDao; + + @Override + public Integer delAndInsertBatch(StaffPatrolStatsFormDTO formDTO, List insertList) { + int delete = statsStaffPatrolRecordDailyDao.deleteInternal(formDTO); + log.debug("delAndInsertBatch delete:{},param:{}", delete, JSON.toJSONString(formDTO)); + return statsStaffPatrolRecordDailyDao.insertBatch(insertList); + } + + @Override + public List selectData(String customerId, String yesterdayStr) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StatsStaffPatrolRecordDailyEntity::getCustomerId, customerId) + .eq(StatsStaffPatrolRecordDailyEntity::getDateId, yesterdayStr); + List list = statsStaffPatrolRecordDailyDao.selectList(queryWrapper); + return ConvertUtils.sourceToTarget(list, StatsStaffPatrolRecordDailyDTO.class); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 59897628e3..6cfcc8e89e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -6,15 +6,22 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.ExtractConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.RoleKeyConstants; import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.stats.form.GmUploadEventFormDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; @@ -797,4 +804,52 @@ public class UserServiceImpl implements UserService { return resultMap; } + /** + * 根据角色key查找工作人员 + * + * @param customerId + * @param roleKey + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/5 9:52 + */ + @Override + public List getStaffByRoleKey(String customerId, String roleKey) { + return userDao.getStaffByRoleKey(customerId, roleKey); + } + + @Override + public List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO) { + formDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + return userDao.selectUserByRoleKey(formDTO); + } + + @Override + public List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO) { + return userDao.selectLastStaffPatrolList(formDTO); + } + + @Override + public List selectStaffPatrolListByDateId(String customerId, String yesterdayStr) { + return userDao.selectStaffPatrolListByDateId(customerId,yesterdayStr); + } + + /** + * @Description 数据上报--网格员事件总数上报--按客户Id和dateId删除历史数据 + * @author sun + */ + @Override + public int delGmUploadEvent(String customerId, String dateId) { + return userDao.delGmUploadEvent(customerId, dateId); + } + + /** + * @Description 数据上报--网格员事件总数上报--批量新增或修改数据 + * @author sun + */ + @Override + public void saveOrUpGmUploadEvent(List list) { + userDao.saveOrUpGmUploadEvent(list); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index c0479d72a3..7723414608 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -207,4 +207,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.20__add_satisfaction_score.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.20__add_satisfaction_score.sql new file mode 100644 index 0000000000..5daf6faa5a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.20__add_satisfaction_score.sql @@ -0,0 +1,11 @@ +-- epmet_evaluation_index库执行以下sql: 增加群众不满得分 +alter table `epmet_evaluation_index`.screen_project_data add COLUMN `SATISFACTION_SCORE` decimal(10,6) DEFAULT NULL COMMENT '满意度得分' AFTER LATITUDE; + +ALTER TABLE `epmet_evaluation_index`.`screen_govern_rank_data_daily` + ADD COLUMN `RESPONSE_COUNT` int(11) NULL COMMENT '响应次数' AFTER `RESPONSE_RATIO`, + ADD COLUMN `TRANSFER_COUNT` int(11) NULL COMMENT '项目转入次数' AFTER `RESPONSE_COUNT`, + ADD COLUMN `RESOLVED_COUNT` int(11) NULL COMMENT '解决项目数' AFTER `RESOLVED_RATIO`, + ADD COLUMN `CLOSED_COUNT` int(11) NULL COMMENT '已关闭项目数' AFTER `RESOLVED_COUNT`, + ADD COLUMN `GOVERN_COUNT` int(11) NULL COMMENT '自治项目数' AFTER `GOVERN_RATIO`, + ADD COLUMN `SATISFACTION_COUNT` int(11) NULL COMMENT '满意项目数' AFTER `SATISFACTION_RATIO`, + ADD COLUMN `CLOSED_PROJECT_COUNT` int(11) NULL COMMENT '已关闭项目(由议题转的项目)数' AFTER `SATISFACTION_COUNT`; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql new file mode 100644 index 0000000000..7fbadf02ed --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql @@ -0,0 +1,47 @@ +#网格员数据分析需求 脚本 2021-07-06 +CREATE TABLE `fact_grid_member_statistics_daily` +( + `ID` varchar(64) NOT NULL COMMENT '主键(t-1)', + `DATE_ID` varchar(32) NOT NULL COMMENT 'yyyyMMdd', + `MONTH_ID` varchar(32) NOT NULL COMMENT '月份ID', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年度ID', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(32) NOT NULL COMMENT '组织ID', + `GRID_ID` varchar(32) NOT NULL COMMENT '网格I', + `PID` varchar(32) NOT NULL COMMENT '上级ID(网格所属Agency的上级组织Id)', + `PIDS` varchar(512) NOT NULL COMMENT '所有agencyId的上级组织ID(包含agencyId)', + `STAFF_ID` varchar(32) NOT NULL COMMENT '工作人员ID', + `STAFF_NAME` varchar(32) DEFAULT NULL COMMENT '工作人员姓名', + `PROJECT_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目立项数', + `ISSUE_TO_PROJECT_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '议题转项目数', + `CLOSED_ISSUE_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '议题关闭数', + `PROJECT_RESPONSE_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目响应数', + `PROJECT_TRANSFER_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目吹哨数', + `PROJECT_CLOSED_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目结案数', + `PROJECT_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目立项数日增量', + `ISSUE_TO_PROJECT_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '议题转项目数日增量', + `CLOSED_ISSUE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '议题关闭数日增量', + `PROJECT_RESPONSE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目响应数日增量', + `PROJECT_TRANSFER_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目吹哨数日增量', + `PROJECT_CLOSED_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目结案数日增量', + `DEL_FLAG` int(11) DEFAULT NULL COMMENT '删除状态,0:正常,1:删除', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='网格员数据统计_日统计'; +#添加唯一索引 +ALTER TABLE `epmet_data_statistical`.`fact_grid_member_statistics_daily` + ADD UNIQUE INDEX `unx_staff`(`DATE_ID`, `STAFF_ID`, `GRID_ID`) USING BTREE; + +ALTER TABLE `epmet_data_statistical`.`fact_origin_project_main_daily` + ADD COLUMN `PROJECT_CREATOR` varchar(32) NULL COMMENT '项目创建人(议题转项目或立项人)' AFTER `IS_SATISFIED`; + +#fact_grid_member_statistics_daily 表添加字段 +ALTER TABLE `fact_grid_member_statistics_daily` + MODIFY COLUMN `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据归属客户ID【例:孔村上报数据属于平阴的】' AFTER `YEAR_ID`, + ADD COLUMN `SOURCE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'internal' COMMENT '来源类型 external:外部,internal:内部' AFTER `YEAR_ID`, + ADD COLUMN `SOURCE_CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据来源客户Id' AFTER `CUSTOMER_ID`; \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql new file mode 100644 index 0000000000..7c9f7a9e3d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.22__pulic_party.sql @@ -0,0 +1,7 @@ +ALTER TABLE `epmet_evaluation_index`.`screen_user_join` + ADD COLUMN `AVG_ISSUE_FZ` int(11) NULL DEFAULT 0 COMMENT '人均议题分子' AFTER `AVG_ISSUE`, + ADD COLUMN `AVG_ISSUE_FM` int(11) NULL DEFAULT 0 COMMENT '人均议题分母' AFTER `AVG_ISSUE_FZ`, + ADD COLUMN `AVG_JOIN_FZ` int(11) NULL DEFAULT 0 COMMENT '平均参与度分子' AFTER `AVG_JOIN`, + ADD COLUMN `AVG_JOIN_FM` int(11) NULL DEFAULT 0 COMMENT '平均参与度分母' AFTER `AVG_JOIN_FZ`, + DROP PRIMARY KEY, + ADD PRIMARY KEY (`ID`) USING BTREE; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml index fad1ca0443..ba3cccf88b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml @@ -39,4 +39,15 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml new file mode 100644 index 0000000000..8a43152a4b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from fact_grid_member_statistics_daily + where CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + limit #{deleteSize} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml new file mode 100644 index 0000000000..dc8760fab8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 521ef174e4..995c6cebad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -177,4 +177,64 @@ and M.IS_PARTY=#{isParty} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index d5bbf0cc29..9c42712164 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -210,6 +210,9 @@ and t1.AGENCY_ID=#{communityId} + + and t1.ISSUE_STATUS=#{issueStatus} + @@ -228,6 +231,9 @@ and t1.AGENCY_ID=#{communityId} + + and t1.TOPIC_USER_IS_PARTY = #{topicUserIsParty} + @@ -266,6 +272,9 @@ AND t1.ISSUE_STATUS = 'shift_project' AND t1.CUSTOMER_ID = #{customerId} and t1.PIDS LIKE CONCAT(#{agencyPath},'%') + + and t1.TOPIC_USER_IS_PARTY = #{topicUserIsParty} + SELECT a.ORG_ID, a.count AS "sum", - IFNULL( b.count, - 0 ) AS "count" + IFNULL( b.count, 0 ) + IFNULL( c.count, 0 ) AS "count" FROM (SELECT ORG_ID, COUNT( ID ) AS "count" @@ -323,12 +322,22 @@ AND MONTH_ID = #{monthId} GROUP BY ORG_ID ) b ON a.ORG_ID = b.ORG_ID + LEFT JOIN + (SELECT ORG_ID, + COUNT(DISTINCT ID ) AS "count" + FROM fact_origin_project_log_daily + WHERE ORG_TYPE = 'grid' + AND ACTION_CODE = 'response' + AND IS_ACTIVE = 1 + AND CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + GROUP BY ORG_ID ) c + ON a.ORG_ID = c.ORG_ID SELECT a.AGENCY_ID, a.count AS "sum", - IFNULL( b.count, - 0 ) AS "count" + IFNULL( b.count, 0 ) + IFNULL( c.count, 0 ) AS "count" FROM (SELECT da.ID AS AGENCY_ID, COUNT( f.ID ) AS "count" @@ -599,12 +620,24 @@ AND f.DATE_ID <= #{dateId} GROUP BY da.ID ) b ON a.AGENCY_ID = b.AGENCY_ID + LEFT JOIN + (SELECT da.ID AS AGENCY_ID, + COUNT(DISTINCT f.ID ) AS "count" + FROM fact_origin_project_log_daily f + INNER JOIN dim_agency da ON f.PIDS LIKE CONCAT( '%', da.ID, '%' ) + AND da.`LEVEL` = #{level} + WHERE + ACTION_CODE = 'response' + AND f.IS_ACTIVE = 1 + AND f.CUSTOMER_ID = #{customerId} + AND f.DATE_ID <= #{dateId} + GROUP BY da.ID ) c + ON a.AGENCY_ID = c.AGENCY_ID + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index e55e3b5076..11ce137aab 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -171,6 +171,9 @@ and t1.PROJECT_STATUS=#{projectStatus} + + and t1.IS_PARTY=#{isParty} + @@ -189,6 +192,9 @@ and t1.PROJECT_STATUS=#{projectStatus} + + and t1.IS_PARTY=#{isParty} + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml index d1db2b9588..76ab745264 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml @@ -288,7 +288,7 @@ SELECT sca.AGENCY_ID, - sca.PID AS PARENT_ID, + IF(sca.PID = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PID) AS PARENT_ID, #{monthId} AS MONTH_ID, #{quarterId} AS QUARTER_ID, #{yearId} AS YEAR_ID, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml index 016cd62b24..1c0941a04b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml @@ -176,7 +176,7 @@ SELECT sca.AGENCY_ID, - sca.PID AS PARENT_ID, + IF(sca.PID = '0',(SELECT AGENCY_ID FROM screen_customer_agency WHERE AREA_CODE = #{areaCode} AND DEL_FLAG = 0),sca.PID) AS PARENT_ID, #{monthId} AS MONTH_ID, #{quarterId} AS QUARTER_ID, #{yearId} AS YEAR_ID, @@ -222,7 +222,7 @@ + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 0fca6febf5..71ae010181 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -65,7 +65,7 @@ - SELECT m.GRID_ID, m.CUSTOMER_ID, @@ -78,7 +78,7 @@ - SELECT m.GRID_ID, m.CUSTOMER_ID, @@ -93,7 +93,7 @@ - SELECT PARENT_AGENCY_ID, ALL_PARENT_IDS @@ -104,7 +104,7 @@ AND m.GRID_ID = #{gridId} - SELECT GRID_ID gridId, GRID_NAME gridName, @@ -130,7 +130,7 @@ - SELECT GRID_ID gridId, GRID_NAME gridName, @@ -361,7 +361,7 @@ - SELECT sca.AGENCY_ID AS PID, sca.PIDS, @@ -386,4 +386,19 @@ AND cg.ALL_PARENT_IDS like concat(#{pids},'%') + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml index b38ec6cce5..b738c0f217 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml @@ -52,7 +52,14 @@ 0 AS RESPONSE_RATIO, 0 AS RESOLVED_RATIO, 0 AS GOVERN_RATIO, - 0 AS SATISFACTION_RATIO + 0 AS SATISFACTION_RATIO, + 0 AS RESPONSE_COUNT, + 0 AS TRANSFER_COUNT, + 0 AS RESOLVED_COUNT, + 0 AS CLOSED_COUNT, + 0 AS GOVERN_COUNT, + 0 AS SATISFACTION_COUNT, + 0 AS CLOSED_PROJECT_COUNT FROM screen_customer_agency WHERE @@ -69,7 +76,14 @@ 0 AS RESPONSE_RATIO, 0 AS RESOLVED_RATIO, 0 AS GOVERN_RATIO, - 0 AS SATISFACTION_RATIO + 0 AS SATISFACTION_RATIO, + 0 AS RESPONSE_COUNT, + 0 AS TRANSFER_COUNT, + 0 AS RESOLVED_COUNT, + 0 AS CLOSED_COUNT, + 0 AS GOVERN_COUNT, + 0 AS SATISFACTION_COUNT, + 0 AS CLOSED_PROJECT_COUNT FROM screen_customer_grid WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml index de20dd018c..f232941996 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPioneerDataDao.xml @@ -51,7 +51,12 @@ CREATED_TIME, UPDATED_BY, UPDATED_TIME, - DATA_END_TIME + DATA_END_TIME, + PLAT_ISSUE_TOTAL, + PLAT_TOPIC_TOTAL, + PLAT_SHIFT_PROJECT_TOTAL, + PLAT_CLOSED_PROJECT_TOTAL, + PLAT_PUBLISH_ISSUE_TOTAL ) values ( @@ -78,7 +83,12 @@ now(), 'APP_USER', now(), - #{item.dataEndTime} + #{item.dataEndTime}, + #{item.issueRatioFm}, + #{item.topicRatioFm}, + #{item.shiftProjectRatioFm}, + #{item.resolvedProjectRatioFm}, + #{item.publishIssueRatioFm} ) @@ -195,7 +205,8 @@ PLAT_JOIN_PARTY_RATIO, PLAT_TOPIC_TOTAL, PLAT_PUBLISH_ISSUE_TOTAL, - PLAT_CLOSED_PROJECT_TOTAL + PLAT_CLOSED_PROJECT_TOTAL, + PLAT_SHIFT_PROJECT_TOTAL ) values ( @@ -228,7 +239,8 @@ #{item.platJoinPartyRatio}, #{item.platTopicTotal}, #{item.platPublishIssueTotal}, - #{item.platClosedProjectTotal} + #{item.platClosedProjectTotal}, + #{item.platShiftProjectTotal} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 51c75a1c17..db38763cb5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -46,6 +46,20 @@ and DATE_FORMAT(PROJECT_CREATE_TIME,'%Y%m%d') = #{dateId} limit 1000 + + delete from screen_project_data + where PROJECT_ID = #{projectId} + AND customer_id = #{customerId} + + + + delete from screen_project_data + where 1=1 + AND customer_id = #{customerId} + + PROJECT_ID = #{projectId} + + + SELECT * FROM screen_user_join + WHERE DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND ORG_TYPE = #{flag} + AND MONTH_ID = #{monthId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index ce72f989f2..3ee79011e8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -13,6 +13,11 @@ DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND DATE(UPDATED_TIME) #{date} + + + AND GRID_ID != #{gridId} + + GROUP BY ORG_ID, ISSUE_STATUS @@ -34,6 +39,11 @@ i.DEL_FLAG = '0' AND i.CUSTOMER_ID = #{customerId} AND DATE(ip.CREATED_TIME) = #{date} + + + AND i.GRID_ID != #{gridId} + + GROUP BY i.ORG_ID, ip.ISSUE_STATUS @@ -55,6 +65,11 @@ AND ISSUE_STATUS = 'closed' AND CUSTOMER_ID = #{customerId} AND DATE(UPDATED_TIME) #{date} + + + AND GRID_ID != #{gridId} + + GROUP BY ORG_ID, RESOLVE_TYPE @@ -72,6 +87,11 @@ AND ISSUE_STATUS = 'closed' AND CUSTOMER_ID = #{customerId} AND DATE(UPDATED_TIME) = #{date} + + + AND GRID_ID != #{gridId} + + GROUP BY ORG_ID, RESOLVE_TYPE @@ -241,7 +261,7 @@ i.DEL_FLAG = '0' AND ip.DEL_FLAG = '0' AND i.CUSTOMER_ID = #{customerId} - AND DATE_FORMAT(i.CREATED_TIME,'%Y%m%d') = #{dateId} + AND DATE_FORMAT(ip.CREATED_TIME,'%Y%m%d') = #{dateId} @@ -301,4 +321,31 @@ order by a.category_type,a.sort + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 7aa2bf3422..d84d884cb3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -9,6 +9,7 @@ FROM customer_grid DEL_FLAG = 0 + AND SYNC_FLAG='1' AND CREATED_TIME >= #{start} @@ -65,7 +66,8 @@ pid, pids FROM customer_grid - WHERE UPDATED_TIME >= #{startTime} + WHERE SYNC_FLAG='1' + AND UPDATED_TIME >= #{startTime} AND UPDATED_TIME #{endTime} @@ -86,4 +88,42 @@ CG.CUSTOMER_ID =#{customerId} and cg.del_flag='0' + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml new file mode 100644 index 0000000000..75b9aa5b40 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index cf3ce06acc..c0209242e6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -16,6 +16,7 @@ FROM customer_agency DEL_FLAG = 0 + AND SYNC_FLAG='1' AND CREATED_TIME >= #{statsStartTime} @@ -97,7 +98,8 @@ district, PARENT_AREA_CODE as parentAreaCode from customer_agency - where UPDATED_TIME >= #{startTime} + where SYNC_FLAG='1' + AND UPDATED_TIME >= #{startTime} and UPDATED_TIME #{endTime} @@ -191,4 +193,15 @@ AND cd.DEL_FLAG = '0' ) + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml index 9bf253e4a5..3be24445bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml @@ -17,6 +17,8 @@ customer_id, DATE_ID, org_id, + pid, + pids, org_name, meeting_code, type_code, @@ -36,6 +38,8 @@ #{customerId}, #{dateId}, #{item.orgId}, + #{item.pid}, + #{item.pids}, #{item.orgName}, #{item.meetingCode}, #{item.typeCode}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml index 4036d053b4..033e4e786c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml @@ -29,6 +29,8 @@ customer_id, month_id, org_id, + pid, + pids, org_name, meeting_code, type_code, @@ -51,6 +53,8 @@ #{monthId}, #{item.orgId}, + #{item.pid}, + #{item.pids}, #{item.orgName}, #{item.meetingCode}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 3c5ebd884f..0b60e3efd5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -86,6 +86,7 @@ STATUS, CLOSED_STATUS, ORG_ID_PATH, + CREATED_BY, CREATED_TIME, UPDATED_TIME FROM project @@ -162,4 +163,61 @@ and CUSTOMER_ID = #{customerId} and PARAMETER_KEY = #{parameterKey} + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml new file mode 100644 index 0000000000..5bd8912385 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/BaseReportDao.xml @@ -0,0 +1,931 @@ + + + + + + DELETE + FROM + fact_reg_user_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_reg_user_grid_daily + ( + id, + customer_id, + agency_id, + grid_id, + date_id, + week_id, + year_id, + reg_total, + resi_total, + warm_hearted_total, + partymember_total, + reg_incr, + warm_incr, + partymember_incr, + resi_proportion, + partymember_proportion, + warm_hearted_proportion, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.dateId}, + #{item.weekId}, + #{item.yearId}, + #{item.regTotal}, + #{item.resiTotal}, + #{item.warmHeartedTotal}, + #{item.partymemberTotal}, + #{item.regIncr}, + #{item.warmIncr}, + #{item.partymemberIncr}, + #{item.resiProportion}, + #{item.partymemberProportion}, + #{item.warmHeartedProportion}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_reg_user_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_reg_user_agency_daily + ( + id, + customer_id, + agency_id, + date_id, + week_id, + year_id, + reg_total, + resi_total, + warm_hearted_total, + partymember_total, + reg_incr, + warm_incr, + partymember_incr, + resi_proportion, + partymember_proportion, + warm_hearted_proportion, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.dateId}, + #{item.weekId}, + #{item.yearId}, + #{item.regTotal}, + #{item.resiTotal}, + #{item.warmHeartedTotal}, + #{item.partymemberTotal}, + #{item.regIncr}, + #{item.warmIncr}, + #{item.partymemberIncr}, + #{item.resiProportion}, + #{item.partymemberProportion}, + #{item.warmHeartedProportion}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_group_total_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_group_total_grid_daily + ( + id, + customer_id, + agency_id, + grid_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + group_total, + ordinary_total, + branch_total, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.groupTotal}, + #{item.ordinaryTotal}, + #{item.branchTotal}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_group_total_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_group_total_agency_daily + ( + id, + customer_id, + agency_id, + pid, + date_id, + week_id, + month_id, + quarter_id, + year_id, + group_total, + ordinary_total, + branch_total, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.groupTotal}, + #{item.ordinaryTotal}, + #{item.branchTotal}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_topic_hotdiscuss_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_topic_hotdiscuss_grid_daily + ( + id, + customer_id, + agency_id, + grid_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + topic_total, + status, + topic_count, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.gridId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.topicTotal}, + #{item.status}, + #{item.topicCount}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + DELETE + FROM + fact_topic_hotdiscuss_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + insert into fact_topic_hotdiscuss_agency_daily + ( + id, + customer_id, + agency_id, + pid, + date_id, + week_id, + month_id, + quarter_id, + year_id, + topic_total, + status, + topic_count, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.topicTotal}, + #{item.status}, + #{item.topicCount}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + + DELETE FROM fact_agency_project_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERT INTO fact_agency_project_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + PARENT_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + PROJECT_TOTAL, + PENDING_TOTAL, + PENDING_RATIO, + CLOSED_TOTAL, + CLOSED_RATIO, + RESOLVED_TOTAL, + RESOLVED_RATIO, + UNRESOLVED_TOTAL, + UNRESOLVED_RATIO, + PROJECT_INCR, + PENDING_INCR, + CLOSED_INCR, + RESOLVED_INCR, + UNRESOLVED_INCR, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.parentId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.projectTotal}, + #{i.pendingTotal}, + #{i.pendingRatio}, + #{i.closedTotal}, + #{i.closedRatio}, + #{i.resolvedTotal}, + #{i.resolvedRatio}, + #{i.unresolvedTotal}, + #{i.unresolvedRatio}, + #{i.projectIncr}, + #{i.pendingIncr}, + #{i.closedIncr}, + #{i.resolvedIncr}, + #{i.unresolvedIncr}, + 0, + 0, + 'BASE_REPORT', + now(), + 'BASE_REPORT', + now() + ) + + + + + + INSERT INTO fact_grid_project_daily + (ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + PROJECT_TOTAL, + PENDING_TOTAL, + PENDING_RATIO, + CLOSED_TOTAL, + CLOSED_RATIO, + RESOLVED_TOTAL, + RESOLVED_RATIO, + UNRESOLVED_TOTAL, + UNRESOLVED_RATIO, + PROJECT_INCR, + PENDING_INCR, + CLOSED_INCR, + RESOLVED_INCR, + UNRESOLVED_INCR, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.projectTotal}, + #{i.pendingTotal}, + #{i.pendingRatio}, + #{i.closedTotal}, + #{i.closedRatio}, + #{i.resolvedTotal}, + #{i.resolvedRatio}, + #{i.unresolvedTotal}, + #{i.unresolvedRatio}, + #{i.projectIncr}, + #{i.pendingIncr}, + #{i.closedIncr}, + #{i.resolvedIncr}, + #{i.unresolvedIncr}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + DELETE FROM fact_grid_project_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + DELETE FROM fact_issue_agency_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERt INTO fact_issue_agency_daily + (ID, + CUSTOMER_ID, + AGENCY_ID, + PID, + YEAR_ID, + QUARTER_ID, + MONTH_ID, + WEEK_ID, + DATE_ID, + ISSUE_INCR, + ISSUE_TOTAL, + SHIFT_PROJECT_INCR, + SHIFT_PROJECT_TOTAL, + SHIFT_PROJECT_PERCENT, + VOTING_INCR, + VOTING_TOTAL, + VOTING_PERCENT, + CLOSED_INCR, + CLOSED_RESOLVED_INCR, + CLOSED_UNRESOLVED_INCR, + CLOSED_TOTAL, + CLOSED_RESOLVED_TOTAL, + CLOSED_UNRESOLVED_TOTAL, + CLOSED_PERCENT, + CLOSED_RESOLVED_PERCENT, + CLOSED_UNRESOLVED_PERCENT, + CLOSED_CASE_INCR, + CLOSED_CASE_RESOLVED_INCR, + CLOSED_CASE_UNRESOLVED_INCR, + CLOSED_CASE_TOTAL, + CLOSED_CASE_RESOLVED_TOTAL, + CLOSED_CASE_UNRESOLVED_TOTAL, + CLOSED_CASE_RESOLVED_PERCENT, + CLOSED_CASE_UNRESOLVED_PERCENT, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + DEL_FLAG, + UPDATED_TIME) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.pid}, + #{i.yearId}, + #{i.quarterId}, + #{i.monthId}, + #{i.weekId}, + #{i.dateId}, + #{i.issueIncr}, + #{i.issueTotal}, + #{i.shiftProjectIncr}, + #{i.shiftProjectTotal}, + #{i.shiftProjectPercent}, + #{i.votingIncr}, + #{i.votingTotal}, + #{i.votingPercent}, + #{i.closedIncr}, + #{i.closedResolvedIncr}, + #{i.closedUnresolvedIncr}, + #{i.closedTotal}, + #{i.closedResolvedTotal}, + #{i.closedUnresolvedTotal}, + #{i.closedPercent}, + #{i.closedResolvedPercent}, + #{i.closedUnresolvedPercent}, + #{i.closedCaseIncr}, + #{i.closedCaseResolvedIncr}, + #{i.closedCaseUnresolvedIncr}, + #{i.closedCaseTotal}, + #{i.closedCaseResolvedTotal}, + #{i.closedCaseUnresolvedTotal}, + #{i.closedCaseResolvedPercent}, + #{i.closedCaseUnresolvedPercent}, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + 0, + NOW() + ) + + + + + + INSERT INTO fact_issue_grid_daily + (ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + YEAR_ID, + QUARTER_ID, + MONTH_ID, + WEEK_ID, + DATE_ID, + ISSUE_INCR, + ISSUE_TOTAL, + SHIFT_PROJECT_INCR, + SHIFT_PROJECT_TOTAL, + SHIFT_PROJECT_PERCENT, + VOTING_INCR, + VOTING_TOTAL, + VOTING_PERCENT, + CLOSED_INCR, + CLOSED_RESOLVED_INCR, + CLOSED_UNRESOLVED_INCR, + CLOSED_TOTAL, + CLOSED_RESOLVED_TOTAL, + CLOSED_UNRESOLVED_TOTAL, + CLOSED_PERCENT, + CLOSED_RESOLVED_PERCENT, + CLOSED_UNRESOLVED_PERCENT, + CLOSED_CASE_INCR, + CLOSED_CASE_RESOLVED_INCR, + CLOSED_CASE_UNRESOLVED_INCR, + CLOSED_CASE_TOTAL, + CLOSED_CASE_RESOLVED_TOTAL, + CLOSED_CASE_UNRESOLVED_TOTAL, + CLOSED_CASE_RESOLVED_PERCENT, + CLOSED_CASE_UNRESOLVED_PERCENT, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + DEL_FLAG, + UPDATED_TIME) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.yearId}, + #{i.quarterId}, + #{i.monthId}, + #{i.weekId}, + #{i.dateId}, + #{i.issueIncr}, + #{i.issueTotal}, + #{i.shiftProjectIncr}, + #{i.shiftProjectTotal}, + #{i.shiftProjectPercent}, + #{i.votingIncr}, + #{i.votingTotal}, + #{i.votingPercent}, + #{i.closedIncr}, + #{i.closedResolvedIncr}, + #{i.closedUnresolvedIncr}, + #{i.closedTotal}, + #{i.closedResolvedTotal}, + #{i.closedUnresolvedTotal}, + #{i.closedPercent}, + #{i.closedResolvedPercent}, + #{i.closedUnresolvedPercent}, + #{i.closedCaseIncr}, + #{i.closedCaseResolvedIncr}, + #{i.closedCaseUnresolvedIncr}, + #{i.closedCaseTotal}, + #{i.closedCaseResolvedTotal}, + #{i.closedCaseUnresolvedTotal}, + #{i.closedCaseResolvedPercent}, + #{i.closedCaseUnresolvedPercent}, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + 0, + NOW() + ) + + + + + + DELETE FROM fact_issue_grid_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + DELETE FROM fact_topic_issue_agency_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERT INTO fact_topic_issue_agency_daily + ( + ID, + CUSTOMER_ID, + PID, + AGENCY_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_TOTAL, + ISSUE_INCR, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.pid}, + #{i.agencyId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.issueTotal}, + #{i.issueIncr}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + INSERT INTO fact_topic_issue_grid_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_INCR, + ISSUE_TOTAL, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.issueIncr}, + #{i.issueTotal}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + DELETE FROM fact_topic_issue_grid_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + DELETE FROM fact_topic_status_agency_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + + INSERT INTO fact_topic_status_agency_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + PID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + TOPIC_STATUS_ID, + TOPIC_COUNT, + TOPIC_PROPORTION, + TOPIC_INCREMENT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.pid}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.topicStatusId}, + #{i.topicCount}, + #{i.topicProportion}, + #{i.topicIncrement}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + INSERT INTO fact_topic_status_grid_daily + ( + ID, + CUSTOMER_ID, + AGENCY_ID, + GRID_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + TOPIC_STATUS_ID, + TOPIC_COUNT, + TOPIC_PROPORTION, + TOPIC_INCREMENT, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + values + + ( + REPLACE(UUID(), '-', ''), + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.topicStatusId}, + #{i.topicCount}, + #{i.topicProportion}, + #{i.topicIncrement}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + + + + + DELETE FROM fact_topic_status_grid_daily + WHERE customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml new file mode 100644 index 0000000000..862f136e20 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DatsStatsDao.xml @@ -0,0 +1,108 @@ + + + + + + + DELETE + FROM + fact_grid_member_statistics_daily + WHERE + source_customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + INSERT INTO fact_grid_member_statistics_daily + ( + id, + date_id, + month_id, + year_id, + source_type, + customer_id, + source_customer_id, + agency_id, + grid_id, + pid, + pids, + staff_id, + staff_name, + project_count, + issue_to_project_count, + closed_issue_count, + project_response_count, + project_transfer_count, + project_closed_count, + project_incr, + issue_to_project_incr, + closed_issue_incr, + project_response_incr, + project_transfer_incr, + project_closed_incr, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.dateId}, + #{i.monthId}, + #{i.yearId}, + #{i.sourceType}, + #{i.parentCustomerId}, + #{i.customerId}, + #{i.agencyId}, + #{i.gridId}, + #{i.pid}, + #{i.pids}, + #{i.staffId}, + #{i.staffName}, + #{i.projectCount}, + #{i.issueToProjectCount}, + #{i.closedIssueCount}, + #{i.projectResponseCount}, + #{i.projectTransferCount}, + #{i.projectClosedCount}, + #{i.projectIncr}, + #{i.issueToProjectIncr}, + #{i.closedIssueIncr}, + #{i.projectResponseIncr}, + #{i.projectTransferIncr}, + #{i.projectClosedIncr}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + ON DUPLICATE KEY + UPDATE + source_type = values(source_type), + customer_id = values(customer_id), + source_customer_id = values(source_customer_id), + project_count = values(project_count), + issue_to_project_count = values(issue_to_project_count), + closed_issue_count = values(closed_issue_count), + project_response_count = values(project_response_count), + project_transfer_count = values(project_transfer_count), + project_closed_count = values(project_closed_count), + project_incr = values(project_incr), + issue_to_project_incr = values(issue_to_project_incr), + closed_issue_incr = values(closed_issue_incr), + project_response_incr = values(project_response_incr), + project_transfer_incr = values(project_transfer_incr), + project_closed_incr = values(project_closed_incr), + updated_by = 'BASE_REPORT', + updated_time = NOW() + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml new file mode 100644 index 0000000000..3f6cda5d85 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml @@ -0,0 +1,78 @@ + + + + + + insert into stats_staff_patrol_record_daily + ( + ID, + SOURCE_TYPE, + CUSTOMER_ID, + SOURCE_CUSTOMER_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + YEAR_ID, + QUARTER_ID, + GRID_ID, + AGENCY_ID, + GRID_PIDS, + STAFF_ID, + PATROL_TOTAL, + TOTAL_TIME, + REPORT_PROJECT_COUNT, + LATEST_PATROL_TIME, + LATEST_PATROL_STATUS, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.sourceType}, + #{item.customerId}, + #{item.sourceCustomerId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.yearId}, + #{item.quarterId}, + #{item.gridId}, + #{item.agencyId}, + #{item.gridPids}, + #{item.staffId}, + #{item.patrolTotal}, + #{item.totalTime}, + #{item.reportProjectCount}, + #{item.latestPatrolTime}, + #{item.latestPatrolStatus}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + ON DUPLICATE KEY UPDATE + PATROL_TOTAL = values(PATROL_TOTAL), + TOTAL_TIME = values(TOTAL_TIME), + UPDATED_BY = VALUES(UPDATED_BY) + + + DELETE FROM stats_staff_patrol_record_daily + WHERE CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + AND SOURCE_TYPE = 'internal' + + AND GRID_ID = #{gridId} + + + AND STAFF_ID = #{staffId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index acb6c9feb3..d0fc049555 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -570,4 +570,138 @@ user_id = #{userId} + + + + + + + DELETE + FROM + stats_staff_patrol_record_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + LIMIT 1000 + + + + INSERT INTO stats_staff_patrol_record_daily + ( + id, + source_type, + customer_id, + source_customer_id, + date_id, + week_id, + month_id, + quarter_id, + year_id, + grid_id, + agency_id, + grid_pids, + staff_id, + patrol_total, + total_time, + report_project_count, + latest_patrol_time, + latest_patrol_status, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) + VALUES + + ( + REPLACE(UUID(), '-', ''), + #{i.sourceType}, + #{i.parentCustomerId}, + #{i.customerId}, + #{i.dateId}, + #{i.weekId}, + #{i.monthId}, + #{i.quarterId}, + #{i.yearId}, + #{i.gridId}, + #{i.agencyId}, + #{i.gridPids}, + #{i.staffId}, + #{i.patrolTotal}, + #{i.totalTime}, + #{i.reportProjectCount}, + #{i.latestPatrolTime}, + #{i.latestPatrolStatus}, + 0, + 0, + 'BASE_REPORT', + NOW(), + 'BASE_REPORT', + NOW() + ) + + ON DUPLICATE KEY + UPDATE + source_type = values(source_type), + customer_id = values(customer_id), + source_customer_id = values(source_customer_id), + report_project_count = values(report_project_count), + updated_by = 'BASE_REPORT', + updated_time = NOW() + + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index f57bb25da3..50efc65a6e 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -41,4 +42,14 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/resi/act/published/{staffId}") Result> getPublishedAct(@PathVariable("staffId") String staffId); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param userId + * @author yinzuomei + * @description 根据用户id,查询用户的注册志愿者信息 + * @Date 2021/6/28 9:30 + **/ + @PostMapping("/heart/resi/volunteer/queryuservolunteerinfo/{userId}") + Result queryUserVolunteerInfo(@PathVariable("userId") String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index 8c4f0be34a..9e4d671a3b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -4,6 +4,7 @@ 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.ActInfoDTO; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; import org.springframework.stereotype.Component; @@ -35,4 +36,16 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result> getPublishedAct(String staffId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getPublishedAct", staffId); } + + /** + * @param userId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 根据用户id,查询用户的注册志愿者信息 + * @Date 2021/6/28 9:30 + **/ + @Override + public Result queryUserVolunteerInfo(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryUserVolunteerInfo", userId); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index 4f31298977..00a07440ca 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -21,16 +21,14 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.service.VolunteerInfoService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -102,4 +100,16 @@ public class ResiVolunteerController { ValidatorUtils.validateEntity(customerFormDTO,CommonCustomerFormDTO.CustomerIdGroup.class); return new Result>().ok(volunteerInfoService.getVolunteerIds(customerFormDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param userId + * @author yinzuomei + * @description 根据用户id,查询用户的注册志愿者信息 + * @Date 2021/6/28 9:34 + **/ + @PostMapping("queryuservolunteerinfo/{userId}") + public Result queryUserVolunteerInfo(@PathVariable("userId")String userId){ + return new Result().ok(volunteerInfoService.queryUserVolunteerInfo(userId)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index 398d48aa5b..53ac849cb8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -18,7 +18,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; @@ -29,7 +28,6 @@ import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.entity.VolunteerInfoEntity; import java.util.List; -import java.util.Map; /** * 志愿者信息 @@ -78,4 +76,12 @@ public interface VolunteerInfoService extends BaseService { * @date 2020.08.13 10:22 **/ List getVolunteerIds(CommonCustomerFormDTO customerFormDTO); + + /** + * 根据用户id,查询用户的注册志愿者信息 + * + * @param userId + * @return com.epmet.dto.VolunteerInfoDTO + */ + VolunteerInfoDTO queryUserVolunteerInfo(String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 6949505c9f..71b318ba0a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -208,4 +208,16 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpljar - + + com.epmet + epmet-message-client + 2.0.0 + com.epmet epmet-commons-tools @@ -93,6 +97,12 @@ 2.0.0 compile + + com.epmet + epmet-heart-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java index 9027eac8e1..6b097270d7 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java @@ -75,7 +75,7 @@ public class PointRuleController { } /** - * desc:根据功能id获取积分规则 + * desc:修改积分规则 * * @param formDTO * @return @@ -84,7 +84,7 @@ public class PointRuleController { @RequirePermission( requirePermission = RequirePermissionEnum.MORE_POINT_RULE_SAVE) public Result update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { formDTO.setCustomerId(tokenDTO.getCustomerId()); - ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + ValidatorUtils.validateEntity(formDTO, PointRuleFormDTO.UserShowGroup.class,UpdateGroup.class); pointRuleService.update(tokenDTO,formDTO); return new Result().ok(true); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java index 5c3b666fa1..b52a602ede 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java @@ -2,20 +2,22 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.CommonPageUserFormDTO; -import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; -import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.PointVerificationLogService; import com.epmet.service.UserPointActionLogService; import com.epmet.service.UserPointStatisticalDailyService; import com.epmet.service.UserPointTotalService; import com.epmet.utils.ModuleConstant; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -156,4 +158,24 @@ public class ResiPointController { List resultDTOS = userPointStatisticalDailyService.listAroundPartyPointRank(formDTO); return new Result>().ok(resultDTOS); } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param tokenDto + * @param formDTO + * @author yinzuomei + * @description 积分任务列表 + * @Date 2021/6/18 14:19 + **/ + @PostMapping("mytasklist") + public Result> queryMyPointTaskList(@LoginUser TokenDto tokenDto,@RequestBody MyPointTaskFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + //默认查询当天 + if(StringUtils.isBlank(formDTO.getDateId())){ + formDTO.setDateId(DateUtils.getBeforeNDay(0)); + } + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(pointActionLogService.queryMyPointTaskList(formDTO)); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java index 9d5dbecdd3..0d304b8ae3 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java @@ -56,4 +56,13 @@ public interface PointRuleDao extends BaseDao { List selectCustomerIds(); + /** + * @Description 校验重名的规则 + * @Param ruleName + * @Param customerId + * @author zxc + * @date 2021/6/18 1:39 下午 + */ + Integer checkSameName(@Param("ruleName")String ruleName,@Param("customerId") String customerId,@Param("ruleId")String ruleId); + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java index a2c1963e85..1db465d453 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.MyPointTaskResultDTO; import com.epmet.dto.result.ResiPointLogPeriodResultDTO; import com.epmet.entity.UserPointActionLogEntity; import org.apache.ibatis.annotations.Mapper; @@ -63,4 +64,9 @@ public interface UserPointActionLogDao extends BaseDao * @return java.lang.Integer */ Integer selectIncrease(@Param("type")String type, @Param("objectId")String objectId); + + List queryMyPointTaskList(@Param("customerId")String customerId, + @Param("userId")String userId, + @Param("type")String type, + @Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java index bbb6055148..9b5cd7f6bc 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java @@ -94,4 +94,19 @@ public class PointRuleDefaultEntity extends BaseEpmetEntity { * 是否启用 0-否,1-是 */ private String enabledFlag; + + /** + * 规则显示顺序 + */ + private Integer sort; + + /** + * 链接页面 + */ + private String linkPage; + + /** + * 一次性任务?1:是;0:不是 + */ + private String disposable; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java index 6468d86afb..7191215345 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java @@ -102,6 +102,21 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String enabledFlag; + /** + * 规则显示顺序 + */ + private Integer sort; + + /** + * 链接页面 + */ + private String linkPage; + + /** + * 一次性任务?1:是;0:不是 + */ + private String disposable; + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index 892fd67a11..314b9b46db 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -22,6 +22,8 @@ import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserPointActionLogDTO; import com.epmet.dto.form.CommonPageUserFormDTO; +import com.epmet.dto.form.MyPointTaskFormDTO; +import com.epmet.dto.result.MyPointTaskResultDTO; import com.epmet.dto.result.ResiPointLogListResultDTO; import com.epmet.entity.UserPointActionLogEntity; import dto.form.SendPointFormDTO; @@ -133,4 +135,12 @@ public interface UserPointActionLogService extends BaseService + */ + List queryMyPointTaskList(MyPointTaskFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index de0f13ac4d..1291a777e2 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -21,15 +21,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.common.enu.PointUnitEnum; import com.epmet.common.enu.SysResponseEnum; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.enums.CommonOperateTypeEnum; import com.epmet.commons.tools.enums.EventEnum; +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.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dao.PointRuleDao; @@ -38,17 +42,16 @@ import com.epmet.dao.RuleOperateLogDao; import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.InitPointRuleResultDTO; -import com.epmet.dto.form.CustomerFunctionListFormDTO; -import com.epmet.dto.form.PointDetailFormDTO; -import com.epmet.dto.form.PointRuleFormDTO; -import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.PointRuleDefaultEntity; import com.epmet.entity.PointRuleEntity; import com.epmet.entity.RuleOperateLogEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.PointRuleService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -56,7 +59,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; @@ -81,6 +87,10 @@ public class PointRuleServiceImpl extends BaseServiceImpl getFunctionList(String customerId) { @@ -145,15 +155,31 @@ public class PointRuleServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + throw new RenException(EpmetErrorCode.SAME_RULE_NAME.getCode()); + } + // 检验积分上限是不是单位积分的整数倍 + Integer remainder = formDTO.getUpLimit() % formDTO.getPoint(); + if (remainder > NumConstant.ZERO){ + throw new RenException(EpmetErrorCode.UP_LIMIT_POINT.getCode()); + } PointRuleEntity entityNew = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class); entityNew.setId(formDTO.getRuleId()); entityNew.setEnabledFlag(StrConstant.TRUE.equals(formDTO.getEnabledFlag()) ? "1" : "0"); @@ -163,6 +189,70 @@ public class PointRuleServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -512,4 +521,42 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl + */ + @Override + public List queryMyPointTaskList(MyPointTaskFormDTO formDTO) { + List list=baseDao.queryMyPointTaskList(formDTO.getCustomerId(),formDTO.getUserId(),formDTO.getType(), formDTO.getDateId()); + list.forEach(dto->{ + if(NumConstant.ZERO==dto.getUpLimit()){ + //无上限 + dto.setFinishTotalDesc("完成"+dto.getFinishedCount()); + dto.setFinishFlag("去完成"); + }else{ + dto.setFinishTotalDesc("完成".concat(String.valueOf(dto.getFinishedCount())).concat("/").concat(String.valueOf(dto.getUpLimitCount()))); + if (dto.getUpLimitCount().equals(dto.getFinishedCount()) || dto.getFinishedCount() > dto.getUpLimitCount()) { + dto.setFinishFlag("已完成"); + } else { + dto.setFinishFlag("去完成"); + } + } + //一次性任务,已完成。 + if("1".equals(dto.getDisposable())&&dto.getFinishedCount().equals(NumConstant.ONE)){ + dto.setFinishFlag("已完成"); + } + //如果是注册志愿者 + if ("register_volunteer".equals(dto.getEventCode())){ + Result volunteerInfoDTOResult= epmetHeartOpenFeignClient.queryUserVolunteerInfo(formDTO.getUserId()); + if(volunteerInfoDTOResult.success()&&null!=volunteerInfoDTOResult.getData()){ + dto.setFinishFlag("已完成"); + dto.setFinishTotalDesc("完成1"); + } + } + }); + return list; + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql new file mode 100644 index 0000000000..76f4b2addd --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql @@ -0,0 +1,29 @@ +alter table point_rule_default add COLUMN SORT INT(11) COMMENT '规则显示顺序' AFTER ENABLED_FLAG ; +alter table point_rule add COLUMN SORT INT(11) COMMENT '规则显示顺序' AFTER ENABLED_FLAG ; +alter table point_rule_default add COLUMN LINK_PAGE VARCHAR(32) COMMENT '链接页面' AFTER SORT ; +alter table point_rule add COLUMN LINK_PAGE VARCHAR(32) COMMENT '链接页面' AFTER SORT ; +alter table point_rule_default add COLUMN DISPOSABLE varchar(1) not null default '0' comment '一次性任务?1:是;0:不是' AFTER LINK_PAGE; +alter table point_rule add COLUMN DISPOSABLE varchar(1) not null default '0' comment '一次性任务?1:是;0:不是' AFTER LINK_PAGE; + +update point_rule_default set sort='1001',LINK_PAGE='group' where EVENT_CODE='participate_one_topic' and DEL_FLAG='0'; +update point_rule_default set sort='1002',LINK_PAGE='group' where EVENT_CODE='publish_one_topic' and DEL_FLAG='0'; +update point_rule_default set sort='1003',LINK_PAGE='group' where EVENT_CODE='invite_resi_into_group' and DEL_FLAG='0'; +update point_rule_default set sort='1004',LINK_PAGE='group' where EVENT_CODE='invite_new_into_group' and DEL_FLAG='0'; +update point_rule_default set sort='1005',LINK_PAGE='group' where EVENT_CODE='leader_resolve_topic' and DEL_FLAG='0'; +update point_rule_default set sort='1006',LINK_PAGE='group' where EVENT_CODE='shift_topic_to_issue' and DEL_FLAG='0'; +update point_rule_default set sort='1007',LINK_PAGE='group' where EVENT_CODE='topic_to_issue' and DEL_FLAG='0'; +update point_rule_default set sort='1008',LINK_PAGE='group' where EVENT_CODE='topic_to_project' and DEL_FLAG='0'; +update point_rule_default set sort='2001',LINK_PAGE='heart',DISPOSABLE='1' where EVENT_CODE='register_volunteer' and DEL_FLAG='0'; +update point_rule_default set sort='2002',LINK_PAGE='heart' where EVENT_CODE='active_insert_live' and DEL_FLAG='0'; + + +update point_rule set sort='1001',LINK_PAGE='group' where EVENT_CODE='participate_one_topic' and DEL_FLAG='0'; +update point_rule set sort='1002',LINK_PAGE='group' where EVENT_CODE='publish_one_topic' and DEL_FLAG='0'; +update point_rule set sort='1003',LINK_PAGE='group' where EVENT_CODE='invite_resi_into_group' and DEL_FLAG='0'; +update point_rule set sort='1004',LINK_PAGE='group' where EVENT_CODE='invite_new_into_group' and DEL_FLAG='0'; +update point_rule set sort='1005',LINK_PAGE='group' where EVENT_CODE='leader_resolve_topic' and DEL_FLAG='0'; +update point_rule set sort='1006',LINK_PAGE='group' where EVENT_CODE='shift_topic_to_issue' and DEL_FLAG='0'; +update point_rule set sort='1007',LINK_PAGE='group' where EVENT_CODE='topic_to_issue' and DEL_FLAG='0'; +update point_rule set sort='1008',LINK_PAGE='group' where EVENT_CODE='topic_to_project' and DEL_FLAG='0'; +update point_rule set sort='2001',LINK_PAGE='heart' ,DISPOSABLE='1' where EVENT_CODE='register_volunteer' and DEL_FLAG='0'; +update point_rule set sort='2002',LINK_PAGE='heart' where EVENT_CODE='active_insert_live' and DEL_FLAG='0'; \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml index 916c58edbb..319395e4f4 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml @@ -138,7 +138,7 @@ - + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml index c18c78976b..4bde53c962 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml @@ -33,13 +33,16 @@ CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND FUNCTION_ID = #{functionId,jdbcType=VARCHAR} AND DEL_FLAG = '0' + order by sort asc UPDATE point_rule SET POINT = #{point,jdbcType=INTEGER}, ENABLED_FLAG = #{enabledFlag,jdbcType=VARCHAR}, - UP_LIMIT = #{upLimit,jdbcType=INTEGER} + UP_LIMIT = #{upLimit,jdbcType=INTEGER}, + RULE_NAME = #{ruleName}, + RULE_DESC = #{ruleDesc} WHERE id = #{id,jdbcType=VARCHAR} and CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} @@ -54,4 +57,15 @@ + + + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml index c7c6bf89c2..d2a4f0f212 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml @@ -73,4 +73,73 @@ AND OBJECT_ID = #{objectId} AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d') + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml index bcf4735cb8..e9fb92c22f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml @@ -35,7 +35,15 @@ \ No newline at end of file diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiPartyMemberController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiPartyMemberController.java index 5b7fbdf89f..3e1f982716 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiPartyMemberController.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiPartyMemberController.java @@ -10,10 +10,10 @@ import com.epmet.dto.form.AuditedPartyMemberFormDTO; import com.epmet.dto.form.AuditingPartyMemberFormDTO; import com.epmet.dto.form.CertifiedDetailFormDTO; import com.epmet.dto.form.CertifiedFormDTO; -import com.epmet.dto.result.CertifiedDetailResultDTO; -import com.epmet.dto.result.CertifiedResultDTO; import com.epmet.dto.result.AuditedPartyMemberResultDTO; import com.epmet.dto.result.AuditingPartyMemberResultDTO; +import com.epmet.dto.result.CertifiedDetailResultDTO; +import com.epmet.dto.result.CertifiedResultDTO; import com.epmet.resi.partymember.dto.partymember.form.AuditingDetailFromDTO; import com.epmet.resi.partymember.dto.partymember.form.AutoFailedDetailFromDTO; import com.epmet.resi.partymember.dto.partymember.form.PartyMemberConfirmFromDTO; @@ -122,6 +122,7 @@ public class ResiPartyMemberController { @PostMapping("auditingdetail") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTYAUTH_AUDITING_DETAIL) public Result auditingDetail(@RequestBody AuditingDetailFromDTO fromDTO) { + ValidatorUtils.validateEntity(fromDTO); return resiPartyMemberService.auditingDetail(fromDTO); } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiPartyMemberServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiPartyMemberServiceImpl.java index d2f4ccc899..8f7c751f19 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiPartyMemberServiceImpl.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiPartyMemberServiceImpl.java @@ -9,11 +9,10 @@ import com.epmet.dto.form.AuditedPartyMemberFormDTO; import com.epmet.dto.form.AuditingPartyMemberFormDTO; import com.epmet.dto.form.CertifiedDetailFormDTO; import com.epmet.dto.form.CertifiedFormDTO; -import com.epmet.dto.result.CertifiedDetailResultDTO; -import com.epmet.dto.result.CertifiedResultDTO; -import com.epmet.feign.ResiPartymemberFeignClient; import com.epmet.dto.result.AuditedPartyMemberResultDTO; import com.epmet.dto.result.AuditingPartyMemberResultDTO; +import com.epmet.dto.result.CertifiedDetailResultDTO; +import com.epmet.dto.result.CertifiedResultDTO; import com.epmet.feign.ResiPartymemberFeignClient; import com.epmet.resi.partymember.dto.partymember.form.*; import com.epmet.resi.partymember.dto.partymember.result.*; @@ -23,8 +22,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; - import java.util.ArrayList; import java.util.List; @@ -45,11 +42,11 @@ public class ResiPartyMemberServiceImpl implements ResiPartyMemberService { UnderReviewParyMemberFormDTO underReviewParyMemberFormDTO = ConvertUtils.sourceToTarget(formDTO, UnderReviewParyMemberFormDTO.class); Result> result = resiPartymemberFeignClient.auditingPartyMember(underReviewParyMemberFormDTO); if (!result.success()) { - logger.error(String.format("调用%s服务查询单元认证-待审核列表失败,入参网格id[%s],错误码%s,错误提示%s", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId(), result.getCode(), result.getMsg())); + logger.warn(String.format("调用%s服务查询单元认证-待审核列表失败,入参网格id[%s],错误码%s,错误提示%s", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId(), result.getCode(), result.getMsg())); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } if (null == result.getData() || result.getData().isEmpty()) { - logger.info(String.format("调用%s服务查询党员认证-待审核列表,入参网格id[%s],待审核党员列表查询为空", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId())); + logger.warn(String.format("调用%s服务查询党员认证-待审核列表,入参网格id[%s],待审核党员列表查询为空", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId())); return list; } list = ConvertUtils.sourceToTarget(result.getData(), AuditingPartyMemberResultDTO.class); @@ -62,11 +59,11 @@ public class ResiPartyMemberServiceImpl implements ResiPartyMemberService { ReviewedParyMemberFormDTO reviewedParyMemberFormDTO = ConvertUtils.sourceToTarget(formDTO, ReviewedParyMemberFormDTO.class); Result> result = resiPartymemberFeignClient.auditedPartyMember(reviewedParyMemberFormDTO); if (!result.success()) { - logger.error(String.format("调用%s服务查询党员认证-审核历史列表失败,入参网格id[%s],错误码%s,错误提示%s", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId(), result.getCode(), result.getMsg())); + logger.warn(String.format("调用%s服务查询党员认证-审核历史列表失败,入参网格id[%s],错误码%s,错误提示%s", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId(), result.getCode(), result.getMsg())); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } if (null == result.getData() || result.getData().isEmpty()) { - logger.info(String.format("调用%s服务查询党员认证-审核历史列表为空,入参网格id[%s],待审核党员列表查询为空", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId())); + logger.warn(String.format("调用%s服务查询党员认证-审核历史列表为空,入参网格id[%s],待审核党员列表查询为空", ServiceConstant.RESI_PARTYMEMBER_SERVER, formDTO.getGridId())); return list; } list = ConvertUtils.sourceToTarget(result.getData(), AuditedPartyMemberResultDTO.class); diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index b266f10c0c..04eb309484 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -175,6 +175,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.1.140:9876;192.168.1.141:9876 @@ -215,6 +216,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + false 192.168.1.140:9876;192.168.1.141:9876 @@ -254,6 +256,7 @@ https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.10.161:9876 @@ -294,6 +297,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 1674e82553..ff16d20238 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.mq.listener.IssueProjectCategoryTagInitListener; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.MessageListener; @@ -13,50 +15,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @Component -public class RocketMQConsumerRegister { +public class RocketMQConsumerRegister extends MQAbstractRegister { - @Value("${rocketmq.name-server}") - private String nameServer; + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.ISSUE_PROJECT_CATEGORY_TAG, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new IssueProjectCategoryTagInitListener()); - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - register(nameServer, ConsomerGroupConstants.ISSUE_PROJECT_CATEGORY_TAG, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new IssueProjectCategoryTagInitListener()); - } catch (MQClientException e) { - e.printStackTrace(); - } + // ...其他监听器类似 } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - -} +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml index 9e787eb546..09823befef 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml @@ -129,4 +129,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index d53204f039..38d49f3929 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -30,7 +30,7 @@ public class AccessServiceImpl implements AccessService { listOpePermsFormDTO.setCurrGridId(currGridId); Result> result = govAccessFeignClient.listOperationPermissions(listOpePermsFormDTO); if (!result.success()) { - logger.error("调用GovAccess服务查询功能权限列表失败,StaffId:{},错误信息:{}", staffId, result.getMsg()); + logger.warn("调用GovAccess服务查询功能权限列表失败,StaffId:{},错误信息:{}", staffId, result.getMsg()); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java index b9cbcdc232..933bdbb492 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java @@ -101,4 +101,9 @@ public class AgencysResultDTO implements Serializable { * 当前组织对应客户根组织级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) */ private String rootlevel; + + /** + * 当前agencyId所属的客户id + */ + private String customerId; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java index 3c96aa6df6..d111551123 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @author zhaoqifeng @@ -38,4 +39,14 @@ public class LatestCustomerResultDTO implements Serializable { * 性别0未知1男2女 */ private Integer gender; + + /** + * 是否有字客户 + */ + private Boolean haveSubCustomer; + + /** + * 子客户列表 + */ + private List subCustomerIds; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java index 60683bf779..b9222196f9 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java @@ -19,7 +19,6 @@ package com.epmet.dto.result; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -43,4 +42,13 @@ public class ParentListResultDTO implements Serializable { private String name = ""; + /** + * 省级:province; 市级: city; 区县级: district ;乡(镇、街道)级:street ;社区级:community + */ + private String level=""; + + /** + * 增加此返回值,为了调试用 + */ + private String areaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java index 81498e5586..b26db57327 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java @@ -31,4 +31,6 @@ public class RoleInfoResultDTO implements Serializable{ private Boolean fullTimeOnly = false; private String roleKey; + + private String description; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java index 3e6647a9a0..7828cc0bad 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @author zhaoqifeng @@ -37,4 +38,6 @@ public class StaffInfoResultDTO implements Serializable { */ @JsonInclude(JsonInclude.Include.NON_NULL) private String roleName; + + List roles; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java index 9d596bca43..b39085d40c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java @@ -30,4 +30,6 @@ public class StaffRoleResultDTO implements Serializable { */ @JsonInclude(JsonInclude.Include.NON_NULL) private Boolean selected; + + private String description; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 4e28d10dc1..1b99ac96f3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -342,4 +342,14 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/customerstaffgrid/gridstaff") Result> selectGridStaffByGridIds(@RequestBody List gridIds); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param customerId + * @author yinzuomei + * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed + * @Date 2021/6/24 16:11 + **/ + @GetMapping(value = "/gov/org/customeragency/getareacodeswitch/{customerId}") + Result getAreaCodeSwitch(@PathVariable("customerId")String customerId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 4976297323..0d13438885 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -197,4 +197,16 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> selectGridStaffByGridIds(List gridIds) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds); } + + /** + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed + * @Date 2021/6/24 16:11 + **/ + @Override + public Result getAreaCodeSwitch(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAreaCodeSwitch", customerId); + } } diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 9c353b0f90..180922a33d 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -170,6 +170,7 @@ + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -212,6 +213,7 @@ + false 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -255,6 +257,7 @@ + true 192.168.10.161:9876 epmet_message @@ -295,6 +298,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 epmet_message diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index b88368a11d..bb6308fd11 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -17,7 +17,6 @@ package com.epmet.controller; -import com.baomidou.mybatisplus.extension.api.R; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -34,13 +33,12 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerOrgParameterService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Map; import java.util.Set; @@ -58,6 +56,8 @@ public class CustomerAgencyController { @Autowired private CustomerAgencyService customerAgencyService; + @Autowired + private CustomerOrgParameterService customerOrgParameterService; @GetMapping("page") public Result> page(@RequestParam Map params) { @@ -297,4 +297,9 @@ public class CustomerAgencyController { Result organizeTree(@PathVariable("agencyId") String agencyId) { return new Result().ok(customerAgencyService.organizeTree(agencyId)); } + + @GetMapping("getareacodeswitch/{customerId}") + public Result getAreaCodeSwitch(@PathVariable("customerId")String customerId){ + return new Result().ok(customerOrgParameterService.getAreaCodeSwitch(customerId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index bfe0f9f00f..ea2474714b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,65 +2,36 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.mq.listener.InitCustomerOrgRolesListener; -import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; -import org.apache.rocketmq.client.consumer.listener.MessageListener; -import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - +/** + * @Description 如果rocketmq.enable=true,这里必须实现,且 实例化 + * @author wxz + * @date 2021.07.14 17:13:41 +*/ @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; - - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerOrgRolesListener()); - } - } catch (MQClientException e) { - e.printStackTrace(); - } - } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); +public class RocketMQConsumerRegister extends MQAbstractRegister { + + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + //判断逻辑,放到了了Pom.xml中,local不开启即可 + //if (!EnvEnum.LOCAL.getCode().equals(env)) { + //... + //} + + // 客户初始化监听器注册 + register(consumerProperties, + ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, + MessageModel.CLUSTERING, + TopicConstants.INIT_CUSTOMER, + "*", + new InitCustomerOrgRolesListener()); + + // ...其他监听器类似 } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java index 010e2044a3..7224ea757a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java @@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit; * @return * @date 2021.03.03 16:10 */ -//@Component public class InitCustomerOrgRolesListener implements MessageListenerConcurrently { private Logger logger = LoggerFactory.getLogger(getClass()); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java index 536cfdb330..7b6a784a83 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java @@ -129,6 +129,9 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl getLatestCustomer(String userId) { LatestCustomerResultDTO resultDTO = new LatestCustomerResultDTO(); + resultDTO.setHaveSubCustomer(false); + resultDTO.setSubCustomerIds(new ArrayList<>()); + CustomerStaffAgencyDTO customerStaffAgencyDTO = baseDao.selectLatestCustomerByStaff(userId); resultDTO.setAgencyId(customerStaffAgencyDTO.getAgencyId()); @@ -150,6 +153,8 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl customerResult = operCrmFeignClient.getCustomerInfo(customerDTO); if (customerResult.success() && null != customerResult.getData()) { resultDTO.setCustomerName(customerResult.getData().getCustomerName()); + resultDTO.setHaveSubCustomer(customerResult.getData().getHaveSubCustomer()); + resultDTO.setSubCustomerIds(customerResult.getData().getSubCustomerIds()); }else{ log.warn(String.format("根据客户id:%s,查询客户信息失败",customerDTO.getId())); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 8baed16dd6..324ed0a5ca 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -145,4 +145,8 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + # 是否开启mq + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ +# consume-thread-min: 2 +# consume-thread-max: 2 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql new file mode 100644 index 0000000000..1f511e8a14 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.5__add_sync_flag.sql @@ -0,0 +1,2 @@ +alter table customer_agency add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前组织是否同步到统计库和指标库' AFTER AREA_CODE; +alter table customer_grid add column SYNC_FLAG VARCHAR(1) not null default '1' comment '当前网格是否同步到统计库和指标库' AFTER AREA_CODE; \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 2036e76fa6..d0663c1a75 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -314,6 +314,7 @@ INNER JOIN customer_agency ca ON cg.pid = ca.id WHERE cg.del_flag = '0' AND ca.del_flag = '0' + AND cg.SYNC_FLAG='1' AND cg.id IN #{id} @@ -428,6 +429,7 @@ ) agency ON grid.PID = agency.ID WHERE grid.del_flag = 0 + and grid.SYNC_FLAG='1' AND grid.area_code LIKE CONCAT(#{areaCode},'%') @@ -467,6 +469,7 @@ ) agency ON a.PID = agency.ID WHERE a.del_flag = 0 + and a.SYNC_FLAG='1' AND a.customer_id = #{customerId} ) AS c ORDER BY CONVERT ( gridName USING gbk ) ASC diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/LatestListFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/LatestListFormDTO.java index ca84aee3b0..c7f174086d 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/LatestListFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/LatestListFormDTO.java @@ -37,5 +37,7 @@ public class LatestListFormDTO implements Serializable { */ private Integer pageSize = 3; + private Integer num = 0; + } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PatrolProjectFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PatrolProjectFormDTO.java new file mode 100644 index 0000000000..5e3f4bf813 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PatrolProjectFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2021/7/1 10:10 上午 + * @DESC + */ +@Data +public class PatrolProjectFormDTO implements Serializable { + + private static final long serialVersionUID = 7244072033926913678L; + + private String userId; + + /** + * 巡查开始时间 + */ + private String patrolStartTime; + + /** + * 巡查结束时间 + */ + private String patrolEndTime; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java index e3246e8bae..7bd2b95f31 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java @@ -4,10 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; -import com.epmet.dto.form.DelCategoryFormDTO; -import com.epmet.dto.form.ProcessListFormDTO; -import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO; -import com.epmet.dto.form.ProjectListFromDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.fallback.GovProjectOpenFeignClientFallback; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; @@ -86,4 +83,13 @@ public interface GovProjectOpenFeignClient { **/ @PostMapping("gov/project/projectcategory/getprojectcategorylist") Result> getProjectCategoryList(@RequestBody DelCategoryFormDTO formDTO); + + /** + * @Description 查询巡查期间的立项数 + * @Param formDTO + * @author zxc + * @date 2021/7/1 10:16 上午 + */ + @PostMapping("gov/project/project/patrolproject") + Result selectPatrolProject(@RequestBody PatrolProjectFormDTO formDTO); } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java index f03dabfef1..cb2dbf1abd 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java @@ -5,10 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; -import com.epmet.dto.form.DelCategoryFormDTO; -import com.epmet.dto.form.ProcessListFormDTO; -import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO; -import com.epmet.dto.form.ProjectListFromDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.GovProjectOpenFeignClient; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; @@ -78,4 +75,9 @@ public class GovProjectOpenFeignClientFallback implements GovProjectOpenFeignCli public Result> getProjectCategoryList(DelCategoryFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "getProjectCategoryList", formDTO); } + + @Override + public Result selectPatrolProject(PatrolProjectFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "selectPatrolProject", formDTO); + } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index d5be20752e..43c87b57b5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -178,7 +178,7 @@ public interface ProjectConstant { String EVALUATE_GOOD = "good"; String EVALUATE_BAD = "bad"; String EVALUATE_PERFECT = "perfect"; - + String EVALUATE="evaluate"; /** * 三个月,六个月,12个月 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java index 60257a5e4d..1c1460b3cb 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectController.java @@ -222,4 +222,16 @@ public class ProjectController { projectService.platformCallBack(formDTO); return new Result(); } + + /** + * @Description 查询巡查期间的立项数 + * @Param formDTO + * @author zxc + * @date 2021/7/1 10:16 上午 + */ + @PostMapping("patrolproject") + public Result selectPatrolProject(@RequestBody PatrolProjectFormDTO formDTO){ + return new Result().ok(projectService.selectPatrolProject(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java index 2c2fe53f31..38176df2ad 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ProjectDTO; import com.epmet.dto.ProjectStaffDTO; import com.epmet.dto.form.LatestListFormDTO; +import com.epmet.dto.form.PatrolProjectFormDTO; import com.epmet.dto.form.ProjectListFromDTO; import com.epmet.dto.form.ShiftProjectsFromDTO; import com.epmet.dto.result.*; @@ -164,4 +165,12 @@ public interface ProjectDao extends BaseDao { * @date 2021/5/14 1:59 下午 */ List selectProjectIdByTime(@Param("agencyId")String agencyId,@Param("endDate")Integer endDate,@Param("startDate")Integer startDate); + + /** + * @Description 查询巡查期间的立项数 + * @Param formDTO + * @author zxc + * @date 2021/7/1 10:16 上午 + */ + Integer selectPatrolProject(PatrolProjectFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java index 67112ab5d4..f04d8f050a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java @@ -295,4 +295,12 @@ public interface ProjectService extends BaseService { * @return void */ void platformCallBack(PlatformCallBackFormDTO formDTO); + + /** + * @Description 查询巡查期间的立项数 + * @Param formDTO + * @author zxc + * @date 2021/7/1 10:16 上午 + */ + Integer selectPatrolProject(PatrolProjectFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java index acc06b2281..c1e07bf6bf 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java @@ -20,16 +20,20 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ProjectConstant; @@ -39,25 +43,28 @@ import com.epmet.dao.ProjectSatisfactionStatisticsDao; import com.epmet.dto.ProjectSatisfactionDetailDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.entity.ProjectEntity; import com.epmet.entity.ProjectSatisfactionDetailEntity; import com.epmet.entity.ProjectSatisfactionStatisticsEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.redis.ProjectRedis; import com.epmet.redis.ProjectSatisfactionDetailRedis; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.ProjectSatisfactionDetailService; import com.epmet.service.ProjectSatisfactionStatisticsService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.redisson.api.RLock; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.stream.Collectors; @@ -91,6 +98,10 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl page(Map params) { @@ -240,6 +251,21 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl getClosedProjectList(LatestListFormDTO formDTO) { - + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setNum(pageIndex); return baseDao.selectClosedProjectList(formDTO); } @@ -2694,4 +2695,15 @@ public class ProjectServiceImpl extends BaseServiceImpl + + + \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java index 8e752eb744..1f234a5f4f 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java @@ -17,9 +17,11 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; +import java.util.List; /** @@ -123,4 +125,13 @@ public class CustomerDTO implements Serializable { */ private Date updatedTime; + /** + * 06.21:扩展属性:是否有字客户 + */ + private Boolean haveSubCustomer; + + /** + * 06.21:扩展属性:子客户列表 + */ + private List subCustomerIds; } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java index 63ad887526..2911420fe3 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java @@ -17,10 +17,15 @@ package com.epmet.redis; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.map.MapUtil; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.CustomerDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Map; + /** * 客户表 * @@ -32,6 +37,11 @@ public class CustomerRedis { @Autowired private RedisUtils redisUtils; + /** + * 客户信息rediskey前缀 + */ + private String customerInfoKeyPref="epmet:customer:info:"; + public void delete(Object[] ids) { } @@ -44,4 +54,26 @@ public class CustomerRedis { return null; } + + /** + * 查询客户基本信息 + */ + public CustomerDTO queryCustomerInfo(String customerId) { + String customerInfoKey=customerInfoKeyPref.concat(customerId); + Map customerDtoMap = redisUtils.hGetAll(customerInfoKey); + if (MapUtil.isEmpty(customerDtoMap)) { + return null; + } + CustomerDTO customerDTO = BeanUtil.mapToBean(customerDtoMap, CustomerDTO.class, true); + return customerDTO; + } + + /** + * 将客户基本信息放到redis,有效期一天 + */ + public void saveCustomerInfo(String customerId, CustomerDTO data) { + String customerInfoKey = customerInfoKeyPref.concat(customerId); + Map customerDtoMap = BeanUtil.beanToMap(data); + redisUtils.hMSet(customerInfoKey, customerDtoMap,RedisUtils.DEFAULT_EXPIRE); + } } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java index 72727b7f22..6a3a82127d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java @@ -27,14 +27,20 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.CustomerRelationDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerRelationDTO; import com.epmet.entity.CustomerRelationEntity; +import com.epmet.redis.CustomerRedis; import com.epmet.service.CustomerRelationService; +import com.epmet.service.CustomerService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -48,6 +54,10 @@ import java.util.Map; @Slf4j @Service public class CustomerRelationServiceImpl extends BaseServiceImpl implements CustomerRelationService { + @Autowired + private CustomerRedis customerRedis; + @Autowired + private CustomerService customerService; @Override public PageData page(Map params) { @@ -146,7 +156,18 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl getAllSubCustomerIds(String customerId) { - return baseDao.selectAllSubCustomerIds(customerId); + CustomerDTO customerDTO = customerRedis.queryCustomerInfo(customerId); + if (null != customerDTO) { + return customerDTO.getSubCustomerIds(); + } + CustomerDTO data = customerService.get(customerId); + if (null != data) { + data.setSubCustomerIds(baseDao.selectAllSubCustomerIds(customerId)); + data.setHaveSubCustomer(CollectionUtils.isNotEmpty(data.getSubCustomerIds()) ? true : false); + customerRedis.saveCustomerInfo(customerId, data); + return data.getSubCustomerIds(); + } + return new ArrayList<>(); } } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 341aa441e8..f66c547f6c 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -215,7 +215,16 @@ public class CustomerServiceImpl extends BaseServiceImpl getCustomerInfo(CustomerDTO dto) { CustomerEntity entity = baseDao.selectById(dto.getId()); - return new Result().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class)); + List customerIds=customerRelationService.getAllSubCustomerIds(dto.getId()); + CustomerDTO customerDTO=ConvertUtils.sourceToTarget(entity, CustomerDTO.class); + if(CollectionUtils.isEmpty(customerIds)){ + customerDTO.setHaveSubCustomer(false); + customerDTO.setSubCustomerIds(new ArrayList<>()); + }else{ + customerDTO.setHaveSubCustomer(true); + customerDTO.setSubCustomerIds(customerIds); + } + return new Result().ok(customerDTO); } @Override diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index ae5cc37dbb..13ac2c8615 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -144,6 +144,7 @@ + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -186,6 +187,7 @@ + false 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -228,6 +230,7 @@ + true 192.168.10.161:9876 epmet_message @@ -268,6 +271,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 epmet_message diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 057cf3c501..3a7120eba2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.mq.listener.InitCustomerComponentsListener; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.MessageListener; @@ -13,50 +15,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @Component -public class RocketMQConsumerRegister { +public class RocketMQConsumerRegister extends MQAbstractRegister { - @Value("${rocketmq.name-server}") - private String nameServer; - - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener()); - } catch (MQClientException e) { - e.printStackTrace(); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener()); + // ...其他监听器类似 } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - } + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml index f9ee219699..3cb91d990b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml @@ -126,6 +126,7 @@ dingTalk: secret: @dingTalk.robot.secret@ rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ # 停机选项 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml index f27f4d16b0..cc77b03a28 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml @@ -38,7 +38,7 @@ hc.CONFIGURATION_DESCRIPTION, chd.REGION, chd.CONFIGURATION, - chd.DEMO_DATA, + hc.DEMO_DATA, chd.DISPLAY_ORDER FROM ( diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 856b79afc0..494b7edfb4 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -205,6 +205,7 @@ + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -260,6 +261,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + false 192.168.1.140:9876;192.168.1.141:9876 @@ -314,6 +316,7 @@ + true 192.168.10.161:9876 @@ -365,6 +368,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 93a3d454a6..f13010a93c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -224,6 +224,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl 议题服务) Date now = new Date(); //2.调用gov-org获取数据权限 - ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(topicTurnIssueFromDTO.getTopicId()); - if(null == group) { - throw new RenException(ModuleConstant.FAILURE_TO_TURN_ISSUE); - } - TopicInfoFormDTO topicId = new TopicInfoFormDTO(); - topicId.setTopicId(topicTurnIssueFromDTO.getTopicId()); - Integer issueCount = govIssueFeignClient.checkTopicShiftIssue(topicId).getData(); - if (issueCount != NumConstant.ZERO){ - throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE); - } CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO(); dataFilterParam.setUserId(topicTurnIssueFromDTO.getUserId()); dataFilterParam.setGridId(group.getGridId()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index e219987289..3a28c34a95 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.enums.EnvEnum; import lombok.extern.slf4j.Slf4j; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; @@ -13,56 +15,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; -@Slf4j @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; +public class RocketMQConsumerRegister extends MQAbstractRegister { - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(ConsomerGroupConstants.GROUP_ACHIEVEMENT_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.GROUP_ACHIEVEMENT, "*", new GroupAchievementCustomListener()); - } - } catch (MQClientException e) { - log.error("registerAllListeners exception", e); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.GROUP_ACHIEVEMENT_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.GROUP_ACHIEVEMENT, "*", new GroupAchievementCustomListener()); + // ...其他监听器类似 } - - public void register(String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - consumer.setConsumeMessageBatchMaxSize(10); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - -} +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml index d3a33a6d2a..b40b72b999 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml @@ -159,4 +159,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml index a3cc1c6fd5..77a8dab576 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupCodeDao.xml @@ -22,6 +22,7 @@ and rg.grid_id = #{gridId} + order by rgc.CREATED_TIME desc limit 1 diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/PublishSuggestionFormDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/PublishSuggestionFormDTO.java index 1261a5e83f..367a1590d3 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/PublishSuggestionFormDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/form/PublishSuggestionFormDTO.java @@ -30,6 +30,6 @@ public class PublishSuggestionFormDTO implements Serializable { @NotNull(message = "是否匿名不能为空", groups = {AddUserInternalGroup.class}) private Boolean publicFlag; - @Length(max = 500, message = "内容不能超过500字", groups = {AddUserShowGroup.class}) + @Length(min = 1, max = 500, message = "内容不能为空,且不能超过500字", groups = {AddUserShowGroup.class}) private String suggestion; } diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java index 21d940ec2c..c75bca8a46 100644 --- a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java @@ -47,4 +47,9 @@ public class MyResiUserInfoResultDTO implements Serializable { * */ private Integer point; + /** + * 今日已获得积分,用于积分任务列表显示 + * */ + private Integer todayObtainedPoint; + } diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/form/AuditingDetailFromDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/form/AuditingDetailFromDTO.java index 387c68772c..2a6ab054fb 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/form/AuditingDetailFromDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/form/AuditingDetailFromDTO.java @@ -2,6 +2,7 @@ package com.epmet.resi.partymember.dto.partymember.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -12,9 +13,11 @@ import java.io.Serializable; @Data public class AuditingDetailFromDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface AddUserInternalGroup {} /** * 党员认证信息表ID */ + @NotBlank(message = "党员认证信息表ID",groups =AddUserInternalGroup.class) private String partyMemberId; /** diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index 1b52c7e1cc..fb8490ad0b 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -290,6 +290,10 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService //补充信息更新到党员基本信息表 PartymemberInfoDTO partyMemberInfo = partymemberInfoService.getPartyMemberInfo(infoDTO); + if (null == partyMemberInfo) { + log.warn("partymemberInfoService.getPartyMemberInfo return null,this partyMember maybe have audited,param:{}", JSON.toJSON(infoDTO)); + return new Result(); + } infoDTO.setId(partyMemberInfo.getId()); partymemberInfoService.updateById(ConvertUtils.sourceToTarget(infoDTO, PartymemberInfoEntity.class)); PartymemberConfirmManualDTO partymemberConfirmManualDTO = @@ -374,17 +378,6 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService resultDTO.setAutoId(fromDTO.getAutoId()); resultDTO.setManualId(fromDTO.getManualId()); - //获取人工审核信息 - PartymemberConfirmManualEntity manualEntity = partymemberConfirmManualService.selectById(fromDTO.getManualId()); - if(null!=manualEntity){ - //人工审核信息设为已读 - manualEntity.setReadFlag(PartyMemberConstant.READ); - partymemberConfirmManualService.updateById(manualEntity); - }else{ - log.error(String.format("入参%s,查询partymember_confirm_manual为空", JSON.toJSONString(fromDTO))); - throw new RenException("数据异常,根据manualId查询partymember_confirm_manual为空"); - } - //获取党员认证信息 PartymemberInfoEntity partyMemberInfoEntity = partymemberInfoService.selectById(fromDTO.getPartyMemberId()); resultDTO.setUserId(partyMemberInfoEntity.getUserId()); @@ -392,8 +385,19 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService resultDTO.setIdCard(partyMemberInfoEntity.getIdCard()); resultDTO.setMobile(partyMemberInfoEntity.getMobile()); resultDTO.setAddress(partyMemberInfoEntity.getStreet() + partyMemberInfoEntity.getEstate() + partyMemberInfoEntity.getBuilding()); - resultDTO.setCertifyTime(manualEntity.getCreatedTime().getTime()/1000); + resultDTO.setCertifyTime(partyMemberInfoEntity.getCreatedTime().getTime() / 1000); + //获取人工审核信息 + PartymemberConfirmManualEntity manualEntity = partymemberConfirmManualService.selectById(fromDTO.getManualId()); + if(null!=manualEntity){ + //人工审核信息设为已读 + manualEntity.setReadFlag(PartyMemberConstant.READ); + resultDTO.setCertifyTime(manualEntity.getCreatedTime().getTime()/1000); + partymemberConfirmManualService.updateById(manualEntity); + }else{ + log.warn(String.format("入参%s,查询partymember_confirm_manual为空", JSON.toJSONString(fromDTO))); + // throw new RenException("数据异常,根据manualId("+fromDTO.getManualId()+")查询partymember_confirm_manual为空"); + } //获取党员自动认证信息 List failedReason = new ArrayList<>(); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberBaseInfoDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberBaseInfoDao.xml index 1b2ea4f5ee..b14b3fefe6 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberBaseInfoDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberBaseInfoDao.xml @@ -82,17 +82,18 @@ pi.USER_ID AS userId, concat( pi.SURNAME, pi.NAME ) AS realName, unix_timestamp(pi.CREATED_TIME) AS applyTime, - pcm.READ_FLAG AS readFlag, + IFNULL(pcm.READ_FLAG,'') AS readFlag, pi.id as partyMemberId, pca.id as autoId, - pcm.id as manualId + IFNULL(pcm.id,'') as manualId FROM partymember_info pi - LEFT JOIN partymember_confirm_manual pcm ON ( pi.id = pcm.PARTYMEMBER_INFO_ID AND pcm.DEL_FLAG = '0'and pcm.AUDIT_STATUS='under_auditting') + LEFT JOIN partymember_confirm_manual pcm ON ( pi.id = pcm.PARTYMEMBER_INFO_ID AND pcm.DEL_FLAG = '0') LEFT JOIN partymember_confirm_auto pca ON(pi.id=pca.PARTYMEMBER_INFO_ID AND pca.del_flag='0') WHERE pi.DEL_FLAG = '0' AND pi.CONFIRM_RESULT = 'auto_confirm_failed' + AND pcm.AUDIT_STATUS='under_auditting' AND pi.EXTRA_ORGANIZATION IS NOT NULL AND pi.GRID_ID = #{gridId} ORDER BY diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java index 7021efac58..44845e753f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java @@ -63,6 +63,11 @@ public class GovStaffRoleDTO implements Serializable { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 * */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java new file mode 100644 index 0000000000..dfbc170559 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java @@ -0,0 +1,156 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Data +public class StatsStaffPatrolRecordDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java index 1bf9d55e25..2c723e6177 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java @@ -39,4 +39,6 @@ public class StartPatrolFormDTO implements Serializable { private String staffPatrolRecId; private String patrolEndTime; + + private String customerId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java new file mode 100644 index 0000000000..62dcf50a26 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; + +@Data +public class UpGovRoleFormDTO { + + /** + * 角色表id + */ + @NotEmpty(message = "角色Id不能为空", groups = {Update.class}) + private String roleId; + /** + * 角色名称 + */ + private String roleName; + /** + * 职责描述 + */ + private String description; + /** + * token中userId + */ + private String userId; + + public interface Update extends CustomerClientShowGroup {} +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java index 95670ba7e8..63783adc2c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java @@ -62,4 +62,17 @@ public class CertificationDetailResultDTO implements Serializable { * 审核记录ID */ private String recordId; + + public CertificationDetailResultDTO() { + this.surname = ""; + this.name = ""; + this.idcard = ""; + this.isCertificated = ""; + this.mobile = ""; + this.certificationImg = ""; + this.remark = ""; + this.authResult = ""; + this.authReason = ""; + this.recordId = ""; + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java index 1708d17f32..3302c18b97 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java @@ -17,6 +17,7 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -64,4 +65,26 @@ public class GovStaffRoleResultDTO implements Serializable { private String mobile; private String gender; + + /** + * 职责描述 + */ + private String description; + /** + * 角色key[默认值] + */ + private String defRoleKey; + /** + * 角色名称[默认值] + */ + private String defRoleName; + /** + * 职责描述[默认值] + */ + private String defDescription; + /** + * 排序 + */ + @JsonIgnore + private Integer sort; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java index fa17be450f..6a83a0b552 100755 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java @@ -58,6 +58,16 @@ public class GovStaffRoleTemplateDTO implements Serializable { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + /** * */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java index 4201a109a3..5b26ee9150 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java @@ -48,4 +48,8 @@ public class MyResiUserInfoResultDTO implements Serializable { * */ private Integer point; + /** + * 今日已获得积分,用于积分任务列表显示 + * */ + private Integer todayObtainedPoint; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index fcf24efc39..6cfb21aa99 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -595,4 +595,14 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/staffrole/getroles") Result getUserRoles(@RequestBody CustomerAgencyUserRoleFormDTO formDTO); + + /** + * 结束巡查 定时任务 + * @author zhaoqifeng + * @date 2021/7/12 17:32 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("/epmetuser/staffpatrol/endpatrolJob") + Result endPatrolJob(@RequestBody StartPatrolFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index db88733c0e..b0b8723f01 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -409,4 +409,17 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoles", formDTO); } + /** + * 结束巡查 定时任务 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/7/12 17:32 + */ + @Override + public Result endPatrolJob(StartPatrolFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "endPatrolJob", formDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 37df7c9140..01bb8ca3f3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GovStaffRoleFormDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; @@ -76,15 +77,14 @@ public class GovStaffRoleController { /** * 更新客户的指定角色 - * @param form + * @param formDTO * @return */ @PostMapping("update-role") - public Result updateRole(@RequestBody GovStaffRoleFormDTO form) { - ValidatorUtils.validateEntity(form, GovStaffRoleFormDTO.UpdateRoleGroup.class); - if (govStaffRoleService.updateRole(form.getRoleId(), form.getRoleName()) == 0) { - throw new RenException("修改角色信息失败"); - } + public Result updateRole(@LoginUser TokenDto tokenDTO, @RequestBody UpGovRoleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpGovRoleFormDTO.Update.class); + formDTO.setUserId(tokenDTO.getUserId()); + govStaffRoleService.updateCustomerRole(formDTO); return new Result(); } @@ -94,10 +94,9 @@ public class GovStaffRoleController { * @return */ @PostMapping("save-sortorder") - public Result saveSortOrder(@RequestBody GovStaffRoleFormDTO form) { + public Result saveSortOrder(@LoginUser TokenDto tokenDTO, @RequestBody GovStaffRoleFormDTO form) { ValidatorUtils.validateEntity(form, GovStaffRoleFormDTO.SaveRoleOrderGroup.class); - List roleIdList = form.getRoleIdList(); - govStaffRoleService.saveSortOrder(roleIdList); + govStaffRoleService.saveSortOrder(tokenDTO.getUserId(), form.getRoleIdList()); return new Result(); } @@ -124,4 +123,29 @@ public class GovStaffRoleController { Result> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){ return new Result>().ok(govStaffRoleService.queryCustomerGovRoleList(customerId)); } + + /** + * @param formDTO + * @Description 默认权限保存排序 + * @Author sun + **/ + @PostMapping("savedefaultsort") + public Result saveDefaultSort(@LoginUser TokenDto tokenDTO, @RequestBody GovStaffRoleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GovStaffRoleFormDTO.SaveRoleOrderGroup.class); + govStaffRoleService.saveDefaultSort(tokenDTO.getUserId(), formDTO.getRoleIdList()); + return new Result(); + } + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + @PostMapping("updatedefaultrole") + public Result updateDefaultRole(@LoginUser TokenDto tokenDTO, @RequestBody UpGovRoleFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpGovRoleFormDTO.Update.class); + formDTO.setUserId(tokenDTO.getUserId()); + govStaffRoleService.updateDefaultRole(formDTO); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java index 4d510c5996..6708db5b5d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java @@ -87,6 +87,20 @@ public class StaffPatrolController { } + /** + * 结束巡查 定时任务 + * @author zhaoqifeng + * @date 2021/7/12 17:00 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("endpatrolJob") + public Result endPatrolJob(@RequestBody StartPatrolFormDTO formDTO) { + staffPatrolRecordService.endPatrolJob(formDTO); + return new Result(); + + } + /** * 上传巡查记录 * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java new file mode 100644 index 0000000000..b2dad2bce4 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java @@ -0,0 +1,32 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.StatsStaffPatrolRecordDailyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@RestController +@RequestMapping("statsstaffpatrolrecorddaily") +public class StatsStaffPatrolRecordDailyController { + + @Autowired + private StatsStaffPatrolRecordDailyService statsStaffPatrolRecordDailyService; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index f717b678c8..9753829066 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.dto.result.RoleKeyValueResultDTO; @@ -46,6 +47,14 @@ public interface GovStaffRoleDao extends BaseDao { */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @param orgId + * @return + */ + List getStaffRoles(@Param("staffIds") List staffId, @Param("orgId") String orgId); + /** * 获取客户机关角色列表 * @param params @@ -75,7 +84,7 @@ public interface GovStaffRoleDao extends BaseDao { int updateColumnsById(@Param("roleId") String roleId, @Param("roleName") String roleName); - int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort); + int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort, @Param("userId") String userId); List listRolesByRoleKey(@Param("roleKey") String roleKey); @@ -88,4 +97,11 @@ public interface GovStaffRoleDao extends BaseDao { * @date 2021/6/15 2:35 下午 */ List selectRoleKeyName(@Param("roleIds")List roleIds); + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + int upNameOrDescription(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java index 62af0e097c..974a358e17 100755 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java @@ -18,10 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.UpGovRoleFormDTO; +import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleResultDTO; import com.epmet.entity.GovStaffRoleTemplateEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -45,4 +48,23 @@ public interface GovStaffRoleTemplateDao extends BaseDao selectGovRoleList(); + + /** + * @author sun + * @Description 获取工作端默认角色列表 + */ + List defaultRoleList(); + + /** + * @author sun + * @Description 修改默认权限排序 + */ + int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort, @Param("userId") String userId); + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + int upNameOrDescription(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java new file mode 100644 index 0000000000..458a171d00 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java @@ -0,0 +1,64 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Mapper +public interface StatsStaffPatrolRecordDailyDao extends BaseDao { + + /** + * @Description 校验今天某人是不是有数据 + * @Param staffId + * @Param dateId + * @author zxc + * @date 2021/6/30 2:41 下午 + */ + String checkStatsCount(@Param("staffId")String staffId, @Param("dateId")String dateId,@Param("gridId")String gridId); + + /** + * @Description 更新最近巡查时间和巡查状态 + * @Param id + * @Param patrolStartTime 最近巡查时间 + * @author zxc + * @date 2021/7/1 9:15 上午 + */ + void updateStatsRecord(@Param("id")String id,@Param("patrolStartTime") Date patrolStartTime); + + /** + * @Description 巡查关闭时更新 + * @Param userId + * @Param patrolStartTime + * @author zxc + * @date 2021/7/1 10:36 上午 + */ + void updateStatsRecordEnd(@Param("userId")String userId,@Param("totalTime") Integer totalTime, + @Param("projectCount")Integer projectCount,@Param("dateId")String dateId,@Param("gridId")String gridId); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java index bd6839ac59..b225205a4b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java @@ -74,7 +74,7 @@ public interface UserWechatDao extends BaseDao{ * @author wangc * @date 2020.07.27 00:58 **/ - List selectResiAndStrangerInfo(@Param("userIds") List userIds, @Param("realName")String realName); + List selectResiAndStrangerInfo(@Param("customerId") String customerId, @Param("realName")String realName); //临时用下in List selectNotInUserBaseInfoTemp(); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java index 6950c65256..6ac107e80a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java @@ -63,6 +63,11 @@ public class GovStaffRoleEntity extends BaseEpmetEntity { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + /** * 排序 * */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java index 34a4844ad9..cd87413736 100755 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java @@ -58,4 +58,14 @@ public class GovStaffRoleTemplateEntity extends BaseEpmetEntity { * */ private Boolean fullTimeOnly; + /** + * 角色对应的职责说明 + */ + private String description; + + /** + * 排序 + */ + private String sort; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java new file mode 100644 index 0000000000..93edb74930 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("stats_staff_patrol_record_daily") +public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 来源类型 external:外部,internal:内部 + */ + private String sourceType; + + /** + * 客户Id + */ + private String customerId; + + /** + * 数据来源客户Id + */ + private String sourceCustomerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 6ee17905c2..58ebf19e6f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; @@ -104,6 +105,16 @@ public interface GovStaffRoleService extends BaseService { */ List listRolesByStaffId(String staffId, String orgId); + /** + * 查询用户角色 + * @author zhaoqifeng + * @date 2021/7/1 15:30 + * @param staffIds + * @param orgId + * @return java.util.Map> + */ + Map> getStaffRoles(List staffIds, String orgId); + /** * 获取当前机关下的角色列表 * @param dto @@ -138,7 +149,7 @@ public interface GovStaffRoleService extends BaseService { int updateRole(String roleId, String roleName); - void saveSortOrder(List roleIdList); + void saveSortOrder(String userId, List roleIdList); List listRolesByRoleKey(String roleKey); @@ -150,4 +161,24 @@ public interface GovStaffRoleService extends BaseService { * @Date 2021/3/29 15:37 **/ List queryCustomerGovRoleList(String customerId); + + /** + * @Description 默认权限保存排序 + * @Author sun + **/ + void saveDefaultSort(String userId, List roleIdList); + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + void updateDefaultRole(UpGovRoleFormDTO formDTO); + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + void updateCustomerRole(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java index 7eae381718..e9cbb44ce7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java @@ -72,6 +72,14 @@ public interface StaffPatrolRecordService extends BaseService { + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index aea728c458..8a8764e5b0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -226,6 +226,12 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl(); } + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { + Map> map = govStaffRoleService.getStaffRoles(fromDTO.getStaffList(), fromDTO.getAgencyId()); + list.forEach(item -> { + item.setRoles(map.get(item.getStaffId())); + }); + } return new Result>().ok(list); } @@ -245,6 +251,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffRoleList); @@ -277,6 +284,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/1 15:30 + */ + @Override + public Map> getStaffRoles(List staffIds, String orgId) { + List staffRoleList = baseDao.getStaffRoles(staffIds, orgId); + return staffRoleList.stream().collect(Collectors.groupingBy(GovStaffRoleEntity::getCustomerId, + Collectors.mapping(GovStaffRoleEntity :: getId, Collectors.toList()))); + } + @Override public List getGovStaffRoleList(GovStaffRoleDTO dto) { return baseDao.selectGovStaffRoleList(dto); @@ -182,7 +200,34 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByCustomer(String customerId) { - return govStaffRoleDao.listRolesByCustomer(customerId); + List resultList = new ArrayList<>(); + //1.查询系统默认角色列表数据 + resultList = govStaffRoleTemplateDao.defaultRoleList(); + //2.查询客户角色权限列表数据 + List cuList = govStaffRoleDao.listRolesByCustomer(customerId); + //3.封装数据并返回 + resultList.forEach(re -> { + cuList.forEach(cu -> { + if (re.getDefRoleKey().equals(cu.getRoleKey())) { + re.setCustomerId(cu.getCustomerId()); + re.setRoleId(cu.getRoleId()); + re.setRoleKey(cu.getRoleKey()); + re.setRoleName(cu.getRoleName()); + re.setDescription(cu.getDescription()); + re.setSort(cu.getSort()); + } + }); + }); + //4.按客户权限顺序排序 + if(cuList.size()>NumConstant.ZERO){ + Collections.sort(resultList, new Comparator() { + @Override + public int compare(GovStaffRoleResultDTO o1, GovStaffRoleResultDTO o2) { + return o1.getSort().compareTo(o2.getSort()); + } + }); + } + return resultList; } @Override @@ -221,12 +266,11 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl roleIdList) { + @Transactional(rollbackFor = Exception.class) + public void saveSortOrder(String userId, List roleIdList) { for (int i = 0 ; i < roleIdList.size() ; i++) { - int r = govStaffRoleDao.updateSortById(roleIdList.get(i), i); - System.out.println(r); + int r = govStaffRoleDao.updateSortById(roleIdList.get(i), i, userId); } } @@ -264,4 +308,41 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl roleIdList) { + for (int i = 0; i < roleIdList.size(); i++) { + govStaffRoleTemplateDao.updateSortById(roleIdList.get(i), i, userId); + } + } + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + @Override + public void updateDefaultRole(UpGovRoleFormDTO formDTO) { + if (govStaffRoleTemplateDao.upNameOrDescription(formDTO) < NumConstant.ONE) { + throw new RenException("修改角色信息失败"); + } + } + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + @Override + public void updateCustomerRole(UpGovRoleFormDTO formDTO) { + if (govStaffRoleDao.upNameOrDescription(formDTO) < NumConstant.ONE) { + throw new RenException("修改角色信息失败"); + } + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index e25a4600eb..63a26443d9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -49,6 +49,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; @@ -190,23 +191,10 @@ public class GridLatestServiceImpl extends BaseServiceImpl getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) { - List allData = new LinkedList<>(); - List userIds = baseDao.selectAllUserByCustomerId(customerUserFormDTO.getCustomerId()); - if(null == userIds) userIds = new LinkedList<>(); - CommonCustomerFormDTO customerParam = new CommonCustomerFormDTO(); - customerParam.setCustomerId(customerUserFormDTO.getCustomerId()); - Result> volunteer = epmetHeartOpenFeignClient.volunteerUserIds(customerParam); - if(volunteer.success() && null != volunteer.getData() && !volunteer.getData().isEmpty()){ - userIds.addAll(volunteer.getData()); - userIds = userIds.stream().distinct().collect(Collectors.toList()); - } - if(null == userIds || userIds.isEmpty()){ - return allData; - } PageHelper.startPage(customerUserFormDTO.getPageNo(),customerUserFormDTO.getPageSize()); - allData = userWechatDao.selectResiAndStrangerInfo(userIds,customerUserFormDTO.getName()); - if(null == allData || allData.isEmpty()){ - return allData; + List allData = userWechatDao.selectResiAndStrangerInfo(customerUserFormDTO.getCustomerId(),customerUserFormDTO.getName()); + if (CollectionUtils.isEmpty(allData)){ + return new ArrayList<>(); } allData.forEach(info -> { if(StringUtils.isNotBlank(info.getUserId())){ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java index fd9e5891cd..5e3fd465ec 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java @@ -15,15 +15,19 @@ import com.epmet.constant.PatrolConstant; import com.epmet.dao.CustomerStaffDao; import com.epmet.dao.StaffPatrolDetailDao; import com.epmet.dao.StaffPatrolRecordDao; +import com.epmet.dao.StatsStaffPatrolRecordDailyDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.StaffPatrolDetailDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.StaffPatrolDetailEntity; import com.epmet.entity.StaffPatrolRecordEntity; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.GovProjectOpenFeignClient; import com.epmet.service.StaffPatrolDetailService; import com.epmet.service.StaffPatrolRecordService; +import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -61,6 +65,12 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StaffPatrolRecordEntity :: getStatus, PatrolConstant.PATROLLING); + wrapper.eq(StringUtils.isNotBlank(formDTO.getCustomerId()), StaffPatrolRecordEntity :: getCustomerId, formDTO.getCustomerId()); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + String endTimeStr = DateUtils.format(item.getPatrolStartTime(), DateUtils.DATE_PATTERN_YYYYMMDD); + endTimeStr = endTimeStr.concat("235959"); + Date endTime = DateUtils.parse(endTimeStr, DateUtils.DATE_TIME_NO_SPLIT); + item.setPatrolEndTime(endTime); + item.setActrualEndTime(endTime); + item.setStatus(PatrolConstant.END); + Integer totalTime = DateUtils.calculateSecond(item.getPatrolStartTime(), endTime) + 59; + item.setTotalTime(totalTime); + item.setUpdatedTime(null); + statsPatrolUpdateEnd(item.getStaffId(),totalTime, item.getPatrolStartTime(), endTime, item.getGrid()); + }); + + updateBatchById(list); + } + } + + /** + * @Description 巡查结束时,添加巡查统计表逻辑 + * @Param userId + * @Param totalTime + * @Param patrolStartTime + * @Param patrolEndTime + * @author zxc + * @date 2021/7/1 10:50 上午 + */ + @Transactional(rollbackFor = Exception.class) + public void statsPatrolUpdateEnd(String userId, Integer totalTime, Date patrolStartTime, Date patrolEndTime,String gridId){ + String dateId = DateUtils.getBeforeNDay(NumConstant.ZERO); + PatrolProjectFormDTO formDTO = new PatrolProjectFormDTO(); + formDTO.setUserId(userId); + formDTO.setPatrolStartTime(DateUtils.format(patrolStartTime,DateUtils.DATE_TIME_PATTERN)); + formDTO.setPatrolEndTime(DateUtils.format(patrolEndTime,DateUtils.DATE_TIME_PATTERN)); + Result patrolProject = govProjectOpenFeignClient.selectPatrolProject(formDTO); + if (!patrolProject.success()){ + throw new RenException("查询巡查期间立项数失败【"+patrolProject.getInternalMsg()+"】"); + } + Integer data = patrolProject.getData(); + statsStaffPatrolRecordDailyDao.updateStatsRecordEnd(userId,totalTime,data,dateId,gridId); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java new file mode 100644 index 0000000000..a53fc8e3a5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java @@ -0,0 +1,32 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.StatsStaffPatrolRecordDailyDao; +import com.epmet.dto.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; +import com.epmet.service.StatsStaffPatrolRecordDailyService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Service +@Slf4j +public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl implements StatsStaffPatrolRecordDailyService { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index a2b08568e7..0716978c1c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -247,6 +247,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { @Override @Transactional(rollbackFor = Exception.class) public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) { + // 校验这个徽章此人有没有 Integer recordCount = userBadgeCertificateRecordDao.selectIsExist(certificationAddFormDTO.getBadgeId(), certificationAddFormDTO.getUserId()); if (recordCount>NumConstant.ZERO){ throw new RenException("不允许重复提交审核"); @@ -296,6 +297,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { .map(AuthFieldResultDTO::getEnName).collect(Collectors.toSet()); List missColumns = ValidatorUtils.hasAllRequired(JSON.toJSONString(certificationAddFormDTO), requiredColumns); if (!CollectionUtils.isEmpty(missColumns)) { + /*EpmetErrorCode.BADGE_CHECK.setMsg(JSON.toJSONString(missColumns).concat("不能为空")); + throw new RenException(EpmetErrorCode.BADGE_CHECK.getCode());*/ throw new RenException(JSON.toJSONString(missColumns).concat("不能为空")); } } @@ -360,6 +363,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { */ @Override public List authField(AuthFieldFormDTO authFieldFormDTO) { + // 查询徽章要显示的认证信息字段 List authFieldResultDTOS = userBadgeDao.selectAuthField(authFieldFormDTO); if (CollectionUtils.isEmpty(authFieldResultDTOS)){ authFieldFormDTO.setCustomerId(BadgeConstant.DEFAULT_CUSTOMER); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index af8191b9a2..53befc262c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -311,6 +311,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl implem if(pointResult.success() && null != pointResult.getData()){ //累计积分 result.setPoint(pointResult.getData().getUsablePoint()); + //今日已获得积分,用于积分任务列表显示 + result.setTodayObtainedPoint(pointResult.getData().getTodayObtainedPoint()); } return result; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/DimIdGenerator.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/DimIdGenerator.java new file mode 100644 index 0000000000..35e1f6d99b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/DimIdGenerator.java @@ -0,0 +1,91 @@ +package com.epmet.util; + +import com.epmet.commons.tools.utils.DateUtils; +import lombok.Data; + +import java.util.Calendar; +import java.util.Date; + +public class DimIdGenerator { + + /** + * 生成日期维度ID + * @param targetDate + * @return + */ + public static String getDateDimId(Date targetDate) { + return DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMMDD); + } + + /** + * 获取月维度ID + * @param date + * @return + */ + public static String getMonthDimId(Date date) { + return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMM); + } + + /** + * 获取周维度ID ,每周的星期一为 周的开始 + * @param date + * @return + */ + public static String getWeekDimId(Date date) { + String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + Calendar calendar = Calendar.getInstance(); + calendar.setFirstDayOfWeek(Calendar.MONDAY); + calendar.setTime(date); + return yyyy.concat("W").concat(calendar.get(Calendar.WEEK_OF_YEAR)+""); + } + + /** + * 获取季度维度ID + * @param date + * @return + */ + public static String getQuarterDimId(Date date) { + String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + return yyyy.concat("Q").concat(DateUtils.getQuarterIndex(date) + ""); + } + + /** + * 获取年维度ID + * @param date + * @return + */ + public static String getYearDimId(Date date) { + return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + } + + /** + * 获取封装了所有ID的对象 + * @return + */ + public static DimIdBean getDimIdBean(Date date) { + DimIdBean dimIdBean = new DimIdBean(); + dimIdBean.setDateId(getDateDimId(date)); + dimIdBean.setMonthId(getMonthDimId(date)); + dimIdBean.setWeekId(getWeekDimId(date)); + dimIdBean.setQuarterId(getQuarterDimId(date)); + dimIdBean.setYearId(getYearDimId(date)); + return dimIdBean; + } + + public static void main(String[] args) { + DimIdBean dimIdBean = getDimIdBean(DateUtils.stringToDate("2020-06-14",DateUtils.DATE_PATTERN)); + System.out.println(dimIdBean); + } + + @Data + public static class DimIdBean { + private String dateId; + private String monthId; + private String quarterId; + private String yearId; + private String weekId; + + public DimIdBean() { + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.14__add_patrol_stats.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.14__add_patrol_stats.sql new file mode 100644 index 0000000000..38cd6b93d8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.14__add_patrol_stats.sql @@ -0,0 +1,26 @@ +CREATE TABLE `stats_staff_patrol_record_daily` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `DATE_ID` varchar(32) NOT NULL COMMENT '统计日期 关联日期dim表', + `WEEK_ID` varchar(32) NOT NULL COMMENT '周ID', + `MONTH_ID` varchar(32) NOT NULL COMMENT '月ID', + `QUARTER_ID` varchar(32) NOT NULL COMMENT '季ID', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格id', + `AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '工作人员所属组织id=网格所属的组织id', + `GRID_PIDS` varchar(512) DEFAULT NULL COMMENT '网格所有上级id', + `STAFF_ID` varchar(64) DEFAULT NULL COMMENT '工作人员用户id', + `PATROL_TOTAL` int(11) DEFAULT NULL COMMENT '巡查次数', + `TOTAL_TIME` int(11) DEFAULT NULL COMMENT '巡查时长 单位:秒', + `REPORT_PROJECT_COUNT` int(11) DEFAULT NULL COMMENT '巡查期间直接立项项目数', + `LATEST_PATROL_TIME` datetime DEFAULT NULL COMMENT '最新的巡查开始时间', + `LATEST_PATROL_STATUS` varchar(32) DEFAULT NULL COMMENT '最新的巡查状态 正在巡查中:patrolling;结束:end', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + UNIQUE KEY `unx_staff` (`DATE_ID`,`GRID_ID`,`STAFF_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='[天]工作人员巡查记录统计'; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.15__update_patrol_stats.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.15__update_patrol_stats.sql new file mode 100644 index 0000000000..a97fdfaf7e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.15__update_patrol_stats.sql @@ -0,0 +1,3 @@ +ALTER TABLE `epmet_user`.`stats_staff_patrol_record_daily` + DROP INDEX `unx_staff`, + ADD UNIQUE INDEX `unx_staff`(`DATE_ID`, `STAFF_ID`, `GRID_ID`) USING BTREE; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql new file mode 100644 index 0000000000..1aa5a6c45e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.16__alter_stats_staff_patrol_record_daily.sql @@ -0,0 +1,4 @@ +ALTER TABLE `stats_staff_patrol_record_daily` +ADD COLUMN `SOURCE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'internal' COMMENT '来源类型 external:外部,internal:内部' AFTER `ID`, +ADD COLUMN `SOURCE_CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '数据来源客户Id' AFTER `CUSTOMER_ID`; + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index be9203602e..7712a0b58c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -25,9 +25,12 @@ - update gov_staff_role - set SORT = #{sort} - where ID = #{roleId} + UPDATE gov_staff_role + SET sort = #{sort}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + id = #{roleId} @@ -69,7 +72,9 @@ r.CUSTOMER_ID AS customerId, r.ROLE_KEY AS roleKey, r.ROLE_NAME AS roleName, - r.ORG_TYPE AS orgType + r.ORG_TYPE AS orgType, + r.DESCRIPTION AS description, + r.SORT AS sort FROM gov_staff_role r WHERE r.CUSTOMER_ID = #{customerId} ORDER BY r.SORT asc @@ -104,7 +109,7 @@ ) - + + + + + UPDATE gov_staff_role + + + role_name = #{roleName}, + + + description = #{description}, + + updated_by = #{userId}, + updated_time = NOW() + + WHERE + id = #{roleId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml index a06b408917..9e2cf5d596 100755 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml @@ -18,9 +18,14 @@ + + + + UPDATE gov_staff_role_template + SET sort = #{sort}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + id = #{roleId} + + + + UPDATE gov_staff_role_template + + + role_name = #{roleName}, + + + description = #{description}, + + updated_by = #{userId}, + updated_time = NOW() + + WHERE + id = #{roleId} + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml index bf38f046e1..d3d5b53bb3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml @@ -22,7 +22,7 @@ pr.STAFF_ID = #{userId} ) - GROUP BY pr.STAFF_ID ORDER BY pr.CREATED_TIME DESC)t + ORDER BY pr.CREATED_TIME DESC)t GROUP BY STAFF_ID diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml new file mode 100644 index 0000000000..da96fba412 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml @@ -0,0 +1,43 @@ + + + + + + + + update stats_staff_patrol_record_daily + set LATEST_PATROL_TIME = #{patrolStartTime}, + LATEST_PATROL_STATUS = 'patrolling', + UPDATED_TIME = NOW() + where DEL_FLAG = 0 + and ID = #{id} + + + + + update stats_staff_patrol_record_daily + SET TOTAL_TIME = (TOTAL_TIME + #{totalTime}), + PATROL_TOTAL = (PATROL_TOTAL + 1), + REPORT_PROJECT_COUNT = (REPORT_PROJECT_COUNT + #{projectCount}), + LATEST_PATROL_STATUS = 'end', + UPDATED_TIME = NOW() + WHERE DEL_FLAG = 0 + AND STAFF_ID = #{userId} + AND DATE_ID = #{dateId} + AND GRID_ID = #{gridId} + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index f3498237a6..06cbd5f02c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -125,9 +125,7 @@ wechat.DEL_FLAG = '0' AND (wechat.NICKNAME IS NOT NULL OR wechat.NICKNAME ]]> '') AND (base.SURNAME IS NOT NULL OR base.SURNAME ]]> '') - - wechat.USER_ID = #{item} - + AND wechat.CUSTOMER_ID = #{customerId} AND (base.REAL_NAME LIKE concat('%',#{realName},'%') OR wechat.NICKNAME LIKE concat('%',#{realName},'%'))