瀏覽代碼

【CHG】首页按日期查询

zhaomn 2 年之前
父節點
當前提交
51ee724199

+ 15 - 17
railway-business/src/main/java/com/railway/business/bi/controller/ChartController.java

@@ -7,13 +7,12 @@ import com.railway.business.bi.service.IChartService;
 import com.railway.business.bi.service.IDetailService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
-import com.railway.common.utils.LocalDateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import java.util.Date;
 import java.util.List;
 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;
 
 /**
@@ -37,26 +36,25 @@ public class ChartController extends BaseController {
     this.detailService = detailService;
   }
 
-  @ApiOperation(value = "重要待办事项", notes = "重要待办事项")
+  @ApiOperation(value = "首页-重要待办事项", notes = "重要待办事项")
   @GetMapping("/todoList")
-  public AjaxResult todoList() {
-    TodoListVO info = chartService.todoList();
+  public AjaxResult todoList(@RequestParam(value = "date", required = false) String date) {
+    TodoListVO info = chartService.todoList(date);
     AjaxResult ajax = AjaxResult.success();
     ajax.put("info", info);
     return ajax;
   }
 
-  @ApiOperation(value = "地图图表", notes = "获取地图上的图表数据")
+  @ApiOperation(value = "首页-地图图表", notes = "获取地图上的图表数据")
   @GetMapping("/map")
   public AjaxResult getChartInMap() {
-    String date = LocalDateUtil.dateTime(new Date());
-    List<ChartVO> info = chartService.getChartInMap(date);
+    List<ChartVO> info = chartService.getChartInMap();
     AjaxResult ajax = AjaxResult.success();
     ajax.put("info", info);
     return ajax;
   }
 
-  @ApiOperation(value = "地图表格", notes = "获取地图上的表格数据")
+  @ApiOperation(value = "首页-地图表格", notes = "获取地图上的表格数据")
   @GetMapping("/map/table")
   public AjaxResult getTableInMap() {
     ChartVO info = chartService.getTableInMap();
@@ -65,7 +63,7 @@ public class ChartController extends BaseController {
     return ajax;
   }
 
-  @ApiOperation(value = "检修兑现情况", notes = "获取检修兑现情况图表数据")
+  @ApiOperation(value = "首页-检修兑现情况", notes = "获取检修兑现情况图表数据")
   @GetMapping("/jxdxqk")
   public AjaxResult getChartJxdxqk() {
     ChartVO info = chartService.getChartJxdxqk();
@@ -92,7 +90,7 @@ public class ChartController extends BaseController {
     return ajax;
   }
 
-  @ApiOperation(value = "试验计划兑现情况", notes = "获取试验计划兑现情况图表数据")
+  @ApiOperation(value = "首页-试验计划兑现情况", notes = "获取试验计划兑现情况图表数据")
   @GetMapping("/syjhdxqk")
   public AjaxResult getChartSyjhdxqk() {
     ChartVO info = chartService.getChartSyjhdxqk();
@@ -110,7 +108,7 @@ public class ChartController extends BaseController {
     return ajax;
   }
 
-  @ApiOperation(value = "电力远动调试", notes = "获取电力远动调试图表数据")
+  @ApiOperation(value = "首页-电力远动调试", notes = "获取电力远动调试图表数据")
   @GetMapping("/dlydts")
   public AjaxResult getChartDlydts() {
     ChartVO info = chartService.getChartDlydts();
@@ -119,7 +117,7 @@ public class ChartController extends BaseController {
     return ajax;
   }
 
-  @ApiOperation(value = "电力受电线路", notes = "获取电力受电线路图表数据")
+  @ApiOperation(value = "首页-电力受电线路", notes = "获取电力受电线路图表数据")
   @GetMapping("/dlsdxl")
   public AjaxResult getChartDlsdxl() {
     ChartVO info = chartService.getChartDlsdxl();
@@ -128,7 +126,7 @@ public class ChartController extends BaseController {
     return ajax;
   }
 
-  @ApiOperation(value = "电力变配电所", notes = "获取电力变配电所图表数据")
+  @ApiOperation(value = "首页-电力变配电所", notes = "获取电力变配电所图表数据")
   @GetMapping("/dlbpds")
   public AjaxResult getChartDlbpds() {
     ChartVO info = chartService.getChartDlbpds();
@@ -191,10 +189,10 @@ public class ChartController extends BaseController {
     return ajax;
   }
 
-  @ApiOperation(value = "牵变、电力设备巡检兑现(本月)", notes = "获取牵变、电力设备巡检兑现(本月)图表数据")
+  @ApiOperation(value = "首页-牵变、电力设备巡检兑现(本月)", notes = "获取牵变、电力设备巡检兑现(本月)图表数据")
   @GetMapping("/qbdlsbxjdx")
-  public AjaxResult getChartQbdlsbxjdx() {
-    ChartVO info = chartService.getChartQbdlsbxjdx();
+  public AjaxResult getChartQbdlsbxjdx(@RequestParam(value = "date", required = false) String date) {
+    ChartVO info = chartService.getChartQbdlsbxjdx(date);
     AjaxResult ajax = AjaxResult.success();
     ajax.put("info", info);
     return ajax;

+ 6 - 1
railway-business/src/main/java/com/railway/business/bi/mapper/ShowBdycMapper.java

@@ -21,7 +21,7 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface ShowBdycMapper {
 
-  List<DlycDTO> totalByDay(String day);
+  List<DlycDTO> totalByDay();
 
   /**
    * 新增
@@ -38,6 +38,11 @@ public interface ShowBdycMapper {
    */
   int update(ShowBdyc showBdyc);
 
