安全帽绑定、工程成本维护

This commit is contained in:
haozq 2024-03-30 20:30:57 +08:00
parent a996673914
commit 3aa0e2adff
18 changed files with 455 additions and 4 deletions

View File

@ -50,4 +50,9 @@ public class ParamDto {
@ApiModelProperty(value = "建管单位")
private String orgId;
@ApiModelProperty(value = "设备id")
private String devId;
@ApiModelProperty(value = "人员id")
private String userId;
}

View File

@ -19,7 +19,7 @@ public class ProCostVo {
/**
* 工程造价
*/
private Decimal cost;
private String cost;
/**
* 成本备注
*/
@ -33,6 +33,8 @@ public class ProCostVo {
*/
private String createTime;
private String proName;

View File

@ -90,6 +90,11 @@ public class SystemGlobal {
*/
public final static int HJ_TYPE=351;
/**
* 安全帽的类型
*/
public final static int AQM_TYPE=1804;
public final static int WEEK_DAY=7;
}

View File

@ -95,4 +95,14 @@ public class DeviceController extends BaseController {
return service.getDeviceDetail(dto);
}
/**
* 查询安全帽的集合
* @param dto
* @return
*/
@GetMapping("getDeviceListByType")
public Result<List<DeviceVo>> getDeviceListByType(DeviceDto dto) {
return service.getDeviceListByType(dto);
}
}

View File

@ -93,4 +93,25 @@ public class HumanManageController extends BaseController {
list = service.getPersonnelAccessLists(dto);
return getDataTable(list);
}
@ApiOperation(value = "绑定安全帽")
@GetMapping("bindDev")
@Log(title = "人员管理", menu = "人车管理->人员管理", grade = OperationType.ADD_BUSINESS, details = "绑定安全膜", type = "业务日志")
public AjaxResult bindDev(ParamDto dto) {
return service.bindDev(dto);
}
@ApiOperation(value = "查看绑定安全帽")
@GetMapping("getBindDetail")
public AjaxResult getBindDetail(ParamDto dto) {
return service.getBindDetail(dto);
}
@ApiOperation(value = "")
@GetMapping("delBind")
@Log(title = "delBind", menu = "人车管理->人员管理", grade = OperationType.ADD_BUSINESS, details = "绑定安全膜", type = "业务日志")
public AjaxResult delBind(ParamDto dto) {
return service.delBind(dto);
}
}

View File

@ -16,6 +16,7 @@ import com.securitycontrol.entity.background.vo.DeviceVo;
import com.securitycontrol.entity.background.vo.EmergencyPlanVo;
import com.securitycontrol.entity.background.vo.GtVo;
import com.securitycontrol.entity.file.FileExportVo;
import com.securitycontrol.entity.screen.vo.ProCostVo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,9 +42,55 @@ public class TbAreaController extends BaseController {
@Autowired
private TbAreaService service;
@Autowired
private EmergencyService emergencyService;
@ApiOperation(value = "查询工程成本")
@GetMapping("getProCostList")
@Log(title = "工程管理", menu = "基础管理->工程管理", grade = OperationType.QUERY_BUSINESS, details = "查询工程成本", type = "业务日志")
public TableDataInfo getProCostList(AreaDto dto) {
try{
startPage();
List<ProCostVo> list = service.getProCostList(dto);
return getDataTable(list);
}catch (Exception e){
log.error(e.toString(),e);
return getDataTableBad(new ArrayList<>(),"请求出错了");
}
}
/**
* 新增成本
*
* @param dto
* @return
*/
@PostMapping("addCost")
@Log(title = "工程管理", menu = "基础管理->工程管理", grade = OperationType.ADD_BUSINESS, details = "新增成本", type = "业务日志")
public Result<String> addCost(@RequestBody ProCostVo dto) {
return service.addCost(dto);
}
/**
* 修改成本
*
* @param dto
* @return
*/
@PostMapping("updateCost")
@Log(title = "工程管理", menu = "基础管理->工程管理", grade = OperationType.ADD_BUSINESS, details = "修改成本", type = "业务日志")
public Result<String> updateCost(@RequestBody ProCostVo dto) {
return service.updateCost(dto);
}
/**
* 删除维护成本
* @param dto
* @return
*/
@PostMapping("deleteCost")
@Log(title = "工程管理", menu = "基础管理->工程管理", grade = OperationType.ADD_BUSINESS, details = "删除成本", type = "业务日志")
public Result<String> deleteCost(@RequestBody ProCostVo dto) {
return service.deleteCost(dto);
}
@ApiOperation(value = "获取设备列表")
@GetMapping("getAreaList")
@ -196,4 +243,7 @@ public class TbAreaController extends BaseController {
}
}

View File

@ -57,4 +57,11 @@ public interface DeviceMapper {
* @return
*/
DeviceVo getDeviceDetail(DeviceDto dto);
/**
* 查询安全帽下拉选
* @param code
* @return
*/
List<DeviceVo> getDeviceListByType(@Param("code") int code);
}

View File

@ -112,4 +112,39 @@ public interface HumanManageMapper {
* @date 2024/3/22 9:33
*/
List<UserAccessVo> getPersonnelAccessLists(ParamDto dto);
/**
* 绑定安全帽
* @param dto
* @return
*/
int bindDev(ParamDto dto);
/**
* 接触安全帽绑定
* @param dto
* @return
*/
int delBind(ParamDto dto);
/**
* 查询绑定记录
* @param dto
* @return
*/
int getBindHis(ParamDto dto);
/**
* 查询已绑定设备
* @param dto
* @return
*/
List<ParamDto> getBindDetail(ParamDto dto);
/**
* 修改成功
* @param dto
* @return
*/
int updateDev(ParamDto dto);
}

View File

@ -3,6 +3,7 @@ package com.securitycontrol.background.mapper;
import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import com.securitycontrol.entity.background.vo.GtVo;
import com.securitycontrol.entity.screen.vo.ProCostVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -118,4 +119,32 @@ public interface TbAreaMapper {
* @return
*/
int deleteData(AreaVo dto);
/**
* 查询工程成本信息
* @param dto
* @return
*/
List<ProCostVo> getProCostList(AreaDto dto);
/**
* 新增成本
* @param dto
* @return
*/
int addCost(ProCostVo dto);
/**
* 修改工程成本
* @param dto
* @return
*/
int updateCost(ProCostVo dto);
/**
* 删除成本数据
* @param dto
* @return
*/
int deleteCost(ProCostVo dto);
}

View File

@ -47,4 +47,11 @@ public interface DeviceService {
* @return
*/
Result<DeviceVo> getDeviceDetail(DeviceDto dto);
/**
* 查询安全帽的集合
* @param dto
* @return
*/
Result<List<DeviceVo>> getDeviceListByType(DeviceDto dto);
}

View File

@ -81,4 +81,25 @@ public interface HumanService {
* @date 2024/3/22 9:33
*/
List<UserAccessVo> getPersonnelAccessLists(ParamDto dto);
/**
* 人员绑定安全膜
* @param dto
* @return
*/
AjaxResult bindDev(ParamDto dto);
/**
* 接触绑定
* @param dto
* @return
*/
AjaxResult delBind(ParamDto dto);
/**
* 人员绑定安全帽记录
* @param dto
* @return
*/
AjaxResult getBindDetail(ParamDto dto);
}

View File

@ -5,6 +5,7 @@ import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import com.securitycontrol.entity.background.vo.GtVo;
import com.securitycontrol.entity.screen.vo.ProCostVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -114,4 +115,32 @@ public interface TbAreaService {
* @return
*/
Result<String> deleteSwFile( AreaVo dto);
/**
* 分页查询工程成本信息
* @param dto
* @return
*/
List<ProCostVo> getProCostList(AreaDto dto);
/**
* 新增工程成本
* @param dto
* @return
*/
Result<String> addCost(ProCostVo dto);
/**
* 修改工程成本
* @param dto
* @return
*/
Result<String> updateCost(ProCostVo dto);
/**
* 删除成本数据
* @param dto
* @return
*/
Result<String> deleteCost(ProCostVo dto);
}

View File

@ -16,6 +16,7 @@ import org.apache.poi.xssf.model.SingleXmlCells;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@ -129,6 +130,22 @@ public class DeviceServiceImpl implements DeviceService {
return Result.ok(new DeviceVo());
}
/**
*
* @param dto
* @return
*/
@Override
public Result<List<DeviceVo>> getDeviceListByType(DeviceDto dto) {
try{
List<DeviceVo> list= mapper.getDeviceListByType(SystemGlobal.AQM_TYPE);
return Result.ok(list);
}catch (Exception e){
log.error(e.toString(),e);
return Result.fail(new ArrayList<DeviceVo>());
}
}
public String checkData(DeviceVo deviceVo){
try{

View File

@ -10,12 +10,15 @@ import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.StringUtils;
import com.securitycontrol.common.core.utils.aes.AesCbcUtils;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.utils.aes.ListHelper;
import com.securitycontrol.common.core.utils.aes.StringHelper;
import com.securitycontrol.common.core.utils.uuid.IdUtils;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.security.utils.ValidatorsUtils;
import com.securitycontrol.entity.background.dto.ParamDto;
import com.securitycontrol.entity.background.vo.HumanManageVo;
import com.securitycontrol.entity.background.vo.UserAccessVo;
import com.securitycontrol.entity.system.SystemGlobal;
import com.securitycontrol.entity.system.vo.ResourceFileVo;
import com.securitycontrol.system.api.RemoteFileService;
import com.securitycontrol.system.api.domain.SysFile;
@ -253,4 +256,82 @@ public class HumanServiceImpl implements HumanService {
}
return list;
}
/**
* 人员绑定安全膜
* @param dto
* @return
*/
@Override
public AjaxResult bindDev(ParamDto dto) {
try{
if (StringHelper.isEmpty(dto.getUserId())) {
AjaxResult.error("未选择人员");
}
if (StringHelper.isEmpty(dto.getDevId())) {
AjaxResult.error("未选择安全帽");
}
if(StringHelper.isEmpty(dto.getId())){
int bidNum=mapper.getBindHis(dto);
dto.setId(IdUtils.getUUId());
if(bidNum>SystemGlobal.MIN_NUM){
return AjaxResult.error("该人员已绑定安全帽");
}
int num= mapper.bindDev(dto);
if(num== SystemGlobal.SUCCESS_NUM){
return AjaxResult.success("绑定成功");
}
}else{
int num= mapper.updateDev(dto);
if(num== SystemGlobal.SUCCESS_NUM){
return AjaxResult.success("修改成功");
}
}
return AjaxResult.error("绑定失败,数据未入库");
} catch (Exception e) {
log.error(e.toString(),e);
return AjaxResult.error("系统升级中,请稍后重试");
}
}
/**
*
* @param dto
* @return
*/
@Override
public AjaxResult delBind(ParamDto dto) {
try{
if (StringHelper.isEmpty(dto.getUserId())) {
AjaxResult.error("人员不能为空");
}
int num= mapper.delBind(dto);
if(num>SystemGlobal.MIN_NUM){
return AjaxResult.success("解除绑定成功");
}
return AjaxResult.error("解除绑定失败");
} catch (Exception e) {
log.error(e.toString(),e);
return AjaxResult.error("系统升级中,请稍后重试");
}
}
@Override
public AjaxResult getBindDetail(ParamDto dto) {
try{
List<ParamDto> list=mapper.getBindDetail(dto);
if(ListHelper.isNotEmpty(list)){
return AjaxResult.success("请求成功",list.get(0));
}
return AjaxResult.success("未绑定球机","");
} catch (Exception e) {
log.error(e.toString(),e);
}
return AjaxResult.success("error","");
}
}

View File

