修改路径

This commit is contained in:
haozq 2024-03-26 17:25:06 +08:00
parent 91841998a4
commit 4322f829cd
17 changed files with 535 additions and 5 deletions

View File

@ -33,7 +33,7 @@ public class IdUtils
*
* @return 简化的UUID去掉了横线
*/
public static String uuIds()
public static String getUUId()
{
return UUID.randomuuid().toString(true).toUpperCase();
}

View File

@ -0,0 +1,24 @@
package com.securitycontrol.entity.background.dto;
import lombok.Data;
/**
* @author 黑子
* 班组查询信息表
*/
@Data
public class AreaDto {
/**
* 标段工程编码
*/
private String bidCode;
private String gtCode;
/**
* 工程类型
*/
private String proType;
}

View File

@ -0,0 +1,61 @@
package com.securitycontrol.entity.background.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 区域管理一实体类
* @author 黑子
*/
@Data
public class AreaVo {
/**
* 区域id
*/
private String areaId;
/**
* 区域名称
*/
@NotBlank(message = "区域名称不能为空")
private String areaName;
/**
* 标段名称
*/
private String bidCode;
/**
* 杆塔id
*/
private String gtId;
/**
* 备注
*/
private String remarks;
/**
* 创建时间
*/
private String createTime;
/**
* 更新时间
*/
private String updateTime;
/**
* 工程类型
*/
private String proType;
/**
* 工程名称
*/
private String proName;
/**
* 区域编码
*/
private String areaCode;
/**
* 杆塔名称
*/
private String gtName;
}

View File

@ -0,0 +1,27 @@
package com.securitycontrol.entity.system;
/**
* 系统全局变量配置
*
* 系统常亮配置
* @author 黑子
*/
public class SystemGlobal {
/**
* 线路工程类型
*/
public final static String LINE_TYPE="1";
/**
* 成功数据数量
*/
public final static int SUCCESS_NUM=1;
}

View File

@ -44,4 +44,8 @@ public class SelectVo {
@ApiModelProperty(value = "杆塔ID")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String gtId;
@ApiModelProperty(value = "地市名称")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String cityName;
}

View File

@ -0,0 +1,87 @@
package com.securitycontrol.background.controller;
import com.securitycontrol.background.service.DeviceService;
import com.securitycontrol.background.service.TbAreaService;
import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.dto.DeviceDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import com.securitycontrol.entity.background.vo.DeviceVo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
/**
* 区域管理接口
* @author 黑子
*/
@Slf4j
public class TbAreaController extends BaseController {
@Autowired
private TbAreaService service;
@ApiOperation(value = "获取设备列表")
@GetMapping("getAreaList")
@Log(title = "区域管理", menu = "基础管理->区域管理", grade = OperationType.QUERY_BUSINESS, details = "查询区域列表", type = "业务日志")
public TableDataInfo getAreaList(AreaDto dto) {
try{
startPage();
List<AreaVo> list = service.getAreaList(dto);
return getDataTable(list);
}catch (Exception e){
log.error(e.toString(),e);
return getDataTableBad(new ArrayList<>(),"请求出错了");
}
}
/**
* 新增区域
*
* @param dto
* @return
*/
@PostMapping("addArea")
@Log(title = "新增区域", menu = "基础管理->区域管理", grade = OperationType.QUERY_BUSINESS, details = "新增区域", type = "业务日志")
public Result<String> addArea(@RequestBody @Valid AreaVo dto) {
return service.addArea(dto);
}
/**
* 修改区域
* @param dto
* @return
*/
@PostMapping("updateArea")
@Log(title = "修改区域", menu = "基础管理->区域管理", grade = OperationType.QUERY_BUSINESS, details = "修改区域", type = "业务日志")
public Result<String> updateArea(@RequestBody @Valid AreaVo dto) {
return service.updateArea(dto);
}
/**
* 删除区域
* 批量删除
* @param dto
* @return
*/
@PostMapping("deleteArea")
@Log(title = "修改区域", menu = "基础管理->区域管理", grade = OperationType.QUERY_BUSINESS, details = "删除区域", type = "业务日志")
public Result<String> deleteArea(@RequestBody @Valid AreaVo dto) {
return service.deleteArea(dto);
}
}

View File

