分包业绩管理

This commit is contained in:
马三炮 2025-04-24 13:52:51 +08:00
parent d1a4770177
commit 64b8271532
9 changed files with 542 additions and 1 deletions

View File

@ -29,7 +29,12 @@ public enum TableType {
/**
* 分包商人员信息
*/
TB_SUB_PEOPLE("tb_sub_people", "分包商人员信息");
TB_SUB_PEOPLE("tb_sub_people", "分包商人员信息"),
/**
* 分包商业绩信息
*/
TB_SUB_PERF("tb_sub_perf", "分包商业绩信息");
private final String code;
private final String info;

View File

@ -0,0 +1,139 @@
package com.bonus.tool.controller.search;
import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.page.TableDataInfo;
import com.bonus.common.utils.poi.ExcelUtil;
import com.bonus.tool.dto.TbCompanyPerfVo;
import com.bonus.tool.dto.TbSubPerfVo;
import com.bonus.tool.service.TbSubPerfService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 分包业绩管理
* @author 马三炮
* @date 2025/4/24
*/
@RestController
@Slf4j
@RequestMapping("/tbSubPerf")
public class TbSubPerfController extends BaseController {
@Resource
private TbSubPerfService tbSubPerfService;
/**
*分包业绩管理列表查询
* @param
* @return
*/
@ApiOperation(value = "分包业绩管理列表查询")
// @PreAuthorize("@ss.hasPermi('key:people:list')")
@GetMapping("/getTbSubPerfList")
public TableDataInfo getTbSubPerfList(TbSubPerfVo tbSubPerfVo) {
try {
startPage();
List<TbSubPerfVo> tbSubPerfList = tbSubPerfService.getTbSubPerfList(tbSubPerfVo);
return getDataTable(tbSubPerfList);
}catch (Exception e){
log.info("分包业绩管理列表失败{}",e.getMessage());
return getDataTableError(null);
}
}
/**
* 分包业绩管理详情
* @param
* @return
*/
@ApiOperation(value = "分包业绩管理详情")
// @PreAuthorize("@ss.hasPermi('key:people:query')")
@PostMapping("/getTbSubPerfById")
public AjaxResult getTbSubPerfById(@RequestBody TbSubPerfVo tbSubPerfVo) {
try {
TbSubPerfVo tbSubPerf = tbSubPerfService.getTbSubPerfById(tbSubPerfVo);
return success(tbSubPerf);
}catch (Exception e){
log.info("分包业绩管理详情失败{}",e.getMessage());
return error("分包业绩管理详情失败");
}
}
/**
* 分包业绩管理新增
* @param
* @return
*/
@ApiOperation(value = "分包业绩管理新增")
// @PreAuthorize("@ss.hasPermi('key:people:add')")
@PostMapping("/addTbSubPerf")
public AjaxResult addTbSubPerf(@RequestBody TbSubPerfVo tbSubPerfVo) {
try {
tbSubPerfService.addTbSubPerf(tbSubPerfVo);
return success("新增分包业绩管理成功");
}catch (Exception e){
log.info("新增分包业绩管理失败{}",e.getMessage());
return error(e.getMessage());
}
}
/**
* 分包业绩管理修改
* @param
* @return
*/
@ApiOperation(value = "分包业绩管理修改")
// @PreAuthorize("@ss.hasPermi('key:people:add')")
@PostMapping("/updateTbSubPerf")
public AjaxResult updateTbSubPerf(@RequestBody TbSubPerfVo tbSubPerfVo) {
try {
tbSubPerfService.updateTbSubPerf(tbSubPerfVo);
return success("修改分包业绩管理成功");
}catch (Exception e){
log.info("修改分包业绩管理失败{}",e.getMessage());
return error(e.getMessage());
}
}
/**
* 分包业绩管理删除
* @param
* @return
*/
@ApiOperation(value = "分包业绩管理删除")
// @PreAuthorize("@ss.hasPermi('key:people:add')")
@PostMapping("/delTbSubPerf")
public AjaxResult delTbSubPerf(@RequestBody TbSubPerfVo tbSubPerfVo) {
try {
tbSubPerfService.delTbSubPerf(tbSubPerfVo);
return success("删除分包业绩管理成功");
}catch (Exception e){
log.info("删除分包业绩管理失败{}",e.getMessage());
return error(e.getMessage());
}
}
/**
* 分包业绩管理导出
* @param
* @return
*/
@ApiOperation(value = "分包业绩管理导出")
// @PreAuthorize("@ss.hasPermi('key:people:del')")
@PostMapping("/tbSubPerfExport")
public void tbSubPerfExport(HttpServletResponse response, TbSubPerfVo tbSubPerfVo) {
try {
List<TbSubPerfVo> tbSubPerfList = tbSubPerfService.getTbSubPerfList(tbSubPerfVo);
ExcelUtil<TbSubPerfVo> util = new ExcelUtil<>(TbSubPerfVo.class);
util.exportExcel(response, tbSubPerfList, "分包业绩管理");
}catch (Exception e){
log.info("导出失败{}",e.getMessage());
}
}
}

View File

@ -40,6 +40,7 @@ public class TbFileSourceVo {
* tb_company_perf_rel 1业绩证明
* tb_sub 1:公司资质
* tb_sub_people 1:身份证正面2:身份证反面3:资格证4:其他资质
* tb_sub_perf 1:合同
*/
private String fileType;

View File

@ -0,0 +1,98 @@
package com.bonus.tool.dto;
import com.bonus.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author 马三炮
* @date 2025/4/24
*/
@Data
public class TbSubPerfVo {
/**
* 主键
*/
private Long id;
/**
* 分包商id
*/
private Long subId;
/**
* 项目名称
*/
@Excel(name = "项目名称", sort = 1)
private String proName;
/**
* 建设单位
*/
@Excel(name = "建设单位", sort = 2)
private String consUnit;
/**
* 开始时间
*/
@Excel(name = "开始时间", sort = 4)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String startTime;
/**
* 结束时间
*/
@Excel(name = "结束时间", sort = 5)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String endTime;
/**
* 合同身份
*/
@Excel(name = "合同身份", sort = 6)
private String htRemark;
/**
* 分包合同金额(万元)
*/
@Excel(name = "分包合同金额(万元)", sort = 3)
private BigDecimal money;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 创建人
*/
private String createUser;
/**
* 修改人
*/
private String updateUser;
/**
* 关键人员列表
*/
List<TbCompanyPerfRelVo> tbCompanyPerfRelList;
/***
* 附件集合
*/
private List<TbFileSourceVo> tbFileSourceVoList;
}

View File

@ -0,0 +1,19 @@
package com.bonus.tool.mapper;
import com.bonus.tool.dto.TbSubPerfVo;
import java.util.List;
public interface TbSubPerfMapper {
List<TbSubPerfVo> getTbSubPerfList(TbSubPerfVo tbSubPerfVo);
TbSubPerfVo getTbSubPerfById(TbSubPerfVo tbSubPerfVo);
TbSubPerfVo getTbSubPerfByProName(TbSubPerfVo tbSubPerfVo);
void addTbSubPerf(TbSubPerfVo tbSubPerfVo);
void updateTbSubPerf(TbSubPerfVo tbSubPerfVo);
void delTbSubPerf(TbSubPerfVo tbSubPerfVo);
}

View File

@ -0,0 +1,42 @@
package com.bonus.tool.service;
import com.bonus.tool.dto.TbSubPerfVo;
import java.util.List;
public interface TbSubPerfService {
/**
*分包业绩管理列表查询
* @param
* @return
*/
List<TbSubPerfVo> getTbSubPerfList(TbSubPerfVo tbSubPerfVo);
/**
* 分包业绩管理详情
* @param
* @return
*/
TbSubPerfVo getTbSubPerfById(TbSubPerfVo tbSubPerfVo);
/**
* 分包业绩管理新增
* @param
* @return
*/
void addTbSubPerf(TbSubPerfVo tbSubPerfVo);
/**
* 分包业绩管理修改
* @param
* @return
*/
void updateTbSubPerf(TbSubPerfVo tbSubPerfVo);
/**
* 分包业绩管理删除
* @param
* @return
*/
void delTbSubPerf(TbSubPerfVo tbSubPerfVo) throws Exception;
}

View File

@ -146,7 +146,21 @@ public class TbCompanyPerfServiceImpl implements TbCompanyPerfService {
}
//删除附件信息
tbFileSourceService.delTbFileSource(tbCompanyPerfVo.getId(),TableType.TB_COMPANY_PERF.getCode());
//获取项目关键人员信息
List<TbCompanyPerfRelVo> tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByPerfId(tbCompanyPerfVo.getId(),"1");
//删除关键人信息
tbCompanyPerfRelService.delTbCompanyPerRelByPerfId(tbCompanyPerfVo.getId(),"1");
//删除关键人服务器图片
if (!tbCompanyPerfRelList.isEmpty()){
for (TbCompanyPerfRelVo TbCompanyPerfRel:tbCompanyPerfRelList) {
//获取公司业绩管理附件
List<TbFileSourceVo> tbFileSourceList = TbCompanyPerfRel.getTbFileSourceVoList();
if (!tbFileSourceList.isEmpty()){
for (TbFileSourceVo tbFileSource:tbFileSourceList) {
iSysFileService.deleteFile(tbFileSource.getFilePath());
}
}
}
}
}
}

