Merge branch 'development' of http://pms.dtyx.net:3000/cuizhibin/znpt-backend into development
This commit is contained in:
commit
71f39d8732
|
@ -177,6 +177,9 @@ public class EquipmentEntity extends AuditableEntity implements Serializable {
|
|||
@ApiModelProperty("发票状态")
|
||||
private String invoiceStatus;
|
||||
|
||||
@ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成")
|
||||
private String procurementStatus;
|
||||
|
||||
@ApiModelProperty("附件")
|
||||
private String attachments;
|
||||
|
||||
|
|
|
@ -154,6 +154,9 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成")
|
||||
private String procurementStatus;
|
||||
|
||||
// 移除备用状态字段,使用现有的 location_status 字段
|
||||
// @ApiModelProperty("备用状态")
|
||||
// private String spareStatus;
|
||||
|
|
|
@ -17,20 +17,29 @@ import java.util.List;
|
|||
@ApiModel(value="ProjectKanbanDataResp对象", description="项目看板数据响应")
|
||||
public class ProjectKanbanDataResp {
|
||||
|
||||
@ApiModelProperty("待施工项目列表")
|
||||
@ApiModelProperty("未开工项目列表")
|
||||
private List<ProjectKanbanItem> pendingProjects;
|
||||
|
||||
@ApiModelProperty("施工中项目列表")
|
||||
@ApiModelProperty("筹备中项目列表")
|
||||
private List<ProjectKanbanItem> preparingProjects;
|
||||
|
||||
@ApiModelProperty("开工中项目列表")
|
||||
private List<ProjectKanbanItem> inProgressProjects;
|
||||
|
||||
@ApiModelProperty("暂停中项目列表")
|
||||
private List<ProjectKanbanItem> suspendedProjects;
|
||||
|
||||
@ApiModelProperty("已完工项目列表")
|
||||
private List<ProjectKanbanItem> completedProjects;
|
||||
|
||||
@ApiModelProperty("已审核项目列表")
|
||||
private List<ProjectKanbanItem> auditedProjects;
|
||||
@ApiModelProperty("验收中项目列表")
|
||||
private List<ProjectKanbanItem> acceptanceProjects;
|
||||
|
||||
@ApiModelProperty("已验收项目列表")
|
||||
private List<ProjectKanbanItem> acceptedProjects;
|
||||
@ApiModelProperty("回款中项目列表")
|
||||
private List<ProjectKanbanItem> collectionProjects;
|
||||
|
||||
@ApiModelProperty("已结算项目列表")
|
||||
private List<ProjectKanbanItem> settledProjects;
|
||||
|
||||
@Data
|
||||
@ApiModel(value="ProjectKanbanItem对象", description="项目看板项目项")
|
||||
|
|
|
@ -19,17 +19,26 @@ public class ProjectKanbanStatsResp {
|
|||
@ApiModelProperty("待施工项目数")
|
||||
private Long pendingProjectCount;
|
||||
|
||||
@ApiModelProperty("施工中项目数")
|
||||
@ApiModelProperty("筹备中项目数")
|
||||
private Long preparingProjectCount;
|
||||
|
||||
@ApiModelProperty("开工中项目数")
|
||||
private Long inProgressProjectCount;
|
||||
|
||||
@ApiModelProperty("暂停中项目数")
|
||||
private Long suspendedProjectCount;
|
||||
|
||||
@ApiModelProperty("已完工项目数")
|
||||
private Long completedProjectCount;
|
||||
|
||||
@ApiModelProperty("已审核项目数")
|
||||
private Long auditedProjectCount;
|
||||
@ApiModelProperty("验收中项目数")
|
||||
private Long acceptanceProjectCount;
|
||||
|
||||
@ApiModelProperty("已验收项目数")
|
||||
private Long acceptedProjectCount;
|
||||
@ApiModelProperty("回款中项目数")
|
||||
private Long collectionProjectCount;
|
||||
|
||||
@ApiModelProperty("已结算项目数")
|
||||
private Long settledProjectCount;
|
||||
|
||||
@ApiModelProperty("总机组数")
|
||||
private Long totalTurbineCount;
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author wangna
|
||||
* @date 2025/08/05
|
||||
* @Description: 团队成员更新请求类(用于更新操作,移除必填验证)
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="TeamMemberUpdateReq对象", description="团队成员更新请求类")
|
||||
public class TeamMemberUpdateReq implements Serializable {
|
||||
|
||||
@ApiModelProperty("项目ID")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("机组ID(可选)")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("任务组ID(可选)")
|
||||
private String taskGroupId;
|
||||
|
||||
@ApiModelProperty("任务ID(可选)")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("项目角色类型:PROJECT_MANAGER-项目经理,SAFETY_OFFICER-安全员,QUALITY_OFFICER-质量员,CONSTRUCTOR-施工人员,TEAM_LEADER-施工组长")
|
||||
private String roleType;
|
||||
|
||||
@ApiModelProperty("具体岗位代码(如:GROUND_SERVICE-地勤,DRIVER-司机,ASCENDING-登高等)")
|
||||
private String jobCode;
|
||||
|
||||
@ApiModelProperty("岗位描述")
|
||||
private String jobDesc;
|
||||
|
||||
@ApiModelProperty("加入时间")
|
||||
private LocalDate joinDate;
|
||||
|
||||
@ApiModelProperty("离开时间")
|
||||
private LocalDate leaveDate;
|
||||
|
||||
@ApiModelProperty("状态:ACTIVE-在职,INACTIVE-离职,PENDING-待入职")
|
||||
private String status = "ACTIVE";
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("用户电话")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("用户邮箱")
|
||||
private String email;
|
||||
}
|
|
@ -15,11 +15,14 @@ import java.util.List;
|
|||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ProjectStatusEnum {
|
||||
PENDING(0, "待施工"),
|
||||
IN_PROGRESS(1, "施工中"),
|
||||
COMPLETED(2, "已完工"),
|
||||
AUDITED(3, "已审核"),
|
||||
ACCEPTED(4, "已验收");
|
||||
PENDING(0, "未开工"),
|
||||
PREPARING(1, "筹备中"),
|
||||
IN_PROGRESS(2, "开工中"),
|
||||
SUSPENDED(3, "暂停中"),
|
||||
COMPLETED(4, "已完工"),
|
||||
IN_ACCEPTANCE(5, "验收中"),
|
||||
IN_COLLECTION(6, "回款中"),
|
||||
SETTLED(7, "已结算");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
|
|
@ -17,13 +17,23 @@ public interface BusinessDataFileMapper {
|
|||
// 新增文件预览方法
|
||||
|
||||
|
||||
public List<BusinessDataFileEntity> List(@Param("folderId") Long folderId, @Param("fileName") String fileName);
|
||||
void delete(@Param("fileId") Long fileId,@Param("folderId") Long folderId);
|
||||
// public List<BusinessDataFileEntity> List(@Param("folderId") Long folderId, @Param("fileName") String fileName);
|
||||
|
||||
public List<BusinessDataFileEntity> List(
|
||||
@Param("folderId") Long folderId,
|
||||
@Param("fileName") String fileName,
|
||||
@Param("sortField") String sortField,
|
||||
@Param("sortOrder") String sortOrder);
|
||||
void delete(@Param("fileId") Long fileId,
|
||||
@Param("folderId") Long folderId);
|
||||
|
||||
void add(BusinessDataFileEntity businessDataFileEntity);
|
||||
|
||||
String getPath(Long fileId);
|
||||
|
||||
// 在接口中添加重命名方法
|
||||
void reName(@Param("fileId") Long fileId, @Param("newFileName") String newFileName, @Param("newFilePath") String newFilePath);
|
||||
void reName(@Param("fileId") Long fileId,
|
||||
@Param("newFileName") String newFileName,
|
||||
@Param("newFilePath") String newFilePath);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,8 +14,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
@Service
|
||||
public interface BusinessDataFileService {
|
||||
|
||||
// @ApiOperation("分页查询文件")
|
||||
// PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName);
|
||||
@ApiOperation("分页查询文件")
|
||||
PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName);
|
||||
PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder);
|
||||
|
||||
@ApiOperation("删除文件")
|
||||
Result delete(@RequestParam(value = "fileId", required = false) Long fileId,@RequestParam(value = "foldelId", required = false) Long folderId);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
/**
|
||||
* 设备状态更新服务接口
|
||||
* 用于处理设备审批后的状态更新,避免循环依赖
|
||||
*
|
||||
* @author Bear.G
|
||||
* @date 2025/1/8/周三 17:50
|
||||
*/
|
||||
public interface EquipmentStatusUpdateService {
|
||||
|
||||
/**
|
||||
* 更新设备采购状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param status 新状态
|
||||
*/
|
||||
void updateProcurementStatus(String equipmentId, String status);
|
||||
|
||||
/**
|
||||
* 更新设备借用状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param status 新状态
|
||||
*/
|
||||
void updateBorrowStatus(String equipmentId, String status);
|
||||
|
||||
/**
|
||||
* 更新设备归还状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param status 新状态
|
||||
*/
|
||||
void updateReturnStatus(String equipmentId, String status);
|
||||
|
||||
/**
|
||||
* 更新设备位置状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param locationStatus 新位置状态
|
||||
*/
|
||||
void updateLocationStatus(String equipmentId, String locationStatus);
|
||||
|
||||
/**
|
||||
* 更新设备使用状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param useStatus 新使用状态
|
||||
*/
|
||||
void updateUseStatus(String equipmentId, String useStatus);
|
||||
}
|
|
@ -27,6 +27,11 @@ public interface ProjectMemberService extends IService<ProjectMemberEntity> {
|
|||
*/
|
||||
ProjectMemberResp updateTeamMember(String memberId, TeamMemberReq req);
|
||||
|
||||
/**
|
||||
* 更新团队成员信息(使用更新专用请求类)
|
||||
*/
|
||||
ProjectMemberResp updateTeamMember(String memberId, TeamMemberUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除团队成员(支持单个或批量删除)
|
||||
*/
|
||||
|
|
|
@ -52,15 +52,33 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
private BusinessDataService businessDataService;
|
||||
|
||||
|
||||
@ApiOperation("分页查询文件")
|
||||
@Override
|
||||
public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName);
|
||||
Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
return pageBean;
|
||||
}
|
||||
// @ApiOperation("分页查询文件")
|
||||
// @Override
|
||||
// public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) {
|
||||
// PageHelper.startPage(page, pageSize);
|
||||
// List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName);
|
||||
// Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
// PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
// return pageBean;
|
||||
// }
|
||||
// @ApiOperation("分页查询文件")
|
||||
// @Override
|
||||
// public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder) {
|
||||
// PageHelper.startPage(page, pageSize);
|
||||
// List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName, sortField, sortOrder);
|
||||
// Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
// PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
// return pageBean;
|
||||
// }
|
||||
@ApiOperation("分页查询文件")
|
||||
@Override
|
||||
public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName, sortField, sortOrder);
|
||||
Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
return pageBean;
|
||||
}
|
||||
@ApiOperation("删除文件")
|
||||
public Result delete(Long fileId, Long folderId) {
|
||||
//删除数据库数据
|
||||
|
@ -228,7 +246,7 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
byte[] bytes = file.getBytes();
|
||||
String uploadDir = businessDataService.getPath(folderId);
|
||||
|
||||
File uploadedFile = new File(uploadDir + "\\" + file.getOriginalFilename());
|
||||
File uploadedFile = new File(uploadDir + "/" + file.getOriginalFilename());
|
||||
if (uploadedFile.exists()) {
|
||||
return Result.error("文件已存在");
|
||||
}
|
||||
|
@ -238,12 +256,11 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
BusinessDataFileEntity fileEntity = new BusinessDataFileEntity();
|
||||
fileEntity.setFolderId(folderId);
|
||||
fileEntity.setFileName(file.getOriginalFilename());
|
||||
fileEntity.setFilePath(uploadDir + "\\" + file.getOriginalFilename());
|
||||
fileEntity.setFilePath(uploadDir + "/" + file.getOriginalFilename());
|
||||
fileEntity.setFileType(file.getContentType());
|
||||
fileEntity.setFileSize(file.getSize()/1024);
|
||||
fileEntity.setUploadTime(new Date());
|
||||
fileEntity.setUploaderId(loginIdAsLong);
|
||||
System.out.println(uploadDir + "\\" + file.getOriginalFilename());
|
||||
add(fileEntity);
|
||||
|
||||
return Result.okM("上传成功");
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.dite.znpt.domain.vo.EquipmentApprovalReq;
|
|||
import com.dite.znpt.domain.vo.EquipmentApprovalResp;
|
||||
import com.dite.znpt.domain.vo.EquipmentProcurementApplyReq;
|
||||
import com.dite.znpt.service.EquipmentApprovalService;
|
||||
import com.dite.znpt.service.EquipmentStatusUpdateService;
|
||||
import com.dite.znpt.websocket.SimpleWebSocketHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
@ -34,6 +35,9 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
|
||||
@Resource
|
||||
private EquipmentApprovalMapper equipmentApprovalMapper;
|
||||
|
||||
@Resource
|
||||
private EquipmentStatusUpdateService equipmentStatusUpdateService;
|
||||
|
||||
@Override
|
||||
public IPage<EquipmentApprovalResp> getPendingApprovals(EquipmentApprovalListReq req) {
|
||||
|
@ -85,6 +89,21 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
entity.setApprovalComment(req.getApprovalComment());
|
||||
|
||||
equipmentApprovalMapper.updateById(entity);
|
||||
|
||||
// 审批通过后,更新设备状态
|
||||
try {
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateProcurementStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateBorrowStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateReturnStatus(entity.getEquipmentId(), "APPROVED");
|
||||
}
|
||||
log.info("设备状态更新成功,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId);
|
||||
} catch (Exception e) {
|
||||
log.error("设备状态更新失败,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId, e);
|
||||
// 不抛出异常,避免影响审批流程
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,6 +120,21 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
entity.setApprovalComment(req.getApprovalComment());
|
||||
|
||||
equipmentApprovalMapper.updateById(entity);
|
||||
|
||||
// 审批拒绝后,更新设备状态
|
||||
try {
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateProcurementStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateBorrowStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateReturnStatus(entity.getEquipmentId(), "REJECTED");
|
||||
}
|
||||
log.info("设备状态更新成功,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId);
|
||||
} catch (Exception e) {
|
||||
log.error("设备状态更新失败,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId, e);
|
||||
// 不抛出异常,避免影响审批流程
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -264,7 +298,7 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
|
||||
// 更新设备采购状态 - 新增逻辑
|
||||
try {
|
||||
updateEquipmentProcurementStatus(req.getEquipmentId(), "PENDING_APPROVAL");
|
||||
equipmentStatusUpdateService.updateProcurementStatus(req.getEquipmentId(), "PENDING_APPROVAL");
|
||||
log.info("设备采购状态更新成功,设备ID: {}", req.getEquipmentId());
|
||||
} catch (Exception e) {
|
||||
log.error("设备采购状态更新失败,设备ID: {}", req.getEquipmentId(), e);
|
||||
|
@ -297,7 +331,7 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
log.warn("设备ID为空,跳过状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
log.info("准备更新设备采购状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
|
@ -316,6 +350,108 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 审批通过后更新设备状态
|
||||
*/
|
||||
private void updateEquipmentStatusAfterApproval(EquipmentApprovalEntity entity) {
|
||||
if (entity == null || entity.getEquipmentId() == null) {
|
||||
log.warn("审批实体或设备ID为空,跳过状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("审批通过后更新设备状态,设备ID: {}, 业务类型: {}", entity.getEquipmentId(), entity.getBusinessType());
|
||||
|
||||
// 根据业务类型更新不同的设备状态
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
// 采购审批通过,更新设备状态为已采购
|
||||
updateEquipmentProcurementStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
// 借用审批通过,更新设备状态为已借用
|
||||
updateEquipmentBorrowStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
// 归还审批通过,更新设备状态为已归还
|
||||
updateEquipmentReturnStatus(entity.getEquipmentId(), "APPROVED");
|
||||
}
|
||||
|
||||
log.info("设备状态更新成功,设备ID: {}", entity.getEquipmentId());
|
||||
} catch (Exception e) {
|
||||
log.error("审批通过后更新设备状态失败,设备ID: {}", entity.getEquipmentId(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批拒绝后更新设备状态
|
||||
*/
|
||||
private void updateEquipmentStatusAfterRejection(EquipmentApprovalEntity entity) {
|
||||
if (entity == null || entity.getEquipmentId() == null) {
|
||||
log.warn("审批实体或设备ID为空,跳过状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("审批拒绝后更新设备状态,设备ID: {}, 业务类型: {}", entity.getEquipmentId(), entity.getBusinessType());
|
||||
|
||||
// 根据业务类型更新不同的设备状态
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
// 采购审批拒绝,更新设备状态为审批拒绝
|
||||
updateEquipmentProcurementStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
// 借用审批拒绝,更新设备状态为借用拒绝
|
||||
updateEquipmentBorrowStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
// 归还审批拒绝,更新设备状态为归还拒绝
|
||||
updateEquipmentReturnStatus(entity.getEquipmentId(), "REJECTED");
|
||||
}
|
||||
|
||||
log.info("设备状态更新成功,设备ID: {}", entity.getEquipmentId());
|
||||
} catch (Exception e) {
|
||||
log.error("审批拒绝后更新设备状态失败,设备ID: {}", entity.getEquipmentId(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备借用状态
|
||||
*/
|
||||
private void updateEquipmentBorrowStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过借用状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("准备更新设备借用状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
// 这里可以添加具体的更新逻辑
|
||||
// 例如:equipmentMapper.updateBorrowStatus(equipmentId, status);
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备借用状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备归还状态
|
||||
*/
|
||||
private void updateEquipmentReturnStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过归还状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("准备更新设备归还状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
// 这里可以添加具体的更新逻辑
|
||||
// 例如:equipmentMapper.updateReturnStatus(equipmentId, status);
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备归还状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<EquipmentApprovalResp> getMyProcurementApplications(EquipmentApprovalListReq req) {
|
||||
log.info("开始获取我的采购申请,请求参数: {}", req);
|
||||
|
|
|
@ -562,6 +562,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
resp.setInventoryBasis(entity.getInventoryBasis());
|
||||
resp.setDynamicRecord(entity.getDynamicRecord());
|
||||
|
||||
// 设置采购状态字段
|
||||
resp.setProcurementStatus(entity.getProcurementStatus());
|
||||
|
||||
// 新增字段转换
|
||||
resp.setUsingDepartment(entity.getUsingDepartment());
|
||||
resp.setBorrowingTime(entity.getBorrowingTime());
|
||||
|
@ -699,6 +702,11 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
conditionCount++;
|
||||
}
|
||||
|
||||
// 添加采购状态查询条件 - 确保查询有采购状态的设备
|
||||
queryWrapper.isNotNull(EquipmentEntity::getProcurementStatus);
|
||||
log.info("添加采购状态查询条件: 不为空");
|
||||
conditionCount++;
|
||||
|
||||
log.info("总共添加了 {} 个查询条件", conditionCount);
|
||||
|
||||
// 按采购时间倒序排列
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.mapper.EquipmentMapper;
|
||||
import com.dite.znpt.service.EquipmentStatusUpdateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 设备状态更新服务实现类
|
||||
* 使用MyBatis Plus来更新设备状态,避免循环依赖
|
||||
*
|
||||
* @author Bear.G
|
||||
* @date 2025/1/8/周三 17:50
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EquipmentStatusUpdateServiceImpl implements EquipmentStatusUpdateService {
|
||||
|
||||
@Resource
|
||||
private EquipmentMapper equipmentMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateProcurementStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过采购状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备采购状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
// 使用MyBatis Plus的LambdaUpdateWrapper来更新设备状态
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
|
||||
// 根据状态设置相应的字段
|
||||
if ("APPROVED".equals(status)) {
|
||||
// 审批通过:设置采购状态为已通过,位置状态为库存中,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "APPROVED");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getInStockTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购审批通过,设置状态为已通过");
|
||||
} else if ("REJECTED".equals(status)) {
|
||||
// 审批拒绝:设置采购状态为已拒绝,位置状态为未入库,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "REJECTED");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "not_in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购审批拒绝,设置状态为已拒绝");
|
||||
} else if ("PENDING_APPROVAL".equals(status) || "PENDING".equals(status)) {
|
||||
// 待审批:设置采购状态为待审批,位置状态为待审批,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "PENDING_APPROVAL");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "pending_approval");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购申请提交,设置状态为待审批");
|
||||
} else if ("COMPLETED".equals(status)) {
|
||||
// 采购完成:设置采购状态为已完成,位置状态为库存中,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "COMPLETED");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getInStockTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购完成,设置状态为已完成");
|
||||
}
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备采购状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount);
|
||||
} else {
|
||||
log.warn("设备采购状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备采购状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateBorrowStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过借用状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备借用状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
|
||||
if ("APPROVED".equals(status)) {
|
||||
// 借用审批通过:设置位置状态为外借中,使用状态为使用中
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "borrowed");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "1");
|
||||
updateWrapper.set(EquipmentEntity::getBorrowingTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备借用审批通过,设置状态为外借中");
|
||||
} else if ("REJECTED".equals(status)) {
|
||||
// 借用审批拒绝:保持原有状态
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备借用审批拒绝,保持原有状态");
|
||||
}
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备借用状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount);
|
||||
} else {
|
||||
log.warn("设备借用状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备借用状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateReturnStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过归还状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备归还状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
|
||||
if ("APPROVED".equals(status)) {
|
||||
// 归还审批通过:设置位置状态为库存中,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getReturnTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备归还审批通过,设置状态为库存中");
|
||||
} else if ("REJECTED".equals(status)) {
|
||||
// 归还审批拒绝:保持原有状态
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备归还审批拒绝,保持原有状态");
|
||||
}
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备归还状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount);
|
||||
} else {
|
||||
log.warn("设备归还状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备归还状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateLocationStatus(String equipmentId, String locationStatus) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过位置状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备位置状态,设备ID: {}, 新位置状态: {}", equipmentId, locationStatus);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, locationStatus);
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备位置状态更新成功,设备ID: {}, 新位置状态: {}, 影响行数: {}", equipmentId, locationStatus, updateCount);
|
||||
} else {
|
||||
log.warn("设备位置状态更新失败,设备ID: {}, 新位置状态: {}, 可能设备不存在", equipmentId, locationStatus);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备位置状态失败,设备ID: {}, 位置状态: {}", equipmentId, locationStatus, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUseStatus(String equipmentId, String useStatus) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过使用状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备使用状态,设备ID: {}, 新使用状态: {}", equipmentId, useStatus);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, useStatus);
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备使用状态更新成功,设备ID: {}, 新使用状态: {}, 影响行数: {}", equipmentId, useStatus, updateCount);
|
||||
} else {
|
||||
log.warn("设备使用状态更新失败,设备ID: {}, 新使用状态: {}, 可能设备不存在", equipmentId, useStatus);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备使用状态失败,设备ID: {}, 使用状态: {}", equipmentId, useStatus, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -18,6 +19,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -188,6 +190,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
ProjectMemberEntity entity = new ProjectMemberEntity();
|
||||
BeanUtil.copyProperties(req, entity);
|
||||
|
||||
// 设置创建和更新信息
|
||||
String currentUserId = StpUtil.getLoginIdAsString();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
entity.setCreateBy(currentUserId);
|
||||
entity.setCreateTime(now);
|
||||
entity.setUpdateBy(currentUserId);
|
||||
entity.setUpdateTime(now);
|
||||
|
||||
// 保存到数据库
|
||||
this.save(entity);
|
||||
|
||||
|
@ -208,6 +218,85 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
|
||||
// 更新成员信息
|
||||
BeanUtil.copyProperties(req, existingMember);
|
||||
|
||||
// 设置更新信息
|
||||
existingMember.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
existingMember.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
this.updateById(existingMember);
|
||||
|
||||
// 返回更新后的成员信息
|
||||
return getTeamMemberById(memberId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectMemberResp updateTeamMember(String memberId, TeamMemberUpdateReq req) {
|
||||
// 验证成员是否存在
|
||||
ProjectMemberEntity existingMember = this.getById(memberId);
|
||||
if (existingMember == null) {
|
||||
throw new ServiceException("项目成员不存在");
|
||||
}
|
||||
|
||||
// 更新成员信息 - 只更新非空字段,保留原有值
|
||||
if (StrUtil.isNotBlank(req.getTurbineId())) {
|
||||
existingMember.setTurbineId(req.getTurbineId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
existingMember.setTaskGroupId(req.getTaskGroupId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getTaskId())) {
|
||||
existingMember.setTaskId(req.getTaskId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getRoleType())) {
|
||||
existingMember.setRoleType(req.getRoleType());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getJobCode())) {
|
||||
existingMember.setJobCode(req.getJobCode());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getJobDesc())) {
|
||||
existingMember.setJobDesc(req.getJobDesc());
|
||||
}
|
||||
if (req.getJoinDate() != null) {
|
||||
existingMember.setJoinDate(req.getJoinDate());
|
||||
}
|
||||
if (req.getLeaveDate() != null) {
|
||||
existingMember.setLeaveDate(req.getLeaveDate());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getStatus())) {
|
||||
existingMember.setStatus(req.getStatus());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getRemark())) {
|
||||
existingMember.setRemark(req.getRemark());
|
||||
}
|
||||
|
||||
// 验证关联数据是否存在(只验证非空字段)
|
||||
validateUpdateTeamMemberRequest(req, existingMember);
|
||||
|
||||
// 如果更新了用户信息(电话或邮箱),同时更新用户表
|
||||
if (StrUtil.isNotBlank(req.getPhone()) || StrUtil.isNotBlank(req.getEmail())) {
|
||||
UserEntity user = userService.getById(existingMember.getUserId());
|
||||
if (user != null) {
|
||||
boolean needUpdateUser = false;
|
||||
if (StrUtil.isNotBlank(req.getPhone())) {
|
||||
user.setMobile(req.getPhone());
|
||||
needUpdateUser = true;
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getEmail())) {
|
||||
user.setEmail(req.getEmail());
|
||||
needUpdateUser = true;
|
||||
}
|
||||
if (needUpdateUser) {
|
||||
user.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
userService.updateById(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置更新信息
|
||||
existingMember.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
existingMember.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
this.updateById(existingMember);
|
||||
|
||||
// 返回更新后的成员信息
|
||||
|
@ -271,6 +360,64 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证更新团队成员请求参数(只验证非空字段)
|
||||
*/
|
||||
private void validateUpdateTeamMemberRequest(TeamMemberReq req, ProjectMemberEntity existingMember) {
|
||||
// 验证机组是否存在(如果指定了机组)
|
||||
if (StrUtil.isNotBlank(req.getTurbineId())) {
|
||||
TurbineEntity turbine = turbineService.getById(req.getTurbineId());
|
||||
if (turbine == null) {
|
||||
throw new ServiceException("机组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务组是否存在(如果指定了任务组)
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
ProjectTaskGroupEntity taskGroup = projectTaskGroupService.getById(req.getTaskGroupId());
|
||||
if (taskGroup == null) {
|
||||
throw new ServiceException("任务组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务是否存在(如果指定了任务)
|
||||
if (StrUtil.isNotBlank(req.getTaskId())) {
|
||||
ProjectTaskEntity task = projectTaskService.getById(req.getTaskId());
|
||||
if (task == null) {
|
||||
throw new ServiceException("任务不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证更新团队成员请求参数(只验证非空字段)
|
||||
*/
|
||||
private void validateUpdateTeamMemberRequest(TeamMemberUpdateReq req, ProjectMemberEntity existingMember) {
|
||||
// 验证机组是否存在(如果指定了机组)
|
||||
if (StrUtil.isNotBlank(req.getTurbineId())) {
|
||||
TurbineEntity turbine = turbineService.getById(req.getTurbineId());
|
||||
if (turbine == null) {
|
||||
throw new ServiceException("机组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务组是否存在(如果指定了任务组)
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
ProjectTaskGroupEntity taskGroup = projectTaskGroupService.getById(req.getTaskGroupId());
|
||||
if (taskGroup == null) {
|
||||
throw new ServiceException("任务组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务是否存在(如果指定了任务)
|
||||
if (StrUtil.isNotBlank(req.getTaskId())) {
|
||||
ProjectTaskEntity task = projectTaskService.getById(req.getTaskId());
|
||||
if (task == null) {
|
||||
throw new ServiceException("任务不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据成员ID获取成员信息
|
||||
*/
|
||||
|
@ -286,10 +433,17 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
|
||||
// 查询并返回单个成员信息
|
||||
List<ProjectMemberResp> list = this.baseMapper.queryTeamMembers(query);
|
||||
return list.stream()
|
||||
.filter(member -> member.getMemberId().equals(memberId))
|
||||
ProjectMemberResp member = list.stream()
|
||||
.filter(m -> m.getMemberId().equals(memberId))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (member != null) {
|
||||
// 丰富成员信息
|
||||
enrichMemberInfo(CollUtil.toList(member));
|
||||
}
|
||||
|
||||
return member;
|
||||
}
|
||||
|
||||
// ========================== 项目看板相关方法实现 ==========================
|
||||
|
@ -300,11 +454,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
|
||||
// 统计项目数量
|
||||
resp.setTotalProjectsCount(projectService.count());
|
||||
resp.setPendingProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 0).count());
|
||||
resp.setInProgressProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 1).count());
|
||||
resp.setCompletedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 2).count());
|
||||
resp.setAuditedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 3).count());
|
||||
resp.setAcceptedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 4).count());
|
||||
resp.setPendingProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 0).count()); // 未开工
|
||||
resp.setPreparingProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 1).count()); // 筹备中
|
||||
resp.setInProgressProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 2).count()); // 开工中
|
||||
resp.setSuspendedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 3).count()); // 暂停中
|
||||
resp.setCompletedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 4).count()); // 已完工
|
||||
resp.setAcceptanceProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 5).count()); // 验收中
|
||||
resp.setCollectionProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 6).count()); // 回款中
|
||||
resp.setSettledProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 7).count()); // 已结算
|
||||
|
||||
// 统计机组数量
|
||||
resp.setTotalTurbineCount(turbineService.count());
|
||||
|
@ -336,11 +493,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
ProjectKanbanDataResp resp = new ProjectKanbanDataResp();
|
||||
|
||||
// 获取各状态的项目列表
|
||||
resp.setPendingProjects(getProjectKanbanItems(0));
|
||||
resp.setInProgressProjects(getProjectKanbanItems(1));
|
||||
resp.setCompletedProjects(getProjectKanbanItems(2));
|
||||
resp.setAuditedProjects(getProjectKanbanItems(3));
|
||||
resp.setAcceptedProjects(getProjectKanbanItems(4));
|
||||
resp.setPendingProjects(getProjectKanbanItems(0)); // 未开工
|
||||
resp.setPreparingProjects(getProjectKanbanItems(1)); // 筹备中
|
||||
resp.setInProgressProjects(getProjectKanbanItems(2)); // 开工中
|
||||
resp.setSuspendedProjects(getProjectKanbanItems(3)); // 暂停中
|
||||
resp.setCompletedProjects(getProjectKanbanItems(4)); // 已完工
|
||||
resp.setAcceptanceProjects(getProjectKanbanItems(5)); // 验收中
|
||||
resp.setCollectionProjects(getProjectKanbanItems(6)); // 回款中
|
||||
resp.setSettledProjects(getProjectKanbanItems(7)); // 已结算
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity
|
|||
if (turbine == null) {
|
||||
return;
|
||||
}
|
||||
if (turbine.getStatus() == ProjectStatusEnum.AUDITED.getCode()) {
|
||||
if (turbine.getStatus() == ProjectStatusEnum.PREPARING.getCode()) {
|
||||
return;
|
||||
}
|
||||
List<TurbineStatusResp> turbineStatusList = jobService.calCrewStatus(ListUtil.of(turbineId));
|
||||
|
@ -234,7 +234,7 @@ public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity
|
|||
&& status4.contains(turbineStatusVo.getAntiThunderWorkStatus())
|
||||
&& status4.contains(turbineStatusVo.getSummaryWorkStatus())) {
|
||||
// 全部审批已审批
|
||||
turbine.setStatus(ProjectStatusEnum.AUDITED.getCode());
|
||||
turbine.setStatus(ProjectStatusEnum.PREPARING.getCode());
|
||||
} else if (status2.contains(turbineStatusVo.getInWorkStatus())
|
||||
|| status2.contains(turbineStatusVo.getOutWorkStatus())
|
||||
|| status2.contains(turbineStatusVo.getAntiThunderWorkStatus())
|
||||
|
@ -267,12 +267,12 @@ public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity
|
|||
if (!statusList.contains(ProjectStatusEnum.PENDING.getCode()) &&
|
||||
!statusList.contains(ProjectStatusEnum.IN_PROGRESS.getCode())) {
|
||||
status = ProjectStatusEnum.COMPLETED.getCode();
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工 的则项目 已审核
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工 的则项目 筹备中
|
||||
if (!statusList.contains(ProjectStatusEnum.COMPLETED.getCode())) {
|
||||
status = ProjectStatusEnum.AUDITED.getCode();
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工、已审核 的则项目 已验收
|
||||
if (!statusList.contains(ProjectStatusEnum.AUDITED.getCode())) {
|
||||
status = ProjectStatusEnum.ACCEPTED.getCode();
|
||||
status = ProjectStatusEnum.PREPARING.getCode();
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工、筹备中 的则项目 验收中
|
||||
if (!statusList.contains(ProjectStatusEnum.PREPARING.getCode())) {
|
||||
status = ProjectStatusEnum.IN_ACCEPTANCE.getCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.BusinessDataFileMapper">
|
||||
<!-- <select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">-->
|
||||
<!-- select * from business_data_part_file-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="folderId != null">-->
|
||||
<!-- and folder_id = #{folderId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="fileName != null and fileName != ''">-->
|
||||
<!-- and file_name like concat('%', #{fileName}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">-->
|
||||
<!-- select * from business_data_part_file-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="folderId != null">-->
|
||||
<!-- and folder_id = #{folderId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="fileName != null and fileName != ''">-->
|
||||
<!-- and file_name like concat('%', #{fileName}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test="sortField != null and sortField != '' and sortOrder != null and sortOrder != ''">-->
|
||||
<!-- order by ${sortField} ${sortOrder}-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- order by upload_time desc-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </select>-->
|
||||
<select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">
|
||||
select * from business_data_part_file
|
||||
<where>
|
||||
|
@ -11,6 +41,24 @@
|
|||
and file_name like concat('%', #{fileName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sortField != null and sortField != '' and sortOrder != null and sortOrder != ''">
|
||||
<choose>
|
||||
<when test="sortField == 'file_name'">
|
||||
order by convert(file_name using gbk) ${sortOrder}
|
||||
</when>
|
||||
<when test="sortField == 'file_type'">
|
||||
order by convert(file_type using gbk) ${sortOrder}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by ${sortField} ${sortOrder}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<otherwise>
|
||||
order by upload_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<delete id="delete" parameterType="com.dite.znpt.domain.entity.BusinessDataFileEntity" >
|
||||
delete from business_data_part_file
|
||||
|
|
|
@ -43,15 +43,26 @@ public class BusinessDataFileController {
|
|||
@Resource
|
||||
private BusinessDataFileMapper businessDataFileMapper;
|
||||
|
||||
@ApiOperation(value = "分页查询文件", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(defaultValue = "0") Long folderId,
|
||||
@RequestParam(required = false) String fileName) {
|
||||
PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName);
|
||||
return Result.ok(pageBean);
|
||||
}
|
||||
// @ApiOperation(value = "分页查询文件", httpMethod = "GET")
|
||||
// @GetMapping("/list")
|
||||
// public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
|
||||
// @RequestParam(defaultValue = "10") Integer pageSize,
|
||||
// @RequestParam(defaultValue = "0") Long folderId,
|
||||
// @RequestParam(required = false) String fileName) {
|
||||
// PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName);
|
||||
// return Result.ok(pageBean);
|
||||
// }
|
||||
@ApiOperation(value = "分页查询文件", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(defaultValue = "0") Long folderId,
|
||||
@RequestParam(required = false) String fileName,
|
||||
@RequestParam(required = false) String sortField,
|
||||
@RequestParam(required = false) String sortOrder) {
|
||||
PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName, sortField, sortOrder);
|
||||
return Result.ok(pageBean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "增加文件")
|
||||
@PostMapping("/add")
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ProjectMemberController {
|
|||
@PutMapping("/team-member/{memberId}")
|
||||
public Result<ProjectMemberResp> updateTeamMember(
|
||||
@PathVariable String memberId,
|
||||
@Valid @RequestBody TeamMemberReq req) {
|
||||
@RequestBody TeamMemberUpdateReq req) {
|
||||
return Result.ok(projectMemberService.updateTeamMember(memberId, req));
|
||||
}
|
||||
|
||||
|
|
|
@ -79,5 +79,13 @@ public class UserController {
|
|||
userService.deleteById(userId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据姓名模糊查询用户", httpMethod = "GET")
|
||||
@GetMapping("/searchByName")
|
||||
public PageResult<UserListResp> searchByName(@RequestParam String name) {
|
||||
UserListReq req = new UserListReq();
|
||||
req.setName(name);
|
||||
return PageResult.ok(userService.list(req));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue