工程管理

This commit is contained in:
cwchen 2024-03-11 14:52:40 +08:00
parent b3ed7c5967
commit 4324d5c731
9 changed files with 516 additions and 3 deletions

View File

@ -0,0 +1,19 @@
package com.securitycontrol.entity.system.base.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @authorcwchen
* @date2024-03-11-10:52
* @version1.0
* @description工程-dto
*/
@Data
public class ProDto {
@ApiModelProperty(value = "工程ID")
private String proId;
}

View File

@ -0,0 +1,10 @@
package com.securitycontrol.entity.system.base.dto;
/**
* @authorcwchen
* @date2024-03-11-14:45
* @version1.0
* @description工程工序计划-dto
*/
public class ProGxPlanDto {
}

View File

@ -0,0 +1,10 @@
package com.securitycontrol.entity.system.base.vo;
/**
* @authorcwchen
* @date2024-03-11-14:46
* @version1.0
* @description工程工序计划-vo
*/
public class ProGxPlanVo {
}

View File

@ -0,0 +1,88 @@
package com.securitycontrol.entity.system.base.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @authorcwchen
* @date2024-03-11-10:52
* @version1.0
* @description工程-vo
*/
@Data
public class ProVo {
@ApiModelProperty(value = "工程ID")
private String proId;
@ApiModelProperty(value = "建管单位")
private String org;
@ApiModelProperty(value = "登录用户id")
private Integer userId;
@ApiModelProperty(value = "标段工程编码")
private String bidCode;
@ApiModelProperty(value = "单项工程编码")
private String signCode;
@ApiModelProperty(value = "工程编码")
private String proCode;
@ApiModelProperty(value = "工程名称")
private String proName;
@ApiModelProperty(value = "工程成本")
private String proCost;
@ApiModelProperty(value = "施工单位")
private String sgUnit;
@ApiModelProperty(value = "监理单位")
private String jlUnit;
@ApiModelProperty(value = "工程类型")
private String proType;
@ApiModelProperty(value = "工程规模")
private String proScale;
@ApiModelProperty(value = "项目经理")
private String manager;
@ApiModelProperty(value = "工程简介")
private String proBrief;
@ApiModelProperty(value = "当前工序")
private String nowGx;
@ApiModelProperty(value = "工程状态")
private String status;
@ApiModelProperty(value = "计划开始时间")
private String planStartTime;
@ApiModelProperty(value = "计划结束时间")
private String planEndTime;
@ApiModelProperty(value = "实际开始时间")
private String startTime;
@ApiModelProperty(value = "实际竣工时间")
private String endTime;
@ApiModelProperty(value = "工程图片数量")
private int proImgFileNum;
@ApiModelProperty(value = "平面图数量")
private int proFileNum;
@ApiModelProperty(value = "类型 1.新增 2.修改")
private int type;
@ApiModelProperty(value = "类型")
private boolean flag;
}

View File

@ -1,10 +1,20 @@
package com.securitycontrol.system.base.controller; package com.securitycontrol.system.base.controller;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.domain.AjaxResult;
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.system.base.dto.ProDto;
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
import com.securitycontrol.entity.system.base.vo.ProVo;
import com.securitycontrol.system.base.service.IProService; import com.securitycontrol.system.base.service.IProService;
import org.springframework.web.bind.annotation.RequestMapping; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/** /**
* @authorcwchen * @authorcwchen
@ -14,8 +24,51 @@ import javax.annotation.Resource;
*/ */
@RestController @RestController
@RequestMapping("/sys/pro/") @RequestMapping("/sys/pro/")
public class ProController { public class ProController extends BaseController {
@Resource(name = "IProService") @Resource(name = "IProService")
private IProService service; private IProService service;
@ApiOperation(value = "获取工程列表")
@GetMapping("getProLists")
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.QUERY_BUSINESS, details = "查询功能", type = "业务日志")
public TableDataInfo getProLists(ProDto dto) {
startPage();
List<ProVo> list = service.getProLists(dto);
return getDataTable(list);
}
@ApiOperation(value = "新增工程")
@PostMapping("addPro")
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.ADD_BUSINESS, details = "新增工程", type = "业务日志")
public AjaxResult addPro(@Valid @RequestBody ProVo vo) {
return service.addOrUpdatePro(vo);
}
@ApiOperation(value = "修改工程")
@PostMapping("editPro")
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.UPDATE_BUSINESS, details = "修改工程", type = "业务日志")
public AjaxResult editPro(@Valid @RequestBody ProVo vo) {
return service.addOrUpdatePro(vo);
}
@ApiOperation(value = "工程详情")
@GetMapping("getProById")
public AjaxResult getProById(ProDto dto) {
return service.getProById(dto);
}
@ApiOperation(value = "删除工程")
@PostMapping("delPro")
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.DELETE_BUSINESS, details = "删除工程", type = "业务日志")
public AjaxResult delPro(ProDto dto) {
return service.delPro(dto);
}
@ApiOperation(value = "删除工程工序计划")
@PostMapping("delProGxPlan")
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.DELETE_BUSINESS, details = "删除工程工序计划", type = "业务日志")
public AjaxResult delProGxPlan(ProGxPlanDto dto) {
return service.delProGxPlan(dto);
}
} }

View File

@ -1,7 +1,12 @@
package com.securitycontrol.system.base.mapper; package com.securitycontrol.system.base.mapper;
import com.securitycontrol.entity.system.base.dto.ProDto;
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
import com.securitycontrol.entity.system.base.vo.ProVo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @authorcwchen * @authorcwchen
* @date2024-03-11-10:11 * @date2024-03-11-10:11
@ -10,4 +15,65 @@ import org.springframework.stereotype.Repository;
*/ */
@Repository(value = "IProMapper") @Repository(value = "IProMapper")
public interface IProMapper { public interface IProMapper {
/**
* 获取工程列表
*
* @param dto
* @return List<RoleVo>
* @description 获取工程列表
* @author cwchen
* @date 2024/3/11 11:00
*/
List<ProVo> getProLists(ProDto dto);
/**
* 工程图片/平面图数量
*
* @param proId
* @return List<Integer>
* @description
* @author cwchen
* @date 2024/3/11 13:45
*/
List<Integer> getProFiles(String proId);
/**
* 新增/修改 工程
*
* @param vo
* @description
* @author cwchen
* @date 2024/3/11 14:08
*/
void addOrUpdatePro(ProVo vo);
/**
* 工程详情
*
* @param dto
* @return
* @description
* @author cwchen
* @date 2024/3/11 14:28
*/
ProVo getProById(ProDto dto);
/**
* 删除工程
*
* @param dto
* @description
* @author cwchen
* @date 2024/3/11 14:42
*/
void delPro(ProDto dto);
/**
* 删除工程工序计划
* @param dto
* @description
* @author cwchen
* @date 2024/3/11 14:47
*/
void delProGxPlan(ProGxPlanDto dto);
} }

View File

@ -1,5 +1,12 @@
package com.securitycontrol.system.base.service; package com.securitycontrol.system.base.service;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.system.base.dto.ProDto;
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
import com.securitycontrol.entity.system.base.vo.ProVo;
import java.util.List;
/** /**
* @authorcwchen * @authorcwchen
* @date2024-03-11-10:10 * @date2024-03-11-10:10
@ -7,4 +14,58 @@ package com.securitycontrol.system.base.service;
* @description工程管理-业务层 * @description工程管理-业务层
*/ */
public interface IProService { public interface IProService {
/**
* 获取工程列表
*
* @param dto
* @return List<UserVo>
* @description 获取工程列表
* @author cwchen
* @date 2024/3/11 10:59
*/
List<ProVo> getProLists(ProDto dto);
/**
* 新增/修改工程
*
* @param vo
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/11 14:01
*/
AjaxResult addOrUpdatePro(ProVo vo);
/**
* 工程详情
*
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/11 14:26
*/
AjaxResult getProById(ProDto dto);
/**
* 删除工程
*
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/11 14:38
*/
AjaxResult delPro(ProDto dto);
/**
* 删除工程工序计划
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/11 14:47
*/
AjaxResult delProGxPlan(ProGxPlanDto dto);
} }

View File

