diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index bbc475fc6f..3431acda04 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.22 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.26 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index fd3c252986..4ef8116c0e 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.22 + 0.3.26 com.epmet epmet-cloud diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java index 61386ac6c9..1eb86003bd 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java @@ -4,10 +4,7 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; -import com.epmet.dto.form.GovWxmpFormDTO; -import com.epmet.dto.form.SendSmsCodeFormDTO; -import com.epmet.dto.form.StaffOrgsFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.GovLoginService; @@ -98,5 +95,17 @@ public class GovLoginController { govLoginService.loginOut(tokenDto); return new Result(); } + + /** + * 更新缓存的角色列表 + * @param form + * @return + */ + @PostMapping("/updatecachedroles") + public Result updateCachedRoles(@RequestBody UpdateCachedRolesFormDTO form) { + ValidatorUtils.validateEntity(form); + govLoginService.updateCachedRoles(form.getStaffId(), form.getOrgId(), form.getRoleIds()); + return new Result(); + } } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/UpdateCachedRolesFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/UpdateCachedRolesFormDTO.java new file mode 100644 index 0000000000..80559c4ec5 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/UpdateCachedRolesFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class UpdateCachedRolesFormDTO { + + @NotBlank(message = "客户ID不能为空") + private String staffId; + + @NotBlank(message = "机关ID不能为空") + private String orgId; + + private List roleIds; + +} diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java index 37b78533b5..a07565cf50 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java @@ -61,4 +61,11 @@ public interface GovLoginService { * @Date 2020/4/21 22:08 **/ void loginOut(TokenDto tokenDto); + + /** + * 更新缓存中的角色列表 + * @param staffId + * @param roleIds + */ + void updateCachedRoles(String staffId, String orgId, List roleIds); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 45e34e282e..5c8f90e81e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.impl; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -21,6 +22,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; @@ -61,6 +63,8 @@ public class GovLoginServiceImpl implements GovLoginService { private GovOrgFeignClient govOrgFeignClient; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; /** * @param formDTO @@ -115,8 +119,7 @@ public class GovLoginServiceImpl implements GovLoginService { String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); if (!formDTO.getSmsCode().equals(rightSmsCode)) { logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); - //TODO 2020-05-21 校验验证码先去掉方便测试 - //throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } //3、查询用户所有的组织信息 List customerIdList = new ArrayList<>(); @@ -291,6 +294,32 @@ public class GovLoginServiceImpl implements GovLoginService { cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId()); } + @Override + public void updateCachedRoles(String staffId, String orgId, List roleIds) { + GovTokenDto userDetails = cpUserDetailRedis.get(AppClientConstant.APP_GOV, AppClientConstant.CLIENT_WXMP, staffId, GovTokenDto.class); + if (userDetails == null) { + return; + } + + GovStaffRoleFormDTO form = new GovStaffRoleFormDTO(); + form.setRoleIdList(roleIds); + Result> result = userOpenFeignClient.getByIds(form); + if (!result.success()) { + throw new RenException("更新缓存中的角色列表失败:" + result.getInternalMsg()); + } + + List roles = result.getData().stream().map(roleDto -> { + GovTokenDto.Role role = new GovTokenDto.Role(); + role.setRoleName(roleDto.getRoleName()); + role.setRoleKey(roleDto.getRoleKey()); + role.setId(roleDto.getRoleId()); + return role; + }).collect(Collectors.toList()); + + userDetails.setRoleList(roles); + cpUserDetailRedis.set(userDetails, jwtTokenProperties.getExpire()); + } + //保存登录日志 private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId) { StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); 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 c2aaddf70c..67aced6dbe 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 @@ -127,4 +127,8 @@ public interface Constant { */ String UNREAD = "unread"; + /** + * 创建时间字段名 + */ + String CREATED_TIME = "created_time"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index a8a569100d..0b1295ab88 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -117,5 +117,5 @@ public interface ServiceConstant { /** * 数据统计 */ - String DATA_STATISTICAL = "data-statistical-server"; + String DATA_STATISTICAL_SERVER = "data-statistical-server"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java new file mode 100644 index 0000000000..4a77d9b7cc --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java @@ -0,0 +1,103 @@ +package com.epmet.commons.tools.dto.form; + +import com.alibaba.fastjson.JSON; +import org.springframework.util.CollectionUtils; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * desc: 钉钉文本消息参数 实体类 + * + * @date: 2020/6/29 9:06 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ +public class DingTalkTextMsg implements Serializable { + + private static final long serialVersionUID = -3611771312188821915L; + /** + * 消息接收者 + */ + private String webHook; + + /** + * 密钥 + */ + private String secret; + /** + * 发送内容 + */ + private String content; + + /** + * at的群成员手机号 + */ + private List atMobiles; + + /** + * 是否at所有人 + */ + private boolean isAtAll; + + public String getWebHook() { + return webHook; + } + + public void setWebHook(String webHook) { + this.webHook = webHook; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public List getAtMobiles() { + return atMobiles; + } + + public void setAtMobiles(List atMobiles) { + this.atMobiles = atMobiles; + } + + public boolean isAtAll() { + return isAtAll; + } + + public void setAtAll(boolean atAll) { + isAtAll = atAll; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public String getMsgContent() { + Map items = new HashMap<>(); + items.put("msgtype", "text"); + + Map textContent = new HashMap<>(); + textContent.put("content", getContent()); + items.put("text", textContent); + + Map atItems = new HashMap<>(); + if (!CollectionUtils.isEmpty(atMobiles)) { + atItems.put("atMobiles", atMobiles); + } + if (isAtAll) { + atItems.put("isAtAll", isAtAll); + } + items.put("at", atItems); + return JSON.toJSONString(items); + } +} 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 e12787cc3b..45fdce2511 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 @@ -60,7 +60,8 @@ public enum EpmetErrorCode { ALREADY_EVALUATE(8501,"您已评价"), ALREADY_VOTE(8502,"您已表态"), - + TEXT_SCAN_FAILED(8503,"内容审核失败,请重新编辑"), + IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"), PROJECT_IS_CLOSED(8601,"项目已结案"), // 该错误不会提示给前端,只是后端传输错误信息用。 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java new file mode 100644 index 0000000000..4f24fa70d2 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -0,0 +1,116 @@ +package com.epmet.commons.tools.filter; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.filter.LevelFilter; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.IThrowableProxy; +import ch.qos.logback.classic.spi.StackTraceElementProxy; +import ch.qos.logback.core.spi.FilterReply; +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; +import com.epmet.commons.tools.utils.DingdingMsgSender; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.text.SimpleDateFormat; + +/** + * desc: 发送日志消息 + * + * @date: 2020/6/24 17:47 + * @author: jianjun liu + */ +public class LogMsgSendFilter extends LevelFilter { + private static final Logger logger = LoggerFactory.getLogger(LogMsgSendFilter.class); + private DingdingMsgSender msgSender = new DingdingMsgSender(); + private String webHook; + private String secret; + + @Override + public FilterReply decide(ILoggingEvent event) { + //如果日志级别等于设置的日志级别 则发送消息 + if (event.getLevel().isGreaterOrEqual(Level.ERROR)) { + try { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("【日志告警】\n"); + + stringBuilder.append("\n"); + + stringBuilder.append("告警级别:" + event.getLevel()); + stringBuilder.append("\n"); + stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp())); + stringBuilder.append("\n"); + stringBuilder.append("TraceId:" + Thread.currentThread().getName()); + stringBuilder.append("\n"); + stringBuilder.append("告警信息:" + event.getFormattedMessage()); + stringBuilder.append("\n"); + + IThrowableProxy throwableProxy = event.getThrowableProxy(); + //异常信息处理 暂时处理一级的5行数据 + apendStackInfo(stringBuilder, throwableProxy); + DingTalkTextMsg msg = new DingTalkTextMsg(); + msg.setContent(stringBuilder.toString()); + if (StringUtils.isNotBlank(webHook)) { + msg.setWebHook(webHook); + } + if (StringUtils.isNotBlank(secret)) { + msg.setSecret(secret); + } + boolean flag = msgSender.sendMsgAsync(msg); + if (!flag) { + logger.warn("msgSender.sendMsg fail,param:{}", stringBuilder.toString()); + } + } catch (Exception e) { + logger.warn("decide exception", e); + } + } + //交给其他filter继续向下处理 + return super.decide(event); + } + + private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) { + int defaultRowLine = 5; + if (throwableProxy != null) { + stringBuilder.append("异常信息:") + .append(throwableProxy.getClassName()) + .append(" : ") + .append(throwableProxy.getMessage()) + .append("\n"); + + StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray(); + StackTraceElementProxy stackTraceElementProxy = null; + + if (stackTraceElementProxyArray.length < defaultRowLine) { + defaultRowLine = stackTraceElementProxyArray.length; + } + for (int i = 0; i < defaultRowLine; i++) { + stackTraceElementProxy = stackTraceElementProxyArray[i]; + StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement(); + stringBuilder.append("\t\tat "); + stringBuilder.append(stackTraceElement.getClassName()); + stringBuilder.append("."); + stringBuilder.append(stackTraceElement.getMethodName()); + stringBuilder.append("("); + stringBuilder.append(stackTraceElement.getFileName()); + stringBuilder.append(":"); + stringBuilder.append(stackTraceElement.getLineNumber()); + stringBuilder.append(")"); + stringBuilder.append("\n"); + } + } + } + + + private String formatLongTime2Str(long timestamp) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + return dateFormat.format(timestamp); + } + + public void setWebHook(String webHook) { + this.webHook = webHook; + } + + public void setSecret(String secret) { + this.secret = secret; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java new file mode 100644 index 0000000000..40420d1be7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java @@ -0,0 +1,185 @@ +package com.epmet.commons.tools.utils; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.Lists; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * desc: 发送消息工具类 + * + * @date: 2020/6/29 8:43 + * @author: jianjun liu + */ +@Component +public class DingdingMsgSender { + + private final Logger logger = LoggerFactory.getLogger(DingdingMsgSender.class); + //如果不设置则为 开发环境机器人地址 + private static final String webHook = "https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c"; + private static final String secret = "SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19"; + /** + * 默认10 + */ + private static Integer maxQueueSize = 10; + + /** + * 有序队列 + */ + private ArrayBlockingQueue msgQueue = new ArrayBlockingQueue<>(maxQueueSize); + + + private volatile boolean running = false; + + private Cache limitCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).maximumSize(1000).build(); + + public DingdingMsgSender() { + + } + + + private void handleMsg() { + DingTalkTextMsg msg = null; + try { + //阻塞取元素 + msg = msgQueue.take(); + if (msg != null) { + AtomicInteger limitCount = limitCache.getIfPresent(msg.getWebHook()); + if (limitCount == null) { + limitCount = new AtomicInteger(1); + limitCache.put(msg.getWebHook(), limitCount); + } + if (limitCount.intValue() > maxQueueSize) { + msgQueue.offer(msg); + Thread.sleep(1000); + } else { + sendPostByJSON(msg); + limitCount.addAndGet(1); + } + } else { + Thread.sleep(1000); + } + } catch (Exception e) { + logger.warn("handleMsg exception,serverUrl:" + msg.getWebHook() + ",msg:" + JSON.toJSONString(msg), e); + } + } + + + /** + * desc:异步发送消息 + * + * @param messageParam + * @return + * @throws IOException + */ + public boolean sendMsgAsync(DingTalkTextMsg messageParam) { + if (!running) { + running = true; + getThread().start(); + } + boolean flag = false; + int currentQueueSize = msgQueue.size(); + //非阻塞 添加/删除元素 + if (currentQueueSize < maxQueueSize) { + flag = msgQueue.offer(messageParam); + } else { + msgQueue.poll(); + + DingTalkTextMsg param = new DingTalkTextMsg(); + param.setContent("待发送消息队列已满,当前队列个数" + msgQueue.size() + "\n" + "最新消息内容:" + JSON.toJSONString(messageParam)); + param.setWebHook(messageParam.getWebHook()); + sendPostByJSON(param); + } + return flag; + } + + /** + * 同步发送报警 + * + * @param messageParam + * @return + * @throws IOException + */ + public Result sendMsgSync(DingTalkTextMsg messageParam) { + return sendPostByJSON(messageParam); + } + + private Thread getThread() { + Thread sendMsgThread = new Thread("MsgSender-Thread") { + @Override + public void run() { + while (running) { + handleMsg(); + } + } + }; + return sendMsgThread; + } + + + @PreDestroy + public void destroy() { + running = false; + } + + /** + * 发送POST 请求 + * + * @param param 请求参数,JSON格式 + * @return + */ + private Result sendPostByJSON(DingTalkTextMsg param) { + if (StringUtils.isBlank(param.getWebHook())) { + param.setWebHook(webHook); + } + if (StringUtils.isBlank(param.getSecret())) { + param.setSecret(secret); + } + Result result = new Result().error(); + Long timestamp = System.currentTimeMillis(); + try { + String stringToSign = timestamp + "\n" + param.getSecret(); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(param.getSecret().getBytes("UTF-8"), "HmacSHA256")); + byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8")); + String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8"); + String url = param.getWebHook(); + url = url.concat("×tamp=" + timestamp + "&sign=" + sign); + String jsonStrParam = param.getMsgContent(); + result = HttpClientManager.getInstance().sendPostByJSON(url, jsonStrParam); + } catch (Exception e) { + logger.warn("sendPostByJSON error", e); + } + return result; + } + + + public static void main(String[] args) { + for (int i = 0; i < 50; i++) { + + DingTalkTextMsg dingTalkTextMsg = new DingTalkTextMsg(); + dingTalkTextMsg.setWebHook(""); + dingTalkTextMsg.setContent("测试消息" + i); + dingTalkTextMsg.setAtMobiles(Lists.newArrayList()); + dingTalkTextMsg.setAtAll(false); + dingTalkTextMsg.setSecret(""); + DingdingMsgSender msgSender = new DingdingMsgSender(); + msgSender.sendMsgAsync(dingTalkTextMsg); + } + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 20790e1d6a..2cfaed7588 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -1,10 +1,13 @@ package com.epmet.commons.tools.utils; + import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; @@ -20,10 +23,12 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; -import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; import java.io.IOException; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -115,6 +120,35 @@ public class HttpClientManager { } + /** + * desc: 发送钉钉群消息 简版 + * param: url,jsonStrParam + * return: Result + * + * @author: jianjun liu + */ + public Result sendAlarmMsg(String content) { + Long timestamp = System.currentTimeMillis(); + String url = "https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c"; + String secret = "SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19"; + + try { + String stringToSign = timestamp + "\n" + secret; + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256")); + byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8")); + String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)),"UTF-8"); + DingTalkTextMsg msg = new DingTalkTextMsg(); + msg.setContent(content); + url = url.concat("×tamp="+timestamp+"&sign="+sign); + String jsonStrParam = msg.getMsgContent(); + return sendPostByJSON(url, jsonStrParam); + } catch (Exception e) { + e.printStackTrace(); + } + return new Result().error(); + } + /** * desc: 发送get请求 * param:url, params diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 354c47f3ea..2d4f57c3b7 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -120,6 +120,7 @@ lb://epmet-activiti-server lb://epmet-job-server + lb://epmet-user-server @@ -180,7 +181,7 @@ lb://data-statistical-server - + diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/DimDepartmentDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/DimDepartmentDTO.java new file mode 100644 index 0000000000..6e51daed40 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/DimDepartmentDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 部门维度 + * + * @author yinzuomei@elink-cn.com + * @date 2020/6/29 13:59 + */ +@Data +public class DimDepartmentDTO implements Serializable { + private static final long serialVersionUID = -521155628850201172L; + /** + * DEPARTMENT_ID + */ + private String id; + + /** + * 部门名称 + */ + private String departmentName; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserIncrTrendFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserIncrTrendFormDTO.java index f4496d0199..7f888a0b0d 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserIncrTrendFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserIncrTrendFormDTO.java @@ -13,15 +13,18 @@ import java.io.Serializable; */ @Data public class UserIncrTrendFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + /** * reg:注册居民 parti:参与用户,如果值为null,默认为reg */ - @NotBlank(message = "regOrPartiFlag不能为空") - private String regOrPartiFlag; + @NotBlank(message = "regOrPatiFlag不能为空", groups = {AddUserInternalGroup.class}) + private String regOrPatiFlag; /** * day:日维度 | month:月维度 | (周、季、年)… */ - @NotBlank(message = "type不能为空") + @NotBlank(message = "type不能为空", groups = {AddUserInternalGroup.class}) private String type; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubAgencyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubAgencyFormDTO.java index 43d089e01a..0532ac521a 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubAgencyFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubAgencyFormDTO.java @@ -14,12 +14,15 @@ import java.io.Serializable; @Data public class UserSubAgencyFormDTO implements Serializable { private static final long serialVersionUID = -4558978951554887536L; + public interface AddUserInternalGroup { + } + /** * reg:注册居民 parti:参与用户,如果值为null,默认为reg */ - @NotBlank(message = "regOrPartiFlag不能为空") + @NotBlank(message = "regOrPartiFlag不能为空",groups = {AddUserInternalGroup.class}) private String regOrPartiFlag; - @NotBlank(message = "查询日期不能为空") + @NotBlank(message = "查询日期不能为空",groups = {AddUserInternalGroup.class}) private String dateId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubGridFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubGridFormDTO.java index c9bc20b734..f0f8303642 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubGridFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSubGridFormDTO.java @@ -14,12 +14,16 @@ import java.io.Serializable; @Data public class UserSubGridFormDTO implements Serializable { private static final long serialVersionUID = -1815903503939673149L; + + public interface AddUserInternalGroup { + } + /** * reg:注册居民 parti:参与用户,如果值为null,默认为reg */ - @NotBlank(message = "regOrPartiFlag不能为空") + @NotBlank(message = "regOrPartiFlag不能为空", groups = {AddUserInternalGroup.class}) private String regOrPartiFlag; - @NotBlank(message = "查询日期不能为空") + @NotBlank(message = "查询日期不能为空", groups = {AddUserInternalGroup.class}) private String dateId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSummaryInfoFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSummaryInfoFormDTO.java index 9b8bed1c07..047d909ee2 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSummaryInfoFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/user/UserSummaryInfoFormDTO.java @@ -14,10 +14,11 @@ import java.io.Serializable; @Data public class UserSummaryInfoFormDTO implements Serializable { private static final long serialVersionUID = -1802471335671321322L; - + public interface AddUserInternalGroup { + } /** * reg:注册居民 parti:参与用户,如果值为null,默认为reg */ - @NotBlank(message = "regOrPartiFlag不能为空") + @NotBlank(message = "regOrPartiFlag不能为空",groups = {AddUserInternalGroup.class}) private String regOrPartiFlag; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserAgencyInfoResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserAgencyInfoResultDTO.java new file mode 100644 index 0000000000..c298892d9b --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserAgencyInfoResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result.user; + +import com.epmet.dto.DimAgencyDTO; +import com.epmet.dto.DimDepartmentDTO; +import com.epmet.dto.DimGridDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 直属机关、部门、网格列表查询 返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/6/29 13:55 + */ +@Data +public class UserAgencyInfoResultDTO implements Serializable { + private static final long serialVersionUID = 4471324414446061654L; + private Boolean subGridFlag; + private Boolean subDepartmentFlag; + private Boolean subAgencyFlag; +// @JsonIgnore + private List subAgencyList; +// @JsonIgnore + private List subGridList; +// @JsonIgnore + private List subDepartmentList; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java index ccbcb009ed..a72096446c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java @@ -19,7 +19,7 @@ public class UserSummaryInfoResultDTO implements Serializable { * 数据更新至yyyy.MM.dd */ private String currentDate; - + private String dateId; /** * 注册居民数 */ diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/group/constant/GroupConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/group/constant/GroupConstant.java index 699090f931..cfc64da174 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/group/constant/GroupConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/group/constant/GroupConstant.java @@ -7,6 +7,6 @@ package com.epmet.group.constant; public interface GroupConstant { String MONTH = "month"; - String DATE = "date"; + String DATE = "day"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/issue/constant/IssueConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/issue/constant/IssueConstant.java index 88d4f44c78..42489e9b4a 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/issue/constant/IssueConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/issue/constant/IssueConstant.java @@ -7,7 +7,7 @@ package com.epmet.issue.constant; */ public interface IssueConstant { String MONTH = "month"; - String DATE = "date"; + String DATE = "day"; String VOTING_NAME = "表决中"; String SHIFT_NAME = "已转项目"; String CLOSED_NAME = "已关闭"; 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 d3c8d8bf1c..a23dfa1a62 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 @@ -6,7 +6,7 @@ package com.epmet.project.constant; **/ public interface ProjectConstant { - String DATE = "date"; + String DAY = "day"; String MONTH = "month"; /** diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagUsedAgencyDTO.java similarity index 94% rename from epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java rename to epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagUsedAgencyDTO.java index 1d91a3287a..9f0ddc7b3e 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagAgencyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagUsedAgencyDTO.java @@ -20,7 +20,6 @@ package com.epmet.publicity.dto.result; import lombok.Data; import java.io.Serializable; -import java.util.Date; /** @@ -30,7 +29,7 @@ import java.util.Date; * @since v1.0.0 2020-06-19 */ @Data -public class FactTagAgencyDTO implements Serializable { +public class FactTagUsedAgencyDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagViewedAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagViewedAgencyDTO.java new file mode 100644 index 0000000000..31b5334303 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactTagViewedAgencyDTO.java @@ -0,0 +1,63 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.publicity.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 文章引用标签阅读数量【机关】统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-19 + */ +@Data +public class FactTagViewedAgencyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 标签名称 标签名称 + */ + private String name; + + /** + * 使用改标签的数量 + */ + private Integer value; + + /** + * 固定值:文章数量 + */ + private String type="阅读次数"; + + /** + * 机关Id + */ + private String agencyId; + + /** + * 标签Id + */ + private String tagId; + + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/constant/TopicConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/constant/TopicConstant.java index 62c27f4b55..46259526ce 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/constant/TopicConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/constant/TopicConstant.java @@ -26,5 +26,5 @@ public interface TopicConstant { String SHIFTED = "已转议题"; String MONTH = "month"; - String DATE = "date"; + String DATE = "day"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java index 87dd107010..3b599a64ff 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubAgencyResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.topic.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -32,4 +33,10 @@ public class TopicSubAgencyResultDTO implements Serializable { * 机关Id */ private String agencyId; + + /** + * 排序 + */ + @JsonIgnore + private Integer sort; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java index 64cad1615c..d319e2c128 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSubGridResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.topic.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -32,4 +33,10 @@ public class TopicSubGridResultDTO implements Serializable { * 网格Id */ private String gridId; + + /** + * 排序 + */ + @JsonIgnore + private Integer sort; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java index 3112df3356..71b096ca0f 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryInfoResultDTO.java @@ -16,15 +16,15 @@ public class TopicSummaryInfoResultDTO implements Serializable { /** * 名称 */ - private String name; + private String name = ""; /** * 值 */ - private Integer value; + private Integer value = 0; /** * 百分比 */ - private String ratio; + private String ratio = "0.0%"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java index 6f14a45fd5..c59017335b 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/topic/dto/result/TopicSummaryResultDTO.java @@ -16,27 +16,27 @@ public class TopicSummaryResultDTO implements Serializable { /** * 话题总数 */ - private Integer topicTotalCount; + private Integer topicTotalCount = 0; /** * 讨论中话题数量 */ - private Integer talkingTotalCount; + private Integer talkingTotalCount = 0; /** * 已关闭话题数量 */ - private Integer closedTotalCount; + private Integer closedTotalCount = 0; /** * 已屏蔽话题数量 */ - private Integer shieldedTotalCount; + private Integer shieldedTotalCount = 0; /** * 话题已转议题数量 */ - private Integer shiftedTotalCount; + private Integer shiftedTotalCount = 0; /** * 数据更新至 时间 diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml index e2981ef533..59f372c5d1 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.1 + image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.14 ports: - "8109:8109" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml index 3c34b09319..4b2e0645ab 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.1 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.14 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 9ae8ec1dc4..2b27fda73a 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 0.3.1 + 0.3.14 data-report-server diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/project/ProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/project/ProjectController.java index 5a96496ef6..47a4765288 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/project/ProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/project/ProjectController.java @@ -72,7 +72,7 @@ public class ProjectController { @PostMapping("incrtrend") public Result> incrTrend(@LoginUser TokenDto tokenDto, @RequestBody ProjectIncrTrendFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ProjectIncrTrendFormDTO.ProjectIncr.class); - if (!ProjectConstant.DATE.equals(formDTO.getType()) && !ProjectConstant.MONTH.equals(formDTO.getType())) { + if (!ProjectConstant.DAY.equals(formDTO.getType()) && !ProjectConstant.MONTH.equals(formDTO.getType())) { throw new RenException(ProjectConstant.TYPE_EXCEPTION); } return new Result>().ok(projectService.getProjectIncrTrend(tokenDto, formDTO)); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java index 56d31b9d17..8612d82002 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java @@ -65,7 +65,7 @@ public class PublicityController { * @author jyy */ @PostMapping("tagviewed") - public Result> tagviewed(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { + public Result> tagviewed(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, TagFormDTO.GroupJava.class); Integer pageSize = formDTO.getPageSize(); @@ -73,7 +73,7 @@ public class PublicityController { pageSize = NumConstant.TEN; } String type = formDTO.getType(); - return new Result>().ok(publicityService.tagviewed(tokenDto, pageSize, type)); + return new Result>().ok(publicityService.tagviewed(tokenDto, pageSize, type)); } /** @@ -82,7 +82,7 @@ public class PublicityController { * @author jyy */ @PostMapping("tagused") - public Result> tagused(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { + public Result> tagused(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, TagFormDTO.GroupJava.class); Integer pageSize = formDTO.getPageSize(); @@ -90,7 +90,7 @@ public class PublicityController { pageSize = NumConstant.TEN; } String type = formDTO.getType(); - return new Result>().ok(publicityService.tagused(tokenDto, pageSize, type)); + return new Result>().ok(publicityService.tagused(tokenDto, pageSize, type)); } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/user/UserAnalysisController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/user/UserAnalysisController.java index da00a281d0..cceebbef37 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/user/UserAnalysisController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/user/UserAnalysisController.java @@ -6,10 +6,7 @@ import com.epmet.dto.form.user.UserIncrTrendFormDTO; import com.epmet.dto.form.user.UserSubAgencyFormDTO; import com.epmet.dto.form.user.UserSubGridFormDTO; import com.epmet.dto.form.user.UserSummaryInfoFormDTO; -import com.epmet.dto.result.user.UserIncrTrendResultDTO; -import com.epmet.dto.result.user.UserSubAgencyResultDTO; -import com.epmet.dto.result.user.UserSubGridResultDTO; -import com.epmet.dto.result.user.UserSummaryInfoResultDTO; +import com.epmet.dto.result.user.*; import com.epmet.service.user.UserAnalysisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -40,7 +37,7 @@ public class UserAnalysisController { **/ @PostMapping("summaryinfo") public Result summaryInfo(@RequestBody UserSummaryInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO,UserSummaryInfoFormDTO.AddUserInternalGroup.class); UserSummaryInfoResultDTO userSummaryInfoResultDTO = userService.summaryInfo(formDTO); return new Result().ok(userSummaryInfoResultDTO); } @@ -54,7 +51,7 @@ public class UserAnalysisController { **/ @PostMapping("subagency") public Result> subAgency(@RequestBody UserSubAgencyFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO,UserSubAgencyFormDTO.AddUserInternalGroup.class); List userSubAgencyResultDTO = userService.subAgency(formDTO); return new Result>().ok(userSubAgencyResultDTO); } @@ -68,7 +65,7 @@ public class UserAnalysisController { **/ @PostMapping("subgrid") public Result> subGrid(@RequestBody UserSubGridFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO, UserSubGridFormDTO.AddUserInternalGroup.class); List userSubGridResultDTO = userService.subGrid(formDTO); return new Result>().ok(userSubGridResultDTO); } @@ -82,9 +79,23 @@ public class UserAnalysisController { **/ @PostMapping("incrtrend") public Result> incrTrend(@RequestBody UserIncrTrendFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); - List userIncrTrendResultDTO = userService.incrTrend(formDTO); + ValidatorUtils.validateEntity(formDTO, UserIncrTrendFormDTO.AddUserInternalGroup.class); + List userIncrTrendResultDTO = userService.incrTrendV2(formDTO); return new Result>().ok(userIncrTrendResultDTO); } + /** + * @param + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 直属机关、部门、网格列表查询 + * @Date 2020/6/29 14:10 + **/ + @PostMapping("checksublist") + public Result checkSubList() { + UserAgencyInfoResultDTO userAgencyInfoResultDTO = userService.checkSubList(); + return new Result().ok(userAgencyInfoResultDTO); + } + + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/group/GroupDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/group/GroupDao.java index 0f22c81d2b..e2a8410272 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/group/GroupDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/group/GroupDao.java @@ -32,7 +32,7 @@ public interface GroupDao { * @param * @author zxc */ - List getSubGroupCount(); + List getSubGroupCount(@Param("customerId") String customerId); /** * @Description 获取直属网格下的小组数 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/issue/IssueDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/issue/IssueDao.java index f8f3058673..abf2c4d350 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/issue/IssueDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/issue/IssueDao.java @@ -18,27 +18,30 @@ public interface IssueDao { * @author zhaoqifeng * @date 2020/6/22 15:19 * @param agencyId + * @param dateId * @return com.epmet.issue.dto.result.IssueDataDTO */ - IssueDataDTO selectAgencyInfo(@Param("agencyId") String agencyId); + IssueDataDTO selectAgencyInfo(@Param("agencyId") String agencyId, @Param("dateId") String dateId); /** * 获取下级机关统计信息 * @author zhaoqifeng * @date 2020/6/22 15:20 * @param agencyId + * @param dateId * @return java.util.List */ - List selectSubAgencyList(@Param("agencyId") String agencyId); + List selectSubAgencyList(@Param("agencyId") String agencyId, @Param("dateId") String dateId); /** * 获取机关下网格统计信息 * @author zhaoqifeng * @date 2020/6/22 15:21 * @param agencyId + * @param dateId * @return java.util.List */ - List selectGridList(@Param("agencyId") String agencyId); + List selectGridList(@Param("agencyId") String agencyId, @Param("dateId") String dateId); /** * 获取当前机关日增量 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java index 33801156b9..a4babe6039 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java @@ -42,76 +42,76 @@ public interface PublicityDao { /** * @Description 当月———获取机关下,获取每个标签阅读数量,按照数量降序,取前pagesize个 * @param agencyId,monthId,pageSize 机关id,月,展示数量 - * @author zxc + * @author jyy */ - List getViewedMonthlyCountByTag(@Param("agencyId") String agencyId, @Param("monthId") String monthId, @Param("pageSize") Integer pageSize); + List getViewedMonthlyCountByTag(@Param("agencyId") String agencyId, @Param("monthId") String monthId, @Param("pageSize") Integer pageSize); /** * @Description 当季———获取机关下,获取每个标签阅读数量,按照数量降序,取前pagesize个 * @param agencyId,quarterId,pageSize 机关id,季,展示数量 - * @author zxc + * @author jyy */ - List getViewedQuarterlyCountByTag(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId, @Param("pageSize") Integer pageSize); + List getViewedQuarterlyCountByTag(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId, @Param("pageSize") Integer pageSize); /** * @Description 当年———获取机关下,获取每个标签阅读数量,按照数量降序,取前pagesize个 * @param agencyId,yearId,pageSize 机关id,年,展示数量 - * @author zxc + * @author jyy */ - List getViewedYearlyCountByTag(@Param("agencyId") String agencyId, @Param("yearId") String yearId, @Param("pageSize") Integer pageSize); + List getViewedYearlyCountByTag(@Param("agencyId") String agencyId, @Param("yearId") String yearId, @Param("pageSize") Integer pageSize); /** * @Description 当月———获取机关下,获取每个标签发文数量,按照数量降序,取前pagesize个 * @param agencyId,monthId,pageSize 机关id,月,展示数量 - * @author zxc + * @author jyy */ - List getUsedMonthlyCountByTag(@Param("agencyId") String agencyId, @Param("monthId") String monthId, @Param("pageSize") Integer pageSize); + List getUsedMonthlyCountByTag(@Param("agencyId") String agencyId, @Param("monthId") String monthId, @Param("pageSize") Integer pageSize); /** * @Description 当季———获取机关下,获取每个标签发文数量,按照数量降序,取前pagesize个 * @param agencyId,quarterId,pageSize 机关id,季,展示数量 - * @author zxc + * @author jyy */ - List getUsedQuarterlyCountByTag(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId, @Param("pageSize") Integer pageSize); + List getUsedQuarterlyCountByTag(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId, @Param("pageSize") Integer pageSize); /** * @Description 当年———获取机关下,每个标签发文数量,按照数量降序,取前pagesize个 * @param agencyId,yearId,pageSize 机关id,年,展示数量 - * @author zxc + * @author jyy */ - List getUsedYearlyCountByTag(@Param("agencyId") String agencyId, @Param("yearId") String yearId, @Param("pageSize") Integer pageSize); + List getUsedYearlyCountByTag(@Param("agencyId") String agencyId, @Param("yearId") String yearId, @Param("pageSize") Integer pageSize); /** * @Description 当月———下级机发文数 * @param agencyId,monthId 机关id,月 - * @author zxc + * @author jyy */ List getSubAgencyPublishedMonth(@Param("agencyId") String agencyId, @Param("monthId") String monthId); /** * @Description 当季———下级机发文数 * @param agencyId,quarterId 机关id,季度 - * @author zxc + * @author jyy */ List getSubAgencyPublishedQuarter(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId); /** * @Description 当年———下级机发文数 * @param agencyId,yearId 机关id,年 - * @author zxc + * @author jyy */ List getSubAgencyPublishedYear(@Param("agencyId") String agencyId, @Param("yearId") String yearId); /** * @Description 当月———下级部门文数 * @param agencyId,monthId 机关id,月 - * @author zxc + * @author jyy */ List getSubDepartPublishedMonth(@Param("agencyId") String agencyId, @Param("monthId") String monthId); /** * @Description 当季———下级部门文数 * @param agencyId,quarterId 机关id,季度 - * @author zxc + * @author jyy */ List getSubDepartPublishedQuarter(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId); /** @@ -124,20 +124,20 @@ public interface PublicityDao { /** * @Description 当月———下级网格文数 * @param agencyId,monthId 机关id,月 - * @author zxc + * @author jyy */ List getSubGridPublishedMonth(@Param("agencyId") String agencyId, @Param("monthId") String monthId); /** * @Description 当季———下级网格文数 * @param agencyId,quarterId 机关id,季度 - * @author zxc + * @author jyy */ List getSubGridPublishedQuarter(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId); /** * @Description 当年———下级网格文数 * @param agencyId,yearId 机关id,年 - * @author zxc + * @author jyy */ List getSubGridPublishedYear(@Param("agencyId") String agencyId, @Param("yearId") String yearId); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/topic/TopicDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/topic/TopicDao.java index e45798d750..2ab863ab78 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/topic/TopicDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/topic/TopicDao.java @@ -54,7 +54,7 @@ public interface TopicDao { * @param * @author zxc */ - List getAllTopicShiftedInfoLastDay(); + List getAllTopicShiftedInfoLastDay(@Param("customerId") String customerId); /** * @Description 校验机关下是否存在直属网格 @@ -75,7 +75,7 @@ public interface TopicDao { * @param * @author zxc */ - List getGridAllTopicShiftedInfoLastDay(); + List getGridAllTopicShiftedInfoLastDay(@Param("customerId")String customerId); /** * @Description 话题日增长 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/user/UserAnalysisDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/user/UserAnalysisDao.java index feba486e41..2df268feb2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/user/UserAnalysisDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/user/UserAnalysisDao.java @@ -2,6 +2,7 @@ package com.epmet.dao.user; import com.epmet.dto.DimAgencyDTO; +import com.epmet.dto.DimDepartmentDTO; import com.epmet.dto.DimGridDTO; import com.epmet.dto.result.user.UserIncrTrendResDTO; import com.epmet.dto.result.user.UserSubAgencyResDTO; @@ -101,7 +102,7 @@ public interface UserAnalysisDao { * @return java.util.List * @param myAgencyId * @author yinzuomei - * @description + * @description 注册用户:机关、日增量折现图 近90天 * @Date 2020/6/23 11:24 **/ List selectRegDayIncr(@Param("agencyId")String myAgencyId); @@ -110,7 +111,7 @@ public interface UserAnalysisDao { * @return java.util.List * @param myAgencyId * @author yinzuomei - * @description + * @description 注册用户:机关、月增量折线图 近12个月包含当前月 * @Date 2020/6/23 11:24 **/ List selectRegMonthIncr(@Param("agencyId")String myAgencyId); @@ -119,7 +120,7 @@ public interface UserAnalysisDao { * @return java.util.List * @param myAgencyId * @author yinzuomei - * @description + * @description 参与用户:机关、日增量折线图 近90天 * @Date 2020/6/23 11:24 **/ List selectParticipationUserDayIncr(@Param("agencyId")String myAgencyId); @@ -128,8 +129,17 @@ public interface UserAnalysisDao { * @return java.util.List * @param myAgencyId * @author yinzuomei - * @description + * @description 参与用户:机关、月增量插线图 近12个月 包含当前月 * @Date 2020/6/23 11:24 **/ List selectParticipationUserMonthIncr(@Param("agencyId") String myAgencyId); + + /** + * @return java.util.List + * @param myAgencyId 工作人员所属机关单位id + * @author yinzuomei + * @description 查询机关下的部门列表 + * @Date 2020/6/29 14:18 + **/ + List selectSubDepartmentList(@Param("agencyId")String myAgencyId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java index 80a5624e3b..21fdfac41b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/group/impl/GroupServiceImpl.java @@ -15,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; /** * @Author zxc @@ -48,9 +50,12 @@ public class GroupServiceImpl implements GroupService { @Override public List subAgency(TokenDto tokenDto) { String agencyId = this.getLoginUserDetails(tokenDto); + String customerId = tokenDto.getCustomerId(); List result = new ArrayList<>(); + //获取下级机关 List subAgencyList = groupDao.getSubAgencyList(agencyId); - List subGroupCount = groupDao.getSubGroupCount(); + //查询客户下 + List subGroupCount = groupDao.getSubGroupCount(customerId); if (subAgencyList.size()!= NumConstant.ZERO){ subGroupCount.forEach(group -> { subAgencyList.forEach(subAgency -> { @@ -60,7 +65,8 @@ public class GroupServiceImpl implements GroupService { } }); }); - return result; + //倒序 + return result.stream().sorted(Comparator.comparing(GroupSubAgencyResultDTO::getValue).reversed()).collect(Collectors.toList()); } return new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/issue/impl/IssueServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/issue/impl/IssueServiceImpl.java index 4271cbe29e..d44576202e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/issue/impl/IssueServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.issue.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dao.issue.IssueDao; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.result.LoginUserDetailsResultDTO; @@ -17,6 +18,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -33,17 +35,33 @@ public class IssueServiceImpl implements IssueService { @Override public IssueSummaryInfoResultDTO getSummaryInfo(TokenDto tokenDto) { IssueSummaryInfoResultDTO result = new IssueSummaryInfoResultDTO(); + //获取当前日期前一天 + Date date = DateUtils.getBeforeDay(new Date()); + //获取日期维度 + String dateId = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); String agencyId = getAgencyId(tokenDto); - IssueDataDTO data = issueDao.selectAgencyInfo(agencyId); - result.setAgencyId(agencyId); - result.setDateName(data.getDateName()); - result.setIssueTotal(data.getIssueTotal()); - result.setVotingTotal(data.getVotingTotal()); - result.setShiftProjectTotal(data.getShiftProjectTotal()); - result.setClosedTotal(data.getClosedTotal()); - result.setVotingRatio(toRatio(data.getVotingPercent())); - result.setShiftProjectRatio(toRatio(data.getShiftProjectPercent())); - result.setClosedRatio(toRatio(data.getClosedPercent())); + IssueDataDTO data = issueDao.selectAgencyInfo(agencyId, dateId); + if (null == data) { + result.setAgencyId(agencyId); + result.setDateName(DateUtils.format(date, "yyyy.MM.dd")); + result.setIssueTotal(NumConstant.ZERO); + result.setVotingTotal(NumConstant.ZERO); + result.setShiftProjectTotal(NumConstant.ZERO); + result.setClosedTotal(NumConstant.ZERO); + result.setVotingRatio("0%"); + result.setShiftProjectRatio("0%"); + result.setClosedRatio("0%"); + } else { + result.setAgencyId(agencyId); + result.setDateName(data.getDateName()); + result.setIssueTotal(data.getIssueTotal()); + result.setVotingTotal(data.getVotingTotal()); + result.setShiftProjectTotal(data.getShiftProjectTotal()); + result.setClosedTotal(data.getClosedTotal()); + result.setVotingRatio(toRatio(data.getVotingPercent())); + result.setShiftProjectRatio(toRatio(data.getShiftProjectPercent())); + result.setClosedRatio(toRatio(data.getClosedPercent())); + } return result; } @@ -51,22 +69,44 @@ public class IssueServiceImpl implements IssueService { public List getSummaryPie(TokenDto tokenDto) { List list = new ArrayList<>(); String agencyId = getAgencyId(tokenDto); - IssueDataDTO data = issueDao.selectAgencyInfo(agencyId); - IssueSummaryPieResultDTO voting = new IssueSummaryPieResultDTO(); - voting.setName(IssueConstant.VOTING_NAME); - voting.setValue(data.getVotingTotal()); - voting.setRatio(toRatio(data.getVotingPercent())); - list.add(voting); - IssueSummaryPieResultDTO shift = new IssueSummaryPieResultDTO(); - shift.setName(IssueConstant.SHIFT_NAME); - shift.setValue(data.getShiftProjectTotal()); - shift.setRatio(toRatio(data.getShiftProjectPercent())); - list.add(shift); - IssueSummaryPieResultDTO closed = new IssueSummaryPieResultDTO(); - closed.setName(IssueConstant.CLOSED_NAME); - closed.setValue(data.getClosedTotal()); - closed.setRatio(toRatio(data.getClosedPercent())); - list.add(closed); + //获取当前日期前一天 + Date date = DateUtils.getBeforeDay(new Date()); + //获取日期维度 + String dateId = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); + IssueDataDTO data = issueDao.selectAgencyInfo(agencyId, dateId); + if (null == data) { + IssueSummaryPieResultDTO voting = new IssueSummaryPieResultDTO(); + voting.setName(IssueConstant.VOTING_NAME); + voting.setValue(NumConstant.ZERO); + voting.setRatio("0%"); + list.add(voting); + IssueSummaryPieResultDTO shift = new IssueSummaryPieResultDTO(); + shift.setName(IssueConstant.SHIFT_NAME); + shift.setValue(NumConstant.ZERO); + shift.setRatio("0%"); + list.add(shift); + IssueSummaryPieResultDTO closed = new IssueSummaryPieResultDTO(); + closed.setName(IssueConstant.CLOSED_NAME); + closed.setValue(NumConstant.ZERO); + closed.setRatio("0%"); + list.add(closed); + } else { + IssueSummaryPieResultDTO voting = new IssueSummaryPieResultDTO(); + voting.setName(IssueConstant.VOTING_NAME); + voting.setValue(data.getVotingTotal()); + voting.setRatio(toRatio(data.getVotingPercent())); + list.add(voting); + IssueSummaryPieResultDTO shift = new IssueSummaryPieResultDTO(); + shift.setName(IssueConstant.SHIFT_NAME); + shift.setValue(data.getShiftProjectTotal()); + shift.setRatio(toRatio(data.getShiftProjectPercent())); + list.add(shift); + IssueSummaryPieResultDTO closed = new IssueSummaryPieResultDTO(); + closed.setName(IssueConstant.CLOSED_NAME); + closed.setValue(data.getClosedTotal()); + closed.setRatio(toRatio(data.getClosedPercent())); + list.add(closed); + } return list; } @@ -74,7 +114,11 @@ public class IssueServiceImpl implements IssueService { public List getSubAgency(TokenDto tokenDto) { List list = new ArrayList<>(); String agencyId = getAgencyId(tokenDto); - List dataList = issueDao.selectSubAgencyList(agencyId); + //获取当前日期前一天 + Date date = DateUtils.getBeforeDay(new Date()); + //获取日期维度 + String dateId = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); + List dataList = issueDao.selectSubAgencyList(agencyId, dateId); if(null != dataList) { dataList.forEach(data -> { IssueSubAgencyResultDTO voting = new IssueSubAgencyResultDTO(); @@ -104,7 +148,11 @@ public class IssueServiceImpl implements IssueService { public List getSubGrid(TokenDto tokenDto) { List list = new ArrayList<>(); String agencyId = getAgencyId(tokenDto); - List dataList = issueDao.selectGridList(agencyId); + //获取当前日期前一天 + Date date = DateUtils.getBeforeDay(new Date()); + //获取日期维度 + String dateId = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); + List dataList = issueDao.selectGridList(agencyId, dateId); if(null != dataList) { dataList.forEach(data -> { IssueSubGridResultDTO voting = new IssueSubGridResultDTO(); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 1d8871803d..26302753eb 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -117,7 +117,7 @@ public class ProjectServiceImpl implements ProjectService { if (null == agencyProjectDailyDTO) { return resultList; } - //2:获取当前组织最近日期的直属下级组织项目统计数据,按项目总量降序 + //2:获取机关下直属网格最近一天的日统计数据,按项目总数降序 resultList = projectDao.selectSubGrid(agencyProjectDailyDTO); return resultList; } @@ -133,7 +133,7 @@ public class ProjectServiceImpl implements ProjectService { String agencyId = getLoginUserDetails(tokenDto); //2:查询机关过去九十天日统计数据(sql降序取前九十条) - if (ProjectConstant.DATE.equals(formDTO.getType())) { + if (ProjectConstant.DAY.equals(formDTO.getType())) { resultList = projectDao.selectIncrTrendDaily(agencyId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java index 9eccb5b29f..bec823066c 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java @@ -18,12 +18,8 @@ package com.epmet.service.publicity; 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.publicity.dto.result.*; -import org.apache.commons.lang3.StringUtils; -import java.util.Date; import java.util.List; /** @@ -46,14 +42,14 @@ public interface PublicityService { * @param tokenDto,formDTO * @author jyy */ - public List tagviewed(TokenDto tokenDto, Integer pageSize, String type) ; + public List tagviewed(TokenDto tokenDto, Integer pageSize, String type) ; /** * @Description 宣传能力—工作端—宣传能力-获取发表最多的分类数据 * @param tokenDto,pageSize,type * @author jyy */ - public List tagused(TokenDto tokenDto, Integer pageSize, String type) ; + public List tagused(TokenDto tokenDto, Integer pageSize, String type) ; /** * @param tokenDto type diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java index 10f19b3ea0..990cc97916 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java @@ -54,7 +54,6 @@ public class PublicityServiceImpl implements PublicityService { @Override public FactPublishedAgencyDailyDTO summaryInfo(TokenDto tokenDto) { String agencyId = this.getLoginUserDetails(tokenDto); - agencyId="b9e295f8c1906a0d1c5e0b313afcda3f"; return publicityDao.summaryInfo(agencyId); } @@ -65,9 +64,8 @@ public class PublicityServiceImpl implements PublicityService { * @author jyy */ @Override - public List tagviewed(TokenDto tokenDto, Integer pageSize, String type) { -// String agencyId = this.getLoginUserDetails(tokenDto); - String agencyId = "0d2ffe9fce682b602b9d451226d08fae"; + public List tagviewed(TokenDto tokenDto, Integer pageSize, String type) { + String agencyId = this.getLoginUserDetails(tokenDto); Date date = new Date(); String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN); String yearId = strDate.substring(0, 4); @@ -94,9 +92,8 @@ public class PublicityServiceImpl implements PublicityService { * @author jyy */ @Override - public List tagused(TokenDto tokenDto, Integer pageSize, String type) { -// String agencyId = this.getLoginUserDetails(tokenDto); - String agencyId = "0d2ffe9fce682b602b9d451226d08fae"; + public List tagused(TokenDto tokenDto, Integer pageSize, String type) { + String agencyId = this.getLoginUserDetails(tokenDto); Date date = new Date(); String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN); String yearId = strDate.substring(0, 4); @@ -124,8 +121,7 @@ public class PublicityServiceImpl implements PublicityService { */ @Override public List subagencyPublishedarticle(TokenDto tokenDto, String type) { -// String agencyId = this.getLoginUserDetails(tokenDto); - String agencyId = "1041fe5e8499dbd8add314291d2f6da4"; + String agencyId = this.getLoginUserDetails(tokenDto); Date date = new Date(); String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); @@ -153,8 +149,7 @@ public class PublicityServiceImpl implements PublicityService { */ @Override public List departmentPublishedarticle(TokenDto tokenDto, String type) { -// String agencyId = this.getLoginUserDetails(tokenDto); - String agencyId = "0d2ffe9fce682b602b9d451226d08fae"; + String agencyId = this.getLoginUserDetails(tokenDto); Date date = new Date(); String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); @@ -182,8 +177,7 @@ public class PublicityServiceImpl implements PublicityService { */ @Override public List subgridPublishedarticle(TokenDto tokenDto, String type) { -// String agencyId = this.getLoginUserDetails(tokenDto); - String agencyId = "0d2ffe9fce682b602b9d451226d08fae"; + String agencyId = this.getLoginUserDetails(tokenDto); Date date = new Date(); String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index 9b8dace788..8c4309dfd6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -14,9 +14,9 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.util.*; import java.util.stream.Collectors; /** @@ -41,6 +41,7 @@ public class TopicServiceImpl implements TopicService { TopicSummaryResultDTO result = new TopicSummaryResultDTO(); String agencyId = this.getLoginUserDetails(tokenDto); List topicStatus = topicDao.getTopicStatus(agencyId); + result.setDeadline(LocalDate.now().minusDays(NumConstant.ONE).toString()); if (topicStatus.size() != NumConstant.ZERO){ topicStatus.forEach(topic -> { if (topic.getTopicStatus().equals(TopicConstant.DISCUSSING)){ @@ -52,11 +53,11 @@ public class TopicServiceImpl implements TopicService { } }); result.setTopicTotalCount(topicStatus.stream().collect(Collectors.summingInt(TopicStatusResultDTO::getTopicCount))); - } - TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); - if (shiftedCount != null){ - result.setShiftedTotalCount(shiftedCount.getShiftedIssueCount()); - result.setDeadline(shiftedCount.getDeadline()); + TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); + if (shiftedCount != null){ + result.setShiftedTotalCount(shiftedCount.getShiftedIssueCount()); + result.setDeadline(shiftedCount.getDeadline()); + } } return result; } @@ -93,11 +94,13 @@ public class TopicServiceImpl implements TopicService { @Override public List topicSubGrid(TokenDto tokenDto) { String agencyId = this.getLoginUserDetails(tokenDto); + String customerId = tokenDto.getCustomerId(); List result = new ArrayList<>(); + List resultAll = new ArrayList<>(); List subGridIdList = topicDao.getSubGridIdList(agencyId); if (subGridIdList.size() != NumConstant.ZERO){ List gridAllTopicInfoLastDay = topicDao.getGridAllTopicInfoLastDay(); - List gridAllTopicShiftedInfoLastDay = topicDao.getGridAllTopicShiftedInfoLastDay(); + List gridAllTopicShiftedInfoLastDay = topicDao.getGridAllTopicShiftedInfoLastDay(customerId); subGridIdList.forEach(gridId -> { gridAllTopicInfoLastDay.forEach(gridTopic -> { if (gridId.equals(gridTopic.getGridId())){ @@ -110,7 +113,18 @@ public class TopicServiceImpl implements TopicService { } }); }); - return result; + //根据 话题的(讨论中 + 已屏蔽 + 已关闭 + 已转议题)的和,倒序 + Map> collect = result.stream().collect(Collectors.groupingBy(TopicSubGridResultDTO::getGridId)); + Set>> entries = collect.entrySet(); + entries.forEach(entry -> { + List value = entry.getValue(); + Integer sort = value.stream().collect(Collectors.summingInt(TopicSubGridResultDTO::getValue)); + value.forEach(v -> { + v.setSort(sort); + resultAll.add(v); + }); + }); + return resultAll.stream().sorted(Comparator.comparing(TopicSubGridResultDTO::getSort).reversed()).collect(Collectors.toList()); } return new ArrayList<>(); } @@ -123,12 +137,14 @@ public class TopicServiceImpl implements TopicService { @Override public List topicSubAgency(TokenDto tokenDto) { String agencyId = this.getLoginUserDetails(tokenDto); + String customerId = tokenDto.getCustomerId(); List result = new ArrayList<>(); + List resultAll = new ArrayList<>(); List subAgencyIdList = topicDao.getSubAgencyIdList(agencyId); //存在下级机关 if (subAgencyIdList.size() != NumConstant.ZERO){ List allTopicInfoLastDay = topicDao.getAllTopicInfoLastDay(); - List allTopicShiftedInfoLastDay = topicDao.getAllTopicShiftedInfoLastDay(); + List allTopicShiftedInfoLastDay = topicDao.getAllTopicShiftedInfoLastDay(customerId); //话题状态为 已关闭、讨论中、已屏蔽 subAgencyIdList.forEach(agencyIdOne -> { allTopicInfoLastDay.forEach(agency -> { @@ -142,7 +158,18 @@ public class TopicServiceImpl implements TopicService { } }); }); - return result; + //根据 话题的(讨论中 + 已屏蔽 + 已关闭 + 已转议题)的和,倒序 + Map> collect = result.stream().collect(Collectors.groupingBy(TopicSubAgencyResultDTO::getAgencyId)); + Set>> entries = collect.entrySet(); + entries.forEach(entry -> { + List value = entry.getValue(); + Integer sort = value.stream().collect(Collectors.summingInt(TopicSubAgencyResultDTO::getValue)); + value.forEach(v -> { + v.setSort(sort); + resultAll.add(v); + }); + }); + return resultAll.stream().sorted(Comparator.comparing(TopicSubAgencyResultDTO::getSort).reversed()).collect(Collectors.toList()); } //不存在 return new ArrayList<>(); @@ -158,13 +185,17 @@ public class TopicServiceImpl implements TopicService { String agencyId = this.getLoginUserDetails(tokenDto); List topicSummaryInfo = topicDao.topicSummaryInfo(agencyId); TopicShiftedCountResultDTO shiftedCount = topicDao.getShiftedCount(agencyId); - int i = (shiftedCount.getShiftedIssueCount() / topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue))) * NumConstant.ONE_HUNDRED; - String ratio = String.valueOf(i) + TopicConstant.RATIO; - TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); - result.setName(TopicConstant.SHIFTED); - result.setRatio(ratio); - result.setValue(shiftedCount.getShiftedIssueCount()); - topicSummaryInfo.add(result); + if (topicSummaryInfo.size() != NumConstant.ZERO && shiftedCount != null) { + Integer collect = topicSummaryInfo.stream().collect(Collectors.summingInt(TopicSummaryInfoResultDTO::getValue)); + DecimalFormat decimalFormat = new DecimalFormat(".00"); + String ratio; + ratio = collect == NumConstant.ZERO ? NumConstant.ZERO + TopicConstant.RATIO : decimalFormat.format(((float) shiftedCount.getShiftedIssueCount() / (float) collect) * NumConstant.ONE_HUNDRED) + TopicConstant.RATIO; + TopicSummaryInfoResultDTO result = new TopicSummaryInfoResultDTO(); + result.setName(TopicConstant.SHIFTED); + result.setRatio(ratio); + result.setValue(shiftedCount.getShiftedIssueCount()); + topicSummaryInfo.add(result); + } return topicSummaryInfo; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/UserAnalysisService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/UserAnalysisService.java index cdb05ec73b..2c658fc1da 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/UserAnalysisService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/UserAnalysisService.java @@ -5,10 +5,7 @@ import com.epmet.dto.form.user.UserIncrTrendFormDTO; import com.epmet.dto.form.user.UserSubAgencyFormDTO; import com.epmet.dto.form.user.UserSubGridFormDTO; import com.epmet.dto.form.user.UserSummaryInfoFormDTO; -import com.epmet.dto.result.user.UserIncrTrendResultDTO; -import com.epmet.dto.result.user.UserSubAgencyResultDTO; -import com.epmet.dto.result.user.UserSubGridResultDTO; -import com.epmet.dto.result.user.UserSummaryInfoResultDTO; +import com.epmet.dto.result.user.*; import java.util.List; @@ -53,5 +50,24 @@ public interface UserAnalysisService { * @description 按日、按月查询注册用户数(参与用户数)增量折线图 * @Date 2020/6/22 13:42 **/ + @Deprecated List incrTrend(UserIncrTrendFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.user.result.UserIncrTrendResultDTO + * @author yinzuomei + * @description 按日、按月查询注册用户数(参与用户数)增量折线图 + * @Date 2020/6/22 13:42 + **/ + List incrTrendV2(UserIncrTrendFormDTO formDTO); + + /** + * @return com.epmet.dto.result.user.UserAgencyInfoResultDTO + * @param + * @author yinzuomei + * @description 直属机关、部门、网格列表查询 + * @Date 2020/6/29 14:10 + **/ + UserAgencyInfoResultDTO checkSubList(); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java index 655b6febae..8c3f008f55 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.UserAnalysisConstant; import com.epmet.dao.user.UserAnalysisDao; import com.epmet.dto.DimAgencyDTO; +import com.epmet.dto.DimDepartmentDTO; import com.epmet.dto.DimGridDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.user.UserIncrTrendFormDTO; @@ -26,10 +27,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.stream.Collectors; /** * 组织能力用户相关接口 @@ -46,7 +50,6 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private UserAnalysisDao userAnalysisDao; - /** * @return java.lang.String * @param @@ -68,6 +71,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { throw new RenException(UserAnalysisConstant.QUERY_USER_AGENCY_FAILED); } } + logger.info(String.format("用户%s的所属机关id为%s",loginUserDetailsFormDTO.getUserId(),result.getData().getAgencyId())); return result.getData().getAgencyId(); } /** @@ -88,12 +92,21 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { //注册用户 userSummaryInfoResultDTO=userAnalysisDao.selectRegUserSummaryInfo(myAgencyId); } - if(null!=userSummaryInfoResultDTO){ + if (userSummaryInfoResultDTO == null){ + userSummaryInfoResultDTO = new UserSummaryInfoResultDTO(); + + LocalDate yesterday = LocalDate.now().plusDays(NumConstant.MINUS_ONE_L); + DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtils.DATE_PATTERN_YYYYMMDD); + userSummaryInfoResultDTO.setCurrentDate(DateUtils.getxAxisDatePattern(yesterday.format(format),".")); + + return userSummaryInfoResultDTO; + } userSummaryInfoResultDTO.setCurrentDate(DateUtils.getxAxisDatePattern(userSummaryInfoResultDTO.getCurrentDate(),".")); //提取出工具类 - userSummaryInfoResultDTO.setPartymemberProportion(userSummaryInfoResultDTO.getPartymemberProportionValue().stripTrailingZeros().toPlainString()); - userSummaryInfoResultDTO.setWarmHeartedProportion(userSummaryInfoResultDTO.getWarmHeartedProportionValue().stripTrailingZeros().toPlainString()); - } + String partyMemberProStr=userSummaryInfoResultDTO.getPartymemberProportionValue().setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); + userSummaryInfoResultDTO.setPartymemberProportion(partyMemberProStr.concat("%")); + String warmProStr=userSummaryInfoResultDTO.getWarmHeartedProportionValue().setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); + userSummaryInfoResultDTO.setWarmHeartedProportion(warmProStr.concat("%")); logger.info(String.format("查询用户汇总信息返参%s",JSON.toJSONString(userSummaryInfoResultDTO))); return userSummaryInfoResultDTO; } @@ -133,6 +146,15 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { if(dimInitResultDto.getAgencyId().equals(userSubAgencyResDTO.getAgencyId())){ flag=true; //居民、热心居民、党员总数,用于排序 + if(null==userSubAgencyResDTO.getPartymemberTotal()){ + userSubAgencyResDTO.setPartymemberTotal(0); + } + if(null==userSubAgencyResDTO.getWarmHeartedTotal()){ + userSubAgencyResDTO.setWarmHeartedTotal(0); + } + if(null==userSubAgencyResDTO.getResiTotal()){ + userSubAgencyResDTO.setResiTotal(0); + } dimInitResultDto.setTotal(userSubAgencyResDTO.getPartymemberTotal() +userSubAgencyResDTO.getWarmHeartedTotal() +userSubAgencyResDTO.getResiTotal()); @@ -149,16 +171,31 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { default: break; } + logger.info(String.format("找到当前机关(agencyId=%s,agencyName=%s)对应的数据,当前循环",dimInitResultDto.getAgencyId(),dimInitResultDto.getName())); + break; } } if(!flag){ logger.error(String.format("各机关注册用户数缺少记录:date_id=%s,agencyId=%s",formDTO.getDateId(),dimInitResultDto.getAgencyId())); } } + logger.info("排序前"); + for(UserSubAgencyResultDTO m:dimList){ + logger.info("机关名:"+m.getName()+",总数="+m.getTotal()); + } //返回集合按照total降序排序 - List returnList = dimList.stream().sorted(Comparator.comparing(UserSubAgencyResultDTO::getTotal)) - .collect(Collectors.toList()); - return returnList; + Collections.sort(dimList, new Comparator() { + @Override + public int compare(UserSubAgencyResultDTO o1, UserSubAgencyResultDTO o2) { + int i=o2.getTotal()-o1.getTotal();//降序 + return i; + } + }); + logger.info("排序后"); + for(UserSubAgencyResultDTO m:dimList){ + logger.info("机关名:"+m.getName()+",总数="+m.getTotal()); + } + return dimList; } private List initUserSubAgencyResultDTO(String myAgencyId) { @@ -226,6 +263,15 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { if(dimInitResultDto.getGridId().equals(userSubGridResDTO.getGridId())){ flag=true; //居民、热心居民、党员总数,用于排序 + if(null==userSubGridResDTO.getPartymemberTotal()){ + userSubGridResDTO.setPartymemberTotal(0); + } + if(null==userSubGridResDTO.getWarmHeartedTotal()){ + userSubGridResDTO.setWarmHeartedTotal(0); + } + if(null==userSubGridResDTO.getResiTotal()){ + userSubGridResDTO.setResiTotal(0); + } dimInitResultDto.setTotal(userSubGridResDTO.getPartymemberTotal() +userSubGridResDTO.getWarmHeartedTotal() +userSubGridResDTO.getResiTotal()); @@ -243,15 +289,30 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { break; } } + logger.info(String.format("找到当前网格(gridId=%s,gridName=%s)对应的数据,当前循环",dimInitResultDto.getGridId(),dimInitResultDto.getName())); + break; } if(!flag){ logger.error(String.format("直属网格注册用户数缺少记录:date_id=%s,gridId=%s",formDTO.getDateId(),dimInitResultDto.getGridId())); } } + logger.info("排序前"); + for(UserSubGridResultDTO m:dimList){ + logger.info("网格名:"+m.getName()+",总数="+m.getTotal()); + } //返回集合按照total降序排序 - List returnList = dimList.stream().sorted(Comparator.comparing(UserSubGridResultDTO::getTotal)) - .collect(Collectors.toList()); - return returnList; + Collections.sort(dimList, new Comparator() { + @Override + public int compare(UserSubGridResultDTO o1, UserSubGridResultDTO o2) { + int i=o2.getTotal()-o1.getTotal();//降序 + return i; + } + }); + logger.info("排序后"); + for(UserSubGridResultDTO m:dimList){ + logger.info("网格名:"+m.getName()+",总数="+m.getTotal()); + } + return dimList; } private List initUserSubGridResultDTO(String myAgencyId) { @@ -303,16 +364,16 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { return new ArrayList<>(); } List list=new ArrayList<>(); - if (UserAnalysisConstant.REG_FLAG.equals(formDTO.getRegOrPartiFlag()) && UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())) { + if (UserAnalysisConstant.REG_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())) { //注册用户数、日 list=userAnalysisDao.selectRegDayIncr(myAgencyId); - } else if (UserAnalysisConstant.REG_FLAG.equals(formDTO.getRegOrPartiFlag()) && UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())) { + } else if (UserAnalysisConstant.REG_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())) { //注册用户数、月 list=userAnalysisDao.selectRegMonthIncr(myAgencyId); - } else if (UserAnalysisConstant.PARTI_FLAG.equals(formDTO.getRegOrPartiFlag()) && UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())) { + } else if (UserAnalysisConstant.PARTI_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())) { //参与用户数、日 list=userAnalysisDao.selectParticipationUserDayIncr(myAgencyId); - } else if (UserAnalysisConstant.PARTI_FLAG.equals(formDTO.getRegOrPartiFlag()) && UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())) { + } else if (UserAnalysisConstant.PARTI_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())) { //参与用户数、月 list=userAnalysisDao.selectParticipationUserMonthIncr(myAgencyId); } else { @@ -338,7 +399,8 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { default: break; } - + logger.info(String.format("找到当前日期(dateorMonthId=%s)对应的数据,跳出当前循环",dim.getDateOrMonthId())); + break; } } if(!flag){ @@ -348,6 +410,86 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { return dimList; } + @Override + public List incrTrendV2(UserIncrTrendFormDTO formDTO) { + //获取用户所属机关id + String myAgencyId = this.getMyAgency(); + List resultList=new ArrayList<>(); + List list=new ArrayList<>(); + if (UserAnalysisConstant.REG_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())) { + //注册用户数、日 + list=userAnalysisDao.selectRegDayIncr(myAgencyId); + } else if (UserAnalysisConstant.REG_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())) { + //注册用户数、月 + list=userAnalysisDao.selectRegMonthIncr(myAgencyId); + } else if (UserAnalysisConstant.PARTI_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())) { + //参与用户数、日 + list=userAnalysisDao.selectParticipationUserDayIncr(myAgencyId); + } else if (UserAnalysisConstant.PARTI_FLAG.equals(formDTO.getRegOrPatiFlag()) && UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())) { + //参与用户数、月 + list=userAnalysisDao.selectParticipationUserMonthIncr(myAgencyId); + } else { + logger.error("参数错误"); + return new ArrayList<>(); + } + for(UserIncrTrendResDTO userIncrTrendResDTO:list){ + String date=""; + if(UserAnalysisConstant.DAY_TYPE.equals(formDTO.getType())){ + date=DateUtils.getxAxisDatePattern(userIncrTrendResDTO.getDateIdOrMonthId(),"/"); + }else if(UserAnalysisConstant.MONTH_TYPE.equals(formDTO.getType())){ + date=DateUtils.getxAxisDatePattern(userIncrTrendResDTO.getDateIdOrMonthId(),"/"); + } + //居民、热心居民、党员总数,用于排序 + UserIncrTrendResultDTO reg=new UserIncrTrendResultDTO(); + reg.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId()); + reg.setDate(date); + reg.setType(UserAnalysisConstant.REGISTERED_RESI); + reg.setValue(userIncrTrendResDTO.getRegIncr()); + resultList.add(reg); + + UserIncrTrendResultDTO warm=new UserIncrTrendResultDTO(); + warm.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId()); + warm.setDate(date); + warm.setType(UserAnalysisConstant.WARMHEARTED); + warm.setValue(userIncrTrendResDTO.getWarmIncr()); + resultList.add(warm); + + UserIncrTrendResultDTO party=new UserIncrTrendResultDTO(); + party.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId()); + party.setDate(date); + party.setType(UserAnalysisConstant.PARTYMEMBER); + party.setValue(userIncrTrendResDTO.getPartymemberIncr()); + resultList.add(party); + } + return resultList; + } + + @Override + public UserAgencyInfoResultDTO checkSubList() { + //获取用户所属机关id + String myAgencyId = this.getMyAgency(); + UserAgencyInfoResultDTO userAgencyInfoResultDTO=new UserAgencyInfoResultDTO(); + userAgencyInfoResultDTO.setSubAgencyFlag(false); + userAgencyInfoResultDTO.setSubGridFlag(false); + userAgencyInfoResultDTO.setSubDepartmentFlag(false); + List subAgencyList=userAnalysisDao.selectSubAgencyList(myAgencyId); + if(null!=subAgencyList&&subAgencyList.size()>0){ + userAgencyInfoResultDTO.setSubAgencyFlag(true); + } + List subGridList=userAnalysisDao.selectSubGridList(myAgencyId); + if(null!=subGridList&&subGridList.size()>0){ + userAgencyInfoResultDTO.setSubGridFlag(true); + } + List subDepartmentList=userAnalysisDao.selectSubDepartmentList(myAgencyId); + if(null!=subDepartmentList&&subDepartmentList.size()>0){ + userAgencyInfoResultDTO.setSubDepartmentFlag(true); + } + userAgencyInfoResultDTO.setSubAgencyList(subAgencyList); + userAgencyInfoResultDTO.setSubGridList(subGridList); + userAgencyInfoResultDTO.setSubDepartmentList(subDepartmentList); + return userAgencyInfoResultDTO; + } + private List initUserIncrTrendResultDTO(String type) { List list=new ArrayList<>(); if(UserAnalysisConstant.DAY_TYPE.equals(type)){ @@ -379,7 +521,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { } }else if(UserAnalysisConstant.MONTH_TYPE.equals(type)){ List monthList= DateUtils.getMonthBetween(DateUtils.getBeforeNMonth(12), - DateUtils.getBeforeNMonth(1)); + DateUtils.getBeforeNMonth(0)); for(String monthId:monthList){ String date=DateUtils.getxAxisDatePattern(monthId,"/"); //居民 diff --git a/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml b/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml index 347c3c808c..ad10364cb5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml @@ -137,8 +137,13 @@ - - + + + + + + + @@ -151,7 +156,13 @@ - + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml index e2d08c35a2..e374c96d45 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/group/GroupDao.xml @@ -14,6 +14,8 @@ FROM fact_group_agency_daily WHERE del_flag = '0' AND agency_id = #{agencyId} + ORDER BY date_id DESC + LIMIT 1 @@ -26,6 +28,7 @@ WHERE del_flag = '0' AND pid = #{agencyId} + AND agency_dim_type = 'all' @@ -40,8 +43,8 @@ AND da.del_flag = '0' WHERE fgad.del_flag = '0' - GROUP BY fgad.agency_id - ORDER BY fgad.date_id desc + AND fgad.customer_id = #{customerId} + AND fgad.date_id = (SELECT MAX(date_id) FROM fact_group_agency_daily WHERE del_flag = '0') @@ -57,6 +60,8 @@ WHERE fggd.del_flag = '0' AND fggd.agency_id = #{agencyId} + AND fggd.date_id = (SELECT MAX(date_id) FROM fact_group_grid_daily WHERE del_flag = '0') + ORDER BY value DESC @@ -72,6 +77,7 @@ AND agency_id = #{agencyId} ORDER BY date_id DESC + LIMIT 90 @@ -81,12 +87,13 @@ group_incr AS value, '小组数量' AS type FROM - fact_group_agency_daily + fact_group_agency_monthly WHERE del_flag = '0' AND agency_id = #{agencyId} ORDER BY - month_id DESC + month_id DESC, value DESC + LIMIT 12 \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/issue/IssueDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/issue/IssueDao.xml index 19e81a0cb5..49333cc3e4 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/issue/IssueDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/issue/IssueDao.xml @@ -12,12 +12,13 @@ SHIFT_PROJECT_PERCENT, CLOSED_TOTAL, CLOSED_PERCENT, - MAX(DATE_ID) AS DATE_ID, + DATE_ID, DATE_FORMAT(DATE_ID, '%Y.%m.%d') AS DATE_NAME FROM fact_issue_agency_daily fiad WHERE DEL_FLAG = '0' AND AGENCY_ID = #{agencyId} + AND DATE_ID = #{dateId} - SELECT tag_name AS name, agency_id AS agencyId, tag_id AS tagId, - COUNT(tag_read_count) AS value + SUM(tag_read_count) AS value FROM fact_tag_viewed_agency_monthly where agency_id = #{agencyId} AND month_id = #{monthId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} - SELECT tag_name AS name, agency_id AS agencyId, tag_id AS tagId, - COUNT(tag_read_count) AS value + SUM(tag_read_count) AS value FROM fact_tag_viewed_agency_quarterly where agency_id = #{agencyId} AND quarter_id = #{quarterId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} - SELECT tag_name AS name, agency_id AS agencyId, tag_id AS tagId, - COUNT(tag_read_count) AS value + SUM(tag_read_count) AS value FROM fact_tag_viewed_agency_yearly where agency_id = #{agencyId} AND year_id = #{yearId} GROUP BY tag_id - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} - SELECT tag_name AS name, agency_id AS agencyId, tag_id AS tagId, - COUNT(used_count) AS value + SUM(used_count) AS value FROM fact_tag_used_agency_monthly where agency_id = #{agencyId} AND month_id = #{monthId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} - SELECT tag_name AS name, agency_id AS agencyId, tag_id AS tagId, - COUNT(used_count) AS value + SUM(used_count) AS value FROM fact_tag_used_agency_quarterly where agency_id = #{agencyId} AND quarter_id = #{quarterId} GROUP BY TAG_ID - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} - SELECT tag_name AS name, agency_id AS agencyId, tag_id AS tagId, - COUNT(used_count) AS value + SUM(used_count) AS value FROM fact_tag_used_agency_yearly where agency_id = #{agencyId} AND year_id = #{yearId} GROUP BY tag_id - ORDER BY value DESC + ORDER BY value DESC ,tagId ASC LIMIT #{pageSize} @@ -116,8 +116,10 @@ where pub.agency_id = agency.id AND pub.PID =#{agencyId} + AND pub.agency_id not LIKE '%self%' AND pub.month_id=#{monthId} GROUP BY pub.agency_id + ORDER BY value DESC,agencyId ASC @@ -134,8 +136,10 @@ where pub.agency_id = agency.id AND pub.PID =#{agencyId} + AND pub.agency_id not LIKE '%self%' AND pub.quarter_id=#{quarterId} GROUP BY pub.agency_id + ORDER BY value DESC,agencyId ASC @@ -151,8 +155,10 @@ where pub.agency_id = agency.id AND pub.PID =#{agencyId} + AND pub.agency_id not LIKE '%self%' AND pub.year_id=#{yearId} GROUP BY pub.agency_id + ORDER BY value DESC,agencyId ASC @@ -170,6 +176,7 @@ AND pub.agency_id =#{agencyId} AND pub.month_id=#{monthId} GROUP BY pub.department_id + ORDER BY value DESC,departmentId ASC @@ -188,6 +195,7 @@ AND pub.agency_id =#{agencyId} AND pub.quarter_id=#{quarterId} GROUP BY pub.department_id + ORDER BY value DESC,departmentId ASC @@ -205,6 +213,7 @@ AND pub.agency_id =#{agencyId} AND pub.year_id=#{yearId} GROUP BY pub.department_id + ORDER BY value DESC,departmentId ASC @@ -222,6 +231,7 @@ AND pub.agency_id = #{agencyId} AND pub.month_id=#{monthId} GROUP BY pub.grid_id + ORDER BY value DESC,gridId ASC @@ -240,6 +250,7 @@ AND pub.agency_id = #{agencyId} AND pub.quarter_id=#{quarterId} GROUP BY pub.grid_id + ORDER BY value DESC,gridId ASC @@ -257,6 +268,7 @@ AND pub.agency_id = #{agencyId} AND pub.year_id = #{yearId} GROUP BY pub.grid_id + ORDER BY value DESC,gridId ASC \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/topic/TopicDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/topic/TopicDao.xml index 06e60565b6..29ddddc6c6 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/topic/TopicDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/topic/TopicDao.xml @@ -13,10 +13,9 @@ WHERE del_flag = '0' AND agency_id = #{agencyId} - GROUP BY - topic_status_id ORDER BY date_id DESC + LIMIT 3 @@ -42,16 +41,15 @@ WHEN topic_status_id = 'hidden' THEN '已屏蔽' WHEN topic_status_id = 'closed' THEN '已关闭' ELSE '无' END) AS name, - CONCAT(topic_proportion,'%') AS ratio + CONCAT(ROUND(topic_proportion * 100,2),'%') AS ratio FROM fact_topic_status_agency_daily WHERE del_flag = '0' AND agency_id = #{agencyId} - GROUP BY - topic_status_id ORDER BY date_id DESC + LIMIT 3 @@ -63,6 +61,7 @@ WHERE del_flag = '0' AND pid = #{agencyId} + AND agency_dim_type = 'all' @@ -80,10 +79,7 @@ LEFT JOIN dim_agency da ON da.id = ftsad.agency_id AND da.del_flag = '0' WHERE ftsad.del_flag = '0' - GROUP BY - ftsad.topic_status_id - ORDER BY - ftsad.date_id DESC + AND ftsad.date_id = (SELECT MAX(date_id) AS dateId FROM fact_topic_status_agency_daily WHERE del_flag = '0') @@ -98,8 +94,8 @@ LEFT JOIN dim_agency da ON da.id = ftiad.agency_id AND da.del_flag = '0' WHERE ftiad.del_flag = '0' - GROUP BY ftiad.agency_id - ORDER BY ftiad.date_id DESC + AND ftiad.customer_id = #{customerId} + AND ftiad.date_id = (SELECT MAX(date_id) AS dateId FROM fact_topic_issue_agency_daily WHERE del_flag = '0') @@ -128,10 +124,7 @@ LEFT JOIN dim_grid dg ON dg.id = ftsad.grid_id AND dg.del_flag = '0' WHERE ftsad.del_flag = '0' - GROUP BY - ftsad.topic_status_id - ORDER BY - ftsad.date_id DESC + AND ftsad.date_id = (SELECT MAX(date_id) AS dateId FROM fact_topic_status_grid_daily WHERE del_flag = '0') @@ -146,8 +139,8 @@ LEFT JOIN dim_grid da ON da.id = ftiad.grid_id AND da.del_flag = '0' WHERE ftiad.del_flag = '0' - GROUP BY ftiad.grid_id - ORDER BY ftiad.date_id DESC + AND ftiad.customer_id = #{customerId} + AND ftiad.date_id = (SELECT MAX(date_id) AS dateId FROM fact_topic_issue_grid_daily WHERE del_flag = '0') @@ -166,6 +159,7 @@ AND agency_id = #{agencyId} ORDER BY date_id DESC + LIMIT 270 @@ -197,6 +191,7 @@ AND agency_id = #{agencyId} ORDER BY month_id DESC + LIMIT 36 SELECT - m.AGENCY_ID, + DA.ID AS AGENCY_ID, da.AGENCY_NAME, m.REG_TOTAL, M.RESI_TOTAL, M.WARM_HEARTED_TOTAL, M.PARTYMEMBER_TOTAL FROM - fact_participation_user_agency_daily m - LEFT JOIN dim_agency da - ON ( m.AGENCY_ID = da.ID - AND da.PID =#{agencyId} - AND da.DEL_FLAG = '0' ) - WHERE - m.DEL_FLAG = '0' - and m.DATE_ID=#{dateId} + dim_agency da + LEFT JOIN fact_participation_user_agency_daily m + ON ( da.ID=m.AGENCY_ID + and m.DEL_FLAG = '0' + and m.DATE_ID=#{dateId} + ) + WHERE da.DEL_FLAG = '0' + AND da.PID =#{agencyId} + and da.AGENCY_DIM_TYPE='all' order by m.REG_TOTAL desc @@ -147,7 +151,7 @@ AND m.AGENCY_ID = #{agencyId} - + - + - + - + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java index f7eccf24b1..c5bd28f916 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java @@ -29,8 +29,8 @@ public interface GroupConstant { String CITY = "city"; String PROVINCE = "province"; - String ERRORGRIDDAILY = "groupGridDaily ==>【网格小组统计出错了... 维度:网格-日】customerId为:"; + String STATS_FAILED_GRID_DAILY = "统计数据方法groupGridDaily【网格小组统计-网格-日】执行失败,客户ID:%s,统计日期:%s,异常信息:%s"; - String ERRORAGENCYDAILY = "groupAgencyDaily ==>【网格小组统计出错了... 维度:机关-日】customerId为:"; + String STATS_FAILED_AGENCY_DAILY = "统计数据方法groupAgencyDaily【网格小组统计-机关-日】执行失败,客户ID:%s,统计日期:%s,异常信息:%s"; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java index 338b35e1a1..c611d4b97e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IssueConstant.java @@ -21,9 +21,9 @@ public interface IssueConstant { /** *已解决 */ - String RESLOVED = "resloved"; + String RESOLVED = "resolved"; /** *未解决 */ - String UNRESLOVED = "unresloved"; + String UNRESOLVED = "unresolved"; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueAgencyDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueAgencyDailyDTO.java new file mode 100644 index 0000000000..b780a3e50c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueAgencyDailyDTO.java @@ -0,0 +1,121 @@ +/** + * 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.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 转议题话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicIssueAgencyDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 机关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; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicIssueAgencyMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueAgencyMonthlyDTO.java new file mode 100644 index 0000000000..6b3b99d300 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueAgencyMonthlyDTO.java @@ -0,0 +1,111 @@ +/** + * 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.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 转议题话题-机关月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicIssueAgencyMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 父级ID + */ + private String pid; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 已转议题总量 + */ + private Integer issueTotal; + + /** + * 已转议题增量 + */ + private Integer issueIncr; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicIssueGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueGridDailyDTO.java new file mode 100644 index 0000000000..e006c7c688 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueGridDailyDTO.java @@ -0,0 +1,121 @@ +/** + * 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.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 转议题话题-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicIssueGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格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; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicIssueGridMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueGridMonthlyDTO.java new file mode 100644 index 0000000000..e2e373f485 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicIssueGridMonthlyDTO.java @@ -0,0 +1,111 @@ +/** + * 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.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 转议题话题-网格月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicIssueGridMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 已转议题增量 + */ + private Integer issueIncr; + + /** + * 已转议题总量 + */ + private Integer issueTotal; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicStatusAgencyDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicStatusAgencyDailyDTO.java new file mode 100644 index 0000000000..82215ebd12 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicStatusAgencyDailyDTO.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.stats.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 状态话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicStatusAgencyDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关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; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicStatusAgencyMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicStatusAgencyMonthlyDTO.java new file mode 100644 index 0000000000..a89cdf966c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicStatusAgencyMonthlyDTO.java @@ -0,0 +1,127 @@ +/** + * 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.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 状态话题-机关月统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicStatusAgencyMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计月份 关联月度dm表 + */ + private String monthId; + + /** + * 季度ID 关联季度dm表 + */ + private String quarterId; + + /** + * 年ID 关联年度dm表 + */ + private String yearId; + + /** + * 话题状态 讨论中 discussing +已屏蔽 hidden +已关闭 closed +已转项目 shift_project + */ + private String topicStatusId; + + /** + * 话题数量 + */ + private Integer topicCount; + + /** + * 话题状态占比 月末一天 +指定状态话题数/话题总数 +总数在topic_total_agency_daily中 + */ + private BigDecimal topicProportion; + + /** + * 话题增量 单位时间内的话题状态增加数 + */ + private Integer topicIncr; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicStatusGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicStatusGridDailyDTO.java new file mode 100644 index 0000000000..72fa98eb49 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicStatusGridDailyDTO.java @@ -0,0 +1,136 @@ +/** + * 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.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 状态话题-网格日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicStatusGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格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; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicTotalAgencyDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicTotalAgencyDailyDTO.java new file mode 100644 index 0000000000..fd06f45244 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicTotalAgencyDailyDTO.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.dto.stats.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 话题总数-机关日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicTotalAgencyDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关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; + + /** + * 话题增量 + */ + private Integer topicIncr; + + /** + * 屏蔽话题数 + */ + private Integer hiddenTotalCount; + + /** + * 已转议题数 + */ + private Integer issueTotalCount; + + /** + * 删除标识 + */ + 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/stats/topic/FactTopicTotalGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicTotalGridDailyDTO.java new file mode 100644 index 0000000000..343feb0c92 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicTotalGridDailyDTO.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.dto.stats.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 话题总数-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +public class FactTopicTotalGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题总量 + */ + private Integer topicTotal; + + /** + * 话题增量 + */ + private Integer topicIncr; + + /** + * 屏蔽话题数量 + */ + private Integer hiddenTotalCount; + + /** + * 已转议题数量 + */ + private Integer issueTotalCount; + + /** + * 删除标识 + */ + 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/stats/topic/result/GridTopicData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/GridTopicData.java new file mode 100644 index 0000000000..bbbc9d327f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/GridTopicData.java @@ -0,0 +1,38 @@ +package com.epmet.dto.stats.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName GridTopicData + * @Auth wangc + * @Date 2020-06-22 17:31 + */ +@Data +public class GridTopicData implements Serializable { + private static final long serialVersionUID = -7427128491727512781L; + + private String gridId; + + private Integer topicIncr = 0; + + private Integer discussingIncr = 0; + + private Integer hiddenIncr = 0; + + private Integer closedIncr = 0; + + private Integer total = 0; + + private Integer discussingTotal = 0; + + private Integer hiddenTotal = 0; + + private Integer closedTotal = 0; + + private Integer issueIncr = 0; + + private Integer issueTotal = 0; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/GroupTopicData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/GroupTopicData.java new file mode 100644 index 0000000000..9da8d5a4ea --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/GroupTopicData.java @@ -0,0 +1,38 @@ +package com.epmet.dto.stats.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName GroupTopicData + * @Auth wangc + * @Date 2020-06-22 15:29 + */ +@Data +public class GroupTopicData implements Serializable { + private static final long serialVersionUID = -7968684838832002029L; + + private String groupId; + + private Integer topicIncr = 0; + + private Integer discussingIncr = 0; + + private Integer hiddenIncr = 0; + + private Integer closedIncr = 0; + + private Integer total = 0; + + private Integer discussingTotal = 0; + + private Integer hiddenTotal = 0; + + private Integer closedTotal = 0; + + private Integer issueIncr = 0; + + private Integer issueTotal = 0; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/TopicStatisticalData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/TopicStatisticalData.java new file mode 100644 index 0000000000..a5fa7f5279 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/TopicStatisticalData.java @@ -0,0 +1,43 @@ +package com.epmet.dto.stats.topic.result; + +import com.epmet.dto.stats.topic.*; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 话题统计数据对象 + * @ClassName TopicStatisticalDataResultDTO + * @Auth wangc + * @Date 2020-06-22 13:16 + */ +@Data +public class TopicStatisticalData implements Serializable { + private static final long serialVersionUID = 3690257892396607149L; + + private List issueAgencyDailyList ; + + private List issueAgencyMonthlyList ; + + private List issueGridDailyList ; + + private List issueGridMonthlyList ; + + private List topicAgencyDailyList ; + + private List topicAgencyMonthlyList ; + + private List topicGridDailyList; + + private List totalAgencyDailyList; + + private List totalGridDailyList; + + private String dateId; + + private String monthId; + + private String customerId; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/FactParticipationUserGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/FactParticipationUserGridDailyDTO.java index 63d34f3139..a0d86d6164 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/FactParticipationUserGridDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/FactParticipationUserGridDailyDTO.java @@ -59,6 +59,7 @@ public class FactParticipationUserGridDailyDTO implements Serializable { */ private String dateId; + /** * */ diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java new file mode 100644 index 0000000000..e50824d0cb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java @@ -0,0 +1,41 @@ +package com.epmet.dto.stats.user.result; + + +import com.epmet.dto.stats.user.*; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 用户统计数据对象 + * @ClassName UserStatisticalData + * @Auth wangc + * @Date 2020-06-19 15:02 + */ +@Data +public class UserStatisticalData implements Serializable { + private static final long serialVersionUID = 7423427555123585566L; + + private List partiAgencyDailyList; + + private List partiGridDailyList; + + private List partiAgencyMonthlyList; + + private List partiGridMonthlyList; + + private List regAgencyDailyList; + + private List regGridDailyList; + + private List regAgencyMonthlyList; + + private List regGridMonthlyList; + + private String customerId; + + private String dateId; + + private String monthId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiGroupTopicResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiGroupTopicResultDTO.java new file mode 100644 index 0000000000..33557cd396 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiGroupTopicResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 组-话题对象 + * @ClassName ResiGroupTopicResultDTO + * @Auth wangc + * @Date 2020-06-20 17:23 + */ +@Data +public class ResiGroupTopicResultDTO implements Serializable { + private static final long serialVersionUID = -6243796311184636458L; + + private String gridId; + + private String groupId; + + private String groupName; + + private String customerId; + + private List topics; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiTopicOperationResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiTopicOperationResultDTO.java new file mode 100644 index 0000000000..cd114f3ceb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiTopicOperationResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 话题操作记录DTO + * @ClassName ResiTopicOperationResultDTO + * @Auth wangc + * @Date 2020-06-22 10:58 + */ +@Data +public class ResiTopicOperationResultDTO implements Serializable { + private static final long serialVersionUID = -7811429974017636134L; + + /** + * 话题Id + * */ + private String topicId; + + /** + * 操作状态 + * */ + private String status; + + /** + * 操作时间 yyyy-MM-dd + * */ + private String createdTime; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiTopicResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiTopicResultDTO.java new file mode 100644 index 0000000000..e5bfffdc2d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/result/ResiTopicResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 话题对象 + * @ClassName ResiTopicResultDTO + * @Auth wangc + * @Date 2020-06-20 17:22 + */ +@Data +public class ResiTopicResultDTO implements Serializable { + private static final long serialVersionUID = 6818736495648532514L; + + private String topicId; + + private String status; + + private boolean shiftIssue; + + private String incrFlag; +} 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 3f1c24b472..dffd25d035 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 @@ -5,6 +5,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Date; /** * desc: 数据统计 对外feign client @@ -13,7 +16,8 @@ import org.springframework.web.bind.annotation.PostMapping; * @date: 2020/6/22 17:39 * @author: jianjun liu */ -@FeignClient(name = ServiceConstant.DATA_STATISTICAL, fallback = DataStatisticalOpenFeignClientFallBack.class) +//url="http://localhost:8108" +@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class) public interface DataStatisticalOpenFeignClient { /** @@ -128,4 +132,32 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/statsproject/gridprojectstats") Result gridProjectStats(); + /** + * 初始化所有维度 + * + * @return + */ + @PostMapping("/data/stats/dim/all/init") + Result initAllDims(); + + /** + * @Description 执行用户统计 + * @param + * @return + * @author wangc + * @date 2020.06.29 09:26 + **/ + @PostMapping("/data/stats/statsuser/execute") + Result execUserStatistical(@RequestParam(value = "date",required = false) String date); + + /** + * @Description 执行话题统计 + * @param + * @return + * @author wangc + * @date 2020.06.29 09:27 + **/ + @PostMapping("/data/stats/statstopic/execute") + Result execTopicStatistical(@RequestParam(value = "date",required = false) String date); + } 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 d7e486b79a..a15b468fdc 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 @@ -6,6 +6,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.feign.DataStatisticalOpenFeignClient; import org.springframework.stereotype.Component; + +import java.util.Date; + /** * desc: * @@ -25,7 +28,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result articleSummaryDailyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "articleSummaryDailyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "articleSummaryDailyStatsjob"); } /** @@ -37,7 +40,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result tagUsedDailyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagUsedDailyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagUsedDailyStatsjob"); } /** @@ -48,7 +51,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result tagUsedMonthlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagUsedMonthlyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagUsedMonthlyStatsjob"); } /** @@ -59,7 +62,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result tagUsedQuarterlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagUsedQuarterlyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagUsedQuarterlyStatsjob"); } /** @@ -70,7 +73,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result tagViewedDailyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagViewedDailyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagViewedDailyStatsjob"); } /** @@ -81,7 +84,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result tagViewedMonthlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagViewedMonthlyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagViewedMonthlyStatsjob"); } /** @@ -92,27 +95,27 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result tagViewedQuarterlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagViewedQuarterlyStatsjob"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagViewedQuarterlyStatsjob"); } @Override public Result groupGridDaily() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupGridDaily"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupGridDaily"); } @Override public Result groupAgencyDaily() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupAgencyDaily"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAgencyDaily"); } @Override public Result groupAgencyMonthly() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupAgencyMonthly"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAgencyMonthly"); } @Override public Result agencyGridIssueStats() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "agencyGridIssueStats"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "agencyGridIssueStats"); } /** @@ -121,7 +124,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result agencyProjectStats() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "agencyProjectStats"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "agencyProjectStats"); } /** @@ -130,6 +133,35 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp */ @Override public Result gridProjectStats() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "gridProjectStats"); + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "gridProjectStats"); + } + + @Override + public Result initAllDims() { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "initAllDims"); + } + + /** + * @Description 执行用户统计 + * @param + * @return + * @author wangc + * @date 2020.06.29 09:26 + **/ + @Override + public Result execUserStatistical(String date) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execUserStatistical",date); + } + + /** + * @Description 执行话题统计 + * @param + * @return + * @author wangc + * @date 2020.06.29 09:27 + **/ + @Override + public Result execTopicStatistical(String date) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execTopicStatistical",date); } } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/feign/DataStatisticalOpenFeignClient.java deleted file mode 100644 index 6cf5341890..0000000000 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/feign/DataStatisticalOpenFeignClient.java +++ /dev/null @@ -1,131 +0,0 @@ -package feign; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.Result; -import feign.impl.DataStatisticalOpenFeignClientFallBack; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; - -/** - * desc: 数据统计 对外feign client - * - * @return: - * @date: 2020/6/22 17:39 - * @author: jianjun liu - */ -@FeignClient(name = ServiceConstant.DATA_STATISTICAL, fallback = DataStatisticalOpenFeignClientFallBack.class) -public interface DataStatisticalOpenFeignClient { - - /** - * desc: 【日】统计文章总数及在线文章总数 包含 机关 部门 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/articleSummaryDailyStatsjob") - Result articleSummaryDailyStatsjob(); - - /** - * desc: 定时任务 【日】统计文章总数及在线文章总数 包含 机关 部门 网格 - * - * @return: - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/tagUsedDailyStatsjob") - Result tagUsedDailyStatsjob(); - - /** - * desc: 【月】 统计发表文章最多的分类 包含 机关 部门 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/tagUsedMonthlyStatsjob") - Result tagUsedMonthlyStatsjob(); - - /** - * desc: 【季,年】 统计发表文章最多的分类 包含 机关 部门 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/tagUsedQuarterlyStatsjob") - Result tagUsedQuarterlyStatsjob(); - - /** - * desc: 【日】 统计阅读最多的标签 包含 机关 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/tagViewedDailyStatsjob") - Result tagViewedDailyStatsjob(); - - /** - * desc: 【月】 统计阅读最多的标签 包含 机关 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/tagViewedMonthlyStatsjob") - Result tagViewedMonthlyStatsjob(); - - /** - * desc: 【季,年】 统计阅读最多的标签 包含 机关 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @PostMapping(value = "data/stats/statspublicity/tagViewedQuarterlyStatsjob") - Result tagViewedQuarterlyStatsjob(); - - /** - * @Description 统计 “网格小组”, dim:【网格-日】 - * @param - * @author zxc - */ - @PostMapping("/data/stats/statsgroup/groupgriddaily") - Result groupGridDaily(); - - /** - * @Description 统计 “网格小组”, dim:【机关-日】 - * @param - * @author zxc - */ - @PostMapping("/data/stats/statsgroup/groupagencydaily") - Result groupAgencyDaily(); - - /** - * @Description 统计 “网格小组”, dim:【机关-月】 - * @param - * @author zxc - */ - @PostMapping("/data/stats/statsgroup/groupagencymonthly") - Result groupAgencyMonthly(); - - /** - * 议题统计 - * @author zhaoqifeng - * @date 2020/6/23 14:34 - * @param - * @return com.epmet.commons.tools.utils.Result - */ - @PostMapping("/data/stats/statsissue/issuestats") - Result agencyGridIssueStats(); - - /** - * @Description 数据统计-项目-机关日月统计 - * @Author sun - */ - @PostMapping("/data/stats/statsproject/agencyprojectstats") - Result agencyProjectStats(); - - /** - * @Description 数据统计-项目-网格日月统计 - * @Author sun - */ - @PostMapping("/data/stats/statsproject/gridprojectstats") - Result gridProjectStats(); - -} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/feign/impl/DataStatisticalOpenFeignClientFallBack.java deleted file mode 100644 index cdaa4546ce..0000000000 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ /dev/null @@ -1,135 +0,0 @@ -package feign.impl; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import feign.DataStatisticalOpenFeignClient; -import org.springframework.stereotype.Component; - -/** - * desc: - * - * @return: - * @date: 2020/6/22 9:38 - * @author: jianjun liu - * email:liujianjun@git.elinkit.com.cn - */ -@Component -public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOpenFeignClient { - - /** - * desc: 【日】统计文章总数及在线文章总数 包含 机关 部门 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result articleSummaryDailyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "articleSummaryDailyStatsjob"); - } - - /** - * desc: 定时任务 【日】统计文章总数及在线文章总数 包含 机关 部门 网格 - * - * @return: - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result tagUsedDailyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagUsedDailyStatsjob"); - } - - /** - * desc: 【月】 统计发表文章最多的分类 包含 机关 部门 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result tagUsedMonthlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagUsedMonthlyStatsjob"); - } - - /** - * desc: 【季,年】 统计发表文章最多的分类 包含 机关 部门 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result tagUsedQuarterlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagUsedQuarterlyStatsjob"); - } - - /** - * desc: 【日】 统计阅读最多的标签 包含 机关 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result tagViewedDailyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagViewedDailyStatsjob"); - } - - /** - * desc: 【月】 统计阅读最多的标签 包含 机关 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result tagViewedMonthlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagViewedMonthlyStatsjob"); - } - - /** - * desc: 【季,年】 统计阅读最多的标签 包含 机关 网格 - * - * @date: 2020/6/22 9:09 - * @author: jianjun liu - */ - @Override - public Result tagViewedQuarterlyStatsjob() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "tagViewedQuarterlyStatsjob"); - } - - @Override - public Result groupGridDaily() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupGridDaily"); - } - - @Override - public Result groupAgencyDaily() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupAgencyDaily"); - } - - @Override - public Result groupAgencyMonthly() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "groupAgencyMonthly"); - } - - @Override - public Result agencyGridIssueStats() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "agencyGridIssueStats"); - } - - /** - * @Description 数据统计-项目-机关日月统计 - * @Author sun - */ - @Override - public Result agencyProjectStats() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "agencyProjectStats"); - } - - /** - * @Description 数据统计-项目-网格日月统计 - * @Author sun - */ - @Override - public Result gridProjectStats() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL, "gridProjectStats"); - } -} diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index f49b9ac74d..934f89d9e9 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.2 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.18 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml index 4bbbf5cafb..5762e78185 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.2 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.18 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 45ed52b3f8..9c48019641 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.2 + 0.3.18 data-statistical com.epmet @@ -206,35 +206,23 @@ elink@833066 - + - epmet - elink@833066 + epmet_gov_project_user + EpmEt-db-UsEr - + epmet elink@8473066 - + epmet elink@8473066 - - - - epmet - elink@8473066 - - - - - epmet - elink@8473066 - 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java index 7da757a418..ad4e2110fa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java @@ -3,8 +3,10 @@ package com.epmet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication (exclude = {DataSourceAutoConfiguration.class}) +@EnableAsync public class DataStatsApplication { public static void main(String[] args) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java index 96461ec01a..cf30b35552 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -43,4 +43,14 @@ public interface ProjectConstant { */ String PUBLISHER_TYPE_GRID = "grid"; + /** + * 执行失败钉钉消息模版 + */ + String EXE_FAILED_MSG = "统计数据方法【%s】执行失败,客户ID:%s,统计日期:%s,异常信息:%s"; + + /** + * 统计数据执行失败日志前缀 + */ + String STATS_FAILED_PREFIX = "统计数据执行失败:%s 客户ID:%s,统计日期:%s,异常信息:%s"; + } 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 2f6e7ac226..5f562630dc 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 @@ -2,20 +2,21 @@ package com.epmet.controller; import com.epmet.dto.AgencySubTreeDto; import com.epmet.service.StatsDemoService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.time.LocalDateTime; +import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import java.util.List; - @RequestMapping("demo") @RestController +@Slf4j public class DemoController { @Autowired @@ -24,6 +25,13 @@ public class DemoController { @Autowired private ExecutorService executorService; + @GetMapping("testAlarm") + public void testAlarm() { + for (int i = 0; i < 20; i++) { + log.error("测试消息"+i); + } + } + @GetMapping("testtx") public void testTx() { demoService.testTx(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java index 2d0cd77530..3318ef39a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -1,6 +1,5 @@ package com.epmet.controller; -import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.AgencySubDeptTreeDto; import com.epmet.dto.AgencySubTreeDto; @@ -9,10 +8,7 @@ import com.epmet.service.stats.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -49,69 +45,60 @@ public class DimController { * @return */ @PostMapping("/all/init") - public Result initAll() { + public Result initAllDims() { try { dimDateService.initDimDate(); logger.info("初始化按日维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化按日维度失败:%s", errorStackTrace)); + logger.error("初始化按日维度失败:", e); } try { statsDimService.initGridDim(); logger.info("初始化网格维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化网格维度失败:%s", errorStackTrace)); + logger.error("初始化网格维度失败:", e); } try { statsDimService.initAgencyDim(); logger.info("初始化机关维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化机关维度失败:%s", errorStackTrace)); + logger.error("初始化机关维度失败:", e); } try { statsDimService.initCustomerDim(); logger.info("初始化客户维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化客户维度失败:%s", errorStackTrace)); + logger.error("初始化客户维度失败:", e); } try { statsDimService.initDepartmentDim(); logger.info("初始化部门维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化部门维度失败:%s", errorStackTrace)); + logger.error("初始化部门维度失败:", e); } try { dimMonthService.initMonthDim(); logger.info("初始化按月维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化按月维度失败:%s", errorStackTrace)); + logger.error("初始化按月维度失败:", e); } try { quarterService.initQuarterDim(); logger.info("初始化季度维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化季度维度失败:%s", errorStackTrace)); + logger.error("初始化季度维度失败:", e); } try { dimYearService.initYearDim(); logger.info("初始化年度维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化年度维度失败:%s", errorStackTrace)); + logger.error("初始化年度维度失败:", e); } try { dimWeekService.initWeekDim(); logger.info("初始化按周维度成功"); } catch (Exception e) { - String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error(String.format("初始化按周维度失败:%s", errorStackTrace)); + logger.error("初始化按周维度失败:", e); } return new Result(); } @@ -223,8 +210,8 @@ public class DimController { * @date 2020.06.18 10:34 **/ @GetMapping("allagency") - public List allAgency() { - return dimAgencyService.getAllAgency(); + public List allAgency(@PathVariable String customerId) { + return dimAgencyService.getAllAgency(customerId); } /** @@ -235,8 +222,8 @@ public class DimController { * @date 2020.06.18 10:34 **/ @GetMapping("topagency") - public List topAgency() { - return dimAgencyService.getTopAgency(); + public List topAgency(@PathVariable String customerId) { + return dimAgencyService.getTopAgency(customerId); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java index 850c3b7a75..b78ca89680 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java @@ -1,12 +1,17 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.service.StatsIssueService; +import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.io.Serializable; + /** * @author zhaoqifeng * @dscription @@ -30,4 +35,14 @@ public class StatsIssueController { statsIssueService.agencyGridIssueStats(); return new Result(); } + @Data + private static class StatsDate implements Serializable { + private static final long serialVersionUID = 149723067011918433L; + private String date; + } + @PostMapping("date") + public Result agencyGridIssueStatsOfDate(@RequestBody StatsDate statsDate) { + statsIssueService.agencyGridIssueStatsOfDate(DateUtils.parse(statsDate.getDate(), DateUtils.DATE_PATTERN)); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java new file mode 100644 index 0000000000..b2eb12c054 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java @@ -0,0 +1,31 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsTopicService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; + +/** + * @Description + * @ClassName StatsTopicController + * @Auth wangc + * @Date 2020-06-23 15:19 + */ +@RestController +@RequestMapping("statstopic") +public class StatsTopicController { + + @Autowired + private StatsTopicService statsTopicService; + + @PostMapping("execute") + public Result execute(@RequestParam(value = "date",required = false) Date date){ + statsTopicService.partition(date); + 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 new file mode 100644 index 0000000000..dd4a29fb9d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java @@ -0,0 +1,31 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; + +/** + * @Description 用户统计 + * @ClassName StatsUserController + * @Auth wangc + * @Date 2020-06-23 15:18 + */ +@RestController +@RequestMapping("statsuser") +public class StatsUserController { + + @Autowired + private StatsUserService statsUserService; + + @RequestMapping("execute") + public Result execute(@RequestParam(value = "date",required = false) Date date){ + statsUserService.partition(date); + return new Result(); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java index 28703e70e9..db1bc08318 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java @@ -50,21 +50,21 @@ public interface GroupDataDao { * @param * @author zxc */ - List getAgencyGroupTotalCount(@Param("allGrid") List allGrid,@Param("dateId")String dateId); + List getAgencyGroupTotalCount(@Param("customerId") String customerId,@Param("dateId")String dateId); /** * @Description 查询机关下网格内的小组人数 【待优化】 * @param * @author zxc */ - List selectAgencyGridGroupPeopleTotal(@Param("allGrid") List allGrid,@Param("dateId")String dateId); + List selectAgencyGridGroupPeopleTotal(@Param("customerId") String customerId,@Param("dateId")String dateId); /** * @Description 查询机关下每个小组的人数 【待优化】 * @param * @author zxc */ - List selectAgencyEveryGroupPeopleCount(@Param("allGrid") List allGrid,@Param("dateId")String dateId); + List selectAgencyEveryGroupPeopleCount(@Param("customerId") String customerId,@Param("dateId")String dateId); /** * @Description 查询机关下的小组日增数 【待优化】 @@ -72,7 +72,7 @@ public interface GroupDataDao { * @param dateId * @author zxc */ - List selectAgencyGroupIncr(@Param("allGrid") List allGrid,@Param("dateId")String dateId); + List selectAgencyGroupIncr(@Param("customerId") String customerId,@Param("dateId")String dateId); /** * @Description 查询机关下所有网格小组人数 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 98d2e0e96d..87cd7c6879 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 @@ -18,11 +18,12 @@ public interface StatsIssueDao extends BaseDao { * 获取当前日期组织下议题统计结果 * * @param customerId + * @param date * @return java.util.List * @author zhaoqifeng * @date 2020/6/17 14:13 */ - List selectAgencyIssueTotal(@Param("customerId") String customerId); + List selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date); /** * 获取当前日期组织下议题增量 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java index 3c70225c26..7ed92bc461 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java @@ -55,7 +55,7 @@ public interface DimAgencyDao extends BaseDao { * @author wangc * @date 2020.06.18 09:26 **/ - List selectAllAgency(); + List selectAllAgency(@Param("customerId") String customerId); /** * @param pid @@ -73,7 +73,7 @@ public interface DimAgencyDao extends BaseDao { * @author wangc * @date 2020.06.18 09:26 **/ - List selectTopAgency(); + List selectTopAgency(@Param("customerId")String customerId); /** * desc:根据客户id 获取机关列表 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueAgencyDailyDao.java new file mode 100644 index 0000000000..5089e9b642 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueAgencyDailyDao.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.dao.stats.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicIssueAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueAgencyDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 转议题话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicIssueAgencyDailyDao extends BaseDao { + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/topic/FactTopicIssueAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueAgencyMonthlyDao.java new file mode 100644 index 0000000000..08ad42c187 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueAgencyMonthlyDao.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.dao.stats.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicIssueAgencyMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueAgencyMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 转议题话题-机关月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicIssueAgencyMonthlyDao extends BaseDao { + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/stats/topic/FactTopicIssueGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueGridDailyDao.java new file mode 100644 index 0000000000..bfb369626f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueGridDailyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicIssueGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueGridDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 转议题话题-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicIssueGridDailyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/topic/FactTopicIssueGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueGridMonthlyDao.java new file mode 100644 index 0000000000..8f819b001b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicIssueGridMonthlyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicIssueGridMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueGridMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 转议题话题-网格月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicIssueGridMonthlyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/stats/topic/FactTopicStatusAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicStatusAgencyDailyDao.java new file mode 100644 index 0000000000..218b21cd52 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicStatusAgencyDailyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicStatusAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusAgencyDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 状态话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicStatusAgencyDailyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/topic/FactTopicStatusAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicStatusAgencyMonthlyDao.java new file mode 100644 index 0000000000..742d92bd65 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicStatusAgencyMonthlyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicStatusAgencyMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusAgencyMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 状态话题-机关月统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicStatusAgencyMonthlyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/stats/topic/FactTopicStatusGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicStatusGridDailyDao.java new file mode 100644 index 0000000000..666a54f995 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicStatusGridDailyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicStatusGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusGridDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 状态话题-网格日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicStatusGridDailyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/topic/FactTopicTotalAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicTotalAgencyDailyDao.java new file mode 100644 index 0000000000..445aa9a30f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicTotalAgencyDailyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicTotalAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicTotalAgencyDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 话题总数-机关日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicTotalAgencyDailyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/topic/FactTopicTotalGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicTotalGridDailyDao.java new file mode 100644 index 0000000000..7276945b90 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/topic/FactTopicTotalGridDailyDao.java @@ -0,0 +1,39 @@ +/** + * 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.topic; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.topic.FactTopicTotalGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicTotalGridDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 话题总数-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Mapper +public interface FactTopicTotalGridDailyDao extends BaseDao { + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/user/FactParticipationUserAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java index 463dbca50d..4a5b254b8f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyDailyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactParticipationUserAgencyDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserAgencyDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 机关下(按日)参与用户数分析 @@ -29,5 +33,9 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactParticipationUserAgencyDailyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/user/FactParticipationUserAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyMonthlyDao.java index d303685b38..d52897c4b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserAgencyMonthlyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactParticipationUserAgencyMonthlyDTO; import com.epmet.entity.stats.user.FactParticipationUserAgencyMonthlyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 机关下(按月)参与用户数分析 @@ -29,5 +33,9 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactParticipationUserAgencyMonthlyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/stats/user/FactParticipationUserGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java index 18593b3807..d39a6088e1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactParticipationUserGridDailyDTO; import com.epmet.entity.stats.user.FactParticipationUserGridDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 网格下(按日)参与用户数分析 @@ -29,5 +33,9 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactParticipationUserGridDailyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/user/FactParticipationUserGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridMonthlyDao.java index 81fd930f20..b67adec9dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridMonthlyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactParticipationUserGridMonthlyDTO; import com.epmet.entity.stats.user.FactParticipationUserGridMonthlyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 网格下(月)参与用户数分析 @@ -29,5 +33,8 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactParticipationUserGridMonthlyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/stats/user/FactRegUserAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyDailyDao.java index d4fb9b5fe5..e22a094565 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyDailyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactRegUserAgencyDailyDTO; import com.epmet.entity.stats.user.FactRegUserAgencyDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 机关(按日)注册用户数分析 @@ -29,5 +33,9 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactRegUserAgencyDailyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/user/FactRegUserAgencyMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java index 4ed08b1f00..e59f48e8c5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserAgencyMonthlyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; import com.epmet.entity.stats.user.FactRegUserAgencyMonthlyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 机关(按月)注册用户数分析 @@ -29,5 +33,8 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactRegUserAgencyMonthlyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/stats/user/FactRegUserGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java index 944732d786..f06c4c1179 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactRegUserGridDailyDTO; import com.epmet.entity.stats.user.FactRegUserGridDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 网格(按日)注册用户数分析 @@ -29,5 +33,9 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactRegUserGridDailyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("dateId")String dateId,@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/stats/user/FactRegUserGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java index df808eb3be..940609d9bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridMonthlyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.user.FactRegUserGridMonthlyDTO; import com.epmet.entity.stats.user.FactRegUserGridMonthlyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 网格(月)注册用户数分析 @@ -29,5 +33,9 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactRegUserGridMonthlyDao extends BaseDao { - + + void insertBatch(@Param("list") List list); + + void deleteByParams(@Param("monthId")String monthId,@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/topic/TopicDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java new file mode 100644 index 0000000000..9244b799b1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java @@ -0,0 +1,59 @@ +package com.epmet.dao.topic; + +/** + * 话题Dao ResiGroup + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-11 + */ + +import com.epmet.dto.topic.result.ResiGroupTopicResultDTO; +import com.epmet.dto.topic.result.ResiTopicOperationResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +@Mapper +public interface TopicDao { + + /** + * @Description 将组按照网格Id排序 + * @param targetDate + * @param customerId + * @return List + * @author wangc + * @date 2020.06.22 11:05 + **/ + List selectGroupOrderByGrid(@Param("targetDate")Date targetDate, @Param("customerId")String customerId); + + /** + * @Description 查询话题的操作记录,如果返回结果中没有对应Id的话题说明当日话题没有操作记录 + * @param targetDate + * @return List + * @author wangc + * @date 2020.06.22 11:07 + **/ + List selectTopicOperationRecord(@Param("targetDate")Date targetDate); + + + /** + * @Description 将组按照网格Id排序 + * @param + * @param customerId + * @return List + * @author wangc + * @date 2020.06.22 11:05 + **/ + List selectGroupOrderByGridBetweenTimeRange(@Param("startDate")Date startDate, @Param("endDate")Date endDate, @Param("customerId")String customerId); + + /** + * @Description 查询话题的操作记录,如果返回结果中没有对应Id的话题说明当日话题没有操作记录 + * @param + * @return List + * @author wangc + * @date 2020.06.22 11:07 + **/ + List selectTopicOperationRecordBetweenTimeRange(@Param("startDate")Date startDate, @Param("endDate")Date endDate); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java similarity index 53% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java index f8ff0e359b..15d8f18cbf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/ArticlePublishRangeDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/voice/TagCustomerDao.java @@ -18,39 +18,25 @@ package com.epmet.dao.voice; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO; -import com.epmet.entity.voice.ArticlePublishRangeEntity; +import com.epmet.entity.voice.TagCustomerEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.Date; import java.util.List; /** - * 文章发布范围表 + * 客户标签表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-06-17 + * @since v1.0.0 2020-06-02 */ @Mapper -public interface ArticlePublishRangeDao extends BaseDao { - +public interface TagCustomerDao extends BaseDao { /** - * desc:查询网格发布文章总数及状态为发布中的文章总数 + * desc:获取需要初始化的客户标签 * * @param customerId - * @param createDate * @return */ - List getAllPublishedCount(@Param("customerId") String customerId, @Param("createDate") Date createDate); - - /** - * desc: 根据客户Id、创建日期查询某一天的 文章发布数据 - * - * @param customerId - * @param startDate - * @param endDate - * @return: List - */ - List getOneDayPublishedCount(@Param("customerId") String customerId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + List getTagDefaultList(@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/entity/stats/topic/FactTopicIssueAgencyDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueAgencyDailyEntity.java new file mode 100644 index 0000000000..b8118c7dd1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueAgencyDailyEntity.java @@ -0,0 +1,91 @@ +/** + * 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.stats.topic; + +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 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_issue_agency_daily") +public class FactTopicIssueAgencyDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 日期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-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueAgencyMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueAgencyMonthlyEntity.java new file mode 100644 index 0000000000..5f782d0779 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueAgencyMonthlyEntity.java @@ -0,0 +1,81 @@ +/** + * 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.stats.topic; + +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 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_issue_agency_monthly") +public class FactTopicIssueAgencyMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 父级ID + */ + private String pid; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 月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-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueGridDailyEntity.java similarity index 68% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueGridDailyEntity.java index 1aac103337..90ecdb3b42 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/ArticlePublishRangeEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueGridDailyEntity.java @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -package com.epmet.entity.voice; +package com.epmet.entity.stats.topic; import com.baomidou.mybatisplus.annotation.TableName; + import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -25,61 +26,66 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 文章发布范围表 + * 转议题话题-网格日统计表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-06-17 + * @since v1.0.0 2020-06-20 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("article_publish_range") -public class ArticlePublishRangeEntity extends BaseEpmetEntity { +@TableName("fact_topic_issue_grid_daily") +public class FactTopicIssueGridDailyEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** - * 客户ID + * 机关ID */ + private String agencyId; + + /** + * 客户Id + * */ private String customerId; /** - * 文章ID + * 网格ID */ - private String articleId; + private String gridId; /** - * 网格ID + * 日期ID */ - private String gridId; + private String dateId; /** - * 组织-网格名称 + * 周ID */ - private String agencyGridName; + private String weekId; /** - * 组织ID + * 月ID */ - private String agencyId; + private String monthId; /** - * 所有上级组织机构ID 以英文:隔开 + * 季度ID */ - private String pids; + private String quarterId; /** - * 所有上级名称 以横杠隔开 + * 年ID */ - private String allParentName; + private String yearId; /** - * 下线时间 + * 新增转议题数 */ - private Date offLineTime; + private Integer issueIncr; /** - * 发布状态 已发布:published;已下线:offline + * 转议题总数 */ - private String publishStatus; + private Integer issueTotal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueGridMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueGridMonthlyEntity.java new file mode 100644 index 0000000000..ff1a767364 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicIssueGridMonthlyEntity.java @@ -0,0 +1,81 @@ +/** + * 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.stats.topic; + +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 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_issue_grid_monthly") +public class FactTopicIssueGridMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 月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-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusAgencyDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusAgencyDailyEntity.java new file mode 100644 index 0000000000..a70533c5b8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusAgencyDailyEntity.java @@ -0,0 +1,107 @@ +/** + * 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.stats.topic; + +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; + +/** + * 状态话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_status_agency_daily") +public class FactTopicStatusAgencyDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 统计日期 关联日期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-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusAgencyMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusAgencyMonthlyEntity.java new file mode 100644 index 0000000000..41b867b6af --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusAgencyMonthlyEntity.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats.topic; + +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; + +/** + * 状态话题-机关月统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_status_agency_monthly") +public class FactTopicStatusAgencyMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计月份 关联月度dm表 + */ + private String monthId; + + /** + * 季度ID 关联季度dm表 + */ + private String quarterId; + + /** + * 年ID 关联年度dm表 + */ + private String yearId; + + /** + * 话题状态 讨论中 discussing +已屏蔽 hidden +已关闭 closed +已转项目 shift_project + */ + private String topicStatusId; + + /** + * 话题数量 + */ + private Integer topicCount; + + /** + * 话题状态占比 月末一天 +指定状态话题数/话题总数 +总数在topic_total_agency_daily中 + */ + private BigDecimal topicProportion; + + /** + * 话题增量 单位时间内的话题状态增加数 + */ + private Integer topicIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusGridDailyEntity.java new file mode 100644 index 0000000000..9761626845 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicStatusGridDailyEntity.java @@ -0,0 +1,106 @@ +/** + * 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.stats.topic; + +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; + +/** + * 状态话题-网格日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_status_grid_daily") +public class FactTopicStatusGridDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格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-server/src/main/java/com/epmet/entity/stats/topic/FactTopicTotalAgencyDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicTotalAgencyDailyEntity.java new file mode 100644 index 0000000000..9ee374426f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicTotalAgencyDailyEntity.java @@ -0,0 +1,101 @@ +/** + * 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.stats.topic; + +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 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_total_agency_daily") +public class FactTopicTotalAgencyDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 父级机关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; + + /** + * 话题增量 + */ + private Integer topicIncr; + + /** + * 屏蔽话题数 + */ + private Integer hiddenTotalCount; + + /** + * 已转议题数 + */ + private Integer issueTotalCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicTotalGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicTotalGridDailyEntity.java new file mode 100644 index 0000000000..f9976295ea --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/topic/FactTopicTotalGridDailyEntity.java @@ -0,0 +1,101 @@ +/** + * 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.stats.topic; + +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 2020-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_total_grid_daily") +public class FactTopicTotalGridDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题总量 + */ + private Integer topicTotal; + + /** + * 话题增量 + */ + private Integer topicIncr; + + /** + * 屏蔽话题数量 + */ + private Integer hiddenTotalCount; + + /** + * 已转议题数量 + */ + private Integer issueTotalCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java new file mode 100644 index 0000000000..818e227cad --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/voice/TagCustomerEntity.java @@ -0,0 +1,53 @@ +/** + * 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.voice; + +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-06-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tag_customer") +public class TagCustomerEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 使用计数 + */ + private Integer useCount; + +} 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 c6b8a8bee0..4ffeb599c9 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 @@ -18,9 +18,10 @@ public interface IssueService { * @author zhaoqifeng * @date 2020/6/17 16:04 * @param customerId + * @param date * @return java.util.List */ - List getAgencyIssueTotal(String customerId); + List getAgencyIssueTotal(String customerId, String date); /** * 获取当前日期组织下议题增量 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 9cef7c5340..443c9ddc41 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 @@ -26,8 +26,8 @@ public class IssueServiceImpl implements IssueService { private StatsIssueDao statsIssueDao; @Override - public List getAgencyIssueTotal(String customerId) { - List list = statsIssueDao.selectAgencyIssueTotal(customerId); + public List getAgencyIssueTotal(String customerId, String date) { + List list = statsIssueDao.selectAgencyIssueTotal(customerId, date); list.forEach(dto -> { String[] pIds = dto.getPIds().split(":"); dto.setPId(pIds[pIds.length - 2]); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java index 5d0e6b4292..7faf406333 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsIssueService.java @@ -17,6 +17,15 @@ public interface StatsIssueService { */ void agencyGridIssueStats(); + /** + * 指定日期议题统计 + * @author zhaoqifeng + * @date 2020/6/28 11:01 + * @param date + * @return void + */ + void agencyGridIssueStatsOfDate(Date date); + /** * 机关下议题日统计 * @author zhaoqifeng diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java new file mode 100644 index 0000000000..9e653812d3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java @@ -0,0 +1,21 @@ +package com.epmet.service; + +import java.util.Date; + +/** + * @Description 话题统计Service接口 + * @ClassName StatsTopicService + * @Auth wangc + * @Date 2020-06-23 15:22 + */ +public interface StatsTopicService { + + /** + * @Description 分区统计,按照客户Id划分 + * @param date 如果目标日期为空,则自动计算为T-1天 + * @return + * @author wangc + * @date 2020.06.28 14:38 + **/ + void partition(Date date); +} 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 new file mode 100644 index 0000000000..6bf55f86ec --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java @@ -0,0 +1,20 @@ +package com.epmet.service; + +import java.util.Date; + +/** + * @author wangc + * @dscription + * @date 2020/6/17 16:51 + */ +public interface StatsUserService { + + /** + * @Description 分区统计,按照客户Id划分 + * @param date 如果目标日期为空,则自动计算为T-1天 + * @return + * @author wangc + * @date 2020.06.28 14:38 + **/ + void partition(Date date); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java index a6d61a756e..82588801a7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java @@ -21,24 +21,24 @@ public interface GroupDataService { /** * @Description 获取同级机关下网格下的小组数量 - * @param allGrid + * @param * @author zxc */ - List getAgencyGroupTotalCount(List allGrid,String dateId); + List getAgencyGroupTotalCount(String customerId,String dateId); /** * @Description 查询机关下网格内的小组人数 * @param * @author zxc */ - List selectAgencyGridGroupPeopleTotal(List allGrid,String dateId); + List selectAgencyGridGroupPeopleTotal(String customerId,String dateId); /** * @Description 查询机关下每个小组的人数 * @param * @author zxc */ - List selectAgencyEveryGroupPeopleCount(List allGrid,String dateId); + List selectAgencyEveryGroupPeopleCount(String customerId,String dateId); /** * @Description 查询机关下的小组日增数 @@ -46,7 +46,7 @@ public interface GroupDataService { * @param yesterday * @author zxc */ - List selectAgencyGroupIncr(List allGrid,String yesterday); + List selectAgencyGroupIncr(String customerId,String yesterday); /** * @Description 查询机关下所有网格小组人数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java index 1cdc3acdcf..2b37f81ed6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java @@ -95,12 +95,13 @@ public class GroupDataServiceImpl implements GroupDataService { Set>> entries = collect.entrySet(); entries.forEach(everyGroup -> { List value = everyGroup.getValue(); + String key = everyGroup.getKey(); List groupPeopleSorted = value.stream().sorted(Comparator.comparing(GridGroupPeopleResultDTO::getGroupCount).reversed()).collect(Collectors.toList()); - Integer groupPeopleMedian = groupPeopleSorted.size() % 2 == 0 ? - (groupPeopleSorted.get(groupPeopleSorted.size() / 2 - 1).getGroupCount() + groupPeopleSorted.get(groupPeopleSorted.size() / 2).getGroupCount()) / 2 : - groupPeopleSorted.get(groupPeopleSorted.size() / 2).getGroupCount(); + Integer groupPeopleMedian = groupPeopleSorted.size() % NumConstant.TWO == NumConstant.ZERO ? + (groupPeopleSorted.get(groupPeopleSorted.size() / NumConstant.TWO - NumConstant.ONE).getGroupCount() + groupPeopleSorted.get(groupPeopleSorted.size() / NumConstant.TWO).getGroupCount()) / NumConstant.TWO : + groupPeopleSorted.get(groupPeopleSorted.size() / NumConstant.TWO).getGroupCount(); result.forEach(grid -> { - if (groupPeopleSorted.get(0).getGridId().equals(grid.getGridId())){ + if (key.equals(grid.getGridId())){ grid.setGroupMedian(groupPeopleMedian);//中位数 //网格下小组成员最大数 grid.setGroupMemberMaxCount(groupPeopleSorted.get(NumConstant.ZERO).getGroupCount()); @@ -133,11 +134,11 @@ public class GroupDataServiceImpl implements GroupDataService { * @param * @author zxc */ - public List getAgencyGroupTotalCount(List allGrid,String dateId){ - if (allGrid.size() == NumConstant.ZERO){ + public List getAgencyGroupTotalCount(String customerId,String dateId){ + /*if (allGrid.size() == NumConstant.ZERO){ return new ArrayList<>(); - } - return groupDataDao.getAgencyGroupTotalCount(allGrid,dateId); + }*/ + return groupDataDao.getAgencyGroupTotalCount(customerId,dateId); } /** @@ -146,11 +147,11 @@ public class GroupDataServiceImpl implements GroupDataService { * @author zxc */ @Override - public List selectAgencyGridGroupPeopleTotal(List allGrid,String dateId) { - if (allGrid.size() == NumConstant.ZERO){ + public List selectAgencyGridGroupPeopleTotal(String customerId,String dateId) { + /*if (allGrid.size() == NumConstant.ZERO){ return new ArrayList<>(); - } - return groupDataDao.selectAgencyGridGroupPeopleTotal(allGrid,dateId); + }*/ + return groupDataDao.selectAgencyGridGroupPeopleTotal(customerId,dateId); } /** @@ -158,11 +159,11 @@ public class GroupDataServiceImpl implements GroupDataService { * @param * @author zxc */ - public List selectAgencyEveryGroupPeopleCount(List allGrid,String dateId){ - if (allGrid.size() == NumConstant.ZERO){ + public List selectAgencyEveryGroupPeopleCount(String customerId,String dateId){ + /*if (allGrid.size() == NumConstant.ZERO){ return new ArrayList<>(); - } - return groupDataDao.selectAgencyEveryGroupPeopleCount(allGrid,dateId); + }*/ + return groupDataDao.selectAgencyEveryGroupPeopleCount(customerId,dateId); } /** @@ -171,11 +172,11 @@ public class GroupDataServiceImpl implements GroupDataService { * @param dateId * @author zxc */ - public List selectAgencyGroupIncr(List allGrid,String dateId){ - if (allGrid.size() == NumConstant.ZERO){ + public List selectAgencyGroupIncr(String customerId,String dateId){ + /*if (allGrid.size() == NumConstant.ZERO){ return new ArrayList<>(); - } - return groupDataDao.selectAgencyGroupIncr(allGrid, dateId); + }*/ + return groupDataDao.selectAgencyGroupIncr(customerId, dateId); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index 90404da3be..fc0241db68 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -104,7 +104,7 @@ public class StatsDimServiceImpl implements StatsDimService { lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_AGENCY); } - Date statsEndTime = new Date(); + Date statsEndTime = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD); Date statsStartTime = null; if (lastExecRecord.getExecTime() != null) { statsStartTime = DateUtils.integrate(lastExecRecord.getExecTime(), DateUtils.DATE_PATTERN_YYYYMMDD); @@ -126,7 +126,7 @@ public class StatsDimServiceImpl implements StatsDimService { lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_CUSTOMER); } - Date statsEndTime = new Date(); + Date statsEndTime = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD); Date statsStartTime = null; if (lastExecRecord.getExecTime() != null) { statsStartTime = DateUtils.integrate(lastExecRecord.getExecTime(), DateUtils.DATE_PATTERN_YYYYMMDD); @@ -145,7 +145,7 @@ public class StatsDimServiceImpl implements StatsDimService { lastExecRecord = lastExecRecordService.createLastExecRecord(StatsSubject.DIM_DEPARTMENT); } - Date statsEndTime = new Date(); + Date statsEndTime = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN_YYYYMMDD); Date statsStartTime = null; if (lastExecRecord.getExecTime() != null) { statsStartTime = DateUtils.integrate(lastExecRecord.getExecTime(), DateUtils.DATE_PATTERN_YYYYMMDD); @@ -154,9 +154,6 @@ public class StatsDimServiceImpl implements StatsDimService { List departments = departmentService.listDepartmentsByCreatedTime(statsStartTime, statsEndTime); if (!CollectionUtils.isEmpty(departments)) { dimDepartmentService.initDepartmentDims(departments); - lastExecRecord.setExecTime(new Date()); - // 记录最后一次统计时间 - lastExecRecordService.updateById(lastExecRecord); } } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java index f91f0124b4..b9735e489c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -14,6 +14,7 @@ import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; +import oracle.sql.NUMBER; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -34,8 +35,6 @@ import java.util.stream.Collectors; @Slf4j public class StatsGroupServiceImpl implements StatsGroupService { - @Autowired - private DimGridService dimGridService; @Autowired private DimAgencyService dimAgencyService; @Autowired @@ -63,18 +62,15 @@ public class StatsGroupServiceImpl implements StatsGroupService { List customerIds; do { customerIds = dimCustomerService.selectCustomerIdPage(pageNo,pageSize); + DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date); if (customerIds.size() != NumConstant.ZERO){ customerIds.forEach(customerId -> { try { - DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date); - -// List gridsInfo = dimGridService.getGridListByCustomerId(customerId); List gridsInfo = customerGridService.getCustomerGridIdList(customerId, dimIdBean.getDateId()); - List resultDTOS = groupDataService.groupGridDaily(customerId,dimIdBean,gridsInfo); factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS,customerId); } catch (Exception e) { - log.error(GroupConstant.ERRORGRIDDAILY+customerId,e); + log.error(String.format(GroupConstant.STATS_FAILED_GRID_DAILY,customerId,LocalDate.now(),e)); } }); } @@ -101,7 +97,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { List agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId); factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily,customerId); } catch (Exception e) { - log.error(GroupConstant.ERRORAGENCYDAILY+customerId,e); + log.error(String.format(GroupConstant.STATS_FAILED_AGENCY_DAILY,customerId,LocalDate.now(),e)); } }); } @@ -134,6 +130,13 @@ public class StatsGroupServiceImpl implements StatsGroupService { factGroupAgencyMonthlyService.insertAgencyGroupMonthly(lastDayAgency); } + /** + * @Description 网格小组 【机关-日】 数据统计处理 + * @param customerAgencyInfos + * @param timeDim + * @param customerId + * @author zxc + */ public List getAgencyGroupDaily(List customerAgencyInfos, DimIdGenerator.DimIdBean timeDim,String customerId){ if (customerAgencyInfos.size() == NumConstant.ZERO){ return new ArrayList<>(); @@ -146,65 +149,95 @@ public class StatsGroupServiceImpl implements StatsGroupService { String agencyId = agency.getId(); agencyResult.setAgencyId(agencyId); agencyResult.setCustomerId(customerId); + agencyResult.setPid(agency.getPid()); BeanUtils.copyProperties(timeDim,agencyResult); //机关下的所有网格(包括直属网格) - List allGrid = this.getAllGrid(agencyId); - String pidByAgencyId = dimAgencyService.getPidByAgencyId(agencyId); - agencyResult.setPid(StringUtils.isBlank(pidByAgencyId)?"0":pidByAgencyId); - // TODO 1. 机关下有多少网格 - List customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId); - AtomicReference gridSize = new AtomicReference<>(0); - if (customerGridIdList.size() != NumConstant.ZERO){ - customerGridIdList.forEach(gridId -> { - allGrid.forEach(allAgencyGrid -> { - if (gridId.getGridId().equals(allAgencyGrid)){ - gridSize.updateAndGet(v -> v + NumConstant.ONE); + List allGrid = this.getAllGrid(agencyId,customerId); + if (allGrid.size() != NumConstant.ZERO) { + // 1. 机关下有多少网格 + List customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId); + AtomicReference gridSize = new AtomicReference<>(NumConstant.ZERO); + if (customerGridIdList.size() != NumConstant.ZERO) { + customerGridIdList.forEach(gridId -> { + allGrid.forEach(allAgencyGrid -> { + if (gridId.getGridId().equals(allAgencyGrid)) { + gridSize.updateAndGet(v -> v + NumConstant.ONE); + } + }); + }); + agencyResult.setGridTotal(gridSize.get()); + } else { + agencyResult.setGridTotal(NumConstant.ZERO); + } + // 2. 机关下有多少小组,只算 state = ‘approved’ + List approvedResult = new ArrayList<>(); + List agencyGroupTotalCount = groupDataService.getAgencyGroupTotalCount(customerId, dateId); + allGrid.forEach(grid -> { + agencyGroupTotalCount.forEach(groupTotal -> { + if (grid.equals(groupTotal.getGridId())) { + approvedResult.add(groupTotal); } }); }); - agencyResult.setGridTotal(gridSize.get()); - }else { - agencyResult.setGridTotal(NumConstant.ZERO); - } - - // TODO 2. 机关下有多少小组,只算 state = ‘approved’ - List agencyGroupTotalCount = groupDataService.getAgencyGroupTotalCount(allGrid,dateId); - Integer groupCount = agencyGroupTotalCount.stream().collect(Collectors.summingInt(AgencyGroupTotalCountResultDTO::getGridGroupCount)); - agencyResult.setGroupTotalCount(groupCount); - // TODO 3. 机关下所有组内人数和(不需要去重) 人员状态 != "removed" - List agencyGridGroupPeopleTotal = groupDataService.selectAgencyGridGroupPeopleTotal(allGrid,dateId); - Integer groupPeopleCount = agencyGridGroupPeopleTotal.stream().collect(Collectors.summingInt(AgencyGridGroupPeopleTotalResultDTO::getGridGroupPeopleTotal)); - agencyResult.setGroupMemberTotalCount(groupPeopleCount); - - // TODO 4. 机关下小组平均人数 - agencyResult.setGroupMemberAvgCount( - agencyResult.getGroupTotalCount() == NumConstant.ZERO ? NumConstant.ZERO : - agencyResult.getGroupMemberTotalCount()/agencyResult.getGroupTotalCount()); - - // TODO 5. 机关下小组人数中位数 小组最大(小)成员数、最多(少)成员小组ID - List agencyGridGroupPeople = groupDataService.selectAgencyEveryGroupPeopleCount(allGrid,dateId); - List sorted = agencyGridGroupPeople.stream().sorted(Comparator.comparing(AgencyGridGroupPeopleResultDTO::getGroupCount).reversed()).collect(Collectors.toList()); - Integer groupPeopleMedian; - if (sorted.size() == NumConstant.ONE){ - agencyResult.setGroupMemberMaxCount(sorted.get(NumConstant.ZERO).getGroupCount()); - agencyResult.setMaxMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId()); - agencyResult.setGroupMemberMinCount(sorted.get(NumConstant.ZERO).getGroupCount()); - agencyResult.setMinMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId()); - }else if (sorted.size() >= NumConstant.TWO){ - groupPeopleMedian = sorted.size() % NumConstant.TWO == NumConstant.ZERO ? - (sorted.get(sorted.size() / NumConstant.TWO - NumConstant.ONE).getGroupCount() + sorted.get(sorted.size() / 2).getGroupCount()) / 2 : - sorted.get(sorted.size() / NumConstant.TWO).getGroupCount(); - agencyResult.setGroupMedian(groupPeopleMedian); - - agencyResult.setGroupMemberMaxCount(sorted.get(NumConstant.ZERO).getGroupCount()); - agencyResult.setMaxMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId()); - agencyResult.setGroupMemberMinCount(sorted.get(sorted.size() - NumConstant.ONE).getGroupCount()); - agencyResult.setMinMemberGroupId(sorted.get(sorted.size() - NumConstant.ONE).getGroupId()); + Integer groupCount = approvedResult.stream().collect(Collectors.summingInt(AgencyGroupTotalCountResultDTO::getGridGroupCount)); + agencyResult.setGroupTotalCount(groupCount); + // 3. 机关下所有组内人数和(不需要去重) 人员状态 != "removed" + List peopleTotal = new ArrayList<>(); + List agencyGridGroupPeopleTotal = groupDataService.selectAgencyGridGroupPeopleTotal(customerId, dateId); + allGrid.forEach(grid -> { + agencyGridGroupPeopleTotal.forEach(people -> { + if (grid.equals(people.getGridId())) { + peopleTotal.add(people); + } + }); + }); + Integer groupPeopleCount = peopleTotal.stream().collect(Collectors.summingInt(AgencyGridGroupPeopleTotalResultDTO::getGridGroupPeopleTotal)); + agencyResult.setGroupMemberTotalCount(groupPeopleCount); + // 4. 机关下小组平均人数 + agencyResult.setGroupMemberAvgCount( + agencyResult.getGroupTotalCount() == NumConstant.ZERO ? NumConstant.ZERO : + agencyResult.getGroupMemberTotalCount() / agencyResult.getGroupTotalCount()); + // 5. 机关下小组人数中位数 小组最大(小)成员数、最多(少)成员小组ID + List groupPeople = new ArrayList<>(); + List agencyGridGroupPeople = groupDataService.selectAgencyEveryGroupPeopleCount(customerId, dateId); + allGrid.forEach(grid -> { + agencyGridGroupPeople.forEach(group -> { + if (grid.equals(group.getGridId())) { + groupPeople.add(group); + } + }); + }); + List sorted = groupPeople.stream().sorted(Comparator.comparing(AgencyGridGroupPeopleResultDTO::getGroupCount).reversed()).collect(Collectors.toList()); + Integer groupPeopleMedian; + if (sorted.size() == NumConstant.ONE) { + agencyResult.setGroupMedian(sorted.get(NumConstant.ZERO).getGroupCount()); + agencyResult.setGroupMemberMaxCount(sorted.get(NumConstant.ZERO).getGroupCount()); + agencyResult.setMaxMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId()); + agencyResult.setGroupMemberMinCount(sorted.get(NumConstant.ZERO).getGroupCount()); + agencyResult.setMinMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId()); + } else if (sorted.size() >= NumConstant.TWO) { + groupPeopleMedian = sorted.size() % NumConstant.TWO == NumConstant.ZERO ? + (sorted.get(sorted.size() / NumConstant.TWO - NumConstant.ONE).getGroupCount() + sorted.get(sorted.size() / 2).getGroupCount()) / 2 : + sorted.get(sorted.size() / NumConstant.TWO).getGroupCount(); + agencyResult.setGroupMedian(groupPeopleMedian); + agencyResult.setGroupMemberMaxCount(sorted.get(NumConstant.ZERO).getGroupCount()); + agencyResult.setMaxMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId()); + agencyResult.setGroupMemberMinCount(sorted.get(sorted.size() - NumConstant.ONE).getGroupCount()); + agencyResult.setMinMemberGroupId(sorted.get(sorted.size() - NumConstant.ONE).getGroupId()); + } + // 6. 机关下小组增量 + List groupIncr = new ArrayList<>(); + List agencyGroupIncr = groupDataService.selectAgencyGroupIncr(customerId, dateId); + allGrid.forEach(grid -> { + agencyGroupIncr.forEach(incr -> { + if (grid.equals(incr.getGridId())) { + groupIncr.add(incr); + } + }); + }); + Integer groupIncrCount = groupIncr.stream().collect(Collectors.summingInt(AgencyGroupIncrResultDTO::getGroupIncr)); + agencyResult.setGroupIncr(groupIncrCount); } - // TODO 6. 机关下小组增量 - List agencyGroupIncr = groupDataService.selectAgencyGroupIncr(allGrid, dateId); - Integer groupIncr = agencyGroupIncr.stream().collect(Collectors.summingInt(AgencyGroupIncrResultDTO::getGroupIncr)); - agencyResult.setGroupIncr(groupIncr); result.add(agencyResult); }); return result; @@ -215,9 +248,9 @@ public class StatsGroupServiceImpl implements StatsGroupService { * @param agencyId * @author zxc */ - public List getAllGrid(String agencyId){ + public List getAllGrid(String agencyId,String customerId){ List result = new ArrayList<>(); - List allAgency = dimAgencyService.getAllAgency(); + List allAgency = dimAgencyService.getAllAgency(customerId); Map> subGridOfAgency = new HashMap<>(); allAgency.forEach(agency -> { @@ -242,7 +275,6 @@ public class StatsGroupServiceImpl implements StatsGroupService { * @author zxc */ void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map> subGridOfAgency){ - //向map中放入数据 if(subGridOfAgency.containsKey(pid)){ //包含key @@ -259,13 +291,10 @@ public class StatsGroupServiceImpl implements StatsGroupService { Set grids = new HashSet<>(agency.getGridIds()); subGridOfAgency.put(pid,grids); } - //定义递归出口 if(StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY,agency.getLevel()) || null == agency.getSubAgencies() || agency.getSubAgencies().size() == NumConstant.ZERO){ return ; } - - //定义递归入口 agency.getSubAgencies().forEach(obj -> { initAgencyGridMap(pid,obj,subGridOfAgency); @@ -290,8 +319,4 @@ public class StatsGroupServiceImpl implements StatsGroupService { return DimIdGenerator.getDimIdBean(result); } - public List getAgencyAllGrid(String customerId,String agencyId){ - - return null; - } } 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 fd6ffe7b88..8fc548d4c2 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 @@ -4,6 +4,7 @@ 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.IssueConstant; +import com.epmet.constant.ProjectConstant; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; @@ -18,8 +19,8 @@ import com.epmet.service.StatsIssueService; import com.epmet.service.project.ProjectService; import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -33,6 +34,7 @@ import java.util.stream.Collectors; * @dscription * @date 2020/6/17 16:51 */ +@Slf4j @Service public class StatsIssueServiceImpl implements StatsIssueService { @Autowired @@ -60,11 +62,39 @@ public class StatsIssueServiceImpl implements StatsIssueService { int pageSize = 100; List customerIdList = null; do { + //获取当前日期前一天 + Date date = DateUtils.getBeforeDay(new Date()); customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { //遍历统计每一个客户数据 - customerStats(customerId); + try { + customerStats(customerId, date); + } catch(Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", customerId, DateUtils.format(date)), + e); + } + } + } + } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); + } + + @Override + public void agencyGridIssueStatsOfDate(Date date) { + int pageNo = 1; + int pageSize = 100; + List customerIdList = null; + do { + //获取当前日期前一天 + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + for (String customerId : customerIdList) { + //遍历统计每一个客户数据 + try { + customerStats(customerId, date); + } catch(Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", DateUtils.format(date)), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -77,10 +107,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { * @param customerId * @return void */ - @Async - public void customerStats(String customerId) { - //获取当前日期前一天 - Date date = DateUtils.getBeforeDay(new Date()); + private void customerStats(String customerId, Date date) { //机关议题日统计 saveIssueAgencyDaily(customerId, date); //机关议题月统计 @@ -103,7 +130,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { //获取当前客户下所有机关 List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //获取机关下议题各种状态的数目统计 - List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); //获取机关下议题各种状态的数目增量 List issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); //获取机关下已关闭议题统计 @@ -123,10 +150,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { entity.setPid(agency.getPid()); String pIds; - if (null == agency.getPids() || agency.getPids().isEmpty()) { - pIds = agency.getPid().concat(":").concat(agency.getId()); + if (NumConstant.ZERO_STR.equals(agency.getPid())) { + pIds = agency.getPid(); } else { - pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); + pIds = agency.getPids().concat(":").concat(agency.getId()); } //总量统计 saveTotal(issueAgencyTotalList, agency, entity, pIds); @@ -166,7 +193,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { //获取当前客户下所有机关 List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //获取机关下议题各种状态的数目统计 - List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId); + List issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); //获取机关下已关闭议题统计 List issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); //已结案项目统计 @@ -179,10 +206,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { FactIssueAgencyMonthlyEntity monthly = initIssueAgencyMonthly(dimId); String pIds; - if (null == agency.getPids() || agency.getPids().isEmpty()) { - pIds = agency.getPid().concat(":").concat(agency.getId()); + if (NumConstant.ZERO_STR.equals(agency.getPid())) { + pIds = agency.getPid(); } else { - pIds = ("0").concat(":").concat(agency.getPids()).concat(":").concat(agency.getId()); + pIds = agency.getPids().concat(":").concat(agency.getId()); } //总量统计 saveTotal(issueAgencyTotalList, agency, daily, pIds); @@ -263,8 +290,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { })).collect(Collectors.toList()); Map> totalMap = totalList.stream().collect(Collectors.groupingBy(IssueProjectDTO::getStatus)); - List resolveList = totalMap.get(IssueConstant.RESLOVED); - List unResolveList = totalMap.get(IssueConstant.UNRESLOVED); + List resolveList = totalMap.get(IssueConstant.RESOLVED); + List unResolveList = totalMap.get(IssueConstant.UNRESOLVED); if (null != resolveList) { resolveMap = resolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); } @@ -283,8 +310,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { })).collect(Collectors.toList()); Map> incMap = incList.stream().collect(Collectors.groupingBy(IssueProjectDTO::getStatus)); - List resolveIncList = incMap.get(IssueConstant.RESLOVED); - List unResolveIncList = incMap.get(IssueConstant.UNRESLOVED); + List resolveIncList = incMap.get(IssueConstant.RESOLVED); + List unResolveIncList = incMap.get(IssueConstant.UNRESOLVED); if (null != resolveIncList) { resolveIncMap = resolveIncList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); } @@ -357,8 +384,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { })).collect(Collectors.toList()); Map> totalMap = totalList.stream().collect(Collectors.groupingBy(IssueProjectDTO::getStatus)); - List resolveList = totalMap.get(IssueConstant.RESLOVED); - List unResolveList = totalMap.get(IssueConstant.UNRESLOVED); + List resolveList = totalMap.get(IssueConstant.RESOLVED); + List unResolveList = totalMap.get(IssueConstant.UNRESOLVED); if (null != resolveList) { resolveMap = resolveList.stream().collect(Collectors.groupingBy(IssueProjectDTO:: getGridId, Collectors.counting())); } @@ -476,10 +503,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { for (IssueGridDTO dto : list) { if (grid.getId().equals(dto.getGridId())) { - if (IssueConstant.RESLOVED.equals(dto.getStatus())) { + if (IssueConstant.RESOLVED.equals(dto.getStatus())) { //表决中议题数量 resolvedInc = dto.getCount(); - } else if (IssueConstant.UNRESLOVED.equals(dto.getStatus())) { + } else if (IssueConstant.UNRESOLVED.equals(dto.getStatus())) { //已转项目议题数量 unresolvedInc = dto.getCount(); } @@ -507,10 +534,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { for (IssueGridDTO dto : list) { if (grid.getId().equals(dto.getGridId())) { - if (IssueConstant.RESLOVED.equals(dto.getStatus())) { + if (IssueConstant.RESOLVED.equals(dto.getStatus())) { //已解决议题数量 resolvedCount = dto.getCount(); - } else if (IssueConstant.UNRESLOVED.equals(dto.getStatus())) { + } else if (IssueConstant.UNRESOLVED.equals(dto.getStatus())) { //未解决议题数量 unresolvedCount = dto.getCount(); } @@ -544,6 +571,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { int shiftInc = NumConstant.ZERO; //已关闭增量 int closedInc = NumConstant.ZERO; + //议题增量 + int issueInc = NumConstant.ZERO; for (IssueGridDTO dto : list) { if (grid.getId().equals(dto.getGridId())) { if (IssueConstant.VOTING.equals(dto.getStatus())) { @@ -552,17 +581,16 @@ public class StatsIssueServiceImpl implements StatsIssueService { } else if (IssueConstant.SHIFT_PROJECT.equals(dto.getStatus())) { //已转项目议题数量 shiftInc = dto.getCount(); - } else { + } else if(IssueConstant.CLOSED.equals(dto.getStatus())) { //已关闭议题数量 closedInc = dto.getCount(); } } } - int issueInc = votingInc + shiftInc + closedInc; entity.setVotingIncr(votingInc); entity.setShiftProjectIncr(shiftInc); entity.setClosedIncr(closedInc); - entity.setIssueIncr(issueInc); + entity.setIssueIncr(votingInc); } /** @@ -632,10 +660,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { for (ProjectAgencyDTO project : list) { if (agency.getId().equals(project.getAgencyId()) || project.getPIds().contains(pIds)) { - if (IssueConstant.RESLOVED.equals(project.getStatus())) { + if (IssueConstant.RESOLVED.equals(project.getStatus())) { //已解决数量 resolvedCount = resolvedCount + project.getCount(); - } else if (IssueConstant.SHIFT_PROJECT.equals(project.getStatus())) { + } else if (IssueConstant.UNRESOLVED.equals(project.getStatus())) { //未解决数量 unresolvedCount = unresolvedCount + project.getCount(); } @@ -666,10 +694,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { for (ProjectAgencyDTO project : list) { if (agency.getId().equals(project.getAgencyId()) || project.getPIds().contains(pIds)) { - if (IssueConstant.RESLOVED.equals(project.getStatus())) { + if (IssueConstant.RESOLVED.equals(project.getStatus())) { //已解决数量 resolvedCount = resolvedCount + project.getCount(); - } else if (IssueConstant.SHIFT_PROJECT.equals(project.getStatus())) { + } else if (IssueConstant.UNRESOLVED.equals(project.getStatus())) { //未解决数量 unresolvedCount = unresolvedCount + project.getCount(); } @@ -706,6 +734,8 @@ public class StatsIssueServiceImpl implements StatsIssueService { int shiftInc = NumConstant.ZERO; //已关闭增量 int closedInc = NumConstant.ZERO; + //议题增量 + int issueInc = NumConstant.ZERO; for (IssueAgencyDTO issueAgency : list) { if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { if (IssueConstant.VOTING.equals(issueAgency.getStatus())) { @@ -714,17 +744,16 @@ public class StatsIssueServiceImpl implements StatsIssueService { } else if (IssueConstant.SHIFT_PROJECT.equals(issueAgency.getStatus())) { //已转项目议题数量 shiftInc = shiftInc + issueAgency.getCount(); - } else { + } else if(IssueConstant.CLOSED.equals(issueAgency.getStatus())) { //已关闭议题数量 closedInc = closedInc + issueAgency.getCount(); } } } - int issueInc = votingInc + shiftInc + closedInc; entity.setVotingIncr(votingInc); entity.setShiftProjectIncr(shiftInc); entity.setClosedIncr(closedInc); - entity.setIssueIncr(issueInc); + entity.setIssueIncr(votingInc); } /** @@ -796,10 +825,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { for (IssueAgencyDTO issueAgency : list) { if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { - if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { + if (IssueConstant.RESOLVED.equals(issueAgency.getStatus())) { //表决中议题数量 resolvedCount = resolvedCount + issueAgency.getCount(); - } else if (IssueConstant.UNRESLOVED.equals(issueAgency.getStatus())) { + } else if (IssueConstant.UNRESOLVED.equals(issueAgency.getStatus())) { //已转项目议题数量 unresolvedCount = unresolvedCount + issueAgency.getCount(); } @@ -835,10 +864,10 @@ public class StatsIssueServiceImpl implements StatsIssueService { for (IssueAgencyDTO issueAgency : list) { if (agency.getId().equals(issueAgency.getAgencyId()) || issueAgency.getPIds().contains(pIds)) { - if (IssueConstant.RESLOVED.equals(issueAgency.getStatus())) { + if (IssueConstant.RESOLVED.equals(issueAgency.getStatus())) { //表决中议题数量 resolvedInc = resolvedInc + issueAgency.getCount(); - } else if (IssueConstant.UNRESLOVED.equals(issueAgency.getStatus())) { + } else if (IssueConstant.UNRESOLVED.equals(issueAgency.getStatus())) { //已转项目议题数量 unresolvedInc = unresolvedInc + issueAgency.getCount(); } @@ -848,7 +877,6 @@ public class StatsIssueServiceImpl implements StatsIssueService { entity.setClosedUnresolvedIncr(unresolvedInc); } - /** * 初始化数据 * 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 1e5cac4aac..75748d696b 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 @@ -71,10 +71,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { try { + log.info("for循环统计机关-项目-日月数据,当前统计的客户Id:" + customerId); //遍历统计每一个客户数据 customerAgencyStats(customerId); } catch (Exception e) { - log.error("项目-机关-数据统计程序错误,对应客户Id:"+customerId, e); + log.error("项目-机关-数据统计程序错误,对应客户Id:" + customerId, e); log.error("Error creating model JSON", e); } } @@ -92,11 +93,13 @@ public class StatsProjectServiceImpl implements StatsProjectService { DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //2:根据客户Id查询机关维度表数据 + log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询机关维度数据,对应客户Id:" + customerId); DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); dimAgencyDTO.setCustomerId(customerId); List dimAgencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); //3:根据客户Id查询项目业务表已结案数据(查询传入日期及之前的数据) + log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目业务表已结案数据,对应客户Id:" + customerId); ProjectEntity projectEntity = new ProjectEntity(); projectEntity.setCustomerId(customerId); projectEntity.setCreatedTime(date); @@ -104,16 +107,27 @@ public class StatsProjectServiceImpl implements StatsProjectService { List projectList = projectService.getProjectList(projectEntity); //4:查询项目处理进展表中有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询传入日期及之前的数据) + log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId); List processList = projectProcessService.getProcessList(projectEntity); //5:机关层级日月统计 if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { //5.1:执行机关日数据统计 - agencyDateProjectStats(customerId, dimId, dimAgencyList, projectList, processList); + try { + log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关日统计方法,方法名:agencyDateProjectStats,客户Id:" + customerId); + agencyDateProjectStats(customerId, dimId, dimAgencyList, projectList, processList); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyDateProjectStats", customerId, dimId.getDateId()), e); + } //5.2:执行机关月数据统计 //if (Calendar.getInstance().get(Calendar.DATE) == 1) { + try { + log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关月统计方法,方法名:agencyMonthProjectStats,客户Id:" + customerId); agencyMonthProjectStats(customerId, dimId, dimAgencyList); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyMonthProjectStats", customerId, dimId.getMonthId()), e); + } //} } @@ -232,7 +246,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { agencyDailyEntity.setUnresolvedRatio(new BigDecimal(numberFormat.format((float) unResolvedTotal.intValue() / (float) closedTotal.intValue()))); } agencyDailyEntity.setProjectIncr(projectIncr.intValue()); - agencyDailyEntity.setPendingIncr(projectIncr.intValue() - closedIncr.intValue()); + agencyDailyEntity.setPendingIncr(projectIncr.intValue()); agencyDailyEntity.setClosedIncr(closedIncr.intValue()); agencyDailyEntity.setResolvedIncr(resolvedIncr.intValue()); agencyDailyEntity.setUnresolvedIncr(unResolvedIncr.intValue()); @@ -246,9 +260,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { FactAgencyProjectDailyEntity delEntity = new FactAgencyProjectDailyEntity(); delEntity.setCustomerId(customerId); delEntity.setDateId(dimId.getDateId()); + log.info("StatsProjectServiceImpl.agencyDateProjectStats-根据客户Id、日维度Id批量删除机关项目日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); factAgencyProjectDailyService.delDateProject(delEntity); //2.2:批量保存机关日统计数据 + log.info("StatsProjectServiceImpl.agencyDateProjectStats-批量新增机关项目日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); factAgencyProjectDailyService.insertBatch(projectDateEntityList); } @@ -323,9 +339,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { FactAgencyProjectMonthlyEntity delEntity = new FactAgencyProjectMonthlyEntity(); delEntity.setCustomerId(customerId); delEntity.setMonthId(dimId.getMonthId()); + log.info("StatsProjectServiceImpl.agencyMonthProjectStats-根据客户Id、月维度Id批量删除机关项目月统计表数据,对应客户Id:" + customerId + ",月维度Id:" + dimId.getMonthId()); factAgencyProjectMonthlyService.delMonthProject(delEntity); //3.2:批量保存机关月统计数据 + log.info("StatsProjectServiceImpl.agencyMonthProjectStats-批量新增机关项目月统计表数据,对应客户Id:" + customerId + ",月维度Id:" + dimId.getMonthId()); factAgencyProjectMonthlyService.insertBatch(monthlyEntityList); } @@ -347,10 +365,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { try { + log.info("for循环统计网格-项目-日月数据,当前统计的客户Id:" + customerId); //遍历统计每一个客户数据 customerGridStats(customerId); } catch (Exception e) { - log.error("项目-网格-数据统计程序错误,对应客户Id:"+customerId, e); + log.error("项目-网格-数据统计程序错误,对应客户Id:" + customerId, e); log.error("Error creating model JSON", e); } } @@ -368,9 +387,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //2:根据客户Id查询网格维度表数据 + log.info("StatsProjectServiceImpl.customerGridStats-根据客户Id查询网格维度数据,对应客户Id:" + customerId); List dimGridList = dimGridService.getGridListByCustomerId(customerId); //3:根据客户Id查询项目业务表已结案数据(查询传入日期及之前的数据) + log.info("StatsProjectServiceImpl.customerGridStats-根据客户Id查询项目业务表已结案数据,对应客户Id:" + customerId); ProjectEntity projectEntity = new ProjectEntity(); projectEntity.setCustomerId(customerId); projectEntity.setCreatedTime(date); @@ -378,20 +399,32 @@ public class StatsProjectServiceImpl implements StatsProjectService { List projectList = projectService.getProjectList(projectEntity); //4:查询项目处理进展表中有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询传入日期及之前的数据) + log.info("StatsProjectServiceImpl.customerGridStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId); List processList = projectProcessService.getProcessList(projectEntity); //5:网格层级日月统计 if (null != dimGridList && dimGridList.size() > NumConstant.ZERO) { //5.1:执行网格日数据统计 - gridDateProjectStats(customerId, dimId, dimGridList, projectList, processList); + try { + log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关日统计方法,方法名:gridDateProjectStats,客户Id:" + customerId); + gridDateProjectStats(customerId, dimId, dimGridList, projectList, processList); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridDateProjectStats", customerId, dimId.getDateId()), e); + } //5.2:执行网格月数据统计 //if (Calendar.getInstance().get(Calendar.DATE) == 1) { + try { + log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关月统计方法,方法名:gridMonthProjectStats,客户Id:" + customerId); gridMonthProjectStats(customerId, dimId, dimGridList); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridMonthProjectStats", customerId, dimId.getMonthId()), e); + } //} } } + /** * @param customerId * @return @@ -506,7 +539,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { gridDailyEntity.setUnresolvedRatio(new BigDecimal(numberFormat.format((float) unResolvedTotal.intValue() / (float) closedTotal.intValue()))); } gridDailyEntity.setProjectIncr(projectIncr.intValue()); - gridDailyEntity.setPendingIncr(projectIncr.intValue() - closedIncr.intValue()); + gridDailyEntity.setPendingIncr(projectIncr.intValue()); gridDailyEntity.setClosedIncr(closedIncr.intValue()); gridDailyEntity.setResolvedIncr(resolvedIncr.intValue()); gridDailyEntity.setUnresolvedIncr(unResolvedIncr.intValue()); @@ -520,9 +553,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { FactAgencyProjectDailyEntity delEntity = new FactAgencyProjectDailyEntity(); delEntity.setCustomerId(customerId); delEntity.setDateId(dimId.getDateId()); + log.info("StatsProjectServiceImpl.gridDateProjectStats-根据客户Id、日维度Id批量删除网格项目日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); factGridProjectDailyService.delDateProject(delEntity); //3.2:批量保存网格日统计数据 + log.info("StatsProjectServiceImpl.gridDateProjectStats-批量新增网格项目日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); factGridProjectDailyService.insertBatch(gridDateEntityList); } @@ -597,9 +632,11 @@ public class StatsProjectServiceImpl implements StatsProjectService { FactAgencyProjectMonthlyEntity delEntity = new FactAgencyProjectMonthlyEntity(); delEntity.setCustomerId(customerId); delEntity.setMonthId(dimId.getMonthId()); + log.info("StatsProjectServiceImpl.gridMonthProjectStats-根据客户Id、月维度Id批量删除网格项目月统计表数据,对应客户Id:" + customerId + ",月维度Id:" + dimId.getMonthId()); factGridProjectMonthlyService.delMonthProject(delEntity); //3.2:批量保存机关月统计数据 + log.info("StatsProjectServiceImpl.gridMonthProjectStats-批量新增网格项目月统计表数据,对应客户Id:" + customerId + ",月维度Id:" + dimId.getMonthId()); factGridProjectMonthlyService.insertBatch(monthlyEntityList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index e21c1e1488..31b48152f3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -12,12 +12,13 @@ import com.epmet.dto.voice.ArticleViewedSummaryDTO; import com.epmet.entity.stats.*; import com.epmet.entity.voice.ArticleEntity; import com.epmet.entity.voice.ArticleTagsEntity; +import com.epmet.entity.voice.TagCustomerEntity; import com.epmet.service.StatsPublicityService; import com.epmet.service.stats.*; -import com.epmet.service.voice.ArticleOperateRecordService; import com.epmet.service.voice.ArticleService; import com.epmet.service.voice.ArticleTagsService; import com.epmet.service.voice.ArticleVisitRecordService; +import com.epmet.service.voice.TagCustomerService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -28,7 +29,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; /** @@ -56,7 +56,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { @Autowired private ArticleVisitRecordService articleVisitRecordService; @Autowired - private ArticleOperateRecordService articleOperateRecordService; + private TagCustomerService tagCustomerService; @Autowired private FactArticlePublishedGridDailyService factArticlePublishedGridDailyService; @Autowired @@ -103,21 +103,19 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { private FactTagViewedGridYearlyService factTagViewedGridYearlyService; @Autowired private FactTagViewedAgencyYearlyService factTagViewedAgencyYearlyService; - @Autowired - private ExecutorService executorService; @Override public Boolean articleSummaryDailyStatsjob(Date statsDate) { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //查询的是昨天及以前的数据 - statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, -1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; String statsDateStr = DateUtils.format(statsDate); do { @@ -146,23 +144,25 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //当天的凌晨时间 即为今天之前的数据 - statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { Date finalStatsDate = statsDate; - //executorService.submit(() -> { - //统计 + //统计 + try { statsTagUsedDaily(finalStatsDate, dimIdBean, customerId); - //}); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagUsedDailyStatsjob", customerId, dimIdBean.getDateId()), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -174,25 +174,23 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //当天的凌晨时间 即为今天之前的数据 - statsDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { - statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { - executorService.submit(() -> { - try { - statsTagUsedMonthly(dimIdBean.getMonthId(), customerId); - } catch (Exception e) { - log.error("statsTagUsedMonthly exception", e); - } - }); + try { + statsTagUsedMonthly(dimIdBean.getMonthId(), customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagUsedMonthlyStatsjob", customerId, dimIdBean.getMonthId()), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -205,23 +203,23 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //当天的凌晨时间 即为今天之前的数据 - statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { - Date finalStatsDate = statsDate; - //executorService.submit(() -> { - //统计 - statsTagViewedDaily(finalStatsDate, dimIdBean, customerId); - //}); + try { + statsTagViewedDaily(statsDate, dimIdBean, customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedDailyStatsjob", customerId, dimIdBean.getDateId()), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -233,25 +231,23 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //当天的凌晨时间 即为今天之前的数据 - statsDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { - statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { - executorService.submit(() -> { - try { - statsTagViewedMonthly(dimIdBean.getMonthId(), customerId); - } catch (Exception e) { - log.error("statsTagViewedMonthly exception", e); - } - }); + try { + statsTagViewedMonthly(dimIdBean.getMonthId(), customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedMonthlyStatsjob", customerId, dimIdBean.getDateId()), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -263,34 +259,30 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //当天的凌晨时间 即为今天之前的数据 - statsDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { - statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { - executorService.submit(() -> { - try { - log.debug("start === statsTagUsedQuarterly "); - statsTagUsedQuarterly(dimIdBean.getQuarterId(), customerId); - } catch (Exception e) { - log.error("statsTagUsedQuarterly exception", e); - } - }); - executorService.submit(() -> { - try { - log.debug("start === statsTagUsedQuarterly "); - statsTagUsedYearly(dimIdBean.getYearId(), customerId); - } catch (Exception e) { - log.error("statsTagUsedYearly exception", e); - } - }); + try { + log.debug("start === statsTagUsedQuarterly "); + statsTagUsedQuarterly(dimIdBean.getQuarterId(), customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagUsedQuarterly", customerId, dimIdBean.getQuarterId()), e); + } + try { + log.debug("start === statsTagUsedQuarterly "); + statsTagUsedYearly(dimIdBean.getYearId(), customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagUsedYearly", customerId, dimIdBean.getYearId()), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -302,34 +294,30 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //如果不传时间 则统计数据为今天之前的数据和,否则统计的是截止到传入的日期数据的和 if (statsDate == null) { //当天的凌晨时间 即为今天之前的数据 - statsDate = DateUtils.integrate(new Date(), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(DateUtils.addDateDays(new Date(), -NumConstant.ONE), DateUtils.DATE_PATTERN); } else { - statsDate = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + statsDate = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); } DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate); - int pageNo = 1; - int pageSize = 100; + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; do { customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { - executorService.submit(() -> { - try { - log.debug("start === statsTagViewedQuarterly "); - statsTagViewedQuarterly(dimIdBean.getQuarterId(), customerId); - } catch (Exception e) { - log.error("statsTagUsedQuarterly exception", e); - } - }); - executorService.submit(() -> { - try { - log.debug("start === statsTagViewedYearly "); - statsTagViewedYearly(dimIdBean.getYearId(), customerId); - } catch (Exception e) { - log.error("statsTagUsedYearly exception", e); - } - }); + try { + log.debug("start === statsTagViewedQuarterly "); + statsTagViewedQuarterly(dimIdBean.getQuarterId(), customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getQuarterId()), e); + } + try { + log.debug("start === statsTagViewedYearly "); + statsTagViewedYearly(dimIdBean.getYearId(), customerId); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getYearId()), e); + } } } } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); @@ -343,7 +331,8 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { log.warn("publicitySummary getDepartmentListByCustomerId return empty,customerId:{}", customerId); return; } - executorService.submit(() -> { + + try { //转换为 需要插入的Entity Map departmentDailyEntityMap = convertDepartmentDailyEntity(departmentDTOList, dimIdBean); //获取当天的业务数据 @@ -363,8 +352,11 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { buildAgencySummaryData(agencySummaryMap, summaryDTO); } } - boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); - }); + factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); + } catch (Exception e) { + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedDepartmentDaily", customerId, statsDate), e); + } + } /** @@ -385,7 +377,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { summary.setArticleTotalCount(summaryDTO.getArticleTotalCount()); summary.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); summary.setPublishedCount(summaryDTO.getPublishedCount()); - result.put(summaryDTO.getPublisherId(), summaryDTO); + result.put(summaryDTO.getAgencyId(), summaryDTO); } else { publishedSummaryDTO.setArticlePublishedCount(publishedSummaryDTO.getArticlePublishedCount() + summaryDTO.getArticlePublishedCount()); publishedSummaryDTO.setArticleTotalCount(publishedSummaryDTO.getArticleTotalCount() + summaryDTO.getArticlePublishedCount()); @@ -394,7 +386,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { } /** - * desc:按日统计 网格纬度的 文章总数数据 + * desc:按日统计 文章总数数据 * * @param statsDate * @param dimIdBean @@ -408,32 +400,31 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { log.warn("publicitySummary getGridListByCustomerId return empty,customerId:{}", customerId); return; } - executorService.submit(() -> { - try { - //转换为 需要插入的Entity - Map gridDailyEntityMap = convertGridDailyEntity(gridDTOList, dimIdBean); - //获取当天的业务数据 - List publishedArticleCount = articleService.getAllGridPublishedCount(customerId, statsDate); - if (!CollectionUtils.isEmpty(publishedArticleCount)) { - for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { - FactArticlePublishedGridDailyEntity gridDailyEntity = gridDailyEntityMap.get(summaryDTO.getPublisherId()); - if (gridDailyEntity == null) { - log.error("publicitySummary getAllGridPublishedCount gridId:{} not exist in dimGrid", summaryDTO.getGridId()); - continue; - } - gridDailyEntity.setArticleTotalCount(summaryDTO.getArticleTotalCount()); - gridDailyEntity.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); - gridDailyEntity.setPublishedCount(summaryDTO.getPublishedCount()); - //同一个机关下数据累加 - buildAgencySummaryData(agencySummaryMap, summaryDTO); + + try { + //转换为 需要插入的Entity + Map gridDailyEntityMap = convertGridDailyEntity(gridDTOList, dimIdBean); + //获取当天的业务数据 + List publishedArticleCount = articleService.getAllGridPublishedCount(customerId, statsDate); + if (!CollectionUtils.isEmpty(publishedArticleCount)) { + for (ArticleGridPublishedSummaryDTO summaryDTO : publishedArticleCount) { + FactArticlePublishedGridDailyEntity gridDailyEntity = gridDailyEntityMap.get(summaryDTO.getPublisherId()); + if (gridDailyEntity == null) { + log.error("publicitySummary getAllGridPublishedCount gridId:{} not exist in dimGrid", summaryDTO.getGridId()); + continue; } + gridDailyEntity.setArticleTotalCount(summaryDTO.getArticleTotalCount()); + gridDailyEntity.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); + gridDailyEntity.setPublishedCount(summaryDTO.getPublishedCount()); + //同一个机关下数据累加 + buildAgencySummaryData(agencySummaryMap, summaryDTO); } - boolean b = factArticlePublishedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), gridDailyEntityMap.values()); - } catch (Exception e) { - log.error("statsPublishedGridDaily exception customerId:{},statsDate:{}", customerId, statsDate); } - }); - + boolean b = factArticlePublishedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), gridDailyEntityMap.values()); + } catch (Exception e) { + e.printStackTrace(); + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedGridDaily", customerId, statsDate), e); + } } private void statsPublishedAgencyDaily(String statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId, Map agencySummaryMap) { @@ -443,10 +434,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); return; } - executorService.submit(() -> { try { //转换为 需要插入的Entity Map agencyDailyEntityMap = convertAgencyDailyEntity(agencyDTOList, dimIdBean); + //获取当天的业务数据 List publishedArticleCount = articleService.getAllAgencyPublishedCount(customerId, statsDate); Map haveDataAgencyDailyMap = new HashMap<>(); @@ -461,13 +452,12 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { gridDailyEntities.setArticleTotalCount(summaryDTO.getArticleTotalCount()); gridDailyEntities.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); gridDailyEntities.setPublishedCount(summaryDTO.getPublishedCount()); + haveDataAgencyDailyMap.put(summaryDTO.getAgencyId(), gridDailyEntities); - //同一个机关下数据累加 - //buildAgencySummaryData(agencySummaryMap, summaryDTO); //构建机关自己的数据 FactArticlePublishedAgencyDailyEntity selfDaily = ConvertUtils.sourceToTarget(dimIdBean, FactArticlePublishedAgencyDailyEntity.class); selfDaily.setCustomerId(gridDailyEntities.getCustomerId()); - selfDaily.setPid(gridDailyEntities.getPid()); + selfDaily.setPid(summaryDTO.getAgencyId()); selfDaily.setAgencyId(summaryDTO.getAgencyId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX)); selfDaily.setArticleTotalCount(summaryDTO.getArticleTotalCount()); selfDaily.setArticlePublishedCount(summaryDTO.getArticlePublishedCount()); @@ -475,6 +465,20 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { haveDataAgencyDailySelfMap.put(selfDaily.getAgencyId(), selfDaily); } } + if (!CollectionUtils.isEmpty(agencySummaryMap)) { + //同一个机关下数据累加 + for (Map.Entry entry : agencySummaryMap.entrySet()) { + String agencyId = entry.getKey(); + ArticleGridPublishedSummaryDTO summary = entry.getValue(); + FactArticlePublishedAgencyDailyEntity dimAgencyEntity = agencyDailyEntityMap.get(agencyId); + if (dimAgencyEntity == null) { + continue; + } + dimAgencyEntity.setArticleTotalCount(dimAgencyEntity.getArticlePublishedCount() + summary.getArticleTotalCount()); + dimAgencyEntity.setArticlePublishedCount(dimAgencyEntity.getPublishedCount() + summary.getArticlePublishedCount()); + dimAgencyEntity.setPublishedCount(dimAgencyEntity.getPublishedCount() + summary.getPublishedCount()); + } + } //数据向上级机关添加 if (!CollectionUtils.isEmpty(haveDataAgencyDailyMap)) { for (Map.Entry entry : haveDataAgencyDailyMap.entrySet()) { @@ -492,102 +496,165 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { if (!CollectionUtils.isEmpty(haveDataAgencyDailySelfMap)) { agencyDailyEntityMap.putAll(haveDataAgencyDailySelfMap); } - log.debug("statsPublishedAgencyDaily insert:{}",JSON.toJSONString(agencyDailyEntityMap.values())); - boolean b = factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); + log.debug("statsPublishedAgencyDaily insert:{}", JSON.toJSONString(agencyDailyEntityMap.values())); + factArticlePublishedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), agencyDailyEntityMap.values()); } catch (Exception e) { - e.printStackTrace(); - log.error("statsPublishedAgencyDaily exception,customer:{}",customerId); + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedAgencyDaily", customerId, statsDate), e); } - }); - } /** - * desc:按日统计 网格纬度的 标签被使用的次数 + * desc:按日统计 标签被使用的次数 * * @param statsDate * @param dimIdBean * @param customerId */ private void statsTagUsedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) { - try { - //1.业务数据来源 发布时间为统计时间的 - // 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分 - // 1.1查出今天所有的文章标签 根据网格Id - // 1.2 - //获取所有网格 - List agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId); - if (CollectionUtils.isEmpty(agencyDTOList)) { - log.warn("publicitySummary getAgencyListByCustomerId return empty,customerId:{}", customerId); - return; - } - //转换为 需要插入的Entity - Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); - //转换为 需要插入的Entity key gridId_tagId - Map tagUsedGridDailyMap = new HashMap<>(); - Map tagUsedDeptDailyMap = new HashMap<>(); - Map tagUsedAgencyDailyMap = new HashMap<>(); - Map tagUsedAgencyDailySelfMap = new HashMap<>(); - //获取当天的业务数据 - //1获取文章及机关id,网格Id - List publishedArticleList = articleService.getPublishedArticleByPublishTime(customerId, DateUtils.format(statsDate)); - if (CollectionUtils.isEmpty(publishedArticleList)) { - return; - } + + //1.业务数据来源 发布时间为统计时间的 + // 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分 + // 1.1查出今天所有的文章标签 根据网格Id + // 1.2 + //获取所有网格 + List agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId); + if (CollectionUtils.isEmpty(agencyDTOList)) { + log.warn("statsTagUsedDaily getAgencyListByCustomerId return empty,customerId:{}", customerId); + return; + } + List gridDTOList = dimGridService.getGridListByCustomerId(customerId); + if (CollectionUtils.isEmpty(gridDTOList)) { + log.warn("statsTagUsedDaily getGridListByCustomerId return empty,customerId:{}", customerId); + } + List departmentDTOList = dimDepartmentService.getDepartmentListByCustomerId(customerId); + if (CollectionUtils.isEmpty(departmentDTOList)) { + log.warn("statsTagUsedDaily getDepartmentListByCustomerId return empty,customerId:{}", customerId); + } + //转换为 需要插入的Entity key gridId_tagId + Map tagUsedGridDailyMap = new HashMap<>(); + Map tagUsedDeptDailyMap = new HashMap<>(); + Map tagUsedAgencyDailyMap = new HashMap<>(); + Map tagUsedAgencyDailySelfMap = new HashMap<>(); + + //默认标签 + buildDefaultUsedTag(dimIdBean, customerId, agencyDTOList, gridDTOList, departmentDTOList, tagUsedGridDailyMap, tagUsedDeptDailyMap, tagUsedAgencyDailyMap, tagUsedAgencyDailySelfMap); + //转换为 需要插入的Entity + Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + + //获取当天的业务数据 + //1获取文章及机关id,网格Id + List publishedArticleList = articleService.getPublishedArticleByPublishTime(customerId, DateUtils.format(statsDate)); + if (!CollectionUtils.isEmpty(publishedArticleList)) { //KEY 文章Id Map articleMap = publishedArticleList.stream().collect(Collectors.toMap(ArticleEntity::getId, o -> o)); Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); - Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, NumConstant.ONE), DateUtils.DATE_PATTERN); //2 获取文章标签 List articleTagsList = articleTagsService.getArticleTagsByCreateTime(customerId, startTime, endTime); - if (CollectionUtils.isEmpty(articleTagsList)) { - log.error("publicitySummary getArticleTagsByCreateTime customerId:{} have not articleTags,publishedArticleList:{}", customerId, JSON.toJSONString(publishedArticleList)); - return; - } - //tagId - for (ArticleTagsEntity tagEntity : articleTagsList) { - ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); - if (articleEntity == null) { - log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); - return; - } - DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); - convertTagUsedAgencyDailyEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailyMap, articleEntity, tagEntity, dimIdBean); - switch (articleEntity.getPublisherType()) { - case ProjectConstant.PUBLISHER_TYPE_GRID: - convertTagUsedGridDailyEntity(tagUsedGridDailyMap, articleEntity, tagEntity, dimIdBean); - break; - case ProjectConstant.PUBLISHER_TYPE_DEPT: - convertTagUsedDepartmentDailyEntity(tagUsedDeptDailyMap, articleEntity, tagEntity, dimIdBean); - break; - case ProjectConstant.PUBLISHER_TYPE_AGENCY: - convertTagUsedAgencyDailySelfEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailySelfMap, articleEntity, tagEntity, dimIdBean); - break; + if (!CollectionUtils.isEmpty(articleTagsList)) { + //tagId + for (ArticleTagsEntity tagEntity : articleTagsList) { + ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); + if (articleEntity == null) { + log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); + continue; + } + DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); + convertTagUsedAgencyDailyEntity(dimAgencyEntity.getPid(), tagUsedAgencyDailyMap, articleEntity, tagEntity, dimIdBean); + switch (articleEntity.getPublisherType()) { + case ProjectConstant.PUBLISHER_TYPE_GRID: + convertTagUsedGridDailyEntity(tagUsedGridDailyMap, articleEntity, tagEntity, dimIdBean); + break; + case ProjectConstant.PUBLISHER_TYPE_DEPT: + convertTagUsedDepartmentDailyEntity(tagUsedDeptDailyMap, articleEntity, tagEntity, dimIdBean); + break; + case ProjectConstant.PUBLISHER_TYPE_AGENCY: + convertTagUsedAgencyDailySelfEntity(tagUsedAgencyDailySelfMap, articleEntity, tagEntity, dimIdBean); + break; + } } } + } - factTagUsedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedGridDailyMap.values()); - factTagUsedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedDeptDailyMap.values()); - //向上级机关递归添加 数据 - Map finalTagUsedAgencyDailyMap = new HashMap<>(); - finalTagUsedAgencyDailyMap.putAll(tagUsedAgencyDailyMap); - for (Map.Entry entry : tagUsedAgencyDailyMap.entrySet()) { - String agencyId = entry.getKey().split(StrConstant.UNDER_LINE)[0]; - FactTagUsedAgencyDailyEntity currentEntity = entry.getValue(); - DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(currentEntity.getAgencyId()); - if (dimAgencyEntity == null) { - log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", agencyId); - continue; - } - setTagUsedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, currentEntity, dimIdBean); - } - if (!CollectionUtils.isEmpty(tagUsedAgencyDailySelfMap)){ - finalTagUsedAgencyDailyMap.putAll(tagUsedAgencyDailySelfMap); + factTagUsedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedGridDailyMap.values()); + factTagUsedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), tagUsedDeptDailyMap.values()); + //向上级机关递归添加 数据 + Map finalTagUsedAgencyDailyMap = new HashMap<>(); + finalTagUsedAgencyDailyMap.putAll(tagUsedAgencyDailyMap); + List agencyDailyEntities = tagUsedAgencyDailyMap.values().stream().filter(uesedTag -> uesedTag.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()); + log.debug("===tagUsedAgencyDailyMap:" + JSON.toJSONString(tagUsedAgencyDailyMap.values().stream().filter(o -> o.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()))); + for (FactTagUsedAgencyDailyEntity entry : agencyDailyEntities) { + DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(entry.getAgencyId()); + if (dimAgencyEntity == null) { + log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", entry.getAgencyId()); + continue; } - factTagUsedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); - } catch (Exception e) { - e.printStackTrace(); - //log.error(); + setTagUsedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, entry, dimIdBean); + } + log.debug("===finalTagUsedAgencyDailyMap:" + JSON.toJSONString(finalTagUsedAgencyDailyMap.values().stream().filter(o -> o.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()))); + if (!CollectionUtils.isEmpty(tagUsedAgencyDailySelfMap)) { + finalTagUsedAgencyDailyMap.putAll(tagUsedAgencyDailySelfMap); + } + log.debug("===finalTagUsedAgencyDailyMap:" + JSON.toJSONString(finalTagUsedAgencyDailyMap.values().stream().filter(o -> o.getUsedCount() > NumConstant.ZERO).collect(Collectors.toList()))); + factTagUsedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); + + } + + private void buildDefaultUsedTag(DimIdGenerator.DimIdBean dimIdBean, String customerId, List agencyDTOList, List gridDTOList, List departmentDTOList, Map tagUsedGridDailyMap, Map tagUsedDeptDailyMap, Map tagUsedAgencyDailyMap, Map tagUsedAgencyDailySelfMap) { + List tagDefaultList = tagCustomerService.getTagDefaultList(customerId); + if (!CollectionUtils.isEmpty(tagDefaultList)) { + agencyDTOList.forEach(agency -> { + if (!CollectionUtils.isEmpty(gridDTOList)) { + gridDTOList.forEach(grid -> { + tagDefaultList.forEach(tag -> { + FactTagUsedGridDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedGridDailyEntity.class); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setGridId(grid.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(NumConstant.ZERO); + tagUsedGridDailyMap.put(grid.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + + }); + } + if (!CollectionUtils.isEmpty(departmentDTOList)) { + departmentDTOList.forEach(dept -> { + tagDefaultList.forEach(tag -> { + FactTagUsedDepartmentDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedDepartmentDailyEntity.class); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setDepartmentId(dept.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(NumConstant.ZERO); + tagUsedDeptDailyMap.put(dept.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); + } + tagDefaultList.forEach(tag -> { + FactTagUsedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedAgencyDailyEntity.class); + entity.setPid(agency.getPid()); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(NumConstant.ZERO); + tagUsedAgencyDailyMap.put(agency.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + tagDefaultList.forEach(tag -> { + FactTagUsedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedAgencyDailyEntity.class); + entity.setPid(agency.getId()); + entity.setCustomerId(customerId); + String agencyId = agency.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); + entity.setAgencyId(agencyId); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setUsedCount(NumConstant.ZERO); + tagUsedAgencyDailySelfMap.put(agencyId.concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); } } @@ -599,6 +666,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { * @param customerId */ private void statsTagViewedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) { + //1.业务数据来源 发布时间为统计时间的 // 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分 // 1.1查出今天所有的文章标签 根据网格Id @@ -613,50 +681,52 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { List dimGridList = dimGridService.getGridListByCustomerId(customerId); if (CollectionUtils.isEmpty(dimGridList)) { log.debug("statsTagViewedDaily customerId:{} have any grid", customerId); - return; } - Map dimGridEntityMap = dimGridList.stream().collect(Collectors.toMap(DimGridEntity::getId, o -> o)); - //转换为 需要插入的Entity - Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + //转换为 需要插入的Entity key gridId_tagId Map tagViewedGridDailyMap = new HashMap<>(); Map tagViewedAgencyDailyMap = new HashMap<>(); Map tagViewedAgencyDailySelfMap = new HashMap<>(); + + //默认标签 + buildDefaultViewedTag(dimIdBean, customerId, agencyDTOList, dimGridList, tagViewedGridDailyMap, tagViewedAgencyDailyMap, tagViewedAgencyDailySelfMap); + Map dimGridEntityMap = dimGridList.stream().collect(Collectors.toMap(DimGridEntity::getId, o -> o)); + //转换为 需要插入的Entity + Map dimAgencyEntityMap = agencyDTOList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o)); + //获取当天的业务数据 //1获取今天文章的阅读记录数 Date startTime = DateUtils.integrate(statsDate, DateUtils.DATE_PATTERN); - Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, 1), DateUtils.DATE_PATTERN); + Date endTime = DateUtils.integrate(DateUtils.addDateDays(statsDate, NumConstant.ONE), DateUtils.DATE_PATTERN); List visitRecordList = articleVisitRecordService.getArticleVisitByCreateTime(customerId, startTime, endTime); - if (CollectionUtils.isEmpty(visitRecordList)) { - return; - } - - for (ArticleViewedSummaryDTO viewedSummaryDTO : visitRecordList) { - List articleTagsList = articleTagsService.getArticleTagsByArticleId(customerId, viewedSummaryDTO.getArticleId()); - if (CollectionUtils.isEmpty(articleTagsList)) { - continue; - } - ArticleEntity articleEntity = articleService.selectArticleById(viewedSummaryDTO.getArticleId()); - if (articleEntity == null) { - continue; - } - boolean isAgencyPublished = false; - if (ProjectConstant.PUBLISHER_TYPE_AGENCY.equals(articleEntity.getPublisherType())) { - isAgencyPublished = true; - } - String gridId = viewedSummaryDTO.getGridId(); - DimGridEntity dimGridEntity = dimGridEntityMap.get(gridId); + if (!CollectionUtils.isEmpty(visitRecordList)) { + for (ArticleViewedSummaryDTO viewedSummaryDTO : visitRecordList) { + List articleTagsList = articleTagsService.getArticleTagsByArticleId(customerId, viewedSummaryDTO.getArticleId()); + if (CollectionUtils.isEmpty(articleTagsList)) { + continue; + } + ArticleEntity articleEntity = articleService.selectArticleById(viewedSummaryDTO.getArticleId()); + if (articleEntity == null) { + continue; + } + boolean isAgencyPublished = false; + if (ProjectConstant.PUBLISHER_TYPE_AGENCY.equals(articleEntity.getPublisherType())) { + isAgencyPublished = true; + } + String gridId = viewedSummaryDTO.getGridId(); + DimGridEntity dimGridEntity = dimGridEntityMap.get(gridId); - if (dimGridEntity == null) { - log.error("statsTagViewedDaily viewedRecord gridId:{} not exist in dimGridMap", gridId); - continue; - } - DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(dimGridEntity.getAgencyId()); - for (ArticleTagsEntity articleTag : articleTagsList) { - convertTagViewedGridDailyEntity(dimAgencyEntity, tagViewedGridDailyMap, articleTag, viewedSummaryDTO, dimIdBean); - convertTagViewedAgencyDailyEntity(dimAgencyEntity, tagViewedAgencyDailyMap, articleTag, viewedSummaryDTO, dimIdBean); - if (isAgencyPublished) { - convertTagViewedAgencyDailySelfEntity(dimAgencyEntity, tagViewedAgencyDailySelfMap, articleTag, viewedSummaryDTO, dimIdBean); + if (dimGridEntity == null) { + log.error("statsTagViewedDaily viewedRecord gridId:{} not exist in dimGridMap", gridId); + continue; + } + DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(dimGridEntity.getAgencyId()); + for (ArticleTagsEntity articleTag : articleTagsList) { + convertTagViewedGridDailyEntity(dimAgencyEntity, tagViewedGridDailyMap, articleTag, viewedSummaryDTO, dimIdBean); + convertTagViewedAgencyDailyEntity(dimAgencyEntity, tagViewedAgencyDailyMap, articleTag, viewedSummaryDTO, dimIdBean); + if (isAgencyPublished) { + convertTagViewedAgencyDailySelfEntity(dimAgencyEntity, tagViewedAgencyDailySelfMap, articleTag, viewedSummaryDTO, dimIdBean); + } } } } @@ -666,16 +736,14 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { //向上级机关递归添加 数据 Map finalTagUsedAgencyDailyMap = new HashMap<>(); finalTagUsedAgencyDailyMap.putAll(tagViewedAgencyDailyMap); - for (Map.Entry entry : tagViewedAgencyDailyMap.entrySet()) { - String agencyId = entry.getKey(); - FactTagViewedAgencyDailyEntity currentEntity = entry.getValue(); - DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(currentEntity.getAgencyId()); + List tagViewedList = tagViewedAgencyDailyMap.values().stream().filter(tagViewed -> tagViewed.getTagReadCount() > NumConstant.ZERO).collect(Collectors.toList()); + for (FactTagViewedAgencyDailyEntity entry : tagViewedList) { + DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(entry.getAgencyId()); if (dimAgencyEntity == null) { - - log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", agencyId); + log.error("dimAgencyEntityMap bizData agencyId:{} not exist in dimAgency", entry.getAgencyId()); continue; } - setTagViewedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, currentEntity, dimIdBean); + setTagViewedData2ParentAgency(dimAgencyEntityMap, finalTagUsedAgencyDailyMap, entry, dimIdBean); } if (!CollectionUtils.isEmpty(tagViewedAgencyDailySelfMap)) { finalTagUsedAgencyDailyMap.putAll(tagViewedAgencyDailySelfMap); @@ -683,6 +751,49 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { factTagViewedAgencyDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), finalTagUsedAgencyDailyMap.values()); } + private void buildDefaultViewedTag(DimIdGenerator.DimIdBean dimIdBean, String customerId, List agencyDTOList, List dimGridList, Map tagViewedGridDailyMap, Map tagViewedAgencyDailyMap, Map tagViewedAgencyDailySelfMap) { + List tagDefaultList = tagCustomerService.getTagDefaultList(customerId); + if (!CollectionUtils.isEmpty(tagDefaultList)) { + agencyDTOList.forEach(agency -> { + if (!CollectionUtils.isEmpty(dimGridList)) { + dimGridList.forEach(grid -> { + tagDefaultList.forEach(tag -> { + FactTagViewedGridDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedGridDailyEntity.class); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setGridId(grid.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setTagReadCount(NumConstant.ZERO); + tagViewedGridDailyMap.put(grid.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); + } + tagDefaultList.forEach(tag -> { + FactTagViewedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); + entity.setPid(agency.getPid()); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setTagReadCount(NumConstant.ZERO); + tagViewedAgencyDailyMap.put(agency.getId().concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + tagDefaultList.forEach(tag -> { + FactTagViewedAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); + entity.setPid(agency.getId()); + entity.setCustomerId(customerId); + String agencyId = agency.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); + entity.setAgencyId(agencyId); + entity.setTagId(tag.getId()); + entity.setTagName(tag.getTagName()); + entity.setTagReadCount(NumConstant.ZERO); + tagViewedAgencyDailySelfMap.put(agencyId.concat(StrConstant.UNDER_LINE).concat(tag.getId()), entity); + }); + }); + } + } + /** * desc:按月统计 标签使用数 * @@ -763,7 +874,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { List gridQuarterlyList = ConvertUtils.sourceToTarget(gridMonthlyList, FactTagViewedGridQuarterlyEntity.class); factTagViewedGridQuarterlyService.deleteAndInsertByQuarterId(customerId, quarterId, gridQuarterlyList); } - List agencyMonthlyList = factTagViewedAgencyMonthlyService.getTagViewedCountByQuarterId(customerId, quarterId); if (!CollectionUtils.isEmpty(agencyMonthlyList)) { List agencyQuarterlyList = ConvertUtils.sourceToTarget(agencyMonthlyList, FactTagViewedAgencyQuarterlyEntity.class); @@ -848,6 +958,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { FactTagViewedAgencyDailyEntity parentAgencyDailyEntity = agencyDailyEntityMap.get(key); DimAgencyEntity currentDimAgency = dimAgencyEntityMap.get(pid); if (currentDimAgency == null) { + log.error("setTagViewedData2ParentAgency pid:{} not exist in dimAgency", pid); return; } if (parentAgencyDailyEntity == null) { @@ -872,6 +983,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { String pid = summary.getPid(); FactArticlePublishedAgencyDailyEntity parentAgency = agencyDailyEntityMap.get(pid); if (parentAgency == null) { + log.error("setPublishedData2ParentAgency pid:{} not exist in dimAgency", pid); return; } parentAgency.setArticleTotalCount(parentAgency.getArticleTotalCount() + agencySummary.getArticleTotalCount()); @@ -897,9 +1009,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { entity.setCustomerId(dimGridEntity.getCustomerId()); entity.setAgencyId(dimGridEntity.getAgencyId()); entity.setGridId(dimGridEntity.getId()); - entity.setArticleTotalCount(0); - entity.setArticlePublishedCount(0); - entity.setPublishedCount(0); + entity.setArticleTotalCount(NumConstant.ZERO); + entity.setArticlePublishedCount(NumConstant.ZERO); + entity.setPublishedCount(NumConstant.ZERO); result.put(dimGridEntity.getId(), entity); }); return result; @@ -919,9 +1031,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { entity.setCustomerId(dimGridEntity.getCustomerId()); entity.setAgencyId(dimGridEntity.getAgencyId()); entity.setDepartmentId(dimGridEntity.getId()); - entity.setArticleTotalCount(0); - entity.setArticlePublishedCount(0); - entity.setPublishedCount(0); + entity.setArticleTotalCount(NumConstant.ZERO); + entity.setArticlePublishedCount(NumConstant.ZERO); + entity.setPublishedCount(NumConstant.ZERO); result.put(dimGridEntity.getId(), entity); }); return result; @@ -941,9 +1053,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { entity.setCustomerId(dimGridEntity.getCustomerId()); entity.setPid(dimGridEntity.getPid()); entity.setAgencyId(dimGridEntity.getId()); - entity.setArticleTotalCount(0); - entity.setArticlePublishedCount(0); - entity.setPublishedCount(0); + entity.setArticleTotalCount(NumConstant.ZERO); + entity.setArticlePublishedCount(NumConstant.ZERO); + entity.setPublishedCount(NumConstant.ZERO); result.put(dimGridEntity.getId(), entity); }); return result; @@ -953,25 +1065,9 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { /** * desc:将网格对象构建为 tagUsedGridDaily 对象 * - * @param dimGridEntities * @param dimIdBean * @return */ - private Map convertTagUsedGridDailyEntity(List dimGridEntities, DimIdGenerator.DimIdBean dimIdBean) { - Map result = new HashMap<>(); - dimGridEntities.forEach(dimGridEntity -> { - FactTagUsedGridDailyEntity entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedGridDailyEntity.class); - entity.setCustomerId(dimGridEntity.getCustomerId()); - entity.setAgencyId(dimGridEntity.getAgencyId()); - entity.setGridId(dimGridEntity.getId()); - entity.setTagId(""); - entity.setTagName(""); - entity.setUsedCount(0); - result.put(dimGridEntity.getId(), entity); - }); - return result; - } - private void convertTagUsedGridDailyEntity(Map result, ArticleEntity articleEntity, ArticleTagsEntity tagEntity, DimIdGenerator.DimIdBean dimIdBean) { String gridId = articleEntity.getPublisherId(); String tagId = tagEntity.getTagId(); @@ -984,10 +1080,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { entity.setGridId(gridId); entity.setTagId(tagId); entity.setTagName(tagEntity.getTagName()); - entity.setUsedCount(1); + entity.setUsedCount(NumConstant.ONE); result.put(key, entity); } else { - entity.setUsedCount(entity.getUsedCount() + 1); + entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); } } @@ -1003,10 +1099,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { entity.setDepartmentId(publisherId); entity.setTagId(tagId); entity.setTagName(tagEntity.getTagName()); - entity.setUsedCount(1); + entity.setUsedCount(NumConstant.ONE); result.put(key, entity); } else { - entity.setUsedCount(entity.getUsedCount() + 1); + entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); } } @@ -1022,29 +1118,29 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { entity.setAgencyId(agencyId); entity.setTagId(tagId); entity.setTagName(tagEntity.getTagName()); - entity.setUsedCount(1); + entity.setUsedCount(NumConstant.ONE); result.put(key, entity); } else { - entity.setUsedCount(entity.getUsedCount() + 1); + entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); } } - private void convertTagUsedAgencyDailySelfEntity(String pid, Map result, ArticleEntity articleEntity, ArticleTagsEntity tagEntity, DimIdGenerator.DimIdBean dimIdBean) { + private void convertTagUsedAgencyDailySelfEntity(Map result, ArticleEntity articleEntity, ArticleTagsEntity tagEntity, DimIdGenerator.DimIdBean dimIdBean) { String agencyId = articleEntity.getOrgId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); String tagId = tagEntity.getTagId(); String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); FactTagUsedAgencyDailyEntity entity = result.get(key); if (entity == null) { entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagUsedAgencyDailyEntity.class); - entity.setPid(pid); + entity.setPid(articleEntity.getOrgId()); entity.setCustomerId(articleEntity.getCustomerId()); entity.setAgencyId(agencyId); entity.setTagId(tagId); entity.setTagName(tagEntity.getTagName()); - entity.setUsedCount(1); + entity.setUsedCount(NumConstant.ONE); result.put(key, entity); } else { - entity.setUsedCount(entity.getUsedCount() + 1); + entity.setUsedCount(entity.getUsedCount() + NumConstant.ONE); } } @@ -1053,7 +1149,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { String gridId = viewedSummaryDTO.getGridId(); String tagId = tagEntity.getTagId(); String key = gridId.concat(StrConstant.UNDER_LINE).concat(tagId); - Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); + Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? NumConstant.ZERO : viewedSummaryDTO.getViewedCount(); FactTagViewedGridDailyEntity entity = result.get(key); if (entity == null) { entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedGridDailyEntity.class); @@ -1074,7 +1170,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { String agencyId = dimAgencyEntity.getId(); String tagId = tagEntity.getTagId(); String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); - Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); + Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? NumConstant.ZERO : viewedSummaryDTO.getViewedCount(); FactTagViewedAgencyDailyEntity entity = result.get(key); if (entity == null) { entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); @@ -1095,11 +1191,11 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { String agencyId = dimAgencyEntity.getId().concat(DimAgencyConstant.TYPE_SELF_ID_SUFFIX); String tagId = tagEntity.getTagId(); String key = agencyId.concat(StrConstant.UNDER_LINE).concat(tagId); - Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? 0 : viewedSummaryDTO.getViewedCount(); + Integer viewedCount = viewedSummaryDTO.getViewedCount() == null ? NumConstant.ZERO : viewedSummaryDTO.getViewedCount(); FactTagViewedAgencyDailyEntity entity = result.get(key); if (entity == null) { entity = ConvertUtils.sourceToTarget(dimIdBean, FactTagViewedAgencyDailyEntity.class); - entity.setPid(dimAgencyEntity.getPid()); + entity.setPid(dimAgencyEntity.getId()); entity.setCustomerId(tagEntity.getCustomerId()); entity.setAgencyId(agencyId); entity.setTagId(tagId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java new file mode 100644 index 0000000000..911281919b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java @@ -0,0 +1,114 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.ProjectConstant; +import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.stats.DimTopicStatusDTO; +import com.epmet.dto.stats.topic.result.TopicStatisticalData; +import com.epmet.service.StatsTopicService; +import com.epmet.service.stats.DimAgencyService; +import com.epmet.service.stats.DimCustomerService; +import com.epmet.service.stats.DimTopicStatusService; +import com.epmet.service.stats.topic.TopicStatisticalService; +import com.epmet.service.topic.TopicService; +import com.epmet.util.DimIdGenerator; +import com.epmet.util.ModuleConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; + +/** + * @Description 话题统计Service + * @ClassName StatsTopicServiceImpl + * @Auth wangc + * @Date 2020-06-23 15:22 + */ +@Service +public class StatsTopicServiceImpl implements StatsTopicService { + + protected static final Logger log = LoggerFactory.getLogger(StatsTopicServiceImpl.class); + + @Autowired + private DimCustomerService dimCustomerService; + + @Autowired + private DimAgencyService dimAgencyService; + + @Autowired + private DimTopicStatusService dimTopicStatusService; + + @Autowired + private TopicService topicService; + + @Autowired + private TopicStatisticalService topicStatisticalService; + + /** + * @Description 分区统计,按照客户Id划分 + * @param date 如果目标日期为空,则自动计算为T-1天 + * @return + * @author wangc + * @date 2020.06.28 14:38 + **/ + @Override + public void partition(Date date) { + + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; + List customerIdList = null; + do { + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + for (String customerId : customerIdList) { + //遍历统计每一个客户数据 + generate(customerId,date); + } + } + } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); + + } + + /** + * @Description 生成话题统计数据 + * @param customerId - 客户Id + * @parma date - 目标日期 + * @return + * @author wangc + * @date 2020.06.28 14:50 + **/ + void generate(String customerId,Date date){ + //1.初始化时间参数 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.DATE, NumConstant.ONE_NEG); + calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); + calendar.set(Calendar.MINUTE, NumConstant.ZERO); + calendar.set(Calendar.SECOND, NumConstant.ZERO); + //2.初始化时间维度 + DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); + + //3.初始化话题状态维度 + Map topicStatusParams = new HashMap<>(); + topicStatusParams.put(FieldConstant.DEL_FLAG_HUMP, NumConstant.ZERO_STR); + List topicStatusDimension = dimTopicStatusService.list(topicStatusParams); + + //4.初始化机关维度 + List agencies = dimAgencyService.getAllAgency(customerId); + + //5.计算统计数据 + try { + TopicStatisticalData data = + topicService.compute(agencies, date, timeDimension, customerId, topicStatusDimension); + //6.生成唯一性统计数据 + topicStatisticalService.insertUniquely(data); + }catch(Exception e){ + log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_TOPIC_STATISTICAL, customerId, new Date().toString(), e.getMessage())); + } + + } +} 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 new file mode 100644 index 0000000000..17fd8ccfc6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -0,0 +1,114 @@ +package com.epmet.service.impl; + + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.ProjectConstant; +import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.service.StatsUserService; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + + +/** + * @Description 生成用户统计信息 + * @ClassName StatsUserServiceImpl + * @Auth wangc + * @Date 2020-06-23 15:21 + */ +@Service +public class StatsUserServiceImpl implements StatsUserService { + + protected static final Logger log = LoggerFactory.getLogger(StatsUserServiceImpl.class); + + @Autowired + private DimCustomerService dimCustomerService; + + @Autowired + private DimAgencyService dimAgencyService; + + @Autowired + private UserService userService; + + @Autowired + private UserStatisticalService userStatisticalService; + + /** + * @Description 分区统计,按照客户Id划分 + * @param date 如果目标日期为空,则自动计算为T-1天 + * @return + * @author wangc + * @date 2020.06.28 14:38 + **/ + @Override + public void partition(Date date) { + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; + List customerIdList = null; + do { + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + for (String customerId : customerIdList) { + //遍历统计每一个客户数据 + generate(customerId,date); + } + } + } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); + + } + + /** + * @Description 生成用户统计数据 + * @param customerId 客户Id + * @param date 目标日期 + * @return + * @author wangc + * @date 2020.06.28 14:40 + **/ + void generate(String customerId,Date date){ + //1.初始化时间参数 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + //获取当日的零点 + calendar.add(Calendar.DATE, NumConstant.ONE_NEG); + calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); + calendar.set(Calendar.MINUTE, NumConstant.ZERO); + calendar.set(Calendar.SECOND, NumConstant.ZERO); + + //2.初始化时间维度 + DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); + + //3.初始化机关维度 + List agencies = dimAgencyService.getAllAgency(customerId); + //List topAgencies = dimAgencyService.getTopAgency(customerId); + + //4.计算机关统计数据、生成唯一性统计数据 + try { + UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); + userStatisticalService.insertUniquely(agencyData); + }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())); + } + + //5.计算网格统计数据、生成唯一性统计数据 + try { + UserStatisticalData gridData = userService.traverseGridUser(agencies, date, timeDimension); + userStatisticalService.insertUniquely(gridData); + }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())); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index 95c305943d..8d4e8d938d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java @@ -118,7 +118,7 @@ public interface DimAgencyService extends BaseService { * @author wangc * @date 2020.06.18 09:45 **/ - List getAllAgency(); + List getAllAgency(String customerId); /** * @Description 查询顶级机关以及它下级机关的信息 @@ -127,7 +127,7 @@ public interface DimAgencyService extends BaseService { * @author wangc * @date 2020.06.18 09:45 **/ - List getTopAgency(); + List getTopAgency(String customerId); /** * desc: 根据客户Id 获取机关列表数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index ef1c918895..fe45c20ddc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -174,8 +174,8 @@ public class DimAgencyServiceImpl extends BaseServiceImpl getAllAgency() { - return baseDao.selectAllAgency(); + public List getAllAgency(String customerId) { + return baseDao.selectAllAgency(customerId); } @@ -187,8 +187,8 @@ public class DimAgencyServiceImpl extends BaseServiceImpl getTopAgency() { - return baseDao.selectTopAgency(); + public List getTopAgency(String customerId) { + return baseDao.selectTopAgency(customerId); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java index f6f0d9ee55..15ae161fbb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDateServiceImpl.java @@ -115,20 +115,19 @@ public class DimDateServiceImpl extends BaseServiceImpl getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); + String delFlag = (String)params.get(FieldConstant.DEL_FLAG_HUMP); + if(StringUtils.isBlank(delFlag)) delFlag = NumConstant.ZERO_STR; QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - + wrapper.eq(FieldConstant.DEL_FLAG,delFlag); return wrapper; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimWeekServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimWeekServiceImpl.java index 45359643cf..46c00761af 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimWeekServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimWeekServiceImpl.java @@ -117,7 +117,7 @@ public class DimWeekServiceImpl 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicIssueAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueAgencyDailyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicIssueAgencyDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicIssueAgencyDailyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicIssueAgencyDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicIssueAgencyDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicIssueAgencyDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueAgencyMonthlyService.java new file mode 100644 index 0000000000..0d4a48ea5a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueAgencyMonthlyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicIssueAgencyMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueAgencyMonthlyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-机关月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicIssueAgencyMonthlyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicIssueAgencyMonthlyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicIssueAgencyMonthlyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicIssueAgencyMonthlyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicIssueAgencyMonthlyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueGridDailyService.java new file mode 100644 index 0000000000..12e23274a8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueGridDailyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicIssueGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueGridDailyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicIssueGridDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicIssueGridDailyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicIssueGridDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicIssueGridDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicIssueGridDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueGridMonthlyService.java new file mode 100644 index 0000000000..3101304a62 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicIssueGridMonthlyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicIssueGridMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueGridMonthlyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-网格月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicIssueGridMonthlyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicIssueGridMonthlyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicIssueGridMonthlyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicIssueGridMonthlyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicIssueGridMonthlyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusAgencyDailyService.java new file mode 100644 index 0000000000..b653a4fee7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusAgencyDailyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicStatusAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusAgencyDailyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 状态话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicStatusAgencyDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicStatusAgencyDailyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicStatusAgencyDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicStatusAgencyDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicStatusAgencyDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusAgencyMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusAgencyMonthlyService.java new file mode 100644 index 0000000000..55c0b5adf3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusAgencyMonthlyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicStatusAgencyMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusAgencyMonthlyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 状态话题-机关月统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicStatusAgencyMonthlyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicStatusAgencyMonthlyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicStatusAgencyMonthlyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicStatusAgencyMonthlyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicStatusAgencyMonthlyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusGridDailyService.java new file mode 100644 index 0000000000..8a76bb9707 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicStatusGridDailyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicStatusGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusGridDailyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 状态话题-网格日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicStatusGridDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicStatusGridDailyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicStatusGridDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicStatusGridDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicStatusGridDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicTotalAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicTotalAgencyDailyService.java new file mode 100644 index 0000000000..4a5800f3fc --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicTotalAgencyDailyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicTotalAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicTotalAgencyDailyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 话题总数-机关日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicTotalAgencyDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicTotalAgencyDailyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicTotalAgencyDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicTotalAgencyDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicTotalAgencyDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicTotalGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicTotalGridDailyService.java new file mode 100644 index 0000000000..c4fc1cd71e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/FactTopicTotalGridDailyService.java @@ -0,0 +1,96 @@ +/** + * 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.stats.topic; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicTotalGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicTotalGridDailyEntity; + + +import java.util.List; +import java.util.Map; + +/** + * 话题总数-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +public interface FactTopicTotalGridDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicTotalGridDailyDTO + * @author generator + * @date 2020-06-20 + */ + FactTopicTotalGridDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void save(FactTopicTotalGridDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-20 + */ + void update(FactTopicTotalGridDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/TopicStatisticalService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/TopicStatisticalService.java new file mode 100644 index 0000000000..6482b543b6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/TopicStatisticalService.java @@ -0,0 +1,8 @@ +package com.epmet.service.stats.topic; + +import com.epmet.dto.stats.topic.result.TopicStatisticalData; + +public interface TopicStatisticalService { + + void insertUniquely(TopicStatisticalData data); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueAgencyDailyServiceImpl.java new file mode 100644 index 0000000000..614e95486e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueAgencyDailyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicIssueAgencyDailyDao; +import com.epmet.dto.stats.topic.FactTopicIssueAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueAgencyDailyEntity; +import com.epmet.service.stats.topic.FactTopicIssueAgencyDailyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicIssueAgencyDailyServiceImpl extends BaseServiceImpl implements FactTopicIssueAgencyDailyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicIssueAgencyDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicIssueAgencyDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicIssueAgencyDailyDTO get(String id) { + FactTopicIssueAgencyDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicIssueAgencyDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicIssueAgencyDailyDTO dto) { + FactTopicIssueAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueAgencyDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicIssueAgencyDailyDTO dto) { + FactTopicIssueAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueAgencyDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueAgencyMonthlyServiceImpl.java new file mode 100644 index 0000000000..5e7e0c6d2a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueAgencyMonthlyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicIssueAgencyMonthlyDao; +import com.epmet.dto.stats.topic.FactTopicIssueAgencyMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueAgencyMonthlyEntity; +import com.epmet.service.stats.topic.FactTopicIssueAgencyMonthlyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-机关月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicIssueAgencyMonthlyServiceImpl extends BaseServiceImpl implements FactTopicIssueAgencyMonthlyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicIssueAgencyMonthlyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicIssueAgencyMonthlyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicIssueAgencyMonthlyDTO get(String id) { + FactTopicIssueAgencyMonthlyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicIssueAgencyMonthlyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicIssueAgencyMonthlyDTO dto) { + FactTopicIssueAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueAgencyMonthlyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicIssueAgencyMonthlyDTO dto) { + FactTopicIssueAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueAgencyMonthlyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueGridDailyServiceImpl.java new file mode 100644 index 0000000000..5d9e805fb8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueGridDailyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicIssueGridDailyDao; +import com.epmet.dto.stats.topic.FactTopicIssueGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueGridDailyEntity; +import com.epmet.service.stats.topic.FactTopicIssueGridDailyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicIssueGridDailyServiceImpl extends BaseServiceImpl implements FactTopicIssueGridDailyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicIssueGridDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicIssueGridDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicIssueGridDailyDTO get(String id) { + FactTopicIssueGridDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicIssueGridDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicIssueGridDailyDTO dto) { + FactTopicIssueGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueGridDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicIssueGridDailyDTO dto) { + FactTopicIssueGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueGridDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueGridMonthlyServiceImpl.java new file mode 100644 index 0000000000..9f3004f690 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicIssueGridMonthlyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicIssueGridMonthlyDao; +import com.epmet.dto.stats.topic.FactTopicIssueGridMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicIssueGridMonthlyEntity; +import com.epmet.service.stats.topic.FactTopicIssueGridMonthlyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 转议题话题-网格月统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicIssueGridMonthlyServiceImpl extends BaseServiceImpl implements FactTopicIssueGridMonthlyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicIssueGridMonthlyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicIssueGridMonthlyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicIssueGridMonthlyDTO get(String id) { + FactTopicIssueGridMonthlyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicIssueGridMonthlyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicIssueGridMonthlyDTO dto) { + FactTopicIssueGridMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueGridMonthlyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicIssueGridMonthlyDTO dto) { + FactTopicIssueGridMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicIssueGridMonthlyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusAgencyDailyServiceImpl.java new file mode 100644 index 0000000000..d6644f4c26 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusAgencyDailyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicStatusAgencyDailyDao; +import com.epmet.dto.stats.topic.FactTopicStatusAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusAgencyDailyEntity; +import com.epmet.service.stats.topic.FactTopicStatusAgencyDailyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 状态话题-机关日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicStatusAgencyDailyServiceImpl extends BaseServiceImpl implements FactTopicStatusAgencyDailyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicStatusAgencyDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicStatusAgencyDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicStatusAgencyDailyDTO get(String id) { + FactTopicStatusAgencyDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicStatusAgencyDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicStatusAgencyDailyDTO dto) { + FactTopicStatusAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicStatusAgencyDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicStatusAgencyDailyDTO dto) { + FactTopicStatusAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicStatusAgencyDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusAgencyMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusAgencyMonthlyServiceImpl.java new file mode 100644 index 0000000000..86c88ed82b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusAgencyMonthlyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicStatusAgencyMonthlyDao; +import com.epmet.dto.stats.topic.FactTopicStatusAgencyMonthlyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusAgencyMonthlyEntity; +import com.epmet.service.stats.topic.FactTopicStatusAgencyMonthlyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 状态话题-机关月统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicStatusAgencyMonthlyServiceImpl extends BaseServiceImpl implements FactTopicStatusAgencyMonthlyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicStatusAgencyMonthlyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicStatusAgencyMonthlyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicStatusAgencyMonthlyDTO get(String id) { + FactTopicStatusAgencyMonthlyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicStatusAgencyMonthlyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicStatusAgencyMonthlyDTO dto) { + FactTopicStatusAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicStatusAgencyMonthlyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicStatusAgencyMonthlyDTO dto) { + FactTopicStatusAgencyMonthlyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicStatusAgencyMonthlyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusGridDailyServiceImpl.java new file mode 100644 index 0000000000..af4e77a184 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicStatusGridDailyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicStatusGridDailyDao; +import com.epmet.dto.stats.topic.FactTopicStatusGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicStatusGridDailyEntity; +import com.epmet.service.stats.topic.FactTopicStatusGridDailyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 状态话题-网格日统计数据表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicStatusGridDailyServiceImpl extends BaseServiceImpl implements FactTopicStatusGridDailyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicStatusGridDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicStatusGridDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicStatusGridDailyDTO get(String id) { + FactTopicStatusGridDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicStatusGridDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicStatusGridDailyDTO dto) { + FactTopicStatusGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicStatusGridDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicStatusGridDailyDTO dto) { + FactTopicStatusGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicStatusGridDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicTotalAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicTotalAgencyDailyServiceImpl.java new file mode 100644 index 0000000000..351a6f2e29 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicTotalAgencyDailyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicTotalAgencyDailyDao; +import com.epmet.dto.stats.topic.FactTopicTotalAgencyDailyDTO; +import com.epmet.entity.stats.topic.FactTopicTotalAgencyDailyEntity; +import com.epmet.service.stats.topic.FactTopicTotalAgencyDailyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 话题总数-机关日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicTotalAgencyDailyServiceImpl extends BaseServiceImpl implements FactTopicTotalAgencyDailyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicTotalAgencyDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicTotalAgencyDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicTotalAgencyDailyDTO get(String id) { + FactTopicTotalAgencyDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicTotalAgencyDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicTotalAgencyDailyDTO dto) { + FactTopicTotalAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicTotalAgencyDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicTotalAgencyDailyDTO dto) { + FactTopicTotalAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicTotalAgencyDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicTotalGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicTotalGridDailyServiceImpl.java new file mode 100644 index 0000000000..53316ce9bb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/FactTopicTotalGridDailyServiceImpl.java @@ -0,0 +1,102 @@ +/** + * 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.stats.topic.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.stats.topic.FactTopicTotalGridDailyDao; +import com.epmet.dto.stats.topic.FactTopicTotalGridDailyDTO; +import com.epmet.entity.stats.topic.FactTopicTotalGridDailyEntity; +import com.epmet.service.stats.topic.FactTopicTotalGridDailyService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 话题总数-网格日统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-20 + */ +@Service +public class FactTopicTotalGridDailyServiceImpl extends BaseServiceImpl implements FactTopicTotalGridDailyService { + + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicTotalGridDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicTotalGridDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicTotalGridDailyDTO get(String id) { + FactTopicTotalGridDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicTotalGridDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicTotalGridDailyDTO dto) { + FactTopicTotalGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicTotalGridDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicTotalGridDailyDTO dto) { + FactTopicTotalGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicTotalGridDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/TopicStatisticalServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/TopicStatisticalServiceImpl.java new file mode 100644 index 0000000000..e70e4f7afe --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/topic/impl/TopicStatisticalServiceImpl.java @@ -0,0 +1,124 @@ +package com.epmet.service.stats.topic.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dao.stats.topic.*; +import com.epmet.dto.stats.topic.result.TopicStatisticalData; +import com.epmet.service.stats.topic.TopicStatisticalService; +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; + +/** + * @Description + * @ClassName TopicStatisticalServiceImpl + * @Auth wangc + * @Date 2020-06-23 14:29 + */ +@Service +public class TopicStatisticalServiceImpl implements TopicStatisticalService { + + private static final Logger logger = LoggerFactory.getLogger(TopicStatisticalServiceImpl.class); + + @Autowired + private FactTopicIssueAgencyDailyDao topicIssueAgencyDailyDao; + + @Autowired + private FactTopicIssueAgencyMonthlyDao topicIssueAgencyMonthlyDao; + + @Autowired + private FactTopicIssueGridDailyDao topicIssueGridDailyDao; + + @Autowired + private FactTopicIssueGridMonthlyDao topicIssueGridMonthlyDao; + + @Autowired + private FactTopicStatusAgencyDailyDao topicStatusAgencyDailyDao; + + @Autowired + private FactTopicStatusAgencyMonthlyDao topicStatusAgencyMonthlyDao; + + @Autowired + private FactTopicStatusGridDailyDao topicStatusGridDailyDao; + + @Autowired + private FactTopicTotalAgencyDailyDao topicTotalAgencyDailyDao; + + @Autowired + private FactTopicTotalGridDailyDao topicTotalGridDailyDao; + + @Override + @Transactional(rollbackFor = Exception.class) + public void insertUniquely(TopicStatisticalData data) { + if(null == data) return; + + if(StringUtils.isBlank(data.getDateId()) || StringUtils.isBlank(data.getMonthId())){ + logger.warn("缺失重要参数:dateId或monthId"); + return ; + } + + if(null != data.getIssueAgencyDailyList() && data.getIssueAgencyDailyList().size() > NumConstant.ZERO){ + + topicIssueAgencyDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + topicIssueAgencyDailyDao.insertBatch(data.getIssueAgencyDailyList()); + } + + if(null != data.getIssueAgencyMonthlyList() && data.getIssueAgencyMonthlyList().size() > NumConstant.ZERO){ + + topicIssueAgencyMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + topicIssueAgencyMonthlyDao.insertBatch(data.getIssueAgencyMonthlyList()); + + } + + if(null != data.getIssueGridDailyList() && data.getIssueGridDailyList().size() > NumConstant.ZERO){ + + topicIssueGridDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + topicIssueGridDailyDao.insertBatch(data.getIssueGridDailyList()); + + } + + if(null != data.getIssueGridMonthlyList() && data.getIssueGridMonthlyList().size() > NumConstant.ZERO){ + + topicIssueGridMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + topicIssueGridMonthlyDao.insertBatch(data.getIssueGridMonthlyList()); + + } + + if(null != data.getTopicAgencyDailyList() && data.getTopicAgencyDailyList().size() > NumConstant.ZERO){ + + topicStatusAgencyDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + topicStatusAgencyDailyDao.insertBatch(data.getTopicAgencyDailyList()); + + } + + if(null != data.getTopicAgencyMonthlyList() && data.getTopicAgencyMonthlyList().size() > NumConstant.ZERO){ + + topicStatusAgencyMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + topicStatusAgencyMonthlyDao.insertBatch(data.getTopicAgencyMonthlyList()); + + } + + if(null != data.getTopicGridDailyList() && data.getTopicGridDailyList().size() > NumConstant.ZERO){ + + topicStatusGridDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + topicStatusGridDailyDao.insertBatch(data.getTopicGridDailyList()); + + } + + if(null != data.getTotalAgencyDailyList() && data.getTotalAgencyDailyList().size() > NumConstant.ZERO){ + + topicTotalAgencyDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + topicTotalAgencyDailyDao.insertBatch(data.getTotalAgencyDailyList()); + + } + + if(null != data.getTotalGridDailyList() && data.getTotalGridDailyList().size() > NumConstant.ZERO){ + + topicTotalGridDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + topicTotalGridDailyDao.insertBatch(data.getTotalGridDailyList()); + + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/UserStatisticalService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/UserStatisticalService.java new file mode 100644 index 0000000000..92adebf81b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/UserStatisticalService.java @@ -0,0 +1,8 @@ +package com.epmet.service.stats.user; + +import com.epmet.dto.stats.user.result.UserStatisticalData; + +public interface UserStatisticalService { + + void insertUniquely(UserStatisticalData data); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/UserStatisticalServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/UserStatisticalServiceImpl.java new file mode 100644 index 0000000000..f42f74645c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/user/impl/UserStatisticalServiceImpl.java @@ -0,0 +1,117 @@ +package com.epmet.service.stats.user.impl; + + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dao.stats.user.*; +import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.service.stats.user.UserStatisticalService; +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; + +/** + * @Description + * @ClassName UserStatisticalServiceImpl + * @Auth wangc + * @Date 2020-06-23 14:27 + */ +@Service +public class UserStatisticalServiceImpl implements UserStatisticalService { + + private static final Logger logger = LoggerFactory.getLogger(UserStatisticalServiceImpl.class); + + @Autowired + private FactParticipationUserAgencyDailyDao participationUserAgencyDailyDao; + + @Autowired + private FactParticipationUserAgencyMonthlyDao participationUserAgencyMonthlyDao; + + @Autowired + private FactParticipationUserGridDailyDao participationUserGridDailyDao; + + @Autowired + private FactParticipationUserGridMonthlyDao participationUserGridMonthlyDao; + + @Autowired + private FactRegUserAgencyDailyDao regUserAgencyDailyDao; + + @Autowired + private FactRegUserAgencyMonthlyDao regUserAgencyMonthlyDao; + + @Autowired + private FactRegUserGridDailyDao regUserGridDailyDao; + + @Autowired + private FactRegUserGridMonthlyDao regUserGridMonthlyDao; + + + @Override + @Transactional(rollbackFor = Exception.class) + public void insertUniquely(UserStatisticalData data) { + if (null == data) return ; + + if(StringUtils.isBlank(data.getDateId()) || StringUtils.isBlank(data.getMonthId())){ + logger.warn("缺失重要参数:dateId或monthId"); + return ; + } + + if(null != data.getPartiAgencyDailyList() && data.getPartiAgencyDailyList().size() > NumConstant.ZERO){ + + participationUserAgencyDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + participationUserAgencyDailyDao.insertBatch(data.getPartiAgencyDailyList()); + } + + if(null != data.getPartiAgencyMonthlyList() && data.getPartiAgencyMonthlyList().size() > NumConstant.ZERO){ + + participationUserAgencyMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + participationUserAgencyMonthlyDao.insertBatch(data.getPartiAgencyMonthlyList()); + + } + + if(null != data.getPartiGridMonthlyList() && data.getPartiGridMonthlyList().size() > NumConstant.ZERO){ + + participationUserGridMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + participationUserGridMonthlyDao.insertBatch(data.getPartiGridMonthlyList()); + + } + + if(null != data.getPartiGridDailyList() && data.getPartiGridDailyList().size() > NumConstant.ZERO){ + + participationUserGridDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + participationUserGridDailyDao.insertBatch(data.getPartiGridDailyList()); + + } + + if(null != data.getRegAgencyDailyList() && data.getRegAgencyDailyList().size() > NumConstant.ZERO){ + + regUserAgencyDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + regUserAgencyDailyDao.insertBatch(data.getRegAgencyDailyList()); + + } + + if(null != data.getRegAgencyMonthlyList() && data.getRegAgencyMonthlyList().size() > NumConstant.ZERO){ + + regUserAgencyMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + regUserAgencyMonthlyDao.insertBatch(data.getRegAgencyMonthlyList()); + + } + + if(null != data.getRegGridDailyList() && data.getRegGridDailyList().size() > NumConstant.ZERO){ + + regUserGridDailyDao.deleteByParams(data.getDateId(),data.getCustomerId()); + regUserGridDailyDao.insertBatch(data.getRegGridDailyList()); + + } + + if(null != data.getRegGridMonthlyList() && data.getRegGridMonthlyList().size() > NumConstant.ZERO){ + + regUserGridMonthlyDao.deleteByParams(data.getMonthId(),data.getCustomerId()); + regUserGridMonthlyDao.insertBatch(data.getRegGridMonthlyList()); + + } + + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java new file mode 100644 index 0000000000..a83bc3a5c0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java @@ -0,0 +1,28 @@ +package com.epmet.service.topic; + +import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.stats.DimTopicStatusDTO; +import com.epmet.dto.stats.topic.result.TopicStatisticalData; +import com.epmet.util.DimIdGenerator; + +import java.util.Date; +import java.util.List; + +/** + * @Author wangc + * @CreateTime 2020/6/19 13:22 + */ +public interface TopicService { + + /** + * @Description 计算并生成统计数据 整合维度 : 机关 网格 组 话题 + * @param agencies + * @param targetDate + * @param timeDimension + * @return + * @author wangc + * @date 2020.06.22 11:12 + **/ + TopicStatisticalData compute(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension, String customerId, List statusDimension); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java new file mode 100644 index 0000000000..a4e9ecbc6a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -0,0 +1,924 @@ +package com.epmet.service.topic.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.topic.TopicDao; +import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.stats.DimTopicStatusDTO; +import com.epmet.dto.stats.topic.*; +import com.epmet.dto.stats.topic.result.GridTopicData; +import com.epmet.dto.stats.topic.result.GroupTopicData; +import com.epmet.dto.stats.topic.result.TopicStatisticalData; +import com.epmet.dto.topic.result.ResiGroupTopicResultDTO; +import com.epmet.dto.topic.result.ResiTopicOperationResultDTO; +import com.epmet.dto.topic.result.ResiTopicResultDTO; +import com.epmet.service.topic.TopicService; +import com.epmet.service.user.impl.UserServiceImpl; +import com.epmet.util.DimIdGenerator; +import com.epmet.util.ModuleConstant; +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 java.math.BigDecimal; +import java.text.NumberFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description + * @ClassName TopicServiceImpl + * @Auth wangc + * @Date 2020-06-20 17:00 + */ +@DataSource(DataSourceConstant.RESI_GROUP) +@Service +public class TopicServiceImpl implements TopicService { + + private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); + + @Autowired + private TopicDao topicDao; + + /** + * @Description 计算并生成统计数据 整合维度 : 机关 网格 组 话题 + * @param agencies + * @param targetDate + * @param timeDimension + * @return + * @author wangc + * @date 2020.06.22 11:12 + **/ + @Override + public TopicStatisticalData compute(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension, String customerId, List statusDimension) { + if(null == agencies || agencies.size() == NumConstant.ZERO){ + logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE); + return null; + } + + //Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); + Map> subGridOfAgency = new HashMap<>(); + agencies.forEach(agency -> { + initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); + }); + + List topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); + topics.forEach(groupTopic -> { + if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ + groupTopic.setTopics(new ArrayList<>()); + } + }); + Map> gridGroupMap = + topics.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId)); + + agencies.forEach(agency -> { + if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ + agency.getGridIds().forEach(gridId -> { + if(!gridGroupMap.containsKey(gridId)){ + gridGroupMap.put(gridId,null); + } + }); + + } + + if(!subGridOfAgency.containsKey(agency.getAgencyId())){ + subGridOfAgency.put(agency.getAgencyId(),new HashSet<>()); + } + + }); + + return calculateAndSummarizeTopicStatisticalData(subGridOfAgency,agencies,gridGroupMap,targetDate,statusDimension,timeDimension,customerId); + + } + + /** + * @Description 初始化机关-所有下级网格Map + * @param pid - 固定一个机关Id + * @param agency - AgencySubTreeDto + * @param subGridOfAgency - Map> + * @return + * @author wangc + * @date 2020.06.18 15:54 + **/ + void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map> subGridOfAgency){ + + //向map中放入数据 + if(subGridOfAgency.containsKey(pid)){ + //包含key + Set grids = subGridOfAgency.get(pid); + if(null == grids){ + grids = new HashSet<>(); + subGridOfAgency.put(pid,grids); + } + if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ + grids.addAll(agency.getGridIds()); + } + }else{ + //不包含key + Set grids = new HashSet<>(agency.getGridIds()); + subGridOfAgency.put(pid,grids); + } + + //定义递归出口 + if(StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY,agency.getLevel()) || null == agency.getSubAgencies() || agency.getSubAgencies().size() == NumConstant.ZERO){ + return ; + } + + + //定义递归入口 + agency.getSubAgencies().forEach(obj -> { + initAgencyGridMap(pid,obj,subGridOfAgency); + }); + } + + /** + * @Description 计算并整合出每一个组内话题的数据 + * @param subGridOfAgency + * @param gridGroupMap + * @param targetDate + * @return + * @author wangc + * @date 2020.06.22 13:13 + **/ + TopicStatisticalData calculateAndSummarizeTopicStatisticalData(Map> subGridOfAgency, List agencies, Map> gridGroupMap, Date targetDate,List statusDimension ,DimIdGenerator.DimIdBean timeDimension ,String customerId){ + if(null == subGridOfAgency || subGridOfAgency.size() <= NumConstant.ZERO){ + return null; + } + if(null == gridGroupMap || gridGroupMap.size() <= NumConstant.ZERO){ + return null; + } + //定义数据包 - 返回对象 + TopicStatisticalData dataPacket = new TopicStatisticalData(); + + dataPacket.setDateId(timeDimension.getDateId()); + dataPacket.setMonthId(timeDimension.getMonthId()); + dataPacket.setCustomerId(customerId); + + //参数:subGridOfAgency 所有机关的下级网格信息 + + //参数:gridGroupMap 所有网格的组以及组内话题 + + //[所有]话题当日的操作记录 + List operations = + topicDao.selectTopicOperationRecord(targetDate); + //key:话题Id value:这个话题在当日的操作记录 + //操作类型有: ①discussing(发布) ②hidden(屏蔽) ③hidden_cancelled(取消屏蔽) ④closed(关闭) ⑤shift_issue(转议题) + //注意不要把【发布】和【取消屏蔽】混淆!!! + Map> topicOperationMap = + operations.stream().collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getTopicId)); + + analyzeTopic(subGridOfAgency,agencies,gridGroupMap,topicOperationMap,targetDate,dataPacket,statusDimension,timeDimension); + return dataPacket; + } + + /** + * @Description 生成话题统计数据 + * @param + * @return + * @author wangc + * @date 2020.06.22 13:45 + **/ + void analyzeTopic(Map> subGridOfAgency, List agencies, Map> gridGroupMap, Map> topicOperationMap, Date targetDate, TopicStatisticalData dataPacket, List statusDimension, DimIdGenerator.DimIdBean timeDimension){ + //Boolean isMonthEnd = false; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + //前一天零点 + calendar.add(Calendar.DATE, NumConstant.ONE_NEG); + calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); + calendar.set(Calendar.MINUTE, NumConstant.ZERO); + calendar.set(Calendar.SECOND, NumConstant.ZERO); + Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate; + + calendar.setTime(targetDateCheck); + //如果目标日期是当月的最后一天 + //if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){ + //求出这个月的第一天 + calendar.setTime(new Date()); + calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE); + calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO); + calendar.set(Calendar.MINUTE, NumConstant.ZERO); + calendar.set(Calendar.SECOND, NumConstant.ZERO); + + // isMonthEnd = true; + //} + + //计算百分比使用,保留小数点后两位 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.SIX); + + Map statusMap = new HashMap<>(); + statusDimension.forEach(status -> statusMap.put(status.getId(),status)); + Map agencyMap = new HashMap<>(); + agencies.forEach(agency -> {agencyMap.put(agency.getAgencyId(),agency);}); + + + List groupList = new LinkedList<>(); + for(Map.Entry> entry : gridGroupMap.entrySet()){ + if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO) + groupList.addAll(entry.getValue()); + } + + //key -> groupId + Map groupTopicData = traverseGroupTopic(groupList,topicOperationMap); + Map gridDistinct = new HashMap<>(); + agencies.forEach(agency -> { + if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ + agency.getGridIds().forEach(grid -> { + gridDistinct.put(grid,false); + }); + } + }); + + for(Map.Entry> entry : subGridOfAgency.entrySet()){ + + FactTopicIssueAgencyDailyDTO issueAgencyD = new FactTopicIssueAgencyDailyDTO(); + FactTopicTotalAgencyDailyDTO totalAgencyD = new FactTopicTotalAgencyDailyDTO(); + FactTopicStatusAgencyDailyDTO topicAgencyD_discussing = new FactTopicStatusAgencyDailyDTO(); + FactTopicStatusAgencyDailyDTO topicAgencyD_hidden = new FactTopicStatusAgencyDailyDTO(); + FactTopicStatusAgencyDailyDTO topicAgencyD_closed = new FactTopicStatusAgencyDailyDTO(); + + initAgencyDailyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getPid(),agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueAgencyD,totalAgencyD,topicAgencyD_discussing,topicAgencyD_hidden,topicAgencyD_closed); + + + + if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){ + entry.getValue().forEach(gridId -> { + + + + + FactTopicIssueGridDailyDTO issueGridD = new FactTopicIssueGridDailyDTO(); + FactTopicStatusGridDailyDTO topicGridD_discussing = new FactTopicStatusGridDailyDTO(); + FactTopicStatusGridDailyDTO topicGridD_hidden = new FactTopicStatusGridDailyDTO(); + FactTopicStatusGridDailyDTO topicGridD_closed = new FactTopicStatusGridDailyDTO(); + FactTopicTotalGridDailyDTO totalGirdD = new FactTopicTotalGridDailyDTO(); + + + + initGridDailyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueGridD,totalGirdD,topicGridD_discussing,topicGridD_hidden,topicGridD_closed); + + + + + List groups = gridGroupMap.get(gridId); + if(null != groups && groups.size() > NumConstant.ZERO) { + groups.forEach(group -> { + if (null != group && StringUtils.isNotBlank(group.getGroupId())) { + + + issueAgencyD.setIssueIncr(issueAgencyD.getIssueIncr() + groupTopicData.get(group.getGroupId()).getIssueIncr()); + issueAgencyD.setIssueTotal(issueAgencyD.getIssueTotal() + groupTopicData.get(group.getGroupId()).getIssueTotal()); + + issueGridD.setIssueIncr(issueGridD.getIssueIncr() + groupTopicData.get(group.getGroupId()).getIssueIncr()); + issueGridD.setIssueTotal(issueGridD.getIssueTotal() + groupTopicData.get(group.getGroupId()).getIssueTotal()); + + totalAgencyD.setIssueTotalCount(issueAgencyD.getIssueTotal()); + totalAgencyD.setHiddenTotalCount(totalAgencyD.getHiddenTotalCount() + groupTopicData.get(group.getGroupId()).getHiddenTotal()); + totalAgencyD.setTopicIncr(totalAgencyD.getTopicIncr() + groupTopicData.get(group.getGroupId()).getTopicIncr()); + totalAgencyD.setTopicTotal(totalAgencyD.getTopicTotal() + groupTopicData.get(group.getGroupId()).getTotal()); + + + totalGirdD.setIssueTotalCount(issueGridD.getIssueTotal()); + totalGirdD.setHiddenTotalCount(totalGirdD.getHiddenTotalCount() + groupTopicData.get(group.getGroupId()).getHiddenTotal()); + totalGirdD.setTopicIncr(totalGirdD.getTopicIncr() + groupTopicData.get(group.getGroupId()).getTopicIncr()); + totalGirdD.setTopicTotal(totalGirdD.getTopicTotal() + groupTopicData.get(group.getGroupId()).getTotal()); + + + GroupTopicData data = groupTopicData.get(group.getGroupId()); + if (null != data) { + + + topicAgencyD_discussing.setTopicCount(topicAgencyD_discussing.getTopicCount() + data.getDiscussingTotal()); + topicAgencyD_discussing.setTopicIncrement(topicAgencyD_discussing.getTopicIncrement() + data.getDiscussingIncr()); + + topicAgencyD_hidden.setTopicCount(topicAgencyD_hidden.getTopicCount() + data.getHiddenTotal()); + topicAgencyD_hidden.setTopicIncrement(topicAgencyD_hidden.getTopicIncrement() + data.getHiddenIncr()); + + topicAgencyD_closed.setTopicCount(topicAgencyD_closed.getTopicCount() + data.getClosedTotal()); + topicAgencyD_closed.setTopicIncrement(topicAgencyD_closed.getTopicIncrement() + data.getClosedIncr()); + + + topicGridD_discussing.setTopicCount(topicGridD_discussing.getTopicCount() + data.getDiscussingTotal()); + topicGridD_discussing.setTopicIncrement(topicGridD_discussing.getTopicIncrement() + data.getDiscussingIncr()); + + topicGridD_hidden.setTopicCount(topicGridD_hidden.getTopicCount() + data.getHiddenTotal()); + topicGridD_hidden.setTopicIncrement(topicGridD_hidden.getTopicIncrement() + data.getHiddenIncr()); + + topicGridD_closed.setTopicCount(topicGridD_closed.getTopicCount() + data.getClosedTotal()); + topicGridD_closed.setTopicIncrement(topicGridD_closed.getTopicIncrement() + data.getClosedIncr()); + + + } + + } + + + }); + } + //网格-百分比 + setGridTopicProportion(numberFormat, topicGridD_discussing, topicGridD_hidden, topicGridD_closed, totalGirdD); + + if(!gridDistinct.get(gridId)) { + setGridDailyDataPacket(dataPacket, issueGridD, totalGirdD, topicGridD_discussing, topicGridD_hidden, topicGridD_closed); + } + + + gridDistinct.put(gridId,true); + }); + + + } + //机关-百分比 + setAgencyTopicProportion(numberFormat,topicAgencyD_discussing,topicAgencyD_hidden,topicAgencyD_closed,totalAgencyD); + + setAgencyDailyDataPacket(dataPacket,issueAgencyD,totalAgencyD,topicAgencyD_discussing,topicAgencyD_hidden,topicAgencyD_closed); + } + + + + // if(isMonthEnd){ + + gridDistinct.forEach((k,v) -> { + gridDistinct.put(k,false); + }); + + List topicsBetweenTimeRange = topicDao.selectGroupOrderByGridBetweenTimeRange(calendar.getTime(),targetDate,dataPacket.getCustomerId()); + Map> GridGroupMapBetweenTimeRange = + topicsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiGroupTopicResultDTO::getGridId)); + List groupListBetweenTimeRange = new LinkedList<>(); + + for(Map.Entry> entryBetweenTimeRange : GridGroupMapBetweenTimeRange.entrySet()){ + if(null != entryBetweenTimeRange.getValue() && entryBetweenTimeRange.getValue().size() > NumConstant.ZERO) + groupListBetweenTimeRange.addAll(entryBetweenTimeRange.getValue()); + } + List operationsBetweenTimeRange = + topicDao.selectTopicOperationRecordBetweenTimeRange(calendar.getTime(),targetDate); + + Map> topicOperationMapBetweenTimeRange = + operationsBetweenTimeRange.stream().collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getTopicId)); + Map groupTopicDataBetweenTimeRange = traverseGroupTopic(groupListBetweenTimeRange,topicOperationMapBetweenTimeRange); + + for(Map.Entry> entry : subGridOfAgency.entrySet()){ + + FactTopicIssueAgencyMonthlyDTO issueAgencyM = new FactTopicIssueAgencyMonthlyDTO(); + FactTopicStatusAgencyMonthlyDTO topicAgencyM_discussing = new FactTopicStatusAgencyMonthlyDTO(); + FactTopicStatusAgencyMonthlyDTO topicAgencyM_hidden = new FactTopicStatusAgencyMonthlyDTO(); + FactTopicStatusAgencyMonthlyDTO topicAgencyM_closed = new FactTopicStatusAgencyMonthlyDTO(); + + + initAgencyMonthlyDTO(entry.getKey(),agencyMap.get(entry.getKey()).getPid(),agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,statusMap,issueAgencyM,topicAgencyM_discussing,topicAgencyM_hidden,topicAgencyM_closed); + + + + if(null != entry.getValue() && entry.getValue().size() > NumConstant.ZERO){ + entry.getValue().forEach(gridId -> { + + + FactTopicIssueGridMonthlyDTO issueGridM = new FactTopicIssueGridMonthlyDTO(); + initGridMonthlyDTO(entry.getKey(),gridId,agencyMap.get(entry.getKey()).getCustomerId(),timeDimension,issueGridM); + + + List groups = gridGroupMap.get(gridId); + if(null != groups) { + groups.forEach(group -> { + if (null != group && StringUtils.isNotBlank(group.getGroupId())) { + + + issueAgencyM.setIssueIncr(issueAgencyM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr()); + issueAgencyM.setIssueTotal(issueAgencyM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal()); + + issueGridM.setIssueIncr(issueGridM.getIssueIncr() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueIncr()); + issueGridM.setIssueTotal(issueGridM.getIssueTotal() + groupTopicDataBetweenTimeRange.get(group.getGroupId()).getIssueTotal()); + + + GroupTopicData data = groupTopicDataBetweenTimeRange.get(group.getGroupId()); + if (null != data) { + + + topicAgencyM_discussing.setTopicCount(topicAgencyM_discussing.getTopicCount() + data.getDiscussingTotal()); + topicAgencyM_discussing.setTopicIncr(topicAgencyM_discussing.getTopicIncr() + data.getDiscussingIncr()); + + topicAgencyM_hidden.setTopicCount(topicAgencyM_hidden.getTopicCount() + data.getHiddenTotal()); + topicAgencyM_hidden.setTopicIncr(topicAgencyM_hidden.getTopicIncr() + data.getHiddenIncr()); + + topicAgencyM_closed.setTopicCount(topicAgencyM_closed.getTopicCount() + data.getClosedTotal()); + topicAgencyM_closed.setTopicIncr(topicAgencyM_closed.getTopicIncr() + data.getClosedIncr()); + + } + + } + + + }); + } + + if(!gridDistinct.get(gridId)) { + setGridMonthlyDataPacket(dataPacket, issueGridM); + } + + gridDistinct.put(gridId,true); + }); + + + + } + //机关-百分比 + setAgencyTopicMonthlyProportion(numberFormat,topicAgencyM_discussing,topicAgencyM_hidden,topicAgencyM_closed); + + setAgencyMonthlyDataPacket(dataPacket,issueAgencyM,topicAgencyM_discussing,topicAgencyM_hidden,topicAgencyM_closed); + } + + + + // } + } + + + /** + * @Description 生成每个组的话题统计数据 + * @param + * @return Map key:groupId + * @author wangc + * @date 2020.06.22 16:03 + **/ + Map traverseGroupTopic(List groups, Map> topicOperationMap){ + if(null == groups || groups.size() < NumConstant.ONE) + return null; + + Map groupTopicStatistical = new HashMap<>(); + + groups.forEach(group -> { + + if (null != group) { + + GroupTopicData groupTopicData = new GroupTopicData(); + groupTopicData.setGroupId(group.getGroupId()); + if (null == group.getTopics() || group.getTopics().size() == NumConstant.ZERO) { + groupTopicData.setTotal(NumConstant.ZERO); + }else { + groupTopicData.setTotal(group.getTopics().size()); + } + + //if (null == group.getTopics() || group.getTopics().size() == NumConstant.ZERO) { + groupTopicData.setTopicIncr(NumConstant.ZERO); + groupTopicData.setHiddenTotal(NumConstant.ZERO); + groupTopicData.setHiddenIncr(NumConstant.ZERO); + groupTopicData.setIssueIncr(NumConstant.ZERO); + groupTopicData.setClosedTotal(NumConstant.ZERO); + groupTopicData.setClosedIncr(NumConstant.ZERO); + groupTopicData.setDiscussingTotal(NumConstant.ZERO); + groupTopicData.setDiscussingIncr(NumConstant.ZERO); + groupTopicData.setIssueTotal(NumConstant.ZERO); + //}else{ + + for (ResiTopicResultDTO topic : group.getTopics()) { + if(StringUtils.isBlank(topic.getTopicId())) continue; + if (StringUtils.equals(NumConstant.ONE_STR, topic.getIncrFlag())) { + groupTopicData.setTopicIncr(groupTopicData.getTopicIncr() + NumConstant.ONE); + } + List operations = topicOperationMap.get(topic.getTopicId()); + boolean operFlag = true; + if(null == operations || operations.size() < NumConstant.ZERO){ + operFlag = false; + } + Map> hiddenGroupByDate = operFlag ? operations.stream().filter(oper -> StringUtils.equals("hidden",oper.getStatus())).collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getCreatedTime)) : null; + + //Map> hiddenCancelledGroupByDate = operFlag ? operations.stream().filter(oper -> StringUtils.equals("hidden_cancelled",oper.getStatus())).collect(Collectors.groupingBy(ResiTopicOperationResultDTO::getCreatedTime)) : null; + if(operFlag) { + //如果在同一天内被多次屏蔽,只计算一次 + hiddenGroupByDate.forEach((k, v) -> { + if (null != v && v.size() > NumConstant.ZERO) { + groupTopicData.setHiddenIncr(groupTopicData.getHiddenIncr() + NumConstant.ONE); + } + }); + + //转议题,operations会根据daily与monthly维度不同而取值不同,当daily时,operations只有当天的操作日志,当monthly时,operations包含时间区间内的操作日志 + if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "shift_issue")).findAny().isPresent()) { + groupTopicData.setIssueIncr(groupTopicData.getIssueIncr() + NumConstant.ONE); + } + } + + if (topic.isShiftIssue()) { + groupTopicData.setIssueTotal(groupTopicData.getIssueTotal() + NumConstant.ONE); + } + + //对于话题,每个话题的操作记录中,【关闭】与【转议题】只会出现一次,而【屏蔽】与【取消屏蔽】会出现多次 + switch (topic.getStatus()) { + case "hidden": + groupTopicData.setHiddenTotal(groupTopicData.getHiddenTotal() + NumConstant.ONE); + break; + case "closed": + groupTopicData.setClosedTotal(groupTopicData.getClosedTotal() + NumConstant.ONE); + if (operFlag) { + if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "closed")).findAny().isPresent()) { + groupTopicData.setClosedIncr(groupTopicData.getClosedIncr() + NumConstant.ONE); + } + } + break; + case "discussing": + groupTopicData.setDiscussingTotal(groupTopicData.getDiscussingTotal() + NumConstant.ONE); + if(operFlag) { + //创建话题,operations会根据daily与monthly维度不同而取值不同,当daily时,operations只有当天的操作日志,当monthly时,operations包含时间区间内的操作日志 + if (operations.stream().filter(operation -> StringUtils.equals(operation.getStatus(), "discussing")).findAny().isPresent()) { + groupTopicData.setDiscussingIncr(groupTopicData.getDiscussingIncr() + NumConstant.ONE); + } + + } + break; + } + + + } + // } + + groupTopicStatistical.put(group.getGroupId(), groupTopicData); + } + + }); + + return groupTopicStatistical; + } + + void initAgencyDailyDTO(String agencyId, String pid, String customerId,DimIdGenerator.DimIdBean timeDimension, Map statusMap, FactTopicIssueAgencyDailyDTO issueAgencyD, FactTopicTotalAgencyDailyDTO totalAgencyD, FactTopicStatusAgencyDailyDTO topicAgencyD_discussing, FactTopicStatusAgencyDailyDTO topicAgencyD_hidden, FactTopicStatusAgencyDailyDTO topicAgencyD_closed){ + + + issueAgencyD.setAgencyId(agencyId); + issueAgencyD.setPid(pid); + issueAgencyD.setCustomerId(customerId); + issueAgencyD.setDateId(timeDimension.getDateId()); + issueAgencyD.setWeekId(timeDimension.getWeekId()); + issueAgencyD.setMonthId(timeDimension.getMonthId()); + issueAgencyD.setQuarterId(timeDimension.getQuarterId()); + issueAgencyD.setYearId(timeDimension.getYearId()); + issueAgencyD.setIssueIncr(NumConstant.ZERO); + issueAgencyD.setIssueTotal(NumConstant.ZERO); + issueAgencyD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + totalAgencyD.setAgencyId(agencyId); + totalAgencyD.setPid(pid); + totalAgencyD.setCustomerId(customerId); + totalAgencyD.setDateId(timeDimension.getDateId()); + totalAgencyD.setWeekId(timeDimension.getWeekId()); + totalAgencyD.setMonthId(timeDimension.getMonthId()); + totalAgencyD.setQuarterId(timeDimension.getQuarterId()); + totalAgencyD.setYearId(timeDimension.getYearId()); + totalAgencyD.setIssueTotalCount(NumConstant.ZERO); + totalAgencyD.setHiddenTotalCount(NumConstant.ZERO); + totalAgencyD.setTopicIncr(NumConstant.ZERO); + totalAgencyD.setTopicTotal(NumConstant.ZERO); + totalAgencyD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + topicAgencyD_discussing.setAgencyId(agencyId); + topicAgencyD_discussing.setPid(pid); + topicAgencyD_discussing.setCustomerId(customerId); + topicAgencyD_discussing.setDateId(timeDimension.getDateId()); + topicAgencyD_discussing.setWeekId(timeDimension.getWeekId()); + topicAgencyD_discussing.setMonthId(timeDimension.getMonthId()); + topicAgencyD_discussing.setQuarterId(timeDimension.getQuarterId()); + topicAgencyD_discussing.setYearId(timeDimension.getYearId()); + topicAgencyD_discussing.setTopicStatusId(statusMap.get("discussing").getId()); + topicAgencyD_discussing.setTopicIncrement(NumConstant.ZERO); + topicAgencyD_discussing.setTopicCount(NumConstant.ZERO); + topicAgencyD_discussing.setTopicProportion(BigDecimal.ZERO); + topicAgencyD_discussing.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + topicAgencyD_hidden.setAgencyId(agencyId); + topicAgencyD_hidden.setPid(pid); + topicAgencyD_hidden.setCustomerId(customerId); + topicAgencyD_hidden.setDateId(timeDimension.getDateId()); + topicAgencyD_hidden.setWeekId(timeDimension.getWeekId()); + topicAgencyD_hidden.setMonthId(timeDimension.getMonthId()); + topicAgencyD_hidden.setQuarterId(timeDimension.getQuarterId()); + topicAgencyD_hidden.setYearId(timeDimension.getYearId()); + topicAgencyD_hidden.setTopicStatusId(statusMap.get("hidden").getId()); + topicAgencyD_hidden.setTopicIncrement(NumConstant.ZERO); + topicAgencyD_hidden.setTopicCount(NumConstant.ZERO); + topicAgencyD_hidden.setTopicProportion(BigDecimal.ZERO); + topicAgencyD_hidden.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + topicAgencyD_closed.setAgencyId(agencyId); + topicAgencyD_closed.setPid(pid); + topicAgencyD_closed.setCustomerId(customerId); + topicAgencyD_closed.setDateId(timeDimension.getDateId()); + topicAgencyD_closed.setWeekId(timeDimension.getWeekId()); + topicAgencyD_closed.setMonthId(timeDimension.getMonthId()); + topicAgencyD_closed.setQuarterId(timeDimension.getQuarterId()); + topicAgencyD_closed.setYearId(timeDimension.getYearId()); + topicAgencyD_closed.setTopicStatusId(statusMap.get("closed").getId()); + topicAgencyD_closed.setTopicIncrement(NumConstant.ZERO); + topicAgencyD_closed.setTopicCount(NumConstant.ZERO); + topicAgencyD_closed.setTopicProportion(BigDecimal.ZERO); + topicAgencyD_closed.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + + } + + void initGridDailyDTO(String agencyId, String gridId, String customerId ,DimIdGenerator.DimIdBean timeDimension,Map statusMap, FactTopicIssueGridDailyDTO issueGridD, FactTopicTotalGridDailyDTO totalGridD, FactTopicStatusGridDailyDTO topicGridD_discussing,FactTopicStatusGridDailyDTO topicGridD_hidden,FactTopicStatusGridDailyDTO topicGridD_closed){ + + issueGridD.setAgencyId(agencyId); + issueGridD.setGridId(gridId); + issueGridD.setCustomerId(customerId); + issueGridD.setDateId(timeDimension.getDateId()); + issueGridD.setWeekId(timeDimension.getWeekId()); + issueGridD.setMonthId(timeDimension.getMonthId()); + issueGridD.setQuarterId(timeDimension.getQuarterId()); + issueGridD.setYearId(timeDimension.getYearId()); + issueGridD.setIssueIncr(NumConstant.ZERO); + issueGridD.setIssueTotal(NumConstant.ZERO); + issueGridD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + totalGridD.setAgencyId(agencyId); + totalGridD.setGridId(gridId); + totalGridD.setCustomerId(customerId); + totalGridD.setDateId(timeDimension.getDateId()); + totalGridD.setWeekId(timeDimension.getWeekId()); + totalGridD.setMonthId(timeDimension.getMonthId()); + totalGridD.setQuarterId(timeDimension.getQuarterId()); + totalGridD.setYearId(timeDimension.getYearId()); + totalGridD.setHiddenTotalCount(NumConstant.ZERO); + totalGridD.setIssueTotalCount(NumConstant.ZERO); + totalGridD.setTopicIncr(NumConstant.ZERO); + totalGridD.setTopicTotal(NumConstant.ZERO); + totalGridD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + topicGridD_discussing.setAgencyId(agencyId); + topicGridD_discussing.setGridId(gridId); + topicGridD_discussing.setCustomerId(customerId); + topicGridD_discussing.setDateId(timeDimension.getDateId()); + topicGridD_discussing.setWeekId(timeDimension.getWeekId()); + topicGridD_discussing.setMonthId(timeDimension.getMonthId()); + topicGridD_discussing.setQuarterId(timeDimension.getQuarterId()); + topicGridD_discussing.setYearId(timeDimension.getYearId()); + topicGridD_discussing.setTopicStatusId(statusMap.get("discussing").getId()); + topicGridD_discussing.setTopicCount(NumConstant.ZERO); + topicGridD_discussing.setTopicIncrement(NumConstant.ZERO); + topicGridD_discussing.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + topicGridD_hidden.setAgencyId(agencyId); + topicGridD_hidden.setGridId(gridId); + topicGridD_hidden.setCustomerId(customerId); + topicGridD_hidden.setDateId(timeDimension.getDateId()); + topicGridD_hidden.setWeekId(timeDimension.getWeekId()); + topicGridD_hidden.setMonthId(timeDimension.getMonthId()); + topicGridD_hidden.setQuarterId(timeDimension.getQuarterId()); + topicGridD_hidden.setYearId(timeDimension.getYearId()); + topicGridD_hidden.setTopicStatusId(statusMap.get("hidden").getId()); + topicGridD_hidden.setTopicCount(NumConstant.ZERO); + topicGridD_hidden.setTopicIncrement(NumConstant.ZERO); + topicGridD_hidden.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + topicGridD_closed.setAgencyId(agencyId); + topicGridD_closed.setGridId(gridId); + topicGridD_closed.setCustomerId(customerId); + topicGridD_closed.setDateId(timeDimension.getDateId()); + topicGridD_closed.setWeekId(timeDimension.getWeekId()); + topicGridD_closed.setMonthId(timeDimension.getMonthId()); + topicGridD_closed.setQuarterId(timeDimension.getQuarterId()); + topicGridD_closed.setYearId(timeDimension.getYearId()); + topicGridD_closed.setTopicStatusId(statusMap.get("closed").getId()); + topicGridD_closed.setTopicCount(NumConstant.ZERO); + topicGridD_closed.setTopicIncrement(NumConstant.ZERO); + topicGridD_closed.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + } + + void setGridTopicProportion(NumberFormat numberFormat,FactTopicStatusGridDailyDTO topicGridD_discussing, FactTopicStatusGridDailyDTO topicGridD_hidden, FactTopicStatusGridDailyDTO topicGridD_closed,FactTopicTotalGridDailyDTO totalGirdD){ + topicGridD_discussing.setTopicProportion(totalGirdD.getTopicTotal() == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicGridD_discussing.getTopicCount() / (float) totalGirdD.getTopicTotal() + ))); + + topicGridD_hidden.setTopicProportion(totalGirdD.getTopicTotal() == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicGridD_hidden.getTopicCount() / (float) totalGirdD.getTopicTotal() + ))); + + + topicGridD_closed.setTopicProportion(totalGirdD.getTopicTotal() == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicGridD_closed.getTopicCount() / (float) totalGirdD.getTopicTotal() + ))); + + + } + + void setAgencyTopicProportion(NumberFormat numberFormat,FactTopicStatusAgencyDailyDTO topicAgencyD_discussing, FactTopicStatusAgencyDailyDTO topicAgencyD_hidden, FactTopicStatusAgencyDailyDTO topicAgencyD_closed,FactTopicTotalAgencyDailyDTO totalAgencyD){ + topicAgencyD_discussing.setTopicProportion(totalAgencyD.getTopicTotal() == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicAgencyD_discussing.getTopicCount() / (float) totalAgencyD.getTopicTotal() + ))); + + topicAgencyD_hidden.setTopicProportion(totalAgencyD.getTopicTotal() == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicAgencyD_hidden.getTopicCount() / (float) totalAgencyD.getTopicTotal() + ))); + + topicAgencyD_closed.setTopicProportion(totalAgencyD.getTopicTotal() == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicAgencyD_closed.getTopicCount() / (float) totalAgencyD.getTopicTotal() + ))); + } + + void setAgencyDailyDataPacket(TopicStatisticalData dataPacket,FactTopicIssueAgencyDailyDTO issueAgencyD, FactTopicTotalAgencyDailyDTO totalAgencyD, FactTopicStatusAgencyDailyDTO topicAgencyD_discussing, FactTopicStatusAgencyDailyDTO topicAgencyD_hidden, FactTopicStatusAgencyDailyDTO topicAgencyD_closed){ + if(null == dataPacket.getIssueAgencyDailyList()){ + List issueAgencyDailyList = new LinkedList<>(); + issueAgencyDailyList.add(issueAgencyD); + dataPacket.setIssueAgencyDailyList(issueAgencyDailyList); + }else{ + dataPacket.getIssueAgencyDailyList().add(issueAgencyD); + } + + if(null == dataPacket.getTotalAgencyDailyList()){ + List totalAgencyDailyList = new LinkedList<>(); + totalAgencyDailyList.add(totalAgencyD); + dataPacket.setTotalAgencyDailyList(totalAgencyDailyList); + }else{ + dataPacket.getTotalAgencyDailyList().add(totalAgencyD); + } + + if(null == dataPacket.getTopicAgencyDailyList()){ + List topicAgencyDailyList = new LinkedList<>(); + topicAgencyDailyList.add(topicAgencyD_discussing); + topicAgencyDailyList.add(topicAgencyD_hidden); + topicAgencyDailyList.add(topicAgencyD_closed); + dataPacket.setTopicAgencyDailyList(topicAgencyDailyList); + }else{ + dataPacket.getTopicAgencyDailyList().add(topicAgencyD_discussing); + dataPacket.getTopicAgencyDailyList().add(topicAgencyD_hidden); + dataPacket.getTopicAgencyDailyList().add(topicAgencyD_closed); + } + } + + void setGridDailyDataPacket(TopicStatisticalData dataPacket,FactTopicIssueGridDailyDTO issueGridD, FactTopicTotalGridDailyDTO totalGridD, FactTopicStatusGridDailyDTO topicGridD_discussing,FactTopicStatusGridDailyDTO topicGridD_hidden,FactTopicStatusGridDailyDTO topicGridD_closed){ + if(null == dataPacket.getIssueGridDailyList()){ + List issueGridDailyList = new LinkedList<>(); + issueGridDailyList.add(issueGridD); + dataPacket.setIssueGridDailyList(issueGridDailyList); + }else{ + dataPacket.getIssueGridDailyList().add(issueGridD); + } + + if(null == dataPacket.getTotalGridDailyList()){ + List totalGridDailyList = new LinkedList<>(); + totalGridDailyList.add(totalGridD); + dataPacket.setTotalGridDailyList(totalGridDailyList); + }else{ + dataPacket.getTotalGridDailyList().add(totalGridD); + } + + if(null == dataPacket.getTopicGridDailyList()){ + List topicGridDailyList = new LinkedList<>(); + topicGridDailyList.add(topicGridD_discussing); + topicGridDailyList.add(topicGridD_hidden); + topicGridDailyList.add(topicGridD_closed); + dataPacket.setTopicGridDailyList(topicGridDailyList); + }else{ + dataPacket.getTopicGridDailyList().add(topicGridD_discussing); + dataPacket.getTopicGridDailyList().add(topicGridD_hidden); + dataPacket.getTopicGridDailyList().add(topicGridD_closed); + } + } + + void initAgencyMonthlyDTO(String agencyId, String pid, String customerId,DimIdGenerator.DimIdBean timeDimension, Map statusMap,FactTopicIssueAgencyMonthlyDTO issueAgencyM ,FactTopicStatusAgencyMonthlyDTO topicAgencyM_discussing ,FactTopicStatusAgencyMonthlyDTO topicAgencyM_hidden ,FactTopicStatusAgencyMonthlyDTO topicAgencyM_closed){ + issueAgencyM.setAgencyId(agencyId); + issueAgencyM.setPid(pid); + issueAgencyM.setCustomerId(customerId); + issueAgencyM.setMonthId(timeDimension.getMonthId()); + issueAgencyM.setQuarterId(timeDimension.getQuarterId()); + issueAgencyM.setYearId(timeDimension.getYearId()); + issueAgencyM.setIssueIncr(NumConstant.ZERO); + issueAgencyM.setIssueTotal(NumConstant.ZERO); + issueAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + topicAgencyM_discussing.setAgencyId(agencyId); + topicAgencyM_discussing.setPid(pid); + topicAgencyM_discussing.setCustomerId(customerId); + topicAgencyM_discussing.setMonthId(timeDimension.getMonthId()); + topicAgencyM_discussing.setQuarterId(timeDimension.getQuarterId()); + topicAgencyM_discussing.setYearId(timeDimension.getYearId()); + topicAgencyM_discussing.setTopicStatusId(statusMap.get("discussing").getId()); + topicAgencyM_discussing.setTopicIncr(NumConstant.ZERO); + topicAgencyM_discussing.setTopicCount(NumConstant.ZERO); + topicAgencyM_discussing.setTopicProportion(BigDecimal.ZERO); + topicAgencyM_discussing.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + topicAgencyM_hidden.setAgencyId(agencyId); + topicAgencyM_hidden.setPid(pid); + topicAgencyM_hidden.setCustomerId(customerId); + topicAgencyM_hidden.setMonthId(timeDimension.getMonthId()); + topicAgencyM_hidden.setQuarterId(timeDimension.getQuarterId()); + topicAgencyM_hidden.setYearId(timeDimension.getYearId()); + topicAgencyM_hidden.setTopicStatusId(statusMap.get("hidden").getId()); + topicAgencyM_hidden.setTopicIncr(NumConstant.ZERO); + topicAgencyM_hidden.setTopicCount(NumConstant.ZERO); + topicAgencyM_hidden.setTopicProportion(BigDecimal.ZERO); + topicAgencyM_hidden.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + topicAgencyM_closed.setAgencyId(agencyId); + topicAgencyM_closed.setPid(pid); + topicAgencyM_closed.setCustomerId(customerId); + topicAgencyM_closed.setMonthId(timeDimension.getMonthId()); + topicAgencyM_closed.setQuarterId(timeDimension.getQuarterId()); + topicAgencyM_closed.setYearId(timeDimension.getYearId()); + topicAgencyM_closed.setTopicStatusId(statusMap.get("closed").getId()); + topicAgencyM_closed.setTopicIncr(NumConstant.ZERO); + topicAgencyM_closed.setTopicCount(NumConstant.ZERO); + topicAgencyM_closed.setTopicProportion(BigDecimal.ZERO); + topicAgencyM_closed.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + } + + void initGridMonthlyDTO(String agencyId, String gridId,String customerId,DimIdGenerator.DimIdBean timeDimension,FactTopicIssueGridMonthlyDTO issueGridM){ + issueGridM.setAgencyId(agencyId); + issueGridM.setGridId(gridId); + issueGridM.setCustomerId(customerId); + issueGridM.setMonthId(timeDimension.getMonthId()); + issueGridM.setQuarterId(timeDimension.getQuarterId()); + issueGridM.setYearId(timeDimension.getYearId()); + issueGridM.setIssueIncr(NumConstant.ZERO); + issueGridM.setIssueTotal(NumConstant.ZERO); + issueGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + } + + void setAgencyTopicMonthlyProportion(NumberFormat numberFormat,FactTopicStatusAgencyMonthlyDTO topicAgencyM_discussing, FactTopicStatusAgencyMonthlyDTO topicAgencyM_hidden, FactTopicStatusAgencyMonthlyDTO topicAgencyM_closed){ + + Integer total = topicAgencyM_discussing.getTopicCount() + topicAgencyM_hidden.getTopicCount() + topicAgencyM_closed.getTopicCount(); + + topicAgencyM_discussing.setTopicProportion(total == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicAgencyM_discussing.getTopicCount() / (float) total + ))); + + topicAgencyM_hidden.setTopicProportion(total == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicAgencyM_hidden.getTopicCount() / (float) total + ))); + + topicAgencyM_closed.setTopicProportion(total == NumConstant.ZERO + ? BigDecimal.ZERO + : new BigDecimal( + numberFormat.format( + (float)topicAgencyM_closed.getTopicCount() / (float) total + ))); + } + + void setAgencyMonthlyDataPacket(TopicStatisticalData dataPacket,FactTopicIssueAgencyMonthlyDTO issueAgencyM, FactTopicStatusAgencyMonthlyDTO topicAgencyM_discussing, FactTopicStatusAgencyMonthlyDTO topicAgencyM_hidden, FactTopicStatusAgencyMonthlyDTO topicAgencyM_closed){ + if(null == dataPacket.getIssueAgencyMonthlyList()){ + List issueAgencyMonthlyList = new LinkedList<>(); + issueAgencyMonthlyList.add(issueAgencyM); + dataPacket.setIssueAgencyMonthlyList(issueAgencyMonthlyList); + }else{ + dataPacket.getIssueAgencyMonthlyList().add(issueAgencyM); + } + + + if(null == dataPacket.getTopicAgencyMonthlyList()){ + List topicAgencyMonthlyList = new LinkedList<>(); + topicAgencyMonthlyList.add(topicAgencyM_discussing); + topicAgencyMonthlyList.add(topicAgencyM_hidden); + topicAgencyMonthlyList.add(topicAgencyM_closed); + dataPacket.setTopicAgencyMonthlyList(topicAgencyMonthlyList); + }else{ + dataPacket.getTopicAgencyMonthlyList().add(topicAgencyM_discussing); + dataPacket.getTopicAgencyMonthlyList().add(topicAgencyM_hidden); + dataPacket.getTopicAgencyMonthlyList().add(topicAgencyM_closed); + } + } + + void setGridMonthlyDataPacket(TopicStatisticalData dataPacket,FactTopicIssueGridMonthlyDTO issueGridM ){ + if(null == dataPacket.getIssueGridMonthlyList()){ + List issueGridMonthlyList = new LinkedList<>(); + issueGridMonthlyList.add(issueGridM); + dataPacket.setIssueGridMonthlyList(issueGridMonthlyList); + }else{ + dataPacket.getIssueGridMonthlyList().add(issueGridM); + } + + } + +} 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 3f20d2a9e7..cd4c70287b 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 @@ -1,6 +1,8 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.util.DimIdGenerator; import java.util.Date; import java.util.List; @@ -10,12 +12,12 @@ public interface UserService { /** * @Description 遍历所有机关(它的下级机关)统计注册用户和参与用户的数据,使用level控制 - * @param topAgencies - List + * @param agencies - List * @return * @author wangc * @date 2020.06.18 10:03 **/ - void traverseAgencyUser(List topAgencies, Date targetDate); + UserStatisticalData traverseAgencyUser(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension); /** * @Description 遍历所有机关的直属网格统计注册用户参与用户的数据 @@ -24,5 +26,5 @@ public interface UserService { * @author wangc * @date 2020.06.18 10:03 **/ - void traverseGridUser(List agencies, Date targetDate); + UserStatisticalData traverseGridUser(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension); } 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 cef6dbe508..f7655f12a7 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 @@ -5,8 +5,11 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.stats.user.*; +import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; import com.epmet.service.user.UserService; +import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -14,12 +17,14 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; /** - * @Description 直连epmet-user + * @Description 15直连epmet-user * @ClassName UserServiceImpl * @Auth wangc * @Date 2020-06-18 09:55 @@ -41,13 +46,18 @@ public class UserServiceImpl implements UserService { * @date 2020.06.18 10:03 **/ @Override - public void traverseAgencyUser(List agencies, Date targetDate) { + public UserStatisticalData traverseAgencyUser(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension) { if(null == agencies || agencies.size() == NumConstant.ZERO){ - logger.warn("没有相应的机关集合"); - return ; + logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE); + return null; } + + UserStatisticalData dataPacket = new UserStatisticalData(); + dataPacket.setDateId(timeDimension.getDateId()); + dataPacket.setMonthId(timeDimension.getMonthId()); //自上向下检索 - //Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); + + Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); Map> subGridOfAgency = new HashMap<>(); agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); @@ -56,10 +66,18 @@ public class UserServiceImpl implements UserService { //对每一个机关进行数据统计 if(subGridOfAgency.size() > NumConstant.ZERO){ subGridOfAgency.forEach((k,v) -> { - queryUserData(v,targetDate); + queryUserData(ModuleConstant.DIM_SUB_AGENCY, + k, + (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(k).get(NumConstant.ZERO).getPid(), + (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? null : agencyMap.get(k).get(NumConstant.ZERO).getCustomerId(), + v, + targetDate, + dataPacket, + timeDimension); }); } + return dataPacket; } /** @@ -70,25 +88,40 @@ public class UserServiceImpl implements UserService { * @date 2020.06.18 10:03 **/ @Override - public void traverseGridUser(List agencies, Date targetDate) { + public UserStatisticalData traverseGridUser(List agencies, Date targetDate, DimIdGenerator.DimIdBean timeDimension) { if(null == agencies || agencies.size() == NumConstant.ZERO){ - logger.warn("没有相应的机关集合"); - return ; + logger.warn(ModuleConstant.LOG_WARN_NO_AGENCY_MESSAGE); + return null; } + + UserStatisticalData dataPacket = new UserStatisticalData(); + dataPacket.setMonthId(timeDimension.getMonthId()); + dataPacket.setDateId(timeDimension.getDateId()); + //自上向下检索 Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); if(null != agencyMap && agencyMap.size() > NumConstant.ZERO){ agencyMap.forEach((k,v) -> { if(null != v && v.size() > NumConstant.ZERO){ - queryUserData(new HashSet<>(v.get(NumConstant.ZERO).getGridIds()),targetDate); + queryUserData(ModuleConstant.DIM_BELONGING_GRID, + k, + v.get(NumConstant.ZERO).getPid(), + v.get(NumConstant.ZERO).getCustomerId(), + new HashSet<>(v.get(NumConstant.ZERO).getGridIds()), + targetDate, + dataPacket, + timeDimension); } }); } + + return dataPacket; } /** * @Description 初始化机关-所有下级网格Map + * @param pid - 固定一个机关Id * @param agency - AgencySubTreeDto * @param subGridOfAgency - Map> * @return @@ -128,56 +161,38 @@ public class UserServiceImpl implements UserService { /** * @Description 执行查询用户数据统计的逻辑 + * @param relation - agency(下级机关加网格) | grid(直属网格) + * @param agencyId + * @param pid + * @param customerId * @param gridIds - 机关下所有网格集合/机关下直属网格集合 * @param targetDate + * @param dataPacket - 数据包 + * @param timeDimension DimIdGenerator.DimIdBean * @return * @author wangc * @date 2020.06.19 10:01 **/ - void queryUserData(Set gridIds,Date targetDate){ - //默认查询注册用户 - - //1.计算机关下注册用户一个时间单位内的累计与增长 - CommonTotalAndIncCountResultDTO regData = - userDao.selectResiTotalAndIncrByLevel(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,targetDate); - //2.查询注册用户的Id列表 - List incrRegUsers = - userDao.selectIncrUserIds(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,targetDate); - List totalRegUsers = - userDao.selectTotalUserIds(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,targetDate); - //3.查询机关下一个时间单位内热心居民的累计与增量(注册用户) - CommonTotalAndIncCountResultDTO warmRegData = - userDao.selectWarmTotalAndIncr(totalRegUsers,incrRegUsers,gridIds,targetDate); - //4.查询机关下一个时间单位内党员的累计与增量(注册用户) - CommonTotalAndIncCountResultDTO partyRegData = - userDao.selectPartyTotalAndIncr(totalRegUsers,incrRegUsers,targetDate); - - - //参与用户 - //1.计算机关下参与用户一个时间单位内的累计与增长 - CommonTotalAndIncCountResultDTO partiData = - userDao.selectResiTotalAndIncrByLevel(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,targetDate); - //2.查询参与用户的Id列表 - List incrPartiUsers = - userDao.selectIncrUserIds(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,targetDate); - List totalPartiUsers = - userDao.selectTotalUserIds(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,targetDate); - //3.查询机关下一个时间单位内热心居民的累计与增量(参与用户) - CommonTotalAndIncCountResultDTO warmPartiData = - userDao.selectWarmTotalAndIncr(totalPartiUsers,incrPartiUsers,gridIds,targetDate); - //4.查询机关下一个时间单位内党员的累计与增量(参与用户) - CommonTotalAndIncCountResultDTO partyPartiData = - userDao.selectPartyTotalAndIncr(totalPartiUsers,incrPartiUsers,targetDate); + void queryUserData(String relation, String agencyId, String pid, String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ + + if(StringUtils.isBlank(pid)) + pid = NumConstant.ZERO_STR; + dataPacket.setCustomerId(customerId); + //计算百分比使用,保留小数点后两位 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.SIX); + + Boolean isMonthBeginning = true; Calendar calendar =Calendar.getInstance(); calendar.setTime(new Date()); calendar.add(Calendar.DATE, NumConstant.ONE_NEG); Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate; calendar.setTime(targetDateCheck); - //如果目标日期是当月的最后一天 - if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){ + //如果目标日期不是是当月的第一天 + if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){ //求出这个月的第一天 calendar.setTime(new Date()); calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE); @@ -185,27 +200,443 @@ public class UserServiceImpl implements UserService { calendar.set(Calendar.MINUTE, NumConstant.ZERO); calendar.set(Calendar.SECOND, NumConstant.ZERO); - //本月注册用户增长数 - Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); - //本月新增注册用户Id集合 - List incrRegIdsMonthly = userDao.selectIncrUserIdsWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); - //本月新增党员数(注册用户) - Integer incrPartyOfRegMonthly = userDao.selectPartyIncrWithinTimeRange(incrRegIdsMonthly,calendar.getTime(),targetDateCheck); - //本月新增热心居民数(注册用户) - Integer incrWarmOfRegMonthly = userDao.selectWarmIncrWithinTimeRange(incrRegIdsMonthly,gridIds,calendar.getTime(),targetDateCheck); - - - //本月参与用户增长数 - Integer partiIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,calendar.getTime(),targetDateCheck); - //本月新增参与用户Id集合 - List incrPartiIdsMonthly = userDao.selectIncrUserIdsWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,calendar.getTime(),targetDateCheck); - //本月新增党员数(参与用户) - Integer incrPartyOfPartiMonthly = userDao.selectPartyIncrWithinTimeRange(incrPartiIdsMonthly,calendar.getTime(),targetDateCheck); - //本月新增热心居民数(参与用户) - Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,gridIds,calendar.getTime(),targetDateCheck); + isMonthBeginning = false; + } + + if(StringUtils.equals(ModuleConstant.DIM_SUB_AGENCY,relation)){ + + + //默认查询注册用户 + + //1.计算机关下注册用户一个时间单位内的累计与增长 + CommonTotalAndIncCountResultDTO regData = + userDao.selectResiTotalAndIncrByLevel(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,targetDate); + //2.查询注册用户的Id列表 + List incrRegUsers = + userDao.selectIncrUserIds(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,targetDate); + List totalRegUsers = + userDao.selectTotalUserIds(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,targetDate); + //3.查询机关下一个时间单位内热心居民的累计与增量(注册用户) + CommonTotalAndIncCountResultDTO warmRegData = + userDao.selectWarmTotalAndIncr(totalRegUsers,incrRegUsers,gridIds,targetDate); + //4.查询机关下一个时间单位内党员的累计与增量(注册用户) + CommonTotalAndIncCountResultDTO partyRegData = + userDao.selectPartyTotalAndIncr(totalRegUsers,incrRegUsers,targetDate); + + + //参与用户 + //1.计算机关下参与用户一个时间单位内的累计与增长 + CommonTotalAndIncCountResultDTO partiData = + userDao.selectResiTotalAndIncrByLevel(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,targetDate); + //2.查询参与用户的Id列表 + List incrPartiUsers = + userDao.selectIncrUserIds(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,targetDate); + List totalPartiUsers = + userDao.selectTotalUserIds(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,targetDate); + //3.查询机关下一个时间单位内热心居民的累计与增量(参与用户) + CommonTotalAndIncCountResultDTO warmPartiData = + userDao.selectWarmTotalAndIncr(totalPartiUsers,incrPartiUsers,gridIds,targetDate); + //4.查询机关下一个时间单位内党员的累计与增量(参与用户) + CommonTotalAndIncCountResultDTO partyPartiData = + userDao.selectPartyTotalAndIncr(totalPartiUsers,incrPartiUsers,targetDate); + + + + //agency + FactRegUserAgencyDailyDTO regAgencyD = new FactRegUserAgencyDailyDTO(); + regAgencyD.setCustomerId(customerId); + regAgencyD.setAgencyId(agencyId); + regAgencyD.setDateId(timeDimension.getDateId()); + regAgencyD.setWeekId(timeDimension.getWeekId()); + regAgencyD.setYearId(timeDimension.getYearId()); + regAgencyD.setResiTotal(regData.getTotal()); + regAgencyD.setRegTotal(regData.getTotal()); + regAgencyD.setWarmHeartedTotal(warmRegData.getTotal()); + regAgencyD.setPartymemberTotal(partyRegData.getTotal()); + regAgencyD.setRegIncr(regData.getIncr()); + regAgencyD.setWarmIncr(warmRegData.getIncr()); + regAgencyD.setPartymemberIncr(partiData.getIncr()); + regAgencyD.setResiProportion(new BigDecimal(NumConstant.ONE)); + regAgencyD.setPartymemberProportion(null == regData.getTotal() || regData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)partyRegData.getTotal()/(float)regData.getTotal() ))); + regAgencyD.setWarmHeartedProportion(null == regData.getTotal() || regData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)warmRegData.getTotal()/(float)regData.getTotal() ))); + regAgencyD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + if(null != dataPacket.getRegAgencyDailyList()){ + dataPacket.getRegAgencyDailyList().add(regAgencyD); + }else{ + List list = new ArrayList<>(); + list.add(regAgencyD); + dataPacket.setRegAgencyDailyList(list); + } + + + FactParticipationUserAgencyDailyDTO partiAgencyD = new FactParticipationUserAgencyDailyDTO(); + partiAgencyD.setCustomerId(customerId); + partiAgencyD.setAgencyId(agencyId); + partiAgencyD.setDateId(timeDimension.getDateId()); + partiAgencyD.setWeekId(timeDimension.getWeekId()); + partiAgencyD.setYearId(timeDimension.getYearId()); + partiAgencyD.setResiTotal(partiData.getTotal()); + partiAgencyD.setRegTotal(partiData.getTotal()); + partiAgencyD.setWarmHeartedTotal(warmPartiData.getTotal()); + partiAgencyD.setPartymemberTotal(partyPartiData.getTotal()); + partiAgencyD.setRegIncr(partiData.getIncr()); + partiAgencyD.setWarmIncr(warmPartiData.getIncr()); + partiAgencyD.setPartymemberIncr(partyPartiData.getIncr()); + partiAgencyD.setResiProportion(new BigDecimal(NumConstant.ONE)); + partiAgencyD.setPartymemberProportion(null == partiData.getTotal() || partiData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)partyPartiData.getTotal()/(float)partiData.getTotal() ))); + partiAgencyD.setWarmHeartedProportion(null == partiData.getTotal() || partiData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)warmPartiData.getTotal()/(float)partiData.getTotal() ))); + partiAgencyD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + if(null != dataPacket.getPartiAgencyDailyList()){ + dataPacket.getPartiAgencyDailyList().add(partiAgencyD); + }else{ + List list = new ArrayList<>(); + list.add(partiAgencyD); + dataPacket.setPartiAgencyDailyList(list); + } + + + + + + FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO(); + regAgencyM.setCustomerId(customerId); + regAgencyM.setAgencyId(agencyId); + regAgencyM.setMonthId(timeDimension.getMonthId()); + regAgencyM.setQuarterId(timeDimension.getQuarterId()); + regAgencyM.setYearId(timeDimension.getYearId()); + regAgencyM.setRegTotal(regData.getTotal()); + regAgencyM.setResiTotal(regData.getTotal()); + regAgencyM.setWarmHeartedTotal(warmRegData.getTotal()); + regAgencyM.setPartymemberTotal(partyRegData.getTotal()); + regAgencyM.setRegIncr(regData.getIncr()); + regAgencyM.setWarmIncr(warmRegData.getIncr()); + regAgencyM.setPartymemberIncr(partiData.getIncr()); + regAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE)); + regAgencyM.setPartymemberProportion(regAgencyD.getPartymemberProportion()); + regAgencyM.setWarmHeartedProportion(regAgencyD.getWarmHeartedProportion()); + regAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + + FactParticipationUserAgencyMonthlyDTO partiAgencyM = new FactParticipationUserAgencyMonthlyDTO(); + partiAgencyM.setCustomerId(customerId); + partiAgencyM.setAgencyId(agencyId); + partiAgencyM.setMonthId(timeDimension.getMonthId()); + partiAgencyM.setQuarterId(timeDimension.getQuarterId()); + partiAgencyM.setYearId(timeDimension.getYearId()); + partiAgencyM.setRegTotal(partiData.getTotal()); + partiAgencyM.setResiTotal(partiData.getTotal()); + partiAgencyM.setWarmHeartedTotal(warmPartiData.getTotal()); + partiAgencyM.setPartymemberTotal(partyPartiData.getTotal()); + partiAgencyM.setRegIncr(partiData.getIncr()); + partiAgencyM.setWarmIncr(warmPartiData.getIncr()); + partiAgencyM.setPartymemberIncr(partyPartiData.getIncr()); + partiAgencyM.setResiProportion(new BigDecimal(NumConstant.ONE)); + partiAgencyM.setPartymemberProportion(partiAgencyD.getPartymemberProportion()); + partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion()); + partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + + //如果是月初第一天,不再做日期区间查询 + if(isMonthBeginning) { + if (null == dataPacket.getRegAgencyMonthlyList()) { + List list = new LinkedList<>(); + list.add(regAgencyM); + dataPacket.setRegAgencyMonthlyList(list); + } else { + dataPacket.getRegAgencyMonthlyList().add(regAgencyM); + } + if (null == dataPacket.getPartiAgencyMonthlyList()) { + List list = new LinkedList<>(); + list.add(partiAgencyM); + dataPacket.setPartiAgencyMonthlyList(list); + } else { + dataPacket.getPartiAgencyMonthlyList().add(partiAgencyM); + } + }else{ + //如果不是月初第一天 + + //本月注册用户增长数 + Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); + //本月新增注册用户Id集合 + List incrRegIdsMonthly = userDao.selectIncrUserIdsWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); + //本月新增党员数(注册用户) + Integer incrPartyOfRegMonthly = userDao.selectPartyIncrWithinTimeRange(incrRegIdsMonthly,calendar.getTime(),targetDateCheck); + //本月新增热心居民数(注册用户) + Integer incrWarmOfRegMonthly = userDao.selectWarmIncrWithinTimeRange(incrRegIdsMonthly,gridIds,calendar.getTime(),targetDateCheck); + + + //本月参与用户增长数 + Integer partiIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,calendar.getTime(),targetDateCheck); + //本月新增参与用户Id集合 + List incrPartiIdsMonthly = userDao.selectIncrUserIdsWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,gridIds,calendar.getTime(),targetDateCheck); + //本月新增党员数(参与用户) + Integer incrPartyOfPartiMonthly = userDao.selectPartyIncrWithinTimeRange(incrPartiIdsMonthly,calendar.getTime(),targetDateCheck); + //本月新增热心居民数(参与用户) + Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,gridIds,calendar.getTime(),targetDateCheck); + + + + regAgencyM.setRegIncr(regIncrMonthly); + regAgencyM.setWarmIncr(incrWarmOfRegMonthly); + regAgencyM.setPartymemberIncr(incrPartyOfRegMonthly); + if(null == dataPacket.getRegAgencyMonthlyList()){ + List list = new LinkedList<>(); + list.add(regAgencyM); + dataPacket.setRegAgencyMonthlyList(list); + }else{ + dataPacket.getRegAgencyMonthlyList().add(regAgencyM); + } + + + + partiAgencyM.setRegIncr(partiIncrMonthly); + partiAgencyM.setWarmIncr(incrWarmOfPartiMonthly); + partiAgencyM.setPartymemberIncr(incrPartyOfPartiMonthly); + if(null == dataPacket.getPartiAgencyMonthlyList()){ + List list = new LinkedList<>(); + list.add(partiAgencyM); + dataPacket.setPartiAgencyMonthlyList(list); + }else{ + dataPacket.getPartiAgencyMonthlyList().add(partiAgencyM); + } + + + } + + + }else{ + //直属网格数据 + + + Set singleGridIdSet = new HashSet<>(); + final boolean monthBeginningFlag = isMonthBeginning; + //grid + gridIds.forEach(gridId -> { + + singleGridIdSet.add(gridId); + // START QUERY + + //1.计算机关下注册用户一个时间单位内的累计与增长 + CommonTotalAndIncCountResultDTO regData = + userDao.selectResiTotalAndIncrByLevel(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,targetDate); + //2.查询注册用户的Id列表 + List incrRegUsers = + userDao.selectIncrUserIds(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,targetDate); + List totalRegUsers = + userDao.selectTotalUserIds(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,targetDate); + //3.查询机关下一个时间单位内热心居民的累计与增量(注册用户) + CommonTotalAndIncCountResultDTO warmRegData = + userDao.selectWarmTotalAndIncr(totalRegUsers,incrRegUsers,singleGridIdSet,targetDate); + //4.查询机关下一个时间单位内党员的累计与增量(注册用户) + CommonTotalAndIncCountResultDTO partyRegData = + userDao.selectPartyTotalAndIncr(totalRegUsers,incrRegUsers,targetDate); + + + //参与用户 + //1.计算机关下参与用户一个时间单位内的累计与增长 + CommonTotalAndIncCountResultDTO partiData = + userDao.selectResiTotalAndIncrByLevel(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,singleGridIdSet,targetDate); + //2.查询参与用户的Id列表 + List incrPartiUsers = + userDao.selectIncrUserIds(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,singleGridIdSet,targetDate); + List totalPartiUsers = + userDao.selectTotalUserIds(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,singleGridIdSet,targetDate); + //3.查询机关下一个时间单位内热心居民的累计与增量(参与用户) + CommonTotalAndIncCountResultDTO warmPartiData = + userDao.selectWarmTotalAndIncr(totalPartiUsers,incrPartiUsers,singleGridIdSet,targetDate); + //4.查询机关下一个时间单位内党员的累计与增量(参与用户) + CommonTotalAndIncCountResultDTO partyPartiData = + userDao.selectPartyTotalAndIncr(totalPartiUsers,incrPartiUsers,targetDate); + + + // END QUERY + + + //注册用户网格级别 + FactRegUserGridDailyDTO regGridD = new FactRegUserGridDailyDTO(); + + regGridD.setCustomerId(customerId); + regGridD.setGridId(gridId); + regGridD.setCustomerId(customerId); + regGridD.setAgencyId(agencyId);//网格直属得机关 + regGridD.setDateId(timeDimension.getDateId()); + regGridD.setWeekId(timeDimension.getWeekId()); + regGridD.setYearId(timeDimension.getYearId()); + regGridD.setResiTotal(regData.getTotal()); + regGridD.setRegTotal(regData.getTotal()); + regGridD.setWarmHeartedTotal(warmRegData.getTotal()); + regGridD.setPartymemberTotal(partyRegData.getTotal()); + regGridD.setRegIncr(regData.getIncr()); + regGridD.setWarmIncr(warmRegData.getIncr()); + regGridD.setPartymemberIncr(partyRegData.getIncr()); + regGridD.setResiProportion(new BigDecimal(NumConstant.ONE)); + regGridD.setPartymemberProportion(null == regData.getTotal() || regData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)partyRegData.getTotal()/(float)regData.getTotal() ))); + regGridD.setWarmHeartedProportion(null == regData.getTotal() || regData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)warmRegData.getTotal()/(float)regData.getTotal() ))); + regGridD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + if(null != dataPacket.getRegGridDailyList()){ + dataPacket.getRegGridDailyList().add(regGridD); + }else{ + List list = new ArrayList<>(); + list.add(regGridD); + dataPacket.setRegGridDailyList(list); + } + + + //参与用户网格级别 + FactParticipationUserGridDailyDTO partiGridD = new FactParticipationUserGridDailyDTO(); + + partiGridD.setCustomerId(customerId); + partiGridD.setGridId(gridId); + partiGridD.setAgencyId(agencyId); + partiGridD.setDateId(timeDimension.getDateId()); + partiGridD.setWeekId(timeDimension.getWeekId()); + partiGridD.setYearId(timeDimension.getYearId()); + partiGridD.setResiTotal(partiData.getTotal()); + partiGridD.setRegTotal(partiData.getTotal()); + partiGridD.setWarmHeartedTotal(warmPartiData.getTotal()); + partiGridD.setPartymemberTotal(partyPartiData.getTotal()); + partiGridD.setRegIncr(partiData.getIncr()); + partiGridD.setWarmIncr(warmPartiData.getIncr()); + partiGridD.setPartymemberIncr(partyPartiData.getIncr()); + partiGridD.setResiProportion(new BigDecimal(NumConstant.ONE)); + partiGridD.setPartymemberProportion(null == partiData.getTotal() || partiData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)partyPartiData.getTotal()/(float)partiData.getTotal() ))); + partiGridD.setWarmHeartedProportion(null == partiData.getTotal() || partiData.getTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float)warmPartiData.getTotal()/(float)partiData.getTotal() ))); + partiGridD.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + if(null != dataPacket.getPartiGridDailyList()){ + dataPacket.getPartiGridDailyList().add(partiGridD); + }else{ + List list = new ArrayList<>(); + list.add(partiGridD); + dataPacket.setPartiGridDailyList(list); + } + + + + FactRegUserGridMonthlyDTO regGridM = new FactRegUserGridMonthlyDTO(); + regGridM.setCustomerId(customerId); + regGridM.setAgencyId(agencyId); + regGridM.setGridId(gridId); + regGridM.setMonthId(timeDimension.getMonthId()); + regGridM.setQuarterId(timeDimension.getQuarterId()); + regGridM.setYearId(timeDimension.getYearId()); + regGridM.setRegTotal(regData.getTotal()); + regGridM.setResiTotal(regData.getTotal()); + regGridM.setWarmHeartedTotal(warmRegData.getTotal()); + regGridM.setPartymemberTotal(partyRegData.getTotal()); + regGridM.setRegIncr(regData.getIncr()); + regGridM.setWarmIncr(warmRegData.getIncr()); + regGridM.setPartymemberIncr(partyRegData.getIncr()); + regGridM.setResiProportion(new BigDecimal(NumConstant.ONE)); + regGridM.setPartymemberProportion(regGridD.getPartymemberProportion()); + regGridM.setWarmHeartedProportion(regGridD.getWarmHeartedProportion()); + regGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + FactParticipationUserGridMonthlyDTO partiGridM = new FactParticipationUserGridMonthlyDTO(); + partiGridM.setCustomerId(customerId); + partiGridM.setAgencyId(agencyId); + partiGridM.setGridId(gridId); + partiGridM.setMonthId(timeDimension.getMonthId()); + partiGridM.setQuarterId(timeDimension.getQuarterId()); + partiGridM.setYearId(timeDimension.getYearId()); + partiGridM.setRegTotal(partiData.getTotal()); + partiGridM.setResiTotal(partiData.getTotal()); + partiGridM.setWarmHeartedTotal(warmPartiData.getTotal()); + partiGridM.setPartymemberTotal(partyPartiData.getTotal()); + partiGridM.setRegIncr(partiData.getIncr()); + partiGridM.setWarmIncr(warmPartiData.getIncr()); + partiGridM.setPartymemberIncr(partyPartiData.getIncr()); + partiGridM.setResiProportion(new BigDecimal(NumConstant.ONE)); + partiGridM.setPartymemberProportion(partiGridD.getPartymemberProportion()); + partiGridM.setWarmHeartedProportion(partiGridD.getWarmHeartedProportion()); + partiGridM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); + + + + + //如果是月初第一天,不再做日期区间查询 + if(monthBeginningFlag){ + if(null != dataPacket.getRegGridMonthlyList()){ + dataPacket.getRegGridMonthlyList().add(regGridM); + }else{ + List list = new ArrayList<>(); + list.add(regGridM); + dataPacket.setRegGridMonthlyList(list); + } + + + if(null != dataPacket.getPartiGridMonthlyList()){ + dataPacket.getPartiGridMonthlyList().add(partiGridM); + }else{ + List list = new ArrayList<>(); + list.add(partiGridM); + dataPacket.setPartiGridMonthlyList(list); + } + + }else{ + //本月注册用户增长数 + Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,calendar.getTime(),targetDateCheck); + //本月新增注册用户Id集合 + List incrRegIdsMonthly = userDao.selectIncrUserIdsWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,singleGridIdSet,calendar.getTime(),targetDateCheck); + //本月新增党员数(注册用户) + Integer incrPartyOfRegMonthly = userDao.selectPartyIncrWithinTimeRange(incrRegIdsMonthly,calendar.getTime(),targetDateCheck); + //本月新增热心居民数(注册用户) + Integer incrWarmOfRegMonthly = userDao.selectWarmIncrWithinTimeRange(incrRegIdsMonthly,singleGridIdSet,calendar.getTime(),targetDateCheck); + + + //本月参与用户增长数 + Integer partiIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,singleGridIdSet,calendar.getTime(),targetDateCheck); + //本月新增参与用户Id集合 + List incrPartiIdsMonthly = userDao.selectIncrUserIdsWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_PARTI,singleGridIdSet,calendar.getTime(),targetDateCheck); + //本月新增党员数(参与用户) + Integer incrPartyOfPartiMonthly = userDao.selectPartyIncrWithinTimeRange(incrPartiIdsMonthly,calendar.getTime(),targetDateCheck); + //本月新增热心居民数(参与用户) + Integer incrWarmOfPartiMonthly = userDao.selectWarmIncrWithinTimeRange(incrPartiIdsMonthly,singleGridIdSet,calendar.getTime(),targetDateCheck); + + + regGridM.setRegIncr(regIncrMonthly); + regGridM.setWarmIncr(incrWarmOfRegMonthly); + regGridM.setPartymemberIncr(incrPartyOfRegMonthly); + + if(null != dataPacket.getRegGridMonthlyList()){ + dataPacket.getRegGridMonthlyList().add(regGridM); + }else{ + List list = new ArrayList<>(); + list.add(regGridM); + dataPacket.setRegGridMonthlyList(list); + } + + + partiGridM.setRegIncr(partiIncrMonthly); + partiGridM.setWarmIncr(incrWarmOfPartiMonthly); + partiGridM.setPartymemberIncr(incrPartyOfPartiMonthly); + + if(null != dataPacket.getPartiGridMonthlyList()){ + dataPacket.getPartiGridMonthlyList().add(partiGridM); + }else{ + List list = new ArrayList<>(); + list.add(partiGridM); + dataPacket.setPartiGridMonthlyList(list); + } + + } + + + singleGridIdSet.clear(); + + }); } - } + + + } + public static void main(String[] args) { @@ -213,7 +644,7 @@ public class UserServiceImpl implements UserService { SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); - calendar.set(Calendar.DAY_OF_MONTH, 1); + //calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java deleted file mode 100644 index 125e46e962..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/ArticlePublishRangeService.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.service.voice; - -import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO; -import com.epmet.entity.voice.ArticlePublishRangeEntity; - -import java.util.Date; -import java.util.List; - -/** - * 文章发布范围表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-06-17 - */ -public interface ArticlePublishRangeService extends BaseService { - - /** - * desc: 根据客户Id 、创建日期查询 有史以来所有的发布文章总数 - * - * @param customerId - * @param createDate - * @return: List - * @date: 2020/6/17 16:59 - * @author: jianjun liu - * email:liujianjun@git.elinkit.com.cn - */ - List getAllPublishedCount(String customerId, Date createDate); - - /** - * desc: 根据客户Id、创建日期查询某一天的 文章发布数据 - * - * @param customerId - * @param startDate - * @param endDate - * @return: List - * @date: 2020/6/17 21:43 - * @author: jianjun liu - * email:liujianjun@git.elinkit.com.cn - */ - List getOneDayPublishedCount(String customerId, Date startDate, Date endDate); -} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.java new file mode 100644 index 0000000000..609d68cf5c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/TagCustomerService.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.service.voice; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.voice.TagCustomerEntity; + +import java.util.List; + +/** + * 客户标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-02 + */ +public interface TagCustomerService extends BaseService { + + List getTagDefaultList(String customerId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java deleted file mode 100644 index 8fc2f430cd..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/ArticlePublishRangeServiceImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.service.voice.impl; - -import com.epmet.commons.dynamic.datasource.annotation.DataSource; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.constant.DataSourceConstant; -import com.epmet.dao.voice.ArticlePublishRangeDao; -import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO; -import com.epmet.entity.voice.ArticlePublishRangeEntity; -import com.epmet.service.voice.ArticlePublishRangeService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; - -/** - * 文章发布范围表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-06-17 - */ -@Slf4j -@Service -@DataSource(DataSourceConstant.GOV_VOICE) -public class ArticlePublishRangeServiceImpl extends BaseServiceImpl implements ArticlePublishRangeService { - - - @Override - public List getAllPublishedCount(String customerId, Date createDate) { - log.debug("getAllPublishedCount param customerId:{},createDate:{}", customerId, createDate); - return baseDao.getAllPublishedCount(customerId, createDate); - } - - /** - * desc: 根据客户Id、创建日期查询某一天的 文章发布数据 - * - * @param customerId - * @param startDate - * @param endDate - * @return: List - * @date: 2020/6/17 21:43 - * @author: jianjun liu - * email:liujianjun@git.elinkit.com.cn - */ - @Override - public List getOneDayPublishedCount(String customerId, Date startDate, Date endDate) { - log.debug("getOneDayPublishedCount param startDate:{},endDate:{}", startDate, endDate); - return baseDao.getOneDayPublishedCount(customerId, startDate, endDate); - } -} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java new file mode 100644 index 0000000000..36e872429e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/voice/impl/TagCustomerServiceImpl.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.voice.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.voice.TagCustomerDao; +import com.epmet.entity.voice.TagCustomerEntity; +import com.epmet.service.voice.TagCustomerService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 客户标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-06-02 + */ +@Service +@DataSource(DataSourceConstant.GOV_VOICE) +public class TagCustomerServiceImpl extends BaseServiceImpl implements TagCustomerService { + + @Override + public List getTagDefaultList(String customerId) { + return baseDao.getTagDefaultList(customerId); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java index 1ef0b26a51..7473434df9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -16,4 +16,27 @@ public interface ModuleConstant { * 机关级别-社区 * */ String AGENCY_LEVEL_COMMUNITY = "community"; + + /** + * 维度: 下级机关 + * */ + String DIM_SUB_AGENCY = "agency"; + + /** + * 维度: 直属网格 + * */ + String DIM_BELONGING_GRID = "grid"; + + /** + * 统计机器人 + * */ + String CREATED_BY_STATISTICAL_ROBOT = "STATISTICAL_ROBOT"; + + String EXCEPTION_DING_INTERCEPTOR_PREFIX_AGENCY_USER_STATISTICAL = "agencyUserStats"; + + String EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL = "gridUserStats"; + + String EXCEPTION_DING_INTERCEPTOR_PREFIX_TOPIC_STATISTICAL = "topicStats"; + + String LOG_WARN_NO_AGENCY_MESSAGE = "没有相应的机关集合"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql index 81f9cb98f1..60d6b107fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/data_statistical.sql @@ -572,5 +572,404 @@ CREATE TABLE `fact_tag_viewed_grid_yearly` ( PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章引用标签阅读数量【网格】年度统计表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for fact_group_agency_monthly +-- ---------------------------- +DROP TABLE IF EXISTS fact_group_agency_monthly;;/*SkipError*/ +CREATE TABLE `fact_group_agency_monthly` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `PID` varchar(64) DEFAULT NULL COMMENT '父级机关ID', + `MONTH_ID` varchar(32) NOT NULL COMMENT '统计月份ID 关联月份dim表', + `QUARTER_ID` varchar(32) NOT NULL COMMENT '统计季度ID', + `YEAR_ID` varchar(32) NOT NULL COMMENT '统计年份ID', + `GRID_TOTAL` int(11) DEFAULT NULL COMMENT '网格数 截至到月末的机关下网格数', + `GROUP_TOTAL` int(11) DEFAULT NULL COMMENT '小组数 截止到月末的新增数(该月内所有的新增数字之和)', + `GROUP_MEMBER_TOTAL` int(11) DEFAULT NULL COMMENT '机关下网格组内总人数 不去重', + `GROUP_MEMBER_AVG_COUNT` int(11) DEFAULT NULL COMMENT '小组平均人数 月末一天的平均数', + `GROUP_MEDIAN` int(11) DEFAULT NULL COMMENT '小组中位数 月末一天的中位数(人)', + `GROUP_INCR` int(11) DEFAULT NULL COMMENT '小组增量', + `GROUP_MEMBER_MAX_COUNT` int(11) DEFAULT NULL COMMENT '小组成员最大数', + `MAX_MEMBER_GROUP_ID` varchar(32) DEFAULT NULL COMMENT '成员最多小组ID', + `GROUP_MEMBER_MIN_COUNT` int(11) DEFAULT NULL COMMENT '小组成员最小数', + `MIN_MEMBER_GROUP_ID` varchar(32) DEFAULT NULL COMMENT '成员最少小组ID', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 未删除:0,已删除:1', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组-机关月统计数据'; + + + + + +-- ---------------------------- +-- Table structure for fact_group_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_group_grid_daily;;/*SkipError*/ +CREATE TABLE `fact_group_grid_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机构ID 关联机关dim表', + `GRID_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', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年ID', + `QUARTER_ID` varchar(32) NOT NULL COMMENT '季度ID', + `GRID_TOTAL` int(11) DEFAULT '0' COMMENT '网格数 当前网格下的网格数', + `GROUP_TOTAL` int(11) DEFAULT '0' COMMENT '小组数', + `GROUP_MEMBER_TOTAL` int(11) DEFAULT '0' COMMENT '网格下所有组内总人数 不去重', + `GROUP_MEMBER_AVG_COUNT` int(11) DEFAULT '0' COMMENT '小组平均人数', + `GROUP_MEDIAN` int(11) DEFAULT '0' COMMENT '小组中位数 截至统计日期,小组人数依次由小到大排开取中位数', + `GROUP_INCR` int(11) DEFAULT '0' COMMENT '小组增量', + `GROUP_MEMBER_MAX_COUNT` int(11) DEFAULT NULL COMMENT '小组成员最大数', + `MAX_MEMBER_GROUP_ID` varchar(32) DEFAULT NULL COMMENT '最多成员小组ID', + `GROUP_MEMBER_MIN_COUNT` int(11) DEFAULT NULL COMMENT '小组成员最小数', + `MIN_MEMBER_GROUP_ID` varchar(32) DEFAULT NULL COMMENT '最少成员小组ID', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 未删除:0,已删除:1', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组-网格日统计数据'; + + + + +-- ---------------------------- +-- Table structure for fact_group_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_group_agency_daily;;/*SkipError*/ +CREATE TABLE `fact_group_agency_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机构ID', + `PID` varchar(64) DEFAULT 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_TOTAL` int(11) DEFAULT '0' COMMENT '网格总数 截至统计日期', + `GROUP_TOTAL_COUNT` int(11) DEFAULT '0' COMMENT '网格小组数(包含所有下级机关的网格小组) 截至统计日期', + `GROUP_MEMBER_TOTAL_COUNT` int(11) DEFAULT '0' COMMENT '机关下网格小组人数总计 不去重', + `GROUP_MEMBER_AVG_COUNT` int(11) DEFAULT '0' COMMENT '小组平均人数 截至统计日期', + `GROUP_MEDIAN` int(11) DEFAULT '0' COMMENT '小组中位数 截至统计日期,小组人数依次由小到大排开取中位数', + `GROUP_INCR` int(11) DEFAULT '0' COMMENT '当天小组增量', + `GROUP_MEMBER_MAX_COUNT` varchar(32) DEFAULT NULL COMMENT '小组最大成员数', + `MAX_MEMBER_GROUP_ID` varchar(32) DEFAULT NULL COMMENT '最多成员小组ID', + `GROUP_MEMBER_MIN_COUNT` varchar(32) DEFAULT NULL COMMENT '小组最小成员数', + `MIN_MEMBER_GROUP_ID` varchar(32) DEFAULT NULL COMMENT '最少成员小组ID', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 未删除:0,已删除:1', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组-机关日统计数据'; + + + + + +-- ---------------------------- +-- Table structure for fact_topic_status_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_status_agency_daily;;/*SkipError*/ +CREATE TABLE `fact_topic_status_agency_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机构ID 关联机关dm表', + `PID` varchar(64) NOT NULL COMMENT '父级机关ID', + `DATE_ID` varchar(32) NOT NULL COMMENT '统计日期 关联日期dm表', + `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', + `TOPIC_STATUS_ID` varchar(32) NOT NULL COMMENT '话题状态ID 关联dim_topic_status表\n讨论中 discussing\n已屏蔽 hidden\n已关闭 closed\n已转项目 shift_project', + `TOPIC_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '话题数量 指定状态的话题数量', + `TOPIC_PROPORTION` decimal(11,6) NOT NULL COMMENT '话题状态百分比 指定状态话题数/话题总数\n总数在topic_total_agency_daily中', + `TOPIC_INCREMENT` int(11) NOT NULL DEFAULT '0' COMMENT '话题增量 单位时间内的状态话题的增加数', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='状态话题-机关日统计数据表'; + + + + + + +-- ---------------------------- +-- Table structure for fact_topic_status_agency_monthly +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_status_agency_monthly;;/*SkipError*/ +CREATE TABLE `fact_topic_status_agency_monthly` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机构ID 关联机关dm表', + `PID` varchar(64) DEFAULT NULL COMMENT '父级机关ID', + `MONTH_ID` varchar(32) NOT NULL COMMENT '统计月份 关联月度dm表', + `QUARTER_ID` varchar(32) NOT NULL COMMENT '季度ID 关联季度dm表', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年ID 关联年度dm表', + `TOPIC_STATUS_ID` varchar(32) NOT NULL COMMENT '话题状态 讨论中 discussing\n已屏蔽 hidden\n已关闭 closed\n已转项目 shift_project', + `TOPIC_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '话题数量', + `TOPIC_PROPORTION` decimal(11,6) NOT NULL COMMENT '话题状态占比 月末一天 \n指定状态话题数/话题总数\n总数在topic_total_agency_daily中', + `TOPIC_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '话题增量 单位时间内的话题状态增加数', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='状态话题-机关月统计数据表'; + + + + + +-- ---------------------------- +-- Table structure for fact_topic_status_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_status_grid_daily;;/*SkipError*/ +CREATE TABLE `fact_topic_status_grid_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID 关联网格dm表', + `DATE_ID` varchar(32) NOT NULL COMMENT '日期ID', + `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', + `TOPIC_STATUS_ID` varchar(32) DEFAULT NULL COMMENT '话题状态ID 讨论中 discussing\n已屏蔽 hidden\n已关闭 closed\n已转项目 shift_project', + `TOPIC_COUNT` int(11) DEFAULT '0' COMMENT '话题数量', + `TOPIC_PROPORTION` decimal(11,6) DEFAULT NULL COMMENT '话题状态占比 指定状态话题数/话题总数\n总数在topic_total_grid_daily中', + `TOPIC_INCREMENT` int(11) DEFAULT '0' COMMENT '话题增量', + `DEL_FLAG` varchar(32) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='状态话题-网格日统计数据表'; + + + + + + +-- ---------------------------- +-- Table structure for fact_topic_total_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_total_agency_daily;;/*SkipError*/ +CREATE TABLE `fact_topic_total_agency_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `PID` varchar(64) DEFAULT NULL COMMENT '父级机关ID', + `DATE_ID` varchar(32) NOT NULL COMMENT '统计日期 关联日期dm表', + `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', + `TOPIC_TOTAL` int(11) DEFAULT '0' COMMENT '话题总数', + `TOPIC_INCR` int(11) DEFAULT '0' COMMENT '话题增量', + `HIDDEN_TOTAL_COUNT` int(11) DEFAULT '0' COMMENT '屏蔽话题数', + `ISSUE_TOTAL_COUNT` int(11) DEFAULT '0' COMMENT '已转议题数', + `DEL_FLAG` varchar(32) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='话题总数-机关日统计表'; + + + + + + +-- ---------------------------- +-- Table structure for fact_topic_total_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_total_grid_daily;;/*SkipError*/ +CREATE TABLE `fact_topic_total_grid_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '机关ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', + `DATE_ID` varchar(32) NOT NULL COMMENT '统计日期 关联日期dm表', + `WEEK_ID` varchar(32) DEFAULT NULL COMMENT '周ID', + `MONTH_ID` varchar(32) DEFAULT NULL COMMENT '月ID', + `QUARTER_ID` varchar(32) DEFAULT NULL COMMENT '季度ID', + `YEAR_ID` varchar(32) DEFAULT NULL COMMENT '年ID', + `TOPIC_TOTAL` int(11) DEFAULT NULL COMMENT '话题总量', + `TOPIC_INCR` int(11) DEFAULT NULL COMMENT '话题增量', + `HIDDEN_TOTAL_COUNT` int(11) DEFAULT NULL COMMENT '屏蔽话题数量', + `ISSUE_TOTAL_COUNT` int(11) DEFAULT NULL COMMENT '已转议题数量', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL DEFAULT '0' COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL DEFAULT '0' COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='话题总数-网格日统计表'; + + + + + + +-- ---------------------------- +-- Table structure for fact_topic_issue_agency_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_issue_agency_daily;;/*SkipError*/ +CREATE TABLE `fact_topic_issue_agency_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL DEFAULT '' COMMENT '客户Id', + `PID` varchar(64) DEFAULT NULL COMMENT '父级机关ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `DATE_ID` varchar(32) NOT NULL COMMENT '日期ID', + `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', + `ISSUE_TOTAL` int(11) DEFAULT '0' COMMENT '已转议题数量', + `ISSUE_INCR` int(11) DEFAULT '0' COMMENT '已转议题当日增量', + `DEL_FLAG` varchar(32) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转议题话题-机关日统计数据表'; + + + + + +-- ---------------------------- +-- Table structure for fact_topic_issue_agency_monthly +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_issue_agency_monthly;;/*SkipError*/ +CREATE TABLE `fact_topic_issue_agency_monthly` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `PID` varchar(64) DEFAULT 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', + `ISSUE_TOTAL` int(11) DEFAULT '0' COMMENT '已转议题总量', + `ISSUE_INCR` int(11) DEFAULT '0' COMMENT '已转议题增量', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转议题话题-机关月统计表'; + + + + + + +-- ---------------------------- +-- Table structure for fact_topic_issue_grid_daily +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_issue_grid_daily;;/*SkipError*/ +CREATE TABLE `fact_topic_issue_grid_daily` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', + `DATE_ID` varchar(32) NOT NULL COMMENT '日期ID', + `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', + `ISSUE_INCR` int(11) DEFAULT '0' COMMENT '新增转议题数', + `ISSUE_TOTAL` int(11) DEFAULT '0' COMMENT '转议题总数', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`,`CUSTOMER_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转议题话题-网格日统计表'; + + + + + + +-- ---------------------------- +-- Table structure for fact_topic_issue_grid_monthly +-- ---------------------------- +DROP TABLE IF EXISTS fact_topic_issue_grid_monthly;;/*SkipError*/ +CREATE TABLE `fact_topic_issue_grid_monthly` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关ID', + `GRID_ID` varchar(64) 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', + `ISSUE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '已转议题增量', + `ISSUE_TOTAL` int(11) NOT NULL DEFAULT '0' COMMENT '已转议题总量', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转议题话题-网格月统计表'; + + + + +-- ---------------------------- +-- Table structure for dim_topic_status +-- ---------------------------- +DROP TABLE IF EXISTS dim_topic_status;;/*SkipError*/ +CREATE TABLE dim_topic_status( + ID VARCHAR(32) NOT NULL COMMENT '唯一标识 话题状态ID"discussing"、"hidden"、"closed"' , + STATUS_DESC VARCHAR(32) NOT NULL COMMENT '状态描述 讨论中 已屏蔽 已关闭' , + DEL_FLAG VARCHAR(32) NOT NULL DEFAULT 0 COMMENT '删除标识' , + REVISION INT NOT NULL DEFAULT 0 COMMENT '乐观锁' , + CREATED_BY VARCHAR(32) NOT NULL COMMENT '创建人' , + CREATED_TIME DATETIME NOT NULL COMMENT '创建时间' , + UPDATED_BY VARCHAR(32) NOT NULL COMMENT '更新人' , + UPDATED_TIME DATETIME NOT NULL COMMENT '更新时间' , + PRIMARY KEY (ID) +) COMMENT = '话题状态维度表 ';; + +ALTER TABLE dim_topic_status COMMENT '话题状态维度表';; + + + SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml index ae47a96fcd..fb3deaefb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml @@ -126,10 +126,12 @@ 15 - + ERROR ACCEPT DENY + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -137,7 +139,6 @@ - diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml index 968ca9d83d..0ed8f428fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml @@ -73,7 +73,6 @@ @@ -44,7 +44,7 @@ AND ORIGIN = 'issue' AND STATUS = 'closed' AND CUSTOMER_ID = #{customerId} - AND UPDATED_TIME = #{date} + AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') = #{date} GROUP BY AGENCY_ID, CLOSED_STATUS @@ -60,7 +60,7 @@ AND ORIGIN = 'issue' AND STATUS = 'closed' AND CUSTOMER_ID = #{customerId} - AND UPDATED_TIME #{date} + AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') #{date} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml index 9f839a668e..5f6816ff3b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml @@ -5,9 +5,9 @@ + - - - - - - - diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml index d2ef1b2a30..ced5e75721 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml @@ -91,11 +91,7 @@ fact_group_agency_daily WHERE del_flag = '0' - AND DATE_FORMAT(date_id,'%Y%m') = #{monthId} - GROUP BY - AGENCY_ID - ORDER BY - DATE_ID DESC + AND date_id = (SELECT MAX(date_id) FROM fact_group_agency_daily WHERE del_flag = '0') @@ -107,7 +103,7 @@ fact_group_agency_daily WHERE del_flag = '0' - AND SUBSTRING( date_id, 1, 6 ) = #{monthId} + AND month_id = #{monthId} GROUP BY agency_id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyDailyDao.xml index b99b5e409b..6a18c289ce 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyDailyDao.xml @@ -13,7 +13,7 @@ AGENCY_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyMonthlyDao.xml index 05d22a1a38..124bd1f198 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedAgencyMonthlyDao.xml @@ -10,7 +10,7 @@ AGENCY_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID @@ -32,7 +32,7 @@ AGENCY_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentDailyDao.xml index 8e8fb7e9b3..1f802a277e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentDailyDao.xml @@ -14,7 +14,7 @@ DEPARTMENT_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentMonthlyDao.xml index af8efb5266..9aad892518 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedDepartmentMonthlyDao.xml @@ -10,7 +10,7 @@ DEPARTMENT_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID @@ -32,7 +32,7 @@ DEPARTMENT_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridDailyDao.xml index 1970dc22a7..adb493b15e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridDailyDao.xml @@ -12,7 +12,7 @@ GRID_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridMonthlyDao.xml index 67974a20e2..297903ed89 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagUsedGridMonthlyDao.xml @@ -11,7 +11,7 @@ GRID_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID @@ -33,7 +33,7 @@ GRID_ID, TAG_ID, TAG_NAME, - COUNT( USED_COUNT ) USED_COUNT, + SUM( USED_COUNT ) USED_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyDailyDao.xml index f8c7a55728..be981cd24f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyDailyDao.xml @@ -13,7 +13,7 @@ AGENCY_ID, TAG_ID, TAG_NAME, - COUNT( TAG_READ_COUNT ) TAG_READ_COUNT, + SUM( TAG_READ_COUNT ) TAG_READ_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyMonthlyDao.xml index 85e33ec0ac..8a313e66bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedAgencyMonthlyDao.xml @@ -12,7 +12,7 @@ AGENCY_ID, TAG_ID, TAG_NAME, - COUNT( TAG_READ_COUNT ) TAG_READ_COUNT, + SUM( TAG_READ_COUNT ) TAG_READ_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID @@ -34,7 +34,7 @@ AGENCY_ID, TAG_ID, TAG_NAME, - COUNT( TAG_READ_COUNT ) TAG_READ_COUNT, + SUM( TAG_READ_COUNT ) TAG_READ_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridDailyDao.xml index 3fa886f434..556242237e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridDailyDao.xml @@ -14,7 +14,7 @@ GRID_ID, TAG_ID, TAG_NAME, - COUNT( TAG_READ_COUNT ) TAG_READ_COUNT, + SUM( TAG_READ_COUNT ) TAG_READ_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridMonthlyDao.xml index 8bde85f5a3..e3c9f89bdc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTagViewedGridMonthlyDao.xml @@ -13,7 +13,7 @@ GRID_ID, TAG_ID, TAG_NAME, - COUNT( TAG_READ_COUNT ) TAG_READ_COUNT, + SUM( TAG_READ_COUNT ) TAG_READ_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID @@ -35,7 +35,7 @@ GRID_ID, TAG_ID, TAG_NAME, - COUNT( TAG_READ_COUNT ) TAG_READ_COUNT, + SUM( TAG_READ_COUNT ) TAG_READ_COUNT, MONTH_ID, QUARTER_ID, YEAR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueAgencyDailyDao.xml new file mode 100644 index 0000000000..796804c0c9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueAgencyDailyDao.xml @@ -0,0 +1,84 @@ + + + + + + + INSERT INTO fact_topic_issue_agency_daily + ( + ID, + + PID, + + AGENCY_ID, + + CUSTOMER_ID, + + DATE_ID, + + WEEK_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + ISSUE_TOTAL, + + ISSUE_INCR, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.pid}, + + #{item.agencyId}, + + #{item.customerId}, + + #{item.dateId}, + + #{item.weekId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.issueTotal}, + + #{item.issueIncr}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_issue_agency_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueAgencyMonthlyDao.xml new file mode 100644 index 0000000000..1d85661ddd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueAgencyMonthlyDao.xml @@ -0,0 +1,78 @@ + + + + + + + INSERT INTO fact_topic_issue_agency_monthly + ( + ID, + + PID, + + AGENCY_ID, + + CUSTOMER_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + ISSUE_TOTAL, + + ISSUE_INCR, + + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.pid}, + + #{item.agencyId}, + + #{item.customerId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.issueTotal}, + + #{item.issueIncr}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_issue_agency_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueGridDailyDao.xml new file mode 100644 index 0000000000..d509a646bf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueGridDailyDao.xml @@ -0,0 +1,87 @@ + + + + + + + INSERT INTO fact_topic_issue_grid_daily + ( + ID, + + AGENCY_ID, + + GRID_ID, + + CUSTOMER_ID, + + DATE_ID, + + WEEK_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + ISSUE_TOTAL, + + ISSUE_INCR, + + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.gridId}, + + #{item.customerId}, + + #{item.dateId}, + + #{item.weekId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.issueTotal}, + + #{item.issueIncr}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_issue_grid_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueGridMonthlyDao.xml new file mode 100644 index 0000000000..e9232f4a24 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicIssueGridMonthlyDao.xml @@ -0,0 +1,77 @@ + + + + + + + INSERT INTO fact_topic_issue_grid_monthly + ( + ID, + + AGENCY_ID, + + GRID_ID, + + CUSTOMER_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + ISSUE_TOTAL, + + ISSUE_INCR, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.gridId}, + + #{item.customerId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.issueTotal}, + + #{item.issueIncr}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_issue_grid_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyDailyDao.xml new file mode 100644 index 0000000000..f8f4a16a84 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyDailyDao.xml @@ -0,0 +1,95 @@ + + + + + + + INSERT INTO fact_topic_status_agency_daily + ( + ID, + + AGENCY_ID, + + PID, + + CUSTOMER_ID, + + DATE_ID, + + WEEK_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + TOPIC_STATUS_ID, + + TOPIC_COUNT, + + TOPIC_PROPORTION, + + TOPIC_INCREMENT, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.pid}, + + #{item.customerId}, + + #{item.dateId}, + + #{item.weekId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.topicStatusId}, + + #{item.topicCount}, + + #{item.topicProportion}, + + #{item.topicIncrement}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_status_agency_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyMonthlyDao.xml new file mode 100644 index 0000000000..721ba53791 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusAgencyMonthlyDao.xml @@ -0,0 +1,86 @@ + + + + + + + INSERT INTO fact_topic_status_agency_monthly + ( + ID, + + AGENCY_ID, + + PID, + + CUSTOMER_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + TOPIC_STATUS_ID, + + TOPIC_COUNT, + + TOPIC_PROPORTION, + + TOPIC_INCR, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.pid}, + + #{item.customerId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.topicStatusId}, + + #{item.topicCount}, + + #{item.topicProportion}, + + #{item.topicIncr}, + + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_status_agency_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusGridDailyDao.xml new file mode 100644 index 0000000000..b60c3bffaf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicStatusGridDailyDao.xml @@ -0,0 +1,93 @@ + + + + + + + INSERT INTO fact_topic_status_grid_daily + ( + ID, + + AGENCY_ID, + + GRID_ID, + + CUSTOMER_ID, + + DATE_ID, + + WEEK_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + TOPIC_STATUS_ID, + + TOPIC_COUNT, + + TOPIC_PROPORTION, + + TOPIC_INCREMENT, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.gridId}, + + #{item.customerId}, + + #{item.dateId}, + + #{item.weekId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.topicStatusId}, + + #{item.topicCount}, + + #{item.topicProportion}, + + #{item.topicIncrement}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_status_grid_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalAgencyDailyDao.xml new file mode 100644 index 0000000000..d12e0d8c11 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalAgencyDailyDao.xml @@ -0,0 +1,93 @@ + + + + + + + INSERT INTO fact_topic_total_agency_daily + ( + ID, + + AGENCY_ID, + + PID, + + CUSTOMER_ID, + + DATE_ID, + + WEEK_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + TOPIC_TOTAL, + + TOPIC_INCR, + + HIDDEN_TOTAL_COUNT, + + ISSUE_TOTAL_COUNT, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.pid}, + + #{item.customerId}, + + #{item.dateId}, + + #{item.weekId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.topicTotal}, + + #{item.topicIncr}, + + #{item.hiddenTotalCount}, + + #{item.issueTotalCount}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_total_agency_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml new file mode 100644 index 0000000000..537a46cebb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/topic/FactTopicTotalGridDailyDao.xml @@ -0,0 +1,93 @@ + + + + + + + INSERT INTO fact_topic_total_grid_daily + ( + ID, + + AGENCY_ID, + + GRID_ID, + + CUSTOMER_ID, + + DATE_ID, + + WEEK_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + TOPIC_TOTAL, + + TOPIC_INCR, + + HIDDEN_TOTAL_COUNT, + + ISSUE_TOTAL_COUNT, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.agencyId}, + + #{item.gridId}, + + #{item.customerId}, + + #{item.dateId}, + + #{item.weekId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.topicTotal}, + + #{item.topicIncr}, + + #{item.hiddenTotalCount}, + + #{item.issueTotalCount}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_topic_total_grid_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml new file mode 100644 index 0000000000..b41b6f89dd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyDailyDao.xml @@ -0,0 +1,106 @@ + + + + + + + INSERT INTO fact_participation_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, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + 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.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_participation_user_agency_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyMonthlyDao.xml new file mode 100644 index 0000000000..7215527ed6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserAgencyMonthlyDao.xml @@ -0,0 +1,105 @@ + + + + + + + INSERT INTO fact_participation_user_agency_monthly + ( + ID, + + CUSTOMER_ID, + + AGENCY_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + REG_TOTAL, + + RESI_TOTAL, + + WARM_HEARTED_TOTAL, + + PARTYMEMBER_TOTAL, + + REG_INCR, + + WARM_INCR, + + PARTYMEMBER_INCR, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.customerId}, + + #{item.agencyId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.regTotal}, + + #{item.resiTotal}, + + #{item.warmHeartedTotal}, + + #{item.partymemberTotal}, + + #{item.regIncr}, + + #{item.warmIncr}, + + #{item.partymemberIncr}, + + #{item.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_participation_user_agency_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml new file mode 100644 index 0000000000..575cea1844 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml @@ -0,0 +1,111 @@ + + + + + + + INSERT INTO fact_participation_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, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + 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.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_participation_user_grid_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridMonthlyDao.xml new file mode 100644 index 0000000000..cfe17cd854 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridMonthlyDao.xml @@ -0,0 +1,109 @@ + + + + + + + INSERT INTO fact_participation_user_grid_monthly + ( + ID, + + CUSTOMER_ID, + + AGENCY_ID, + + GRID_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + REG_TOTAL, + + RESI_TOTAL, + + WARM_HEARTED_TOTAL, + + PARTYMEMBER_TOTAL, + + REG_INCR, + + WARM_INCR, + + PARTYMEMBER_INCR, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.customerId}, + + #{item.agencyId}, + + #{item.gridId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.regTotal}, + + #{item.resiTotal}, + + #{item.warmHeartedTotal}, + + #{item.partymemberTotal}, + + #{item.regIncr}, + + #{item.warmIncr}, + + #{item.partymemberIncr}, + + #{item.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_participation_user_grid_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyDailyDao.xml new file mode 100644 index 0000000000..185a97da77 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyDailyDao.xml @@ -0,0 +1,106 @@ + + + + + + + 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, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + 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.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_reg_user_agency_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml new file mode 100644 index 0000000000..aa8548ff1c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserAgencyMonthlyDao.xml @@ -0,0 +1,105 @@ + + + + + + + INSERT INTO fact_reg_user_agency_monthly + ( + ID, + + CUSTOMER_ID, + + AGENCY_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + REG_TOTAL, + + RESI_TOTAL, + + WARM_HEARTED_TOTAL, + + PARTYMEMBER_TOTAL, + + REG_INCR, + + WARM_INCR, + + PARTYMEMBER_INCR, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.customerId}, + + #{item.agencyId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.regTotal}, + + #{item.resiTotal}, + + #{item.warmHeartedTotal}, + + #{item.partymemberTotal}, + + #{item.regIncr}, + + #{item.warmIncr}, + + #{item.partymemberIncr}, + + #{item.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_reg_user_agency_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml new file mode 100644 index 0000000000..f8d85b7ab9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml @@ -0,0 +1,109 @@ + + + + + + + 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, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + 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.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_reg_user_grid_daily + WHERE + DATE_ID = #{dateId} + + AND CUSTOMER_ID = #{customerId} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml new file mode 100644 index 0000000000..f5f66265fe --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml @@ -0,0 +1,110 @@ + + + + + + + INSERT INTO fact_reg_user_grid_monthly + ( + ID, + + CUSTOMER_ID, + + AGENCY_ID, + + GRID_ID, + + MONTH_ID, + + QUARTER_ID, + + YEAR_ID, + + REG_TOTAL, + + RESI_TOTAL, + + WARM_HEARTED_TOTAL, + + PARTYMEMBER_TOTAL, + + REG_INCR, + + WARM_INCR, + + PARTYMEMBER_INCR, + + WARM_HEARTED_PROPORTION, + + RESI_PROPORTION, + + PARTYMEMBER_PROPORTION, + + CREATED_BY, + + CREATED_TIME, + + UPDATED_BY, + + UPDATED_TIME + + + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + + #{item.customerId}, + + #{item.agencyId}, + + #{item.gridId}, + + #{item.monthId}, + + #{item.quarterId}, + + #{item.yearId}, + + #{item.regTotal}, + + #{item.resiTotal}, + + #{item.warmHeartedTotal}, + + #{item.partymemberTotal}, + + #{item.regIncr}, + + #{item.warmIncr}, + + #{item.partymemberIncr}, + + #{item.warmHeartedProportion}, + + #{item.resiProportion}, + + #{item.partymemberProportion}, + + #{item.createdBy}, + + now(), + + #{item.createdBy}, + + now() + ) + + + + + DELETE FROM fact_reg_user_grid_monthly + WHERE + MONTH_ID = #{monthId} + + AND CUSTOMER_ID = #{customerId} + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml new file mode 100644 index 0000000000..819674dbbf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 91dc279ec1..6b796d944e 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 @@ -6,17 +6,17 @@ SELECT - count( 1 ) AS total, + count( DISTINCT urole.USER_ID ) AS total, ( SELECT - count( 1 ) + count( DISTINCT urole.USER_ID) FROM USER_ROLE urole LEFT JOIN EPMET_ROLE erole ON urole.ROLE_ID = erole.ID @@ -138,7 +177,7 @@ urole.USER_ID = #{incrUserId} - + AND urole.CREATED_TIME =]]> #{targetDate} AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) @@ -154,11 +193,22 @@ AND erole.DEL_FLAG = '0' WHERE urole.DEL_FLAG = '0' - - urole.USER_ID = #{userId} - + + - + + AND urole.USER_ID = '' + + + + urole.USER_ID = #{userId} + + + + + + + AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) @@ -171,10 +221,10 @@ @@ -250,14 +324,14 @@ SELECT - count( 1 ) + count( DISTINCT urole.USER_ID) FROM USER_ROLE urole LEFT JOIN EPMET_ROLE erole ON urole.ROLE_ID = erole.ID AND erole.DEL_FLAG = '0' WHERE urole.DEL_FLAG = '0' - - urole.USER_ID = #{incrUserId} - + + + AND urole.USER_ID = '' + + + + urole.USER_ID = #{incrUserId} + + + + AND urole.CREATED_TIME =]]> #{startDate} AND urole.CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) AND erole.ROLE_NAME = '党员' @@ -296,7 +385,7 @@ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml deleted file mode 100644 index 154d617001..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/ArticlePublishRangeDao.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml new file mode 100644 index 0000000000..73defbbf6b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/voice/TagCustomerDao.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml index c56d2e0cfd..9f45cdc9e8 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-job-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-job-server:0.3.13 ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index 295e3985c4..d08f27704a 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.9 + 0.3.13 com.epmet epmet-job diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DimInitService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DimInitService.java new file mode 100644 index 0000000000..6d3f493620 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/DimInitService.java @@ -0,0 +1,9 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +public interface DimInitService { + + Result initAllDims(); + +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsTopicService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsTopicService.java new file mode 100644 index 0000000000..1c8c8e07f1 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsTopicService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +public interface StatsTopicService { + + /** + * @Description 调用统计服务执行统计 - 话题 + * @param + * @return + * @author wangc + * @date 2020.06.29 09:40 + **/ + Result execTopicStatistical(String date); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserService.java new file mode 100644 index 0000000000..334f39f7ef --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +public interface StatsUserService { + + /** + * @Description 调用统计服务-用户 + * @param + * @return + * @author wangc + * @date 2020.06.29 09:39 + **/ + Result execUserStatistical(String date); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimInitServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimInitServiceImpl.java new file mode 100644 index 0000000000..38bdc54135 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/DimInitServiceImpl.java @@ -0,0 +1,19 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.DimInitService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class DimInitServiceImpl implements DimInitService { + + @Autowired + private DataStatisticalOpenFeignClient statsFeignClient; + + @Override + public Result initAllDims() { + return statsFeignClient.initAllDims(); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java new file mode 100644 index 0000000000..cefabfbdc7 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java @@ -0,0 +1,32 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.StatsTopicService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + + +/** + * @Description + * @ClassName StatsTopicServiceImpl + * @Auth wangc + * @Date 2020-06-29 09:47 + */ +@Service +public class StatsTopicServiceImpl implements StatsTopicService { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public Result execTopicStatistical(String date) { + + return dataStatisticalOpenFeignClient.execTopicStatistical(date); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java new file mode 100644 index 0000000000..3082f91779 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -0,0 +1,31 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.StatsUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + + +/** + * @Description + * @ClassName StatsUserServiceImpl + * @Auth wangc + * @Date 2020-06-29 09:41 + */ +@Service +public class StatsUserServiceImpl implements StatsUserService { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public Result execUserStatistical(String date) { + return dataStatisticalOpenFeignClient.execUserStatistical(date); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DimInitTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DimInitTask.java new file mode 100644 index 0000000000..1fa78dd52c --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DimInitTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.DimInitService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/6/23 14:36 + */ +@Slf4j +@Component("dimInitTask") +public class DimInitTask implements ITask { + + @Autowired + private DimInitService dimInitService; + + @Override + public void run(String params) { + log.debug("DimInitTask定时任务正在执行,参数为:{}", params); + Result result = dimInitService.initAllDims(); + if (result.success()){ + log.debug("DimInitTask定时任务正在执行定时任务执行成功"); + }else { + log.debug("DimInitTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedDailyStatsTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedDailyStatsTask.java index 2d850980a4..ef5b147ac8 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedDailyStatsTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedDailyStatsTask.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; /** * desc:标签被使用次数 日统计定时任务 */ -@Component("publicityTagUsedDailyStatsjob") +@Component("publicityTagUsedDailyStatsTask") public class PublicityTagUsedDailyStatsTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java index df99756776..c0a7862b90 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; /** * desc:标签被使用次数 【月、季、年】统计定时任务 */ -@Component("publicityTagUsedMonthlyStatsjob") +@Component("publicityTagUsedMonthlyStatsTask") public class PublicityTagUsedMonthlyStatsTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java new file mode 100644 index 0000000000..a9a816139c --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsPublicityTaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:标签被使用次数 【月、季、年】统计定时任务 + */ +@Component("publicityTagUsedQuarterlyAndYearlyStatsTask") +public class PublicityTagUsedQuarterlyAndYearlyStatsTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private StatsPublicityTaskService statsPublicityTaskService; + + + @Override + public void run(String params) { + logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行,参数为:{}", params); + Result result = statsPublicityTaskService.tagUsedQuarterlyStatsjob(); + if (result.success()) { + logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行定时任务执行成功"); + } else { + logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedQuarterlyAndYearlyhlyStatsTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedQuarterlyAndYearlyhlyStatsTask.java new file mode 100644 index 0000000000..cb03b1a6aa --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedQuarterlyAndYearlyhlyStatsTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsPublicityTaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * desc:标签被阅读次数 【月、季、年】统计定时任务 + */ +@Component("publicityTagViewedQuarterlyAndYearlyhlyStatsTask") +public class PublicityTagViewedQuarterlyAndYearlyhlyStatsTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private StatsPublicityTaskService statsPublicityTaskService; + + + @Override + public void run(String params) { + logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行,参数为:{}", params); + Result result = statsPublicityTaskService.tagUsedQuarterlyStatsjob(); + if (result.success()) { + logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行定时任务执行成功"); + } else { + logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyDailyTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyDailyTask.java index 99f2d1739a..695b4aae18 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyDailyTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyDailyTask.java @@ -24,7 +24,7 @@ public class StatsGroupAgencyDailyTask implements ITask { @Override public void run(String params) { logger.debug("StatsGroupAgencyDailyTask定时任务正在执行,参数为:{}", params); - Result result = statsGroupService.groupGridDaily(); + Result result = statsGroupService.groupAgencyDaily(); if (result.success()){ logger.debug("StatsGroupAgencyDailyTask定时任务正在执行定时任务执行成功"); }else { diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupGridDailyTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupGridDailyTask.java index 675c63ea88..780ba44f18 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupGridDailyTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupGridDailyTask.java @@ -25,7 +25,7 @@ public class StatsGroupGridDailyTask implements ITask { @Override public void run(String params) { logger.debug("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params); - Result result = statsGroupService.groupAgencyDaily(); + Result result = statsGroupService.groupGridDaily(); if (result.success()){ logger.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行成功"); }else { diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsTopicTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsTopicTask.java new file mode 100644 index 0000000000..6570e33b24 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsTopicTask.java @@ -0,0 +1,34 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsTopicService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Description + * @ClassName StatsTopicTask + * @Auth wangc + * @Date 2020-06-29 09:49 + */ +@Component("statsTopicTask") +public class StatsTopicTask implements ITask { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private StatsTopicService statsTopicService; + + @Override + public void run(String params) { + logger.debug("StatsTopicTask定时任务正在执行,参数为:{}", params); + Result result = statsTopicService.execTopicStatistical(params); + if (result.success()){ + logger.debug("StatsTopicTask定时任务正在执行定时任务执行成功"); + }else { + logger.debug("StatsTopicTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserTask.java new file mode 100644 index 0000000000..9fda8cfc88 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserTask.java @@ -0,0 +1,34 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.StatsUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Description + * @ClassName StatsUserTask + * @Auth wangc + * @Date 2020-06-29 09:49 + */ +@Component("statsUserTask") +public class StatsUserTask implements ITask { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private StatsUserService statsUserService; + + @Override + public void run(String params) { + logger.debug("StatsUserTask定时任务正在执行,参数为:{}", params); + Result result = statsUserService.execUserStatistical(params); + if (result.success()){ + logger.debug("StatsUserTask定时任务正在执行定时任务执行成功"); + }else { + logger.debug("StatsUserTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index 9d0a60fbf1..76ac6ca878 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -55,4 +57,13 @@ public interface EpmetMessageOpenFeignClient { **/ @PostMapping(value = "message/sms/sendVerificationCode", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result sendVerificationCode(@RequestBody SendVerificationCodeFormDTO formDTO); + + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 热心居民申请给网格长们发送消息 + **/ + @PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUserMessageList(List msgList); } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java index 6bd8c16bb8..3cc5a5c5eb 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java @@ -10,6 +10,8 @@ import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -39,4 +41,8 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendVerificationCode", formDTO); } + @Override + public Result saveUserMessageList(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml index adc35709b2..9aa157cd04 100644 --- a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-message-server: container_name: epmet-message-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.21 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.23 ports: - "8085:8085" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-server/pom.xml b/epmet-module/epmet-message/epmet-message-server/pom.xml index 01a6bc6f5f..bf543a83f3 100644 --- a/epmet-module/epmet-message/epmet-message-server/pom.xml +++ b/epmet-module/epmet-message/epmet-message-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.21 + 0.3.23 com.epmet epmet-message diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java index 2f8600641e..7f6d02fa40 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java @@ -51,7 +51,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl @Override public PageData page(Map params) { IPage page = baseDao.selectPage( - getPage(params, Constant.CREATE_DATE, false), + getPage(params, Constant.CREATED_TIME, false), getWrapper(params) ); return getPageData(page, SysSmsDTO.class); diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java index fe12ca4a76..457a165fd6 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java @@ -59,7 +59,7 @@ public class IssueDTO implements Serializable { private String closeReason; /** - * 解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 */ private String resolveType; diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 06fc27b887..33d4dd713c 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.42 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.47 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 2dd11868f2..0accecf9f6 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.43 + 0.3.47 gov-issue com.epmet @@ -147,6 +147,7 @@ false + https://epmet-dev.elinkservice.cn/epmetscan/api @@ -179,6 +180,7 @@ true + https://epmet-dev.elinkservice.cn/epmetscan/api diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java index 632d72b70e..1f8ae5abb9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java @@ -29,11 +29,11 @@ public interface IssueConstant { /** * 议题解决类型-已解决 */ - String ISSUE_RESLOVED = "resloved"; + String ISSUE_RESOLVED = "resolved"; /** * 议题解决类型-未解决 */ - String ISSUE_UNRESLOVED = "unresloved"; + String ISSUE_UNRESOLVED = "unresolved"; String SELECT_EXCEPTION = "获取议题详情数据失败"; String UPPDATE_EXCEPTION = "议题详情表数据更新失败"; @@ -91,4 +91,6 @@ public interface IssueConstant { * 北京时区(北京时间) */ String BEIJING_TIME_ZONE = "+8"; + + String REVIEW_ISSUE = "议题评论失败,评论内容为:%s"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java index 3d3fde4b30..5bea3d3a3a 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -18,12 +18,12 @@ public interface UserMessageConstant { /** * 议题关闭时,选择已解决 */ - String ISSUE_RESLOVED_MSG = "您好,您发表的话题\"%s\"问题已解决,解决方案是:%s"; + String ISSUE_RESOLVED_MSG = "您好,您发表的话题\"%s\"问题已解决,解决方案是:%s"; /** * 议题关闭时,选择无需解决 */ - String ISSUE_UNRESLOVED_MSG = "您好,您发表的话题\"%s\"问题无需解决,原因:%s"; + String ISSUE_UNRESOLVED_MSG = "您好,您发表的话题\"%s\"问题无需解决,原因:%s"; /** * 议题转项目消息模板 @@ -33,6 +33,6 @@ public interface UserMessageConstant { /** * 议题转项目消息模板 */ - String PROJECT_RESLOVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; + String PROJECT_RESOLVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java index cfa9b8c046..4c94cbd18d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java @@ -59,7 +59,7 @@ public class IssueEntity extends BaseEpmetEntity { private String closeReason; /** - * 解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 */ private String resolveType; diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java index e012192a3f..7cfa0507da 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java @@ -46,7 +46,7 @@ public class IssueExcel { @Excel(name = "关闭理由 【未关闭时可以为空】关闭议题时必填的理由,转项目后而且已经结案,这个字段不回写") private String closeReason; - @Excel(name = "解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写") + @Excel(name = "解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写") private String resolveType; @Excel(name = "议题名称 最多20字") diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java index 1ca0d1dba0..3d8405232b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java @@ -24,8 +24,13 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.IssueConstant; import com.epmet.dao.IssueSatisfactionDetailDao; import com.epmet.dto.EvaluateInfoDTO; @@ -38,15 +43,18 @@ import com.epmet.dto.result.InitEvaluationResultDTO; import com.epmet.entity.IssueSatisfactionDetailEntity; import com.epmet.redis.IssueSatisfactionDetailRedis; import com.epmet.service.IssueSatisfactionDetailService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; 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 java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.UUID; /** * 议题满意度调查记录表 @@ -55,10 +63,15 @@ import java.util.Map; * @since v1.0.0 2020-05-11 */ @Service +@Slf4j public class IssueSatisfactionDetailServiceImpl extends BaseServiceImpl implements IssueSatisfactionDetailService { @Autowired private IssueSatisfactionDetailRedis issueSatisfactionDetailRedis; + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; @Override public PageData page(Map params) { @@ -142,6 +155,22 @@ public class IssueSatisfactionDetailServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + log.error(String.format(IssueConstant.REVIEW_ISSUE,comment)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } IssueSatisfactionDetailEntity entity = new IssueSatisfactionDetailEntity(); BeanUtils.copyProperties(formDTO,entity); InitEvaluationFormDTO initEvaluation = new InitEvaluationFormDTO(); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index b97e5e51d7..83fff55e27 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -7,10 +7,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.IssueConstant; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserMessageConstant; @@ -42,6 +47,7 @@ import com.epmet.utils.ModuleConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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; @@ -86,6 +92,10 @@ public class IssueServiceImpl extends BaseServiceImpl imp private IssueVoteStatisticalDao issueVoteStatisticalDao; @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; @Override public PageData page(Map params) { @@ -351,6 +361,20 @@ public class IssueServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void closeIssue(CloseIssueFormDTO formDTO) { + //公开回复内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(formDTO.getCloseReason()); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + Date date = new Date(); //1:更新议题详情表数据 IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); @@ -398,10 +422,10 @@ public class IssueServiceImpl extends BaseServiceImpl imp ResiTopicDTO topicDTO = resultTopicDTO.getData(); //4.2:创建消息模板 String messageContent = ""; - if (IssueConstant.ISSUE_RESLOVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_RESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); - } else if (IssueConstant.ISSUE_UNRESLOVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_UNRESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); + if (IssueConstant.ISSUE_RESOLVED.equals(formDTO.getResolveType())) { + messageContent = String.format(UserMessageConstant.ISSUE_RESOLVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); + } else if (IssueConstant.ISSUE_UNRESOLVED.equals(formDTO.getResolveType())) { + messageContent = String.format(UserMessageConstant.ISSUE_UNRESOLVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); } //4.3:调用服务,发送消息 if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { @@ -479,6 +503,20 @@ public class IssueServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public void shiftProject(ShiftProjectFormDTO formDTO) { + //公开回复内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(formDTO.getPublicReply()); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + //因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据 //1:查询议题数据 IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); @@ -504,6 +542,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp //3:调用gov-project服务,新增项目各业务表初始数据 Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); if (!resultDTO.success() || null == resultDTO.getData()) { + logger.error(resultDTO.getInternalMsg()); throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); } IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); @@ -563,7 +602,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp msgList.add(msgIssue); } //2:创建项目工作人员消息对象 - String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESLOVED_MSG, entity.getIssueTitle()); + String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, entity.getIssueTitle()); //所选人员如果即在部门下又在网格下则只发一条消息 Map map = new HashMap<>(); formDTO.getStaffList().forEach(staff->{ 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 c842bf462c..93f2568a4b 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 @@ -103,6 +103,14 @@ ribbon: ReadTimeout: 300000 ConnectTimeout: 300000 +openapi: + scan: + server: + url: @openapi.scan.server.url@ + method: + imgSyncScan: /imgSyncScan + textSyncScan: /textSyncScan + #pageHelper分页插件 pagehelper: helper-dialect: mysql diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/epmet_gov_issue.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/epmet_gov_issue.sql index 978b6ee246..6194b95cbe 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/epmet_gov_issue.sql +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db/migration/epmet_gov_issue.sql @@ -30,7 +30,7 @@ CREATE TABLE `issue` ( `SOURCE_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源类型 eg:resi_topic', `SOURCE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源ID eg:2223232(当SOURCE_TYPE为\"resi_topic\"时,这里指话题的ID)', `CLOSE_REASON` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关闭理由 【未关闭时可以为空】关闭议题时必填的理由,转项目后而且已经结案,这个字段不回写', - `RESOLVE_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写', + `RESOLVE_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写', `ISSUE_TITLE` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '议题名称 最多20字', `SUGGESTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '建议 最多1000字', `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 48cd31c6f1..5c07879fe6 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.27 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.32 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 382580cd85..61e29c166c 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.28 + 0.3.32 gov-project com.epmet @@ -147,6 +147,7 @@ false + https://epmet-dev.elinkservice.cn/epmetscan/api @@ -179,6 +180,7 @@ true + https://epmet-dev.elinkservice.cn/epmetscan/api 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 a2d77e8446..ff9dfb0dc1 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 @@ -113,4 +113,11 @@ public interface ProjectConstant { * 获取项目节点数据失败 */ String SELECT_process_EXCEPTION = "获取项目节点数据失败"; + /** + * 议题转项目已存在项目数据,不能重复转 + * 议题转项目 项目服务数据入库成功,议题数据更新或发送消息失败导致议题数据可以回滚,项目服务数据不能回滚 + */ + String SAVE_PROJECT_EXCEPTION = "已存在项目数据,不能重复转项目"; + + String REVIEW_PROJECT = "项目评论失败,评论内容为:%s"; } 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 3b58c435b7..a45b46bb0a 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 @@ -103,4 +103,12 @@ public interface ProjectDao extends BaseDao { * @Description 获取客户下已结案项目列表,按结案时间倒序 **/ List selectClosedProjectList(LatestListFormDTO formDTO); + + /** + * @param projectDTO + * @return + * @Author sun + * @Description 根据客户Id、机关Id、议题Id查询项目数据是否存在 + **/ + List selectProjectList(ProjectDTO projectDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index 436610ef21..c856ef957b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -23,10 +23,15 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ProjectConstant; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserMessageConstant; @@ -46,6 +51,7 @@ import com.epmet.service.ProjectService; import com.epmet.service.ProjectStaffService; import org.apache.commons.lang3.StringUtils; 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; @@ -77,6 +83,10 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl page(Map params) { @@ -176,6 +186,20 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + //1:更新项目人员关联表数据状态为已处理 ProjectStaffEntity staffEntity = projectStaffDao.selectById(formDTO.getProjectStaffId()); if (null == staffEntity) { 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 e831d30530..fcefe8e5b4 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 @@ -24,10 +24,13 @@ 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.exception.RenException; 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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ProjectConstant; import com.epmet.dao.ProjectSatisfactionDetailDao; import com.epmet.dto.ProjectSatisfactionDetailDTO; @@ -37,9 +40,11 @@ import com.epmet.entity.ProjectSatisfactionDetailEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.ProjectSatisfactionDetailRedis; import com.epmet.service.ProjectSatisfactionDetailService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; 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; @@ -53,12 +58,17 @@ import java.util.stream.Collectors; * @since v1.0.0 2020-05-11 */ @Service +@Slf4j public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl implements ProjectSatisfactionDetailService { @Autowired private ProjectSatisfactionDetailRedis projectSatisfactionDetailRedis; @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; @Override public PageData page(Map params) { @@ -178,6 +188,22 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + log.error(String.format(ProjectConstant.REVIEW_PROJECT,comment)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } ProjectSatisfactionDetailEntity entity = new ProjectSatisfactionDetailEntity(); BeanUtils.copyProperties(formDTO,entity); //校验是否评价 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 29a964851f..9f19a0ecf2 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -27,8 +27,12 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ParameterKeyConstant; import com.epmet.constant.ProjectConstant; import com.epmet.constant.UserMessageConstant; @@ -48,6 +52,7 @@ import com.epmet.redis.ProjectRedis; import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; 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; @@ -82,6 +87,10 @@ public class ProjectServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + //更新项目表状态 ProjectEntity projectEntity = baseDao.selectById(fromDTO.getProjectId()); if (ProjectConstant.CLOSED.equals(projectEntity.getStatus())) { @@ -298,7 +321,6 @@ public class ProjectServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + ProjectEntity projectEntity = baseDao.selectById(fromDTO.getProjectId()); if (ProjectConstant.CLOSED.equals(projectEntity.getStatus())) { throw new RenException(EpmetErrorCode.PROJECT_IS_CLOSED.getCode()); @@ -467,6 +503,17 @@ public class ProjectServiceImpl extends BaseServiceImpl staffList = formDTO.getStaffList(); IssueDTO issueDTO = formDTO.getIssueDTO(); + //0.因项目还未添加分布式事务,议题转项目,如果项目数据入库成功议题数据也修改成功但是消息发送失败时则议题数据可以回滚但项目服务的数据不能回滚 + //先根据客户Id机关Id议题Id查询项目表是否已存在,存在则说明之前转过切失败了,这样的数据不能再操作了,只能操作数据库,将项目表和项目进展表数据清除 + ProjectDTO projectDTO = new ProjectDTO(); + projectDTO.setCustomerId(issueDTO.getCustomerId()); + projectDTO.setAgencyId(issueDTO.getOrgId()); + projectDTO.setOrigin(ProjectConstant.ISSUE); + projectDTO.setOriginId(issueDTO.getId()); + List listProject = baseDao.selectProjectList(projectDTO); + if (null != listProject && listProject.size() > NumConstant.ZERO) { + throw new RenException(ProjectConstant.SAVE_PROJECT_EXCEPTION); + } //1:调用gov-org服务,获取所有勾选人员以及议题数据对应的组织信息、部门信息、网格信息用于对处理部门和ORG_ID_PATH字段的赋值使用 List agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList()); agencyIdList.add(issueDTO.getOrgId()); diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml b/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml index d6aeb50289..ddd3113ac5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml @@ -103,6 +103,14 @@ ribbon: ReadTimeout: 300000 ConnectTimeout: 300000 +openapi: + scan: + server: + url: @openapi.scan.server.url@ + method: + imgSyncScan: /imgSyncScan + textSyncScan: /textSyncScan + #pageHelper分页插件 pagehelper: helper-dialect: mysql diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index 0dad21111b..548eb53128 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -165,4 +165,22 @@ ORDER BY p.created_time DESC + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java index 9d9971ccf3..8a96cc23b4 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java @@ -72,4 +72,10 @@ public interface TopicConstant { * 构造queryWrapper 用户Id * */ String CUSTOMER_USER_ID = "CUSTOMER_USER_ID"; + + String REVIEW_TOPIC = "评论话题失败,评论内容为:%s"; + + String CREATE_TOPIC = "创建话题失败,话题内容为:%s"; + + String SHIFT_ISSUE = "转议题失败,标题为:%s , 建议为:%s"; } diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml index 34276d79e5..c1a06c861e 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.53 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.54 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 60ef52d595..ea2c9bbbd5 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.53 + 0.3.54 com.epmet resi-group @@ -150,6 +150,7 @@ false + https://epmet-dev.elinkservice.cn/epmetscan/api @@ -181,6 +182,7 @@ false true + https://epmet-dev.elinkservice.cn/epmetscan/api diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 72412d91cd..e9162746bf 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -502,7 +502,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl param = new HashMap<>(); - param.put(ModuleConstant.RESI_GROUP_ID_CAMEL, resiGroupDTO.getId()); + param.put(ModuleConstant.RESI_GROUP_ID, resiGroupDTO.getId()); param.put(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); List statisticalList = resiGroupStatisticalService.list(param); if (null != statisticalList && statisticalList.size() > 0) { diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java index 8751f579c2..0f0108348f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java @@ -21,14 +21,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.RedisKeys; +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.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.modules.comment.entity.ResiTopicCommentEntity; @@ -52,10 +57,12 @@ import com.epmet.resi.group.dto.topic.ResiTopicCommentDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO; import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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; @@ -69,6 +76,7 @@ import java.util.stream.Collectors; * @since v1.0.0 2020-03-31 */ @Service +@Slf4j public class ResiTopicCommentServiceImpl extends BaseServiceImpl implements ResiTopicCommentService { @Autowired @@ -86,6 +94,11 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + log.error(String.format(TopicConstant.REVIEW_TOPIC,commentContent)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } //1.判断当前用户是否被禁言 ResiTopicDTO topic = resiTopicService.get(resiCommentFormDTO.getTopicId()); if(null == topic){ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 4e3c3578b2..da1b435b8a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -24,12 +24,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.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.commons.tools.utils.ScanContentUtils; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.CommonDataFilterResultDTO; @@ -72,14 +79,15 @@ import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO; import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO; import com.epmet.resi.group.dto.topic.result.*; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -91,6 +99,7 @@ import java.util.stream.Collectors; * @since v1.0.0 2020-03-31 */ @Service +@Slf4j public class ResiTopicServiceImpl extends BaseServiceImpl implements ResiTopicService { @Autowired @@ -132,6 +141,13 @@ public class ResiTopicServiceImpl extends BaseServiceImpl attachmentList = resiTopicPublishFormDTO.getAttachmentList(); + //创建话题内容审核 + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(topicContent); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + log.error(String.format(TopicConstant.CREATE_TOPIC,topicContent)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + //创建话题图片审核 + if (attachmentList.size() != NumConstant.ZERO){ + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + attachmentList.forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(url); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); + } + } + } if (null == tokenDto) { logger.error(ModuleConstant.USER_NOT_NULL); throw new RenException(ModuleConstant.USER_NOT_NULL); @@ -1045,6 +1096,29 @@ public class ResiTopicServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScan); + if (!textSyncScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + log.error(String.format(TopicConstant.SHIFT_ISSUE,issueTitle,suggestion)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } //1.统一时间(群组服务 -> 议题服务) Date now = new Date(); //2.调用gov-org获取数据权限 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 98f0d3e7bd..dd17343ed3 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 @@ -117,4 +117,12 @@ ribbon: #pageHelper分页插件 pagehelper: helper-dialect: mysql - reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 \ No newline at end of file + reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 + +openapi: + scan: + server: + url: @openapi.scan.server.url@ + method: + imgSyncScan: /imgSyncScan + textSyncScan: /textSyncScan \ No newline at end of file diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java index d92ea44b9d..89a557de68 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java @@ -59,7 +59,7 @@ public class IssueDTO implements Serializable { private String closeReason; /** - * 解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 */ private String resolveType; diff --git a/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml b/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml index cffa5d8eaf..22a0bfc441 100644 --- a/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-hall/resi-hall-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-hall-server: container_name: resi-hall-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-hall-server:0.3.20 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-hall-server:0.3.21 ports: - "8100:8100" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-hall/resi-hall-server/pom.xml b/epmet-module/resi-hall/resi-hall-server/pom.xml index b83cc8aad1..beb8ba5879 100644 --- a/epmet-module/resi-hall/resi-hall-server/pom.xml +++ b/epmet-module/resi-hall/resi-hall-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.20 + 0.3.21 resi-hall com.epmet diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java index d86a754f6c..a20d0e61bc 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java @@ -131,8 +131,8 @@ public class IssueController { // @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_DETAIL) public Result evaluate(@LoginUser TokenDto tokenDto,@RequestBody EvaluateFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); - issueService.evaluate(tokenDto,formDTO); - return new Result(); + return issueService.evaluate(tokenDto,formDTO); + } /** @@ -144,8 +144,8 @@ public class IssueController { // @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_DETAIL) public Result projectEvaluate(@LoginUser TokenDto tokenDto,@RequestBody ProjectEvaluateFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO); - issueService.projectEvaluate(tokenDto,formDTO); - return new Result(); + return issueService.projectEvaluate(tokenDto,formDTO); + } /** diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/IssueService.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/IssueService.java index 36dbe70b15..d71c3e4b03 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/IssueService.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/IssueService.java @@ -2,6 +2,7 @@ package com.epmet.service; 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.dto.form.*; import com.epmet.dto.result.*; import org.springframework.web.bind.annotation.RequestBody; @@ -72,14 +73,14 @@ public interface IssueService { * @param evaluateFormDTO * @author zxc */ - void evaluate(TokenDto tokenDto,EvaluateFormDTO evaluateFormDTO); + Result evaluate(TokenDto tokenDto,EvaluateFormDTO evaluateFormDTO); /** * @Description 提交满意度评价——已转项目 * @param projectEvaluateFormDTO * @author zxc */ - void projectEvaluate(TokenDto tokenDto, ProjectEvaluateFormDTO projectEvaluateFormDTO); + Result projectEvaluate(TokenDto tokenDto, ProjectEvaluateFormDTO projectEvaluateFormDTO); /** * @Description 满意度评价列表——已关闭 diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 854eb51aea..0551eb8423 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -201,9 +201,9 @@ public class IssueServiceImpl implements IssueService { * @author zxc */ @Override - public void evaluate(TokenDto tokenDto, EvaluateFormDTO evaluateFormDTO) { + public Result evaluate(TokenDto tokenDto, EvaluateFormDTO evaluateFormDTO) { evaluateFormDTO.setUserId(tokenDto.getUserId()); - govIssueFeignClient.evaluate(evaluateFormDTO); + return govIssueFeignClient.evaluate(evaluateFormDTO); } /** @@ -212,9 +212,9 @@ public class IssueServiceImpl implements IssueService { * @author zxc */ @Override - public void projectEvaluate(TokenDto tokenDto, ProjectEvaluateFormDTO projectEvaluateFormDTO) { + public Result projectEvaluate(TokenDto tokenDto, ProjectEvaluateFormDTO projectEvaluateFormDTO) { projectEvaluateFormDTO.setUserId(tokenDto.getUserId()); - govProjectFeignClient.projectEvaluate(projectEvaluateFormDTO); + return govProjectFeignClient.projectEvaluate(projectEvaluateFormDTO); } /** diff --git a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml index 9aa9529d34..6bd93a33df 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-partymember-server: container_name: resi-partymember-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-partymember-server:0.3.52 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-partymember-server:0.3.54 ports: - "8096:8096" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-partymember/resi-partymember-server/pom.xml b/epmet-module/resi-partymember/resi-partymember-server/pom.xml index 58cfd05402..d4d9fa21a1 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/pom.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.52 + 0.3.54 com.epmet resi-partymember 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 a51cc29d90..e047396cfd 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 @@ -1,5 +1,6 @@ package com.epmet.modules.partymember.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -10,19 +11,14 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.PartyMemberConstant; import com.epmet.constant.PartyMemberMessageConstant; import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserRoleDTO; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.form.StaffRoleFormDTO; -import com.epmet.dto.form.UserMessageFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.result.AgencyAndStaffsResultDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.GridInfoResultDTO; -import com.epmet.dto.result.UserResiInfoResultDTO; -import com.epmet.modules.feign.EpmetMessageFeignClient; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.feign.ResiGroupFeignClient; @@ -48,6 +44,7 @@ import com.epmet.resi.partymember.dto.partymember.result.AuditingDetailResultDTO import com.epmet.resi.partymember.dto.partymember.result.AutoFailedDetailResultDTO; import com.epmet.resi.partymember.dto.partymember.result.RejectedDetailResultDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -85,7 +82,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService @Autowired private PartymemberRegisterRelationService partymemberRegisterRelationService; @Autowired - private EpmetMessageFeignClient messageFeignClient; + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private GovOrgFeignClient govOrgFeignClient; @Autowired @@ -150,17 +147,21 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService if (null != partyMemberInfoResult) { return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); } - //TODO 方便测试屏蔽短信验证码 - /*//生成短信验证码 - Map message = (Map) messageFeignClient.sendSmsCaptcha(fromDTO.getMobile()).getData(); - if (null == message) { + //生成短信验证码 + SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); + sendVerificationCodeFormDTO.setMobile(fromDTO.getMobile()); + sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER); + Result sendVerificationCodeResult = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); + if(!sendVerificationCodeResult.success()|| + null==sendVerificationCodeResult.getData() + || StringUtils.isBlank(sendVerificationCodeResult.getData().getCode())){ return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode()); } //删除旧验证码 partyMemberInfoRedis.deleteUserMobileCodeByPattern(fromDTO.getUserId(), fromDTO.getMobile()); //将验证码存入Redis - partyMemberInfoRedis.setUserMobileCode(fromDTO.getUserId(), fromDTO.getMobile(), message.get("code"));*/ + partyMemberInfoRedis.setUserMobileCode(fromDTO.getUserId(), fromDTO.getMobile(), sendVerificationCodeResult.getData().getCode()); //将访问记录更新到热心居民申请行为记录表 saveOrUpdateVisit(fromDTO.getVisitId(), null, PartyMemberConstant.OPERATE_OPERATE_SMS_CODE); @@ -354,9 +355,14 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService //获取人工审核信息 PartymemberConfirmManualEntity manualEntity = partymemberConfirmManualService.selectById(fromDTO.getManualId()); - //人工审核信息设为已读 - manualEntity.setReadFlag(PartyMemberConstant.READ); - partymemberConfirmManualService.updateById(manualEntity); + if(null!=manualEntity){ + //人工审核信息设为已读 + manualEntity.setReadFlag(PartyMemberConstant.READ); + partymemberConfirmManualService.updateById(manualEntity); + }else{ + logger.error(String.format("入参%s,查询partymember_confirm_manual为空", JSON.toJSONString(fromDTO))); + throw new RenException("数据异常,根据manualId查询partymember_confirm_manual为空"); + } //获取党员认证信息 PartymemberInfoEntity partyMemberInfoEntity = partymemberInfoService.selectById(fromDTO.getPartyMemberId()); @@ -618,7 +624,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService userMessageFormDTO.setMessageContent(messageContent); userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); //保存消息 - return messageFeignClient.saveUserMessage(userMessageFormDTO); + return epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); } /** @@ -673,7 +679,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService }); }); if (msgList.size() > NumConstant.ZERO) { - result = messageFeignClient.saveUserMessageList(msgList); + result = epmetMessageOpenFeignClient.saveUserMessageList(msgList); } return result; } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/readme b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme index 7cb6399fe1..384fca6dfc 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/resources/readme +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme @@ -1,4 +1,7 @@ #访问openApi 需要向redis中 添加白名单 sadd epmet:openapi:scan:whitelist "客户端ip地址" #eg: -sadd epmet:openapi:scan:whitelist "\"192.168.1.1\"" \ No newline at end of file +sadd epmet:openapi:scan:whitelist "\"192.168.1.1\"" + +#del +srem 'epmet:openapi:scan:whitelist' "\"116.179.32.197\"" "\"27.219.156.47\"" \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java new file mode 100644 index 0000000000..9d5ae26351 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java @@ -0,0 +1,12 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.util.List; + +@Data +public class GovStaffRoleFormDTO { + + private List roleIdList; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateCachedRolesFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateCachedRolesFormDTO.java new file mode 100644 index 0000000000..80559c4ec5 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateCachedRolesFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class UpdateCachedRolesFormDTO { + + @NotBlank(message = "客户ID不能为空") + private String staffId; + + @NotBlank(message = "机关ID不能为空") + private String orgId; + + private List roleIds; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LoginUserDetailsResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LoginUserDetailsResultDTO.java index 30acef4ea8..1174f0fb34 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LoginUserDetailsResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LoginUserDetailsResultDTO.java @@ -1,7 +1,9 @@ package com.epmet.dto.result; +import com.epmet.commons.tools.security.dto.GovTokenDto; import lombok.Data; +import java.util.List; import java.util.Set; @Data @@ -25,7 +27,8 @@ public class LoginUserDetailsResultDTO { /** * 角色列表 */ - private Set roleIdList; + //private Set roleIdList; + private List roleList; /** * 部门id列表 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 c8c1848738..d4a09e63cc 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 @@ -4,12 +4,10 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; +import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.TagCustomerFormDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; -import com.epmet.dto.result.TagCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; @@ -24,6 +22,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class, url = "localhost:8087") @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class) public interface EpmetUserOpenFeignClient { @@ -72,4 +71,11 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/user/getcustomeridbyuserid") Result getCustomerIdByUserId(@RequestBody TagCustomerFormDTO formDTO); + /** + * 根据角色id列表批量查询角色信息 + * @param form + * @return + */ + @PostMapping("/epmetuser/govstaffrole/getbyids") + Result> getByIds(@RequestBody GovStaffRoleFormDTO form); } 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 54c904449e..9f87d6f530 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 @@ -5,12 +5,10 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; +import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.TagCustomerFormDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; -import com.epmet.dto.result.TagCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; import org.springframework.stereotype.Component; @@ -50,4 +48,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerIdByUserId", formDTO); } + @Override + public Result> getByIds(GovStaffRoleFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getById", form); + } + } diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 1b546e9355..62e0f89277 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.60 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.65 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 7da3cceed3..84957941b8 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.60 + 0.3.65 com.epmet epmet-user @@ -82,6 +82,12 @@ 2.0.0 compile + + com.epmet + epmet-message-client + 2.0.0 + compile + 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 8b8ccd1048..38081f88cd 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 @@ -1,17 +1,20 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.RoleDTO; +import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; +import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @RequestMapping("govstaffrole") @RestController @@ -40,4 +43,20 @@ public class GovStaffRoleController { List roleTemplates = govStaffRoleService.listRoleTemplates(); return new Result().ok(roleTemplates); } + + /** + * 使用id列表查询角色列表 + * @param form + * @return + */ + @PostMapping("getbyids") + public Result> getByIds(@RequestBody GovStaffRoleFormDTO form) { + List roleDTOS = new ArrayList<>(); + List roleIdList = form.getRoleIdList(); + if (!CollectionUtils.isEmpty(roleIdList)) { + roleDTOS = roleIdList.stream().map(roleId -> govStaffRoleService.getDTOById(roleId)).collect(Collectors.toList()); + } + + return new Result>().ok(roleDTOS); + } } 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 d7562fafad..275a2e9742 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 @@ -59,4 +59,6 @@ public interface GovStaffRoleDao extends BaseDao { GovStaffRoleDTO getRoleByCustomerIdAndRoleKey(@Param("customerId") String customerId, @Param("roleKey") String roleKey); List listRolesByCustomer(@Param("customerId") String customerId); + + GovStaffRoleResultDTO getDTOById(@Param("roleId") String roleId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java new file mode 100644 index 0000000000..cba4210ee7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java @@ -0,0 +1,23 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UpdateCachedRolesFormDTO; +import com.epmet.feign.fallback.AuthFeignClientCallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +//@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallback = AuthFeignClientCallback.class, url = "localhost:8081") +@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallback = AuthFeignClientCallback.class) +public interface AuthFeignClient { + + /** + * 更新缓存的角色列表 + * @param form + * @return + */ + @PostMapping("/auth/gov/updatecachedroles") + Result updateCachedRoles(@RequestBody UpdateCachedRolesFormDTO form); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/AuthFeignClientCallback.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/AuthFeignClientCallback.java new file mode 100644 index 0000000000..af013a458b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/AuthFeignClientCallback.java @@ -0,0 +1,17 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UpdateCachedRolesFormDTO; +import com.epmet.feign.AuthFeignClient; +import org.springframework.stereotype.Component; + +@Component +public class AuthFeignClientCallback implements AuthFeignClient { + + @Override + public Result updateCachedRoles(UpdateCachedRolesFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_AUTH_SERVER, "updateCachedRoles", form); + } +} 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 25d6fe495b..1322bf06d1 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 @@ -125,4 +125,6 @@ public interface GovStaffRoleService extends BaseService { List listRolesByCustomer(String customerId); List listRoleTemplates(); + + GovStaffRoleResultDTO getDTOById(String roleId); } \ 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 be1796082c..48b2f5a45f 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 @@ -24,8 +24,10 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerStaffConstant; import com.epmet.constant.UserConstant; @@ -39,6 +41,7 @@ import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.StaffRoleEntity; import com.epmet.entity.UserEntity; +import com.epmet.feign.AuthFeignClient; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; import com.epmet.service.GovStaffRoleService; @@ -52,10 +55,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -78,6 +78,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { @@ -328,6 +332,23 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl listRoleTemplates() { return govStaffRoleTemplateDao.listValidateRoles(); } + + @Override + public GovStaffRoleResultDTO getDTOById(String roleId) { + return govStaffRoleDao.getDTOById(roleId); + } } \ No newline at end of file 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 d831b34e14..5901ddd950 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 @@ -26,19 +26,18 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.UserResiInfoDao; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserRoleDTO; -import com.epmet.dto.form.IssueInitiatorFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.form.VerificationCodeFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.IssueInitiatorResultDTO; +import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.entity.UserResiInfoEntity; -import com.epmet.feign.MessageFeignClient; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.redis.UserResiInfoRedis; import com.epmet.service.RegisterRelationService; import com.epmet.service.UserResiInfoService; @@ -77,7 +76,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -202,25 +201,25 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl map = (Map) result.getData(); - if (null == map || null == map.get("code")) { + //3:调用短信服务 生成验证码发送短信 + SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); + sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile()); + sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER); + Result result = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); + if(!result.success()||null==result.getData()||StringUtils.isBlank(result.getData().getCode())){ return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode()); } //4:删除缓存中可能存在的旧验证码 userResiInfoRedis.deleteOldUserMobileCode(verificationCodeFormDTO.getUserId(), verificationCodeFormDTO.getMobile()); //5:将验证码存入redis - userResiInfoRedis.setUserResiMobileCode(verificationCodeFormDTO.getUserId(),verificationCodeFormDTO.getMobile(),map.get("code").toString());*/ - return result; + userResiInfoRedis.setUserResiMobileCode(verificationCodeFormDTO.getUserId(),verificationCodeFormDTO.getMobile(),result.getData().getCode()); + return new Result(); } @Override 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 aa495b89f5..22f47ce8bc 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 @@ -59,4 +59,13 @@ FROM gov_staff_role r WHERE r.CUSTOMER_ID = #{customerId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/UserControllerTest.java b/epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/UserControllerTest.java new file mode 100644 index 0000000000..06d674a4e3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/test/java/com/epmet/epmetuser/test/UserControllerTest.java @@ -0,0 +1,25 @@ +package com.epmet.epmetuser.test; + +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.dto.result.LoginUserDetailsResultDTO; +import com.epmet.service.UserService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest +@RunWith(SpringRunner.class) +public class UserControllerTest { + + @Autowired + private UserService userService; + + @Test + public void getLoginUserDetails() { + LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(AppClientConstant.APP_GOV, AppClientConstant.CLIENT_WXMP, "4aaab913d9f11d90a2cb4dd21b075259"); + System.out.println(loginUserDetails); + } + +}