@ -0,0 +1,49 @@
package com.securitycontrol.background.mapper;
import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 区域管理接口层
* @author 黑子
*/
@Repository
public interface TbAreaMapper {
/**
* 查询区域集合
* @param dto
* @return
*/
List<AreaVo> getAreaList(AreaDto dto);
/**
* 查询工程类型
* @param bidCode
* @return
*/
String getProjectTypeByBidCode(String bidCode);
/**
* 新增数据接口
* @param dto
* @return
*/
int insertData(AreaVo dto);
/**
* 修改区域管理
* @param dto
* @return
*/
int updateData(AreaVo dto);
/**
* 删除区域
* @param dto
* @return
*/
int deleteArea(AreaVo dto);
}

View File

@ -0,0 +1,43 @@
package com.securitycontrol.background.service;
import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import java.util.List;
/**
* 区域管理 业务接口层
* @author 黑子
*/
public interface TbAreaService {
/**
* 获取区域列表的集合
* @param dto
* @return
*/
List<AreaVo> getAreaList(AreaDto dto);
/**
* 新增区域列表
* @param dto
* @return
*/
Result<String> addArea(AreaVo dto);
/**
* 修改区域
* @param dto
* @return
*/
Result<String> updateArea(AreaVo dto);
/**
* 删除区域接口
* @param dto
* @return
*/
Result<String> deleteArea(AreaVo dto);
}

View File