+  /**
+   * 更新涉及工区
+   */
+  int updateSjgq(@Param("fileId") Long fileId);
+
   /**
    * 获取单个
    */

+ 1 - 1
railway-business/src/main/java/com/railway/business/bi/mapper/ShowDlycMapper.java

@@ -20,7 +20,7 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface ShowDlycMapper {
 
-  List<DlycDTO> totalByDay(String day);
+  List<DlycDTO> totalByDay();
 
   /**
    * 新增

+ 3 - 4
railway-business/src/main/java/com/railway/business/bi/service/IChartService.java

@@ -18,14 +18,13 @@ public interface IChartService {
      * 重要待办事项
      * @return 待办事项统计
      */
-    TodoListVO todoList();
+    TodoListVO todoList(String date);
 
     /**
      * 获取地图上的图表数据
-     * @param date 获取图表数据日期
      * @return 图表数据对象
      */
-    List<ChartVO> getChartInMap(String date);
+    List<ChartVO> getChartInMap();
 
     /**
      * 获取地图上的表格数据
@@ -97,6 +96,6 @@ public interface IChartService {
      * 获取牵变、电力设备巡检兑现(本月)图表数据
      * @return 图表数据对象
      */
-    ChartVO getChartQbdlsbxjdx();
+    ChartVO getChartQbdlsbxjdx(String date);
 
 }

+ 20 - 8
railway-business/src/main/java/com/railway/business/bi/service/impl/ChartServiceImpl.java

@@ -20,6 +20,8 @@ import com.railway.business.bi.mapper.ShowTestPlanKgMapper;
 import com.railway.business.bi.mapper.ShowYdtsMapper;
 import com.railway.business.bi.service.IChartService;
 import com.railway.common.utils.LocalDateUtil;
