Commit 2e469a06 authored by zhangsen's avatar zhangsen

API

parent 5f37cd0c
......@@ -210,7 +210,7 @@
<select id="getPersonYardByPage" resultType="java.util.Map">
SELECT
ifnull(b.name, '') as personName ,
ifnull(b.name, '') as objectName ,
ifnull(a.qrcode_color, '') AS qrCodeColor,
ifnull(c.station_name, '') AS stationName
FROM
......
......@@ -2,13 +2,16 @@ 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.Enum.QrcodeColorEnum;
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.mapper2.SjglZsjZsbtzMapper;
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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -20,6 +23,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -40,16 +44,34 @@ public class PersonQrCodeController extends BaseController {
@Autowired
private StationQrCodeStatisticsMapper stationQrCodeStatisticsMapper;
@Autowired
private SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
/**
* 评估大屏 - 人员赋码环形图查询
*
* @param parentCode 父级code
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@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);
public ResponseModel<List<Map<String, Object>>> getPersonYardStatistics(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "dataType") String dataType) {
List<Map<String, Object>> resultList = new ArrayList<>();
if (StringUtils.isNotEmpty(dataType) && dataType.equals("person")) {
resultList = personBasicMapper.getPersonYardStatistics(parentCode);
} else if (StringUtils.isNotEmpty(dataType) && dataType.equals("equip")) {
resultList = sjglZsjZsbtzMapper.getEquipYardStatistics(parentCode);
} else if (StringUtils.isNotEmpty(dataType) && dataType.equals("job")) {
resultList = sjglZsjZsbtzMapper.getJobYardStatistics(parentCode);
}
resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
item.put("value", Integer.parseInt(item.get("value").toString()));
});
return ResponseHelper.buildResponse(resultList);
}
......@@ -58,13 +80,40 @@ public class PersonQrCodeController extends BaseController {
*
* @param parentCode 父级code
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@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);
@RequestParam(value = "size") Integer size,
@RequestParam(required = false, value = "dataType") String dataType) {
Page<Map<String, Object>> resultList = new Page<>();
if ("person".equals(dataType)) {
resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size);
} else if ("equip".equals(dataType)) {
List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode);
Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode);
equipYardByPage.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
});
resultList.setRecords(equipYardByPage);
resultList.setCurrent(current);
resultList.setSize(size);
resultList.setTotal(equipYardByPageCount);
} else if ("job".equals(dataType)) {
List<Map<String, Object>> jobYardByPage = sjglZsjZsbtzMapper.getJobYardByPage((current - 1) * size, size, parentCode);
Integer jobYardByPageCount = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode);
jobYardByPage.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
});
resultList.setRecords(jobYardByPage);
resultList.setCurrent(current);
resultList.setSize(size);
resultList.setTotal(jobYardByPageCount);
}
return ResponseHelper.buildResponse(resultList);
}
......@@ -73,10 +122,11 @@ public class PersonQrCodeController extends BaseController {
*
* @param parentCode 父级code
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getQrCodeCount")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 人员赋码数量等统计", notes = "评估大屏 - 人员赋码数量等统计")
public ResponseModel<Map<String, Object>> getQrCodeCount(@RequestParam(required = false, value = "parentCode") String parentCode) {
public ResponseModel<Map<String, Object>> getQrCodeCount(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "dataType") String dataType) {
FeignClientResult<Map<String, Object>> sevenEntity = null;
try {
......@@ -107,7 +157,7 @@ public class PersonQrCodeController extends BaseController {
* @param parentCode 父级code
* @param dataType 类型 - 人员、任务、设备等
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getQrCodeCountByStation")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 场站 人员赋码数量等统计 【折线图】", notes = "评估大屏 - 场站 人员赋码数量等统计 【折线图】")
public ResponseModel<List<Map<String, Object>>> getQrCodeCountByStation(@RequestParam(required = false, value = "parentCode") String parentCode,
......
......@@ -4,6 +4,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
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 org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -37,4 +38,41 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> {
* 任务赋码数据
*/
List<StationQrCodeStatistics> getTaskQrcodeInfo();
/**
* 设备赋码数据
*/
List<Map<String, Object>> getEquipYardStatistics(@Param("parentCode") String parentCode);
/**
* 任务赋码数据
*/
List<Map<String, Object>> getJobYardStatistics(@Param("parentCode") String parentCode);
/**
* 设备赋码列表
*/
List<Map<String, Object>> getEquipYardByPage(@Param("current") Integer current,
@Param("size") Integer size,
@Param("parentCode") String parentCode);
/**
* 设备赋码列表
*/
Integer getEquipYardByPageCount(@Param("parentCode") String parentCode);
/**
* 任务赋码列表
*/
List<Map<String, Object>> getJobYardByPage(@Param("current") Integer current,
@Param("size") Integer size,
@Param("parentCode") String parentCode);
/**
* 任务赋码列表数量统计
*/
Integer getJobYardByPageCount(@Param("parentCode") String parentCode);
}
......@@ -64,4 +64,96 @@
GROUP BY
WERKS
</select>
<select id="getEquipYardStatistics" resultType="java.util.Map">
SELECT
a.QRCODE_COLOR as qrCodeColor,
count( 1 ) as value
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b on a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
GROUP BY
QRCODE_COLOR
</select>
<select id="getJobYardStatistics" resultType="java.util.Map">
SELECT
a.QRCODE_COLOR as qrCodeColor,
count( 1 ) as value
FROM
fdgl_job_main a
LEFT JOIN privilege_company b on a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
GROUP BY
QRCODE_COLOR
</select>
<select id="getEquipYardByPage" resultType="java.util.Map">
SELECT
ifnull(a.SBMC, '') as objectName ,
ifnull(a.QRCODE_COLOR, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
ORDER BY a.CREATE_TIME DESC
limit #{current},#{size}
</select>
<select id="getEquipYardByPageCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
</select>
<select id="getJobYardByPage" resultType="java.util.Map">
SELECT
ifnull(a.JOB_DESCRIPTION, '') as objectName ,
ifnull(a.qrcode_color, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName
FROM
fdgl_job_main a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
ORDER BY a.CREATE_TIME DESC
limit #{current},#{size}
</select>
<select id="getJobYardByPageCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
fdgl_job_main a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
AND b.COMPANY_CODE like concat(#{parentCode},'%')
</if>
</where>
</select>
</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