View File

@ -0,0 +1,156 @@
package com.bonus.tool.service.impl;
import com.bonus.common.enums.TableType;
import com.bonus.common.exception.ServiceException;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.common.utils.StringUtils;
import com.bonus.system.service.ISysFileService;
import com.bonus.tool.dto.TbCompanyPerfRelVo;
import com.bonus.tool.dto.TbCompanyPerfVo;
import com.bonus.tool.dto.TbFileSourceVo;
import com.bonus.tool.dto.TbSubPerfVo;
import com.bonus.tool.mapper.TbSubPerfMapper;
import com.bonus.tool.service.TbCompanyPerfRelService;
import com.bonus.tool.service.TbFileSourceService;
import com.bonus.tool.service.TbSubPerfService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @author 马三炮
* @date 2025/4/24
*/
@Service
@Slf4j
public class TbSubPerfServiceImpl implements TbSubPerfService {
@Resource
private TbSubPerfMapper tbSubPerfMapper;
@Resource
private TbCompanyPerfRelService tbCompanyPerfRelService;
@Resource
private TbFileSourceService tbFileSourceService;
@Resource
private ISysFileService iSysFileService;
/**
*分包业绩管理列表查询
* @param
* @return
*/
@Override
public List<TbSubPerfVo> getTbSubPerfList(TbSubPerfVo tbSubPerfVo) {
//获取分包业绩列表
List<TbSubPerfVo> tbSubPerfList = tbSubPerfMapper.getTbSubPerfList(tbSubPerfVo);
if(!tbSubPerfList.isEmpty()){
for (TbSubPerfVo tbSubPerf:tbSubPerfList) {
//获取项目关键人员信息
List<TbCompanyPerfRelVo> tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByPerfId(tbSubPerf.getId(),"2");
tbSubPerf.setTbCompanyPerfRelList(tbCompanyPerfRelList);
//获取附件信息
List<TbFileSourceVo> tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbSubPerf.getId(), TableType.TB_SUB_PERF.getCode());
tbSubPerf.setTbFileSourceVoList(tbFileSourceVoList);
}
}
return tbSubPerfList;
}
/**
* 分包业绩管理详情
* @param
* @return
*/
@Override
public TbSubPerfVo getTbSubPerfById(TbSubPerfVo tbSubPerfVo) {
//获取分包业绩列表
TbSubPerfVo tbSubPerf = tbSubPerfMapper.getTbSubPerfById(tbSubPerfVo);
//获取项目关键人员信息
List<TbCompanyPerfRelVo> tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByPerfId(tbSubPerf.getId(),"2");
tbSubPerf.setTbCompanyPerfRelList(tbCompanyPerfRelList);
//获取附件信息
List<TbFileSourceVo> tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbSubPerf.getId(), TableType.TB_SUB_PERF.getCode());
tbSubPerf.setTbFileSourceVoList(tbFileSourceVoList);
return tbSubPerf;
}
/**
* 分包业绩管理新增
* @param
* @return
*/
@Override
@Transactional
public void addTbSubPerf(TbSubPerfVo tbSubPerfVo) {
TbSubPerfVo tbSubPerfOld = tbSubPerfMapper.getTbSubPerfByProName(tbSubPerfVo);
if (StringUtils.isNotNull(tbSubPerfOld)){
throw new ServiceException("项目已存在");
}
tbSubPerfVo.setCreateUser(SecurityUtils.getLoginUser().getUsername());
tbSubPerfVo.setCreateTime(new Date());
tbSubPerfMapper.addTbSubPerf(tbSubPerfVo);
tbFileSourceService.addTbFileSource(tbSubPerfVo.getTbFileSourceVoList(),tbSubPerfVo.getId(), TableType.TB_SUB_PERF.getCode());
//保存关键人信息
tbCompanyPerfRelService.addTbCompanyPerRelList(tbSubPerfVo.getTbCompanyPerfRelList(),tbSubPerfVo.getId(),"2");
}
/**
* 分包业绩管理修改
* @param
* @return
*/
@Override
@Transactional
public void updateTbSubPerf(TbSubPerfVo tbSubPerfVo) {
try {
TbSubPerfVo tbSubPerfOld = tbSubPerfMapper.getTbSubPerfByProName(tbSubPerfVo);
if (StringUtils.isNotNull(tbSubPerfOld) && !tbSubPerfOld.getId().equals(tbSubPerfOld.getId()) ){
throw new ServiceException("项目已存在");
}
tbSubPerfVo.setUpdateUser(SecurityUtils.getLoginUser().getUsername());
tbSubPerfMapper.updateTbSubPerf(tbSubPerfVo);
tbFileSourceService.delTbFileSource(tbSubPerfVo.getId(),TableType.TB_SUB_PERF.getCode());
tbFileSourceService.addTbFileSource(tbSubPerfVo.getTbFileSourceVoList(),tbSubPerfVo.getId(),TableType.TB_SUB_PERF.getCode());
//删除关键人信息
tbCompanyPerfRelService.delTbCompanyPerRelByPerfId(tbSubPerfVo.getId(),"1");
//保存关键人信息
tbCompanyPerfRelService.addTbCompanyPerRelList(tbSubPerfVo.getTbCompanyPerfRelList(),tbSubPerfVo.getId(),"2");
}catch (Exception e){
log.error("分包业绩管理修改失败{}",e.getMessage());
throw new ServiceException(e.getMessage());
}
}
/**
* 分包业绩管理删除
* @param
* @return
*/
@Override
public void delTbSubPerf(TbSubPerfVo tbSubPerfVo) throws Exception {
//公司业绩管理删除
tbSubPerfMapper.delTbSubPerf(tbSubPerfVo);
//获取公司业绩管理附件
List<TbFileSourceVo> tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbSubPerfVo.getId(),TableType.TB_SUB_PERF.getCode());
//删除服务器图片
if (!tbFileSourceVoList.isEmpty()){
for (TbFileSourceVo tbFileSource:tbFileSourceVoList) {
iSysFileService.deleteFile(tbFileSource.getFilePath());
}
}
//删除附件信息
tbFileSourceService.delTbFileSource(tbSubPerfVo.getId(),TableType.TB_SUB_PERF.getCode());
//删除关键人信息
tbCompanyPerfRelService.delTbCompanyPerRelByPerfId(tbSubPerfVo.getId(),"2");
}
}