@ -62,7 +62,7 @@ public class DeviceServiceImpl implements DeviceService {
}
dto.setDelFlag(0);
if(StringHelper.isEmpty(dto.getDeviceId())){
dto.setDeviceId(IdUtils.uuIds());
dto.setDeviceId(IdUtils.getUUId());
Integer num= mapper.insertData(dto);
if(num==1) {
return Result.ok("新增成功","新增成功");

View File

@ -0,0 +1,135 @@
package com.securitycontrol.background.service.impl;
import com.securitycontrol.background.mapper.TbAreaMapper;
import com.securitycontrol.background.service.TbAreaService;
import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.aes.StringHelper;
import com.securitycontrol.common.core.utils.uuid.IdUtils;
import com.securitycontrol.entity.background.dto.AreaDto;
import com.securitycontrol.entity.background.vo.AreaVo;
import com.securitycontrol.entity.system.SystemGlobal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* 区域管理接口处理层
* @author 黑子
*/
@Service
@Slf4j
public class TbAreaServiceImpl implements TbAreaService {
@Autowired
private TbAreaMapper mapper;
@Override
public List<AreaVo> getAreaList(AreaDto dto) {
return mapper.getAreaList(dto);
}
/**
* 新增区域管理
* @param dto
* @return
*/
@Override
public Result<String> addArea(AreaVo dto) {
try{
String result=checkData(dto);
if (StringHelper.isNotEmpty(result)) {
return Result.fail(result);
}
dto.setAreaId(IdUtils.getUUId());
int num=mapper.insertData(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
*/
@Override
public Result<String> updateArea(AreaVo dto) {
try{
String result=checkData(dto);
if (StringHelper.isNotEmpty(result)) {
return Result.fail(result);
}
int num=mapper.updateData(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
*/
@Override
public Result<String> deleteArea(AreaVo dto) {
try{
if(StringHelper.isEmpty(dto.getAreaId())){
return Result.fail("修改失败,条件不能为空!");
}
String ids=dto.getAreaId();
List<String> list= Arrays.asList(ids.split("@"));
AtomicBoolean isDel= new AtomicBoolean(true);
list.forEach(id->{
int num=mapper.deleteArea(dto);
if (num!=SystemGlobal.SUCCESS_NUM){
isDel.set(false);
}
});
if(isDel.get()){
return Result.ok("删除成功","删除成功");
}
return Result.fail("删除失败,请联系管理员!");
}catch (Exception e){
log.error(e.toString(),e);
return Result.fail("系统升级中,请稍后重试!");
}
}
/**
* 数据校验
* @param dto
* @return
*/
public String checkData(AreaVo dto){
String bidCode=dto.getBidCode();
if (StringHelper.isEmpty(bidCode)) {
return "请选择工程";
}
//依据工程编码查询工程类型
String proType=mapper.getProjectTypeByBidCode(bidCode);
//线路工程
if(SystemGlobal.LINE_TYPE.equals(proType)){
if(StringHelper.isEmpty(dto.getGtId())){
return "线路工程必须要选择杆塔";
}
}
return null;
}
}

View File

@ -0,0 +1,46 @@
<?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.securitycontrol.background.mapper.TbAreaMapper">
<resultMap id="AreaMap" type="com.securitycontrol.entity.background.vo.AreaVo">
<id property="areaId" column="area_id"/>
<result property="areaName" column="area_name"/>
<result property="bidCode" column="bid_code"/>
<result property="remarks" column="remarks"/>
<result property="areaCode" column="area_code"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="gtId" column="gt_id"/>
<result property="gtName" column="gt_name"/>
<result property="proName" column="pro_name"/>
</resultMap>
<insert id="insertData">
insert into tb_area(area_id,area_name,bid_code,remarks,
area_code,create_time, gt_id,del_flag)value (
#{areaId},#{areaName},#{bidCode},#{remarks},#{areaCode},now(),#{gtId},0)
</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()
where area_id=#{areaId}
</update>
<update id="deleteArea">
update tb_area set del_flag=1 where area_id=#{areaId}
</update>
<select id="getAreaList" resultType="com.securitycontrol.entity.background.vo.AreaVo">
select area_id,area_name,pro.bid_code, remarks,area_code,pro.pro_name,
area.create_time,area.update_time, area.gt_id,gt.gt_name
from tb_area area
left join tb_project pro on pro.bid_code=area.bid_code
LEFT JOIN t_pro_gt gt on area.gt_id=gt.gt_id
where area.del_flag=0 and pro.del_flag=0 and gt.del_flag=0
</select>
<select id="getProjectTypeByBidCode" resultType="java.lang.String">
select pro_type
from tb_project pro
where pro.del_flag=0 AND pro.bid_code=#{bidCode}
</select>
</mapper>

View File

@ -44,7 +44,7 @@ public class SelectController extends BaseController {
return service.getMenuTree(dto);
}
@ApiOperation(value = "字典下拉选")
@ApiOperation(value = "字典树结构下拉选")
@PostMapping("getDictList")
public AjaxResult getDictList(String code) {
return service.getDictList(code);
@ -62,7 +62,7 @@ public class SelectController extends BaseController {
return service.getBuildLists();
}
@ApiOperation(value = "字典下拉选")
@ApiOperation(value = "字典集合下拉选")
@GetMapping("getDictLists")
public AjaxResult getDictLists(SelectDto dto) {
return service.getDictLists(dto);
@ -97,4 +97,12 @@ public class SelectController extends BaseController {
public AjaxResult getBdLists(SelectDto dto){
return service.getBdLists(dto);
}
@ApiOperation(value = "工程下拉选")
@GetMapping("getProList")
public AjaxResult getProList(SelectDto dto){
return service.getProList(dto);
}
}

View File

@ -130,4 +130,11 @@ public interface ISelectMapper {
* @date 2024/3/25 13:11
*/
List<SelectVo> getBdLists(SelectDto dto);
/**
* 工程下拉选集合
* @param dto
* @return
*/
List<SelectVo> getProList(SelectDto dto);
}

View File

@ -133,4 +133,11 @@ public interface ISelectService {
* @return
*/
AjaxResult getDictSelect(String code);
/**
* 获取工程下拉选
* @param dto
* @return
*/
AjaxResult getProList(SelectDto dto);
}

View File

@ -178,6 +178,22 @@ public class SelectServiceImpl implements ISelectService {
return AjaxResult.success(groupList);
}
/**
* 工程下拉选
* @param dto
* @return
*/
@Override
public AjaxResult getProList(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try{
list=mapper.getProList(dto);
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getBdLists(SelectDto dto) {

View File

@ -109,4 +109,20 @@
</if>
</where>
</select>
<!--工程下拉选-->
<select id="getProList" resultType="com.securitycontrol.entity.system.vo.SelectVo">
select pro.bid_code,pro.pro_name
from tb_project pro
LEFT JOIN sys_build sb on sb.org_id=pro.org
where pro.del_flag =0
<if test="proType!=null and proType!=''">
and pro.pro_type=#{proType}
</if>
<if test="org!=null and org!=''">
and pro.org=#{org}
</if>
<if test="cityName!=null and cityName!=''">
and sb.city_name=#{cityName}
</if>
</select>
</mapper>