From 380ac1764eecf34136b8b4bcd2aba747dda3f09b Mon Sep 17 00:00:00 2001 From: fl <3098731433@qq.com> Date: Sun, 27 Apr 2025 14:12:17 +0800 Subject: [PATCH] =?UTF-8?q?EPC=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/controller/search/EpcController.java | 118 +++++++++++++ .../java/com/bonus/tool/mapper/EpcMapper.java | 98 ++++++++++ .../com/bonus/tool/service/EpcService.java | 44 +++++ .../tool/service/impl/EpcServiceImpl.java | 158 +++++++++++++++++ .../src/main/resources/mapper/EpcMapper.xml | 167 ++++++++++++++++++ 5 files changed, 585 insertions(+) create mode 100644 search-tool/src/main/java/com/bonus/tool/controller/search/EpcController.java create mode 100644 search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java create mode 100644 search-tool/src/main/java/com/bonus/tool/service/EpcService.java create mode 100644 search-tool/src/main/java/com/bonus/tool/service/impl/EpcServiceImpl.java create mode 100644 search-tool/src/main/resources/mapper/EpcMapper.xml diff --git a/search-tool/src/main/java/com/bonus/tool/controller/search/EpcController.java b/search-tool/src/main/java/com/bonus/tool/controller/search/EpcController.java new file mode 100644 index 0000000..f00f6d2 --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/controller/search/EpcController.java @@ -0,0 +1,118 @@ +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.tool.dto.TbGwModelDto; +import com.bonus.tool.dto.TbGwModelVo; +import com.bonus.tool.service.EpcService; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * Epc模版 + * @author fly + * @date 2025/4/27 + */ +@RestController +@Slf4j +@RequestMapping("/epc") +public class EpcController extends BaseController { + + @Resource + private EpcService service; + + /** + *Epc模版列表查询 + * @param + * @return + */ + @ApiOperation(value = "Epc模版列表查询") + // @PreAuthorize("@ss.hasPermi('key:people:list')") + @GetMapping("/getEpcList") + public TableDataInfo getEpcList(TbGwModelDto bean) { + try { + startPage(); + List list = service.getEpcList(bean); + return getDataTable(list); + }catch (Exception e){ + log.info("Epc模版列表失败{}",e.getMessage()); + return getDataTableError(null); + } + } + + + /** + * Epc模版新增 + * @param + * @return + */ + @ApiOperation(value = "Epc模版新增") + // @PreAuthorize("@ss.hasPermi('key:people:list')") + @PostMapping("/addEpcTemp") + public AjaxResult addEpcTemp(@RequestBody TbGwModelDto o) { + try { + return service.addEpcTemp(o); + }catch (Exception e){ + log.info("Epc模版新增失败{}",e.getMessage()); + return error(e.getMessage()); + } + } + + /** + * Epc模版详情 + * @param + * @return + */ + @ApiOperation(value = "Epc模版详情") + // @PreAuthorize("@ss.hasPermi('key:people:query')") + @PostMapping("/getEpcTempById") + public AjaxResult getEpcTempById(@RequestBody TbGwModelDto o) { + try { + return service.getEpcTempById(o); + }catch (Exception e){ + log.info("公司业绩管理详情失败{}",e.getMessage()); + return error("公司业绩管理详情失败"); + } + } + + /** + * Epc模版删除 + * @param + * @return + */ + @ApiOperation(value = "Epc模版删除") + // @PreAuthorize("@ss.hasPermi('key:people:add')") + @PostMapping("/delEpcTemp") + public AjaxResult delEpcTemp(@RequestBody TbGwModelDto o) { + try { + return service.delEpcTemp(o); + }catch (Exception e){ + log.info("Epc模版删除失败{}",e.getMessage()); + return error(e.getMessage()); + } + } + + /** + * Epc模版修改 + * @param + * @return + */ + @ApiOperation(value = "Epc模版修改") + // @PreAuthorize("@ss.hasPermi('key:people:add')") + @PostMapping("/updateEpcTemp") + public AjaxResult updateEpcTemp(@RequestBody TbGwModelDto o) { + try { + return service.updateEpcTemp(o); + }catch (Exception e){ + log.info("Epc模版修改失败{}",e.getMessage()); + return error(e.getMessage()); + } + } + + +} diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java new file mode 100644 index 0000000..46937dc --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java @@ -0,0 +1,98 @@ +package com.bonus.tool.mapper; + +import com.bonus.tool.dto.*; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface EpcMapper { + /** + * Epc模版列表查询 + * @param + * @return + */ + List getEpcList(TbGwModelDto bean); + + /** + * Epc模版新增 + * @param + * @return + */ + int addEpcTemp(TbGwModelDto o); + + /** + * Epc模版新增-公司关键人员 + * @param comCoreList + * @return + */ + int insertComCore(List comCoreList); + + /** + * 国网模版新增-公司其他人员 + * @param comOtherList + * @return + */ + int insertComOther(List comOtherList); + + /** + * Epc模版新增-分包商拟派人员 + * @param subPersonList + * @return + */ + int insertSubPerson(List subPersonList); + + /** + * Epc模版详情 + * @param + * @return + */ + TbGwModelVo getEpcTempById(TbGwModelDto o); + + /** + * Epc模版详情-公司业绩 + * @param id + * @return + */ + List selectComPerfList(Long id); + + /** + * Epc模版详情-公司关键人员 + * @param id + * @return + */ + List selectComCoreList(Long id); + + /** + * 国网模版详情-公司其他人员 + * @param id + * @return + */ + List selectComOtherList(Long id); + + /** + * Epc模版详情-分包商人员 + * @param id + * @return + */ + List selectSubOtherList(Long id); + + /** + * Epc模版删除 + * @param + * @return + */ + int delEpcTemp(Long id); + + /** + * Epc模版关联数据删除 + * @param o + */ + void delAssociatedData(TbGwModelDto o); + + /** + * Epc模版修改 + * @param + * @return + */ + int updateEpcTemp(TbGwModelDto o); +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/EpcService.java b/search-tool/src/main/java/com/bonus/tool/service/EpcService.java new file mode 100644 index 0000000..996dc3c --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/service/EpcService.java @@ -0,0 +1,44 @@ +package com.bonus.tool.service; + +import com.bonus.common.core.domain.AjaxResult; +import com.bonus.tool.dto.TbGwModelDto; +import com.bonus.tool.dto.TbGwModelVo; + +import java.util.List; + +public interface EpcService { + /** + * Epc模版列表查询 + * @param + * @return + */ + List getEpcList(TbGwModelDto bean); + + /** + * Epc模版新增 + * @param + * @return + */ + AjaxResult addEpcTemp(TbGwModelDto o); + + /** + * Epc模版详情 + * @param o + * @return + */ + AjaxResult getEpcTempById(TbGwModelDto o); + + /** + * Epc模版删除 + * @param o + * @return + */ + AjaxResult delEpcTemp(TbGwModelDto o); + + /** + * Epc模版修改 + * @param o + * @return + */ + AjaxResult updateEpcTemp(TbGwModelDto o); +} diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/EpcServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/EpcServiceImpl.java new file mode 100644 index 0000000..47fa45b --- /dev/null +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/EpcServiceImpl.java @@ -0,0 +1,158 @@ +package com.bonus.tool.service.impl; + +import com.bonus.common.core.domain.AjaxResult; +import com.bonus.common.utils.SecurityUtils; +import com.bonus.tool.dto.*; +import com.bonus.tool.mapper.EpcMapper; +import com.bonus.tool.service.EpcService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author fly + * @date 2025/4/24 + */ +@Service +@Slf4j +public class EpcServiceImpl implements EpcService { + + @Resource + private EpcMapper mapper; + + /** + * Epc模版列表查询 + * + * @param + * @return + */ + @Override + public List getEpcList(TbGwModelDto bean) { + //获取公司业绩列表 + return mapper.getEpcList(bean); + } + + /** + * Epc模版新增 + * + * @param + * @return + */ + @Override + @Transactional + public AjaxResult addEpcTemp(TbGwModelDto o) { + String userName = SecurityUtils.getLoginUser().getUsername(); + o.setCreateUser(userName); + //1.新增模板主表 + int i = mapper.addEpcTemp(o); + if (i > 0) { + //新增关联数据 + addAssociatedData(o); + } + return i > 0 ? AjaxResult.success() : AjaxResult.error(); + } + + /** + * 新增关联数据 + * + * @param o + */ + private void addAssociatedData(TbGwModelDto o) { + //2.1公司关键人员 + List comCoreList = o.getComCoreList(); + if (comCoreList != null && !comCoreList.isEmpty()) { + comCoreList.forEach(item -> { + item.setParentId(o.getId()); + }); + int y = mapper.insertComCore(comCoreList); + } + //2.2公司其他人员 + List comotherList = o.getComOtherList(); + if (comotherList != null && !comotherList.isEmpty()) { + comotherList.forEach(item -> { + item.setParentId(o.getId()); + }); + int y = mapper.insertComOther(comotherList); + } + //2.3 分包商人员 + List subPersonList = o.getSubPersonList(); + if (subPersonList != null && !subPersonList.isEmpty()) { + subPersonList.forEach(subPerson -> { + subPerson.setParentId(o.getId()); + }); + int z = mapper.insertSubPerson(subPersonList); + } + } + + /** + * Epc模版详情 + * + * @param + * @return + */ + @Override + public AjaxResult getEpcTempById(TbGwModelDto o) { + try { + //1.0获取Epc模版详情 + TbGwModelVo bean = mapper.getEpcTempById(o); + //2.1获取公司核心人员 + List comCoreList = mapper.selectComCoreList(o.getId()); + bean.setComCoreList(comCoreList); + //2.2获取公司其他人员 + List comOtherList = mapper.selectComOtherList(o.getId()); + bean.setComOtherList(comOtherList); + //3.1获取分包商人员 + List subOtherList = mapper.selectSubOtherList(o.getId()); + bean.setSubPersonList(subOtherList); + return AjaxResult.success(bean); + } catch (Exception e) { + log.info("Epc模版详情失败{}", e.getMessage()); + return AjaxResult.error("Epc模版详情"); + } + } + + /** + * Epc模版删除 + * + * @param o + * @return + */ + @Override + public AjaxResult delEpcTemp(TbGwModelDto o) { + int i = mapper.delEpcTemp(o.getId()); + if (i > 0) { + delAssociatedData(o); + } + return i > 0 ? AjaxResult.success("Epc模板删除成功") : AjaxResult.error("Epc模板删除失败"); + } + + /** + * Epc模版修改 + * + * @param o + * @return + */ + @Transactional + @Override + public AjaxResult updateEpcTemp(TbGwModelDto o) { + String userName = SecurityUtils.getLoginUser().getUsername(); + o.setUpdateUser(userName); + int i = mapper.updateEpcTemp(o); + delAssociatedData(o); + addAssociatedData(o); + return AjaxResult.success("Epc模板修改成功"); + } + + /** + * 删除Epc模版关联数据 + * + * @param o + */ + private void delAssociatedData(TbGwModelDto o) { + mapper.delAssociatedData(o); + } + +} diff --git a/search-tool/src/main/resources/mapper/EpcMapper.xml b/search-tool/src/main/resources/mapper/EpcMapper.xml new file mode 100644 index 0000000..f22842d --- /dev/null +++ b/search-tool/src/main/resources/mapper/EpcMapper.xml @@ -0,0 +1,167 @@ + + + + + + insert into tb_epc_mdel(name, + create_user) + values (#{name}, + #{createUser}) + + + + insert into tb_epc_company_user( + epc_id, + key_id, + position, + pro_perf + )values + + ( + #{item.parentId}, + #{item.id}, + #{item.postName}, + #{item.proPerf} + ) + + + + + insert into tb_epc_other_user( + epc_id, + other_id, + position + )values + + ( + #{item.parentId}, + #{item.id}, + #{item.postName} + ) + + + + + insert into tb_epc_sub_user( + epc_id, + user_id, + position + )values + + ( + #{item.parentId}, + #{item.id}, + #{item.postName} + ) + + + + + + update tb_epc_mdel + set + name = #{name}, + update_user = #{updateUser} + where id = #{id} + + + + update tb_epc_mdel + set del_flag = 1 + where id = #{id} + + + + delete + from tb_epc_company_user + where epc_id = #{id}; + delete + from tb_epc_other_user + where epc_id = #{id}; + delete + from tb_epc_sub_user + where epc_id = #{id}; + + + + + + + + + + + +