From cb9be5e23680da32ba19aa7134ea7a61e6cd1bfe Mon Sep 17 00:00:00 2001 From: chenrui <1950717904@qq.com> Date: Sat, 2 Nov 2024 18:59:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E7=BB=BC=E5=90=88=E5=88=86?= =?UTF-8?q?=E6=9E=90=E6=89=A7=E6=B3=95=E9=83=A8=E9=97=A8=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=EF=BC=8C=E6=A3=80=E6=9F=A5=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatisticalPanelController.java | 42 ++++++- .../code/domain/dto/StatisticalPanelDto.java | 44 +++++++ .../code/service/StatisticalPaneService.java | 17 +++ ...l.java => StatisticalPaneServiceImpl.java} | 113 +++++++++++++++++- .../impl/statisticalPanelServiceImpl.java | 74 ------------ .../code/service/statisticalPanelService.java | 8 -- .../mapper/StatisticalPanelMapper.xml | 17 +++ 7 files changed, 227 insertions(+), 88 deletions(-) create mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/dto/StatisticalPanelDto.java rename lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/{StatisticalPaneImpl.java => StatisticalPaneServiceImpl.java} (80%) delete mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/statisticalPanelServiceImpl.java delete mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/statisticalPanelService.java diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticalPanelController.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticalPanelController.java index 6f619a56..9e0b9fe1 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticalPanelController.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticalPanelController.java @@ -1,13 +1,14 @@ package com.zdxt.code.controller; -import com.zdxt.code.domain.StatisticsIndicator; import com.zdxt.code.domain.StatisticsIndicatorPart; +import com.zdxt.code.domain.dto.StatisticalPanelDto; import com.zdxt.code.service.StatisticalPaneService; import com.zdxt.common.ZDResponse; import com.zdxt.common.controller.BaseController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -20,26 +21,57 @@ public class StatisticalPanelController extends BaseController { @Autowired private StatisticalPaneService statisticalPaneService; - /*@RequestMapping("/") - public ZDResponse home(){ - return ZDResponse.success(); - }*/ + + + + + @RequestMapping("/statisticalPanelDeptAndUser") + @ResponseBody + public ZDResponse statisticalPanelDeptAndUser(StatisticsIndicatorPart statisticsIndicatorPart){ + StatisticalPanelDto statisticalPanelDto = + statisticalPaneService.statisticalPanelDeptAndUser(statisticsIndicatorPart); + return ZDResponse.success("执法部门统计",statisticalPanelDto); + } + + /** + * 企业 + * @param statisticsIndicatorPart + * @return + */ @GetMapping("/enterprise") @ResponseBody public ZDResponse qy(StatisticsIndicatorPart statisticsIndicatorPart){ return ZDResponse.success("成功",statisticalPaneService.enterprise(statisticsIndicatorPart)); } + + /** + * 登记 + * @param statisticsIndicatorPart + * @return + */ @GetMapping("/registration") @ResponseBody public ZDResponse registration(StatisticsIndicatorPart statisticsIndicatorPart){ return ZDResponse.success("成功",statisticalPaneService.registration(statisticsIndicatorPart)); } + + /** + * 预警 + * @param statisticsIndicatorPart + * @return + */ @GetMapping("/warning") @ResponseBody public ZDResponse warning(StatisticsIndicatorPart statisticsIndicatorPart){ return ZDResponse.success("成功",statisticalPaneService.warning(statisticsIndicatorPart)); } + + /** + * 投诉 + * @param statisticsIndicatorPart + * @return + */ @GetMapping("/complaint") @ResponseBody public ZDResponse complaint(StatisticsIndicatorPart statisticsIndicatorPart){ diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/dto/StatisticalPanelDto.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/dto/StatisticalPanelDto.java new file mode 100644 index 00000000..ebbf54c1 --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/dto/StatisticalPanelDto.java @@ -0,0 +1,44 @@ +package com.zdxt.code.domain.dto; + +public class StatisticalPanelDto { + + /** + * 执法部门数量 + */ + private Integer deptTotal; + /** + * 执法人员数量 + */ + private Integer userTotal; + + /** + * 本单位执法人员数量 + */ + private Integer oneselfUserTotal; + + + public Integer getDeptTotal() { + return deptTotal; + } + + public void setDeptTotal(Integer deptTotal) { + this.deptTotal = deptTotal; + } + + public Integer getUserTotal() { + return userTotal; + } + + public void setUserTotal(Integer userTotal) { + this.userTotal = userTotal; + } + + public Integer getOneselfUserTotal() { + return oneselfUserTotal; + } + + public void setOneselfUserTotal(Integer oneselfUserTotal) { + this.oneselfUserTotal = oneselfUserTotal; + } + +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticalPaneService.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticalPaneService.java index 4277e3c5..c9c79a15 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticalPaneService.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticalPaneService.java @@ -1,6 +1,7 @@ package com.zdxt.code.service; import com.zdxt.code.domain.StatisticsIndicatorPart; +import com.zdxt.code.domain.dto.StatisticalPanelDto; public interface StatisticalPaneService { @@ -11,4 +12,20 @@ public interface StatisticalPaneService { StatisticsIndicatorPart warning(StatisticsIndicatorPart statisticsIndicatorPart); StatisticsIndicatorPart complaint(StatisticsIndicatorPart statisticsIndicatorPart); + + + /** + * 执法部门数量 + * @param statisticsIndicatorPart + * @return + */ + StatisticalPanelDto statisticalPanelDeptAndUser(StatisticsIndicatorPart statisticsIndicatorPart); + + /** + * 统计执法计 + * @param statisticsIndicatorPart + * @return + */ + StatisticsIndicatorPart statisticProgram(StatisticsIndicatorPart statisticsIndicatorPart); + } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalPaneImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalPaneServiceImpl.java similarity index 80% rename from lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalPaneImpl.java rename to lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalPaneServiceImpl.java index eb7e6ee5..47532592 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalPaneImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalPaneServiceImpl.java @@ -1,8 +1,14 @@ package com.zdxt.code.service.impl; +import com.zdxt.auth.dto.UserBean; +import com.zdxt.auth.feign.DeptApi; import com.zdxt.auth.feign.UserApi; import com.zdxt.auth.project.system.dept.service.IDeptService; +import com.zdxt.auth.project.system.dict.service.IDictDataService; +import com.zdxt.auth.project.system.user.service.IUserService; import com.zdxt.code.domain.*; +import com.zdxt.code.domain.dto.StatisticalPanelDto; +import com.zdxt.code.mapper.StatisticalPanelMapper; import com.zdxt.code.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,7 +26,7 @@ import java.util.stream.Collectors; * 月度:year!==null,quarter!==null,month!==null */ @Service -public class StatisticalPaneImpl implements StatisticalPaneService { +public class StatisticalPaneServiceImpl implements StatisticalPaneService { @Autowired private ComplaintStatisticsService complaintStatisticsService; @Autowired @@ -38,6 +44,22 @@ public class StatisticalPaneImpl implements StatisticalPaneService { @Autowired private IDeptService iDeptService; + @Autowired + private StatisticalPanelMapper statisticalPanelMapper; + + @Autowired + private UserApi userApi; + @Autowired + private DeptApi deptApi; + + @Autowired + private IDictDataService dictDataService; + + @Autowired + private IUserService userService; + @Autowired + private IZfryjdm2405301Service iZfryjdm2405301Service; + /** * 企业--无权限 * @param statisticsIndicatorPart @@ -216,6 +238,89 @@ public class StatisticalPaneImpl implements StatisticalPaneService { return p; } + + @Override + public StatisticalPanelDto statisticalPanelDeptAndUser(StatisticsIndicatorPart statisticsIndicatorPart) { + //统计执法部门数量 + Integer deptTotal = statisticalPanelMapper.statisticalPanelDept(statisticsIndicatorPart); + //执法人员数量 + Integer userTotal = statisticalPanelMapper.statisticalPanelUser(statisticsIndicatorPart); + + UserBean user = userApi.getCurrentUser(); + //查询双系统执法人员信息 + Zfryjdm2405301 zfryjdm2405301 = + iZfryjdm2405301Service.selectZfryByZfCode(user.getLawCertificateNum()); + //通过机构代码查询执法主体信息 + statisticsIndicatorPart.setCreditCode(zfryjdm2405301.getZzjgdm()); + //本单位执法人员数量 + Integer oneselfUserTotal = statisticalPanelMapper.statisticalPanelOneselfDeptUser(statisticsIndicatorPart); + + //默认今年 同比 对比上一年 上一个季度 上一个月 + StatisticalPanelDto statisticalPanelDto = new StatisticalPanelDto(); + + /** + * 部门总数 + */ + statisticalPanelDto.setDeptTotal(deptTotal); + + /** + * 执法人员数量 + */ + statisticalPanelDto.setUserTotal(userTotal); + + /** + * 本单位执法人员 + */ + statisticalPanelDto.setOneselfUserTotal(oneselfUserTotal); + + + return statisticalPanelDto; + } + + @Override + public StatisticsIndicatorPart statisticProgram(StatisticsIndicatorPart statisticsIndicatorPart) { + + //获取参数传递过来的查询条件转换为开始时间与结束时间 + StatisticsIndicatorPart statisticsIndicatorPart1 = nowDataMake(statisticsIndicatorPart); + //获取参数传递的查询时间转换为 同比时间 + StatisticsIndicatorPart statisticsIndicatorPart2 = + lastDataMake(statisticsIndicatorPart, statisticsIndicatorPart1.getBeginTime()); + + //查询筛选条件-时间 + statisticsIndicatorPart.setBeginTime(statisticsIndicatorPart1.getBeginTime()); + statisticsIndicatorPart.setEndTime(statisticsIndicatorPart1.getEndTime()); + + //统计执法计划总数 + Integer allTotal = statisticalPanelMapper.statisticalPanelProgramTotal(statisticsIndicatorPart); + //统计本单位执法计划总数 + Integer deptTotal = statisticalPanelMapper.statisticalPanelProgramWithDept(statisticsIndicatorPart); + + //同比查询执法数据 + //统计执法计划总数 + Integer lastAllTotal = statisticalPanelMapper.statisticalPanelProgramTotal(statisticsIndicatorPart); + //统计本单位执法计划总数 + Integer lastDeptTotal = statisticalPanelMapper.statisticalPanelProgramWithDept(statisticsIndicatorPart); + + + + List statisticsIndicatorParts = new ArrayList<>(); + + //返回结果 + //总检查计划数量结果 + StatisticsIndicatorPart statisticsIndicatorPart3 = new StatisticsIndicatorPart(); + statisticsIndicatorPart3.setTotal(allTotal); + statisticsIndicatorPart3.setHuan((allTotal-lastAllTotal)); + statisticsIndicatorParts.add(statisticsIndicatorPart3); + //本单位检查计划统计 + StatisticsIndicatorPart statisticsIndicatorPart4 = new StatisticsIndicatorPart(); + statisticsIndicatorPart4.setTotal(deptTotal); + statisticsIndicatorPart4.setHuan((deptTotal-lastDeptTotal)); + + + return null; + } + + /** * 当前时间处理--转换成beginTime和endTime的形式 */ @@ -303,4 +408,10 @@ public class StatisticalPaneImpl implements StatisticalPaneService { } return null; } + + public static int getQuarter(int year, int month) { + return (month + 2) / 3; + } + + } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/statisticalPanelServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/statisticalPanelServiceImpl.java deleted file mode 100644 index 496af62f..00000000 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/statisticalPanelServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.zdxt.code.service.impl; - -import com.zdxt.auth.dto.DeptBean; -import com.zdxt.auth.dto.UserBean; -import com.zdxt.auth.feign.DeptApi; -import com.zdxt.auth.feign.UserApi; -import com.zdxt.auth.project.system.dict.service.IDictDataService; -import com.zdxt.auth.project.system.user.service.IUserService; -import com.zdxt.code.domain.StatisticsIndicatorPart; -import com.zdxt.code.domain.Zfryjdm2405301; -import com.zdxt.code.mapper.StatisticalPanelMapper; -import com.zdxt.code.service.IZfryjdm2405301Service; -import com.zdxt.code.service.statisticalPanelService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.time.YearMonth; - -@Service -public class statisticalPanelServiceImpl implements statisticalPanelService { - - @Autowired - private StatisticalPanelMapper statisticalPanelMapper; - - @Autowired - private UserApi userApi; - @Autowired - private DeptApi deptApi; - - @Autowired - private IDictDataService dictDataService; - - @Autowired - private IUserService userService; - @Autowired - private IZfryjdm2405301Service iZfryjdm2405301Service; - - @Override - public void statisticalPanelDeptAndUser(StatisticsIndicatorPart statisticsIndicatorPart) { - //统计执法部门数量 - Integer deptTotal = statisticalPanelMapper.statisticalPanelDept(statisticsIndicatorPart); - //执法人员数量 - Integer userTotal = statisticalPanelMapper.statisticalPanelUser(statisticsIndicatorPart); - - UserBean user = userApi.getCurrentUser(); - //查询双系统执法人员信息 - Zfryjdm2405301 zfryjdm2405301 = - iZfryjdm2405301Service.selectZfryByZfCode(user.getLawCertificateNum()); - //通过机构代码查询执法主体信息 - statisticsIndicatorPart.setCreditCode(zfryjdm2405301.getZzjgdm()); - //本单位执法人员数量 - Integer oneselfUserTotal = statisticalPanelMapper.statisticalPanelOneselfDeptUser(statisticsIndicatorPart); - - //默认今年 同比 对比上一年 上一个季度 上一个月 - //TODO 没有选择 - - } - - public static YearMonth getPreviousQuarter(int year, int quarter) { - if (quarter == 1) { - return YearMonth.of(year - 1, 4); - } else { - return YearMonth.of(year, getFirstMonthOfQuarter(quarter - 1)); - } - } - - private static int getFirstMonthOfQuarter(int quarter) { - return 3 * (quarter - 1) + 1; - } - - public static void main(String[] args) { - System.out.println(getPreviousQuarter(2024, 4)); - } -} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/statisticalPanelService.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/statisticalPanelService.java deleted file mode 100644 index ad628bcb..00000000 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/statisticalPanelService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.zdxt.code.service; - -import com.zdxt.code.domain.StatisticsIndicatorPart; - -public interface statisticalPanelService { - - void statisticalPanelDeptAndUser(StatisticsIndicatorPart statisticsIndicatorPart); -} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml index b8f03547..7829949a 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml @@ -35,6 +35,13 @@ AND DATE_FORMAT(create_time, '%Y-%m') = #{month} + + #{beginTime} ]]> + + + + + AND time_type is not null @@ -54,6 +61,16 @@ ${params.dataScope} + + AND bureau_dept_id = #{bureauDeptId} + + + = #{beginTime} ]]> + + + + + AND time_type is not null