Commit c87f5901 authored by zhangsen's avatar zhangsen

赋码等业务开发

parent 7bae3e9d
...@@ -64,4 +64,9 @@ public interface StationBasicMapper extends BaseMapper<StationBasic> { ...@@ -64,4 +64,9 @@ public interface StationBasicMapper extends BaseMapper<StationBasic> {
*/ */
int updateYardByProjectOrgCode(@Param("list") List<Map<String,String>> analysisResult); int updateYardByProjectOrgCode(@Param("list") List<Map<String,String>> analysisResult);
/**
* 查询所有场站信息
*/
List<StationBasicDto> getStationBasicListAll();
} }
...@@ -179,4 +179,12 @@ ...@@ -179,4 +179,12 @@
project_org_code = #{item.code} project_org_code = #{item.code}
</foreach> </foreach>
</update> </update>
<select id="getStationBasicListAll" resultType="com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto">
SELECT
station_number stationNumber,
project_org_code AS projectOrgCode
FROM
station_basic
</select>
</mapper> </mapper>
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jxiop-biz</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.influxdb</groupId> <groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId> <artifactId>influxdb-java</artifactId>
</dependency> </dependency>
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.api.feign.McbWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationQrCodeStatisticsMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PersonBasicServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "人员人员赋码基本信息 评估大屏Api")
@RequestMapping(value = "/person-qrcode")
public class PersonQrCodeController extends BaseController {
@Autowired
PersonBasicServiceImpl personBasicServiceImpl;
@Autowired
McbWarningFeign mcbWarningFeign;
@Autowired
PersonBasicMapper personBasicMapper;
@Autowired
private StationQrCodeStatisticsMapper stationQrCodeStatisticsMapper;
/**
* 评估大屏 - 人员赋码环形图查询
*
* @param parentCode 父级code
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPersonYardStatistics")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码环形图查询", notes = "评估大屏 - 人员赋码环形图查询")
public ResponseModel<List<Map<String, Object>>> getPersonYardStatistics(@RequestParam(required = false, value = "parentCode") String parentCode) {
List<Map<String, Object>> resultList = personBasicServiceImpl.getPersonYardStatistics(parentCode);
return ResponseHelper.buildResponse(resultList);
}
/**
* 评估大屏 - 人员赋码列表查询
*
* @param parentCode 父级code
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getPersonYardByPage")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码列表查询", notes = "评估大屏 - 人员赋码列表查询")
public ResponseModel<Page<Map<String, Object>>> getPersonYardByPage(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size) {
Page<Map<String, Object>> resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size);
return ResponseHelper.buildResponse(resultList);
}
/**
* 评估大屏 - 人员赋码数量等统计
*
* @param parentCode 父级code
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getQrCodeCount")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码数量等统计", notes = "评估大屏 - 人员赋码数量等统计")
public ResponseModel<Map<String, Object>> getQrCodeCount(@RequestParam(required = false, value = "parentCode") String parentCode) {
FeignClientResult<Map<String, Object>> sevenEntity = null;
try {
sevenEntity = mcbWarningFeign.getQrCodeCount(parentCode, "RYFM");
} catch (Exception e) {
e.printStackTrace();
}
if (sevenEntity != null && 200 == sevenEntity.getStatus()) {
Map<String, Object> result = sevenEntity.getResult();
String red = result.get("red").toString();
String yellow = result.get("yellow").toString();
String redToGreen = result.get("redToGreen").toString();
String yellowToGreen = result.get("yellowToGreen").toString();
Integer countAll = personBasicMapper.getPersonYardByPageCount(parentCode);
result.put("redToGreenPercent", getPercent(new BigDecimal(red), new BigDecimal(countAll)));
result.put("redPercent", getPercent(new BigDecimal(redToGreen), new BigDecimal(countAll)));
result.put("yellowToGreenPercent", getPercent(new BigDecimal(yellow), new BigDecimal(countAll)));
result.put("yellowPercent", getPercent(new BigDecimal(yellowToGreen), new BigDecimal(countAll)));
return ResponseHelper.buildResponse(result);
}
return ResponseHelper.buildResponse(null);
}
/**
* 评估大屏 - 场站 人员赋码数量等统计 【折线图】
*
* @param parentCode 父级code
* @param dataType 类型 - 人员、任务、设备等
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getQrCodeCountByStation")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 场站 人员赋码数量等统计 【折线图】", notes = "评估大屏 - 场站 人员赋码数量等统计 【折线图】")
public ResponseModel<List<Map<String, Object>>> getQrCodeCountByStation(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "dataType") String dataType) {
List<Map<String, Object>> qrCodeCountByStation = stationQrCodeStatisticsMapper.getQrCodeCountByStation(parentCode, dataType);
return ResponseHelper.buildResponse(qrCodeCountByStation);
}
/**
* 百分比
*
* @param numerator 分子
* @param denominator 分母
* @return 百分比
*/
private double getPercent(BigDecimal numerator, BigDecimal denominator) {
BigDecimal multiply = numerator.divide(denominator.compareTo(BigDecimal.ZERO) != 0 ? denominator : new BigDecimal(1), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
return Math.abs(multiply.doubleValue());
}
}
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz; import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import java.util.List; import java.util.List;
...@@ -26,4 +27,14 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> { ...@@ -26,4 +27,14 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> {
List<Map<String,Object>> getStationInfoMapByStationWerks(String WERKS, String DATAID); List<Map<String,Object>> getStationInfoMapByStationWerks(String WERKS, String DATAID);
List<Map<String,Object>> getStationInfoMapByStationGFWerks(String WERKS,String DATAID); List<Map<String,Object>> getStationInfoMapByStationGFWerks(String WERKS,String DATAID);
/**
* 设备赋码数据
*/
List<StationQrCodeStatistics> getEquipQrcodeInfo();
/**
* 任务赋码数据
*/
List<StationQrCodeStatistics> getTaskQrcodeInfo();
} }
...@@ -67,7 +67,8 @@ public class PersonYardTimeTask { ...@@ -67,7 +67,8 @@ public class PersonYardTimeTask {
@Scheduled(cron = "0 0 0 1/1 * ? ") // @Scheduled(cron = "0 0 0 1/1 * ? ")
// 已迁移至大屏服务
public void timeYardTimeTask() { public void timeYardTimeTask() {
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) { if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
personBasicService.addRedisPostAndCerInfo(); personBasicService.addRedisPostAndCerInfo();
...@@ -169,7 +170,8 @@ public class PersonYardTimeTask { ...@@ -169,7 +170,8 @@ public class PersonYardTimeTask {
// @Scheduled(cron = "0 55 23 1/1 * ? ") // @Scheduled(cron = "0 55 23 1/1 * ? ")
@Scheduled(cron = "0 0/30 * * * ? ") // @Scheduled(cron = "0 0/30 * * * ? ")
// 已迁移至大屏服务
public void stationQrCodeStatisticsData() { public void stationQrCodeStatisticsData() {
LambdaQueryWrapper<StationQrCodeStatistics> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationQrCodeStatistics> qw = new LambdaQueryWrapper<>();
qw.eq(StationQrCodeStatistics::getRecordDate, DateUtils.getDateNowShortStr()); qw.eq(StationQrCodeStatistics::getRecordDate, DateUtils.getDateNowShortStr());
......
...@@ -37,4 +37,31 @@ ...@@ -37,4 +37,31 @@
B.FSB B.FSB
</select> </select>
<select id="getEquipQrcodeInfo" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics">
SELECT
WERKS AS `code`,
count( QRCODE_COLOR = 'red' OR NULL ) AS redNum,
count( QRCODE_COLOR = 'yellow' OR NULL ) AS yellowNum,
count( QRCODE_COLOR = 'green' OR NULL ) AS greenNum,
'equip' AS type,
CURRENT_DATE AS recordDate
FROM
sjgl_zsj_zsbtz
GROUP BY
WERKS
</select>
<select id="getTaskQrcodeInfo" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.StationQrCodeStatistics">
SELECT
WERKS AS `code`,
count( QRCODE_COLOR = 'red' OR NULL ) AS redNum,
count( QRCODE_COLOR = 'yellow' OR NULL ) AS yellowNum,
count( QRCODE_COLOR = 'green' OR NULL ) AS greenNum,
'job' AS type,
CURRENT_DATE AS recordDate
FROM
fdgl_job_main
GROUP BY
WERKS
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment