src/main/java/com/yssh/controller/SuYuanController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/yssh/dao/SuYuanMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/yssh/service/IDictRecordService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/yssh/service/ISuYuanService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/yssh/service/impl/DictRecordServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/yssh/service/impl/SuYuanServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapping/SuYuanMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/yssh/controller/SuYuanController.java
@@ -33,7 +33,7 @@ @RequestMapping("/suYuan") @SuppressWarnings("rawtypes") public class SuYuanController { @Autowired private ISuYuanService suYuanService; @@ -41,66 +41,76 @@ @ApiOperationSupport(order = 1) @GetMapping("/get2d") public Result get2d( @RequestParam(value = "date", required = true)@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date){ List<SuYuan2d> list = suYuanService.selectSuYuan2d(date); return Result.OK(list); @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { List<SuYuan2d> list = suYuanService.selectSuYuan2d(date); return Result.OK(list); } @ApiOperation(value = "查询3d热力图数据", notes = "根据时间查询3d热力图数据") @ApiOperationSupport(order = 2) @GetMapping("/get3d") public Result get3d( @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date){ List<SuYuan3d> list = suYuanService.selectSuYuan3d(name, date); return Result.OK(list); @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { List<SuYuan3d> list = suYuanService.selectSuYuan3d(name, date); return Result.OK(list); } @ApiOperation(value = "查询溯源100热力图数据", notes = "根据时间查询溯源100热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递") @ApiOperationSupport(order = 3) @GetMapping("/get100") public Result get100( @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ){ return Result.OK(suYuanService.selectSuYuan100(name, date)); @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ) { return Result.OK(suYuanService.selectSuYuan100(name, date)); } @ApiOperation(value = "查询溯源200热力图数据", notes = "根据时间查询溯源200热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递") @ApiOperationSupport(order = 4) @GetMapping("/get200") public Result get200( @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ){ return Result.OK(suYuanService.selectSuYuan200(name, date)); @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ) { return Result.OK(suYuanService.selectSuYuan200(name, date)); } @ApiOperation(value = "查询溯源300热力图数据", notes = "根据时间查询溯源300热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递") @ApiOperationSupport(order = 5) @GetMapping("/get300") public Result get300( @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ){ return Result.OK(suYuanService.selectSuYuan300(name, date)); @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ) { return Result.OK(suYuanService.selectSuYuan300(name, date)); } @ApiOperation(value = "查询溯源500热力图数据", notes = "根据时间查询溯源500热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递") @ApiOperationSupport(order = 6) @GetMapping("/get500") public Result get500( @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ){ return Result.OK(suYuanService.selectSuYuan500(name, date)); @RequestParam(value = "name", required = true) String name, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date ) { return Result.OK(suYuanService.selectSuYuan500(name, date)); } @ApiOperation(value = "获取所有监测数据", notes = "获取所有监测数据") @ApiOperationSupport(order = 7) @GetMapping("/query/{name}") public Result getMonitorData(@PathVariable("name") String name){ List<SuYuanMonitorData> list = suYuanService.getMonitorData(name); return Result.OK(list); public Result getMonitorData(@PathVariable("name") String name) { List<SuYuanMonitorData> list = suYuanService.getMonitorData(name); return Result.OK(list); } @ApiOperation(value = "更新Vocs名称", notes = "更新Vocs名称") @ApiOperationSupport(order = 7) @GetMapping("/updateVocsName") public Result updateVocsName(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date, @RequestParam(value = "id", required = true) String id, @RequestParam(value = "vocsName", required = true) String vocsName ) { return Result.OK(suYuanService.updateVocsName(date, id, vocsName)); } } src/main/java/com/yssh/dao/SuYuanMapper.java
@@ -1,5 +1,6 @@ package com.yssh.dao; import java.util.Date; import java.util.List; import java.util.Map; @@ -36,4 +37,6 @@ //获取本月指定监测站点监测值对大的数据 Map<String, Object> getMonthValueDataMax(@Param("tableNames") List<String> tableNames, @Param("id") String id); int updateVocsName(String table, String id, String vocsName); } src/main/java/com/yssh/service/IDictRecordService.java
@@ -2,6 +2,7 @@ import com.yssh.entity.DictRecord; import java.util.Date; import java.util.List; /** @@ -45,5 +46,4 @@ * 创建字典记录信息表 */ int createDictRecoTable(); } src/main/java/com/yssh/service/ISuYuanService.java
@@ -14,22 +14,24 @@ public Integer isTableExists(String tableName); public void insertSuYuanDatas(List<SuYuan> lists, String time) throws Exception; int createNewTable(String tableName); public List<SuYuan2d> selectSuYuan2d(Date date); public List<SuYuan3d> selectSuYuan3d(String name, Date date); public Map<String, Object> selectSuYuan100(String name, Date date); public Map<String, Object> selectSuYuan200(String name, Date date); public Map<String, Object> selectSuYuan300(String name, Date date); public Map<String, Object> selectSuYuan500(String name, Date date); public List<SuYuanMonitorData> getMonitorData(String name); //public List<Temporary> temporary(String name, Date date); public int updateVocsName(Date date, String id, String vocsName); } src/main/java/com/yssh/service/impl/DictRecordServiceImpl.java
@@ -1,5 +1,6 @@ package com.yssh.service.impl; import java.util.Date; import java.util.List; import lombok.Synchronized; @@ -25,6 +26,7 @@ /** * 查询字典记录列表 * * @param dictRecord 字典记录 * @return 字典记录 */ @@ -35,6 +37,7 @@ /** * 新增字典记录 * * @param dictRecord 字典记录 * @return 结果 */ @@ -45,6 +48,7 @@ /** * 删除字典记录对象 * * @param ids 需要删除的数据ID * @return 结果 */ @@ -56,6 +60,7 @@ /** * 删除字典记录信息 * * @param id 字典记录ID * @return 结果 */ @@ -73,5 +78,4 @@ public int createDictRecoTable() { return dictRecordMapper.createDictRecoTable(); } } src/main/java/com/yssh/service/impl/SuYuanServiceImpl.java
@@ -1,5 +1,6 @@ package com.yssh.service.impl; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -39,38 +40,40 @@ public class SuYuanServiceImpl implements ISuYuanService { protected final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private SuYuanMapper suYuanMapper; @Autowired private IAsyncService asyncService; private IAsyncService asyncService; @Autowired private DictRecordMapper dictRecordMapper; @Autowired private ICommonService commonService; @Autowired private FeedbackMapper feedbackMapper; private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH"); //@Transactional @Override @Async("threadPoolTaskExecutor") public void insertSuYuanDatas(List<SuYuan> lists, String time) throws Exception{ public void insertSuYuanDatas(List<SuYuan> lists, String time) throws Exception { //插入数据 List<List<SuYuan>> list = Lists.partition(lists, IAsyncService.BATCH_INSERT_NUMBER); CountDownLatch countDownLatch = new CountDownLatch(list.size()); for (List<SuYuan> corpReserveList : list) { asyncService.executeAsync(TableStrategy.getTableStrategy(time), corpReserveList, suYuanMapper, countDownLatch); } countDownLatch.await(); countDownLatch.await(); logger.info(lists.size() + "条数据入库完成-----"); } @Override public Integer isTableExists(String tableName){ public Integer isTableExists(String tableName) { return suYuanMapper.isTableExists(tableName); } @@ -122,11 +125,15 @@ } List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s->{s.setName(checkPoint.getName());i.getAndIncrement();s.setVocsName(checkPoint.getName()+ "-" + i.longValue());}); list.stream().forEach(s -> { s.setName(checkPoint.getName()); i.getAndIncrement(); s.setVocsName(checkPoint.getName() + "-" + i.longValue()); }); if (StringUtils.isNotEmpty(list)) { Collections.sort(list); DistanceSuYuan max = list.get(0); FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate()); feedbackMapper.insert(feedbackDetail); result.put("feedbackId", feedbackDetail.getId()); @@ -151,11 +158,15 @@ } List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s->{s.setName(checkPoint.getName());i.getAndIncrement();s.setVocsName(checkPoint.getName()+ "-" + i.longValue());}); list.stream().forEach(s -> { s.setName(checkPoint.getName()); i.getAndIncrement(); s.setVocsName(checkPoint.getName() + "-" + i.longValue()); }); if (StringUtils.isNotEmpty(list)) { Collections.sort(list); DistanceSuYuan max = list.get(0); FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate()); feedbackMapper.insert(feedbackDetail); result.put("feedbackId", feedbackDetail.getId()); @@ -163,7 +174,7 @@ result.put("data", list); return result; } @Override public Map<String, Object> selectSuYuan300(String name, Date date) { Map<String, Object> result = new HashMap<String, Object>(); @@ -180,11 +191,15 @@ } List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s->{s.setName(checkPoint.getName());i.getAndIncrement();s.setVocsName(checkPoint.getName()+ "-" + i.longValue());}); list.stream().forEach(s -> { s.setName(checkPoint.getName()); i.getAndIncrement(); s.setVocsName(checkPoint.getName() + "-" + i.longValue()); }); if (StringUtils.isNotEmpty(list)) { Collections.sort(list); DistanceSuYuan max = list.get(0); FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate()); feedbackMapper.insert(feedbackDetail); result.put("feedbackId", feedbackDetail.getId()); @@ -192,7 +207,7 @@ result.put("data", list); return result; } @Override public Map<String, Object> selectSuYuan500(String name, Date date) { Map<String, Object> result = new HashMap<String, Object>(); @@ -209,11 +224,15 @@ } List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d); AtomicInteger i = new AtomicInteger(0); list.stream().forEach(s->{s.setName(checkPoint.getName());i.getAndIncrement();s.setVocsName(checkPoint.getName()+ "-" + i.longValue());}); list.stream().forEach(s -> { s.setName(checkPoint.getName()); i.getAndIncrement(); s.setVocsName(checkPoint.getName() + "-" + i.longValue()); }); if (StringUtils.isNotEmpty(list)) { Collections.sort(list); DistanceSuYuan max = list.get(0); FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(), max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate()); feedbackMapper.insert(feedbackDetail); result.put("feedbackId", feedbackDetail.getId()); @@ -230,8 +249,19 @@ } List<DictRecord> recordList = dictRecordMapper.selectDictRecordList(new DictRecord()); List<String> tableNames = new ArrayList<String>(); recordList.stream().forEach(s -> {tableNames.add(s.getTableName());}); recordList.stream().forEach(s -> { tableNames.add(s.getTableName()); }); return suYuanMapper.getMonitorData(tableNames, checkPoint.getX() + "_" + checkPoint.getY() + "_" + checkPoint.getZ()); } @Override public int updateVocsName(Date date, String id, String vocsName) { String table = "su_yuan_" + dateFormat.format(new Date()); if (isTableExists(table) == 0) { return 0; } return suYuanMapper.updateVocsName(table, id, vocsName); } } src/main/resources/mapping/SuYuanMapper.xml
@@ -191,4 +191,8 @@ <update id="update" > UPDATE ${tableName} SET c = #{value} WHERE id = #{id} </update> <update id="updateVocsName"> update ${table} set vocsName = #{vocsName} where id = #{id}; </update> </mapper>