Commit 9a0340d768b31c9031618943548b4d41ecc453e1

Authored by guzijian
1 parent af61bdb0

feat: 新增线路配置

Bsth-admin/src/main/java/com/ruoyi/config/controller/LineConfigController.java 0 → 100644
  1 +package com.ruoyi.config.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.security.access.prepost.PreAuthorize;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.PostMapping;
  9 +import org.springframework.web.bind.annotation.PutMapping;
  10 +import org.springframework.web.bind.annotation.DeleteMapping;
  11 +import org.springframework.web.bind.annotation.PathVariable;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import com.ruoyi.common.annotation.Log;
  16 +import com.ruoyi.common.core.controller.BaseController;
  17 +import com.ruoyi.common.core.domain.AjaxResult;
  18 +import com.ruoyi.common.enums.BusinessType;
  19 +import com.ruoyi.config.domain.LineConfig;
  20 +import com.ruoyi.config.service.ILineConfigService;
  21 +import com.ruoyi.common.utils.poi.ExcelUtil;
  22 +import com.ruoyi.common.core.page.TableDataInfo;
  23 +
  24 +/**
  25 + * 线路配置Controller
  26 + *
  27 + * @author Bsth
  28 + * @date 2024-02-05
  29 + */
  30 +@RestController
  31 +@RequestMapping("/config/config")
  32 +public class LineConfigController extends BaseController
  33 +{
  34 + @Autowired
  35 + private ILineConfigService lineConfigService;
  36 +
  37 + /**
  38 + * 查询线路配置列表
  39 + */
  40 + @PreAuthorize("@ss.hasPermi('config:config:list')")
  41 + @GetMapping("/list")
  42 + public TableDataInfo list(LineConfig lineConfig)
  43 + {
  44 + startPage();
  45 + List<LineConfig> list = lineConfigService.selectLineConfigList(lineConfig);
  46 + return getDataTable(list);
  47 + }
  48 +
  49 + /**
  50 + * 导出线路配置列表
  51 + */
  52 + @PreAuthorize("@ss.hasPermi('config:config:export')")
  53 + @Log(title = "线路配置", businessType = BusinessType.EXPORT)
  54 + @PostMapping("/export")
  55 + public void export(HttpServletResponse response, LineConfig lineConfig)
  56 + {
  57 + List<LineConfig> list = lineConfigService.selectLineConfigList(lineConfig);
  58 + ExcelUtil<LineConfig> util = new ExcelUtil<LineConfig>(LineConfig.class);
  59 + util.exportExcel(response, list, "线路配置数据");
  60 + }
  61 +
  62 + /**
  63 + * 获取线路配置详细信息
  64 + */
  65 + @PreAuthorize("@ss.hasPermi('config:config:query')")
  66 + @GetMapping(value = "/{id}")
  67 + public AjaxResult getInfo(@PathVariable("id") Long id)
  68 + {
  69 + return success(lineConfigService.selectLineConfigById(id));
  70 + }
  71 +
  72 + /**
  73 + * 新增线路配置
  74 + */
  75 + @PreAuthorize("@ss.hasPermi('config:config:add')")
  76 + @Log(title = "线路配置", businessType = BusinessType.INSERT)
  77 + @PostMapping
  78 + public AjaxResult add(@RequestBody LineConfig lineConfig)
  79 + {
  80 + return toAjax(lineConfigService.insertLineConfig(lineConfig));
  81 + }
  82 +
  83 + /**
  84 + * 修改线路配置
  85 + */
  86 + @PreAuthorize("@ss.hasPermi('config:config:edit')")
  87 + @Log(title = "线路配置", businessType = BusinessType.UPDATE)
  88 + @PutMapping
  89 + public AjaxResult edit(@RequestBody LineConfig lineConfig)
  90 + {
  91 + return toAjax(lineConfigService.updateLineConfig(lineConfig));
  92 + }
  93 +
  94 + /**
  95 + * 删除线路配置
  96 + */
  97 + @PreAuthorize("@ss.hasPermi('config:config:remove')")
  98 + @Log(title = "线路配置", businessType = BusinessType.DELETE)
  99 + @DeleteMapping("/{ids}")
  100 + public AjaxResult remove(@PathVariable Long[] ids)
  101 + {
  102 + return toAjax(lineConfigService.deleteLineConfigByIds(ids));
  103 + }
  104 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/config/domain/LineConfig.java 0 → 100644
  1 +package com.ruoyi.config.domain;
  2 +
  3 +import org.apache.commons.lang3.builder.ToStringBuilder;
  4 +import org.apache.commons.lang3.builder.ToStringStyle;
  5 +import com.ruoyi.common.annotation.Excel;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +/**
  9 + * 线路配置对象 line_config
  10 + *
  11 + * @author Bsth
  12 + * @date 2024-02-05
  13 + */
  14 +public class LineConfig extends BaseEntity
  15 +{
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /** 主键 */
  19 + private Long id;
  20 +
  21 + /** 线路名 */
  22 + @Excel(name = "线路名")
  23 + private String lineName;
  24 +
  25 + /** 路牌 */
  26 + @Excel(name = "路牌")
  27 + private String lpName;
  28 +
  29 + /** 第一次签到时间 */
  30 + @Excel(name = "第一次签到时间")
  31 + private String firstSignInTime;
  32 +
  33 + /** 第一次签退时间 */
  34 + @Excel(name = "第一次签退时间")
  35 + private String firstSignOutTime;
  36 +
  37 + /** 今天还是隔天 */
  38 + @Excel(name = "今天还是隔天")
  39 + private Integer firstSignTodayTomorrow;
  40 +
  41 + /** 分班标识 */
  42 + @Excel(name = "分班标识")
  43 + private Integer secondFlag;
  44 +
  45 + /** 分班签到时间 */
  46 + @Excel(name = "分班签到时间")
  47 + private String secondSignInTime;
  48 +
  49 + /** 分班签退时间 */
  50 + @Excel(name = "分班签退时间")
  51 + private String secondSignOutTime;
  52 +
  53 + /** 今天还是隔天 */
  54 + @Excel(name = "今天还是隔天")
  55 + private Integer secondSignTodayTomorrow;
  56 +
  57 + public void setId(Long id)
  58 + {
  59 + this.id = id;
  60 + }
  61 +
  62 + public Long getId()
  63 + {
  64 + return id;
  65 + }
  66 + public void setLineName(String lineName)
  67 + {
  68 + this.lineName = lineName;
  69 + }
  70 +
  71 + public String getLineName()
  72 + {
  73 + return lineName;
  74 + }
  75 + public void setLpName(String lpName)
  76 + {
  77 + this.lpName = lpName;
  78 + }
  79 +
  80 + public String getLpName()
  81 + {
  82 + return lpName;
  83 + }
  84 + public void setFirstSignInTime(String firstSignInTime)
  85 + {
  86 + this.firstSignInTime = firstSignInTime;
  87 + }
  88 +
  89 + public String getFirstSignInTime()
  90 + {
  91 + return firstSignInTime;
  92 + }
  93 + public void setFirstSignOutTime(String firstSignOutTime)
  94 + {
  95 + this.firstSignOutTime = firstSignOutTime;
  96 + }
  97 +
  98 + public String getFirstSignOutTime()
  99 + {
  100 + return firstSignOutTime;
  101 + }
  102 + public void setFirstSignTodayTomorrow(Integer firstSignTodayTomorrow)
  103 + {
  104 + this.firstSignTodayTomorrow = firstSignTodayTomorrow;
  105 + }
  106 +
  107 + public Integer getFirstSignTodayTomorrow()
  108 + {
  109 + return firstSignTodayTomorrow;
  110 + }
  111 + public void setSecondFlag(Integer secondFlag)
  112 + {
  113 + this.secondFlag = secondFlag;
  114 + }
  115 +
  116 + public Integer getSecondFlag()
  117 + {
  118 + return secondFlag;
  119 + }
  120 + public void setSecondSignInTime(String secondSignInTime)
  121 + {
  122 + this.secondSignInTime = secondSignInTime;
  123 + }
  124 +
  125 + public String getSecondSignInTime()
  126 + {
  127 + return secondSignInTime;
  128 + }
  129 + public void setSecondSignOutTime(String secondSignOutTime)
  130 + {
  131 + this.secondSignOutTime = secondSignOutTime;
  132 + }
  133 +
  134 + public String getSecondSignOutTime()
  135 + {
  136 + return secondSignOutTime;
  137 + }
  138 + public void setSecondSignTodayTomorrow(Integer secondSignTodayTomorrow)
  139 + {
  140 + this.secondSignTodayTomorrow = secondSignTodayTomorrow;
  141 + }
  142 +
  143 + public Integer getSecondSignTodayTomorrow()
  144 + {
  145 + return secondSignTodayTomorrow;
  146 + }
  147 +
  148 + @Override
  149 + public String toString() {
  150 + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  151 + .append("id", getId())
  152 + .append("lineName", getLineName())
  153 + .append("lpName", getLpName())
  154 + .append("firstSignInTime", getFirstSignInTime())
  155 + .append("firstSignOutTime", getFirstSignOutTime())
  156 + .append("firstSignInTodayTomarrow", getFirstSignTodayTomorrow())
  157 + .append("secondFlag", getSecondFlag())
  158 + .append("secondSignInTime", getSecondSignInTime())
  159 + .append("secondSignOutTime", getSecondSignOutTime())
  160 + .append("secondSignInTodayTomarrow", getSecondSignTodayTomorrow())
  161 + .append("createTime", getCreateTime())
  162 + .append("updateTime", getUpdateTime())
  163 + .append("createBy", getCreateBy())
  164 + .append("updateBy", getUpdateBy())
  165 + .append("remark", getRemark())
  166 + .toString();
  167 + }
  168 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/config/mapper/LineConfigMapper.java 0 → 100644
  1 +package com.ruoyi.config.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.config.domain.LineConfig;
  5 +
  6 +/**
  7 + * 线路配置Mapper接口
  8 + *
  9 + * @author Bsth
  10 + * @date 2024-02-05
  11 + */
  12 +public interface LineConfigMapper
  13 +{
  14 + /**
  15 + * 查询线路配置
  16 + *
  17 + * @param id 线路配置主键
  18 + * @return 线路配置
  19 + */
  20 + public LineConfig selectLineConfigById(Long id);
  21 +
  22 + /**
  23 + * 查询线路配置列表
  24 + *
  25 + * @param lineConfig 线路配置
  26 + * @return 线路配置集合
  27 + */
  28 + public List<LineConfig> selectLineConfigList(LineConfig lineConfig);
  29 +
  30 + /**
  31 + * 新增线路配置
  32 + *
  33 + * @param lineConfig 线路配置
  34 + * @return 结果
  35 + */
  36 + public int insertLineConfig(LineConfig lineConfig);
  37 +
  38 + /**
  39 + * 修改线路配置
  40 + *
  41 + * @param lineConfig 线路配置
  42 + * @return 结果
  43 + */
  44 + public int updateLineConfig(LineConfig lineConfig);
  45 +
  46 + /**
  47 + * 删除线路配置
  48 + *
  49 + * @param id 线路配置主键
  50 + * @return 结果
  51 + */
  52 + public int deleteLineConfigById(Long id);
  53 +
  54 + /**
  55 + * 批量删除线路配置
  56 + *
  57 + * @param ids 需要删除的数据主键集合
  58 + * @return 结果
  59 + */
  60 + public int deleteLineConfigByIds(Long[] ids);
  61 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/config/service/ILineConfigService.java 0 → 100644
  1 +package com.ruoyi.config.service;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.config.domain.LineConfig;
  5 +
  6 +/**
  7 + * 线路配置Service接口
  8 + *
  9 + * @author Bsth
  10 + * @date 2024-02-05
  11 + */
  12 +public interface ILineConfigService
  13 +{
  14 + /**
  15 + * 查询线路配置
  16 + *
  17 + * @param id 线路配置主键
  18 + * @return 线路配置
  19 + */
  20 + public LineConfig selectLineConfigById(Long id);
  21 +
  22 + /**
  23 + * 查询线路配置列表
  24 + *
  25 + * @param lineConfig 线路配置
  26 + * @return 线路配置集合
  27 + */
  28 + public List<LineConfig> selectLineConfigList(LineConfig lineConfig);
  29 +
  30 + /**
  31 + * 新增线路配置
  32 + *
  33 + * @param lineConfig 线路配置
  34 + * @return 结果
  35 + */
  36 + public int insertLineConfig(LineConfig lineConfig);
  37 +
  38 + /**
  39 + * 修改线路配置
  40 + *
  41 + * @param lineConfig 线路配置
  42 + * @return 结果
  43 + */
  44 + public int updateLineConfig(LineConfig lineConfig);
  45 +
  46 + /**
  47 + * 批量删除线路配置
  48 + *
  49 + * @param ids 需要删除的线路配置主键集合
  50 + * @return 结果
  51 + */
  52 + public int deleteLineConfigByIds(Long[] ids);
  53 +
  54 + /**
  55 + * 删除线路配置信息
  56 + *
  57 + * @param id 线路配置主键
  58 + * @return 结果
  59 + */
  60 + public int deleteLineConfigById(Long id);
  61 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/config/service/impl/LineConfigServiceImpl.java 0 → 100644
  1 +package com.ruoyi.config.service.impl;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.common.utils.DateUtils;
  5 +import com.ruoyi.common.utils.SecurityUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +import com.ruoyi.config.mapper.LineConfigMapper;
  9 +import com.ruoyi.config.domain.LineConfig;
  10 +import com.ruoyi.config.service.ILineConfigService;
  11 +
  12 +/**
  13 + * 线路配置Service业务层处理
  14 + *
  15 + * @author Bsth
  16 + * @date 2024-02-05
  17 + */
  18 +@Service
  19 +public class LineConfigServiceImpl implements ILineConfigService
  20 +{
  21 + @Autowired
  22 + private LineConfigMapper lineConfigMapper;
  23 +
  24 + /**
  25 + * 查询线路配置
  26 + *
  27 + * @param id 线路配置主键
  28 + * @return 线路配置
  29 + */
  30 + @Override
  31 + public LineConfig selectLineConfigById(Long id)
  32 + {
  33 + return lineConfigMapper.selectLineConfigById(id);
  34 + }
  35 +
  36 + /**
  37 + * 查询线路配置列表
  38 + *
  39 + * @param lineConfig 线路配置
  40 + * @return 线路配置
  41 + */
  42 + @Override
  43 + public List<LineConfig> selectLineConfigList(LineConfig lineConfig)
  44 + {
  45 + return lineConfigMapper.selectLineConfigList(lineConfig);
  46 + }
  47 +
  48 + /**
  49 + * 新增线路配置
  50 + *
  51 + * @param lineConfig 线路配置
  52 + * @return 结果
  53 + */
  54 + @Override
  55 + public int insertLineConfig(LineConfig lineConfig)
  56 + {
  57 + lineConfig.setCreateTime(DateUtils.getNowDate());
  58 + lineConfig.setCreateBy(SecurityUtils.getUsername());
  59 + return lineConfigMapper.insertLineConfig(lineConfig);
  60 + }
  61 +
  62 + /**
  63 + * 修改线路配置
  64 + *
  65 + * @param lineConfig 线路配置
  66 + * @return 结果
  67 + */
  68 + @Override
  69 + public int updateLineConfig(LineConfig lineConfig)
  70 + {
  71 + lineConfig.setUpdateTime(DateUtils.getNowDate());
  72 + lineConfig.setUpdateBy(SecurityUtils.getUsername());
  73 + return lineConfigMapper.updateLineConfig(lineConfig);
  74 + }
  75 +
  76 + /**
  77 + * 批量删除线路配置
  78 + *
  79 + * @param ids 需要删除的线路配置主键
  80 + * @return 结果
  81 + */
  82 + @Override
  83 + public int deleteLineConfigByIds(Long[] ids)
  84 + {
  85 + return lineConfigMapper.deleteLineConfigByIds(ids);
  86 + }
  87 +
  88 + /**
  89 + * 删除线路配置信息
  90 + *
  91 + * @param id 线路配置主键
  92 + * @return 结果
  93 + */
  94 + @Override
  95 + public int deleteLineConfigById(Long id)
  96 + {
  97 + return lineConfigMapper.deleteLineConfigById(id);
  98 + }
  99 +}
... ...
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
... ... @@ -10,6 +10,8 @@ import com.ruoyi.common.exception.file.FileUploadException;
10 10 import com.ruoyi.common.utils.DateUtils;
11 11 import com.ruoyi.common.utils.StringUtils;
12 12 import com.ruoyi.common.utils.file.FileUploadUtils;
  13 +import com.ruoyi.config.domain.LineConfig;
  14 +import com.ruoyi.config.service.ILineConfigService;
13 15 import com.ruoyi.domain.RuleAttendanceMain;
14 16 import com.ruoyi.driver.domain.Driver;
15 17 import com.ruoyi.driver.mapper.DriverMapper;
... ... @@ -56,7 +58,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
56 58 import static com.ruoyi.common.ConstEquipmentProperties.*;
57 59 import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_ALCOHOL_EX_NUM;
58 60 import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_NO_EX_NUM;
59   -import static com.ruoyi.common.RuleSchedulingProperties.WORK_FLAG;
  61 +import static com.ruoyi.common.RuleSchedulingProperties.*;
60 62  
61 63  
62 64 /**
... ... @@ -75,6 +77,9 @@ public class ThreadJobService {
75 77 @Autowired
76 78 private ISysNoticeService noticeService;
77 79  
  80 + @Autowired
  81 + private ILineConfigService lineConfigService;
  82 +
78 83 @Resource
79 84 private EmailService emailService;
80 85  
... ... @@ -496,8 +501,8 @@ public class ThreadJobService {
496 501  
497 502 private List<DriverScheduling> getBcList(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) {
498 503 List<DriverScheduling> bcList = new ArrayList<>(1000);
  504 + Map<String, LineConfig> configMap = lineConfigService.selectLineConfigList(null).stream().collect(Collectors.toMap(item -> item.getLineName() + item.getLpName(), item -> item));
499 505 for (String key : originSchedulingMap.keySet()) {
500   -
501 506 List<ResponseSchedulingDto> schedulingList = originSchedulingMap.get(key);
502 507 List<DriverScheduling> nowScheduling = schedulingList.stream()
503 508 .filter(item -> BC_TYPE_IN.equals(item.getBcType()) || BC_TYPE_OUT.equals(item.getBcType()))
... ... @@ -510,32 +515,108 @@ public class ThreadJobService {
510 515 .collect(Collectors.toList());
511 516  
512 517 if (CollectionUtil.isNotEmpty(nowScheduling)) {
513   - if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) {
514   - // 处理错误班次
515   - nowScheduling = handleErrorBc(schedulingList);
516   - }
517   - // 处理松青线
518   - // 松1路牌 签到时间 07:20 |松2路牌 签到时间 07:40 |松3路牌 签到时间 08:35 |松4路牌 签到时间 10:30
519   - if (nowScheduling.get(0).getLineName().equals("松青线") && checkLpName(nowScheduling.get(0))) {
520   - updateScheduling(nowScheduling);
521   - }
522   - // 处理青浦20路 2号路牌 签到时间调整为07:20 | 5号路牌 签到时间调整为07:05
523   - if (nowScheduling.get(0).getLineName().equals("青浦20路")) {
524   - updateQinpu2With5(nowScheduling);
525   - }
526   - // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错
527   - if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) {
528   - nowScheduling = handleQinZhengLine(nowScheduling);
529   - }
  518 + // 配置处理
  519 + nowScheduling = handlerScheduler(configMap, schedulingList, nowScheduling);
  520 + // ------|特殊处理|------
  521 + DriverScheduling scheduling = nowScheduling.get(nowScheduling.size() - 1);
  522 + scheduling.setZdsjT(scheduling.getFcsjT());
  523 + // ------|结束处理|------
530 524 bcList.addAll(nowScheduling);
531 525 } else {
532 526 // 处理无进出场
533   - log.info("无进出场驾驶员工号:{}", schedulingList.get(0).getJobCode());
  527 + log.error("无进出场驾驶员工号:{}", schedulingList.get(0).getJobCode());
534 528 }
535 529 }
536 530 return bcList;
537 531 }
538 532  
  533 + /**
  534 + * 处理特殊班次 TODO 获取配置表修改
  535 + *
  536 + * @param configMap
  537 + * @param schedulingList
  538 + * @param nowScheduling
  539 + * @return
  540 + */
  541 + private List<DriverScheduling> handlerScheduler(Map<String, LineConfig> configMap, List<ResponseSchedulingDto> schedulingList, List<DriverScheduling> nowScheduling) {
  542 + // 处理错误班次
  543 + if (nowScheduling.size() % 2 == 1 && nowScheduling.size() > 2) {
  544 + nowScheduling = handleErrorBc(schedulingList);
  545 + }
  546 +
  547 + // TODO 遍历配置表数据
  548 + updateSchedulerByConfig(nowScheduling, configMap);
  549 +
  550 +
  551 + // 处理松青线
  552 + // 松1路牌 签到时间 07:20 |松2路牌 签到时间 07:40 |松3路牌 签到时间 08:35 |松4路牌 签到时间 10:30
  553 +// if (nowScheduling.get(0).getLineName().equals("松青线") && checkLpName(nowScheduling.get(0))) {
  554 +// updateScheduling(nowScheduling);
  555 +// }
  556 + if (nowScheduling.get(0).getLineName().equals("虹桥枢纽6路") && nowScheduling.get(0).getLpName().equals("9") && nowScheduling.size() == 5){
  557 + nowScheduling.remove(3);
  558 + }
  559 + // 处理青浦20路 2号路牌 签到时间调整为07:20 | 5号路牌 签到时间调整为07:05
  560 + if (nowScheduling.get(0).getLineName().equals("青浦20路")) {
  561 + updateQinpu2With5(nowScheduling);
  562 + }
  563 + // 处理青蒸线区间 区间删除注意特殊情况放到最后可能没有全部都是区间倒是nowScheduling 为0 然后get报错
  564 + if (nowScheduling.get(0).getLineName().startsWith("青蒸线")) {
  565 + nowScheduling = handleQinZhengLine(nowScheduling);
  566 + }
  567 + return nowScheduling;
  568 + }
  569 +
  570 + private void updateSchedulerByConfig(List<DriverScheduling> nowScheduling, Map<String, LineConfig> configMap) {
  571 + try {
  572 + String key = nowScheduling.get(0).getLineName() + nowScheduling.get(0).getLpName();
  573 + // TODO 判断是否存在配置
  574 + LineConfig config = configMap.get(key);
  575 + if (!Objects.isNull(config)) {
  576 + // TODO 判断是否分班
  577 + // TODO 判断是否隔天
  578 + // TODO 判断排班是否正常
  579 + // TODO 获取配置修改排班
  580 + if (config.getSecondFlag().equals(NO_SEGMENTATION) && nowScheduling.size() == 2) {
  581 + handlerFirstSignConfig(config, nowScheduling);
  582 + }
  583 + // 分段
  584 + else if (config.getSecondFlag().equals(HAVE_SEGMENTATION) && nowScheduling.size() == 4) {
  585 + handlerFirstSignConfig(config, nowScheduling);
  586 + handlerSecondSignConfig(config, nowScheduling);
  587 + }
  588 + }
  589 + } catch (Exception e) {
  590 + log.error("配置修改失败,原因为:" + e.getMessage());
  591 + log.error("排班数据为:{}", nowScheduling);
  592 + }
  593 + }
  594 +
  595 + private void handlerSecondSignConfig(LineConfig config, List<DriverScheduling> nowScheduling) {
  596 + LocalDate localDate1 = LocalDate.now();
  597 + LocalDate localDate2 = config.getSecondSignTodayTomorrow().equals(TOMORROW_YES) ? LocalDate.now().plusDays(1) : LocalDate.now();
  598 +
  599 + Date date1 = ConstDateUtil.parseDate(localDate1 + " " + config.getSecondSignInTime() + ":00");
  600 + Date date2 = ConstDateUtil.parseDate(localDate2 + " " + config.getSecondSignOutTime() + ":00");
  601 + if (nowScheduling.size() >= 4) {
  602 + nowScheduling.get(2).setFcsjT(date1.getTime());
  603 + nowScheduling.get(3).setZdsjT(date2.getTime());
  604 + }
  605 + }
  606 +
  607 + private void handlerFirstSignConfig(LineConfig config, List<DriverScheduling> nowScheduling) {
  608 + LocalDate localDate1 = LocalDate.now();
  609 + LocalDate localDate2 = config.getFirstSignTodayTomorrow().equals(TOMORROW_YES) ? LocalDate.now().plusDays(1) : LocalDate.now();
  610 + Date date1 = ConstDateUtil.parseDate(localDate1 + " " + config.getFirstSignInTime() + ":00");
  611 + Date date2 = ConstDateUtil.parseDate(localDate2 + " " + config.getFirstSignOutTime() + ":00");
  612 + if (nowScheduling.size() >= 2) {
  613 + nowScheduling.get(0).setFcsjT(date1.getTime());
  614 + nowScheduling.get(1).setZdsjT(date2.getTime());
  615 + } else {
  616 + nowScheduling.get(0).setFcsjT(date1.getTime());
  617 + }
  618 + }
  619 +
539 620 private void updateQinpu2With5(List<DriverScheduling> nowScheduling) {
540 621 if ("2".equals(nowScheduling.get(0).getLpName())) {
541 622 nowScheduling.get(0).setFcsjT(ConstDateUtil.dateAddition(ConstDateUtil.formatDate("yyyy-MM-dd", new Date(nowScheduling.get(0).getFcsjT())), "07:20:00").getTime());
... ...
Bsth-admin/src/main/resources/mapper/config/LineConfigMapper.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.config.mapper.LineConfigMapper">
  6 +
  7 + <resultMap type="LineConfig" id="LineConfigResult">
  8 + <result property="id" column="id"/>
  9 + <result property="lineName" column="line_name"/>
  10 + <result property="lpName" column="lp_name"/>
  11 + <result property="firstSignInTime" column="first_sign_in_time"/>
  12 + <result property="firstSignOutTime" column="first_sign_out_time"/>
  13 + <result property="firstSignTodayTomorrow" column="first_sign_today_tomorrow"/>
  14 + <result property="secondFlag" column="second_flag"/>
  15 + <result property="secondSignInTime" column="second_sign_in_time"/>
  16 + <result property="secondSignOutTime" column="second_sign_out_time"/>
  17 + <result property="secondSignTodayTomorrow" column="second_sign_today_tomorrow"/>
  18 + <result property="createTime" column="create_time"/>
  19 + <result property="updateTime" column="update_time"/>
  20 + <result property="createBy" column="create_by"/>
  21 + <result property="updateBy" column="update_by"/>
  22 + <result property="remark" column="remark"/>
  23 + </resultMap>
  24 +
  25 + <sql id="selectLineConfigVo">
  26 + select id,
  27 + line_name,
  28 + lp_name,
  29 + first_sign_in_time,
  30 + first_sign_out_time,
  31 + first_sign_today_tomorrow,
  32 + second_flag,
  33 + second_sign_in_time,
  34 + second_sign_out_time,
  35 + second_sign_today_tomorrow,
  36 + create_time,
  37 + update_time,
  38 + create_by,
  39 + update_by,
  40 + remark
  41 + from line_config
  42 + </sql>
  43 +
  44 + <select id="selectLineConfigList" parameterType="LineConfig" resultMap="LineConfigResult">
  45 + <include refid="selectLineConfigVo"/>
  46 + <where>
  47 + <if test="lineName != null and lineName != ''">and line_name like concat('%', #{lineName}, '%')</if>
  48 + <if test="lpName != null and lpName != ''">and lp_name like concat('%', #{lpName}, '%')</if>
  49 + <if test="firstSignInTime != null and firstSignInTime != ''">and first_sign_in_time = #{firstSignInTime}
  50 + </if>
  51 + <if test="firstSignOutTime != null and firstSignOutTime != ''">and first_sign_out_time =
  52 + #{firstSignOutTime}
  53 + </if>
  54 + <if test="firstSignTodayTomorrow != null ">and first_sign_today_tomorrow = #{firstSignTodayTomorrow}</if>
  55 + <if test="secondFlag != null ">and second_flag = #{secondFlag}</if>
  56 + <if test="secondSignInTime != null and secondSignInTime != ''">and second_sign_in_time =
  57 + #{secondSignInTime}
  58 + </if>
  59 + <if test="secondSignOutTime != null and secondSignOutTime != ''">and second_sign_out_time =
  60 + #{secondSignOutTime}
  61 + </if>
  62 + <if test="secondSignTodayTomorrow != null ">and second_sign_today_tomorrow = #{secondSignTodayTomorrow}</if>
  63 + </where>
  64 + </select>
  65 +
  66 + <select id="selectLineConfigById" parameterType="Long" resultMap="LineConfigResult">
  67 + <include refid="selectLineConfigVo"/>
  68 + where id = #{id}
  69 + </select>
  70 +
  71 + <insert id="insertLineConfig" parameterType="LineConfig" useGeneratedKeys="true" keyProperty="id">
  72 + insert into line_config
  73 + <trim prefix="(" suffix=")" suffixOverrides=",">
  74 + <if test="lineName != null and lineName != ''">line_name,</if>
  75 + <if test="lpName != null">lp_name,</if>
  76 + <if test="firstSignInTime != null">first_sign_in_time,</if>
  77 + <if test="firstSignOutTime != null">first_sign_out_time,</if>
  78 + <if test="firstSignTodayTomorrow != null">first_sign_today_tomorrow,</if>
  79 + <if test="secondFlag != null">second_flag,</if>
  80 + <if test="secondSignInTime != null">second_sign_in_time,</if>
  81 + <if test="secondSignOutTime != null">second_sign_out_time,</if>
  82 + <if test="secondSignTodayTomorrow != null">second_sign_today_tomorrow,</if>
  83 + <if test="createTime != null">create_time,</if>
  84 + <if test="updateTime != null">update_time,</if>
  85 + <if test="createBy != null">create_by,</if>
  86 + <if test="updateBy != null">update_by,</if>
  87 + <if test="remark != null">remark,</if>
  88 + </trim>
  89 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  90 + <if test="lineName != null and lineName != ''">#{lineName},</if>
  91 + <if test="lpName != null">#{lpName},</if>
  92 + <if test="firstSignInTime != null">#{firstSignInTime},</if>
  93 + <if test="firstSignOutTime != null">#{firstSignOutTime},</if>
  94 + <if test="firstSignTodayTomorrow != null">#{firstSignTodayTomorrow},</if>
  95 + <if test="secondFlag != null">#{secondFlag},</if>
  96 + <if test="secondSignInTime != null">#{secondSignInTime},</if>
  97 + <if test="secondSignOutTime != null">#{secondSignOutTime},</if>
  98 + <if test="secondSignTodayTomorrow != null">#{secondSignTodayTomorrow},</if>
  99 + <if test="createTime != null">#{createTime},</if>
  100 + <if test="updateTime != null">#{updateTime},</if>
  101 + <if test="createBy != null">#{createBy},</if>
  102 + <if test="updateBy != null">#{updateBy},</if>
  103 + <if test="remark != null">#{remark},</if>
  104 + </trim>
  105 + </insert>
  106 +
  107 + <update id="updateLineConfig" parameterType="LineConfig">
  108 + update line_config
  109 + <trim prefix="SET" suffixOverrides=",">
  110 + <if test="lineName != null and lineName != ''">line_name = #{lineName},</if>
  111 + <if test="lpName != null">lp_name = #{lpName},</if>
  112 + <if test="firstSignInTime != null">first_sign_in_time = #{firstSignInTime},</if>
  113 + <if test="firstSignOutTime != null">first_sign_out_time = #{firstSignOutTime},</if>
  114 + <if test="firstSignTodayTomorrow != null">first_sign_today_tomorrow = #{firstSignTodayTomorrow},</if>
  115 + <if test="secondFlag != null">second_flag = #{secondFlag},</if>
  116 + second_sign_in_time = #{secondSignInTime},
  117 + second_sign_out_time = #{secondSignOutTime},
  118 + second_sign_today_tomorrow = #{secondSignTodayTomorrow},
  119 + <if test="createTime != null">create_time = #{createTime},</if>
  120 + <if test="updateTime != null">update_time = #{updateTime},</if>
  121 + <if test="createBy != null">create_by = #{createBy},</if>
  122 + <if test="updateBy != null">update_by = #{updateBy},</if>
  123 + <if test="remark != null">remark = #{remark},</if>
  124 + </trim>
  125 + where id = #{id}
  126 + </update>
  127 +
  128 + <delete id="deleteLineConfigById" parameterType="Long">
  129 + delete
  130 + from line_config
  131 + where id = #{id}
  132 + </delete>
  133 +
  134 + <delete id="deleteLineConfigByIds" parameterType="String">
  135 + delete from line_config where id in
  136 + <foreach item="id" collection="array" open="(" separator="," close=")">
  137 + #{id}
  138 + </foreach>
  139 + </delete>
  140 +</mapper>
0 141 \ No newline at end of file
... ...