车辆管理
This commit is contained in:
@ -46,18 +46,51 @@ public class MaterialsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void test() {
|
||||||
|
// 获取所有材料
|
||||||
List<MatMaterials> materials = materialsService.lambdaQuery()
|
List<MatMaterials> materials = materialsService.lambdaQuery()
|
||||||
.eq(MatMaterials::getProjectId, PROJECT_ID)
|
.eq(MatMaterials::getProjectId, PROJECT_ID)
|
||||||
.list();
|
.list();
|
||||||
Set<Long> materialIds = materials.stream().map(MatMaterials::getId).collect(Collectors.toSet());
|
Set<Long> materialIds = materials.stream().map(MatMaterials::getId).collect(Collectors.toSet());
|
||||||
|
// 获取所有材料的出库数据
|
||||||
List<MatMaterialsInventory> inventoryList = materialsInventoryService.lambdaQuery()
|
List<MatMaterialsInventory> inventoryList = materialsInventoryService.lambdaQuery()
|
||||||
.in(MatMaterialsInventory::getMaterialsId, materialIds)
|
.in(MatMaterialsInventory::getMaterialsId, materialIds)
|
||||||
.eq(MatMaterialsInventory::getOutPut, MatMaterialsInventoryOutPutEnum.OUT.getValue())
|
.eq(MatMaterialsInventory::getOutPut, MatMaterialsInventoryOutPutEnum.OUT.getValue())
|
||||||
.list();
|
.list();
|
||||||
|
// 按表单编号分组
|
||||||
Map<String, List<MatMaterials>> map = materials.stream()
|
Map<String, List<MatMaterials>> map = materials.stream()
|
||||||
.collect(Collectors.groupingBy(MatMaterials::getFormCode));
|
.collect(Collectors.groupingBy(MatMaterials::getFormCode));
|
||||||
|
for (Map.Entry<String, List<MatMaterials>> entry : map.entrySet()) {
|
||||||
|
String formCode = entry.getKey();
|
||||||
|
List<MatMaterials> materialsList = entry.getValue();
|
||||||
|
// 获取入库数据
|
||||||
|
MatMaterialReceive receive = materialReceiveService.lambdaQuery()
|
||||||
|
.eq(MatMaterialReceive::getFormCode, formCode)
|
||||||
|
.one();
|
||||||
|
// 创建领料出库数据
|
||||||
|
MatMaterialIssue issue = new MatMaterialIssue();
|
||||||
|
issue.setProjectId(PROJECT_ID);
|
||||||
|
issue.setMaterialSource("2");
|
||||||
|
issue.setFormCode(formCode);
|
||||||
|
issue.setProjectName(receive.getProjectName());
|
||||||
|
issue.setMaterialName(receive.getMaterialName());
|
||||||
|
issue.setOrderingUnit(receive.getOrderingUnit());
|
||||||
|
issue.setSupplierUnit(receive.getSupplierUnit());
|
||||||
|
// issue.setIssueUnit(inventory.getRecipient());
|
||||||
|
// issue.setIssueUnitId(inventory.getRecipientId());
|
||||||
|
// issue.setShipper(inventory.getShipper());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// issue.setStorageUnit();
|
||||||
|
issue.setCertCount(0);
|
||||||
|
issue.setReportCount(0);
|
||||||
|
issue.setTechDocCount(0);
|
||||||
|
issue.setLicenseCount(0);
|
||||||
|
log.info("领料出库数据:{}", issue);
|
||||||
|
log.info("=============================");
|
||||||
|
}
|
||||||
|
|
||||||
for (MatMaterials material : materials) {
|
for (MatMaterials material : materials) {
|
||||||
String formCode = material.getFormCode();
|
String formCode = material.getFormCode();
|
||||||
// 查看入库数据
|
// 查看入库数据
|
||||||
|
|||||||
@ -74,8 +74,8 @@ public class SubConstructionUserFileController extends BaseController {
|
|||||||
@Log(title = "施工人员文件存储", businessType = BusinessType.INSERT)
|
@Log(title = "施工人员文件存储", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/upload/zip")
|
@PostMapping("/upload/zip")
|
||||||
public R<Boolean> uploadFileZip(@RequestParam("file") MultipartFile file) {
|
public R<Boolean> uploadFileZip(@RequestParam("file") MultipartFile file, Long projectId) {
|
||||||
Boolean result = constructionUserFileService.batchUploadFileByZip(file);
|
Boolean result = constructionUserFileService.batchUploadFileByZip(file, projectId);
|
||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,9 +49,10 @@ public interface ISubConstructionUserFileService extends IService<SubConstructio
|
|||||||
* 通过zip文件批量上传施工人员文件
|
* 通过zip文件批量上传施工人员文件
|
||||||
*
|
*
|
||||||
* @param multipartFile zip文件
|
* @param multipartFile zip文件
|
||||||
|
* @param projectId 项目id
|
||||||
* @return 是否上传成功
|
* @return 是否上传成功
|
||||||
*/
|
*/
|
||||||
Boolean batchUploadFileByZip(MultipartFile multipartFile);
|
Boolean batchUploadFileByZip(MultipartFile multipartFile, Long projectId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存施工人员文件存储
|
* 保存施工人员文件存储
|
||||||
|
|||||||
@ -186,11 +186,18 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
* 通过zip文件批量上传施工人员文件
|
* 通过zip文件批量上传施工人员文件
|
||||||
*
|
*
|
||||||
* @param multipartFile zip文件
|
* @param multipartFile zip文件
|
||||||
|
* @param projectId 项目id
|
||||||
* @return 是否上传成功
|
* @return 是否上传成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean batchUploadFileByZip(MultipartFile multipartFile) {
|
public Boolean batchUploadFileByZip(MultipartFile multipartFile, Long projectId) {
|
||||||
|
if (projectId == null) {
|
||||||
|
throw new ServiceException("项目不存在", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
if (multipartFile == null) {
|
||||||
|
throw new ServiceException("请上传文件", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
// 获取文件原始名字
|
// 获取文件原始名字
|
||||||
String originalFilename = multipartFile.getOriginalFilename();
|
String originalFilename = multipartFile.getOriginalFilename();
|
||||||
// 校验
|
// 校验
|
||||||
@ -202,9 +209,6 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
if (!suffix.equals("zip")) {
|
if (!suffix.equals("zip")) {
|
||||||
throw new ServiceException("请上传zip格式的文件", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("请上传zip格式的文件", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
// 1. 获取项目id
|
|
||||||
String[] parts = originalFilename.split("_");
|
|
||||||
long projectId = Long.parseLong(parts[1]);
|
|
||||||
// 压缩包临时文件路径
|
// 压缩包临时文件路径
|
||||||
String randomStr = RandomUtil.randomString(16);
|
String randomStr = RandomUtil.randomString(16);
|
||||||
File tempZipFile = null;
|
File tempZipFile = null;
|
||||||
|
|||||||
@ -5,8 +5,6 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||||
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
|
|
||||||
//@Configuration
|
//@Configuration
|
||||||
public class WebSocketConfig {
|
public class WebSocketConfig {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import org.dromara.safety.mapper.HseSafetyInspectionMapper;
|
|||||||
import org.dromara.safety.service.IHseSafetyInspectionService;
|
import org.dromara.safety.service.IHseSafetyInspectionService;
|
||||||
import org.dromara.safety.service.IHseTeamMeetingService;
|
import org.dromara.safety.service.IHseTeamMeetingService;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysDictDataService;
|
import org.dromara.system.service.ISysDictDataService;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
@ -625,7 +626,10 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
|||||||
replacementMap.put("${checkTime}", checkTime != null ? DateUtils.formatDateTime(checkTime) : "");
|
replacementMap.put("${checkTime}", checkTime != null ? DateUtils.formatDateTime(checkTime) : "");
|
||||||
String correctorName = "";
|
String correctorName = "";
|
||||||
if (safetyInspection.getCorrectorId() != null) {
|
if (safetyInspection.getCorrectorId() != null) {
|
||||||
correctorName = userService.selectUserById(safetyInspection.getCorrectorId()).getNickName();
|
SysUserVo userVo = userService.selectUserById(safetyInspection.getCorrectorId());
|
||||||
|
if (userVo != null) {
|
||||||
|
correctorName = userVo.getNickName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
replacementMap.put("${correctorName}", correctorName);
|
replacementMap.put("${correctorName}", correctorName);
|
||||||
replacementMap.put("${replyDate}", safetyInspection.getReplyDate());
|
replacementMap.put("${replyDate}", safetyInspection.getReplyDate());
|
||||||
|
|||||||
@ -209,7 +209,9 @@ public class HseTeamMeetingServiceImpl extends ServiceImpl<HseTeamMeetingMapper,
|
|||||||
.select(SubContractor::getId, SubContractor::getName)
|
.select(SubContractor::getId, SubContractor::getName)
|
||||||
.eq(SubContractor::getId, contractorId);
|
.eq(SubContractor::getId, contractorId);
|
||||||
SubContractor contractor = contractorService.getOne(contractorLambdaQueryWrapper);
|
SubContractor contractor = contractorService.getOne(contractorLambdaQueryWrapper);
|
||||||
teamMeetingVo.setContractorName(contractor.getName());
|
if (contractor != null) {
|
||||||
|
teamMeetingVo.setContractorName(contractor.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 查询对应班组
|
// 查询对应班组
|
||||||
Long teamId = teamMeeting.getTeamId();
|
Long teamId = teamMeeting.getTeamId();
|
||||||
@ -218,7 +220,9 @@ public class HseTeamMeetingServiceImpl extends ServiceImpl<HseTeamMeetingMapper,
|
|||||||
.select(BusProjectTeam::getId, BusProjectTeam::getTeamName)
|
.select(BusProjectTeam::getId, BusProjectTeam::getTeamName)
|
||||||
.eq(BusProjectTeam::getId, teamId);
|
.eq(BusProjectTeam::getId, teamId);
|
||||||
BusProjectTeam projectTeam = projectTeamService.getOne(teamLambdaQueryWrapper);
|
BusProjectTeam projectTeam = projectTeamService.getOne(teamLambdaQueryWrapper);
|
||||||
teamMeetingVo.setTeamName(projectTeam.getTeamName());
|
if (projectTeam != null) {
|
||||||
|
teamMeetingVo.setTeamName(projectTeam.getTeamName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 查询对应参会用户
|
// 查询对应参会用户
|
||||||
String participantId = teamMeeting.getParticipantId();
|
String participantId = teamMeeting.getParticipantId();
|
||||||
|
|||||||
@ -21,6 +21,21 @@ public class VehVehicleTripQueryReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出发地
|
||||||
|
*/
|
||||||
|
private String startPlace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出发地经度
|
||||||
|
*/
|
||||||
|
private String startLng;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出发地纬度
|
||||||
|
*/
|
||||||
|
private String startLat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目的地
|
* 目的地
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -135,6 +135,16 @@ public class VehVehicleTripMyVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isVehicleOwner;
|
private Integer isVehicleOwner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请ID
|
||||||
|
*/
|
||||||
|
private Long applyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请状态
|
||||||
|
*/
|
||||||
|
private String applyStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请列表
|
* 申请列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -150,6 +150,11 @@ public class VehVehicleTripVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String distanceM;
|
private String distanceM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 距离
|
||||||
|
*/
|
||||||
|
private String startEndDistance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 距离评分
|
* 距离评分
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -118,6 +118,10 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe
|
|||||||
if (vehicleTrip == null) {
|
if (vehicleTrip == null) {
|
||||||
throw new ServiceException("行程不存在", HttpStatus.NOT_FOUND);
|
throw new ServiceException("行程不存在", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
// 本人无法申请
|
||||||
|
if (Objects.equals(apply.getCreateBy(), LoginHelper.getUserId())) {
|
||||||
|
throw new ServiceException("本人无法申请", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
if (vehicleTrip.getTripStatus().equals(VehTripStatusEnum.CANCELED.getValue())) {
|
if (vehicleTrip.getTripStatus().equals(VehTripStatusEnum.CANCELED.getValue())) {
|
||||||
throw new ServiceException("行程已取消,请重新选择行程", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("行程已取消,请重新选择行程", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
@ -127,6 +131,15 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe
|
|||||||
if (!vehicleTrip.getReviewStatus().equals(BusinessStatusEnum.FINISH.getStatus())) {
|
if (!vehicleTrip.getReviewStatus().equals(BusinessStatusEnum.FINISH.getStatus())) {
|
||||||
throw new ServiceException("行程未通过审核,请重新选择行程", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("行程未通过审核,请重新选择行程", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
// 判断是否为重复申请
|
||||||
|
Long count = this.lambdaQuery()
|
||||||
|
.eq(VehVehicleApply::getTripId, req.getTripId())
|
||||||
|
.eq(VehVehicleApply::getCreateBy, LoginHelper.getUserId())
|
||||||
|
.notIn(VehVehicleApply::getStatus, VehApplyStatusEnum.REJECTED.getValue(), VehApplyStatusEnum.CANCELED.getValue())
|
||||||
|
.count();
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("您已申请过该行程,请勿重复申请", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
boolean save = this.save(apply);
|
boolean save = this.save(apply);
|
||||||
if (!save) {
|
if (!save) {
|
||||||
throw new ServiceException("新增失败");
|
throw new ServiceException("新增失败");
|
||||||
@ -361,6 +374,7 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe
|
|||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
SysUserVo userVo = userService.selectUserById(userId);
|
SysUserVo userVo = userService.selectUserById(userId);
|
||||||
passengerPhone = userVo.getPhonenumber();
|
passengerPhone = userVo.getPhonenumber();
|
||||||
|
entity.setPassengerPhone(passengerPhone);
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(passengerPhone) && !PhoneUtil.isPhone(passengerPhone)) {
|
if (StringUtils.isNotBlank(passengerPhone) && !PhoneUtil.isPhone(passengerPhone)) {
|
||||||
throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST);
|
throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST);
|
||||||
|
|||||||
@ -138,7 +138,8 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
|
|||||||
List<VehVehicleApply> userApplies = vehicleApplyService.lambdaQuery()
|
List<VehVehicleApply> userApplies = vehicleApplyService.lambdaQuery()
|
||||||
.eq(VehVehicleApply::getCreateBy, userId)
|
.eq(VehVehicleApply::getCreateBy, userId)
|
||||||
.eq("1".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.CONFIRMED.getValue())
|
.eq("1".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.CONFIRMED.getValue())
|
||||||
.notIn("2".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue(), VehApplyStatusEnum.ALREADY.getValue())
|
.notIn("2".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue(),
|
||||||
|
VehApplyStatusEnum.ALREADY.getValue(), VehApplyStatusEnum.CANCELED.getValue())
|
||||||
.eq("3".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue())
|
.eq("3".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue())
|
||||||
.list();
|
.list();
|
||||||
// 整合数据
|
// 整合数据
|
||||||
@ -172,7 +173,8 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
|
|||||||
.eq(VehVehicleApply::getCreateBy, userId)
|
.eq(VehVehicleApply::getCreateBy, userId)
|
||||||
.eq("0".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.CONFIRMED.getValue())
|
.eq("0".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.CONFIRMED.getValue())
|
||||||
.eq("1".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ALREADY.getValue())
|
.eq("1".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ALREADY.getValue())
|
||||||
.notIn("2".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue(), VehApplyStatusEnum.ALREADY.getValue())
|
.notIn("2".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue(),
|
||||||
|
VehApplyStatusEnum.ALREADY.getValue(), VehApplyStatusEnum.CANCELED.getValue())
|
||||||
.eq("3".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue())
|
.eq("3".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.ARRIVED.getValue())
|
||||||
.list();
|
.list();
|
||||||
// 整合数据
|
// 整合数据
|
||||||
@ -194,6 +196,7 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
|
|||||||
private LambdaQueryWrapper<VehVehicleTrip> buildQueryWrapper(VehVehicleTripQueryReq req) {
|
private LambdaQueryWrapper<VehVehicleTrip> buildQueryWrapper(VehVehicleTripQueryReq req) {
|
||||||
LambdaQueryWrapper<VehVehicleTrip> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<VehVehicleTrip> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(req.getProjectId() != null, VehVehicleTrip::getProjectId, req.getProjectId());
|
lqw.eq(req.getProjectId() != null, VehVehicleTrip::getProjectId, req.getProjectId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(req.getStartPlace()), VehVehicleTrip::getStartPlace, req.getStartPlace());
|
||||||
lqw.like(StringUtils.isNotBlank(req.getEndPlace()), VehVehicleTrip::getEndPlace, req.getEndPlace());
|
lqw.like(StringUtils.isNotBlank(req.getEndPlace()), VehVehicleTrip::getEndPlace, req.getEndPlace());
|
||||||
lqw.ge(req.getPeopleNum() != null, VehVehicleTrip::getPeopleNum, req.getPeopleNum());
|
lqw.ge(req.getPeopleNum() != null, VehVehicleTrip::getPeopleNum, req.getPeopleNum());
|
||||||
lqw.eq(req.getReviewStatus() != null, VehVehicleTrip::getReviewStatus, req.getReviewStatus());
|
lqw.eq(req.getReviewStatus() != null, VehVehicleTrip::getReviewStatus, req.getReviewStatus());
|
||||||
@ -529,7 +532,14 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
|
|||||||
|
|
||||||
// 是否为行程发起人
|
// 是否为行程发起人
|
||||||
tripMyVo.setIsVehicleOwner(trip.getCreateBy().equals(userId) ? 1 : 0);
|
tripMyVo.setIsVehicleOwner(trip.getCreateBy().equals(userId) ? 1 : 0);
|
||||||
|
// 获取当前用户为乘客的信息
|
||||||
|
VehVehicleApply apply = relatedApplies.stream()
|
||||||
|
.filter(a -> Objects.equals(a.getCreateBy(), userId))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
if (apply != null) {
|
||||||
|
tripMyVo.setApplyId(apply.getId());
|
||||||
|
tripMyVo.setApplyStatus(apply.getStatus());
|
||||||
|
}
|
||||||
return tripMyVo;
|
return tripMyVo;
|
||||||
}).sorted(Comparator.comparing(VehVehicleTripMyVo::getStartTime))
|
}).sorted(Comparator.comparing(VehVehicleTripMyVo::getStartTime))
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
@ -38,6 +38,14 @@
|
|||||||
), 2
|
), 2
|
||||||
) AS distanceM,
|
) AS distanceM,
|
||||||
|
|
||||||
|
-- 出发点至重点距离(米)
|
||||||
|
ROUND(
|
||||||
|
ST_Distance_Sphere(
|
||||||
|
POINT(#{req.startLng}, #{req.startLat}),
|
||||||
|
POINT(#{req.endLng}, #{req.endLat})
|
||||||
|
), 2
|
||||||
|
) AS startEndDistance,
|
||||||
|
|
||||||
-- 2. 距离评分(0-100)
|
-- 2. 距离评分(0-100)
|
||||||
ROUND(
|
ROUND(
|
||||||
GREATEST(0, LEAST(100,
|
GREATEST(0, LEAST(100,
|
||||||
@ -83,21 +91,18 @@
|
|||||||
), 2) AS total_score
|
), 2) AS total_score
|
||||||
|
|
||||||
FROM veh_vehicle_trip
|
FROM veh_vehicle_trip
|
||||||
|
where left_seat > 0
|
||||||
<where>
|
|
||||||
<if test="req.projectId != null">
|
|
||||||
AND project_id = #{req.projectId}
|
|
||||||
</if>
|
|
||||||
<if test="req.reviewStatus != null">
|
|
||||||
AND review_status = #{req.reviewStatus}
|
|
||||||
</if>
|
|
||||||
<if test="req.tripStatus != null">
|
|
||||||
AND trip_status = #{req.tripStatus}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
|
|
||||||
-- 只保留总评分 >= 60 的数据
|
-- 只保留总评分 >= 60 的数据
|
||||||
HAVING total_score >= 60
|
and total_score >= 60
|
||||||
|
<if test="req.projectId != null">
|
||||||
|
AND project_id = #{req.projectId}
|
||||||
|
</if>
|
||||||
|
<if test="req.reviewStatus != null">
|
||||||
|
AND review_status = #{req.reviewStatus}
|
||||||
|
</if>
|
||||||
|
<if test="req.tripStatus != null">
|
||||||
|
AND trip_status = #{req.tripStatus}
|
||||||
|
</if>
|
||||||
|
|
||||||
ORDER BY total_score DESC
|
ORDER BY total_score DESC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package org.dromara.workflow.controller.app;
|
package org.dromara.workflow.controller.app;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.domain.dto.UserDTO;
|
import org.dromara.common.core.domain.dto.UserDTO;
|
||||||
@ -13,14 +12,15 @@ import org.dromara.warm.flow.core.entity.Instance;
|
|||||||
import org.dromara.warm.flow.core.invoker.FrameInvoker;
|
import org.dromara.warm.flow.core.invoker.FrameInvoker;
|
||||||
import org.dromara.warm.flow.ui.service.ChartExtService;
|
import org.dromara.warm.flow.ui.service.ChartExtService;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
import org.dromara.workflow.domain.bo.FlowCategoryBo;
|
|
||||||
import org.dromara.workflow.domain.vo.FlowAppVo;
|
import org.dromara.workflow.domain.vo.FlowAppVo;
|
||||||
import org.dromara.workflow.domain.vo.FlowCategoryVo;
|
|
||||||
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
||||||
import org.dromara.workflow.service.IFlwInstanceService;
|
import org.dromara.workflow.service.IFlwInstanceService;
|
||||||
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -29,7 +29,7 @@ import java.util.stream.Collectors;
|
|||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/workflow/")
|
@RequestMapping("/app/workflow")
|
||||||
public class FlowAppController {
|
public class FlowAppController {
|
||||||
|
|
||||||
private final IFlwInstanceService flwInstanceService;
|
private final IFlwInstanceService flwInstanceService;
|
||||||
@ -39,21 +39,21 @@ public class FlowAppController {
|
|||||||
private final IFlwTaskAssigneeService flwTaskAssigneeService;
|
private final IFlwTaskAssigneeService flwTaskAssigneeService;
|
||||||
|
|
||||||
@GetMapping("/{businessId}")
|
@GetMapping("/{businessId}")
|
||||||
public R<List<FlowAppVo>> list(@PathVariable("businessId") String businessId,Long projectId) {
|
public R<List<FlowAppVo>> list(@PathVariable("businessId") String businessId, Long projectId) {
|
||||||
Map<String, Object> stringObjectMap;
|
Map<String, Object> stringObjectMap;
|
||||||
try {
|
try {
|
||||||
stringObjectMap = flwInstanceService.flowHisTaskList(businessId);
|
stringObjectMap = flwInstanceService.flowHisTaskList(businessId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return R.ok(null,null);
|
return R.ok(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<FlowHisTaskVo> list= (List<FlowHisTaskVo>) stringObjectMap.get("list");
|
List<FlowHisTaskVo> list = (List<FlowHisTaskVo>) stringObjectMap.get("list");
|
||||||
Map<String, FlowHisTaskVo> map = list.stream().collect(Collectors.toMap(FlowHisTaskVo::getNodeCode, vo -> vo));
|
Map<String, FlowHisTaskVo> map = list.stream().collect(Collectors.toMap(FlowHisTaskVo::getNodeCode, vo -> vo));
|
||||||
|
|
||||||
|
|
||||||
Long instanceId = (Long) stringObjectMap.get("instanceId");
|
Long instanceId = (Long) stringObjectMap.get("instanceId");
|
||||||
String defJsonStr = ((Instance) FlowEngine.insService().getById(instanceId)).getDefJson();
|
String defJsonStr = ((Instance) FlowEngine.insService().getById(instanceId)).getDefJson();
|
||||||
DefJson defJson = (DefJson)FlowEngine.jsonConvert.strToBean(defJsonStr, DefJson.class);
|
DefJson defJson = (DefJson) FlowEngine.jsonConvert.strToBean(defJsonStr, DefJson.class);
|
||||||
ChartExtService chartExtService = (ChartExtService) FrameInvoker.getBean(ChartExtService.class);
|
ChartExtService chartExtService = (ChartExtService) FrameInvoker.getBean(ChartExtService.class);
|
||||||
if (chartExtService != null) {
|
if (chartExtService != null) {
|
||||||
chartExtService.initPromptContent(defJson);
|
chartExtService.initPromptContent(defJson);
|
||||||
@ -62,8 +62,8 @@ public class FlowAppController {
|
|||||||
|
|
||||||
List<NodeJson> nodeList = defJson.getNodeList();
|
List<NodeJson> nodeList = defJson.getNodeList();
|
||||||
List<NodeJson> nodeJsons = sortNodeList(nodeList);
|
List<NodeJson> nodeJsons = sortNodeList(nodeList);
|
||||||
List<FlowAppVo> appVoList = new ArrayList<>();
|
List<FlowAppVo> appVoList = new ArrayList<>();
|
||||||
for (NodeJson nodeJson : nodeJsons ){
|
for (NodeJson nodeJson : nodeJsons) {
|
||||||
FlowAppVo appVo = new FlowAppVo();
|
FlowAppVo appVo = new FlowAppVo();
|
||||||
|
|
||||||
appVo.setNodeName(nodeJson.getNodeName());
|
appVo.setNodeName(nodeJson.getNodeName());
|
||||||
@ -71,20 +71,21 @@ public class FlowAppController {
|
|||||||
appVo.setNodeType(nodeJson.getNodeType());
|
appVo.setNodeType(nodeJson.getNodeType());
|
||||||
String nodeCode = nodeJson.getNodeCode();
|
String nodeCode = nodeJson.getNodeCode();
|
||||||
FlowHisTaskVo flowHisTaskVo = map.get(nodeCode);
|
FlowHisTaskVo flowHisTaskVo = map.get(nodeCode);
|
||||||
if(flowHisTaskVo != null){
|
if (flowHisTaskVo != null) {
|
||||||
appVo.setFlowStatus(flowHisTaskVo.getFlowStatus());
|
appVo.setFlowStatus(flowHisTaskVo.getFlowStatus());
|
||||||
if(BusinessStatusEnum.WAITING.getStatus().equals(flowHisTaskVo.getFlowStatus())){
|
appVo.setCreateTime(flowHisTaskVo.getCreateTime());
|
||||||
|
if (BusinessStatusEnum.WAITING.getStatus().equals(flowHisTaskVo.getFlowStatus())) {
|
||||||
appVo.setAuditName(userService.selectNicknameByIds(flowHisTaskVo.getApprover()));
|
appVo.setAuditName(userService.selectNicknameByIds(flowHisTaskVo.getApprover()));
|
||||||
}else {
|
} else {
|
||||||
UserDTO userDTO = userService.selectUser(Long.valueOf(flowHisTaskVo.getApprover()));
|
UserDTO userDTO = userService.selectUser(Long.valueOf(flowHisTaskVo.getApprover()));
|
||||||
if(userDTO != null){
|
if (userDTO != null) {
|
||||||
appVo.setApproveAvatar(userDTO.getAvatarUrl());
|
appVo.setApproveAvatar(userDTO.getAvatarUrl());
|
||||||
appVo.setApproveName(userDTO.getNickName());
|
appVo.setApproveName(userDTO.getNickName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
appVo.setFlowStatus(BusinessStatusEnum.WAITING.getStatus());
|
appVo.setFlowStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||||
if(nodeJson.getNodeType()==1){
|
if (nodeJson.getNodeType() == 1) {
|
||||||
String permissionFlag = nodeJson.getPermissionFlag();
|
String permissionFlag = nodeJson.getPermissionFlag();
|
||||||
List<UserDTO> userDTOS = flwTaskAssigneeService.fetchUsersByStorageIds(permissionFlag, projectId);
|
List<UserDTO> userDTOS = flwTaskAssigneeService.fetchUsersByStorageIds(permissionFlag, projectId);
|
||||||
String auditName = userDTOS.stream().map(UserDTO::getNickName).collect(Collectors.joining(","));
|
String auditName = userDTOS.stream().map(UserDTO::getNickName).collect(Collectors.joining(","));
|
||||||
|
|||||||
@ -2,11 +2,8 @@ package org.dromara.workflow.domain.vo;
|
|||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.core.domain.dto.UserDTO;
|
|
||||||
|
|
||||||
import java.security.PrivilegedAction;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FlowAppVo {
|
public class FlowAppVo {
|
||||||
@ -47,4 +44,9 @@ public class FlowAppVo {
|
|||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user