View File

@ -0,0 +1,67 @@
<?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.bonus.tool.mapper.TbSubPerfMapper">
<insert id="addTbSubPerf" useGeneratedKeys="true" keyProperty="id">
insert into tb_sub_perf
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="subId != null and subId != ''">sub_id,</if>
<if test="proName != null and proName != ''">pro_name,</if>
<if test="consUnit != null ">cons_unit,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null ">end_time,</if>
<if test="htRemark != null and htRemark != ''">ht_remark,</if>
<if test="money != null ">money,</if>
<if test="createTime != null ">create_time,</if>
<if test="createUser != null and createUser != ''">create_user,</if>
del_flag
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="subId != null and subId != ''">#{subId},</if>
<if test="proName != null and proName != ''">#{proName},</if>
<if test="consUnit != null ">#{consUnit},</if>
<if test="startTime != null ">#{startTime},</if>
<if test="endTime != null ">#{endTime},</if>
<if test="htRemark != null and htRemark != ''">#{htRemark},</if>
<if test="money != null ">#{money},</if>
0
</trim>
</insert>
<update id="updateTbSubPerf">
update tb_company_perf
<trim prefix="SET" suffixOverrides=",">
<if test="subId != null">sub_id = #{subId},</if>
<if test="proName != null">pro_name = #{proName},</if>
<if test="consUnit != null">cons_unit = #{consUnit},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="htRemark != null">ht_remark = #{htRemark},</if>
<if test="money != null">money = #{money},</if>
<if test="updateUser != null">update_user = #{updateUser},</if>
update_time = now()
</trim>
where id = #{id}
</update>
<delete id="delTbSubPerf">
update tb_sub_perf set del_flag = 1 where id = #{id}
</delete>
<select id="getTbSubPerfList" resultType="com.bonus.tool.dto.TbSubPerfVo">
select id as id,sub_id as subId,pro_name as proName,cons_unit as consUnit,start_time as startTime,
end_time as endTime,ht_remark as htRemark,money as money
from tb_sub_perf where del_flag=0
<if test="proName != '' and proName != null">and pro_name = #{proName}</if>
<if test="startTime != null"> and start_time >= STR_TO_DATE(#{startTime}, '%Y-%m-%d')</if>
<if test="endTime != null"> and STR_TO_DATE(#{endTime}, '%Y-%m-%d ') >= end_time </if>
</select>
<select id="getTbSubPerfById" resultType="com.bonus.tool.dto.TbSubPerfVo">
select id as id,sub_id as subId,pro_name as proName,cons_unit as consUnit,start_time as startTime,
end_time as endTime,ht_remark as htRemark,money as money
from tb_sub_perf where id=#{id}
</select>
<select id="getTbSubPerfByProName" resultType="com.bonus.tool.dto.TbSubPerfVo">
select id as id,sub_id as subId,pro_name as proName,cons_unit as consUnit,start_time as startTime,
end_time as endTime,ht_remark as htRemark,money as money
from tb_sub_perf where pro_name=#{proName} and sub_id=#{subId} and del_flag=0
</select>
</mapper>