From 957a756c362a45bc42f099d3f0de7ae052f5614f Mon Sep 17 00:00:00 2001 From: tuyp Date: Thu, 13 Apr 2023 21:50:44 +0800 Subject: [PATCH] 准备周六在家加班...... --- logs/springboot-logback/info/2023-04-08-0.log.gz | Bin 0 -> 3873 bytes src/main/java/com/laowu/controller/WorkstationAloneMappingController.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/laowu/mapper/WorkstationAloneMappingMapper.java | 38 ++++++++++++++++++++++++++++++++++++++ src/main/java/com/laowu/model/WorkstationAloneMappingDO.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/laowu/service/WorkstationAloneMappingService.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/laowu/service/impl/PositionRequireItemServiceImpl.java | 12 ++++++++++++ src/main/java/com/laowu/service/impl/WorkstationAloneMappingServiceImpl.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/laowu/vo/position/RequirementsVO.java | 4 ++++ src/main/resources/mapper/WorkstationAloneMappingMapper.xml | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 397 insertions(+) create mode 100644 logs/springboot-logback/info/2023-04-08-0.log.gz create mode 100644 src/main/java/com/laowu/controller/WorkstationAloneMappingController.java create mode 100644 src/main/java/com/laowu/mapper/WorkstationAloneMappingMapper.java create mode 100644 src/main/java/com/laowu/model/WorkstationAloneMappingDO.java create mode 100644 src/main/java/com/laowu/service/WorkstationAloneMappingService.java create mode 100644 src/main/java/com/laowu/service/impl/WorkstationAloneMappingServiceImpl.java create mode 100644 src/main/resources/mapper/WorkstationAloneMappingMapper.xml diff --git a/logs/springboot-logback/info/2023-04-08-0.log.gz b/logs/springboot-logback/info/2023-04-08-0.log.gz new file mode 100644 index 0000000..7e9b4fa Binary files /dev/null and b/logs/springboot-logback/info/2023-04-08-0.log.gz differ diff --git a/src/main/java/com/laowu/controller/WorkstationAloneMappingController.java b/src/main/java/com/laowu/controller/WorkstationAloneMappingController.java new file mode 100644 index 0000000..36a2873 --- /dev/null +++ b/src/main/java/com/laowu/controller/WorkstationAloneMappingController.java @@ -0,0 +1,59 @@ +package com.laowu.controller; + + +import com.laowu.dto.station.RequiresDTO; +import com.laowu.dto.station.ShareDTO; +import com.laowu.model.WorkstationAloneMappingDO; +import com.laowu.service.WorkstationAloneMappingService; +import com.laowu.util.ResponseData; +import com.laowu.util.ResponseVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 职位需求工作站映射表 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-03-30 + */ +@RestController +@Api(tags = "独立需求工作站映射表") +@RequestMapping("/workstationAloneMapping") +public class WorkstationAloneMappingController { + + @Autowired + private WorkstationAloneMappingService workstationAloneMappingService; + + @PostMapping("requires") + @ApiOperation("查看某个工作站的项目用工需求 stationId 工作站id pageSize pageNum itemStatus province city county positionId itemName ") + public ResponseVO requires(@RequestBody RequiresDTO requiresDTO){ + return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.requires(requiresDTO)); + } + + @PostMapping("deleteRequire") + @ApiOperation("删除需求 stationId aloneId 需求id") + public ResponseVO deleteRequire(@RequestBody WorkstationAloneMappingDO workstationAloneMappingDO){ + return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.deleteRequire(workstationAloneMappingDO)); + } + + @PostMapping("share") + @ApiOperation("分配工作站 stationIds requireIds ") + public ResponseVO share(@RequestBody ShareDTO shareDTO){ + return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.share(shareDTO)); + } + + @PostMapping("requireStations") + @ApiOperation("查看需求已经在哪些工作站 aloneId") + public ResponseVO requireStations(@RequestBody WorkstationAloneMappingDO workstationAloneMappingDO){ + return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.requireStations(workstationAloneMappingDO)); + } + + +} diff --git a/src/main/java/com/laowu/mapper/WorkstationAloneMappingMapper.java b/src/main/java/com/laowu/mapper/WorkstationAloneMappingMapper.java new file mode 100644 index 0000000..00e855c --- /dev/null +++ b/src/main/java/com/laowu/mapper/WorkstationAloneMappingMapper.java @@ -0,0 +1,38 @@ +package com.laowu.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.laowu.model.WorkstationAloneMappingDO; +import com.laowu.vo.position.AloneRequirementsVO; +import com.laowu.vo.position.AloneWorkVO; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 职位需求工作站映射表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-03-30 + */ +@Repository +public interface WorkstationAloneMappingMapper extends BaseMapper { + + /** + * 查看某个工作站下的需求 + */ + IPage aloneRequirements(IPage ipage,String positionStatus,String positionName,Long positionId,String province,String city,String county,Long stationId); + + /** + * 查看某个需求已经存在于哪几个工作站了 + */ + List requiresStations(Long requireId); + + /** + * 查看某个需求有哪几个工作站 VO + */ + List aloneWorkVO(Long aloneId); + +} diff --git a/src/main/java/com/laowu/model/WorkstationAloneMappingDO.java b/src/main/java/com/laowu/model/WorkstationAloneMappingDO.java new file mode 100644 index 0000000..8660a34 --- /dev/null +++ b/src/main/java/com/laowu/model/WorkstationAloneMappingDO.java @@ -0,0 +1,39 @@ +package com.laowu.model; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.laowu.util.BaseModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 职位需求工作站映射表 + *

+ * + * @author Tuyp + * @since 2023-03-30 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("workstation_alone_mapping") +public class WorkstationAloneMappingDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 工作站id + */ + private Long stationId; + + /** + * 独立用用工需求id + */ + private Long aloneId; + + +} diff --git a/src/main/java/com/laowu/service/WorkstationAloneMappingService.java b/src/main/java/com/laowu/service/WorkstationAloneMappingService.java new file mode 100644 index 0000000..2e4b63a --- /dev/null +++ b/src/main/java/com/laowu/service/WorkstationAloneMappingService.java @@ -0,0 +1,29 @@ +package com.laowu.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.laowu.dto.station.RequiresDTO; +import com.laowu.dto.station.ShareDTO; +import com.laowu.model.WorkstationAloneMappingDO; +import com.laowu.vo.position.AloneRequirementsVO; +import com.laowu.vo.station.RequireStationsVO; + +/** + *

+ * 职位需求工作站映射表 服务类 + *

+ * + * @author Tuyp + * @since 2023-03-30 + */ +public interface WorkstationAloneMappingService extends IService { + + IPage requires(RequiresDTO requiresDTO); + + String deleteRequire(WorkstationAloneMappingDO workstationAloneMappingDO); + + String share(ShareDTO shareDTO); + + RequireStationsVO requireStations(WorkstationAloneMappingDO workstationAloneMappingDO); + +} diff --git a/src/main/java/com/laowu/service/impl/PositionRequireItemServiceImpl.java b/src/main/java/com/laowu/service/impl/PositionRequireItemServiceImpl.java index 42aacde..3e95f56 100644 --- a/src/main/java/com/laowu/service/impl/PositionRequireItemServiceImpl.java +++ b/src/main/java/com/laowu/service/impl/PositionRequireItemServiceImpl.java @@ -16,7 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** *

