Commit 60715fd8a8e8d1b1acf4aa0aaec8154d5ec4415d
1 parent
6b5cbc00
feat: 新增跟班人员
Showing
14 changed files
with
700 additions
and
8 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/ConstDriverProperties.java
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
| ... | ... | @@ -76,10 +76,11 @@ public interface DriverMapper |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * |
| 79 | + * 根据工号获取名称 | |
| 79 | 80 | * @param jobCodes |
| 80 | 81 | * @return |
| 81 | 82 | */ |
| 82 | - List<Driver> getNameByJobCode(@Param("jobCodes") Set<String> jobCodes); | |
| 83 | + List<Driver> getNameByJobCode(@Param("jobCodes") List<String> jobCodes); | |
| 83 | 84 | |
| 84 | 85 | /** |
| 85 | 86 | * 是否存在对应工号在数据库中 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -233,9 +233,6 @@ public class DriverServiceImpl implements IDriverService { |
| 233 | 233 | // 获取考勤表进行比对,因为排班数据是会变化的 |
| 234 | 234 | List<DriverScheduling> dto = schedulingService.queryScheduling(jobCode, now); |
| 235 | 235 | log.info("获取到排班数据:{}", cacheMapValue); |
| 236 | - if (jobCode.equals("722717")){ | |
| 237 | - return AjaxResult.success(""); | |
| 238 | - } | |
| 239 | 236 | if (jobCode.equals("700001")){ |
| 240 | 237 | return AjaxResult.success(""); |
| 241 | 238 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/expand/controller/DriverSchedulingExpandController.java
0 → 100644
| 1 | +package com.ruoyi.expand.controller; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import javax.servlet.http.HttpServletResponse; | |
| 5 | + | |
| 6 | +import com.ruoyi.pojo.vo.ExpandResponseViewVo; | |
| 7 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.validation.annotation.Validated; | |
| 10 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 11 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 12 | +import org.springframework.web.bind.annotation.PutMapping; | |
| 13 | +import org.springframework.web.bind.annotation.DeleteMapping; | |
| 14 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 15 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 16 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 17 | +import org.springframework.web.bind.annotation.RestController; | |
| 18 | +import com.ruoyi.common.annotation.Log; | |
| 19 | +import com.ruoyi.common.core.controller.BaseController; | |
| 20 | +import com.ruoyi.common.core.domain.AjaxResult; | |
| 21 | +import com.ruoyi.common.enums.BusinessType; | |
| 22 | +import com.ruoyi.expand.domain.DriverSchedulingExpand; | |
| 23 | +import com.ruoyi.expand.service.IDriverSchedulingExpandService; | |
| 24 | +import com.ruoyi.common.utils.poi.ExcelUtil; | |
| 25 | +import com.ruoyi.common.core.page.TableDataInfo; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * 跟班设置Controller | |
| 29 | + * | |
| 30 | + * @author guzijian | |
| 31 | + * @date 2023-09-12 | |
| 32 | + */ | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/expand/expand") | |
| 35 | +public class DriverSchedulingExpandController extends BaseController | |
| 36 | +{ | |
| 37 | + @Autowired | |
| 38 | + private IDriverSchedulingExpandService driverSchedulingExpandService; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 查询跟班设置列表 | |
| 42 | + */ | |
| 43 | + @PreAuthorize("@ss.hasPermi('expand:expand:list')") | |
| 44 | + @GetMapping("/list") | |
| 45 | + public TableDataInfo list(DriverSchedulingExpand driverSchedulingExpand) | |
| 46 | + { | |
| 47 | + startPage(); | |
| 48 | + return driverSchedulingExpandService.selectDriverSchedulingExpandList(driverSchedulingExpand); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 获取跟班设置详细信息 | |
| 53 | + */ | |
| 54 | + @PreAuthorize("@ss.hasPermi('expand:expand:query')") | |
| 55 | + @GetMapping(value = "/{id}") | |
| 56 | + public AjaxResult getInfo(@PathVariable("id") Long id) | |
| 57 | + { | |
| 58 | + return success(driverSchedulingExpandService.selectDriverSchedulingExpandById(id)); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 新增跟班设置 | |
| 63 | + */ | |
| 64 | + @PreAuthorize("@ss.hasPermi('expand:expand:add')") | |
| 65 | + @Log(title = "跟班设置", businessType = BusinessType.INSERT) | |
| 66 | + @PostMapping | |
| 67 | + public AjaxResult add(@Validated @RequestBody DriverSchedulingExpand driverSchedulingExpand) | |
| 68 | + { | |
| 69 | + return toAjax(driverSchedulingExpandService.insertDriverSchedulingExpand(driverSchedulingExpand)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 修改跟班设置 | |
| 74 | + */ | |
| 75 | + @PreAuthorize("@ss.hasPermi('expand:expand:edit')") | |
| 76 | + @Log(title = "跟班设置", businessType = BusinessType.UPDATE) | |
| 77 | + @PutMapping | |
| 78 | + public AjaxResult edit(@RequestBody DriverSchedulingExpand driverSchedulingExpand) | |
| 79 | + { | |
| 80 | + return toAjax(driverSchedulingExpandService.updateDriverSchedulingExpand(driverSchedulingExpand)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 删除跟班设置 | |
| 85 | + */ | |
| 86 | + @PreAuthorize("@ss.hasPermi('expand:expand:remove')") | |
| 87 | + @Log(title = "跟班设置", businessType = BusinessType.DELETE) | |
| 88 | + @DeleteMapping("/{ids}") | |
| 89 | + public AjaxResult remove(@PathVariable Long[] ids) | |
| 90 | + { | |
| 91 | + return toAjax(driverSchedulingExpandService.deleteDriverSchedulingExpandByIds(ids)); | |
| 92 | + } | |
| 93 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/expand/domain/DriverSchedulingExpand.java
0 → 100644
| 1 | +package com.ruoyi.expand.domain; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 5 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 6 | +import org.apache.commons.lang3.builder.ToStringStyle; | |
| 7 | +import com.ruoyi.common.annotation.Excel; | |
| 8 | +import com.ruoyi.common.core.domain.BaseEntity; | |
| 9 | + | |
| 10 | +import javax.validation.constraints.NotBlank; | |
| 11 | +import javax.validation.constraints.NotNull; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 跟班设置对象 driver_scheduling_expand | |
| 15 | + * | |
| 16 | + * @author guzijian | |
| 17 | + * @date 2023-09-12 | |
| 18 | + */ | |
| 19 | +public class DriverSchedulingExpand extends BaseEntity | |
| 20 | +{ | |
| 21 | + private static final long serialVersionUID = 1L; | |
| 22 | + | |
| 23 | + /** 主键 */ | |
| 24 | + private Long id; | |
| 25 | + | |
| 26 | + /** 状态 */ | |
| 27 | + @Excel(name = "状态") | |
| 28 | + @NotNull(message = "状态不能为空") | |
| 29 | + private Long status; | |
| 30 | + | |
| 31 | + /** 主工号 */ | |
| 32 | + @Excel(name = "主工号") | |
| 33 | + @NotBlank(message = "驾驶员不能为空") | |
| 34 | + private String masterJobCode; | |
| 35 | + | |
| 36 | + /** 从工号 */ | |
| 37 | + @Excel(name = "从工号") | |
| 38 | + @NotBlank(message = "跟班不能为空") | |
| 39 | + private String slaveJobCode; | |
| 40 | + | |
| 41 | + /** 开始日期 */ | |
| 42 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 43 | + @Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd") | |
| 44 | + @NotNull(message = "开始日期不能为空") | |
| 45 | + private Date startDate; | |
| 46 | + | |
| 47 | + /** 结束日期 */ | |
| 48 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 49 | + @Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd") | |
| 50 | + @NotNull(message = "结束日期不能为空") | |
| 51 | + private Date endDate; | |
| 52 | + | |
| 53 | + public void setId(Long id) | |
| 54 | + { | |
| 55 | + this.id = id; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public Long getId() | |
| 59 | + { | |
| 60 | + return id; | |
| 61 | + } | |
| 62 | + public void setStatus(Long status) | |
| 63 | + { | |
| 64 | + this.status = status; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public Long getStatus() | |
| 68 | + { | |
| 69 | + return status; | |
| 70 | + } | |
| 71 | + public void setMasterJobCode(String masterJobCode) | |
| 72 | + { | |
| 73 | + this.masterJobCode = masterJobCode; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public String getMasterJobCode() | |
| 77 | + { | |
| 78 | + return masterJobCode; | |
| 79 | + } | |
| 80 | + public void setSlaveJobCode(String slaveJobCode) | |
| 81 | + { | |
| 82 | + this.slaveJobCode = slaveJobCode; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public String getSlaveJobCode() | |
| 86 | + { | |
| 87 | + return slaveJobCode; | |
| 88 | + } | |
| 89 | + public void setStartDate(Date startDate) | |
| 90 | + { | |
| 91 | + this.startDate = startDate; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public Date getStartDate() | |
| 95 | + { | |
| 96 | + return startDate; | |
| 97 | + } | |
| 98 | + public void setEndDate(Date endDate) | |
| 99 | + { | |
| 100 | + this.endDate = endDate; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public Date getEndDate() | |
| 104 | + { | |
| 105 | + return endDate; | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Override | |
| 109 | + public String toString() { | |
| 110 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |
| 111 | + .append("id", getId()) | |
| 112 | + .append("status", getStatus()) | |
| 113 | + .append("masterJobCode", getMasterJobCode()) | |
| 114 | + .append("slaveJobCode", getSlaveJobCode()) | |
| 115 | + .append("startDate", getStartDate()) | |
| 116 | + .append("endDate", getEndDate()) | |
| 117 | + .append("createTime", getCreateTime()) | |
| 118 | + .append("updateTime", getUpdateTime()) | |
| 119 | + .append("createBy", getCreateBy()) | |
| 120 | + .append("updateBy", getUpdateBy()) | |
| 121 | + .append("remark", getRemark()) | |
| 122 | + .toString(); | |
| 123 | + } | |
| 124 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/expand/mapper/DriverSchedulingExpandMapper.java
0 → 100644
| 1 | +package com.ruoyi.expand.mapper; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.ruoyi.expand.domain.DriverSchedulingExpand; | |
| 5 | +import com.ruoyi.pojo.vo.ExpandResponseVo; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 跟班设置Mapper接口 | |
| 9 | + * | |
| 10 | + * @author guzijian | |
| 11 | + * @date 2023-09-12 | |
| 12 | + */ | |
| 13 | +public interface DriverSchedulingExpandMapper | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * 查询跟班设置 | |
| 17 | + * | |
| 18 | + * @param id 跟班设置主键 | |
| 19 | + * @return 跟班设置 | |
| 20 | + */ | |
| 21 | + public DriverSchedulingExpand selectDriverSchedulingExpandById(Long id); | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 查询跟班设置列表 | |
| 25 | + * | |
| 26 | + * @param driverSchedulingExpand 跟班设置 | |
| 27 | + * @return 跟班设置集合 | |
| 28 | + */ | |
| 29 | + public List<DriverSchedulingExpand> selectDriverSchedulingExpandList(DriverSchedulingExpand driverSchedulingExpand); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 新增跟班设置 | |
| 33 | + * | |
| 34 | + * @param driverSchedulingExpand 跟班设置 | |
| 35 | + * @return 结果 | |
| 36 | + */ | |
| 37 | + public int insertDriverSchedulingExpand(DriverSchedulingExpand driverSchedulingExpand); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 修改跟班设置 | |
| 41 | + * | |
| 42 | + * @param driverSchedulingExpand 跟班设置 | |
| 43 | + * @return 结果 | |
| 44 | + */ | |
| 45 | + public int updateDriverSchedulingExpand(DriverSchedulingExpand driverSchedulingExpand); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 删除跟班设置 | |
| 49 | + * | |
| 50 | + * @param id 跟班设置主键 | |
| 51 | + * @return 结果 | |
| 52 | + */ | |
| 53 | + public int deleteDriverSchedulingExpandById(Long id); | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 批量删除跟班设置 | |
| 57 | + * | |
| 58 | + * @param ids 需要删除的数据主键集合 | |
| 59 | + * @return 结果 | |
| 60 | + */ | |
| 61 | + public int deleteDriverSchedulingExpandByIds(Long[] ids); | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 返回扩展集合 | |
| 65 | + * @param qwExpand | |
| 66 | + * @return | |
| 67 | + */ | |
| 68 | + List<ExpandResponseVo> queryExpandListByEntity(DriverSchedulingExpand qwExpand); | |
| 69 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/expand/service/IDriverSchedulingExpandService.java
0 → 100644
| 1 | +package com.ruoyi.expand.service; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import com.ruoyi.common.core.page.TableDataInfo; | |
| 6 | +import com.ruoyi.expand.domain.DriverSchedulingExpand; | |
| 7 | +import com.ruoyi.pojo.vo.ExpandResponseViewVo; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 跟班设置Service接口 | |
| 11 | + * | |
| 12 | + * @author guzijian | |
| 13 | + * @date 2023-09-12 | |
| 14 | + */ | |
| 15 | +public interface IDriverSchedulingExpandService | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * 查询跟班设置 | |
| 19 | + * | |
| 20 | + * @param id 跟班设置主键 | |
| 21 | + * @return 跟班设置 | |
| 22 | + */ | |
| 23 | + public DriverSchedulingExpand selectDriverSchedulingExpandById(Long id); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 查询跟班设置列表 | |
| 27 | + * | |
| 28 | + * @param driverSchedulingExpand 跟班设置 | |
| 29 | + * @return 跟班设置集合 | |
| 30 | + */ | |
| 31 | + public TableDataInfo selectDriverSchedulingExpandList(DriverSchedulingExpand driverSchedulingExpand); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 新增跟班设置 | |
| 35 | + * | |
| 36 | + * @param driverSchedulingExpand 跟班设置 | |
| 37 | + * @return 结果 | |
| 38 | + */ | |
| 39 | + public int insertDriverSchedulingExpand(DriverSchedulingExpand driverSchedulingExpand); | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 修改跟班设置 | |
| 43 | + * | |
| 44 | + * @param driverSchedulingExpand 跟班设置 | |
| 45 | + * @return 结果 | |
| 46 | + */ | |
| 47 | + public int updateDriverSchedulingExpand(DriverSchedulingExpand driverSchedulingExpand); | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 批量删除跟班设置 | |
| 51 | + * | |
| 52 | + * @param ids 需要删除的跟班设置主键集合 | |
| 53 | + * @return 结果 | |
| 54 | + */ | |
| 55 | + public int deleteDriverSchedulingExpandByIds(Long[] ids); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 删除跟班设置信息 | |
| 59 | + * | |
| 60 | + * @param id 跟班设置主键 | |
| 61 | + * @return 结果 | |
| 62 | + */ | |
| 63 | + public int deleteDriverSchedulingExpandById(Long id); | |
| 64 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/expand/service/impl/DriverSchedulingExpandServiceImpl.java
0 → 100644
| 1 | +package com.ruoyi.expand.service.impl; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.List; | |
| 5 | +import java.util.Map; | |
| 6 | +import java.util.stream.Collectors; | |
| 7 | + | |
| 8 | +import com.github.pagehelper.PageInfo; | |
| 9 | +import com.ruoyi.common.constant.HttpStatus; | |
| 10 | +import com.ruoyi.common.core.controller.BaseController; | |
| 11 | +import com.ruoyi.common.core.page.TableDataInfo; | |
| 12 | +import com.ruoyi.common.utils.DateUtils; | |
| 13 | +import com.ruoyi.common.utils.SecurityUtils; | |
| 14 | +import com.ruoyi.driver.domain.Driver; | |
| 15 | +import com.ruoyi.driver.mapper.DriverMapper; | |
| 16 | +import com.ruoyi.pojo.vo.ExpandResponseViewVo; | |
| 17 | +import org.springframework.beans.BeanUtils; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.stereotype.Service; | |
| 20 | +import com.ruoyi.expand.mapper.DriverSchedulingExpandMapper; | |
| 21 | +import com.ruoyi.expand.domain.DriverSchedulingExpand; | |
| 22 | +import com.ruoyi.expand.service.IDriverSchedulingExpandService; | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * 跟班设置Service业务层处理 | |
| 26 | + * | |
| 27 | + * @author guzijian | |
| 28 | + * @date 2023-09-12 | |
| 29 | + */ | |
| 30 | +@Service | |
| 31 | +public class DriverSchedulingExpandServiceImpl implements IDriverSchedulingExpandService { | |
| 32 | + @Autowired | |
| 33 | + private DriverSchedulingExpandMapper driverSchedulingExpandMapper; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + private DriverMapper driverMapper; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 查询跟班设置 | |
| 40 | + * | |
| 41 | + * @param id 跟班设置主键 | |
| 42 | + * @return 跟班设置 | |
| 43 | + */ | |
| 44 | + @Override | |
| 45 | + public DriverSchedulingExpand selectDriverSchedulingExpandById(Long id) { | |
| 46 | + return driverSchedulingExpandMapper.selectDriverSchedulingExpandById(id); | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 查询跟班设置列表 | |
| 51 | + * | |
| 52 | + * @param driverSchedulingExpand 跟班设置 | |
| 53 | + * @return 跟班设置 | |
| 54 | + */ | |
| 55 | + @Override | |
| 56 | + public TableDataInfo selectDriverSchedulingExpandList(DriverSchedulingExpand driverSchedulingExpand) { | |
| 57 | + List<DriverSchedulingExpand> expandList = driverSchedulingExpandMapper.selectDriverSchedulingExpandList(driverSchedulingExpand); | |
| 58 | + List<ExpandResponseViewVo> vos = new ArrayList<>(expandList.size()); | |
| 59 | + | |
| 60 | + | |
| 61 | + List<String> jobCodes = new ArrayList<>(); | |
| 62 | + for (DriverSchedulingExpand expand : expandList) { | |
| 63 | + jobCodes.add(expand.getMasterJobCode()); | |
| 64 | + jobCodes.add(expand.getSlaveJobCode()); | |
| 65 | + ExpandResponseViewVo vo = new ExpandResponseViewVo(); | |
| 66 | + BeanUtils.copyProperties(expand, vo); | |
| 67 | + vos.add(vo); | |
| 68 | + } | |
| 69 | + | |
| 70 | + jobCodes = jobCodes.stream().distinct().collect(Collectors.toList()); | |
| 71 | + Map<String, Driver> driverMap = driverMapper.getNameByJobCode(jobCodes).stream().collect(Collectors.toMap(Driver::getJobCode,driver -> driver)); | |
| 72 | + vos = vos.stream().peek(vo->{ | |
| 73 | + vo.setMaster(vo.getMasterJobCode() + "/" + driverMap.get(vo.getMasterJobCode()).getPersonnelName()); | |
| 74 | + vo.setSlave( vo.getSlaveJobCode() +"/"+driverMap.get(vo.getSlaveJobCode()).getPersonnelName()); | |
| 75 | + }).collect(Collectors.toList()); | |
| 76 | + | |
| 77 | + return BaseController.getDataTable(vos, new PageInfo(expandList).getTotal()); | |
| 78 | + } | |
| 79 | + | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 新增跟班设置 | |
| 83 | + * | |
| 84 | + * @param driverSchedulingExpand 跟班设置 | |
| 85 | + * @return 结果 | |
| 86 | + */ | |
| 87 | + @Override | |
| 88 | + public int insertDriverSchedulingExpand(DriverSchedulingExpand driverSchedulingExpand) { | |
| 89 | + driverSchedulingExpand.setCreateTime(DateUtils.getNowDate()); | |
| 90 | + driverSchedulingExpand.setCreateBy(SecurityUtils.getUsername()); | |
| 91 | + return driverSchedulingExpandMapper.insertDriverSchedulingExpand(driverSchedulingExpand); | |
| 92 | + } | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 修改跟班设置 | |
| 96 | + * | |
| 97 | + * @param driverSchedulingExpand 跟班设置 | |
| 98 | + * @return 结果 | |
| 99 | + */ | |
| 100 | + @Override | |
| 101 | + public int updateDriverSchedulingExpand(DriverSchedulingExpand driverSchedulingExpand) { | |
| 102 | + driverSchedulingExpand.setUpdateTime(DateUtils.getNowDate()); | |
| 103 | + driverSchedulingExpand.setUpdateBy(SecurityUtils.getUsername()); | |
| 104 | + return driverSchedulingExpandMapper.updateDriverSchedulingExpand(driverSchedulingExpand); | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * 批量删除跟班设置 | |
| 109 | + * | |
| 110 | + * @param ids 需要删除的跟班设置主键 | |
| 111 | + * @return 结果 | |
| 112 | + */ | |
| 113 | + @Override | |
| 114 | + public int deleteDriverSchedulingExpandByIds(Long[] ids) { | |
| 115 | + return driverSchedulingExpandMapper.deleteDriverSchedulingExpandByIds(ids); | |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * 删除跟班设置信息 | |
| 120 | + * | |
| 121 | + * @param id 跟班设置主键 | |
| 122 | + * @return 结果 | |
| 123 | + */ | |
| 124 | + @Override | |
| 125 | + public int deleteDriverSchedulingExpandById(Long id) { | |
| 126 | + return driverSchedulingExpandMapper.deleteDriverSchedulingExpandById(id); | |
| 127 | + } | |
| 128 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| 1 | 1 | package com.ruoyi.job; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollectionUtil; | |
| 3 | 4 | import cn.hutool.http.HttpUtil; |
| 4 | 5 | import com.alibaba.fastjson2.JSON; |
| 5 | 6 | import com.alibaba.fastjson2.JSONArray; |
| ... | ... | @@ -11,10 +12,13 @@ import com.ruoyi.driver.domain.Driver; |
| 11 | 12 | import com.ruoyi.driver.service.IDriverService; |
| 12 | 13 | import com.ruoyi.equipment.domain.Equipment; |
| 13 | 14 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 15 | +import com.ruoyi.expand.domain.DriverSchedulingExpand; | |
| 16 | +import com.ruoyi.expand.mapper.DriverSchedulingExpandMapper; | |
| 14 | 17 | import com.ruoyi.pojo.request.PersonnelRequestVo; |
| 15 | 18 | import com.ruoyi.pojo.request.TokenRequestVo; |
| 16 | 19 | import com.ruoyi.pojo.response.ResponseSchedulingDto; |
| 17 | 20 | import com.ruoyi.pojo.response.personnel.*; |
| 21 | +import com.ruoyi.pojo.vo.ExpandResponseVo; | |
| 18 | 22 | import com.ruoyi.service.RuleNumSettingService; |
| 19 | 23 | import com.ruoyi.service.ThreadJobService; |
| 20 | 24 | import com.ruoyi.utils.ConstDateUtil; |
| ... | ... | @@ -41,8 +45,7 @@ import java.util.*; |
| 41 | 45 | import java.util.concurrent.TimeUnit; |
| 42 | 46 | import java.util.stream.Collectors; |
| 43 | 47 | |
| 44 | -import static com.ruoyi.common.ConstDriverProperties.PERSONNEL_POSTS_DRIVER; | |
| 45 | -import static com.ruoyi.common.ConstDriverProperties.PERSONNEL_POSTS_SALES; | |
| 48 | +import static com.ruoyi.common.ConstDriverProperties.*; | |
| 46 | 49 | import static com.ruoyi.common.ConstEquipmentProperties.*; |
| 47 | 50 | import static com.ruoyi.common.redispre.GlobalRedisPreName.*; |
| 48 | 51 | |
| ... | ... | @@ -59,6 +62,9 @@ public class DriverJob implements InitializingBean { |
| 59 | 62 | private NowSchedulingCache nowSchedulingCache; |
| 60 | 63 | |
| 61 | 64 | @Autowired |
| 65 | + private DriverSchedulingExpandMapper expandMapper; | |
| 66 | + | |
| 67 | + @Autowired | |
| 62 | 68 | private RedisCache redisCache; |
| 63 | 69 | |
| 64 | 70 | @Resource |
| ... | ... | @@ -101,6 +107,8 @@ public class DriverJob implements InitializingBean { |
| 101 | 107 | @Value("${api.config.nonce}") |
| 102 | 108 | private String nonce; |
| 103 | 109 | |
| 110 | + | |
| 111 | + private static DriverSchedulingExpandMapper EXPAND_MAPPER; | |
| 104 | 112 | private static RuleNumSettingService RULE_NUM_SETTING_SERVICE; |
| 105 | 113 | private static NowSchedulingCache NOW_SCHEDULING_CACHE; |
| 106 | 114 | private static ThreadJobService THREAD_JOB_SERVICE; |
| ... | ... | @@ -274,7 +282,7 @@ public class DriverJob implements InitializingBean { |
| 274 | 282 | /** |
| 275 | 283 | * 工具任务 手动把非司售人员的排班加入到签到报表缓存 可以把当天生成的排班明细没有来得及加入签到报表的员工手动加入 |
| 276 | 284 | */ |
| 277 | - public void manualAddBcCache(){ | |
| 285 | + public void manualAddBcCache() { | |
| 278 | 286 | RULE_NUM_SETTING_SERVICE.manualAddBcCache(); |
| 279 | 287 | } |
| 280 | 288 | |
| ... | ... | @@ -325,6 +333,8 @@ public class DriverJob implements InitializingBean { |
| 325 | 333 | splitSaveScheduling(driverSchedulingMap, driverJobCode, driverName, item, PERSONNEL_POSTS_DRIVER); |
| 326 | 334 | splitSaveScheduling(driverSchedulingMap, salePersonJobCode, salePersonName, item, PERSONNEL_POSTS_SALES); |
| 327 | 335 | }); |
| 336 | + // TODO 处理跟班 | |
| 337 | + handleBcCopy(driverSchedulingMap); | |
| 328 | 338 | // 排序 |
| 329 | 339 | List<String> keys = new ArrayList<>(driverSchedulingMap.keySet()); |
| 330 | 340 | for (String key : keys) { |
| ... | ... | @@ -339,6 +349,29 @@ public class DriverJob implements InitializingBean { |
| 339 | 349 | return driverSchedulingMap; |
| 340 | 350 | } |
| 341 | 351 | |
| 352 | + private void handleBcCopy(Map<String, List<ResponseSchedulingDto>> driverSchedulingMap) { | |
| 353 | + try { | |
| 354 | + Date date = new Date(); | |
| 355 | + DriverSchedulingExpand qwExpand = new DriverSchedulingExpand(); | |
| 356 | + qwExpand.setStatus(STATUS_NORMAL.longValue()); | |
| 357 | + List<ExpandResponseVo> expandList = EXPAND_MAPPER.queryExpandListByEntity(qwExpand); | |
| 358 | + for (ExpandResponseVo expand : expandList) { | |
| 359 | + List<ResponseSchedulingDto> dtoList = driverSchedulingMap.get(expand.getMasterJobCode()); | |
| 360 | + if (CollectionUtil.isNotEmpty(dtoList) && date.compareTo(expand.getEndDate()) < 0) { | |
| 361 | + List<ResponseSchedulingDto> list = ListUtils.deepCopy(dtoList); | |
| 362 | + list = list.stream().peek(item -> { | |
| 363 | + item.setJobCode(expand.getSlaveJobCode()); | |
| 364 | + item.setPosts(expand.getSlavePosts()); | |
| 365 | + item.setName(expand.getSlaveName()); | |
| 366 | + }).collect(Collectors.toList()); | |
| 367 | + driverSchedulingMap.put(expand.getSlaveJobCode(), list); | |
| 368 | + } | |
| 369 | + } | |
| 370 | + } catch (Exception e) { | |
| 371 | + log.info("创建分班失败原因:{}", e.getMessage()); | |
| 372 | + } | |
| 373 | + } | |
| 374 | + | |
| 342 | 375 | private void splitSaveScheduling(Map<String, List<ResponseSchedulingDto>> driverSchedulingMap, String jobCode, String name, ResponseSchedulingDto item, String posts) { |
| 343 | 376 | if (!Objects.isNull(jobCode)) { |
| 344 | 377 | ResponseSchedulingDto scheduling = new ResponseSchedulingDto(); |
| ... | ... | @@ -521,5 +554,6 @@ public class DriverJob implements InitializingBean { |
| 521 | 554 | EQUIPMENT_MAPPER = equipmentMapper; |
| 522 | 555 | NOW_SCHEDULING_CACHE = nowSchedulingCache; |
| 523 | 556 | RULE_NUM_SETTING_SERVICE = ruleNumSettingService; |
| 557 | + EXPAND_MAPPER = expandMapper; | |
| 524 | 558 | } |
| 525 | 559 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ResponseSchedulingDto.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ruoyi.pojo.response; |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | import org.springframework.format.annotation.DateTimeFormat; |
| 5 | 5 | |
| 6 | +import java.io.Serializable; | |
| 6 | 7 | import java.util.Date; |
| 7 | 8 | import java.util.List; |
| 8 | 9 | |
| ... | ... | @@ -13,7 +14,9 @@ import java.util.List; |
| 13 | 14 | * @website http://www.json.cn/java2pojo/ |
| 14 | 15 | */ |
| 15 | 16 | @Data |
| 16 | -public class ResponseSchedulingDto { | |
| 17 | +public class ResponseSchedulingDto implements Serializable { | |
| 18 | + | |
| 19 | + private static final long serialVersionUID = -3L; | |
| 17 | 20 | |
| 18 | 21 | private Long id; |
| 19 | 22 | @DateTimeFormat(pattern = "yyyy-MM-dd") | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/ExpandResponseViewVo.java
0 → 100644
| 1 | +package com.ruoyi.pojo.vo; | |
| 2 | + | |
| 3 | +import com.ruoyi.expand.domain.DriverSchedulingExpand; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @author 20412 | |
| 8 | + */ | |
| 9 | +@Data | |
| 10 | +public class ExpandResponseViewVo extends DriverSchedulingExpand { | |
| 11 | + private String slave; | |
| 12 | + private String master; | |
| 13 | + | |
| 14 | +} | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/pojo/vo/ExpandResponseVo.java
0 → 100644
| 1 | +package com.ruoyi.pojo.vo; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | + | |
| 5 | +import java.util.Date; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * @author 20412 | |
| 9 | + */ | |
| 10 | +@Data | |
| 11 | +public class ExpandResponseVo { | |
| 12 | + private String masterJobCode; | |
| 13 | + private String slaveJobCode; | |
| 14 | + private String materName; | |
| 15 | + private String slaveName; | |
| 16 | + private String slavePosts; | |
| 17 | + private String slaveFleetName; | |
| 18 | + private Integer status; | |
| 19 | + private Date startDate; | |
| 20 | + private Date endDate; | |
| 21 | + | |
| 22 | + | |
| 23 | +} | ... | ... |
ruoyi-admin/src/main/resources/mapper/expand/DriverSchedulingExpandMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.ruoyi.expand.mapper.DriverSchedulingExpandMapper"> | |
| 6 | + | |
| 7 | + <resultMap type="DriverSchedulingExpand" id="DriverSchedulingExpandResult"> | |
| 8 | + <result property="id" column="id" /> | |
| 9 | + <result property="status" column="status" /> | |
| 10 | + <result property="masterJobCode" column="master_job_code" /> | |
| 11 | + <result property="slaveJobCode" column="slave_job_code" /> | |
| 12 | + <result property="startDate" column="start_date" /> | |
| 13 | + <result property="endDate" column="end_date" /> | |
| 14 | + <result property="createTime" column="create_time" /> | |
| 15 | + <result property="updateTime" column="update_time" /> | |
| 16 | + <result property="createBy" column="create_by" /> | |
| 17 | + <result property="updateBy" column="update_by" /> | |
| 18 | + <result property="remark" column="remark" /> | |
| 19 | + </resultMap> | |
| 20 | + | |
| 21 | + <resultMap id="DriverSchedulingExpandDto" type="com.ruoyi.pojo.vo.ExpandResponseVo"> | |
| 22 | + <result property="status" column="status" /> | |
| 23 | + <result property="masterJobCode" column="master_job_code" /> | |
| 24 | + <result property="slaveJobCode" column="slave_job_code" /> | |
| 25 | + <result property="startDate" column="start_date" /> | |
| 26 | + <result property="endDate" column="end_date" /> | |
| 27 | + <result property="materName" column="materName" /> | |
| 28 | + <result property="slaveName" column="slaveName" /> | |
| 29 | + <result property="slaveFleetName" column="slaveFleetName" /> | |
| 30 | + <result property="slavePosts" column="slavePosts" /> | |
| 31 | + </resultMap> | |
| 32 | + | |
| 33 | + <sql id="selectDriverSchedulingExpandVo"> | |
| 34 | + select id, status, master_job_code, slave_job_code, start_date, end_date, create_time, update_time, create_by, update_by, remark from driver_scheduling_expand | |
| 35 | + </sql> | |
| 36 | + | |
| 37 | + <select id="selectDriverSchedulingExpandList" parameterType="DriverSchedulingExpand" resultMap="DriverSchedulingExpandResult"> | |
| 38 | + <include refid="selectDriverSchedulingExpandVo"/> | |
| 39 | + <where> | |
| 40 | + <if test="status != null "> and status = #{status}</if> | |
| 41 | + <if test="masterJobCode != null and masterJobCode != ''"> and master_job_code = #{masterJobCode}</if> | |
| 42 | + <if test="slaveJobCode != null and slaveJobCode != ''"> and slave_job_code = #{slaveJobCode}</if> | |
| 43 | + <if test="startDate != null "> and start_date = #{startDate}</if> | |
| 44 | + <if test="endDate != null "> and end_date = #{endDate}</if> | |
| 45 | + </where> | |
| 46 | + </select> | |
| 47 | + | |
| 48 | + <select id="selectDriverSchedulingExpandById" parameterType="Long" resultMap="DriverSchedulingExpandResult"> | |
| 49 | + <include refid="selectDriverSchedulingExpandVo"/> | |
| 50 | + where id = #{id} | |
| 51 | + </select> | |
| 52 | + <select id="queryExpandListByEntity" resultMap="DriverSchedulingExpandDto" resultType="com.ruoyi.pojo.vo.ExpandResponseVo"> | |
| 53 | + select driver.personnel_name slaveName, | |
| 54 | + driver.fleet_name slaveFleetName, | |
| 55 | + driver.posts slavePosts,expand.* | |
| 56 | + from driver_scheduling_expand expand,driver | |
| 57 | + where driver.job_code = expand.slave_job_code | |
| 58 | + <if test="status != null"> | |
| 59 | + and expand.`status` = #{status} | |
| 60 | + </if> | |
| 61 | + <if test="masterJobCode != null"> | |
| 62 | + and expand.master_job_code = #{masterJobCode} | |
| 63 | + </if> | |
| 64 | + <if test="slaveJobCode != null"> | |
| 65 | + and expand.slave_job_code = #{slaveJobCode} | |
| 66 | + </if> | |
| 67 | + </select> | |
| 68 | + | |
| 69 | + <insert id="insertDriverSchedulingExpand" parameterType="DriverSchedulingExpand" useGeneratedKeys="true" keyProperty="id"> | |
| 70 | + insert into driver_scheduling_expand | |
| 71 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 72 | + <if test="status != null">status,</if> | |
| 73 | + <if test="masterJobCode != null">master_job_code,</if> | |
| 74 | + <if test="slaveJobCode != null">slave_job_code,</if> | |
| 75 | + <if test="startDate != null">start_date,</if> | |
| 76 | + <if test="endDate != null">end_date,</if> | |
| 77 | + <if test="createTime != null">create_time,</if> | |
| 78 | + <if test="updateTime != null">update_time,</if> | |
| 79 | + <if test="createBy != null">create_by,</if> | |
| 80 | + <if test="updateBy != null">update_by,</if> | |
| 81 | + <if test="remark != null">remark,</if> | |
| 82 | + </trim> | |
| 83 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 84 | + <if test="status != null">#{status},</if> | |
| 85 | + <if test="masterJobCode != null">#{masterJobCode},</if> | |
| 86 | + <if test="slaveJobCode != null">#{slaveJobCode},</if> | |
| 87 | + <if test="startDate != null">#{startDate},</if> | |
| 88 | + <if test="endDate != null">#{endDate},</if> | |
| 89 | + <if test="createTime != null">#{createTime},</if> | |
| 90 | + <if test="updateTime != null">#{updateTime},</if> | |
| 91 | + <if test="createBy != null">#{createBy},</if> | |
| 92 | + <if test="updateBy != null">#{updateBy},</if> | |
| 93 | + <if test="remark != null">#{remark},</if> | |
| 94 | + </trim> | |
| 95 | + </insert> | |
| 96 | + | |
| 97 | + <update id="updateDriverSchedulingExpand" parameterType="DriverSchedulingExpand"> | |
| 98 | + update driver_scheduling_expand | |
| 99 | + <trim prefix="SET" suffixOverrides=","> | |
| 100 | + <if test="status != null">status = #{status},</if> | |
| 101 | + <if test="masterJobCode != null">master_job_code = #{masterJobCode},</if> | |
| 102 | + <if test="slaveJobCode != null">slave_job_code = #{slaveJobCode},</if> | |
| 103 | + <if test="startDate != null">start_date = #{startDate},</if> | |
| 104 | + <if test="endDate != null">end_date = #{endDate},</if> | |
| 105 | + <if test="createTime != null">create_time = #{createTime},</if> | |
| 106 | + <if test="updateTime != null">update_time = #{updateTime},</if> | |
| 107 | + <if test="createBy != null">create_by = #{createBy},</if> | |
| 108 | + <if test="updateBy != null">update_by = #{updateBy},</if> | |
| 109 | + <if test="remark != null">remark = #{remark},</if> | |
| 110 | + </trim> | |
| 111 | + where id = #{id} | |
| 112 | + </update> | |
| 113 | + | |
| 114 | + <delete id="deleteDriverSchedulingExpandById" parameterType="Long"> | |
| 115 | + delete from driver_scheduling_expand where id = #{id} | |
| 116 | + </delete> | |
| 117 | + | |
| 118 | + <delete id="deleteDriverSchedulingExpandByIds" parameterType="String"> | |
| 119 | + delete from driver_scheduling_expand where id in | |
| 120 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 121 | + #{id} | |
| 122 | + </foreach> | |
| 123 | + </delete> | |
| 124 | +</mapper> | |
| 0 | 125 | \ No newline at end of file | ... | ... |
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
| ... | ... | @@ -91,6 +91,20 @@ public class BaseController |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | + * 响应请求分页数据 | |
| 95 | + */ | |
| 96 | + @SuppressWarnings({ "rawtypes", "unchecked" }) | |
| 97 | + public static TableDataInfo getDataTable(List<?> list,long total) | |
| 98 | + { | |
| 99 | + TableDataInfo rspData = new TableDataInfo(); | |
| 100 | + rspData.setCode(HttpStatus.SUCCESS); | |
| 101 | + rspData.setMsg("查询成功"); | |
| 102 | + rspData.setRows(list); | |
| 103 | + rspData.setTotal(total); | |
| 104 | + return rspData; | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 94 | 108 | * 返回成功 |
| 95 | 109 | */ |
| 96 | 110 | public AjaxResult success() | ... | ... |