@ -1,10 +1,20 @@
package com.securitycontrol.system.base.service.impl; package com.securitycontrol.system.base.service.impl;
import com.securitycontrol.common.core.utils.StringUtils;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.system.base.dto.ProDto;
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
import com.securitycontrol.entity.system.base.vo.ProVo;
import com.securitycontrol.system.base.mapper.IProMapper; import com.securitycontrol.system.base.mapper.IProMapper;
import com.securitycontrol.system.base.service.IProService; import com.securitycontrol.system.base.service.IProService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/** /**
* @authorcwchen * @authorcwchen
@ -13,8 +23,73 @@ import javax.annotation.Resource;
* @description工程管理-业务逻辑层 * @description工程管理-业务逻辑层
*/ */
@Service(value = "IProService") @Service(value = "IProService")
@Slf4j
public class ProServiceImpl implements IProService { public class ProServiceImpl implements IProService {
@Resource(name = "IProMapper") @Resource(name = "IProMapper")
private IProMapper mapper; private IProMapper mapper;
@Override
public List<ProVo> getProLists(ProDto dto) {
List<ProVo> list = new ArrayList<>();
list.forEach(item -> {
List<Integer> fileNums = mapper.getProFiles(item.getProId());
item.setProImgFileNum(fileNums.get(0));
item.setProFileNum(fileNums.get(1));
});
list = mapper.getProLists(dto);
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult addOrUpdatePro(ProVo vo) {
try {
if (StringUtils.isBlank(vo.getProId())) {
} else {
}
mapper.addOrUpdatePro(vo);
} catch (Exception e) {
log.error("新增/修改工程", e);
//手动回滚异常
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
return AjaxResult.success();
}
@Override
public AjaxResult getProById(ProDto dto) {
ProVo vo = new ProVo();
vo = mapper.getProById(dto);
return AjaxResult.success(vo);
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult delPro(ProDto dto) {
try {
mapper.delPro(dto);
} catch (Exception e) {
log.error("删除工程",e);
//手动回滚异常
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return AjaxResult.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult delProGxPlan(ProGxPlanDto dto) {
try {
mapper.delProGxPlan(dto);
} catch (Exception e) {
log.error("删除工程工序计划",e);
//手动回滚异常
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return AjaxResult.success();
}
} }

View File

@ -1,5 +1,136 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.securitycontrol.system.base.mapper.IProMapper"> <mapper namespace="com.securitycontrol.system.base.mapper.IProMapper">
<!--新增/修改 工程-->
<insert id="addOrUpdatePro">
<if test="type == 1">
INSERT INTO tb_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="proId != null and proId != ''">pro_id,</if>
<if test="userId != null">user_id,</if>
<if test="signCode != null and signCode!=''">sign_code,</if>
<if test="bidCode != null and bidCode!=''">bid_code,</if>
<if test="proCode != null and proCode!=''">pro_code,</if>
<if test="proName != null and proName!=''">pro_name,</if>
<if test="proCost != null and proCost!=''">pro_cost,</if>
<if test="sgUnit != null and sgUnit!=''">sg_unit,</if>
<if test="jlUnit != null and jlUnit!=''">jl_unit,</if>
<if test="proType != null and proType!=''">pro_type,</if>
<if test="proScale != null and proScale!=''">pro_scale,</if>
<if test="manager != null and manager!=''">manager,</if>
<if test="proBrief != null and proBrief!=''">pro_brief,</if>
<if test="nowGx != null and nowGx!=''">now_gx,</if>
<if test="status != null and status!=''">status,</if>
<if test="planStartTime != null and planStartTime!=''">plan_start_time,</if>
<if test="planEndTime != null and planEndTime!=''">plan_end_time,</if>
<if test="startTime != null and startTime!=''">start_time,</if>
<if test="endTime != null and endTime!=''">end_time,</if>
<if test="org != null and org!=''">org,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="proId != null and proId != ''">#{proId},</if>
<if test="userId != null">#{userId},</if>
<if test="signCode != null and signCode!=''">#{signCode},</if>
<if test="bidCode != null and bidCode!=''">#{bidCode},</if>
<if test="proCode != null and proCode!=''">#{proCode},</if>
<if test="proName != null and proName != ''">#{proName},</if>
<if test="proCost != null and proCost!=''">#{proCost},</if>
<if test="sgUnit != null and sgUnit!=''">#{sgUnit},</if>
<if test="jlUnit != null and jlUnit!=''">#{jlUnit},</if>
<if test="proType != null and proType!=''">#{proType},</if>
<if test="proScale != null and proScale != ''">#{proScale},</if>
<if test="manager != null and manager!=''">#{manager},</if>
<if test="proBrief != null and proBrief!=''">#{proBrief},</if>
<if test="nowGx != null and nowGx!=''">#{nowGx},</if>
<if test="status != null and status!=''">#{status},</if>
<if test="planStartTime != null and planStartTime != ''">#{planStartTime},</if>
<if test="planEndTime != null and planEndTime!=''">#{planEndTime},</if>
<if test="startTime != null and startTime!=''">#{startTime},</if>
<if test="endTime != null and endTime!=''">#{endTime},</if>
<if test="org != null and org!=''">#{org},</if>
</trim>
</if>
<if test="type == 2">
UPDATE tb_project
<set>
<if test="userId != null">user_id = #{userId},</if>
<if test="signCode != null and signCode != ''">sign_code = #{signCode},</if>
<if test="bidCode != null and bidCode != ''">bid_code = #{bidCode},</if>
<if test="proCode != null and proCode != ''">pro_code = #{proCode},</if>
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="proCost != null and proCost != ''">pro_cost = #{proCost},</if>
<if test="sgUnit != null and sgUnit != ''">sg_unit = #{sgUnit},</if>
<if test="jlUnit != null and jlUnit != ''">jl_unit = #{jlUnit},</if>
<if test="proType != null and proType != ''">pro_type = #{proType},</if>
<if test="proScale != null and proScale != ''">pro_scale = #{proScale},</if>
<if test="manager != null and manager != ''">manager = #{manager},</if>
<if test="nowGx != null and nowGx != ''">now_gx = #{nowGx},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="planStartTime != null and planStartTime != ''">plan_start_time = #{planStartTime},</if>
<if test="planEndTime != null and planEndTime != ''">plan_end_time = #{planEndTime},</if>
<if test="startTime != null and startTime != ''">start_time = #{startTime},</if>
<if test="endTime != null and endTime != ''">end_time = #{endTime},</if>
<if test="org != null and org != ''">org = #{org},</if>
</set>
WHERE pro_id = #{proId}
</if>
</insert>
<!--删除工程-->
<delete id="delPro">
</delete>
<!--删除工程工序计划-->
<delete id="delProGxPlan">
DELETE FROM tb_gx_plan WHERE
</delete>
<!--获取工程列表-->
<select id="getProLists" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
SELECT tp.pro_id AS proId,
sb.city_name AS org,
tp.pro_name AS proName,
tp.pro_type AS proType,
tp.pro_scale AS proScale,
tp.jl_unit AS jlUnit,
tp.sg_unit AS sgUnit,
tp.manager AS manager,
tp.plan_start_time AS planStartTime,
tp.plan_end_time AS planEndTime,
tp.start_time AS startTime,
tp.end_time AS endTime,
tp.pro_cost AS proCost,
tp.pro_brief AS proBrief,
tp.status
FROM tb_project tp
LEFT JOIN sys_build sb ON tp.org = sb.org_id
</select>
<!--工程图片/平面图数量-->
<select id="getProFiles" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_resource_file WHERE source_id = #{proId} AND file_type = 0
UNION ALL
SELECT COUNT(*) FROM tb_resource_file WHERE source_id = #{proId} AND file_type = 1
</select>
<!--工程详情-->
<select id="getProById" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
SELECT tp.pro_id AS proId,
tp.user_id AS userId,
tp.sign_code AS signCode,
tp.bid_code AS bidCode,
tp.pro_code AS proCode,
tp.pro_name AS proName,
tp.pro_cost AS proCost,
tp.sg_unit AS sgUnit,
tp.jl_unit AS jlUnit,
tp.pro_type AS proType,
tp.pro_scale AS proScale,
tp.manager AS manager,
tp.pro_brief AS proBrief,
tp.now_gx AS nowGx,
tp.status,
tp.plan_start_time AS planStartTime,
tp.plan_end_time AS planEndTime,
tp.start_time AS startTime,
tp.end_time AS endTime
FROM tb_project tp
</select>
</mapper> </mapper>