Sfoglia il codice sorgente

App端增加履职情况表,修改查询接口为post请求

jingyuanchao 1 anno fa
parent
commit
66d59f13ed

+ 6 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/controller/ResumptionReportController.java

@@ -2,6 +2,7 @@ package com.xunmei.core.reportForms.resumption.controller;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.web.domain.AjaxResult;
@@ -25,7 +26,6 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.time.LocalDate;
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeoutException;
@@ -62,8 +62,8 @@ public class ResumptionReportController {
 
     @ApiOperation(value = "每日安全保卫履职-日报表")
     @RequiresPermissions("core:resumptionReport:list")
-    @GetMapping("/list")
-    public AjaxResult list(ResumptionDTO resumptionDTO) throws ExecutionException, InterruptedException, TimeoutException {
+    @PostMapping("/list")
+    public AjaxResult list(@RequestBody ResumptionDTO resumptionDTO) throws ExecutionException, InterruptedException, TimeoutException {
         if (null == resumptionDTO.getSearchTime()) {
             LocalDate currentDate = LocalDate.now();
             if (null == resumptionDTO.getCycle() || resumptionDTO.getCycle() == 1) {
@@ -79,10 +79,11 @@ public class ResumptionReportController {
         AjaxResult ajaxResult = AjaxResult.success();
         List<ResumptionDayVO> report = resumptionReportService.report(resumptionDTO);
         ajaxResult.put(AjaxResult.DATA_TAG, report);
+        DateTime time = DateUtil.parse(resumptionDTO.getSearchTime());
         if (null == resumptionDTO.getCycle() || resumptionDTO.getCycle() == 1) {
-            ajaxResult.put(TITLE, "营业网点安全保卫履职情况表(" + resumptionDTO.getSearchTime() + ")");
+            ajaxResult.put(TITLE, "营业网点安全保卫履职情况表(" + DateUtil.format(time,Constants.DAILY_FORMAT) + ")");
         } else {
-            ajaxResult.put(TITLE, "营业网点安全保卫履职情况表(" + resumptionDTO.getSearchTime() + ")");
+            ajaxResult.put(TITLE, "营业网点安全保卫履职情况表(" + DateUtil.format(time,Constants.DAILY_FORMAT) + ")");
         }
         SysOrg sysOrg = remoteOrgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
         ajaxResult.put("orgName", sysOrg.getShortName());

+ 5 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/dto/ResumptionDTO.java

@@ -3,6 +3,7 @@ package com.xunmei.core.reportForms.resumption.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
 import javax.validation.constraints.NotEmpty;
 import java.util.Date;
 import java.util.List;
@@ -15,8 +16,12 @@ import java.util.List;
 public class ResumptionDTO {
     private Long orgId;
 
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @ApiModelProperty("查询时间,Web端使用此字段查询")
     private String searchTime;
 
+    @ApiModelProperty(value = "是否App查询,App查询会使用startTime和endTime进行范围查询")
+    private Integer appSelect;
     private Integer planType;
     private Date startTime;
     private Date endTime;

+ 2 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/mapper/ResumptionReportMapper.java

@@ -17,7 +17,8 @@ import java.util.Map;
 @Mapper
 public interface ResumptionReportMapper {
 
-    ResumptionDayVO selectReport(@Param("cycle") Integer cycle, @Param("planType") Integer planType, @Param("orgId") Long orgId, @Param("date") String date, @Param("orgPath") String orgPath);
+    //ResumptionDayVO selectReport(@Param("cycle") Integer cycle, @Param("planType") Integer planType, @Param("orgId") Long orgId, @Param("date") String date, @Param("orgPath") String orgPath);
+    ResumptionDayVO selectReport(@Param("req") ResumptionDTO req, @Param("planType") Integer planType,@Param("orgId") Long orgId, @Param("orgPath") String orgPath);
 
     /**
      * 已整改数量

+ 40 - 46
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/service/impl/ResumptionReportServiceImpl.java

@@ -1,5 +1,6 @@
 package com.xunmei.core.reportForms.resumption.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.excel.EasyExcel;
 import com.xunmei.common.core.constant.SecurityConstants;
@@ -68,6 +69,10 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         } else {
             return Collections.emptyList();
         }
+        if (ObjectUtil.isAllNotEmpty(resumptionDTO.getStartTime(),resumptionDTO.getEndTime())){
+            resumptionDTO.setStartTime(DateUtil.beginOfDay(resumptionDTO.getStartTime()));
+            resumptionDTO.setEndTime(DateUtil.endOfDay(resumptionDTO.getEndTime()));
+        }
         List<ResumptionDayVO> resumptionDayVOS = new ArrayList<>();
 //        sysOrgs.forEach(o -> {
 //            ResumptionDayVO resumptionDayVO = new ResumptionDayVO();
@@ -169,20 +174,20 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         ResumptionDayVO resumptionDayVO1 = null;
         ResumptionDayVO resumptionDayVO2 = null;
         ResumptionDayVO resumptionDayVO3 = null;
-
+        //planType: 1/2/3对应营业前中后
         if (org.getType() != 4) {
             //营业前
-            resumptionDayVO1 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 1, null, resumptionDTO.getSearchTime(), org.getPath());
+            resumptionDayVO1 = resumptionReportMapper.selectReport(resumptionDTO, 1, null, org.getPath());
             //营业中
-            resumptionDayVO2 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 2, null, resumptionDTO.getSearchTime(), org.getPath());
+            resumptionDayVO2 = resumptionReportMapper.selectReport(resumptionDTO, 2, null, org.getPath());
             //后
-            resumptionDayVO3 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 3, null, resumptionDTO.getSearchTime(), org.getPath());
+            resumptionDayVO3 = resumptionReportMapper.selectReport(resumptionDTO, 3, null, org.getPath());
         }
         if (org.getType() == 4) {
             integer = 1;
-            resumptionDayVO1 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 1, org.getId(), resumptionDTO.getSearchTime(), null);
-            resumptionDayVO2 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 2, org.getId(), resumptionDTO.getSearchTime(), null);
-            resumptionDayVO3 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 3, org.getId(), resumptionDTO.getSearchTime(), null);
+            resumptionDayVO1 = resumptionReportMapper.selectReport(resumptionDTO, 1, org.getId(), null);
+            resumptionDayVO2 = resumptionReportMapper.selectReport(resumptionDTO, 2, org.getId(), null);
+            resumptionDayVO3 = resumptionReportMapper.selectReport(resumptionDTO, 3, org.getId(), null);
         }
 
         resumptionDayVO.setNetworkNumber(integer);
@@ -258,7 +263,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
     }
 
     @Override
-    public void intrusionTestExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException , ExecutionException, InterruptedException, TimeoutException{
+    public void intrusionTestExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException, ExecutionException, InterruptedException, TimeoutException {
         String orgName = null;
         if (null != resumptionDTO.getOrgId()) {
             SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
@@ -276,9 +281,9 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
             intrusionTestReportVO.setOrderNum(i + 1);
         }
         String baseHeaderName = "报警测试情况表";
-        String startStr = DateUtils.parseDateToStr("yyyy-MM",resumptionDTO.getStartTime());
-        String endStr = DateUtils.parseDateToStr("yyyy-MM",resumptionDTO.getEndTime());
-        String header = baseHeaderName + "(" + startStr + "至"+endStr+")";
+        String startStr = DateUtils.parseDateToStr("yyyy-MM", resumptionDTO.getStartTime());
+        String endStr = DateUtils.parseDateToStr("yyyy-MM", resumptionDTO.getEndTime());
+        String header = baseHeaderName + "(" + startStr + "至" + endStr + ")";
         response.setContentType("application/vnd.ms-excel");
         response.setCharacterEncoding("utf-8");
         String fileName = URLEncoder.encode("【" + orgName + "】-" + baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
@@ -290,7 +295,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
     }
 
     @Override
-    public List<IntrusionTestReportVO> intrusionTest(ResumptionDTO resumptionDTO) throws ExecutionException, InterruptedException, TimeoutException  {
+    public List<IntrusionTestReportVO> intrusionTest(ResumptionDTO resumptionDTO) throws ExecutionException, InterruptedException, TimeoutException {
         if (null == resumptionDTO.getOrgId()) {
             resumptionDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
         }
@@ -361,19 +366,17 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         return intrusionTestReportVOList;
     }
 
-    private IntrusionTestReportVO getOneIntrusionTestData(SysOrg o,ResumptionDTO resumptionDTO){
+    private IntrusionTestReportVO getOneIntrusionTestData(SysOrg o, ResumptionDTO resumptionDTO) {
         IntrusionTestReportVO resultVo = new IntrusionTestReportVO();
-        IntrusionTestReportVO tempIntrusionTestReportVO1 =null;
-        Integer networkNumber =null;
-        Map map =null;
+        IntrusionTestReportVO tempIntrusionTestReportVO1 = null;
+        Integer networkNumber = null;
+        Map map = null;
 
-        if(o.getType()==4)
-        {
-            networkNumber =1;
+        if (o.getType() == 4) {
+            networkNumber = 1;
             tempIntrusionTestReportVO1 = resumptionReportMapper.selectIntrusionTestReport(o.getId(), resumptionDTO, null);
             map = resumptionReportMapper.selectIntrusionTestAbnormalNumber(o.getId(), resumptionDTO, null);
-        }
-        else{
+        } else {
             networkNumber = monitorAccessReportMapper.selectOrgNumByPathAndType(o.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
             tempIntrusionTestReportVO1 = resumptionReportMapper.selectIntrusionTestReport(null, resumptionDTO, o.getPath());
             //隐患
@@ -394,7 +397,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
     }
 
     @Override
-    public void standbyPowerExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException,ExecutionException, InterruptedException, TimeoutException {
+    public void standbyPowerExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException, ExecutionException, InterruptedException, TimeoutException {
         String orgName = null;
         if (null != resumptionDTO.getOrgId()) {
             SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
@@ -425,7 +428,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
 
 
     @Override
-    public List<LhSelfBankInspectionReport> serviceBank(ResumptionDTO resumptionDTO) throws Exception,ExecutionException, InterruptedException, TimeoutException {
+    public List<LhSelfBankInspectionReport> serviceBank(ResumptionDTO resumptionDTO) throws Exception, ExecutionException, InterruptedException, TimeoutException {
         if (null == resumptionDTO.getOrgId()) {
             resumptionDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
         }
@@ -474,8 +477,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
                     completableFutureList.add(future);
 //                    intrusionTestReportVOList.add(future.get(5, TimeUnit.SECONDS));
                 }
-                if(completableFutureList.size()>0)
-                {
+                if (completableFutureList.size() > 0) {
                     CompletableFuture<Void> allQueries = CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[0]));
                     allQueries.get(15L, TimeUnit.SECONDS);
                     completableFutureList.forEach(x -> {
@@ -492,7 +494,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
     }
 
     @Override
-    public List<IntrusionTestReportVO> standbyPower(ResumptionDTO resumptionDTO) throws ExecutionException, InterruptedException, TimeoutException{
+    public List<IntrusionTestReportVO> standbyPower(ResumptionDTO resumptionDTO) throws ExecutionException, InterruptedException, TimeoutException {
 /*        if (null != resumptionDTO.getSearchTime()) {
             String[] split = resumptionDTO.getSearchTime().split("-");
             Integer s = Integer.valueOf(split[1]);
@@ -575,23 +577,21 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         return intrusionTestReportVOList;
     }
 
-    private IntrusionTestReportVO getOneOrgStandByPower(SysOrg o,ResumptionDTO resumptionDTO)
-    {
+    private IntrusionTestReportVO getOneOrgStandByPower(SysOrg o, ResumptionDTO resumptionDTO) {
         IntrusionTestReportVO resultVo = new IntrusionTestReportVO();
-        IntrusionTestReportVO tempIntrusionTestReportVO1 =null;
-        Integer networkNumber =null;
-        Map map =null;
+        IntrusionTestReportVO tempIntrusionTestReportVO1 = null;
+        Integer networkNumber = null;
+        Map map = null;
 
         if (o.getType() == 4) {
             networkNumber = 1;
             map = resumptionReportMapper.selectStandbyPowerAbnormalNumber(o.getId(), resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), null);
             tempIntrusionTestReportVO1 = resumptionReportMapper.selectStandbyPower(null, resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), o.getPath());
-        }
-        else{
+        } else {
             networkNumber = monitorAccessReportMapper.selectOrgNumByPathAndType(o.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
             tempIntrusionTestReportVO1 = resumptionReportMapper.selectStandbyPower(null, resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), o.getPath());
             //隐患
-             map = resumptionReportMapper.selectStandbyPowerAbnormalNumber(null, resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), o.getPath());
+            map = resumptionReportMapper.selectStandbyPowerAbnormalNumber(null, resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), o.getPath());
         }
 
         BeanUtils.copyProperties(tempIntrusionTestReportVO1, resultVo);
@@ -604,7 +604,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         resultVo.setNetworkNumber(networkNumber);
         resultVo.setCity(o.getAffiliatedArea());
         resultVo.setOrgName(o.getShortName());
-        return  resultVo;
+        return resultVo;
     }
 
     @Override
@@ -632,22 +632,22 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         }
 
         String baseHeaderName = "离行式自助银行巡检情况表";
-        String startStr = DateUtils.parseDateToStr("yyyy-MM",resumptionDTO.getStartTime());
-        String endStr = DateUtils.parseDateToStr("yyyy-MM",resumptionDTO.getEndTime());
-        String header = baseHeaderName + "(" + startStr + "至"+endStr+")";
+        String startStr = DateUtils.parseDateToStr("yyyy-MM", resumptionDTO.getStartTime());
+        String endStr = DateUtils.parseDateToStr("yyyy-MM", resumptionDTO.getEndTime());
+        String header = baseHeaderName + "(" + startStr + "至" + endStr + ")";
         response.setContentType("application/vnd.ms-excel");
         response.setCharacterEncoding("utf-8");
         String fileName = URLEncoder.encode("【" + orgName + "】-" + baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
         response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
         Class clazz;
-        if (showOrgName){
+        if (showOrgName) {
             List<LhSelfBankInspectionReportNameVo> list = BeanHelper.copyProperties(report, LhSelfBankInspectionReportNameVo.class);
             clazz = LhSelfBankInspectionReportNameVo.class;
             // 调用EasyExcel的导出方法
             EasyExcel.write(response.getOutputStream(), clazz)
                     .registerWriteHandler(new ValueCellWriteHandler(header))
                     .sheet(baseHeaderName).doWrite(list);
-        }else {
+        } else {
             List<LhSelfBankInspectionReportNumVo> list = BeanHelper.copyProperties(report, LhSelfBankInspectionReportNumVo.class);
             clazz = LhSelfBankInspectionReportNumVo.class;
             // 调用EasyExcel的导出方法
@@ -657,12 +657,6 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
         }
 
 
-
-
-
-
-
-
     }
 
 

+ 13 - 6
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/ResumptionReportMapper.xml

@@ -45,12 +45,19 @@
           <if test="orgId !=null">
               AND a.org_id = #{orgId}
           </if>
-          <if test=" cycle ==2">
-              AND a.ymd_date like concat(#{date},'%')
-          </if>
-          <if test="cycle ==1 || cycle ==null">
-              AND a.ymd_date = #{date}
-          </if>
+        <choose>
+            <when test="req.appSelect ==1">
+                and a.ymd_date between #{req.startTime} and #{req.endTime}
+            </when>
+            <otherwise>
+                <if test=" req.cycle ==2">
+                    AND a.ymd_date like concat(#{req.searchTime},'%')
+                </if>
+                <if test="req.cycle ==1 || req.cycle ==null">
+                    AND a.ymd_date = #{req.searchTime}
+                </if>
+            </otherwise>
+        </choose>
         <if test="orgPath !=null">
             and a.org_path  like concat(#{orgPath},'%')
         </if>