diff --git a/bonus-common/src/main/java/com/bonus/common/enums/TableType.java b/bonus-common/src/main/java/com/bonus/common/enums/TableType.java index 5bfcd25..a01adcb 100644 --- a/bonus-common/src/main/java/com/bonus/common/enums/TableType.java +++ b/bonus-common/src/main/java/com/bonus/common/enums/TableType.java @@ -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; diff --git a/search-tool/src/main/java/com/bonus/tool/controller/search/TbSubPerfController.java b/search-tool/src/main/java/com/bonus/tool/controller/search/TbSubPerfController.java new file mode 100644 index 0000000..4f930ca --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/controller/search/TbSubPerfController.java @@ -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 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 tbSubPerfList = tbSubPerfService.getTbSubPerfList(tbSubPerfVo); + ExcelUtil util = new ExcelUtil<>(TbSubPerfVo.class); + util.exportExcel(response, tbSubPerfList, "分包业绩管理"); + }catch (Exception e){ + log.info("导出失败{}",e.getMessage()); + } + } +} diff --git a/search-tool/src/main/java/com/bonus/tool/dto/TbFileSourceVo.java b/search-tool/src/main/java/com/bonus/tool/dto/TbFileSourceVo.java index cdc6b07..cc1fd64 100644 --- a/search-tool/src/main/java/com/bonus/tool/dto/TbFileSourceVo.java +++ b/search-tool/src/main/java/com/bonus/tool/dto/TbFileSourceVo.java @@ -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; diff --git a/search-tool/src/main/java/com/bonus/tool/dto/TbSubPerfVo.java b/search-tool/src/main/java/com/bonus/tool/dto/TbSubPerfVo.java new file mode 100644 index 0000000..48472b3 --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/dto/TbSubPerfVo.java @@ -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 tbCompanyPerfRelList; + + /*** + * 附件集合 + */ + private List tbFileSourceVoList; +} diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/TbSubPerfMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/TbSubPerfMapper.java new file mode 100644 index 0000000..44666bb --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/mapper/TbSubPerfMapper.java @@ -0,0 +1,19 @@ +package com.bonus.tool.mapper; + +import com.bonus.tool.dto.TbSubPerfVo; + +import java.util.List; + +public interface TbSubPerfMapper { + List getTbSubPerfList(TbSubPerfVo tbSubPerfVo); + + TbSubPerfVo getTbSubPerfById(TbSubPerfVo tbSubPerfVo); + + TbSubPerfVo getTbSubPerfByProName(TbSubPerfVo tbSubPerfVo); + + void addTbSubPerf(TbSubPerfVo tbSubPerfVo); + + void updateTbSubPerf(TbSubPerfVo tbSubPerfVo); + + void delTbSubPerf(TbSubPerfVo tbSubPerfVo); +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/TbSubPerfService.java b/search-tool/src/main/java/com/bonus/tool/service/TbSubPerfService.java new file mode 100644 index 0000000..54a8fe5 --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/service/TbSubPerfService.java @@ -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 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; +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java index e924392..6f55e32 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java @@ -146,7 +146,21 @@ public class TbCompanyPerfServiceImpl implements TbCompanyPerfService { } //删除附件信息 tbFileSourceService.delTbFileSource(tbCompanyPerfVo.getId(),TableType.TB_COMPANY_PERF.getCode()); + //获取项目关键人员信息 + List tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByPerfId(tbCompanyPerfVo.getId(),"1"); //删除关键人信息 tbCompanyPerfRelService.delTbCompanyPerRelByPerfId(tbCompanyPerfVo.getId(),"1"); + //删除关键人服务器图片 + if (!tbCompanyPerfRelList.isEmpty()){ + for (TbCompanyPerfRelVo TbCompanyPerfRel:tbCompanyPerfRelList) { + //获取公司业绩管理附件 + List tbFileSourceList = TbCompanyPerfRel.getTbFileSourceVoList(); + if (!tbFileSourceList.isEmpty()){ + for (TbFileSourceVo tbFileSource:tbFileSourceList) { + iSysFileService.deleteFile(tbFileSource.getFilePath()); + } + } + } + } } } diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java new file mode 100644 index 0000000..8bd4c3f --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java @@ -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 getTbSubPerfList(TbSubPerfVo tbSubPerfVo) { + + //获取分包业绩列表 + List tbSubPerfList = tbSubPerfMapper.getTbSubPerfList(tbSubPerfVo); + if(!tbSubPerfList.isEmpty()){ + for (TbSubPerfVo tbSubPerf:tbSubPerfList) { + //获取项目关键人员信息 + List tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByPerfId(tbSubPerf.getId(),"2"); + tbSubPerf.setTbCompanyPerfRelList(tbCompanyPerfRelList); + //获取附件信息 + List 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 tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByPerfId(tbSubPerf.getId(),"2"); + tbSubPerf.setTbCompanyPerfRelList(tbCompanyPerfRelList); + //获取附件信息 + List 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 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"); + } +} diff --git a/search-tool/src/main/resources/mapper/TbSubPerfMapper.xml b/search-tool/src/main/resources/mapper/TbSubPerfMapper.xml new file mode 100644 index 0000000..ff0a0fd --- /dev/null +++ b/search-tool/src/main/resources/mapper/TbSubPerfMapper.xml @@ -0,0 +1,67 @@ + + + + + insert into tb_sub_perf + + sub_id, + pro_name, + cons_unit, + start_time, + end_time, + ht_remark, + money, + create_time, + create_user, + del_flag + + + #{subId}, + #{proName}, + #{consUnit}, + #{startTime}, + #{endTime}, + #{htRemark}, + #{money}, + 0 + + + + update tb_company_perf + + sub_id = #{subId}, + pro_name = #{proName}, + cons_unit = #{consUnit}, + start_time = #{startTime}, + end_time = #{endTime}, + ht_remark = #{htRemark}, + money = #{money}, + update_user = #{updateUser}, + update_time = now() + + where id = #{id} + + + update tb_sub_perf set del_flag = 1 where id = #{id} + + + + + +