Commit 387fa00f authored by 李秀明's avatar 李秀明

消防员出勤接口

parent f632bbad
...@@ -30,5 +30,23 @@ public interface SignMapper extends BaseMapper<Sign> { ...@@ -30,5 +30,23 @@ public interface SignMapper extends BaseMapper<Sign> {
int queryPersonNum(String bizOgrCode); int queryPersonNum(String bizOgrCode);
// Map<String, Object> getSignStatistic(@Param("bizOrgCode") String bizOgrCode, @Param("userId") String userId); List<Map<String, Object>> selectCenterSignStats(
@Param("bizOrgCode") String bizOrgCode,
@Param("date") String date,
@Param("targetPassNum") Integer targetPassNum,
@Param("stationType") String stationType
);
List<Map<String, Object>> selectStationSignStats(@Param("bizOrgCode") String bizOrgCode);
IPage<Map<String, Object>> selectStationAttendanceStatsPage(
@Param("page") IPage<?> page,
@Param("date") String date,
@Param("stationType") String stationType,
@Param("bizOrgCode") String bizOrgCode,
@Param("attendanceStatus") String attendanceStatus,
@Param("targetPassNum") Integer targetPassNum,
@Param("sortField") String sortField,
@Param("sortOrder") String sortOrder
);
} }
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
public interface StationInfoMapper extends BaseMapper {
Long count(@Param("stationType") String stationType);
}
...@@ -148,7 +148,93 @@ ...@@ -148,7 +148,93 @@
GROUP BY biz_org_code GROUP BY biz_org_code
</select> </select>
<!-- <select id="getSignStatistic" resultType="Map">--> <select id="selectCenterSignStats" resultType="Map">
SELECT
t.BIZ_ORG_CODE AS bizOrgCode,
t.BIZ_ORG_NAME AS bizOrgName,
COUNT(DISTINCT t.user_id) AS num,
IF(COUNT(DISTINCT t.user_id) >= #{targetPassNum}, 'pass', 'fail') AS status
FROM
cb_sign t
RIGHT JOIN idx_biz_station_info s ON s.biz_ORG_CODE = t.biz_ORG_CODE
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="date != null and date != ''">
AND t.DATE = #{date}
</if>
<if test="stationType != null and stationType != ''">
AND s.STATION_TYPE = #{stationType}
</if>
</where>
GROUP BY
t.BIZ_ORG_CODE
</select>
<select id="selectStationSignStats" resultType="Map">
SELECT
t.DATE AS date,
IFNULL(COUNT(DISTINCT t.user_id), 0) AS num
FROM
cb_sign t
WHERE
t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
AND t.DATE &gt;= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
GROUP BY
t.DATE
</select>
<!-- </select>--> <select id="selectStationAttendanceStatsPage" resultType="Map">
SELECT
t2.BIZ_ORG_CODE AS bizOrgCode,
t2.NAME AS bizOrgName,
CONCAT(t2.STATION_TYPE, '换流站') AS stationType,
#{date} AS date,
IFNULL(t1.num, 0) AS signNum,
(SELECT COUNT(1) FROM cb_firefighters t WHERE t.BIZ_ORG_CODE LIKE CONCAT(t2.BIZ_ORG_CODE, '%') AND t.PEOPLE_TYPE = 1601 AND t.IS_DELETE = false) AS firefighterNum,
ROUND(ROUND(IFNULL(t1.num, 0) / (SELECT COUNT(1) FROM cb_firefighters t WHERE t.BIZ_ORG_CODE LIKE CONCAT(t2.BIZ_ORG_CODE, '%') AND t.PEOPLE_TYPE = 1601 AND t.IS_DELETE = false), 4) * 100, 2) AS attendanceRate,
IF(IFNULL(t1.num, 0) >= #{targetPassNum}, '合格', '不合格') AS attendanceStatus
FROM (
SELECT
t.BIZ_ORG_CODE AS bizOrgCode,
COUNT( DISTINCT t.user_id ) AS num
FROM
cb_sign t
<where>
t.DATE = #{date}
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
t.BIZ_ORG_CODE
) t1
RIGHT JOIN idx_biz_station_info t2 ON t2.BIZ_ORG_CODE = t1.bizOrgCode
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t2.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="stationType != null and stationType != ''">
AND t2.STATION_TYPE = #{stationType}
</if>
<if test="attendanceStatus != null and attendanceStatus != ''">
AND IF(IFNULL(t1.num, 0) >= #{targetPassNum}, 'pass', 'fail') = #{attendanceStatus}
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != ''">
<choose>
<when test="sortOrder == 'ascend'">
${sortField} ASC
</when>
<otherwise>
${sortField} DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
signNum DESC
</if>
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.StationInfoMapper">
<select id="count" resultType="long">
SELECT
COUNT(1)
FROM idx_biz_station_info t
<where>
<if test="stationType != null and stationType != ''">
AND t.STATION_TYPE = #{stationType}
</if>
</where>
</select>
</mapper>
...@@ -3,42 +3,39 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -3,42 +3,39 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Sign; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.SignServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.ApiOperation;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
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 javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.SignServiceImpl;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/** /**
* 打卡记录 * 打卡记录
* *
...@@ -53,11 +50,11 @@ public class SignController extends BaseController { ...@@ -53,11 +50,11 @@ public class SignController extends BaseController {
@Autowired @Autowired
SignServiceImpl signServiceImpl; SignServiceImpl signServiceImpl;
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
/** /**
* 新增打卡记录 * 新增打卡记录
...@@ -65,28 +62,28 @@ public class SignController extends BaseController { ...@@ -65,28 +62,28 @@ public class SignController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增打卡记录", notes = "新增打卡记录") @ApiOperation(httpMethod = "POST", value = "新增打卡记录", notes = "新增打卡记录")
public ResponseModel<SignDto> save(@RequestBody SignDto model) { public ResponseModel<SignDto> save(@RequestBody SignDto model) {
model = signServiceImpl.createWithModel(model); model = signServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新打卡记录", notes = "根据sequenceNbr更新打卡记录") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新打卡记录", notes = "根据sequenceNbr更新打卡记录")
public ResponseModel<SignDto> updateBySequenceNbrSign(@RequestBody SignDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<SignDto> updateBySequenceNbrSign(@RequestBody SignDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(signServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(signServiceImpl.updateWithModel(model));
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
...@@ -95,7 +92,7 @@ public class SignController extends BaseController { ...@@ -95,7 +92,7 @@ public class SignController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除打卡记录", notes = "根据sequenceNbr删除打卡记录") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除打卡记录", notes = "根据sequenceNbr删除打卡记录")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(signServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(signServiceImpl.removeById(sequenceNbr));
} }
...@@ -103,149 +100,191 @@ public class SignController extends BaseController { ...@@ -103,149 +100,191 @@ public class SignController extends BaseController {
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个打卡记录", notes = "根据sequenceNbr查询单个打卡记录")
public ResponseModel<SignDto> selectOne(@PathVariable Long sequenceNbr) {
SignDto signDto = signServiceImpl.queryBySeq(sequenceNbr);
QueryWrapper<OrgUsr> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("sequence_nbr", signDto.getSignUserId());
queryWrapper.eq("is_delete", 0);
OrgUsr orgUsr = iOrgUsrService.getOne(queryWrapper);
try {
OrgPersonFormDto orgPersonFormDto = iOrgUsrService.selectPersonById(orgUsr.getSequenceNbr());
List<FormValue> personImg = orgPersonFormDto.getDynamicFormAlert().stream().filter(e -> e.getKey().equals("personImg")).collect(Collectors.toList());
signDto.setPersonPhotos(personImg.get(0).getValue());
} catch (Exception e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(signDto);
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST", value = "打卡记录分页查询", notes = "打卡记录分页查询")
public ResponseModel<IPage<SignDto>> queryForPage(@RequestBody SignDto dto) {
Page<SignDto> page = new Page<SignDto>();
page.setCurrent(dto.getCurrent());
page.setSize(dto.getSize());
IPage<SignDto> page1 = signServiceImpl.queryForSignPageByMapper(page, dto);
if (0 < page1.getRecords().size()) {
for (SignDto d : page1.getRecords()) {
QueryWrapper<OrgUsr> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("sequence_nbr", d.getSignUserId());
queryWrapper.eq("is_delete", 0);
OrgUsr orgUsr = iOrgUsrService.getOne(queryWrapper);
try {
OrgPersonFormDto orgPersonFormDto = iOrgUsrService.selectPersonById(orgUsr.getSequenceNbr());
List<FormValue> personImg = orgPersonFormDto.getDynamicFormAlert().stream().filter(e -> e.getKey().equals("personImg")).collect(Collectors.toList());
d.setPersonPhotos(personImg.get(0).getValue());
} catch (Exception e) {
e.printStackTrace();
}
}
}
return ResponseHelper.buildResponse(page1);
}
/**
* 人员信息卡统计打卡
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "人员信息卡统计打卡", notes = "人员信息卡统计打卡")
@GetMapping(value = "/statistic")
public ResponseModel<Map<String, Object>> getSignStatistic(@RequestParam(value = "userId", required = false) String userId,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
return ResponseHelper.buildResponse(signServiceImpl.getSignStatistic(userId, bizOrgCode));
}
/**
* 列表分页查询
*
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @PostMapping(value = "/static/page")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个打卡记录", notes = "根据sequenceNbr查询单个打卡记录") @ApiOperation(httpMethod = "POST", value = "打卡记录分页查询", notes = "打卡记录分页查询")
public ResponseModel<SignDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<IPage<SinStaticDto>> queryStaticForPage(@RequestBody SinStaticDto dto) {
SignDto signDto = signServiceImpl.queryBySeq(sequenceNbr); Page<SinStaticDto> page = new Page<>();
QueryWrapper<OrgUsr> queryWrapper = new QueryWrapper<>(); page.setCurrent(dto.getCurrent());
queryWrapper.eq("sequence_nbr",signDto.getSignUserId()); page.setSize(dto.getSize());
queryWrapper.eq("is_delete",0); return ResponseHelper.buildResponse(signServiceImpl.queryForSignStaticPageByMapper(page, dto));
OrgUsr orgUsr = iOrgUsrService.getOne(queryWrapper); }
try {
OrgPersonFormDto orgPersonFormDto = iOrgUsrService.selectPersonById(orgUsr.getSequenceNbr()); /**
List<FormValue> personImg = orgPersonFormDto.getDynamicFormAlert().stream().filter(e -> e.getKey().equals("personImg")).collect(Collectors.toList());
signDto.setPersonPhotos(personImg.get(0).getValue());
} catch (Exception e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(signDto);
}
/**
* 列表分页查询 * 列表分页查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page") @PostMapping(value = "/center/static/page")
@ApiOperation(httpMethod = "POST",value = "打卡记录分页查询", notes = "打卡记录分页查询") @ApiOperation(httpMethod = "POST", value = "中心级卡片驻站消防员出勤柱状图", notes = "中心级卡片驻站消防员出勤柱状图")
public ResponseModel<IPage<SignDto>> queryForPage(@RequestBody SignDto dto) { public ResponseModel<Map<String, Object>> queryPeopleInfoForPage(@RequestBody SinStaticDto dto) {
Page<SignDto> page = new Page<SignDto>(); String bizOrgCode = dto.getBizOrgCode();
page.setCurrent(dto.getCurrent()); if (StringUtils.isBlank(bizOrgCode)) {
page.setSize(dto.getSize()); ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
IPage<SignDto> page1 = signServiceImpl.queryForSignPageByMapper(page, dto); if (null != reginParam) {
if (0 < page1.getRecords().size()) { bizOrgCode = reginParam.getPersonIdentity().getCompanyBizOrgCode();
for(SignDto d : page1.getRecords()){ }
QueryWrapper<OrgUsr> queryWrapper = new QueryWrapper<>(); }
queryWrapper.eq("sequence_nbr",d.getSignUserId()); dto.setBizOrgCode(bizOrgCode);
queryWrapper.eq("is_delete",0); List<Map<String, Object>> res = signServiceImpl.queryPeopleInfo(dto);
OrgUsr orgUsr = iOrgUsrService.getOne(queryWrapper); Map<String, Object> map1 = new HashMap<>();
try { map1.put("bizOrgCode", bizOrgCode);
OrgPersonFormDto orgPersonFormDto = iOrgUsrService.selectPersonById(orgUsr.getSequenceNbr()); map1.put("xData", res.stream().map(x -> x.get("date")).collect(Collectors.toList()));
List<FormValue> personImg = orgPersonFormDto.getDynamicFormAlert().stream().filter(e -> e.getKey().equals("personImg")).collect(Collectors.toList()); map1.put("yData", res.stream().map(x -> x.get("signNum")).collect(Collectors.toList()));
d.setPersonPhotos(personImg.get(0).getValue()); return ResponseHelper.buildResponse(map1);
} catch (Exception e) { }
e.printStackTrace();
} /**
} * 列表全部数据查询
}
return ResponseHelper.buildResponse(page1);
}
/**
* 人员信息卡统计打卡
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "人员信息卡统计打卡", notes = "人员信息卡统计打卡")
@GetMapping(value = "/statistic")
public ResponseModel<Map<String, Object>> getSignStatistic(@RequestParam(value = "userId" , required = false) String userId,
@RequestParam(value = "bizOrgCode" , required = false) String bizOrgCode) {
return ResponseHelper.buildResponse(signServiceImpl.getSignStatistic(userId, bizOrgCode));
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/static/page")
@ApiOperation(httpMethod = "POST",value = "打卡记录分页查询", notes = "打卡记录分页查询")
public ResponseModel<IPage<SinStaticDto>> queryStaticForPage(@RequestBody SinStaticDto dto) {
Page<SinStaticDto> page = new Page<>();
page.setCurrent(dto.getCurrent());
page.setSize(dto.getSize());
return ResponseHelper.buildResponse(signServiceImpl.queryForSignStaticPageByMapper(page, dto));
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/center/static/page")
@ApiOperation(httpMethod = "POST",value = "中心级卡片驻站消防员出勤柱状图", notes = "中心级卡片驻站消防员出勤柱状图")
public ResponseModel<Map<String, Object>> queryPeopleInfoForPage(@RequestBody SinStaticDto dto) {
String bizOrgCode = dto.getBizOrgCode();
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if(null != reginParam) {
bizOrgCode = reginParam.getPersonIdentity().getCompanyBizOrgCode();
}
}
dto.setBizOrgCode(bizOrgCode);
List<Map<String, Object>> res = signServiceImpl.queryPeopleInfo(dto);
Map<String, Object> map1 = new HashMap<>();
map1.put("bizOrgCode", bizOrgCode);
map1.put("xData", res.stream().map(x -> x.get("date")).collect(Collectors.toList()));
map1.put("yData", res.stream().map(x -> x.get("signNum")).collect(Collectors.toList()));
return ResponseHelper.buildResponse(map1);
}
/**
* 列表全部数据查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "打卡记录列表全部数据查询", notes = "打卡记录列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "打卡记录列表全部数据查询", notes = "打卡记录列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<SignDto>> selectForList() { public ResponseModel<List<SignDto>> selectForList() {
return ResponseHelper.buildResponse(signServiceImpl.queryForSignList()); return ResponseHelper.buildResponse(signServiceImpl.queryForSignList());
} }
/** /**
* 当前用户当天是否已打卡 * 当前用户当天是否已打卡
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "打卡记录列表全部数据查询", notes = "打卡记录列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "打卡记录列表全部数据查询", notes = "打卡记录列表全部数据查询")
@GetMapping(value = "/hasSign") @GetMapping(value = "/hasSign")
public ResponseModel<Boolean> hasSign(@RequestParam(value = "type" , required = false) String type, public ResponseModel<Boolean> hasSign(@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "userId" , required = false) String userId) { @RequestParam(value = "userId", required = false) String userId) {
String date = DateUtils.stampToDate(new Date().getTime(),DateUtils.DATE_PATTERN); String date = DateUtils.stampToDate(new Date().getTime(), DateUtils.DATE_PATTERN);
return ResponseHelper.buildResponse(signServiceImpl.hasSign(type,date,userId)); return ResponseHelper.buildResponse(signServiceImpl.hasSign(type, date, userId));
} }
/** /**
* 保存打卡记录 * 保存打卡记录
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "保存打卡记录", notes = "保存打卡记录") @ApiOperation(httpMethod = "POST", value = "保存打卡记录", notes = "保存打卡记录")
@PostMapping(value = "/saveSign") @PostMapping(value = "/saveSign")
public ResponseModel<Boolean> hasSign(@RequestBody SignDto dto) { public ResponseModel<Boolean> hasSign(@RequestBody SignDto dto) {
return ResponseHelper.buildResponse(signServiceImpl.saveSign(dto)); return ResponseHelper.buildResponse(signServiceImpl.saveSign(dto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "今日出勤合格换流站(座)", notes = "今日出勤合格换流站(座)")
@GetMapping(value = "/center/sign-stats")
public ResponseModel<Map<String, Object>> getCenterSignStats(
@RequestParam(value = "bizOrgCode",required = false) String bizOrgCode,
@RequestParam(value = "date", required = false) String date,
@RequestParam(value = "targetPassNum", defaultValue = "8") Integer targetPassNum, // 出勤合格人数
@RequestParam(value = "stationType", required = false) String stationType
) {
if (StringUtils.isBlank(date)) {
date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
return ResponseHelper.buildResponse(signServiceImpl.getCenterSignStats(bizOrgCode, date, targetPassNum, stationType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防员出勤状态统计(近一周)", notes = "消防员出勤状态统计(近一周)")
@GetMapping(value = "/station/sign-stats")
public ResponseModel<Map<String, Object>> getStationSignStats(@RequestParam("bizOrgCode") String bizOrgCode) {
return ResponseHelper.buildResponse(signServiceImpl.getStationSignStats(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "换流站出勤情况", notes = "换流站出勤情况")
@GetMapping(value = "/station-attendance-stats/page")
public ResponseModel<IPage<Map<String, Object>>> getStationAttendanceStatsPage(
@RequestParam("pageNumber") Integer pageNumber,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "stationType", required = false) String stationType,
@RequestParam(value = "date", required = false) String date,
@RequestParam(value = "attendanceStatus", required = false) String attendanceStatus,
@RequestParam(value = "targetPassNum", defaultValue = "8") Integer targetPassNum, // 出勤合格人数
@RequestParam(value = "sorter", required = false) String sorter
) {
if (StringUtils.isBlank(date)) {
date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
Page page = new Page(pageNumber, pageSize);
return ResponseHelper.buildResponse(signServiceImpl.getStationAttendanceStatsPage(page, date, stationType, bizOrgCode, attendanceStatus, targetPassNum, sorter));
}
} }
...@@ -5,34 +5,32 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,34 +5,32 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Sign; import com.yeejoin.amos.boot.module.jcs.api.entity.Sign;
import com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.StationInfoMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.ISignService; import com.yeejoin.amos.boot.module.jcs.api.service.ISignService;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.component.rule.config.RuleConfig; import com.yeejoin.amos.component.rule.config.RuleConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.time.LocalDate;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* 打卡记录服务实现类 * 打卡记录服务实现类
...@@ -43,42 +41,42 @@ import java.util.Map; ...@@ -43,42 +41,42 @@ import java.util.Map;
@Slf4j @Slf4j
@Service @Service
@EnableScheduling @EnableScheduling
public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implements ISignService { public class SignServiceImpl extends BaseService<SignDto, Sign, SignMapper> implements ISignService {
@Autowired @Autowired
FirefightersServiceImpl iFirefightersService;
@Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@Value("${mqtt.topic.person.sign}") @Value("${mqtt.topic.person.sign}")
private String personSign; private String personSign;
@Value("${mqtt.topic.person.sign.zxj:sign/data/synZxj}") @Value("${mqtt.topic.person.sign.zxj:sign/data/synZxj}")
private String personSignZxj; private String personSignZxj;
@Autowired @Autowired
FirefightersServiceImpl iFirefightersService; private StationInfoMapper stationInfoMapper;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<SignDto> queryForSignPage(Page<SignDto> page) { public Page<SignDto> queryForSignPage(Page<SignDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 分页查询 * 分页查询
*/ */
public IPage<SignDto> queryForSignPageByMapper(IPage<SignDto> page, SignDto dto) { public IPage<SignDto> queryForSignPageByMapper(IPage<SignDto> page, SignDto dto) {
return this.baseMapper.queryForPage(page,dto); return this.baseMapper.queryForPage(page, dto);
} }
/** /**
* 分页查询 * 分页查询
*/ */
public IPage<SinStaticDto> queryForSignStaticPageByMapper(IPage<SinStaticDto> page, SinStaticDto dto) { public IPage<SinStaticDto> queryForSignStaticPageByMapper(IPage<SinStaticDto> page, SinStaticDto dto) {
IPage<SinStaticDto> sinStaticDtoIPage = this.baseMapper.queryStaticForPage(page, dto); IPage<SinStaticDto> sinStaticDtoIPage = this.baseMapper.queryStaticForPage(page, dto);
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
numberFormat.setMaximumFractionDigits(2); numberFormat.setMaximumFractionDigits(2);
sinStaticDtoIPage.getRecords().stream().forEach(e->{ sinStaticDtoIPage.getRecords().stream().forEach(e -> {
e.setAttendance(e.getSignNum() + "/" + e.getPersonOfDay()); e.setAttendance(e.getSignNum() + "/" + e.getPersonOfDay());
}); });
...@@ -86,7 +84,7 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -86,7 +84,7 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
return sinStaticDtoIPage; return sinStaticDtoIPage;
} }
public List<Map<String, Object>> queryPeopleInfo(SinStaticDto dto) { public List<Map<String, Object>> queryPeopleInfo(SinStaticDto dto) {
List<Map<String, Object>> res = this.baseMapper.queryPeopleInfo(dto); List<Map<String, Object>> res = this.baseMapper.queryPeopleInfo(dto);
return res; return res;
} }
...@@ -94,26 +92,26 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -94,26 +92,26 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<SignDto> queryForSignList() { public List<SignDto> queryForSignList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
@Override @Override
public Boolean hasSign(String type, String date,String userId) { public Boolean hasSign(String type, String date, String userId) {
QueryWrapper<Sign> queryWrapper = new QueryWrapper<>(); QueryWrapper<Sign> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("date",date); queryWrapper.eq("date", date);
if(StringUtils.isNotEmpty(type)) { if (StringUtils.isNotEmpty(type)) {
queryWrapper.eq("type",type); queryWrapper.eq("type", type);
} }
if(StringUtils.isNotEmpty(userId)) { if (StringUtils.isNotEmpty(userId)) {
queryWrapper.eq("user_id",userId); queryWrapper.eq("user_id", userId);
} }
List<Sign> signs = this.baseMapper.selectList(queryWrapper); List<Sign> signs = this.baseMapper.selectList(queryWrapper);
if (StringUtils.isEmpty(type) && signs.size() != 2) { if (StringUtils.isEmpty(type) && signs.size() != 2) {
return true; return true;
} else { } else {
if(StringUtils.isNotEmpty(type) && signs.size() == 1) { if (StringUtils.isNotEmpty(type) && signs.size() == 1) {
return true; return true;
} }
return false; return false;
...@@ -133,49 +131,49 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -133,49 +131,49 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
@Override @Override
public Boolean saveSign(SignDto dot) { public Boolean saveSign(SignDto dot) {
Sign sign = new Sign(); Sign sign = new Sign();
Map<String,Object> bizOrgCodeAndBizOrgName = iFirefightersService.getCompanyName(dot.getBizOrgCode()); Map<String, Object> bizOrgCodeAndBizOrgName = iFirefightersService.getCompanyName(dot.getBizOrgCode());
int num = this.baseMapper.queryPersonNum(bizOrgCodeAndBizOrgName.get("bizOrgCode").toString()); int num = this.baseMapper.queryPersonNum(bizOrgCodeAndBizOrgName.get("bizOrgCode").toString());
Bean.copyExistPropertis(dot,sign); Bean.copyExistPropertis(dot, sign);
sign.setPersonOfDay(String.valueOf(num)); sign.setPersonOfDay(String.valueOf(num));
boolean save = this.save(sign); boolean save = this.save(sign);
// 发送mqtt 消息 同步人员打卡数据 // 发送mqtt 消息 同步人员打卡数据
if (save){ if (save) {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("bizOrgName", ObjectUtils.isEmpty(sign.getBizOrgName())?"":sign.getBizOrgName()); map.put("bizOrgName", ObjectUtils.isEmpty(sign.getBizOrgName()) ? "" : sign.getBizOrgName());
map.put("bizOrgCode", ObjectUtils.isEmpty(sign.getBizOrgCode())?"":sign.getBizOrgCode()); map.put("bizOrgCode", ObjectUtils.isEmpty(sign.getBizOrgCode()) ? "" : sign.getBizOrgCode());
map.put("orgCode", ObjectUtils.isEmpty(sign.getOrgCode())?"":sign.getOrgCode()); map.put("orgCode", ObjectUtils.isEmpty(sign.getOrgCode()) ? "" : sign.getOrgCode());
map.put("signUserName", ObjectUtils.isEmpty(sign.getName())?"":sign.getName()); map.put("signUserName", ObjectUtils.isEmpty(sign.getName()) ? "" : sign.getName());
map.put("jobTitle", ObjectUtils.isEmpty(sign.getJobTitle())?"":sign.getJobTitle()); map.put("jobTitle", ObjectUtils.isEmpty(sign.getJobTitle()) ? "" : sign.getJobTitle());
map.put("userId", ObjectUtils.isEmpty(sign.getSignUserId())?"":sign.getSignUserId()); map.put("userId", ObjectUtils.isEmpty(sign.getSignUserId()) ? "" : sign.getSignUserId());
map.put("signDate", ObjectUtils.isEmpty(sign.getSignTime())?"":sign.getSignTime()); map.put("signDate", ObjectUtils.isEmpty(sign.getSignTime()) ? "" : sign.getSignTime());
map.put("recUserId", ObjectUtils.isEmpty(sign.getRecUserId())?"":sign.getRecUserId()); map.put("recUserId", ObjectUtils.isEmpty(sign.getRecUserId()) ? "" : sign.getRecUserId());
map.put("recUserName", ObjectUtils.isEmpty(sign.getRecUserName())?"":sign.getRecUserName()); map.put("recUserName", ObjectUtils.isEmpty(sign.getRecUserName()) ? "" : sign.getRecUserName());
map.put("sequenceNbr", ObjectUtils.isEmpty(sign.getRecUserName())?"":sign.getSequenceNbr()); map.put("sequenceNbr", ObjectUtils.isEmpty(sign.getRecUserName()) ? "" : sign.getSequenceNbr());
String json=JSON.toJSONString(map, SerializerFeature.PrettyFormat, String json = JSON.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue); SerializerFeature.WriteMapNullValue);
try { try {
emqKeeper.getMqttClient().publish(personSign, json.getBytes(), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(personSign, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
map.put("personOfDay", ObjectUtils.isEmpty(sign.getPersonOfDay())?"":sign.getPersonOfDay()); map.put("personOfDay", ObjectUtils.isEmpty(sign.getPersonOfDay()) ? "" : sign.getPersonOfDay());
map.put("type", ObjectUtils.isEmpty(sign.getType())?"":sign.getType()); map.put("type", ObjectUtils.isEmpty(sign.getType()) ? "" : sign.getType());
map.put("photos", ObjectUtils.isEmpty(sign.getPhotos())?"":sign.getPhotos()); map.put("photos", ObjectUtils.isEmpty(sign.getPhotos()) ? "" : sign.getPhotos());
map.put("remarks", ObjectUtils.isEmpty(sign.getRemarks())?"":sign.getRemarks()); map.put("remarks", ObjectUtils.isEmpty(sign.getRemarks()) ? "" : sign.getRemarks());
map.put("date", ObjectUtils.isEmpty(sign.getDate())?"":sign.getDate()); map.put("date", ObjectUtils.isEmpty(sign.getDate()) ? "" : sign.getDate());
map.put("recDate", ObjectUtils.isEmpty(sign.getRecDate())?"":sign.getRecDate()); map.put("recDate", ObjectUtils.isEmpty(sign.getRecDate()) ? "" : sign.getRecDate());
map.put("isDelete", ObjectUtils.isEmpty(sign.getIsDelete())?"":sign.getIsDelete()); map.put("isDelete", ObjectUtils.isEmpty(sign.getIsDelete()) ? "" : sign.getIsDelete());
map.put("source", ObjectUtils.isEmpty(sign.getSource())?"":sign.getSource()); map.put("source", ObjectUtils.isEmpty(sign.getSource()) ? "" : sign.getSource());
String json1= JSON.toJSONString(map, SerializerFeature.PrettyFormat, String json1 = JSON.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue); SerializerFeature.WriteMapNullValue);
// 发送emq消息转kafka // 发送emq消息转kafka
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("topic", personSign); jsonObject.put("topic", personSign);
jsonObject.put("data",json); jsonObject.put("data", json);
emqKeeper.getMqttClient().publish("emq.sign.created",jsonObject.toString().getBytes(),1,false); emqKeeper.getMqttClient().publish("emq.sign.created", jsonObject.toString().getBytes(), 1, false);
// 发送emq消息转kafka 同步业务库打卡表 // 发送emq消息转kafka 同步业务库打卡表
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("topic", personSignZxj); jsonObject1.put("topic", personSignZxj);
jsonObject1.put("data",json1); jsonObject1.put("data", json1);
emqKeeper.getMqttClient().publish("emq.bussSign.created",jsonObject1.toString().getBytes(),1,false); emqKeeper.getMqttClient().publish("emq.bussSign.created", jsonObject1.toString().getBytes(), 1, false);
} catch (MqttException e) { } catch (MqttException e) {
log.info(String.format("发送eqm打卡消息失败:%s", e.getMessage())); log.info(String.format("发送eqm打卡消息失败:%s", e.getMessage()));
...@@ -197,21 +195,21 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -197,21 +195,21 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
for (Map<String, Object> m : mapSign for (Map<String, Object> m : mapSign
) { ) {
// 判断至少8人出勤 // 判断至少8人出勤
if(Integer.parseInt(m.get("num").toString()) < 8) { if (Integer.parseInt(m.get("num").toString()) < 8) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("bizOrgCode", m.get("bizOrgCode")); map.put("bizOrgCode", m.get("bizOrgCode"));
map.put("bizOrgName", m.get("bizOrgName")); map.put("bizOrgName", m.get("bizOrgName"));
mapList.add(map); mapList.add(map);
} }
} }
if(mapList.size() > 0) { if (mapList.size() > 0) {
try { try {
emqKeeper.getMqttClient().publish("jcs/sign/put", JSONObject.toJSONString(mapList).getBytes(), 1, false); emqKeeper.getMqttClient().publish("jcs/sign/put", JSONObject.toJSONString(mapList).getBytes(), 1, false);
} catch (MqttException exp) { } catch (MqttException exp) {
log.info(String.format("发送eqm转kafka消息失败:%s", exp.getMessage())); log.info(String.format("发送eqm转kafka消息失败:%s", exp.getMessage()));
} }
} }
if(mapSign.size() == 0) { if (mapSign.size() == 0) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("bizOrgCode", ""); map.put("bizOrgCode", "");
mapList.add(map); mapList.add(map);
...@@ -222,4 +220,71 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -222,4 +220,71 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
} }
} }
} }
}
\ No newline at end of file public Map<String, Object> getCenterSignStats(String bizOrgCode, String date, Integer targetPassNum, String stationType) {
List<Map<String, Object>> queryMaps = baseMapper.selectCenterSignStats(bizOrgCode, date, targetPassNum, stationType);
int passedStationNum = 0;
long allStationNum = stationInfoMapper.count(stationType);
for (Map<String, Object> queryMap : queryMaps) {
String status = queryMap.get("status").toString();
if (Objects.equals("pass", status)) {
passedStationNum++;
}
}
final int finalPassedStationNum = passedStationNum;
final int finalPassedStationNum1 = passedStationNum;
return new HashMap<String, Object>() {{
this.put("pass", finalPassedStationNum);
this.put("fail", allStationNum - finalPassedStationNum1);
}};
}
public Map<String, Object> getStationSignStats(String bizOrgCode) {
List<Map<String, Object>> maps = baseMapper.selectStationSignStats(bizOrgCode);
List<String> xAxis = new ArrayList<>();
List<Long> yAxis = new ArrayList<>();
LocalDate today = LocalDate.now();
for (int i = 0; i < 7; i++) {
String date = today.minusDays(i).toString();
xAxis.add(date);
yAxis.add(0L);
}
if (!maps.isEmpty()) {
for (Map<String, Object> map : maps) {
String date = map.get("date").toString();
long num = Long.parseLong(map.getOrDefault("num", "0").toString());
if (xAxis.contains(date)) {
int index = xAxis.indexOf(date);
yAxis.set(index, num);
}
}
}
return new HashMap<String, Object>() {{
this.put("xAxis", xAxis);
this.put("yAxis", yAxis);
}};
}
public IPage<Map<String, Object>> getStationAttendanceStatsPage(
IPage<?> page,
String date,
String stationType,
String bizOrgCode,
String attendanceStatus,
Integer targetPassNum,
String sorter
) {
String sortField = "", sortOrder = "";
if (org.springframework.util.StringUtils.hasText(sorter)) {
sortField = sorter.split("@")[0];
sortOrder = sorter.split("@")[1];
}
return baseMapper.selectStationAttendanceStatsPage(page, date, stationType, bizOrgCode, attendanceStatus, targetPassNum, sortField, sortOrder);
}
}
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-08-31-chenhao-1"> <changeSet author="chenhao" id="2021-08-31-chenhao-1">
<comment>modify table cb_firefighters_thought add one columns</comment> <comment>modify table cb_firefighters_thought add one columns</comment>
<sql> <sql>
ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间'; ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间';
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1169', '1169', '环支状管网', 'XFJSGW', NULL, NULL, NULL, NULL, NULL, '\0', '1'); INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1169', '1169', '环支状管网', 'XFJSGW', NULL, NULL, NULL, NULL, NULL, '\0', '1');
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1170', '1170', '可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1'); INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1170', '1170', '可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1');
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1171', '1171', '不可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1'); INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1171', '1171', '不可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1');
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="guowubin" id="1629430730658-1"> <changeSet author="guowubin" id="1629430730658-1">
<comment>alter table jc_controller</comment> <comment>alter table jc_controller</comment>
...@@ -561,7 +561,7 @@ ...@@ -561,7 +561,7 @@
'调派任务状态(执行中:executing,已完成:finished)'; '调派任务状态(执行中:executing,已完成:finished)';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-09-13-chenhao-1"> <changeSet author="chenhao" id="2021-09-13-chenhao-1">
<comment>update data cb_firefighters_workexperience</comment> <comment>update data cb_firefighters_workexperience</comment>
<sql> <sql>
...@@ -1583,7 +1583,7 @@ ...@@ -1583,7 +1583,7 @@
INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674815', '值班消防', 'dutyFireFighting', '0', NULL, '10', '1', NULL, NULL, '2021-09-28 10:34:05', '\0'); INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674815', '值班消防', 'dutyFireFighting', '0', NULL, '10', '1', NULL, NULL, '2021-09-28 10:34:05', '\0');
</sql> </sql>
</changeSet> </changeSet>
<changeSet id="2021-10-13" author="chenhao-2"> <changeSet id="2021-10-13" author="chenhao-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column" /> <tableExists tableName="cb_dynamic_form_column" />
...@@ -1775,7 +1775,7 @@ ...@@ -1775,7 +1775,7 @@
INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674816', '值班120急救站', 'dutyFirstAid', '0', NULL, '10', '1', NULL, NULL, '2021-10-14 16:48:41', '\0'); INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674816', '值班120急救站', 'dutyFirstAid', '0', NULL, '10', '1', NULL, NULL, '2021-10-14 16:48:41', '\0');
</sql> </sql>
</changeSet> </changeSet>
<changeSet id="2021-10-14" author="chenhao-2"> <changeSet id="2021-10-14" author="chenhao-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column" /> <tableExists tableName="cb_dynamic_form_column" />
...@@ -2032,8 +2032,8 @@ ...@@ -2032,8 +2032,8 @@
<sql> <sql>
ALTER TABLE cb_firefighters ADD fire_team_name varchar(100) NULL COMMENT '消防队伍名称' ALTER TABLE cb_firefighters ADD fire_team_name varchar(100) NULL COMMENT '消防队伍名称'
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-02-3"> <changeSet author="chenhao" id="2021-11-02-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2044,8 +2044,8 @@ ...@@ -2044,8 +2044,8 @@
<sql> <sql>
ALTER TABLE cb_key_site ADD belong_name varchar(100) NULL COMMENT '所属单位/部门名称'; ALTER TABLE cb_key_site ADD belong_name varchar(100) NULL COMMENT '所属单位/部门名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-02-4"> <changeSet author="chenhao" id="2021-11-02-4">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2056,8 +2056,8 @@ ...@@ -2056,8 +2056,8 @@
<sql> <sql>
ALTER TABLE cb_org_usr ADD parent_name varchar(100) NULL COMMENT '归属机构/部门/人员名称'; ALTER TABLE cb_org_usr ADD parent_name varchar(100) NULL COMMENT '归属机构/部门/人员名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-04-1"> <changeSet author="chenhao" id="2021-11-04-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2068,8 +2068,8 @@ ...@@ -2068,8 +2068,8 @@
<sql> <sql>
ALTER TABLE cb_fire_team ADD parent_name varchar(100) NULL COMMENT '父级队伍名称'; ALTER TABLE cb_fire_team ADD parent_name varchar(100) NULL COMMENT '父级队伍名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litw" id="2021-11-03-01"> <changeSet author="litw" id="2021-11-03-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2093,7 +2093,7 @@ ...@@ -2093,7 +2093,7 @@
) COMMENT = '消防水源物联参数' ; ) COMMENT = '消防水源物联参数' ;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-05-1"> <changeSet author="chenhao" id="2021-11-05-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2104,7 +2104,7 @@ ...@@ -2104,7 +2104,7 @@
<sql> <sql>
ALTER TABLE cb_maintenance_company ADD parent_name varchar(100) NULL COMMENT '所属单位/部门名称'; ALTER TABLE cb_maintenance_company ADD parent_name varchar(100) NULL COMMENT '所属单位/部门名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litw" id="2021-11-05-01"> <changeSet author="litw" id="2021-11-05-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
...@@ -2745,7 +2745,7 @@ ...@@ -2745,7 +2745,7 @@
ALTER TABLE cb_fire_station ADD parent_building_id varchar(1000) NULL COMMENT '所属建筑节点的所有父节点id集合'; ALTER TABLE cb_fire_station ADD parent_building_id varchar(1000) NULL COMMENT '所属建筑节点的所有父节点id集合';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20220207-1" runAlways="true"> <changeSet author="tw" id="20220207-1" runAlways="true">
<comment>`getParentList`</comment> <comment>`getParentList`</comment>
<sql endDelimiter="#"> <sql endDelimiter="#">
...@@ -3971,15 +3971,27 @@ ...@@ -3971,15 +3971,27 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20240801"> <changeSet author="ky" id="20240801">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="idx_biz_station_info" columnName="warehouse_id"/> <columnExists tableName="idx_biz_station_info" columnName="station_type"/>
</not> </not>
</preConditions> </preConditions>
<comment>新增属性字段 warehouse_id</comment> <comment>新增属性字段 station_type</comment>
<sql> <sql>
alter table `idx_biz_station_info` add column `station_type` varchar(20) DEFAULT NULL COMMENT '换流站类型'; alter table `idx_biz_station_info` add column `station_type` varchar(20) DEFAULT NULL COMMENT '换流站类型';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="lixm" id="20240801">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="idx_biz_station_info" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_code</comment>
<sql>
alter table `idx_biz_station_info` add column `biz_org_code` varchar(50) DEFAULT NULL COMMENT 'BIZ_ORG_CODE';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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