提交 01b483f2 authored 作者: 马路路's avatar 马路路

配置中心—配置管理—问卷配置App端接口--拉运意愿页面相关接口

上级 465ed44f
package com.clx.performance.param.app.collect;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class AppCarrierDriverCollectMainParam {
@Schema(description = "拉运意愿主键id", example = "123")
private Integer id;
@Schema(description = "拉运意愿选项主键id", example = "[2,3,4]")
private List<Integer> recordIdList;
}
package com.clx.performance.param.app.collect;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class AppCarrierDriverCollectSaveParam {
@Schema(description="拉运货物意愿")
List<AppCarrierDriverCollectMainParam> paramList;
}
package com.clx.performance.param.app.collect;
import com.msl.common.base.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class AppCarrierDriverCollectTransportIntentionParam extends PageParam {
@NotBlank(message = "类型:1拉运意向 2拒绝拉运原因,类型不能为空")
@Schema(description="状态:1拉运意向 2拒绝拉运")
private Integer collectType;
}
package com.clx.performance.param.app.collect;
import com.msl.common.base.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class CarrierDriverCollectTransportIntentionListParam extends PageParam {
@Schema(description="问题名称")
@Size(max = 10, message = "问题名称长度不能超过10")
private String collectName;
}
...@@ -34,7 +34,7 @@ public class CarrierDriverCollectTransportIntentionParam extends PageParam { ...@@ -34,7 +34,7 @@ public class CarrierDriverCollectTransportIntentionParam extends PageParam {
@Schema(description="状态:1单选 2多选") @Schema(description="状态:1单选 2多选")
private Integer collectCheckType; private Integer collectCheckType;
@NotBlank(message = "类型:1拉运意向 2拒绝拉运,类型不能为空") @NotBlank(message = "类型:1拉运意向 2拒绝拉运原因,类型不能为空")
@Schema(description="状态:1拉运意向 2拒绝拉运") @Schema(description="状态:1拉运意向 2拒绝拉运")
private Integer collectType; private Integer collectType;
......
package com.clx.performance.controller.app.collect; package com.clx.performance.controller.app.collect;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectSaveParam;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectTransportIntentionParam;
import com.clx.performance.service.collect.CollectDriverTransportIntentionService; import com.clx.performance.service.collect.CollectDriverTransportIntentionService;
import com.clx.performance.service.collect.DriverTransportIntentionInfoService; import com.clx.performance.service.collect.DriverTransportIntentionInfoService;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO; import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO;
...@@ -13,6 +15,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping(value="/app/collect/intention") @RequestMapping(value="/app/collect/intention")
...@@ -24,15 +28,23 @@ public class AppCarrierDriverCollectTransportIntentionController { ...@@ -24,15 +28,23 @@ public class AppCarrierDriverCollectTransportIntentionController {
private final DriverTransportIntentionInfoService driverTransportIntentionInfoService; private final DriverTransportIntentionInfoService driverTransportIntentionInfoService;
private final CollectDriverTransportIntentionService collectDriverTransportIntentionService; private final CollectDriverTransportIntentionService collectDriverTransportIntentionService;
@Operation(summary = "获取已配置的拉运意愿列表",description = "<br>By:马路路") @Operation(summary = "获取Web端已配置的拉运意愿列表",description = "<br>By:马路路")
@PostMapping("/getList") @PostMapping("/getList")
Result<PageData<CarrierDriverCollectTransportIntentionVO>> getList(@RequestBody CarrierDriverCollectTransportIntentionParam param) { Result<PageData<CarrierDriverCollectTransportIntentionVO>> getList(@RequestBody AppCarrierDriverCollectTransportIntentionParam param) {
return Result.ok(); IPage<CarrierDriverCollectTransportIntentionVO> page = collectDriverTransportIntentionService.listCarrierDriverCollectTransportIntentionAll(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
} }
@Operation(summary = "保存已勾选拉运意愿",description = "<br>By:马路路") @Operation(summary = "保存已勾选拉运意愿",description = "<br>By:马路路")
@PostMapping("/getList") @PostMapping("/saveCheckedList")
Result<PageData<CarrierDriverCollectTransportIntentionVO>> saveCheckedList(@RequestBody CarrierDriverCollectTransportIntentionParam param) { public Result<Object> saveCheckedList(@RequestBody AppCarrierDriverCollectSaveParam param) {
driverTransportIntentionInfoService.saveCheckedList(param);
return Result.ok(); return Result.ok();
} }
@Operation(summary = "获取当前用户已勾选信息", description = "<br>By:马路路")
@PostMapping("/getCurrentUserCheckInfo")
public Result<List<CarrierDriverCollectTransportIntentionVO>> getCurrentUserCheckInfo() {
return Result.ok(driverTransportIntentionInfoService.getCurrentUserCheckInfo());
}
} }
package com.clx.performance.controller.pc.collect; package com.clx.performance.controller.pc.collect;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionListParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam; import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam;
import com.clx.performance.service.collect.CollectDriverTransportIntentionService; import com.clx.performance.service.collect.CollectDriverTransportIntentionService;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO; import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO;
...@@ -30,31 +31,35 @@ public class CarrierDriverCollectTransportIntentionController { ...@@ -30,31 +31,35 @@ public class CarrierDriverCollectTransportIntentionController {
@Operation(summary = "新增", description = "<br>By:马路路") @Operation(summary = "新增", description = "<br>By:马路路")
@PostMapping("/add") @PostMapping("/add")
public Integer saveCarrierDriverCollectTransportIntention(@RequestBody @Validated CarrierDriverCollectTransportIntentionParam param) { public Result<Object> saveCarrierDriverCollectTransportIntention(@RequestBody @Validated CarrierDriverCollectTransportIntentionParam param) {
return collectDriverTransportIntentionService.saveCarrierDriverCollectTransportIntention(param); collectDriverTransportIntentionService.saveCarrierDriverCollectTransportIntention(param);
return Result.ok();
} }
@Operation(summary = "编辑更新/拖动更新", description = "<br>By:马路路") @Operation(summary = "编辑更新/拖动更新", description = "<br>By:马路路")
@PostMapping("/update") @PostMapping("/update")
public Integer updateCarrierDriverCollectTransportIntention(@RequestBody @Validated CarrierDriverCollectTransportIntentionParam param) { public Result<Object> updateCarrierDriverCollectTransportIntention(@RequestBody @Validated CarrierDriverCollectTransportIntentionParam param) {
return collectDriverTransportIntentionService.updateCarrierDriverCollectTransportIntention(param); collectDriverTransportIntentionService.updateCarrierDriverCollectTransportIntention(param);
return Result.ok();
} }
@Operation(summary = "删除", description = "<br>By:马路路") @Operation(summary = "删除", description = "<br>By:马路路")
@PostMapping("/delete") @PostMapping("/delete")
public Integer deleteCarrierDriverCollectTransportIntention(@RequestBody List<Integer> param) { public Result<Object> deleteCarrierDriverCollectTransportIntention(@RequestBody List<Integer> param) {
return collectDriverTransportIntentionService.deleteCarrierDriverCollectTransportIntention(param); collectDriverTransportIntentionService.deleteCarrierDriverCollectTransportIntention(param);
return Result.ok();
} }
@Operation(summary = "启用/禁用", description = "<br>By:马路路") @Operation(summary = "启用/禁用", description = "<br>By:马路路")
@PostMapping("/enable") @PostMapping("/enable")
public Integer enableCarrierDriverCollectTransportIntention(@RequestBody @Validated CarrierDriverCollectTransportIntentionParam param) { public Result<Object> enableCarrierDriverCollectTransportIntention(@RequestBody @Validated CarrierDriverCollectTransportIntentionParam param) {
return collectDriverTransportIntentionService.enableCarrierDriverCollectTransportIntention(param); collectDriverTransportIntentionService.enableCarrierDriverCollectTransportIntention(param);
return Result.ok();
} }
@Operation(summary = "列表", description = "<br>By:马路路") @Operation(summary = "列表", description = "<br>By:马路路")
@PostMapping("/list") @PostMapping("/list")
public Result<PageData<CarrierDriverCollectTransportIntentionVO>> listCarrierDriverCollectTransportIntention(@RequestBody CarrierDriverCollectTransportIntentionParam param) { public Result<PageData<CarrierDriverCollectTransportIntentionVO>> listCarrierDriverCollectTransportIntention(@RequestBody CarrierDriverCollectTransportIntentionListParam param) {
IPage<CarrierDriverCollectTransportIntentionVO> page = collectDriverTransportIntentionService.listCarrierDriverCollectTransportIntention(param); IPage<CarrierDriverCollectTransportIntentionVO> page = collectDriverTransportIntentionService.listCarrierDriverCollectTransportIntention(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages()); return Result.page(page.getRecords(), page.getTotal(), page.getPages());
} }
......
package com.clx.performance.dao.collect; package com.clx.performance.dao.collect;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.model.collect.CollectDriverTransportIntentionRecord; import com.clx.performance.param.app.collect.AppCarrierDriverCollectTransportIntentionParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam; import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionListParam;
import com.msl.common.dao.BaseDao; import com.msl.common.dao.BaseDao;
import com.clx.performance.mapper.collect.CollectDriverTransportIntentionMapper; import com.clx.performance.mapper.collect.CollectDriverTransportIntentionMapper;
import com.clx.performance.model.collect.CollectDriverTransportIntention; import com.clx.performance.model.collect.CollectDriverTransportIntention;
import java.util.List;
/** /**
* @author kavin * @author kavin
* Date 2024-10-17 * Date 2024-10-17
...@@ -17,7 +15,7 @@ import java.util.List; ...@@ -17,7 +15,7 @@ import java.util.List;
public interface CollectDriverTransportIntentionDao extends BaseDao<CollectDriverTransportIntentionMapper, CollectDriverTransportIntention, Integer> { public interface CollectDriverTransportIntentionDao extends BaseDao<CollectDriverTransportIntentionMapper, CollectDriverTransportIntention, Integer> {
IPage<CollectDriverTransportIntention> listByCondition(CarrierDriverCollectTransportIntentionParam param); IPage<CollectDriverTransportIntention> listByCondition(CarrierDriverCollectTransportIntentionListParam param);
List<CollectDriverTransportIntention> listEnableInfo(); IPage<CollectDriverTransportIntention> listEnableInfo(AppCarrierDriverCollectTransportIntentionParam param);
} }
...@@ -7,14 +7,12 @@ import com.clx.performance.dao.collect.CollectDriverTransportIntentionDao; ...@@ -7,14 +7,12 @@ import com.clx.performance.dao.collect.CollectDriverTransportIntentionDao;
import com.clx.performance.enums.collect.CollectDriverTransportIntentionEnum; import com.clx.performance.enums.collect.CollectDriverTransportIntentionEnum;
import com.clx.performance.mapper.collect.CollectDriverTransportIntentionMapper; import com.clx.performance.mapper.collect.CollectDriverTransportIntentionMapper;
import com.clx.performance.model.collect.CollectDriverTransportIntention; import com.clx.performance.model.collect.CollectDriverTransportIntention;
import com.clx.performance.model.collect.CollectDriverTransportIntentionRecord; import com.clx.performance.param.app.collect.AppCarrierDriverCollectTransportIntentionParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam; import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionListParam;
import com.msl.common.dao.impl.BaseDaoImpl; import com.msl.common.dao.impl.BaseDaoImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @author kavin * @author kavin
* Date 2024-10-17 * Date 2024-10-17
...@@ -24,7 +22,7 @@ import java.util.List; ...@@ -24,7 +22,7 @@ import java.util.List;
public class CollectDriverTransportIntentionDaoImpl extends BaseDaoImpl<CollectDriverTransportIntentionMapper, CollectDriverTransportIntention, Integer> implements CollectDriverTransportIntentionDao { public class CollectDriverTransportIntentionDaoImpl extends BaseDaoImpl<CollectDriverTransportIntentionMapper, CollectDriverTransportIntention, Integer> implements CollectDriverTransportIntentionDao {
@Override @Override
public IPage<CollectDriverTransportIntention> listByCondition(CarrierDriverCollectTransportIntentionParam param) { public IPage<CollectDriverTransportIntention> listByCondition(CarrierDriverCollectTransportIntentionListParam param) {
LambdaQueryWrapper<CollectDriverTransportIntention> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CollectDriverTransportIntention> query = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(param.getCollectName())) { if (StringUtils.isNotBlank(param.getCollectName())) {
...@@ -36,13 +34,14 @@ public class CollectDriverTransportIntentionDaoImpl extends BaseDaoImpl<CollectD ...@@ -36,13 +34,14 @@ public class CollectDriverTransportIntentionDaoImpl extends BaseDaoImpl<CollectD
} }
@Override @Override
public List<CollectDriverTransportIntention> listEnableInfo() { public IPage<CollectDriverTransportIntention> listEnableInfo(AppCarrierDriverCollectTransportIntentionParam param) {
LambdaQueryWrapper<CollectDriverTransportIntention> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CollectDriverTransportIntention> query = new LambdaQueryWrapper<>();
// 启用状态 // 启用状态
query.eq(CollectDriverTransportIntention::getStatus, query.eq(CollectDriverTransportIntention::getStatus,
CollectDriverTransportIntentionEnum.StatusType.STATUS_ENABLE.getCode()); CollectDriverTransportIntentionEnum.StatusType.STATUS_ENABLE.getCode());
// 按照排序编号降序 // 按照排序编号降序
query.orderByDesc(CollectDriverTransportIntention::getSortNo); query.orderByDesc(CollectDriverTransportIntention::getSortNo);
return baseMapper.selectList(query);
return baseMapper.selectPage(Page.of(param.getPage(), param.getPageSize()), query);
} }
} }
package com.clx.performance.dao.impl.collect; package com.clx.performance.dao.impl.collect;
import com.clx.performance.dao.collect.DriverTransportIntentionInfoDao;
import com.clx.performance.mapper.collect.DriverTransportIntentionInfoMapper;
import com.clx.performance.model.collect.DriverTransportIntentionInfo;
import com.msl.common.dao.impl.BaseDaoImpl; import com.msl.common.dao.impl.BaseDaoImpl;
import com.clx.performance.dao.DriverTransportIntentionInfoDao;
import com.clx.performance.mapper.DriverTransportIntentionInfoMapper;
import com.clx.performance.model.DriverTransportIntentionInfo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
......
package com.clx.performance.service.collect; package com.clx.performance.service.collect;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectTransportIntentionParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionListParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam; import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO; import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO; import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO;
...@@ -21,9 +23,9 @@ public interface CollectDriverTransportIntentionService { ...@@ -21,9 +23,9 @@ public interface CollectDriverTransportIntentionService {
Integer deleteCarrierDriverCollectTransportIntention(List<Integer> param); Integer deleteCarrierDriverCollectTransportIntention(List<Integer> param);
IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntention(CarrierDriverCollectTransportIntentionParam param); IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntention(CarrierDriverCollectTransportIntentionListParam param);
List<CarrierDriverCollectTransportIntentionRecordVO> detailCarrierDriverCollectTransportIntention(Integer param); List<CarrierDriverCollectTransportIntentionRecordVO> detailCarrierDriverCollectTransportIntention(Integer param);
IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntentionAll(); IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntentionAll(AppCarrierDriverCollectTransportIntentionParam param);
} }
package com.clx.performance.service.collect; package com.clx.performance.service.collect;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectSaveParam;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO;
import java.util.List;
/** /**
* @author kavin * @author kavin
* Date 2024-10-18 * Date 2024-10-18
* Time 18:03 * Time 18:03
*/ */
public interface DriverTransportIntentionInfoService { public interface DriverTransportIntentionInfoService {
void saveCheckedList(AppCarrierDriverCollectSaveParam param);
List<CarrierDriverCollectTransportIntentionVO> getCurrentUserCheckInfo();
} }
...@@ -2,13 +2,13 @@ package com.clx.performance.service.impl.collect; ...@@ -2,13 +2,13 @@ package com.clx.performance.service.impl.collect;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.param.applet.PageInternalOrderDistributionRecordParam;
import com.clx.order.vo.applet.InternalOrderDistributionRecordVO;
import com.clx.performance.dao.collect.CollectDriverTransportIntentionDao; import com.clx.performance.dao.collect.CollectDriverTransportIntentionDao;
import com.clx.performance.dao.collect.CollectDriverTransportIntentionRecordDao; import com.clx.performance.dao.collect.CollectDriverTransportIntentionRecordDao;
import com.clx.performance.enums.collect.CollectDriverTransportIntentionEnum; import com.clx.performance.enums.collect.CollectDriverTransportIntentionEnum;
import com.clx.performance.model.collect.CollectDriverTransportIntention; import com.clx.performance.model.collect.CollectDriverTransportIntention;
import com.clx.performance.model.collect.CollectDriverTransportIntentionRecord; import com.clx.performance.model.collect.CollectDriverTransportIntentionRecord;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectTransportIntentionParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionListParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam; import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionParam;
import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionRecordParam; import com.clx.performance.param.app.collect.CarrierDriverCollectTransportIntentionRecordParam;
import com.clx.performance.service.collect.CollectDriverTransportIntentionService; import com.clx.performance.service.collect.CollectDriverTransportIntentionService;
...@@ -16,12 +16,12 @@ import com.clx.performance.struct.collect.CollectDriverTransportIntentionDaoStru ...@@ -16,12 +16,12 @@ import com.clx.performance.struct.collect.CollectDriverTransportIntentionDaoStru
import com.clx.performance.struct.collect.CollectDriverTransportIntentionRecordDaoStruct; import com.clx.performance.struct.collect.CollectDriverTransportIntentionRecordDaoStruct;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO; import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO; import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO;
import com.msl.common.base.PageData;
import com.msl.user.utils.TokenUtil; import com.msl.user.utils.TokenUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
...@@ -154,7 +154,7 @@ public class CollectDriverTransportIntentionServiceImpl implements CollectDriver ...@@ -154,7 +154,7 @@ public class CollectDriverTransportIntentionServiceImpl implements CollectDriver
} }
@Override @Override
public IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntention(CarrierDriverCollectTransportIntentionParam param) { public IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntention(CarrierDriverCollectTransportIntentionListParam param) {
IPage<CollectDriverTransportIntention> page = collectDriverTransportIntentionDao.listByCondition(param); IPage<CollectDriverTransportIntention> page = collectDriverTransportIntentionDao.listByCondition(param);
List<CarrierDriverCollectTransportIntentionVO> list= collectDriverTransportIntentionDaoStruct.covertList(page.getRecords()); List<CarrierDriverCollectTransportIntentionVO> list= collectDriverTransportIntentionDaoStruct.covertList(page.getRecords());
return new Page<CarrierDriverCollectTransportIntentionVO>().setPages(page.getPages()).setTotal(page.getTotal()).setRecords(list); return new Page<CarrierDriverCollectTransportIntentionVO>().setPages(page.getPages()).setTotal(page.getTotal()).setRecords(list);
...@@ -169,16 +169,37 @@ public class CollectDriverTransportIntentionServiceImpl implements CollectDriver ...@@ -169,16 +169,37 @@ public class CollectDriverTransportIntentionServiceImpl implements CollectDriver
} }
@Override @Override
public IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntentionAll() { public IPage<CarrierDriverCollectTransportIntentionVO> listCarrierDriverCollectTransportIntentionAll(AppCarrierDriverCollectTransportIntentionParam param) {
// 1.查询所有 // 1.查询所有已启用的信息
List<CollectDriverTransportIntention> list = collectDriverTransportIntentionDao.listEnableInfo(); IPage<CollectDriverTransportIntention> page = collectDriverTransportIntentionDao.listEnableInfo(param);
List<CarrierDriverCollectTransportIntentionVO> listVO = collectDriverTransportIntentionDaoStruct.covertList(list); if (CollectionUtils.isEmpty(page.getRecords())) {
// todo 错误提示
return null;
}
List<CarrierDriverCollectTransportIntentionVO> listVO = collectDriverTransportIntentionDaoStruct.covertList(page.getRecords());
// 筛选主键id // 筛选主键id
List<Integer> ids = listVO.stream().map(CarrierDriverCollectTransportIntentionVO::getId).toList(); List<Integer> ids = listVO.stream().map(CarrierDriverCollectTransportIntentionVO::getId).toList();
// 2.关联子表 // 2.关联子表
List<CollectDriverTransportIntentionRecord> recordList = collectDriverTransportIntentionRecordDao List<CollectDriverTransportIntentionRecord> recordList = collectDriverTransportIntentionRecordDao
.listInField(CollectDriverTransportIntentionRecord::getCollectDriverTransportIntentionId, ids); .listInField(CollectDriverTransportIntentionRecord::getCollectDriverTransportIntentionId, ids);
// Todo 遍历主表关联子表 if (CollectionUtils.isEmpty(recordList)) {
return null; // todo 错误提示
return null;
}
List<CarrierDriverCollectTransportIntentionRecordVO> recordVOList
= collectDriverTransportIntentionRecordDaoStruct.covertList(recordList);
// 构建map
Map<Integer, List<CarrierDriverCollectTransportIntentionRecordVO>> recordVoMap =
recordVOList.stream().collect(Collectors
.groupingBy(CarrierDriverCollectTransportIntentionRecordVO :: getCollectDriverTransportIntentionId));
// 遍历主编数据,构建子表数据
for(CarrierDriverCollectTransportIntentionVO vo : listVO) {
if (recordVoMap.containsKey(vo.getId())) {
vo.setCollectIntentionRecordList(recordVoMap.get(vo.getId()));
}
}
return new Page<CarrierDriverCollectTransportIntentionVO>().setPages(page.getPages()).setTotal(page.getTotal()).setRecords(listVO);
} }
} }
package com.clx.performance.service.impl.collect; package com.clx.performance.service.impl.collect;
import com.clx.performance.dao.collect.CollectDriverTransportIntentionDao;
import com.clx.performance.dao.collect.CollectDriverTransportIntentionRecordDao;
import com.clx.performance.dao.collect.DriverTransportIntentionInfoDao;
import com.clx.performance.model.collect.CollectDriverTransportIntention;
import com.clx.performance.model.collect.CollectDriverTransportIntentionRecord;
import com.clx.performance.model.collect.DriverTransportIntentionInfo;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectMainParam;
import com.clx.performance.param.app.collect.AppCarrierDriverCollectSaveParam;
import com.clx.performance.service.collect.DriverTransportIntentionInfoService; import com.clx.performance.service.collect.DriverTransportIntentionInfoService;
import com.clx.performance.struct.collect.CollectDriverTransportIntentionDaoStruct;
import com.clx.performance.struct.collect.CollectDriverTransportIntentionRecordDaoStruct;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionRecordVO;
import com.clx.performance.vo.pc.collect.CarrierDriverCollectTransportIntentionVO;
import com.msl.user.utils.TokenUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author kavin * @author kavin
* Date 2024-10-18 * Date 2024-10-18
...@@ -11,5 +30,81 @@ import org.springframework.stereotype.Service; ...@@ -11,5 +30,81 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
@Slf4j @Slf4j
public class DriverTransportIntentionInfoServiceImpl implements DriverTransportIntentionInfoService { @AllArgsConstructor
public class DriverTransportIntentionInfoServiceImpl implements DriverTransportIntentionInfoService {
private final DriverTransportIntentionInfoDao driverTransportIntentionInfoDao;
private final CollectDriverTransportIntentionServiceImpl collectDriverTransportIntentionService;
private final CollectDriverTransportIntentionDao collectDriverTransportIntentionDao;
private final CollectDriverTransportIntentionRecordDao collectDriverTransportIntentionRecordDao;
private final CollectDriverTransportIntentionDaoStruct collectDriverTransportIntentionDaoStruct;
private final CollectDriverTransportIntentionRecordDaoStruct collectDriverTransportIntentionRecordDaoStruct;
@Override
public void saveCheckedList(AppCarrierDriverCollectSaveParam param) {
if (Objects.isNull(param) || CollectionUtils.isEmpty(param.getParamList())) {
// todo 错误提示
}
List<DriverTransportIntentionInfo> driverTransportIntentionInfoList = new ArrayList<>();
for (AppCarrierDriverCollectMainParam saveParam : param.getParamList()) {
if (CollectionUtils.isEmpty(saveParam.getRecordIdList())) {
// todo 错误提示
}
// 遍历已勾选的选项
for (Integer intentionRecordId : saveParam.getRecordIdList()) {
DriverTransportIntentionInfo driverTransportIntentionInfo = new DriverTransportIntentionInfo();
driverTransportIntentionInfo.setCollectTransportIntentionId(saveParam.getId());
driverTransportIntentionInfo.setCollectTransportIntentionRecordId(intentionRecordId);
driverTransportIntentionInfo.setCreateUserNo(TokenUtil.getLoginUserInfo().getUserNo());
driverTransportIntentionInfo.setCreateTime(LocalDateTime.now());
driverTransportIntentionInfo.setModifiedTime(LocalDateTime.now());
driverTransportIntentionInfoList.add(driverTransportIntentionInfo);
}
}
driverTransportIntentionInfoDao.saveBatchList(driverTransportIntentionInfoList);
}
@Override
public List<CarrierDriverCollectTransportIntentionVO> getCurrentUserCheckInfo() {
// 1.根据当前用户查询所有记录
List<DriverTransportIntentionInfo> driverTransportIntentionInfoList =
driverTransportIntentionInfoDao.listByField(DriverTransportIntentionInfo::getCreateUserNo,
TokenUtil.getLoginUserInfo().getUserNo());
if (CollectionUtils.isEmpty(driverTransportIntentionInfoList)) {
// todo 错误提示
}
// 2.组装主子表
// 主表id
Set<Integer> idList = driverTransportIntentionInfoList.stream()
.map(DriverTransportIntentionInfo::getCollectTransportIntentionId).collect(Collectors.toSet());
// 子表id
Set<Integer> idRecordList = driverTransportIntentionInfoList.stream()
.map(DriverTransportIntentionInfo::getCollectTransportIntentionRecordId).collect(Collectors.toSet());
List<CollectDriverTransportIntention> intentionList
= collectDriverTransportIntentionDao.listInField(CollectDriverTransportIntention::getId, idList);
List<CarrierDriverCollectTransportIntentionVO> intentionVOList
= collectDriverTransportIntentionDaoStruct.covertList(intentionList);
List<CollectDriverTransportIntentionRecord> intentionRecordList
= collectDriverTransportIntentionRecordDao.listInField(CollectDriverTransportIntentionRecord::getId, idRecordList);
List<CarrierDriverCollectTransportIntentionRecordVO> intentionRecordVOList
= collectDriverTransportIntentionRecordDaoStruct.covertList(intentionRecordList);
// 构建map
Map<Integer, List<CarrierDriverCollectTransportIntentionRecordVO>> recordMap
= intentionRecordVOList.stream().collect(Collectors
.groupingBy(CarrierDriverCollectTransportIntentionRecordVO::getCollectDriverTransportIntentionId));
for (CarrierDriverCollectTransportIntentionVO vo : intentionVOList) {
if (recordMap.containsKey(vo.getId())) {
vo.setCollectIntentionRecordList(recordMap.get(vo.getId()));
}
}
// 3.返回数据
return intentionVOList;
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论