@@ -53,13 +55,23 @@ public class PositionRequireItemServiceImpl extends ServiceImpl iPage = this.baseMapper.requirements(pager, requirementsDTO.getItemName(), requirementsDTO.getItemStatus(), requirementsDTO.getProvince(), requirementsDTO.getCity(), requirementsDTO.getCounty(), requirementsDTO.getPositionId()); List records = iPage.getRecords(); for (RequirementsVO rv : records) { + + Set positionDictDOSet = new HashSet<>(); + //预招人数 List positionItemInfoDOS = positionItemInfoMapper.positionCounts(rv.getId()); for (PositionCountsVO positionCountsVO : positionItemInfoDOS){ //职位分类 List libJobSortDOS = positionItemJobMappingMapper.positionSorts(positionCountsVO.getId()); positionCountsVO.setLibJobSortDOS(libJobSortDOS); + + //职业范围 + List positionDictDOS = positionRequirePositionsMapper.positionDicts(positionCountsVO.getId()); + for (PositionDictDO rcc : positionDictDOS) { + positionDictDOSet.add(rcc); + } } + rv.setPositionDictDOSet(positionDictDOSet); rv.setPositionItemInfoDOS(positionItemInfoDOS); } return iPage; diff --git a/src/main/java/com/laowu/service/impl/WorkstationAloneMappingServiceImpl.java b/src/main/java/com/laowu/service/impl/WorkstationAloneMappingServiceImpl.java new file mode 100644 index 0000000..8230e00 --- /dev/null +++ b/src/main/java/com/laowu/service/impl/WorkstationAloneMappingServiceImpl.java @@ -0,0 +1,108 @@ +package com.laowu.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.laowu.dto.station.RequiresDTO; +import com.laowu.dto.station.ShareDTO; +import com.laowu.mapper.PositionAloneInfoMapper; +import com.laowu.mapper.WorkstationAloneMappingMapper; +import com.laowu.model.PositionAloneInfoDO; +import com.laowu.model.WorkstationAloneMappingDO; +import com.laowu.service.WorkstationAloneMappingService; +import com.laowu.util.ConstantUtils; +import com.laowu.vo.position.AloneRequirementsVO; +import com.laowu.vo.station.RequireStationsVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 职位需求工作站映射表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-03-30 + */ +@Service +public class WorkstationAloneMappingServiceImpl extends ServiceImpl implements WorkstationAloneMappingService { + + @Autowired + private PositionAloneInfoMapper positionAloneInfoMapper; + + public IPage requires(RequiresDTO requiresDTO) { + Page pager = new Page(requiresDTO.getPageNum(), requiresDTO.getPageSize()); + return this.baseMapper.aloneRequirements(pager, requiresDTO.getItemStatus(), requiresDTO.getItemName(), requiresDTO.getPositionId(), requiresDTO.getProvince(), requiresDTO.getCity(), requiresDTO.getCounty(), requiresDTO.getStationId()); + } + + public String deleteRequire(WorkstationAloneMappingDO workstationAloneMappingDO) { + + this.baseMapper.delete(new QueryWrapper() + .lambda() + .eq(WorkstationAloneMappingDO::getAloneId, workstationAloneMappingDO.getAloneId()) + .eq(WorkstationAloneMappingDO::getStationId, workstationAloneMappingDO.getStationId())); + + positionAloneInfoMapper.deleteById(workstationAloneMappingDO.getAloneId()); + + return ConstantUtils.DELETE_SUCCESS; + } + + public String share(ShareDTO shareDTO) { + + List requireIds = shareDTO.getRequireIds(); + for (Long requireId : requireIds) { + List oldIds = this.baseMapper.requiresStations(requireId); + List newIds = shareDTO.getStationIds(); + + List newIds2 = new ArrayList(); + for (Long id : newIds) { + newIds2.add(id); + } + + newIds.removeAll(oldIds); //新增的人在newIds里面 + + if (newIds.size() > 0) { + for (Long id : newIds) { + + PositionAloneInfoDO positionAloneInfoDO = positionAloneInfoMapper.selectById(requireId); + PositionAloneInfoDO positionAloneInfoDO1 = new PositionAloneInfoDO(); + BeanUtils.copyProperties(positionAloneInfoDO,positionAloneInfoDO1); + positionAloneInfoDO1.setOriginId(positionAloneInfoDO.getId()); + positionAloneInfoMapper.insert(positionAloneInfoDO1); + + WorkstationAloneMappingDO workstationAloneMappingDO = new WorkstationAloneMappingDO(); + workstationAloneMappingDO.setAloneId(positionAloneInfoDO1.getId()); + workstationAloneMappingDO.setStationId(id); + this.baseMapper.insert(workstationAloneMappingDO); + } + } + + oldIds.removeAll(newIds2);//删掉以前的 + if (oldIds.size() > 0) { + for (Long id : oldIds) { + this.baseMapper.delete(new QueryWrapper() + .lambda() + .eq(WorkstationAloneMappingDO::getAloneId, requireId) + .eq(WorkstationAloneMappingDO::getStationId, id)); + } + } + + } + + + return ConstantUtils.SUCCESS_UPDATE; + } + + public RequireStationsVO requireStations(WorkstationAloneMappingDO workstationAloneMappingDO) { + RequireStationsVO requireStationsVO = new RequireStationsVO(); + requireStationsVO.setIds(this.baseMapper.requiresStations(workstationAloneMappingDO.getAloneId())); + return requireStationsVO; + } + + +} diff --git a/src/main/java/com/laowu/vo/position/RequirementsVO.java b/src/main/java/com/laowu/vo/position/RequirementsVO.java index ec18e1d..0ca829b 100644 --- a/src/main/java/com/laowu/vo/position/RequirementsVO.java +++ b/src/main/java/com/laowu/vo/position/RequirementsVO.java @@ -1,8 +1,10 @@ package com.laowu.vo.position; +import com.laowu.model.PositionDictDO; import lombok.Data; import java.util.List; +import java.util.Set; @Data public class RequirementsVO { @@ -36,4 +38,6 @@ public class RequirementsVO { private String positionStatus; private List positionItemInfoDOS; + + private Set positionDictDOSet; } diff --git a/src/main/resources/mapper/WorkstationAloneMappingMapper.xml b/src/main/resources/mapper/WorkstationAloneMappingMapper.xml new file mode 100644 index 0000000..ccb863e --- /dev/null +++ b/src/main/resources/mapper/WorkstationAloneMappingMapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, station_id, alone_id + + + + + + + + + -- libgit2 0.25.0