+import com.railway.common.utils.StringUtils;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.HashSet;
@@ -73,8 +75,13 @@ public class ChartServiceImpl implements IChartService {
    * @return 待办事项统计
    */
   @Override
-  public TodoListVO todoList() {
-    int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
+  public TodoListVO todoList(String date) {
+    int month;
+    if(StringUtils.isEmpty(date)) {
+      month = LocalDate.now().getMonthValue();
+    } else {
+      month = LocalDateUtil.parseLocalDate(date).getMonthValue();
+    }
     TodoListVO todoList = new TodoListVO();
     // 1) 远动调试本月待检数量  a个。a从数据库计算得来,首页日期的月份为计划月份,完成日期为空的数量。
     todoList.setYdts(ydtsMapper.countUndone(month));
@@ -95,7 +102,7 @@ public class ChartServiceImpl implements IChartService {
    * @return 图表数据对象
    */
   @Override
-  public List<ChartVO> getChartInMap(String date) {
+  public List<ChartVO> getChartInMap() {
 
     List<ChartVO> chartList = new ArrayList<>();
 
@@ -103,8 +110,8 @@ public class ChartServiceImpl implements IChartService {
     xAxis.add("变电");
     xAxis.add("电力");
 
-    List<DlycDTO> bdycList = bdycMapper.totalByDay(date);
-    List<DlycDTO> dlycList = dlycMapper.totalByDay(date);
+    List<DlycDTO> bdycList = bdycMapper.totalByDay();
+    List<DlycDTO> dlycList = dlycMapper.totalByDay();
     Map<String, DlycDTO> bdycMap = bdycList.stream()
         .collect(Collectors.toMap(DlycDTO::getGq, v -> v, (p1, p2) -> p1));
     Map<String, DlycDTO> dlycMap = dlycList.stream()
@@ -228,7 +235,7 @@ public class ChartServiceImpl implements IChartService {
   public ChartVO getChartJxdxqkby() {
     String[] xAxis = new String[]{"检修本月兑现情况"};
     String name = "检修本月兑现情况";
-    int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
+    int month = LocalDate.now().getMonthValue();
     return getChartJxdxqk(xAxis, name, String.valueOf(month));
   }
 
@@ -461,8 +468,13 @@ public class ChartServiceImpl implements IChartService {
    * @return 图表数据对象
    */
   @Override
-  public ChartVO getChartQbdlsbxjdx() {
-    int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
+  public ChartVO getChartQbdlsbxjdx(String date) {
+    int month;
+    if(StringUtils.isEmpty(date)) {
+      month = LocalDate.now().getMonthValue();
+    } else {
+      month = LocalDateUtil.parseLocalDate(date).getMonthValue();
+    }
     List<SbxjVO> sbxjList = sbxjMapper.getTotal(month);
     int jh1 = 0, jh2 = 0, jh3 = 0, jh4 = 0, jh5 = 0;
     int wc1 = 0, wc2 = 0, wc3 = 0, wc4 = 0, wc5 = 0;

+ 5 - 1
railway-business/src/main/java/com/railway/business/bi/service/impl/ShowFileServiceImpl.java

@@ -47,10 +47,13 @@ import org.springframework.web.multipart.MultipartFile;
 public class ShowFileServiceImpl implements IShowFileService {
 
   private final ShowFileMapper showFileMapper;
+  private final ShowBdycMapper bdycMapper;
   private final MybatisBatchUtils batchUtils;
 
-  public ShowFileServiceImpl(ShowFileMapper showFileMapper, MybatisBatchUtils batchUtils) {
+  public ShowFileServiceImpl(ShowFileMapper showFileMapper, ShowBdycMapper bdycMapper,
+      MybatisBatchUtils batchUtils) {
     this.showFileMapper = showFileMapper;
+    this.bdycMapper = bdycMapper;
     this.batchUtils = batchUtils;
   }
 
@@ -273,6 +276,7 @@ public class ShowFileServiceImpl implements IShowFileService {
           bdList.removeIf(bdyc -> null == bdyc.getFoundDate());
           bdList.forEach(bdyc -> bdyc.setFoundMode(foundMode1));
           batchUtils.batchInsert(bdList, ShowBdycMapper.class, ShowBdycMapper::insert);
+          bdycMapper.updateSjgq(fileId);
           break;
         case YCT3:
         case YCT4:

+ 7 - 1
railway-business/src/main/resources/mapper/bi/ShowBdycMapper.xml

@@ -213,6 +213,13 @@
     WHERE id = #{id}
   </update>
 
+  <update id="updateSjgq">
+    UPDATE show_bdyc set sjgq =  zrbm
+    WHERE file_id = #{fileId}
+      and (sjgq = '' or sjgq is null)
+      and zrbm in ('变配电修试队', '电力维修队')
+  </update>
+
 
   <select id="getInfo" resultMap="BaseResultMap">
     SELECT
@@ -276,7 +283,6 @@
                  case when qxdj = '三级' then 1 else 0 end as sj
           from show_bdyc
           where del_flag = '0'
-            <!-- and found_date = #{date} -->
             and rectify_result='未处理'
             and file_id =
                 (select max(id) from show_file where data_type = 'yctj' and imp_result = '1')

+ 0 - 1
railway-business/src/main/resources/mapper/bi/ShowDlycMapper.xml

@@ -264,7 +264,6 @@
                  case when gravity = '三级' then 1 else 0 end as sj
           from show_dlyc
           where del_flag = '0'
-            <!-- and found_date = #{date} -->
             and rectify_result='未处理'
             and file_id =
                 (select max(id) from show_file where data_type = 'yctj' and imp_result = '1')

+ 11 - 0
railway-common/src/main/java/com/railway/common/core/redis/RedisCache.java

@@ -36,6 +36,17 @@ public class RedisCache {
     redisTemplate.opsForValue().set(key, value);
   }
 
+  /**
+   * 缓存基本的对象,Integer、String、实体类等
+   *
+   * @param key 缓存的键值
+   * @param value 缓存的值
+   * @param timeout 时间(秒)
+   */
+  public <T> void setCacheObject(final String key, final T value, final Integer timeout) {
+    redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS);
+  }
+
   /**
    * 缓存基本的对象,Integer、String、实体类等
    *