diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java index 13f1d7ed..ef79cc6a 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java @@ -323,4 +323,11 @@ public class LeaseApplyInfo extends BaseEntity{ @ApiModelProperty(value = "一级类型id结果集") private String firstId; + + @ApiModelProperty(value = "发布时间") + private String releaseTime; + + @ApiModelProperty(value = "查询类型") + private String queryType; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java index e45ab8e2..19901bca 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java @@ -10,11 +10,14 @@ import javax.validation.constraints.NotNull; import cn.hutool.core.convert.Convert; import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; +import com.bonus.common.biz.domain.lease.LeasePublishInfo; import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.log.enums.OperaType; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.archives.service.ArchivesService; import com.bonus.material.back.domain.BackApplyDetails; +import com.bonus.material.back.domain.HandlingOrder; import com.bonus.material.back.domain.MaCode; import com.bonus.material.back.domain.vo.BackAppRequestVo; import com.bonus.material.back.domain.vo.BackApplyInfoVo; @@ -418,4 +421,50 @@ public class BackApplyInfoController extends BaseController { return error("系统错误, " + e.getMessage()); } } + + + + + + /** -------装卸单开始------- */ + + /** + * 新增装卸单 + */ + @ApiOperation(value = "新增装卸单") + @PreventRepeatSubmit + @SysLog(title = "新增装卸单", businessType = OperaType.INSERT, logType = 1, module = "业务办理->新增装卸单") + @PostMapping("/addHandlingOrder") + public AjaxResult addHandlingOrder(@RequestBody HandlingOrder bean) { + return backApplyInfoService.addHandlingOrder(bean); + } + + + /** + * 装卸单列表展示 + */ + @ApiOperation(value = "装卸单列表展示") + @GetMapping("/getHandlingOrderList") + public AjaxResult getHandlingOrderList(HandlingOrder bean) { + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + try { + List list = backApplyInfoService.getHandlingOrderList(bean); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); + } catch (Exception e) { + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, new ArrayList<>())); + } + } + + + @ApiOperation(value = "app退料退回") + @PreventRepeatSubmit + @PostMapping("/uploadSort") + public AjaxResult uploadSort(@RequestBody HandlingOrder bean) { + return backApplyInfoService.uploadSort(bean); + } + + + + /** -------装卸单结束------- */ } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/HandlingOrder.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/HandlingOrder.java new file mode 100644 index 00000000..ddcf9a66 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/HandlingOrder.java @@ -0,0 +1,71 @@ +package com.bonus.material.back.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import lombok.experimental.Accessors; +import java.io.Serializable; + +/** + * 装卸单 HandlingOrder + * @author 16043 + */ + +@Accessors(chain = true) +@Data +@ToString +public class HandlingOrder implements Serializable { + + + @ApiModelProperty(value = "登录用户id") + private Long userId; + + /** ID */ + private Long id; + + @ApiModelProperty(value="工程id") + private Long proId; + + @ApiModelProperty(value="工程名称") + private String proName; + + @ApiModelProperty(value = "车牌号") + private String carCode; + + @ApiModelProperty(value = "联系人") + private String linkMan; + + @ApiModelProperty(value = "联系电话") + private String phone; + + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建时间 + */ + private String createTime; + + /** + * 修改时间 + */ + private String updateTime; + + /** + * 关键字 + */ + private String keyWord; + + private String reserveDate; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java index 19db6dde..453f841f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java @@ -7,6 +7,7 @@ import java.util.List; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.back.domain.BackApplyDetails; import com.bonus.material.back.domain.BackApplyInfo; +import com.bonus.material.back.domain.HandlingOrder; import com.bonus.material.back.domain.MaCodeDto; import com.bonus.material.back.domain.vo.BackApplyInfoVo; import com.bonus.material.back.domain.vo.BackApplyVo; @@ -383,4 +384,33 @@ public interface BackApplyInfoMapper { List selectTypeIdList(Long userId); AjaxResult getMachineByCode(BackApplyInfo dto); + + + /** + * 新增装卸单 + * @param bean + * @return + */ + int addHandlingOrder(HandlingOrder bean); + + /** + * 查询装卸单 + * @param bean + * @return + */ + List getHandlingOrderList(HandlingOrder bean); + + /** + * 排号 + * @param bean + * @return + */ + int uploadSort(HandlingOrder bean); + + /** + * 查询排序号 + * @param bean + * @return + */ + int selectSort(HandlingOrder bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java index 61bcf249..aad658c0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java @@ -5,6 +5,7 @@ import java.util.List; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.back.domain.BackApplyDetails; import com.bonus.material.back.domain.BackApplyInfo; +import com.bonus.material.back.domain.HandlingOrder; import com.bonus.material.back.domain.MaCode; import com.bonus.material.back.domain.vo.BackAppRequestVo; import com.bonus.material.back.domain.vo.BackApplyInfoVo; @@ -167,5 +168,27 @@ public interface IBackApplyInfoService { AjaxResult deleteByApp(Long id); AjaxResult getMachineByCode(BackApplyInfo dto); + + + /** + * 新增装卸单 + * @param bean + * @return + */ + AjaxResult addHandlingOrder(HandlingOrder bean); + + /** + *装卸单列表展示 + * @param bean + * @return + */ + List getHandlingOrderList(HandlingOrder bean); + + /** + * 上传排号 + * @param bean + * @return + */ + AjaxResult uploadSort(HandlingOrder bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 2e41a248..67a3ec3f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -17,9 +17,7 @@ import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; -import com.bonus.material.back.domain.BackApplyDetails; -import com.bonus.material.back.domain.MaCode; -import com.bonus.material.back.domain.MaCodeDto; +import com.bonus.material.back.domain.*; import com.bonus.material.back.domain.vo.*; import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.material.basic.mapper.BmFileInfoMapper; @@ -37,7 +35,6 @@ import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import com.bonus.material.back.mapper.BackApplyInfoMapper; -import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.back.service.IBackApplyInfoService; import org.springframework.transaction.annotation.Transactional; @@ -1549,6 +1546,48 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { return backApplyInfoMapper.getMachineByCode(dto); } + @Override + public AjaxResult addHandlingOrder(HandlingOrder bean) { + try { + Long userId = SecurityUtils.getLoginUser().getUserid(); + bean.setCreateBy(userId.toString()); + int re = backApplyInfoMapper.addHandlingOrder(bean); + if (re>0){ + return AjaxResult.success("添加成功"); + } else { + return AjaxResult.error("添加失败"); + } + } catch (Exception e) { + log.error("添加装卸单失败", e); + return AjaxResult.error("添加装卸单失败"); + } + } + + @Override + public List getHandlingOrderList(HandlingOrder bean) { + return backApplyInfoMapper.getHandlingOrderList(bean); + } + + @Override + public AjaxResult uploadSort(HandlingOrder bean) { + try { + //查询排号是否存在 + int re = backApplyInfoMapper.selectSort(bean); + if (re > 0) { + return AjaxResult.error("排号已存在"); + } + int res = backApplyInfoMapper.uploadSort(bean); + if (res > 0) { + return AjaxResult.success("排号成功"); + } else { + return AjaxResult.error("排号失败"); + } + } catch (Exception e) { + log.error("排号失败", e); + return AjaxResult.error("排号失败"); + } + } + /** * 关键字搜索 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index b1e290b3..4282b0b3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -304,68 +304,94 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { - Long userId = SecurityUtils.getLoginUser().getUserid(); - // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 - List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); - if (CollectionUtils.isEmpty(typeIdList)) { - leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); - } - List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); - // 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接 - if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { - if (((leaseApplyInfo.getStatusList().contains(3) || leaseApplyInfo.getStatusList().contains(4)) && !leaseApplyInfo.getStatusList().contains(1)) - || leaseApplyInfo.getStatusList().containsAll(Arrays.asList(3, 4, 5))) { + try { + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); + } + leaseApplyInfo.setTaskType(2); + // 如果statusList包含3、4、5,则为领料出库查询 + if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { + if (((leaseApplyInfo.getStatusList().contains(3) || leaseApplyInfo.getStatusList().contains(4)) && !leaseApplyInfo.getStatusList().contains(1)) + || leaseApplyInfo.getStatusList().containsAll(Arrays.asList(3, 4, 5))) { + leaseApplyInfo.setTaskType(1); + } + } + //用leaseApplyInfo.getQueryType的值来区分是否是领用出库查询,如果是,时间筛选为发布时间 + List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); + + // 如果leaseApplyInfo.getQueryType的值为1,则为领料出库查询,需查询领用出库数据,进行拼接 + if (leaseApplyInfo.getTaskType()==1){ // 查询领用出库数据 extracted(leaseApplyInfo, list); } - } - if (!CollectionUtils.isEmpty(list)) { - if (leaseApplyInfo.getHasSign() != null && leaseApplyInfo.getHasSign() == 0) { - list = leaseApplyInfoMapper.selectNoSignList(leaseApplyInfo); + if (!CollectionUtils.isEmpty(list)) { + if (leaseApplyInfo.getHasSign() != null && leaseApplyInfo.getHasSign() == 0) { + list = leaseApplyInfoMapper.selectNoSignList(leaseApplyInfo); + } + } + // 使用 Stream API 进行降序排序 + List sortedList =new ArrayList<>(); + if (leaseApplyInfo.getTaskType()==1){ + sortedList = list.stream() + .sorted(Comparator.comparing(LeaseApplyInfo::getReleaseTime, + Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) + .collect(Collectors.toList()); + } else { + sortedList = list.stream() + .sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime, + Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) + .collect(Collectors.toList()); } - } - // 使用 Stream API 进行降序排序 - List sortedList = list.stream() - .sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime, - Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) - .collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(sortedList)) { - if (!CollectionUtils.isEmpty(typeIdList)) { - // 使用流过滤符合条件的元素 - sortedList = sortedList.stream() - .filter(item -> { - String firstIdStr = item.getFirstId(); - if (firstIdStr == null) { - return false; - } - // 将逗号分隔的字符串转为集合 - Set firstIds = Arrays.stream(firstIdStr.split(",")) - .map(String::trim) - .filter(s -> !s.isEmpty()) - .map(Long::parseLong) - .collect(Collectors.toSet()); - // 判断两个集合是否有交集 - return firstIds.stream().anyMatch(typeIdList::contains); - }) - .collect(Collectors.toList()); - } - String keyWord = leaseApplyInfo.getKeyWord(); - // 如果关键字不为空,进行过滤 - if (!StringUtils.isBlank(keyWord)) { - sortedList = sortedList.stream() - .filter(item -> containsKeyword(item, keyWord)) - .collect(Collectors.toList()); - } - // 判断状态 - if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { - // 将集合sortedList中状态taskStatus包含在leaseApplyInfo.getStatusList()中的元素 - sortedList = sortedList.stream() - .filter(item -> leaseApplyInfo.getStatusList().contains(item.getTaskStatus())) - .collect(Collectors.toList()); + +// List sortedList = list.stream() +// .sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime, +// Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) +// .collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(sortedList)) { + if (!CollectionUtils.isEmpty(typeIdList)) { + // 使用流过滤符合条件的元素 + sortedList = sortedList.stream() + .filter(item -> { + String firstIdStr = item.getFirstId(); + if (firstIdStr == null) { + return false; + } + // 将逗号分隔的字符串转为集合 + Set firstIds = Arrays.stream(firstIdStr.split(",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .map(Long::parseLong) + .collect(Collectors.toSet()); + + // 判断两个集合是否有交集 + return firstIds.stream().anyMatch(typeIdList::contains); + }) + .collect(Collectors.toList()); + } + String keyWord = leaseApplyInfo.getKeyWord(); + // 如果关键字不为空,进行过滤 + if (!StringUtils.isBlank(keyWord)) { + sortedList = sortedList.stream() + .filter(item -> containsKeyword(item, keyWord)) + .collect(Collectors.toList()); + } + // 判断状态 + if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { + // 将集合sortedList中状态taskStatus包含在leaseApplyInfo.getStatusList()中的元素 + sortedList = sortedList.stream() + .filter(item -> leaseApplyInfo.getStatusList().contains(item.getTaskStatus())) + .collect(Collectors.toList()); + } } + return sortedList; + } catch (Exception e) { + log.error("查询领料任务列表", e.getMessage()); + return new ArrayList<>(); } - return sortedList; } /** @@ -709,6 +735,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { return AjaxResult.error("任务ID为空,请完善后重新发布!"); } try { + leaseApplyInfo.setReleaseTime(DateUtils.getTime()); int result = leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo); if (result > 0) { // 同步修改tm_task任务状态, 如果不需要审核,改成 LEASE_TASK_IN_PROGRESS, 如果需要审核,改成 LEASE_TASK_TO_AUDIT diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index 0c817acb..d8221442 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -746,6 +746,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now()); + + insert into bm_handling_order (pro_id, car_code, link_man, phone,reserve_date, create_by, + create_time) + values (#{proId}, #{carCode}, #{linkMan}, #{phone},#{reserveDate}, + #{createBy}, now()) + + delete from back_apply_info where id = #{id} @@ -787,6 +794,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" parent_id = #{parentId} and type_id = #{typeId} + + update bm_handling_order + set sort = #{sort} + where id = #{id} + + delete from back_apply_details where code = #{code} and status = '2' @@ -1020,6 +1033,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where user_id = #{userId} + +