车辆管理

This commit is contained in:
lcj
2025-11-03 10:22:19 +08:00
parent b88a92b7e1
commit e9f5e0fa03
15 changed files with 156 additions and 50 deletions

View File

@ -46,18 +46,51 @@ public class MaterialsTest {
@Test
void test() {
// 获取所有材料
List<MatMaterials> materials = materialsService.lambdaQuery()
.eq(MatMaterials::getProjectId, PROJECT_ID)
.list();
Set<Long> materialIds = materials.stream().map(MatMaterials::getId).collect(Collectors.toSet());
// 获取所有材料的出库数据
List<MatMaterialsInventory> inventoryList = materialsInventoryService.lambdaQuery()
.in(MatMaterialsInventory::getMaterialsId, materialIds)
.eq(MatMaterialsInventory::getOutPut, MatMaterialsInventoryOutPutEnum.OUT.getValue())
.list();
// 按表单编号分组
Map<String, List<MatMaterials>> map = materials.stream()
.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) {
String formCode = material.getFormCode();
// 查看入库数据

View File

@ -74,8 +74,8 @@ public class SubConstructionUserFileController extends BaseController {
@Log(title = "施工人员文件存储", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/upload/zip")
public R<Boolean> uploadFileZip(@RequestParam("file") MultipartFile file) {
Boolean result = constructionUserFileService.batchUploadFileByZip(file);
public R<Boolean> uploadFileZip(@RequestParam("file") MultipartFile file, Long projectId) {
Boolean result = constructionUserFileService.batchUploadFileByZip(file, projectId);
return R.ok(result);
}

View File

@ -49,9 +49,10 @@ public interface ISubConstructionUserFileService extends IService<SubConstructio
* 通过zip文件批量上传施工人员文件
*
* @param multipartFile zip文件
* @param projectId 项目id
* @return 是否上传成功
*/
Boolean batchUploadFileByZip(MultipartFile multipartFile);
Boolean batchUploadFileByZip(MultipartFile multipartFile, Long projectId);
/**
* 保存施工人员文件存储

View File

@ -186,11 +186,18 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
* 通过zip文件批量上传施工人员文件
*
* @param multipartFile zip文件
* @param projectId 项目id
* @return 是否上传成功
*/
@Override
@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();
// 校验
@ -202,9 +209,6 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
if (!suffix.equals("zip")) {
throw new ServiceException("请上传zip格式的文件", HttpStatus.BAD_REQUEST);
}
// 1. 获取项目id
String[] parts = originalFilename.split("_");
long projectId = Long.parseLong(parts[1]);
// 压缩包临时文件路径
String randomStr = RandomUtil.randomString(16);
File tempZipFile = null;

View File

@ -5,8 +5,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import java.util.stream.Stream;
//@Configuration
public class WebSocketConfig {

View File

@ -43,6 +43,7 @@ import org.dromara.safety.mapper.HseSafetyInspectionMapper;
import org.dromara.safety.service.IHseSafetyInspectionService;
import org.dromara.safety.service.IHseTeamMeetingService;
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.ISysOssService;
import org.dromara.system.service.ISysUserService;
@ -625,7 +626,10 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
replacementMap.put("${checkTime}", checkTime != null ? DateUtils.formatDateTime(checkTime) : "");
String correctorName = "";
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("${replyDate}", safetyInspection.getReplyDate());

View File

@ -209,8 +209,10 @@ public class HseTeamMeetingServiceImpl extends ServiceImpl<HseTeamMeetingMapper,
.select(SubContractor::getId, SubContractor::getName)
.eq(SubContractor::getId, contractorId);
SubContractor contractor = contractorService.getOne(contractorLambdaQueryWrapper);
if (contractor != null) {
teamMeetingVo.setContractorName(contractor.getName());
}
}
// 查询对应班组
Long teamId = teamMeeting.getTeamId();
if (teamId != null) {
@ -218,8 +220,10 @@ public class HseTeamMeetingServiceImpl extends ServiceImpl<HseTeamMeetingMapper,
.select(BusProjectTeam::getId, BusProjectTeam::getTeamName)
.eq(BusProjectTeam::getId, teamId);
BusProjectTeam projectTeam = projectTeamService.getOne(teamLambdaQueryWrapper);
if (projectTeam != null) {
teamMeetingVo.setTeamName(projectTeam.getTeamName());
}
}
// 查询对应参会用户
String participantId = teamMeeting.getParticipantId();
List<Long> participantIdList = JSONUtil.toList(participantId, Long.class);

View File

@ -21,6 +21,21 @@ public class VehVehicleTripQueryReq implements Serializable {
*/
private Long projectId;
/**
* 出发地
*/
private String startPlace;
/**
* 出发地经度
*/
private String startLng;
/**
* 出发地纬度
*/
private String startLat;
/**
* 目的地
*/

View File

@ -135,6 +135,16 @@ public class VehVehicleTripMyVo implements Serializable {
*/
private Integer isVehicleOwner;
/**
* 申请ID
*/
private Long applyId;
/**
* 申请状态
*/
private String applyStatus;
/**
* 申请列表
*/

View File

@ -150,6 +150,11 @@ public class VehVehicleTripVo implements Serializable {
*/
private String distanceM;
/**
* 距离
*/
private String startEndDistance;
/**
* 距离评分
*/

View File

@ -118,6 +118,10 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe
if (vehicleTrip == null) {
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())) {
throw new ServiceException("行程已取消,请重新选择行程", HttpStatus.BAD_REQUEST);
}
@ -127,6 +131,15 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe
if (!vehicleTrip.getReviewStatus().equals(BusinessStatusEnum.FINISH.getStatus())) {
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);
if (!save) {
throw new ServiceException("新增失败");
@ -361,6 +374,7 @@ public class VehVehicleApplyServiceImpl extends ServiceImpl<VehVehicleApplyMappe
Long userId = LoginHelper.getUserId();
SysUserVo userVo = userService.selectUserById(userId);
passengerPhone = userVo.getPhonenumber();
entity.setPassengerPhone(passengerPhone);
}
if (StringUtils.isNotBlank(passengerPhone) && !PhoneUtil.isPhone(passengerPhone)) {
throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST);

View File

@ -138,7 +138,8 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
List<VehVehicleApply> userApplies = vehicleApplyService.lambdaQuery()
.eq(VehVehicleApply::getCreateBy, userId)
.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())
.list();
// 整合数据
@ -172,7 +173,8 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
.eq(VehVehicleApply::getCreateBy, userId)
.eq("0".equals(type), VehVehicleApply::getStatus, VehApplyStatusEnum.CONFIRMED.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())
.list();
// 整合数据
@ -194,6 +196,7 @@ public class VehVehicleTripServiceImpl extends ServiceImpl<VehVehicleTripMapper,
private LambdaQueryWrapper<VehVehicleTrip> buildQueryWrapper(VehVehicleTripQueryReq req) {
LambdaQueryWrapper<VehVehicleTrip> lqw = Wrappers.lambdaQuery();
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.ge(req.getPeopleNum() != null, VehVehicleTrip::getPeopleNum, req.getPeopleNum());
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);
// 获取当前用户为乘客的信息
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;
}).sorted(Comparator.comparing(VehVehicleTripMyVo::getStartTime))
.toList();

View File

@ -38,6 +38,14 @@
), 2
) AS distanceM,
-- 出发点至重点距离(米)
ROUND(
ST_Distance_Sphere(
POINT(#{req.startLng}, #{req.startLat}),
POINT(#{req.endLng}, #{req.endLat})
), 2
) AS startEndDistance,
-- 2. 距离评分0-100
ROUND(
GREATEST(0, LEAST(100,
@ -83,8 +91,9 @@
), 2) AS total_score
FROM veh_vehicle_trip
<where>
where left_seat > 0
-- 只保留总评分 >= 60 的数据
and total_score >= 60
<if test="req.projectId != null">
AND project_id = #{req.projectId}
</if>
@ -94,10 +103,6 @@
<if test="req.tripStatus != null">
AND trip_status = #{req.tripStatus}
</if>
</where>
-- 只保留总评分 >= 60 的数据
HAVING total_score >= 60
ORDER BY total_score DESC
</select>

View File

@ -1,6 +1,5 @@
package org.dromara.workflow.controller.app;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
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.ui.service.ChartExtService;
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.FlowCategoryVo;
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
import org.dromara.workflow.service.IFlwInstanceService;
import org.dromara.workflow.service.IFlwTaskAssigneeService;
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.stream.Collectors;
@ -29,7 +29,7 @@ import java.util.stream.Collectors;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/workflow/")
@RequestMapping("/app/workflow")
public class FlowAppController {
private final IFlwInstanceService flwInstanceService;
@ -39,21 +39,21 @@ public class FlowAppController {
private final IFlwTaskAssigneeService flwTaskAssigneeService;
@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;
try {
stringObjectMap = flwInstanceService.flowHisTaskList(businessId);
} 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));
Long instanceId = (Long) stringObjectMap.get("instanceId");
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);
if (chartExtService != null) {
chartExtService.initPromptContent(defJson);
@ -63,7 +63,7 @@ public class FlowAppController {
List<NodeJson> nodeList = defJson.getNodeList();
List<NodeJson> nodeJsons = sortNodeList(nodeList);
List<FlowAppVo> appVoList = new ArrayList<>();
for (NodeJson nodeJson : nodeJsons ){
for (NodeJson nodeJson : nodeJsons) {
FlowAppVo appVo = new FlowAppVo();
appVo.setNodeName(nodeJson.getNodeName());
@ -71,20 +71,21 @@ public class FlowAppController {
appVo.setNodeType(nodeJson.getNodeType());
String nodeCode = nodeJson.getNodeCode();
FlowHisTaskVo flowHisTaskVo = map.get(nodeCode);
if(flowHisTaskVo != null){
if (flowHisTaskVo != null) {
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()));
}else {
} else {
UserDTO userDTO = userService.selectUser(Long.valueOf(flowHisTaskVo.getApprover()));
if(userDTO != null){
if (userDTO != null) {
appVo.setApproveAvatar(userDTO.getAvatarUrl());
appVo.setApproveName(userDTO.getNickName());
}
}
}else {
} else {
appVo.setFlowStatus(BusinessStatusEnum.WAITING.getStatus());
if(nodeJson.getNodeType()==1){
if (nodeJson.getNodeType() == 1) {
String permissionFlag = nodeJson.getPermissionFlag();
List<UserDTO> userDTOS = flwTaskAssigneeService.fetchUsersByStorageIds(permissionFlag, projectId);
String auditName = userDTOS.stream().map(UserDTO::getNickName).collect(Collectors.joining(","));

View File

@ -2,11 +2,8 @@ package org.dromara.workflow.domain.vo;
import lombok.Data;
import org.dromara.common.core.domain.dto.UserDTO;
import java.security.PrivilegedAction;
import java.util.List;
import java.util.Map;
import java.util.Date;
@Data
public class FlowAppVo {
@ -47,4 +44,9 @@ public class FlowAppVo {
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
}