施工管控
This commit is contained in:
parent
d0ee2bf132
commit
1f1d6f0258
|
|
@ -48,6 +48,9 @@ public class BusinessConstants {
|
|||
public static final String LAT = "纬度";
|
||||
public static final String LON = "经度";
|
||||
|
||||
public final static Integer CONFIG_TYPE = 1;
|
||||
public final static Integer CONFIG_TYPE2 = 2;
|
||||
|
||||
|
||||
public final static Integer CELL_1 = 1;
|
||||
public final static Integer CELL_2 = 2;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.common.core.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @className:TimeValidator
|
||||
* @author:cwchen
|
||||
* @date:2024-08-10-15:15
|
||||
* @version:1.0
|
||||
* @description:时间验证
|
||||
*/
|
||||
public class TimeValidator {
|
||||
|
||||
private static final Pattern TIME_PATTERN = Pattern.compile("^([01]?[0-9]|2[0-3]):[0-5][0-9]$");
|
||||
private static final Pattern TIME_PATTERN2 = Pattern.compile("^[1-9]$|^10$");
|
||||
|
||||
/**
|
||||
* 时分校验
|
||||
* @param time
|
||||
* @return boolean
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:16
|
||||
*/
|
||||
public static boolean isValidTime(String time) {
|
||||
if (StringUtils.isEmpty(time)) {
|
||||
return false;
|
||||
}
|
||||
return TIME_PATTERN.matcher(time).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1-10 小时验证
|
||||
* @param time
|
||||
* @return boolean
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:20
|
||||
*/
|
||||
public static boolean isValidTime2(String time) {
|
||||
if (StringUtils.isEmpty(time)) {
|
||||
return false;
|
||||
}
|
||||
return TIME_PATTERN2.matcher(time).matches();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* @className:CheckConfigVo
|
||||
* @author:cwchen
|
||||
* @date:2024-08-10-14:57
|
||||
* @version:1.0
|
||||
* @description:自动验证-vo
|
||||
*/
|
||||
@Data
|
||||
public class CheckConfigVo {
|
||||
|
||||
/**
|
||||
* 配置id
|
||||
*/
|
||||
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 1.固定时间验证 2.间隔时间验证
|
||||
*/
|
||||
@NotNull(message = "验证类型不能为空")
|
||||
private Integer configType;
|
||||
|
||||
@NotBlank(message = "时间不能为空")
|
||||
private String time;
|
||||
|
||||
}
|
||||
|
|
@ -5,11 +5,13 @@ import com.bonus.common.core.web.controller.BaseController;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.CheckConfigVo;
|
||||
import com.bonus.common.entity.bracelet.vo.EquipmentReqVo;
|
||||
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -118,4 +120,22 @@ public class ConsControlController extends BaseController {
|
|||
public AjaxResult spotCheck(@RequestBody BraceletParamsDto dto){
|
||||
return service.spotCheck(dto);
|
||||
}
|
||||
|
||||
@PostMapping("checkConfig")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.INSERT, logType = 0, module = "施工管控->人员管控", details = "自动验证配置")
|
||||
public AjaxResult checkConfig(@Validated @RequestBody CheckConfigVo vo){
|
||||
return service.checkConfig(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动验证配置
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:37
|
||||
*/
|
||||
@GetMapping("getCheckConfig")
|
||||
public AjaxResult getCheckConfig(BraceletParamsDto dto){
|
||||
return service.getCheckConfig(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.bonus.bracelet.mapper;
|
||||
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.BallTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.PersonTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.TeamPeopleTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
|
||||
import com.bonus.common.entity.bracelet.vo.*;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
|
@ -121,4 +118,42 @@ public interface ConsControlMapper {
|
|||
* @date 2024/8/10 13:12
|
||||
*/
|
||||
List<TeamPeopleTreeVo> getTeamPersonByTower(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 删除验证时间配置项
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:27
|
||||
*/
|
||||
void delConfig();
|
||||
/**
|
||||
* 删除验证时间配置内容项
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:27
|
||||
*/
|
||||
void delConfigItems();
|
||||
/**
|
||||
* 添加验证时间配置项
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:27
|
||||
*/
|
||||
void addConfig(CheckConfigVo vo);
|
||||
/**
|
||||
* 添加验证时间配置内容项
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:27
|
||||
*/
|
||||
void addConfigItems(@Param("params") CheckConfigVo vo,@Param("val") String time);
|
||||
|
||||
/**
|
||||
* 获取自动验证配置
|
||||
* @param dto
|
||||
* @return List<CheckConfigVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:39
|
||||
*/
|
||||
List<CheckConfigVo> getCheckConfig(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.bracelet.service;
|
|||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.CheckConfigVo;
|
||||
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -85,4 +86,22 @@ public interface IConsControlService {
|
|||
* @date 2024/8/10 14:27
|
||||
*/
|
||||
AjaxResult spotCheck(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 自动验证配置
|
||||
* @param vo
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 14:58
|
||||
*/
|
||||
AjaxResult checkConfig(CheckConfigVo vo);
|
||||
|
||||
/**
|
||||
* 获取自动验证配置
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/10 15:38
|
||||
*/
|
||||
AjaxResult getCheckConfig(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,20 +10,20 @@ import com.bonus.common.core.constant.HttpStatus;
|
|||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.HaversineUtil;
|
||||
import com.bonus.common.core.utils.TimeValidator;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.core.utils.BuildTreeUtil;
|
||||
import com.bonus.common.entity.bracelet.vo.BallTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.PersonTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.TeamPeopleTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
|
||||
import com.bonus.common.entity.bracelet.vo.*;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
|
@ -250,6 +250,57 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
return AjaxResult.success("已下达手环人脸验证抽检指令");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult checkConfig(CheckConfigVo vo) {
|
||||
try {
|
||||
// 删除配置项
|
||||
mapper.delConfig();
|
||||
mapper.delConfigItems();
|
||||
if (Objects.equals(vo.getConfigType(), BusinessConstants.CONFIG_TYPE)) {
|
||||
// 固定时间验证
|
||||
String[] timeArr = vo.getTime().split(",");
|
||||
for (String time : timeArr) {
|
||||
if(!TimeValidator.isValidTime(time)){
|
||||
return AjaxResult.error("时间格式错误(HH:MM)");
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(vo.getConfigType(), BusinessConstants.CONFIG_TYPE2)) {
|
||||
// 间隔时间验证
|
||||
if (!TimeValidator.isValidTime2(vo.getTime())) {
|
||||
return AjaxResult.error("间隔时间应在1-10的正整数范围");
|
||||
}
|
||||
}
|
||||
// 添加配置项、配置项内容
|
||||
mapper.addConfig(vo);
|
||||
if (Objects.equals(vo.getConfigType(), BusinessConstants.CONFIG_TYPE)) {
|
||||
String[] timeArr = vo.getTime().split(",");
|
||||
for (String time : timeArr) {
|
||||
mapper.addConfigItems(vo,time);
|
||||
}
|
||||
} else if (Objects.equals(vo.getConfigType(), BusinessConstants.CONFIG_TYPE2)) {
|
||||
mapper.addConfigItems(vo,vo.getTime());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error(e.toString(), e);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getCheckConfig(BraceletParamsDto dto) {
|
||||
List<CheckConfigVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getCheckConfig(dto);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组人员/临时人员 是否超出正常施工范围
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,34 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.bracelet.mapper.ConsControlMapper">
|
||||
<!--添加验证时间配置项-->
|
||||
<insert id="addConfig" keyProperty="configId" useGeneratedKeys="true">
|
||||
INSERT INTO tb_config(config_type,config_id) VALUES (
|
||||
#{configType},null
|
||||
)
|
||||
</insert>
|
||||
<!--添加验证时间配置内容项-->
|
||||
<insert id="addConfigItems">
|
||||
INSERT INTO tb_config_items
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="val != null and val != ''">config_time,</if>
|
||||
id,
|
||||
<if test="params.configId != null">config_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="val != null and val != ''">#{val},</if>
|
||||
null,
|
||||
<if test="params.configId != null">#{params.configId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<!--删除验证时间配置项-->
|
||||
<delete id="delConfig">
|
||||
DELETE FROM tb_config
|
||||
</delete>
|
||||
<!--删除验证时间配置内容项-->
|
||||
<delete id="delConfigItems">
|
||||
DELETE FROM tb_config_items
|
||||
</delete>
|
||||
|
||||
<!--获取球机设备列表 项目部权限-->
|
||||
<select id="getBallDeviceLists" resultType="com.bonus.common.entity.bracelet.vo.BallTreeVo">
|
||||
|
|
@ -309,5 +337,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN tb_ls_user tlu ON tlu.id= tb.bid_id
|
||||
WHERE sbx.gt_id = #{id} AND tb.peopel_type = 1 AND sbx.del_flag = 0
|
||||
</select>
|
||||
<!--获取自动验证配置-->
|
||||
<select id="getCheckConfig" resultType="com.bonus.common.entity.bracelet.vo.CheckConfigVo">
|
||||
SELECT tc.config_type AS configType,
|
||||
tc.config_id AS configId,
|
||||
tci.config_time AS time
|
||||
FROM tb_config tc
|
||||
LEFT JOIN tb_config_items tci on tc.config_id = tci.config_id
|
||||
ORDER BY config_time
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue