springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/IndexApi.java
@@ -14,7 +14,11 @@ import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.community.IndexUserStatisticsVo; import com.panzhihua.common.model.vos.community.IndexUserStreetExcelExportVo; import com.panzhihua.common.model.vos.user.*; import com.panzhihua.common.utlis.SFTPUtil; import com.panzhihua.common.utlis.StringUtils; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; @@ -121,4 +125,114 @@ } return r; } @ApiOperation(value = "新数据看板:数据总览", response = IndexDataAnalysisVO.class) @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选,5:按区县筛选",dataType = "Integer"), @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "String"), @ApiImplicitParam(name = "areaCode",value = "区县code",dataType = "String") }) @GetMapping("/indexData/total/Data") public R indexData(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) String streetId, @RequestParam(value = "areaCode",required = false) String areaCode){ Long sId=null; Long aCode=null; if (StringUtils.isNotEmpty(streetId)){ sId=Long.parseLong(streetId); } if (StringUtils.isNotEmpty(areaCode)){ aCode=Long.parseLong(areaCode); } return userService.newIndexData(type, sId,aCode); } @ApiOperation(value = "新数据看板:用户占比", response = UserRateVO.class) @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选,5:按区县筛选",dataType = "Integer"), @ApiImplicitParam(name = "range",value = "本月或累计,默认累计不传,1:本月",dataType = "String"), @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "String"), @ApiImplicitParam(name = "areaCode",value = "区县code",dataType = "String") }) @GetMapping("indexData/userRate") public R userRate(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "range",required = false) String range, @RequestParam(value = "streetId",required = false) String streetId, @RequestParam(value = "areaCode",required = false) String areaCode){ Long sId=null; Long aCode=null; Integer r=null; if (StringUtils.isNotEmpty(streetId)){ sId=Long.parseLong(streetId); } if (StringUtils.isNotEmpty(areaCode)){ aCode=Long.parseLong(areaCode); } if (StringUtils.isNotEmpty(range)){ r=Integer.parseInt(range); } return userService.userRate(type, sId,aCode,r); } @ApiOperation(value = "新数据看板:实名用户", response = RealUserVO.class) @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选,5:按区县筛选",dataType = "Integer"), @ApiImplicitParam(name = "range",value = "本月或累计,默认累计不传,1:本月",dataType = "String"), @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "String"), @ApiImplicitParam(name = "areaCode",value = "区县code",dataType = "String") }) @GetMapping("/indexData/realUser") public R realUser(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) String streetId, @RequestParam(value = "areaCode",required = false) String areaCode, @RequestParam(value = "range",required = false) String range){ Long sId=null; Long aCode=null; Integer r=null; if (StringUtils.isNotEmpty(streetId)){ sId=Long.parseLong(streetId); } if (StringUtils.isNotEmpty(areaCode)){ aCode=Long.parseLong(areaCode); } if (StringUtils.isNotEmpty(range)){ r=Integer.parseInt(range); } return userService.realUser(type,sId,aCode,r); } @ApiOperation(value = "新数据看板:用户行为分析", response = UserActivityAnalysisVO.class) @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选,5:按区县筛选",dataType = "Integer"), @ApiImplicitParam(name = "range",value = "本月或累计,不传默认累计,1:本月",dataType = "String"), @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "String"), @ApiImplicitParam(name = "areaCode",value = "区县code",dataType = "String") }) @GetMapping("/indexData/userActivity") public R userActivity(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) String streetId, @RequestParam(value = "areaCode",required = false) String areaCode, @RequestParam(value = "range",required = false) String range){ Long sId=null; Long aCode=null; Integer r=null; if (StringUtils.isNotEmpty(streetId)){ sId=Long.parseLong(streetId); } if (StringUtils.isNotEmpty(areaCode)){ aCode=Long.parseLong(areaCode); } if (StringUtils.isNotEmpty(range)){ r=Integer.parseInt(range); } return userService.userActivity(type,sId,aCode,r); } @ApiOperation(value = "获取区县街道选项",response = AreaVO.class) @GetMapping("/indexData/getAreaAndStreet") public R getAreaAndStreet(){ return userService.getAreaAndStreet(); } } springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/api/LoginApi.java
@@ -2,6 +2,7 @@ import javax.annotation.Resource; import com.panzhihua.common.interfaces.OperLog; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -39,6 +40,7 @@ * 微信标识 * @return jwt */ @OperLog(operModul = "小程序登录") @PostMapping("/loginApplets") public R loginApplets(@RequestParam("openId") String openId) { LoginReturnVO loginReturnVO = loginService.loginApplets(openId); @@ -52,6 +54,7 @@ * 登录用户token * @return 登出结果 */ @OperLog(operModul = "用户退出登录") @PostMapping("/logout") public R logout(@RequestParam("token") String token) { loginService.logoutApplets(token); @@ -67,6 +70,7 @@ * 密码 * @return 登录结果 */ @OperLog(operModul = "运营后台登录") @PostMapping("/loginAppletsBackStage") public R loginAppletsBackStage(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginAppletsBackStage(account, password); @@ -82,6 +86,7 @@ * @author manailin * @date 2021-5-13 10:56 */ @OperLog(operModul = "大数据统计平台(区、街道、社区三层登陆接口)") @PostMapping("/loginBigDataBackStage") public R loginBigDataBackStage(@RequestBody LoginBody loginBody) { String account = loginBody.getAccount(); @@ -102,6 +107,7 @@ * 密码 * @return 登录结果 */ @OperLog(operModul = "社区后台登录") @PostMapping("/loginCommunityBackage") public R loginCommunityBackage(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginCommunityBackage(account, password); @@ -153,6 +159,7 @@ * 密码 * @return 登录结果 */ @OperLog(operModul = "商家后台登录") @PostMapping("/loginShopBackStage") public R loginShopBackStage(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginShopBackStage(account, password); @@ -168,6 +175,7 @@ * 密码 * @return 登录结果 */ @OperLog(operModul = "网格综治app登录") @PostMapping("/loginGridApp") public R loginGridApp(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnsVO loginReturnVO = loginService.loginGridApp(account, password); @@ -183,6 +191,7 @@ * 密码 * @return 登录结果 */ @OperLog(operModul = "网格综治后台登录") @PostMapping("/loginGridBackstage") public R loginGridBackstage(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginGridBackstage(account, password); @@ -195,6 +204,7 @@ * @param password 密码 * @return 登录结果 */ @OperLog(operModul = "城管后台登录") @PostMapping("/loginCgBackage") public R loginCgBackage(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginCgBackage(account, password); @@ -207,6 +217,7 @@ * @param password 密码 * @return 登录结果 */ @OperLog(operModul = "一键报警APP登录 ") @PostMapping("/loginAlarmApp") public R loginAlarmApp(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnsVO loginReturnVO = loginService.loginAlarmApp(account, password); @@ -222,6 +233,7 @@ * 密码 * @return 登录结果 */ @OperLog(operModul = "便民服务商家后台登录 ") @PostMapping("/loginMerchantBackStage") public R loginMerchantBackStage(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginMerchantBackStage(account, password); @@ -234,6 +246,7 @@ * @param password 密码 * @return 登录结果 */ @OperLog(operModul = "西区大屏登录") @PostMapping("/loginXQDP") public R loginXQDP(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginXQDP(account, password); @@ -250,6 +263,7 @@ * @return 登录结果 */ @PostMapping("/loginMcsUser") @OperLog(operModul = "微商业街用户登录") public R loginMcsUser(@RequestParam("account") String account, @RequestParam("password") String password) { LoginReturnVO loginReturnVO = loginService.loginMcsUser(account, password); return R.ok(loginReturnVO); springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java
@@ -243,4 +243,12 @@ * service_community包 */ public static final String SERVICE_COMMUNITY = "community"; /** * 操作类型 * */ public static final String UPDATE="update"; public static final String INSERT="insert"; public static final String QUERY="query"; public static final String DELETE="delete"; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/interfaces/OperLog.java
@@ -14,4 +14,7 @@ String operModul() default ""; // 操作模块 int operType() default 0; // 操作类型 业务类型(0其它 1新增 2修改 3删除) String businessType() default ""; //操作类型 } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/AreaVO.java
New file @@ -0,0 +1,26 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.Data; import java.io.Serializable; import java.util.List; @Data @ApiModel public class AreaVO implements Serializable { @ApiModelProperty("区县名") private String name; @ApiModelProperty("区县code") private Integer id; @ApiModelProperty("下属街道列表") private List<StreetVO> streetList; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/IndexDataAnalysisVO.java
@@ -15,12 +15,6 @@ @ApiModelProperty("用户总数") private Integer allUser; @ApiModelProperty("实名用户总数") private Integer realUser; @ApiModelProperty("实名用户占比") private Double realUserRate; @ApiModelProperty("新增用户") private Integer addUser; @@ -30,42 +24,46 @@ @ApiModelProperty("周活跃用户") private Integer activeWeekUser; @ApiModelProperty("其他用户数(按街道,社区划分时使用)") private Integer otherUser; @ApiModelProperty("其他用户占比(按街道,社区划分时使用)") private Double otherUserRate; @ApiModelProperty("用户占比(累计)") private List<UserProportion> userProportionTotal; @ApiModelProperty("用户占比(本月)") private List<UserProportion> userProportionMonth; @ApiModelProperty("实名用户(累计)") private List<RealUser> realUsersTotal; @ApiModelProperty("实名用户(本月)") private List<RealUser> realUsersMonth; @ApiModelProperty("用户行为X轴(累计过去20天)") private List<Date> userActivityXAll; @ApiModelProperty("用户行为X轴(本月)") private List<Date> userActivityXMonth; @ApiModelProperty("新增用户Y轴(累计过去20天)") private List<String> addUserYAll; @ApiModelProperty("新增用户Y轴(本月)") private List<String> addUserYWeek; @ApiModelProperty("日活用户Y轴(累计过去20天)") private List<String> activeUserYAll; @ApiModelProperty("日活用户Y轴(本月)") private List<String> activeUserYMonth; // @ApiModelProperty("其他用户数(按街道,社区划分时使用)") // private Integer otherUser; // // @ApiModelProperty("其他用户占比(按街道,社区划分时使用)") // private Double otherUserRate; // // @ApiModelProperty("用户占比(累计)") // private List<UserProportion> userProportionTotal; // // @ApiModelProperty("用户占比(本月)") // private List<UserProportion> userProportionMonth; // // @ApiModelProperty("实名用户(累计)") // private List<RealUser> realUsersTotal; // // @ApiModelProperty("实名用户(本月)") // private List<RealUser> realUsersMonth; // // @ApiModelProperty("用户行为X轴(累计过去20天)") // private List<String> userActivityXAll; // // @ApiModelProperty("用户行为X轴(本月)") // private List<String> userActivityXMonth; // // @ApiModelProperty("新增用户Y轴(累计过去20天)") // private List<String> addUserYAll; // // @ApiModelProperty("新增用户Y轴(本月)") // private List<String> addUserYWeek; // // @ApiModelProperty("日活用户Y轴(累计过去20天)") // private List<String> activeUserYAll; // // @ApiModelProperty("日活用户Y轴(本月)") // private List<String> activeUserYMonth; // @ApiModelProperty("实名用户总数") // private Integer realUser; // // @ApiModelProperty("实名用户占比") // private Double realUserRate; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/RealUserAnalysisVO.java
New file @@ -0,0 +1,17 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel("真实用户统计") public class RealUserAnalysisVO { @ApiModelProperty("区域,街道,社区名") private String name; @ApiModelProperty("实名人数") private Integer count; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/RealUserVO.java
New file @@ -0,0 +1,22 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.util.List; @Data @ApiModel("真实用户统计") public class RealUserVO implements Serializable { @ApiModelProperty("实名用户数") private Integer realUserCount; @ApiModelProperty("实名用户占比") private Double realUserRate; @ApiModelProperty("真实用户统计") private List<RealUserAnalysisVO> realUserList; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/StreetVO.java
New file @@ -0,0 +1,18 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @Data @ApiModel public class StreetVO implements Serializable { @ApiModelProperty("街道id") private Integer id; @ApiModelProperty("街道名") private String name; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/SysOperLogVO.java
@@ -80,4 +80,7 @@ private Long pageSize; private String areaCode; @ApiModelProperty("如果是修改操作,记录修改前的记录") private String beforeUpdateData; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/UserActivityAnalysisVO.java
New file @@ -0,0 +1,23 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.util.List; @Data @ApiModel("用户行为分析") public class UserActivityAnalysisVO implements Serializable { @ApiModelProperty("X轴") private List<String> userX; @ApiModelProperty("活跃用户y轴") private List<String> activeUserY; @ApiModelProperty("新增用户y轴") private List<String> addUserY; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/UserRateAnalysisVO.java
New file @@ -0,0 +1,20 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel("用户占比详情") public class UserRateAnalysisVO { @ApiModelProperty("社区,街道,区县名称") private String name; @ApiModelProperty("占比") private Integer rate; @ApiModelProperty("人数") private Integer count; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/user/UserRateVO.java
New file @@ -0,0 +1,16 @@ package com.panzhihua.common.model.vos.user; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.util.List; @Data @ApiModel("用户占比") public class UserRateVO implements Serializable { @ApiModelProperty("用户来源,用户数及占比") private List<UserRateAnalysisVO> userList; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java
@@ -1229,8 +1229,32 @@ @GetMapping("/checkExport") R checkExport(@RequestParam("account")String account,@RequestParam("password")String password,@RequestParam("oldPassword")String oldPassword); @GetMapping("/indexData") @GetMapping("/indexData/totalData") R newIndexData(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "type",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode); @GetMapping("/indexData/userRate") R userRate(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode, @RequestParam(value = "range",required = false) Integer range); @GetMapping("/indexData/realUser") R realUser(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode, @RequestParam(value = "range",required = false) Integer range); @GetMapping("/indexData/userActivity") R userActivity(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode, @RequestParam(value = "range",required = false) Integer range); @GetMapping("/indexData/getAreaAndStreet") R getAreaAndStreet(); @RequestParam(value = "type",required = false) Long streetId); /** springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/aop/OperLogAspect.java
@@ -14,6 +14,7 @@ import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; @@ -87,7 +88,6 @@ byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); userInfo = new String(decrypt); LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); SysOperLogVO operlog = new SysOperLogVO(); try { @@ -232,4 +232,76 @@ String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString(); return message; } /** * 前置通知,仅在修改防疫相关数据时生成日志记录 * */ @Before(value = "operLogPoinCut()") public void saveUpdateOperLog(JoinPoint joinPoint){ log.info("进入切面---前置通知"); // 获取RequestAttributes RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); // 从获取RequestAttributes中获取HttpServletRequest的信息 HttpServletRequest request = (HttpServletRequest)requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST); // 登录对象信息 String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); boolean empty = ObjectUtils.isEmpty(userInfo); if (empty) { log.error("操作日志获取登录用户信息失败【{}】", joinPoint); return; } byte[] bytes = AES.parseHexStr2Byte(userInfo); byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); userInfo = new String(decrypt); LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); SysOperLogVO operlog = new SysOperLogVO(); try { // 从切面织入点处通过反射机制获取织入点处的方法 MethodSignature signature = (MethodSignature)joinPoint.getSignature(); // 获取切入点所在的方法 Method method = signature.getMethod(); OperLog opLog = method.getAnnotation(OperLog.class); // 获取操作 if (opLog != null) { if (opLog.businessType().equals("")){ return; } String operModul = opLog.operModul(); int operType = opLog.operType(); operlog.setTitle(operModul); // 操作模块 operlog.setBusinessType(operType); // 操作类型 } // 获取请求的类名 String className = joinPoint.getTarget().getClass().getName(); // 获取请求的方法名 String methodName = method.getName(); methodName = className + "." + methodName; operlog.setMethod(methodName); // 请求方法 if (joinPoint.getArgs().length > 0) { for (Object o : joinPoint.getArgs()) { if (o instanceof HttpServletRequest || o instanceof HttpServletResponse) { continue; } operlog.setOperParam(JSONObject.toJSONString(o)); // 请求参数 } } //operlog.setJsonResult(JSONObject.toJSONString(keys)); // 返回结果 operlog.setAccount(loginUserInfoVO.getAccount()); operlog.setOperName(loginUserInfoVO.getName()); // 请求用户名称 operlog.setOperIp(IPUtil.getIpAddress(request)); // 请求IP operlog.setOperUrl(request.getRequestURI()); // 请求URI operlog.setRequestMethod(request.getMethod()); operlog.setOperLocation(IPUtil.getIpBelongAddress(request)); operlog.setOperTime(new Date()); // 创建时间 operlog.setAccount(loginUserInfoVO.getAccount()); Long communityId = loginUserInfoVO.getCommunityId(); operlog.setCommunityId(null == communityId ? 0 : communityId); userService.addOperLog(operlog); } catch (Exception e) { e.printStackTrace(); } } } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActAcidCheckRecordApi.java
@@ -1,7 +1,11 @@ package com.panzhihua.community_backstage.api; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.IdUtil; import com.panzhihua.common.constants.Constants; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.interfaces.OperLog; import com.panzhihua.common.model.dtos.community.acid.ComActAcidCheckRecordDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO; @@ -38,6 +42,7 @@ * @return 所有数据 */ @ApiOperation(value = "分页查询",response = ComActAcidCheckRecordVO.class) @OperLog(operModul = "分页查询排查数据",operType = 1) @PostMapping("queryAll") public R selectAll(@RequestBody ComActAcidCheckRecordDTO comActAcidCheckRecordDTO) { return this.communityService.selectAllComActAcidCheckRecord(comActAcidCheckRecordDTO); @@ -49,6 +54,7 @@ * @param id 主键 * @return 单条数据 */ @OperLog(operModul = "查询单条排查数据",operType = 1) @ApiOperation(value = "通过主键查询单条数据",response = ComActAcidCheckRecordVO.class) @GetMapping("{id}") public R selectOne(@PathVariable("id") Long id) { @@ -61,6 +67,7 @@ * @param comActAcidCheckRecordVO 实体对象 * @return 新增结果 */ @OperLog(operModul = "新增排查数据",operType = 1) @ApiOperation(value = "新增数据") @PostMapping public R insert(@RequestBody ComActAcidCheckRecordVO comActAcidCheckRecordVO) { @@ -74,6 +81,7 @@ * @param comActAcidCheckRecordVO 实体对象 * @return 修改结果 */ @OperLog(operModul = "修改排查数据",operType = 1,businessType = Constants.UPDATE) @ApiOperation(value = "修改数据") @PostMapping("/update") public R update(@RequestBody ComActAcidCheckRecordVO comActAcidCheckRecordVO) { springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActAcidDangerMemberApi.java
@@ -4,6 +4,7 @@ import javax.annotation.Resource; import javax.validation.Valid; import com.panzhihua.common.interfaces.OperLog; import com.panzhihua.common.model.dtos.community.acid.ComActAcidDangerMemberDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import org.springframework.web.bind.annotation.PostMapping; @@ -39,6 +40,7 @@ @Resource private CommunityService communityService; @OperLog(operModul = "后台查询风险人员",operType = 1) @ApiOperation(value = "后台分页查询风险人员", response = ComActAcidDangerMemberVO.class) @PostMapping("/queryAll") public R pageDangerMember(@RequestBody @Valid ComActAcidDangerMemberDTO pageDangerMemberDTO) { springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActAcidMemberApi.java
@@ -1,7 +1,9 @@ package com.panzhihua.community_backstage.api; import com.panzhihua.common.constants.Constants; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.interfaces.OperLog; import com.panzhihua.common.model.dtos.community.acid.ComActAcidMemberDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; @@ -40,6 +42,7 @@ * @param commonPage 查询实体 * @return 所有数据 */ @OperLog(operModul = "分页查询防疫工作人员列表",operType = 1) @ApiOperation(value = "分页查询列表",response = ComActAcidMemberVO.class) @PostMapping("queryAll") public R selectAll(@RequestBody ComActAcidMemberDTO commonPage) { @@ -53,6 +56,7 @@ * @param id 主键 * @return 单条数据 */ @OperLog(operModul = "查询单条防疫工作人员信息",operType = 1) @ApiOperation("通过主键查询单条数据") @GetMapping("{id}") public R selectOne(@PathVariable("id") Long id) { @@ -65,6 +69,7 @@ * @param comActAcidMemberVO 实体对象 * @return 新增结果 */ @OperLog(operModul = "新增防疫工作人员记录",operType = 1) @ApiOperation("新增数据") @PostMapping public R insert(@RequestBody ComActAcidMemberVO comActAcidMemberVO) { @@ -79,6 +84,7 @@ * @param comActAcidMemberVO 实体对象 * @return 修改结果 */ @OperLog(operModul = "修改防疫工作人员信息",operType = 1,businessType = Constants.UPDATE) @ApiOperation("修改数据") @PostMapping("/update") public R update(@RequestBody ComActAcidMemberVO comActAcidMemberVO) { @@ -91,6 +97,7 @@ * @param id 主键结合 * @return 删除结果 */ @OperLog(operModul = "删除防疫工作人员信息",operType = 1) @ApiOperation("删除数据") @GetMapping("del") public R delete(@RequestParam("id") Long id) { springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComActAcidRecordApi.java
@@ -6,7 +6,9 @@ import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson.JSONArray; import com.panzhihua.common.constants.Constants; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.interfaces.OperLog; import com.panzhihua.common.model.dtos.community.acid.ComActAcidRecordDTO; import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.R; @@ -77,6 +79,7 @@ * @param comActAcidRecordDTO 查询实体 * @return 所有数据 */ @OperLog(operModul = "查询防疫登记信息列表",operType = 1) @ApiOperation(value = "分页查询",response = ComActAcidRecordVO.class) @PostMapping("queryAll") public R selectAll(@RequestBody ComActAcidRecordDTO comActAcidRecordDTO) { @@ -97,6 +100,7 @@ * @param id 主键 * @return 单条数据 */ @OperLog(operModul = "查询单条防疫信息",operType = 1) @ApiOperation(value = "通过主键查询单条数据",response = ComActAcidRecordVO.class) @GetMapping("{id}") public R selectOne(@PathVariable("id") Long id) { @@ -109,6 +113,7 @@ * @param comActAcidRecordVO 实体对象 * @return 新增结果 */ @OperLog(operModul = "新增防疫信息数据",operType = 1) @ApiOperation(value = "新增数据") @PostMapping public R insert(@RequestBody ComActAcidRecordVO comActAcidRecordVO) { @@ -121,6 +126,7 @@ * @param comActAcidRecordVO 实体对象 * @return 修改结果 */ @OperLog(operModul = "修改防疫信息数据",operType = 1,businessType = Constants.UPDATE) @ApiOperation(value = "修改数据") @PostMapping("/update") public R update(@RequestBody ComActAcidRecordVO comActAcidRecordVO) { @@ -134,12 +140,14 @@ * @param id 主键结合 * @return 删除结果 */ @OperLog(operModul = "删除防疫信息数据",operType = 1) @ApiOperation(value = "删除数据") @GetMapping("del") public R delete(@RequestParam("id") Long id) { return this.communityService.deleteComActAcidRecord(id); } @OperLog(operModul = "导出防疫信息",operType = 1) @ApiOperation(value = "导出") @PostMapping("/export") public R export(@RequestBody ComActAcidRecordDTO comActAcidRecordDTO) { @@ -363,6 +371,7 @@ * 5项常规统计 * @return */ @OperLog(operModul = "防疫信息五项常规统计",operType = 1) @ApiOperation(value = "5项常规统计",response = FiveCount.class) @GetMapping("fiveCount") public R fiveCount(@RequestParam("localCity")String localCity){ @@ -373,6 +382,7 @@ * 5项常规统计 * @return */ @OperLog(operModul = "防疫信息7项常规统计",operType = 1) @ApiOperation(value = "7项常规统计",response = FiveCount.class) @GetMapping("fiveCountPlus") public R fiveCountPlus(@RequestParam("date")String date,@RequestParam(value = "localCity",required = false)String localCity){ @@ -383,6 +393,7 @@ } @OperLog(operModul = "防疫信息报表统计",operType = 1) @ApiOperation(value = "报表统计",response = ComAcidStaticVO.class) @GetMapping("/statics") public R statics(@RequestParam("date")String date){ springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/IndexApi.java
@@ -4,9 +4,13 @@ import javax.annotation.Resource; import com.panzhihua.common.model.vos.user.IndexDataAnalysisVO; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.alibaba.fastjson.JSONArray; springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/UserApi.java
@@ -70,15 +70,15 @@ return userService.listmenu(userId); } @PostMapping("/indexData") @ApiOperation(value = "新数据统计看板",response = IndexDataAnalysisVO.class) @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选",dataType = "Integer"), @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "Long") }) public R indexData(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "type",required = false) Long streetId){ return userService.newIndexData(type,streetId); } // @PostMapping("/indexData") // @ApiOperation(value = "新数据统计看板",response = IndexDataAnalysisVO.class) // @ApiImplicitParams({ // @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选",dataType = "Integer"), // @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "Long") // }) // public R indexData(@RequestParam(value = "type",required = false) Integer type, // @RequestParam(value = "type",required = false) Long streetId){ // return userService.newIndexData(type,streetId); // } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComActAcidCheckRecordApi.java
@@ -91,6 +91,7 @@ public R update(@RequestBody ComActAcidCheckRecordVO comActAcidCheckRecordVO) { ComActAcidCheckRecord comActAcidCheckRecord=new ComActAcidCheckRecord(); BeanUtils.copyProperties(comActAcidCheckRecordVO,comActAcidCheckRecord); this.comActAcidCheckRecordService.saveRecordBeforeUpdate(comActAcidCheckRecord); return R.ok(this.comActAcidCheckRecordService.updateById(comActAcidCheckRecord)); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActAcidCheckRecordService.java
@@ -22,4 +22,9 @@ * @return */ R pageList(ComActAcidCheckRecordDTO comActAcidDangerMemberDTO); /** * 记录修改前的数据 * */ void saveRecordBeforeUpdate(ComActAcidCheckRecord comActAcidCheckRecord); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidCheckRecordServiceImpl.java
@@ -28,4 +28,9 @@ public R pageList(ComActAcidCheckRecordDTO comActAcidDangerMemberDTO) { return R.ok(this.baseMapper.pageList(new Page(comActAcidDangerMemberDTO.getPage(), comActAcidDangerMemberDTO.getSize()),comActAcidDangerMemberDTO)); } @Override public void saveRecordBeforeUpdate(ComActAcidCheckRecord comActAcidCheckRecord) { } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
@@ -327,7 +327,6 @@ </if> GROUP BY (caa.sponsor_id) having serviceTimes<>'' and serviceTime<>'' and memberName<>'' order by serviceTime desc </select> <select id="institutionalPartyMemberActAnalysis" @@ -372,5 +371,4 @@ having serviceTimes<>'' and serviceTime<>'' order by serviceTimes desc </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -12,6 +12,7 @@ import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import com.panzhihua.common.model.dtos.PageDTO; @@ -1358,15 +1359,51 @@ return userService.uuLogin(uuLoginVO); } @GetMapping("/indexData") @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "数据范围,1:所有区县,2:所有街道,3:所有社区,4:跟据街道筛选",dataType = "Integer"), @ApiImplicitParam(name = "streetId",value = "街道ID",dataType = "Long") }) /** * 数据看板:数据总览 * @return */ @GetMapping("/indexData/totalData") public R indexData(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "type",required = false) Long streetId){ return userService.newIndexData(type,streetId); @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode){ return userService.newIndexData(type,streetId,areaCode); } /** * 数据看板:用户占比 * @return */ @GetMapping("/indexData/userRate") public R userRate(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode, @RequestParam(value = "range",required = false) Integer range){ return userService.userRate(type,streetId,areaCode,range); } /** * 数据看板:真实用户统计 * @return */ @GetMapping("/indexData/realUser") public R realUser(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode, @RequestParam(value = "range",required = false) Integer range){ return userService.realUser(type,streetId,areaCode,range); } @GetMapping("/indexData/userActivity") public R userActivity(@RequestParam(value = "type",required = false) Integer type, @RequestParam(value = "streetId",required = false) Long streetId, @RequestParam(value = "areaCode",required = false) Long areaCode, @RequestParam(value = "range",required = false) Integer range){ return userService.userActivity(type,streetId,areaCode,range); } /** *导出验证密码 @@ -1388,4 +1425,9 @@ public R uuPush(@RequestParam(value = "washPhone",required = false)String washPhone,@RequestParam("phone")String phone,@RequestParam(value = "washName",required = false)String washName,@RequestParam("orderStatus")Integer orderStatus){ return userService.uuPush(washPhone,phone,washName,orderStatus); } @GetMapping("/indexData/getAreaAndStreet") public R getAreaAndStreet(){ return userService.getAreaAndStreet(); } } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java
@@ -5,7 +5,9 @@ import java.util.Map; import com.panzhihua.common.model.vos.community.*; import com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO; import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO; import com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO; import com.panzhihua.common.model.vos.user.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -285,27 +287,34 @@ /** * 看板用户统计:用户占比统计 * */ List<UserProportion> userAnalysis(@Param("type") Integer type,@Param("range") String range,@Param("streetId") Long streetId); List<UserProportion> userAnalysis(@Param("type") Integer type,@Param("range") String range,@Param("streetId") Long streetId,@Param("areaCode")Long areaCode); /** * 统计区域实名用户数 * */ List<RealUser> realUserCount(@Param("type") Integer type,@Param("range") String range,@Param("streetId") Long streetId); List<RealUser> realUserCount(@Param("type") Integer type,@Param("range") String range,@Param("streetId") Long streetId,@Param("areaCode")Long areaCode); /** * 统计该街道内的所有用户数 * */ Integer streetUserCount(@Param("id") Long id); Integer streetUserCount(@Param("id") Long id,@Param("areaCode")Long areaCode); /** * 街道用户统计 * */ IndexDataKanbanVO dataKanBanStreet(Long streetId); IndexDataKanbanVO dataKanBanStreet(@Param("streetId") Long streetId,@Param("areaCode") Long areaCode,@Param("range") String range); /** * 获取当天的新增和日活 * */ Map<String,Long> getDailyAddAndActive(@Param("date") Date date,@Param("id") Long streetId); Map<String,Long> getDailyAddAndActive(@Param("date") Date date,@Param("id") Long streetId,@Param("areaCode") Long areaCode); List<StreetVO> selectStreetByAreaCode(Integer code); ComActAcidCheckRecordVO selectComActAcidCheckRecordById(Long id); ComActAcidRecordVO selectComActAcidRecord(Long id); ComActAcidMemberVO selectComActAcidMember(Long id); } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/SysOperLogDO.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -110,4 +111,6 @@ private String account; private String areaCode; private String beforeUpdateData; } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java
@@ -854,6 +854,43 @@ */ R checkExport(@RequestParam("account")String account, @RequestParam("password")String password,@RequestParam("oldPassword")String oldPassword); /** * 数据看板:数据总览 * @param type 查看类型 * @param streetId 街道id * @param areaCode 区县code * */ R newIndexData(Integer type, Long streetId,Long areaCode); /** * 用户占比统计 * @param type 查看类型 * @param streetId 街道id * @param areaCode 区县code * @param range */ R userRate(Integer type, Long streetId, Long areaCode, Integer range); /** * 真实用户占比统计 * @param type 查看类型 * @param streetId 街道id * @param areaCode 区县code * @param range */ R realUser(Integer type, Long streetId, Long areaCode, Integer range); /** * 用户行为折线图 * @param type 查看类型 * @param streetId 街道id * @param areaCode 区县code * @param range */ R userActivity(Integer type, Long streetId, Long areaCode, Integer range); /** * 获取区县即下属街道名 * */ R getAreaAndStreet(); R newIndexData(Integer type, Long streetId); /** springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -2,6 +2,7 @@ import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static org.apache.commons.lang3.StringUtils.capitalize; import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.math.BigDecimal; @@ -18,9 +19,14 @@ import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.panzhihua.common.model.dtos.community.microCommercialStreet.BindUserPhoneDTO; import com.panzhihua.common.model.vos.community.ComAreaTownCommunityVO; import com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO; import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO; import com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO; import com.panzhihua.common.model.vos.user.*; import com.panzhihua.common.utlis.*; @@ -152,10 +158,17 @@ private SysAppConfigDao sysAppConfigDao; @Resource private SysTemplateConfigDao sysTemplateConfigDao; public static final Integer ALLCOUNTY=1; public static final Integer ALLSTREET=2; public static final Integer ALLCOMMUNITY=3; public static final Integer BYSTREET=4; @Resource private ObjectMapper objectMapper; private static final Integer ALLCOUNTY=1; private static final Integer ALLSTREET=2; private static final Integer ALLCOMMUNITY=3; private static final Integer BYSTREET=4; private static final Integer BYAREA=5; private static final String OTHERUSER="其他用户"; private static final String UPDATEACIDCHECKRECORD="修改排查数据"; private static final String UPDATEACIDMEMBER="修改防疫工作人员信息"; private static final String UPDATEACIDRECORD="修改防疫信息数据"; // @Resource // private GridService gridService; @@ -164,11 +177,11 @@ // String encode = new BCryptPasswordEncoder().encode("lbsq123456"); // System.out.println(encode); List<Date> dates = new ArrayList<>(); List<String> dates = new ArrayList<>(); Date date = new Date(); for (int i = 6; i >= 0; i--) { for (int i = 19; i >= 0; i--) { Date date1 = DateUtils.addDays(date, -i); dates.add(date1); dates.add(DateFormatUtils.format(date1,"MM-dd" )); } System.out.println(dates); @@ -1544,6 +1557,17 @@ */ @Override public R addOperLog(SysOperLogVO operlog) { //判断是否需要保存修改前的数据 final Boolean flag=(operlog.getTitle().equals(UPDATEACIDCHECKRECORD) || operlog.getTitle().equals(UPDATEACIDMEMBER) || operlog.getTitle().equals(UPDATEACIDRECORD)); if (flag){ //保存数据 try { operlog.setBeforeUpdateData(saveBeforeUpdateData(operlog)); } catch (JsonProcessingException e) { e.printStackTrace(); } } SysOperLogDO sysOperLogDO = new SysOperLogDO(); BeanUtils.copyProperties(operlog, sysOperLogDO); int insert = sysOperLogDAO.insert(sysOperLogDO); @@ -3309,7 +3333,7 @@ } @Override public R newIndexData(Integer type, Long streetId) { public R newIndexData(Integer type, Long streetId,Long areaCode) { IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); IndexDataAnalysisVO vo=new IndexDataAnalysisVO(); if (ObjectUtils.isEmpty(type)){ @@ -3319,77 +3343,191 @@ if (type.equals(ALLCOUNTY) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ BeanUtils.copyProperties(indexDataKanbanVO,vo); }else { IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId); IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId,areaCode,null); BeanUtils.copyProperties(indexDataVO,vo); } List<UserProportion> userProportionsTotal = userDao.userAnalysis(type, null, streetId); Integer streetUser = userDao.streetUserCount(streetId); for (UserProportion userProportion : userProportionsTotal) { // List<UserProportion> userProportionsTotal = userDao.userAnalysis(type, null, streetId,areaCode); // Integer streetUser = userDao.streetUserCount(streetId,areaCode); // for (UserProportion userProportion : userProportionsTotal) { // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ // //计算占比 // //userProportion.setAreaCode(null); // if (type.equals(BYSTREET)){ // userProportion.setRate(getRate(streetUser,userProportion.getUser())); // } // userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); // } // } // } // List<UserProportion> userProportionsMonth = userDao.userAnalysis(type, DateUtil.beginOfMonth(new Date()).toString(), streetId,areaCode); // for (UserProportion userProportion : userProportionsMonth) { // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ // if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ // //计算占比 // //userProportion.setAreaCode(null); // if (type.equals(BYSTREET)){ // userProportion.setRate(getRate(streetUser,userProportion.getUser())); // } // userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); // } // } // } // vo.setUserProportionTotal(userProportionsTotal); // vo.setUserProportionMonth(userProportionsMonth); // List<RealUser> realUsersTotal = userDao.realUserCount(type, null, streetId,areaCode); // List<RealUser> realUsersMonth = userDao.realUserCount(type, DateUtil.beginOfMonth(new Date()).toString(), streetId,areaCode); // vo.setRealUsersTotal(realUsersTotal); // vo.setRealUsersMonth(realUsersMonth); // vo.setRealUser(getStreetRealUser(realUsersTotal)); // vo.setRealUserRate(getRate(vo.getAllUser(),vo.getRealUser())); // List<Date> twentyDays = getTwentyDays(); // List<Date> monthTwentyDays = getMonthTwentyDays(); // vo.setUserActivityXAll(getMAndD(getTwentyDays())); // vo.setUserActivityXMonth(getMAndD(getMonthTwentyDays())); // List<String> addUserYAll=new ArrayList<>(); // List<String> addUserYMonth=new ArrayList<>(); // List<String> activeUserYAll=new ArrayList<>(); // List<String> activeUserYMonth=new ArrayList<>(); // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); // //获取用户行为Y轴 // for (Date date : twentyDays) { // //查询当天的新增和日活 // Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); // addUserYAll.add(map.get("addUser").toString()); // activeUserYAll.add(map.get("activeUser").toString()); // } // for (Date date : monthTwentyDays) { // Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); // addUserYMonth.add(map.get("addUser").toString()); // activeUserYMonth.add(map.get("activeUser").toString()); // } // vo.setAddUserYAll(addUserYAll); // vo.setAddUserYWeek(addUserYMonth); // vo.setActiveUserYAll(activeUserYAll); // vo.setActiveUserYMonth(activeUserYMonth); // if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ // //获取其他用户 // vo.setOtherUser(indexDataKanbanVO.getAllUser()-countUser(vo.getUserProportionTotal())); // vo.setOtherUserRate(getRate(indexDataKanbanVO.getAllUser(),vo.getOtherUser())); // } return R.ok(vo); } @Override public R userRate(Integer type, Long streetId, Long areaCode, Integer range) { IndexDataAnalysisVO analysisVO=new IndexDataAnalysisVO(); if (type.equals(BYSTREET) || type.equals(BYAREA)){ //街道,区县筛选 IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId,areaCode,null); BeanUtils.copyProperties(indexDataVO,analysisVO ); }else { //总量数据 IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); BeanUtils.copyProperties(indexDataKanbanVO,analysisVO ); } String date=""; if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ if (range.equals(1)){ DateTime dateTime = DateUtil.beginOfMonth(new Date()); date = DateUtil.parse(dateTime.toString(), "yyyy-MM-dd HH:mm:ss").toString(); } } List<UserProportion> userProportions = userDao.userAnalysis(type, date, streetId,areaCode); List<UserRateAnalysisVO> userRateAnalysisVOList=new ArrayList<>(); Boolean monthRange=false; if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ if (range.equals(1)){ monthRange=true; } } if (userProportions.size()>0){ for (UserProportion userProportion : userProportions) { if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ //计算占比 //userProportion.setAreaCode(null); if (type.equals(BYSTREET)){ userProportion.setRate(getRate(streetUser,userProportion.getUser())); UserRateAnalysisVO vo=new UserRateAnalysisVO(); vo.setName(typeToName(type,userProportion )); if (monthRange){ //获取本月的用户总数作为计算占比的用户总数 IndexDataKanbanVO data = userDao.dataKanBanStreet(streetId, areaCode, date); vo.setRate(getRate(data.getAllUser(),userProportion.getUser())); }else{ vo.setRate(getRate(analysisVO.getAllUser(),userProportion.getUser())); } userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); vo.setCount(userProportion.getUser()); userRateAnalysisVOList.add(vo); } } } List<UserProportion> userProportionsMonth = userDao.userAnalysis(type, DateUtil.beginOfMonth(new Date()).toString(), streetId); for (UserProportion userProportion : userProportionsMonth) { if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion)){ if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(userProportion.getUser())){ //计算占比 //userProportion.setAreaCode(null); if (type.equals(BYSTREET)){ userProportion.setRate(getRate(streetUser,userProportion.getUser())); //计算其他用户占比 final Boolean flag=(type.equals(ALLSTREET) || type.equals(ALLCOMMUNITY) || type.equals(BYSTREET) || type.equals(BYAREA)); if (flag){ UserRateAnalysisVO vo=new UserRateAnalysisVO(); vo.setName(OTHERUSER); vo.setCount(analysisVO.getAllUser()-countUser(userRateAnalysisVOList)); vo.setRate(getRate(analysisVO.getAllUser(), vo.getCount())); userRateAnalysisVOList.add(vo); } userProportion.setRate(getRate(vo.getAllUser(),userProportion.getUser())); UserRateVO userRate=new UserRateVO(); userRate.setUserList(userRateAnalysisVOList); return R.ok(userRate); } @Override public R realUser(Integer type, Long streetId, Long areaCode, Integer range) { IndexDataAnalysisVO analysisVO=new IndexDataAnalysisVO(); if (type.equals(BYSTREET) || type.equals(BYAREA)){ //街道,区县筛选 IndexDataKanbanVO indexDataVO = userDao.dataKanBanStreet(streetId,areaCode,null); BeanUtils.copyProperties(indexDataVO,analysisVO ); }else { //总量数据 IndexDataKanbanVO indexDataKanbanVO = userDao.selectIndexDataKanban(null); BeanUtils.copyProperties(indexDataKanbanVO,analysisVO ); } String date=""; if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ if (range.equals(1)){ DateTime dateTime = DateUtil.beginOfMonth(new Date()); date = DateUtil.parse(dateTime.toString(), "yyyy-MM-dd HH:mm:ss").toString(); } } RealUserVO realUserVO=new RealUserVO(); List<RealUser> realUsers = userDao.realUserCount(type, date, streetId, areaCode); List<RealUserAnalysisVO> realUserList=new ArrayList<>(); realUserVO.setRealUserCount(getStreetRealUser(realUsers)); realUserVO.setRealUserRate(NumberUtil.div(realUserVO.getRealUserCount(), analysisVO.getAllUser()).doubleValue()); for (RealUser realUser : realUsers) { RealUserAnalysisVO vo=new RealUserAnalysisVO(); vo.setCount(realUser.getCount()); vo.setName(typeToNameRealUser(type, realUser)); realUserList.add(vo); } vo.setUserProportionTotal(userProportionsTotal); vo.setUserProportionMonth(userProportionsMonth); List<RealUser> realUsersTotal = userDao.realUserCount(type, null, streetId); List<RealUser> realUsersMonth = userDao.realUserCount(type, DateUtil.beginOfMonth(new Date()).toString(), streetId); vo.setRealUsersTotal(realUsersTotal); vo.setRealUsersMonth(realUsersMonth); vo.setRealUser(getStreetRealUser(realUsersTotal)); vo.setRealUserRate(getRate(vo.getAllUser(),vo.getRealUser())); List<Date> twentyDays = getTwentyDays(); SimpleDateFormat sdf1=new SimpleDateFormat("MM"); for (Date twentyDay : twentyDays) { sdf1.format(twentyDay); realUserVO.setRealUserList(realUserList); return R.ok(realUserVO); } vo.setUserActivityXAll(getTwentyDays()); vo.setUserActivityXMonth(getMonthTwentyDays()); List<String> addUserYAll=new ArrayList<>(); List<String> addUserYMonth=new ArrayList<>(); List<String> activeUserYAll=new ArrayList<>(); List<String> activeUserYMonth=new ArrayList<>(); @Override public R userActivity(Integer type, Long streetId, Long areaCode, Integer range) { UserActivityAnalysisVO vo=new UserActivityAnalysisVO(); List<Date> activeX=getTwentyDays(); List<String> activeY=new ArrayList<>(); List<String> adY=new ArrayList<>(); if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(range)){ if (range.equals(1)){ //本月数据 activeX = getMonthTwentyDays(); } } SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); //获取用户行为Y轴 for (Date date : vo.getUserActivityXAll()) { //查询当天的新增和日活 Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId); addUserYAll.add(map.get("addUser").toString()); activeUserYAll.add(map.get("activeUser").toString()); for (Date date : activeX) { Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId,areaCode); adY.add(map.get("addUser").toString()); activeY.add(map.get("activeUser").toString()); } for (Date date : vo.getUserActivityXMonth()) { Map<String, Long> map = userDao.getDailyAddAndActive(DateUtil.parse(sdf.format(date)), streetId); addUserYMonth.add(map.get("addUser").toString()); activeUserYMonth.add(map.get("activeUser").toString()); } vo.setAddUserYAll(addUserYAll); vo.setAddUserYWeek(addUserYMonth); vo.setActiveUserYAll(activeUserYAll); vo.setActiveUserYMonth(activeUserYMonth); if (type.equals(BYSTREET) || type.equals(ALLCOMMUNITY) || type.equals(ALLSTREET)){ //获取其他用户 vo.setOtherUser(indexDataKanbanVO.getAllUser()-countUser(vo.getUserProportionTotal())); vo.setOtherUserRate(getRate(indexDataKanbanVO.getAllUser(),vo.getOtherUser())); } vo.setUserX(getMAndD(activeX)); vo.setAddUserY(adY); vo.setActiveUserY(activeY); return R.ok(vo); } @@ -3426,6 +3564,20 @@ } } return R.ok(); } @Override public R getAreaAndStreet() { List<Integer> areaCodeList=areaCodeList(); List<AreaVO> areaVOList=new ArrayList<>(); for (Integer code : areaCodeList) { AreaVO vo=new AreaVO(); vo.setId(code); vo.setName(areaCodeToName(code.longValue())); vo.setStreetList(userDao.selectStreetByAreaCode(code)); areaVOList.add(vo); } return R.ok(areaVOList); } /** @@ -3471,11 +3623,12 @@ /** * 计算占比 * */ private Double getRate(Integer total,Integer count){ private Integer getRate(Integer total,Integer count){ if (0 != total && null != total){ if (0 != count && null != count){ BigDecimal div = NumberUtil.div(count.toString(), total.toString(),2); return div.doubleValue(); BigDecimal mul = NumberUtil.mul(div, 100); return mul.intValue(); } } return null; @@ -3502,13 +3655,13 @@ /** * 计算当前统计范围内的所有用户数 * */ public Integer countUser(List<UserProportion> list){ public Integer countUser(List<UserRateAnalysisVO> list){ Integer count=0; if (list.size()>0){ for (UserProportion proportion : list) { for (UserRateAnalysisVO proportion : list) { if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion)){ if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion.getUser())){ count+=proportion.getUser(); if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(proportion.getCount())){ count+=proportion.getCount(); } } } @@ -3516,4 +3669,107 @@ return count; } /** * 截取月,日 * */ public List<String> getMAndD(List<Date> list){ List<String> dateList=new ArrayList<>(); if (list.size()>0){ for (Date date : list) { dateList.add(DateFormatUtils.format(date,"MM-dd" )); } } return dateList; } /** * areaCode转区县名 * */ private String areaCodeToName(Long areaCode){ String code = areaCode.toString(); String name="不正确的areaCode"; switch (code){ case "510423" : name= "西区"; break; case "510402": name="东区"; case "510411": name="仁和区"; break; case "510421": name="米易县"; break; case "510422": name="盐边县"; break; } return name; } /** *根据type选择要设置的名称 * */ private String typeToName(Integer type,UserProportion proportion){ String name=""; if (type.equals(ALLCOUNTY)){ name=areaCodeToName(proportion.getAreaCode()); }else if(type.equals(ALLSTREET) || type.equals(BYAREA)){ name=proportion.getStreetName(); }else if (type.equals(ALLCOMMUNITY) || type.equals(BYSTREET)){ name=proportion.getCommunityName(); } return name; } /** *根据type选择要设置的名称 * */ private String typeToNameRealUser(Integer type,RealUser proportion){ String name=""; if (type.equals(ALLCOUNTY)){ name=areaCodeToName(Long.parseLong(proportion.getAreaCode())); }else if(type.equals(ALLSTREET) || type.equals(BYAREA)){ name=proportion.getStreetName(); }else if (type.equals(ALLCOMMUNITY) || type.equals(BYSTREET)){ name=proportion.getCommunityName(); } return name; } /** * 生成区县code列表 * */ private List<Integer> areaCodeList(){ List<Integer> list=new ArrayList<>(); list.add(510423); list.add(510402); list.add(510411); list.add(510421); list.add(510422); return list; } /** * 根据日志保存修改之前的信息 * */ private String saveBeforeUpdateData(SysOperLogVO operlog) throws JsonProcessingException { if (operlog.getTitle().equals(UPDATEACIDCHECKRECORD)){ // ComActAcidCheckRecordVO comActAcidCheckRecordVO = objectMapper.readValue(operlog.getOperParam(), ComActAcidCheckRecordVO.class); ComActAcidCheckRecordVO comActAcidCheckRecordVO1 = userDao.selectComActAcidCheckRecordById(comActAcidCheckRecordVO.getId()); return JSONObject.toJSONString(comActAcidCheckRecordVO1); }else if (operlog.getTitle().equals(UPDATEACIDRECORD)){ ComActAcidRecordVO comActAcidRecordVO = objectMapper.readValue(operlog.getOperParam(), ComActAcidRecordVO.class); return JSONObject.toJSONString(userDao.selectComActAcidRecord(comActAcidRecordVO.getId())); }else if(operlog.getTitle().equals(UPDATEACIDMEMBER)){ ComActAcidMemberVO comActAcidMemberVO = objectMapper.readValue(operlog.getOperParam(), ComActAcidMemberVO.class); return JSONObject.toJSONString(userDao.selectComActAcidMember(comActAcidMemberVO.getId())); } return null; } } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml
@@ -572,9 +572,17 @@ <if test="range != null and range != ''"> and su.create_at >= #{range} </if> <if test="type == 5"> <if test="areaCode != null"> and ac.area_code=#{areaCode} group by cs.street_id </if> </if> <if test="type == 4"> <if test="streetId != null"> and cs.street_id=#{streetId} group by su.community_id </if> </if> <if test="type == 1"> group by cs.area_code @@ -597,6 +605,12 @@ and su.id_card<>'' <if test="range != null and range != ''"> and su.create_at >= #{range} </if> <if test="type == 5"> <if test="areaCode != null"> and ac.area_code=#{areaCode} group by cs.street_id </if> </if> <if test="type == 4"> and cs.street_id=#{streetId} @@ -621,6 +635,9 @@ where su.community_id<>'' and cs.area_code<>'' and cs.street_id=#{id} <if test="areaCode != null"> and ac.area_code=#{areaCode} </if> </select> <select id="dataKanBanStreet" resultType="com.panzhihua.common.model.vos.IndexDataKanbanVO"> SELECT @@ -634,6 +651,12 @@ <if test="streetId != null"> and t1.street_id=#{streetId} </if> <if test="areaCode != null"> and t1.area_code=#{areaCode} </if> <if test="range != null and range != ''"> and t.create_at >= #{range} </if> </select> <select id="getDailyAddAndActive" resultType="java.util.Map"> select COUNT(case WHEN DATE_FORMAT(su.last_login_time,'%m-%d-%Y')=DATE_FORMAT(#{date},'%m-%d-%Y') then user_id else null end) as activeUser, @@ -646,6 +669,23 @@ <if test="id != null"> and cs.street_id=#{id} </if> <if test="areaCode != null"> and cs.area_code=#{areaCode} </if> </select> <select id="selectStreetByAreaCode" resultType="com.panzhihua.common.model.vos.user.StreetVO"> select street_id as id,name as name from com_street where area_code=#{code} </select> <select id="selectComActAcidCheckRecordById" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidCheckRecordVO"> select * from com_act_acid_check_record where id = #{id} </select> <select id="selectComActAcidRecord" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO"> select * from com_act_acid_record where id = #{id} </select> <select id="selectComActAcidMember" resultType="com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO"> select * from com_act_acid_member where id = #{id} </select> </mapper>