@ -5,6 +5,7 @@ import com.securitycontrol.background.service.SourceFileService;
import com.securitycontrol.background.service.TbAreaService;
import com.securitycontrol.common.core.constant.SecurityConstants;
import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.utils.aes.ListHelper;
import com.securitycontrol.common.core.utils.aes.StringHelper;
import com.securitycontrol.common.core.utils.uuid.IdUtils;
@ -12,6 +13,7 @@ import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import com.securitycontrol.entity.background.vo.GtVo;
import com.securitycontrol.entity.file.FileExportVo;
import com.securitycontrol.entity.screen.vo.ProCostVo;
import com.securitycontrol.entity.system.SystemGlobal;
import com.securitycontrol.system.api.RemoteFileService;
import lombok.extern.slf4j.Slf4j;
@ -315,13 +317,98 @@ public class TbAreaServiceImpl implements TbAreaService {
if (num==SystemGlobal.SUCCESS_NUM){
return Result.ok("删除成功","删除成功");
}
return Result.fail("删除失败,删除失败");
return Result.fail("删除失败");
}catch (Exception e){
log.error(e.toString(),e);
return Result.fail("系统升级中,请稍后重试!");
}
}
/**
* 查询工程成本列表
* @param dto
* @return
*/
@Override
public List<ProCostVo> getProCostList(AreaDto dto) {
return mapper.getProCostList(dto);
}
/**
* 新增工程成本
* @param dto
* @return
*/
@Override
public Result<String> addCost(ProCostVo dto) {
try{
String result=checkData3(dto);
if(StringHelper.isNotEmpty(result)){
return Result.fail(result);
}
dto.setCurryDay(DateTimeHelper.getNowDay());
int num= mapper.addCost(dto);
if(num==SystemGlobal.SUCCESS_NUM){
return Result.ok("新增成功","新增成功");
}
return Result.fail("新增失败,数据未入库");
}catch (Exception e){
log.error(e.toString(),e);
return Result.fail("系统升级中,请稍后重试!");
}
}
@Override
public Result<String> updateCost(ProCostVo dto) {
try{
String result=checkData3(dto);
if(StringHelper.isNotEmpty(result)){
return Result.fail(result);
}
dto.setCurryDay(DateTimeHelper.getNowDay());
int num= mapper.updateCost(dto);
if(num==SystemGlobal.SUCCESS_NUM){
return Result.ok("修改成功","修改成功");
}
return Result.fail("修改失败,数据不存在");
}catch (Exception e){
log.error(e.toString(),e);
return Result.fail("系统升级中,请稍后重试!");
}
}
@Override
public Result<String> deleteCost(ProCostVo dto) {
try{
int num= mapper.deleteCost(dto);
if (num==SystemGlobal.SUCCESS_NUM){
return Result.ok("删除成功","删除成功");
}
return Result.fail("删除失败");
}catch (Exception e){
log.error(e.toString(),e);
return Result.fail("系统升级中,请稍后重试!");
}
}
/**
* 数据校验
* @param dto
* @return
*/
public String checkData3(ProCostVo dto){
if(StringHelper.isEmpty(dto.getRemark())){
return "支出项不能为空";
}
if(StringHelper.isEmpty(dto.getBidCode())){
return "未选择工程";
}
if(StringHelper.isEmpty(dto.getCost())){
return "支出成本不能为空";
}
return null;
}
/**
* 数据校验
* @param dto

View File

@ -85,4 +85,11 @@
where td.device_id=#{deviceId}
</select>
<select id="getDeviceListByType" resultType="com.securitycontrol.entity.background.vo.DeviceVo">
select td.device_id deviceId,device_name deviceName
from tb_device td
left join tb_user_bind_cap ubc on td.device_id=td.device_id and ubc.bind_status=1
WHERE ubc.id is null and td.device_type =#{code} and td.del_flag=0
</select>
</mapper>

View File

@ -67,6 +67,10 @@
<if test="updateTime != null and updateTime!=''">#{updateTime},</if>
</trim>
</insert>
<insert id="bindDev">
insert tb_user_bind_cap(id,people_id,device_id,bind_time,bind_status)
value ( #{id},#{userId},#{devId},now(),1 )
</insert>
<!--删除人员照片资源文件-->
<delete id="delFile">
DELETE FROM tb_resource_file WHERE file_id = #{fileId}
@ -75,6 +79,12 @@
<delete id="delPersonnelById">
DELETE FROM t_team_people WHERE user_id = #{id}
</delete>
<update id="delBind">
update tb_user_bind_cap set bind_status=0 where people_id=#{userId}
</update>
<update id="updateDev">
update tb_user_bind_cap set device_id=#{devId} where id=#{id}
</update>
<!--获取人员列表-->
<select id="getHumanLists" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
SELECT
@ -136,4 +146,15 @@
AND tua.access_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
</select>
<select id="getBindHis" resultType="java.lang.Integer">
select count(1)
from tb_user_bind_cap
where people_id=#{userId} and bind_status=1
</select>
<select id="getBindDetail" resultType="com.securitycontrol.entity.background.dto.ParamDto">
select device_id devId,id
from tb_user_bind_cap
where people_id=#{userId} and bind_status=1
</select>
</mapper>

View File

@ -28,6 +28,10 @@
<insert id="addSwFile" keyProperty="id" useGeneratedKeys="true">
insert into tb_sw_source (bid_code,gt_id,del_flag) value (#{bidCode},#{gtId},0)
</insert>
<!--新增成本-->
<insert id="addCost">
insert into tb_project_cost (bid_code,cost,remark,curry_day,create_time) value (#{bidCode},#{cost},#{remark},#{curryDay},now())
</insert>
<update id="updateData">
update tb_area set area_name=#{areaName},bid_code=#{bidCode},remarks=#{remarks},gt_id=#{gtId},
area_code=#{areaCode},update_time=now(),area_type=#{areaType}
@ -43,9 +47,15 @@
<update id="deleteGt">
update t_pro_gt set del_flag=1 where gt_id=#{gtId}
</update>
<update id="updateCost">
update tb_project_cost set remark=#{remark} , curry_day=#{curryDay},cost=#{cost} where id=#{id}
</update>
<delete id="deleteData">
delete from tb_sw_source where id=#{id}
</delete>
<delete id="deleteCost">
delete from tb_project_cost where id=#{id}
</delete>
<select id="getAreaList" resultMap="AreaMap">
select area_id,area_name,pro.bid_code, remarks,area_code,pro.pro_name,
@ -110,5 +120,12 @@
and sw.gt_id=#{gtId}
</select>
<select id="getProCostList" resultType="com.securitycontrol.entity.screen.vo.ProCostVo">
SELECT pro.pro_name proName,tpc.cost ,tpc.remark,tpc.create_time createTime
FROM tb_project_cost tpc
left join tb_project pro on pro.bid_code=tpc.bid_code
where pro.bid_code=#{bidCode}
</select>
</mapper>