master
liweidong-hj 4 months ago
parent 0b67ad69bb
commit d6f7f37b05
  1. 4
      src/main/java/com/nov/KgLowDurable/config/FileUploadConfig.java
  2. 9
      src/main/java/com/nov/KgLowDurable/controller/LdConsumerFormController.java
  3. 26
      src/main/java/com/nov/KgLowDurable/controller/LdDurableFormController.java
  4. 14
      src/main/java/com/nov/KgLowDurable/controller/LdOneFormController.java
  5. 26
      src/main/java/com/nov/KgLowDurable/controller/LdTwoOutStorageDetailController.java
  6. 4
      src/main/java/com/nov/KgLowDurable/mapper/DepartmentMapper.java
  7. 5
      src/main/java/com/nov/KgLowDurable/mapper/LdConsumerFormMapper.java
  8. 5
      src/main/java/com/nov/KgLowDurable/mapper/LdDurableFormMapper.java
  9. 2
      src/main/java/com/nov/KgLowDurable/mapper/LdOnePutStorageDetailMapper.java
  10. 2
      src/main/java/com/nov/KgLowDurable/mapper/UserMapper.java
  11. 21
      src/main/java/com/nov/KgLowDurable/pojo/dto/LdTwoInventoryDto.java
  12. 12
      src/main/java/com/nov/KgLowDurable/pojo/entity/LdTwoOutStorageDetail.java
  13. 82
      src/main/java/com/nov/KgLowDurable/pojo/vo/LdTwoInventoryVO.java
  14. 7
      src/main/java/com/nov/KgLowDurable/service/IDepartmentService.java
  15. 12
      src/main/java/com/nov/KgLowDurable/service/ILdConsumerFormService.java
  16. 11
      src/main/java/com/nov/KgLowDurable/service/ILdDurableFormService.java
  17. 7
      src/main/java/com/nov/KgLowDurable/service/ILdOneFormService.java
  18. 8
      src/main/java/com/nov/KgLowDurable/service/ILdTwoOutStorageDetailService.java
  19. 4
      src/main/java/com/nov/KgLowDurable/service/IUserService.java
  20. 5
      src/main/java/com/nov/KgLowDurable/service/Impl/DepartmentServiceImpl.java
  21. 14
      src/main/java/com/nov/KgLowDurable/service/Impl/LdConsumerFormServiceImpl.java
  22. 14
      src/main/java/com/nov/KgLowDurable/service/Impl/LdDurableFormServiceImpl.java
  23. 64
      src/main/java/com/nov/KgLowDurable/service/Impl/LdOneFormServiceImpl.java
  24. 9
      src/main/java/com/nov/KgLowDurable/service/Impl/LdOneOutStorageServiceImpl.java
  25. 2
      src/main/java/com/nov/KgLowDurable/service/Impl/LdOnePutStorageDetailServiceImpl.java
  26. 4
      src/main/java/com/nov/KgLowDurable/service/Impl/LdTwoInventoryRecordServiceImpl.java
  27. 57
      src/main/java/com/nov/KgLowDurable/service/Impl/LdTwoOutStorageDetailServiceImpl.java
  28. 225
      src/main/java/com/nov/KgLowDurable/service/Impl/UserServiceImpl.java
  29. 3
      src/main/resources/mapper/DepartmentMapper.xml
  30. 10
      src/main/resources/mapper/LdConsumerFormMapper.xml
  31. 9
      src/main/resources/mapper/LdDurableFormMapper.xml
  32. 1
      src/main/resources/mapper/LdMaterialMapper.xml
  33. 2
      src/main/resources/mapper/LdOneOutStorageDetailMapper.xml
  34. 2
      src/main/resources/mapper/LdOnePutStorageDetailMapper.xml
  35. 1
      src/main/resources/mapper/LdTwoOutStorageDetailMapper.xml
  36. 3
      src/main/resources/mapper/UserMapper.xml

@ -9,11 +9,11 @@ import org.springframework.stereotype.Component;
public class FileUploadConfig {
// 本地服务器地址
@Value("${file.upload.server:http://10.90.100.231:8132}")
@Value("${file.upload.server:http://192.168.0.107:8083}")
private String serverUrl;
// 基础存储路径
@Value("${file.upload.base-path:/opt/SmartParkFilesTest}")
@Value("${file.upload.base-path:D:/opt/SmartParkFilesTest}")
private String basePath;
// 允许的文件类型

@ -37,9 +37,11 @@ public class LdConsumerFormController {
@RequestParam(required = false) String departmentId,
@RequestParam(required = false) String materialName,
@RequestParam(required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(required = false ,defaultValue = "10") Integer pageSize) {
@RequestParam(required = false ,defaultValue = "10") Integer pageSize,
@RequestParam(required = false) Integer num
) {
return Result.OK(consumerFormService.getConsumerFormList(departmentId,materialName,pageNum,pageSize));
return Result.OK(consumerFormService.getConsumerFormList(departmentId,materialName,num,pageNum,pageSize));
}
@GetMapping("/getConsumerFormList")
@ -47,8 +49,7 @@ public class LdConsumerFormController {
@ApiOperation(value = "获取二级出库物资列表", notes = "根据部门获取二级出库物资列表", httpMethod = "GET", response = Result.class)
public Result getConsumerFormList(@RequestParam String departmentId) {
try {
List<LdConsumerForm> quarters = consumerFormService.getConsumerFormByDeptId(departmentId);
return Result.OK(quarters);
return Result.OK(consumerFormService.getConsumerFormByDeptId(departmentId));
} catch (Exception e) {
return Result.error("获取二级出库物资列表失败");
}

@ -34,9 +34,11 @@ public class LdDurableFormController {
@RequestParam(required = false) String departmentId,
@RequestParam(required = false) String materialName,
@RequestParam(required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(required = false ,defaultValue = "10") Integer pageSize) {
@RequestParam(required = false ,defaultValue = "10") Integer pageSize,
@RequestParam(required = false) Integer num
) {
return Result.OK(durableFormService.getDurableFormList(departmentId,materialName,pageNum,pageSize));
return Result.OK(durableFormService.getDurableFormList(departmentId,materialName,num,pageNum,pageSize));
}
@ -48,24 +50,4 @@ public class LdDurableFormController {
return Result.OK(durableFormService.restoreAndScrap(dto));
}
@Autowired
SerialNumberUtil serialNumberUtil;
@PostMapping("/test")
@ApiOperationSort(3)
@ApiOperation(value = "二级耐用品归还报废", notes = "修改耐用品状态", httpMethod = "POST", response = Result.class)
public Result test() {
for (int i = 0; i < 10; i++) {
String fi = serialNumberUtil.generateSimple("FI");
String fo = serialNumberUtil.generateSimple("FO");
String si = serialNumberUtil.generateSimple("SI");
String fid = serialNumberUtil.generateSimple("FID");
System.out.println("第"+i+"次"+":"+fi+" ,"+fo+", "+si+", "+fid);
}
List<String> list = serialNumberUtil.generateBatchSimple("FID", 10);
System.out.println(list);
return Result.OK();
}
}

@ -1,10 +1,13 @@
package com.nov.KgLowDurable.controller;
import com.nov.KgLowDurable.pojo.entity.LdOneForm;
import com.nov.KgLowDurable.service.ILdOneFormService;
import com.nov.KgLowDurable.util.Result;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author liweidong
@ -43,4 +46,15 @@ public class LdOneFormController {
}
@PostMapping("/getOnePutOneForm")
@ApiOperationSort(3)
@ApiOperation(value = "获取一级出库库存", notes = "查询库存", httpMethod = "POST", response = Result.class)
public Result getOnePutOneForm(@RequestBody List<LdOneForm> oneFormList) {
return Result.OK(oneFormService.getOnePutOneForm(oneFormList));
}
}

@ -1,8 +1,18 @@
package com.nov.KgLowDurable.controller;
import com.nov.KgLowDurable.pojo.dto.LdTwoInventoryDto;
import com.nov.KgLowDurable.service.ILdTwoOutStorageDetailService;
import com.nov.KgLowDurable.util.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSort;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author liweidong
@ -12,5 +22,21 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/twoOutStorageDetail")
public class LdTwoOutStorageDetailController {
@Autowired
ILdTwoOutStorageDetailService twoOutStorageDetailService;
/**
* 二级出库表格数据
* @param materialDto
* @return
*/
@PostMapping("/getTwoOutInventory")
@ApiOperationSort(3)
@ApiOperation(value = "获取二级出库库存", notes = "查询库存", httpMethod = "POST", response = Result.class)
public Result getTwoOutInventory(@RequestBody List<LdTwoInventoryDto> materialDto) {
return Result.OK(twoOutStorageDetailService.getTwoOutInventory(materialDto));
}
}

@ -2,6 +2,8 @@ package com.nov.KgLowDurable.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nov.KgLowDurable.pojo.entity.Department;
import com.nov.KgLowDurable.pojo.vo.DepartmentVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -13,4 +15,6 @@ public interface DepartmentMapper extends BaseMapper<Department> {
List<DepartmentVO> selectOnePutDepartment();
Department selectByDepartmentId(@Param("departmentId") String departmentId);
}

@ -1,6 +1,7 @@
package com.nov.KgLowDurable.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nov.KgLowDurable.pojo.entity.LdConsumerForm;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -16,5 +17,7 @@ public interface LdConsumerFormMapper extends BaseMapper<LdConsumerForm> {
List<LdConsumerForm> selectByDepartmentId(@Param("departmentId") String departmentId);
List<LdConsumerForm> selectConsumerFormList(@Param("departmentId") String departmentId, @Param("materialName") String materialName);
List<LdConsumerForm> selectConsumerFormList(@Param("departmentId") String departmentId, @Param("materialName") String materialName, @Param("num") Integer num);
List<LdTwoInventoryVO> selectByIds(@Param("consumerIds") List<Long> consumerIds);
}

@ -1,6 +1,7 @@
package com.nov.KgLowDurable.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nov.KgLowDurable.pojo.entity.LdDurableForm;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -12,7 +13,9 @@ import java.util.List;
public interface LdDurableFormMapper extends BaseMapper<LdDurableForm> {
List<LdDurableForm> selectDurableFormList(@Param("departmentId") String departmentId, @Param("materialName") String materialName);
List<LdDurableForm> selectDurableFormList(@Param("departmentId") String departmentId, @Param("materialName") String materialName, @Param("num") Integer num);
LdDurableForm selectByMaterialId(@Param("materialId") Long materialId);
List<LdTwoInventoryVO> selectByIds(@Param("durableIds") List<Long> durableIds);
}

@ -15,7 +15,7 @@ public interface LdOnePutStorageDetailMapper extends BaseMapper<LdOnePutStorageD
String selectMaxOrderNo(@Param("prefix") String prefix, @Param("date") String date);
List<LdOnePutStorageDetail> selectSummaryDat(@Param("collect")List<Long> collect);
List<LdOnePutStorageDetail> selectSummaryData(@Param("collect")List<Long> collect);
List<LdOnePutStorageDetail> selectByOnePutStorageId(@Param("onePutStorageId") Long onePutStorageId);
}

@ -13,4 +13,6 @@ public interface UserMapper extends BaseMapper<User> {
List<User> selectByDepartmentId(@Param("departmentId") String departmentId);
User selectByLeaderInDept(@Param("topDepartmentId") String topDepartmentId);
}

@ -0,0 +1,21 @@
package com.nov.KgLowDurable.pojo.dto;
import lombok.Data;
/**
* @author: liweidong
* @create: 2026-01-07
*/
@Data
public class LdTwoInventoryDto {
/**
* 库存ID 耐用品/易耗品
*/
private Long twoInventoryId;
/**
* 物资类型 YH/NY
*/
private String type;
}

@ -24,19 +24,25 @@ public class LdTwoOutStorageDetail implements Serializable {
private Long id;
/**
* 一级出库单ID
* 二级库存ID 易耗品/耐用品ID
*/
@TableField("two_inventory_id")
private Long twoInventoryId;
/**
* 二级出库单ID
*/
@TableField("two_out_storage_id")
private Long twoOutStorageId;
/**
* 一级出库单号
* 级出库单号
*/
@TableField("two_out_storage_no")
private String twoOutStorageNo;
/**
* 级出库明细编号
* 级出库明细编号
*/
@TableField("two_out_detail_code")
private String twoOutDetailCode;

@ -0,0 +1,82 @@
package com.nov.KgLowDurable.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 低值易耗品二级库库存表实体类
*
* @author: liweidong
* @create: 2025-12-24
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class LdTwoInventoryVO implements Serializable {
/**
* ID
*/
private Integer id;
/**
* 物资ID
*/
private Long materialId;
/**
* 物资名称
*/
private String materialName;
/**
* 物资编码
*/
private String materialCode;
/**
* 规格型号
*/
private String model;
/**
* 类别 易耗/耐用
*/
private String type;
/**
* 单位
*/
private String unit;
/**
* 数量
*/
private BigDecimal num;
/**
* 单价
*/
private BigDecimal unitPrice;
/**
* 部门
*/
private String departmentId;
/**
* 部门
*/
private String department;
}

@ -16,4 +16,11 @@ public interface IDepartmentService extends IService<Department> {
* @return
*/
List<DepartmentVO> getOnePutDepartment();
/**
* 根据ID查询部门
* @param departmentId
* @return
*/
Department getByDepartmentId(String departmentId);
}

@ -3,6 +3,8 @@ package com.nov.KgLowDurable.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.nov.KgLowDurable.pojo.entity.LdConsumerForm;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import java.util.List;
@ -30,9 +32,17 @@ public interface ILdConsumerFormService extends IService<LdConsumerForm> {
* 二级易耗品列表
* @param departmentId
* @param materialName
* @param num
* @param pageNum
* @param pageSize
* @return
*/
PageInfo<LdConsumerForm> getConsumerFormList(String departmentId, String materialName, Integer pageNum, Integer pageSize);
PageInfo<LdConsumerForm> getConsumerFormList(String departmentId, String materialName, Integer num, Integer pageNum, Integer pageSize);
/**
* 根据IDS 查询
* @param consumerIds
* @return
*/
List<LdTwoInventoryVO> getByIds(List<Long> consumerIds);
}

@ -3,8 +3,8 @@ package com.nov.KgLowDurable.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.nov.KgLowDurable.pojo.dto.LdDurableFormDto;
import com.nov.KgLowDurable.pojo.entity.LdConsumerForm;
import com.nov.KgLowDurable.pojo.entity.LdDurableForm;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import java.util.List;
@ -19,11 +19,12 @@ public interface ILdDurableFormService extends IService<LdDurableForm> {
* 获取二级耐用品列表
* @param departmentId
* @param materialName
* @param num
* @param pageNum
* @param pageSize
* @return
*/
PageInfo<LdDurableForm> getDurableFormList(String departmentId, String materialName, Integer pageNum, Integer pageSize);
PageInfo<LdDurableForm> getDurableFormList(String departmentId, String materialName, Integer num, Integer pageNum, Integer pageSize);
/**
* 归还 报废 接口
@ -39,4 +40,10 @@ public interface ILdDurableFormService extends IService<LdDurableForm> {
*/
LdDurableForm getByMaterialId(Long materialId);
/**
* 根据IDS 擦汗讯
* @param durableIds
* @return
*/
List<LdTwoInventoryVO> getByIds(List<Long> durableIds);
}

@ -42,4 +42,11 @@ public interface ILdOneFormService extends IService<LdOneForm> {
* @return
*/
List<LdOneForm> getPutOneForm(String optionType);
/**
* 查询一级入库 库存信息
* @param oneFormList
* @return
*/
List<LdOneForm> getOnePutOneForm(List<LdOneForm> oneFormList);
}

@ -1,5 +1,6 @@
package com.nov.KgLowDurable.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nov.KgLowDurable.pojo.dto.LdTwoInventoryDto;
import com.nov.KgLowDurable.pojo.entity.LdTwoOutStorageDetail;
import java.util.List;
@ -16,4 +17,11 @@ public interface ILdTwoOutStorageDetailService extends IService<LdTwoOutStorageD
* @return
*/
List<LdTwoOutStorageDetail> selectByTwoOutStorageId(Long twoOutStorageId);
/**
* 获取二级出库表格数据
* @param materialDto
* @return
*/
List getTwoOutInventory(List<LdTwoInventoryDto> materialDto);
}

@ -20,8 +20,8 @@ public interface IUserService extends IService<User> {
/**
* 获取审批人
* @param mainErDepartment
* @param type
* @param mainErDepartment -部门id
* @param type 类型0-一级入库审批1-二级出库审批2-部门申请单审批
* @param formId
* @return
*/

@ -26,4 +26,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
public List<DepartmentVO> getOnePutDepartment() {
return departmentMapper.selectOnePutDepartment();
}
@Override
public Department getByDepartmentId(String departmentId) {
return departmentMapper.selectByDepartmentId(departmentId);
}
}

@ -3,12 +3,9 @@ package com.nov.KgLowDurable.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nov.KgLowDurable.mapper.LdApproveMapper;
import com.nov.KgLowDurable.mapper.LdConsumerFormMapper;
import com.nov.KgLowDurable.pojo.entity.LdApprove;
import com.nov.KgLowDurable.pojo.entity.LdConsumerForm;
import com.nov.KgLowDurable.pojo.entity.LdDemandEnd;
import com.nov.KgLowDurable.service.ILdApproveService;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import com.nov.KgLowDurable.service.ILdConsumerFormService;
import com.nov.KgLowDurable.service.ILdDurableFormService;
import lombok.AllArgsConstructor;
@ -42,10 +39,15 @@ public class LdConsumerFormServiceImpl extends ServiceImpl<LdConsumerFormMapper,
}
@Override
public PageInfo<LdConsumerForm> getConsumerFormList(String departmentId, String materialName, Integer pageNum, Integer pageSize) {
public PageInfo<LdConsumerForm> getConsumerFormList(String departmentId, String materialName, Integer num, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<LdConsumerForm> ldConsumerFormList = consumerFormMapper.selectConsumerFormList(departmentId,materialName);
List<LdConsumerForm> ldConsumerFormList = consumerFormMapper.selectConsumerFormList(departmentId,materialName,num);
PageInfo<LdConsumerForm> pageInfo = new PageInfo<>(ldConsumerFormList);
return pageInfo;
}
@Override
public List<LdTwoInventoryVO> getByIds(List<Long> consumerIds) {
return consumerFormMapper.selectByIds(consumerIds);
}
}

@ -4,13 +4,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nov.KgLowDurable.exception.CustomerException;
import com.nov.KgLowDurable.mapper.LdApproveMapper;
import com.nov.KgLowDurable.mapper.LdDurableFormMapper;
import com.nov.KgLowDurable.pojo.dto.LdDurableFormDto;
import com.nov.KgLowDurable.pojo.entity.LdApprove;
import com.nov.KgLowDurable.pojo.entity.LdConsumerForm;
import com.nov.KgLowDurable.pojo.entity.LdDurableForm;
import com.nov.KgLowDurable.service.ILdApproveService;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import com.nov.KgLowDurable.service.ILdDurableFormService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,9 +28,9 @@ public class LdDurableFormServiceImpl extends ServiceImpl<LdDurableFormMapper, L
LdDurableFormMapper durableFormMapper;
@Override
public PageInfo<LdDurableForm> getDurableFormList(String departmentId, String materialName, Integer pageNum, Integer pageSize) {
public PageInfo<LdDurableForm> getDurableFormList(String departmentId, String materialName, Integer num, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<LdDurableForm> ldDurableFormList = durableFormMapper.selectDurableFormList(departmentId,materialName);
List<LdDurableForm> ldDurableFormList = durableFormMapper.selectDurableFormList(departmentId,materialName,num);
PageInfo<LdDurableForm> pageInfo = new PageInfo<>(ldDurableFormList);
return pageInfo;
}
@ -65,4 +62,9 @@ public class LdDurableFormServiceImpl extends ServiceImpl<LdDurableFormMapper, L
public LdDurableForm getByMaterialId(Long materialId) {
return durableFormMapper.selectByMaterialId(materialId);
}
@Override
public List<LdTwoInventoryVO> getByIds(List<Long> durableIds) {
return durableFormMapper.selectByIds(durableIds);
}
}

@ -2,19 +2,17 @@ package com.nov.KgLowDurable.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nov.KgLowDurable.mapper.LdMaterialMapper;
import com.nov.KgLowDurable.constant.BatchConstant;
import com.nov.KgLowDurable.mapper.LdOneFormMapper;
import com.nov.KgLowDurable.pojo.entity.LdMaterial;
import com.nov.KgLowDurable.pojo.entity.LdOneForm;
import com.nov.KgLowDurable.service.ILdMaterialService;
import com.nov.KgLowDurable.service.ILdOneFormService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -53,4 +51,58 @@ public class LdOneFormServiceImpl extends ServiceImpl<LdOneFormMapper, LdOneForm
public List<LdOneForm> getPutOneForm(String optionType) {
return oneFormMapper.selectOneFormByNum(optionType);
}
@Override
public List<LdOneForm> getOnePutOneForm(List<LdOneForm> oneFormList) {
//收集所有数据
List<LdOneForm> list = new ArrayList<>();
for (LdOneForm oneForm : oneFormList) {
List<LdOneForm> formList = oneFormMapper.selectByMaterialId(oneForm.getMaterialId(), oneForm.getType());
list.addAll(formList);
}
//分组并求和
List<LdOneForm> mergedList = list.stream()
// 按 materialId 和 type 分组
.collect(Collectors.groupingBy(
form -> form.getMaterialId() + "_" + form.getType(),
LinkedHashMap::new, // 保持顺序
Collectors.collectingAndThen(
Collectors.toList(),
forms -> {
//取第一条作为模板
LdOneForm template = createNewForm(forms.get(0));
//求和NUM字段
BigDecimal totalNum = forms.stream()
.map(f -> f.getNum() != null ? f.getNum() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
template.setNum(totalNum);
return template;
}
)
))
.values().stream()
.collect(Collectors.toList());
return mergedList;
}
private LdOneForm createNewForm(LdOneForm source) {
LdOneForm newForm = new LdOneForm();
// 复制所有需要的字段
newForm.setId(source.getId());
newForm.setMaterialId(source.getMaterialId());
newForm.setMaterialName(source.getMaterialName());
newForm.setMaterialCode(source.getMaterialCode());
newForm.setModel(source.getModel());
newForm.setType(source.getType());
newForm.setNum(source.getNum());
newForm.setUnit(source.getUnit());
return newForm;
}
}

@ -436,6 +436,15 @@ public class LdOneOutStorageServiceImpl extends ServiceImpl<LdOneOutStorageMappe
throw new CustomerException("出库ID有误");
}
List<LdOneOutStorageDetail> ldOneOutStorageDetailList = oneOutStorageDetailService.getByOneOutStorageId(ldOneOutStorage.getId());
for (LdOneOutStorageDetail oneOutStorageDetail : ldOneOutStorageDetailList) {
List<LdOneOutStorageDetail> oneOutDetailList = oneOutStorageDetailService.selectByDemandEndId(oneOutStorageDetail.getLdDemandEndId());
BigDecimal sum = oneOutDetailList.stream()
.map(LdOneOutStorageDetail::getOutboundQuantity)
.filter(Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
oneOutStorageDetail.setOutboundQuantity(sum);
}
LdOneOutStorageInfoVO ldOneOutStorageInfoVO = new LdOneOutStorageInfoVO();
ldOneOutStorageInfoVO.setLdOneOutStorage(ldOneOutStorage);
ldOneOutStorageInfoVO.setLdOneOutStorageDetails(ldOneOutStorageDetailList);

@ -46,7 +46,7 @@ public class LdOnePutStorageDetailServiceImpl extends ServiceImpl<LdOnePutStorag
@Override
public List<LdOnePutStorageDetail> getSummaryData(List<Long> collect) {
return onePutStorageDetailMapper.selectSummaryDat(collect);
return onePutStorageDetailMapper.selectSummaryData(collect);
}
@Override

@ -74,7 +74,7 @@ public class LdTwoInventoryRecordServiceImpl extends ServiceImpl<LdTwoInventoryR
List<LdTwoOutStorageDetail> ldTwoOutStorageDetailList = twoOutStorageDetailService.selectByTwoOutStorageId(approveDto.getTwoOutStorageId());
for (LdTwoOutStorageDetail twoOutStorageDetail : ldTwoOutStorageDetailList) {
if(BatchConstant.CONSUMER.equals(twoOutStorageDetail.getType())){
LdConsumerForm consumerForm = consumerFormService.getByMaterialId(twoOutStorageDetail.getMaterialId());
LdConsumerForm consumerForm = consumerFormService.getById(twoOutStorageDetail.getTwoInventoryId());
//计算差值
BigDecimal difference = consumerForm.getNum().subtract(twoOutStorageDetail.getNum());
consumerForm.setNum(difference);
@ -97,7 +97,7 @@ public class LdTwoInventoryRecordServiceImpl extends ServiceImpl<LdTwoInventoryR
throw new CustomerException("出库记录保存失败");
}
}else {
LdDurableForm durableForm = durableFormService.getByMaterialId(twoOutStorageDetail.getMaterialId());
LdDurableForm durableForm = durableFormService.getById(twoOutStorageDetail.getTwoInventoryId());
durableForm.setIsBorrow(BatchConstant.LEND);
durableForm.setNum(new BigDecimal(0));
boolean updateDurableForm = durableFormService.updateById(durableForm);

@ -1,12 +1,22 @@
package com.nov.KgLowDurable.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nov.KgLowDurable.constant.BatchConstant;
import com.nov.KgLowDurable.mapper.LdTwoOutStorageDetailMapper;
import com.nov.KgLowDurable.pojo.dto.LdTwoInventoryDto;
import com.nov.KgLowDurable.pojo.entity.LdConsumerForm;
import com.nov.KgLowDurable.pojo.entity.LdTwoOutStorageDetail;
import com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO;
import com.nov.KgLowDurable.service.ILdConsumerFormService;
import com.nov.KgLowDurable.service.ILdDurableFormService;
import com.nov.KgLowDurable.service.ILdTwoOutStorageDetailService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 服务实现类
@ -19,8 +29,55 @@ public class LdTwoOutStorageDetailServiceImpl extends ServiceImpl<LdTwoOutStorag
@Autowired
LdTwoOutStorageDetailMapper twoOutStorageDetailMapper;
@Autowired
ILdConsumerFormService consumerFormService;
@Autowired
ILdDurableFormService durableFormService;
@Override
public List<LdTwoOutStorageDetail> selectByTwoOutStorageId(Long twoOutStorageId) {
return twoOutStorageDetailMapper.selectByTwoOutStorageId(twoOutStorageId);
}
@Override
public List getTwoOutInventory(List<LdTwoInventoryDto> materialDto) {
// 获取易耗品类型的twoInventoryId列表
List<Long> consumerIds = materialDto.stream()
.filter(dto -> BatchConstant.CONSUMER.equals(dto.getType()))
.map(LdTwoInventoryDto::getTwoInventoryId)
.collect(Collectors.toList());
// 获取耐用型类型的twoInventoryId列表
List<Long> durableIds = materialDto.stream()
.filter(dto -> BatchConstant.DURABLE.equals(dto.getType()))
.map(LdTwoInventoryDto::getTwoInventoryId)
.collect(Collectors.toList());
List<LdTwoInventoryVO> twoInventoryList = new ArrayList<>();
if(!CollectionUtils.isEmpty(consumerIds)){
twoInventoryList = consumerFormService.getByIds(consumerIds);
}
if(!CollectionUtils.isEmpty(durableIds)){
twoInventoryList = durableFormService.getByIds(durableIds);
}
return twoInventoryList;
}
}

@ -3,17 +3,23 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nov.KgLowDurable.mapper.UserMapper;
import com.nov.KgLowDurable.pojo.entity.Department;
import com.nov.KgLowDurable.pojo.entity.LdApprove;
import com.nov.KgLowDurable.pojo.entity.Role;
import com.nov.KgLowDurable.pojo.entity.User;
import com.nov.KgLowDurable.pojo.vo.UserInfoVO;
import com.nov.KgLowDurable.service.IDepartmentService;
import com.nov.KgLowDurable.service.ILdApproveService;
import com.nov.KgLowDurable.service.IUserService;
import com.nov.KgLowDurable.util.HttpUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
@ -26,6 +32,7 @@ import java.util.Map;
*/
@Service
@AllArgsConstructor
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
@Autowired
@ -34,6 +41,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
@Autowired
ILdApproveService ldApproveService;
@Autowired
IDepartmentService departmentService;
@Override
public UserInfoVO getUserInfo() throws Exception {
// Map<String, String> headers = new HashMap<String, String>() {{
@ -81,8 +91,82 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
return data;
}
/**
* 模拟数据 - 直接使用JSON字符串
*/
private static final String MOCK_APPROVAL_DATA = "{\n" +
" \"success\": true,\n" +
" \"message\": \"获取审批列表成功\",\n" +
" \"code\": 200,\n" +
" \"result\": {\n" +
" \"1\": [\n" +
" {\n" +
" \"userId\": \"LiuXu\",\n" +
" \"name\": \"刘旭\",\n" +
" \"department\": \"青岛空管站/实业公司/IT事业部/产品研发室\",\n" +
" \"mainDepartment\": \"82\",\n" +
" \"mainErDepartment\": \"20\",\n" +
" \"leaderInDept\": \",\",\n" +
" \"gender\": \"女\",\n" +
" \"phone\": \"17853572157\",\n" +
" \"mail\": null,\n" +
" \"roleList\": null,\n" +
" \"roleNames\": null,\n" +
" \"checked\": false,\n" +
" \"manageNum\": \"1\",\n" +
" \"deptId\": null,\n" +
" \"deptList\": null,\n" +
" \"postName\": null,\n" +
" \"virPostName\": null,\n" +
" \"apprStatus\": null,\n" +
" \"isCanAbnormal\": false,\n" +
" \"userSort\": 1000,\n" +
" \"isDel\": false,\n" +
" \"mainErDepartmentName\": null\n" +
" }\n" +
" ],\n" +
" \"2\": [\n" +
" {\n" +
" \"userId\": \"AnXingHe\",\n" +
" \"name\": \"安星河\",\n" +
" \"department\": \"青岛空管站/实业公司/IT事业部/产品研发室\",\n" +
" \"mainDepartment\": \"82\",\n" +
" \"mainErDepartment\": \"20\",\n" +
" \"leaderInDept\": \",20,\",\n" +
" \"gender\": \"男\",\n" +
" \"phone\": \"13526109603\",\n" +
" \"mail\": null,\n" +
" \"roleList\": null,\n" +
" \"roleNames\": null,\n" +
" \"checked\": false,\n" +
" \"manageNum\": \"1\",\n" +
" \"deptId\": null,\n" +
" \"deptList\": null,\n" +
" \"postName\": null,\n" +
" \"virPostName\": null,\n" +
" \"apprStatus\": null,\n" +
" \"isCanAbnormal\": false,\n" +
" \"userSort\": 1000,\n" +
" \"isDel\": false,\n" +
" \"mainErDepartmentName\": null\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"timestamp\": 1767767650684\n" +
"}";
@Override
public boolean getApprover(String mainErDepartment, String type,Long formId) {
// 参数校验
if (!StringUtils.hasText(type)) {
throw new IllegalArgumentException("审批类型不能为空");
}
if (formId == null || formId <= 0) {
throw new IllegalArgumentException("表单ID必须大于0");
}
log.info("模拟获取审批人,参数: deptId={}, type={}, formId={}", mainErDepartment, type, formId);
// Map<String, String> headers = new HashMap<String, String>() {{
// put("Content-Type", "application/json");
// }};
@ -95,8 +179,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
// try {
// resp = EntityUtils.toString(
// HttpUtils.doGet(
// "http://192.168.198.1:8105",
// "/dsTasking/processAuthorized",
// "http://10.90.100.231:8132",
// "/ld-person-form/getApprove",
// "GET",
// headers,
// querys
@ -105,64 +189,109 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// JSONObject obj = JSON.parseObject(resp);
//
// if (!"200".equals(obj.getString("code"))) {
// throw new RuntimeException("失败: " + obj.getString("message"));
// }
//
// ApproverUser approverUser = JSON.toJavaObject(obj.getJSONObject("data"), ApproverUser.class);
try {
// 1.解析模拟数据
JSONObject obj = JSON.parseObject(MOCK_APPROVAL_DATA);
if (!"200".equals(obj.getString("code")) || !obj.getBooleanValue("success")) {
String message = obj.getString("message");
throw new RuntimeException("获取审批人失败: " + message);
}
// 2.获取审批结果数据
JSONObject result = obj.getJSONObject("result");
if (result == null || result.isEmpty()) {
throw new RuntimeException("未找到审批人数据");
}
// 3.保存审批人信息到数据库
List<LdApprove> approversToSave = new ArrayList<>();
// 遍历所有审批层级(1, 2, 3...)
for (String level : result.keySet()) {
// 获取该层级的所有用户
List<User> users = result.getJSONArray(level).toJavaList(User.class);
if (CollectionUtils.isEmpty(users)) {
log.warn("层级 {} 没有审批人", level);
continue;
}
for (int i = 0; i < users.size(); i++) {
User user = users.get(i);
LdApprove ldApprove = createLdApprove(user, level, formId, type);
approversToSave.add(ldApprove);
}
}
// 5. 批量保存审批人
boolean saveSuccess = false;
if (!CollectionUtils.isEmpty(approversToSave)) {
saveSuccess = ldApproveService.saveBatch(approversToSave);
} else {
throw new RuntimeException("未找到审批人信息");
}
return saveSuccess;
} catch (Exception e) {
throw new RuntimeException("处理审批人数据失败: " + e.getMessage(), e);
}
}
/**
* 创建审批记录实体
*/
private LdApprove createLdApprove(User user, String level, Long formId, String type) {
LdApprove ldApprove = new LdApprove();
ldApprove.setFormId(formId.intValue());
ldApprove.setUserId("LiuXu");
ldApprove.setUserName("刘旭");
ldApprove.setLevel("1");
ldApprove.setUserId(user.getUserId());
ldApprove.setUserName(user.getName());
ldApprove.setLevel(level);
ldApprove.setStatus("0");
ldApprove.setOptTime(LocalDateTime.now());
ldApprove.setType(type);
boolean save = ldApproveService.save(ldApprove);
return save;
return ldApprove;
}
@Override
public User getDeptApprove(String department) {
// Map<String, String> headers = new HashMap<String, String>() {{
// put("Content-Type", "application/json");
// }};
//
// Map<String, String> querys = new HashMap<String, String>() {{
// put("deptId",department);
// }};
//
// String resp = null;
// try {
// resp = EntityUtils.toString(
// HttpUtils.doGet(
// "http://10.90.100.231:8132",
// "/lowDurableTest/ld-approver/getDeptApprove",
// "GET",
// headers,
// querys
// ).getEntity()
// );
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// JSONObject obj = JSON.parseObject(resp);
//
// if (!"200".equals(obj.getString("code"))) {
// throw new RuntimeException("失败: " + obj.getString("message"));
// }
//
// UserInfoVO approverUser = JSON.toJavaObject(obj.getJSONObject("data"), UserInfoVO.class);
User user = new User();
user.setUserId("负责人ID");
user.setName("负责人名称");
String topDepartmentId = getTopDepartmentId(department);
User user = userMapper.selectByLeaderInDept(topDepartmentId);
if(null == user){
throw new RuntimeException(department+":部门负责人获取失败");
}
return user;
}
public String getTopDepartmentId(String departmentId) {
int maxDepth = 20;
int currentDepth = 0;
String currentId = departmentId;
while (currentDepth < maxDepth) {
Department dept = departmentService.getByDepartmentId(currentId);
if (dept == null) {
throw new RuntimeException("部门不存在: " + currentId);
}
String parentId = dept.getParentid();
//如果是顶级部门 返回当前部门ID
if ("0".equals(parentId) || "1".equals(parentId)) {
return dept.getId();
}
//否则继续查询父部门
currentId = parentId;
currentDepth++;
}
throw new RuntimeException("部门负责人获取失败,查询深度超过限制: " + departmentId);
}
@Override
public List<User> getUserByDeptId(String departmentId) {
return userMapper.selectByDepartmentId(departmentId);

@ -15,6 +15,9 @@
WHERE parentid = 1
AND id NOT IN (12, 20, 50, 51, 52, 60);
</select>
<select id="selectByDepartmentId" resultType="com.nov.KgLowDurable.pojo.entity.Department">
select * from t_department where id = #{departmentId}
</select>
</mapper>

@ -31,10 +31,20 @@
<if test="departmentId != null">
and department_id = #{departmentId}
</if>
<if test="num != null">
and num > #{num}
</if>
<if test="materialName != null and materialName != ''">
AND material_name LIKE CONCAT('%', #{materialName}, '%')
</if>
</select>
<select id="selectByIds" resultType="com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO">
select * from ld_consumer_form where id in
<foreach collection="consumerIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

@ -27,6 +27,9 @@
<if test="departmentId != null">
and department_id = #{departmentId}
</if>
<if test="num != null">
and num > #{num}
</if>
<if test="materialName != null and materialName != ''">
AND material_name LIKE CONCAT('%', #{materialName}, '%')
</if>
@ -34,6 +37,12 @@
<select id="selectByMaterialId" resultType="com.nov.KgLowDurable.pojo.entity.LdDurableForm">
select * from ld_durable_form where material_id = #{materialId}
</select>
<select id="selectByIds" resultType="com.nov.KgLowDurable.pojo.vo.LdTwoInventoryVO">
select * from ld_durable_form where id in
<foreach collection="durableIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

@ -19,6 +19,7 @@
<if test="materialName != null and materialName !=''">
and material_name = #{materialName}
</if>
order by id desc
</select>
<select id="selectAll" resultType="com.nov.KgLowDurable.pojo.vo.LdMaterialVO">

@ -30,7 +30,7 @@
<!-- 基础查询SQL -->
<sql id="baseColumnList">
id, one_out_storage_id, one_out_storage_no, one_out_detail_code, ld_demand_end_id, material_id, material_name, material_code,model, type, unit, application_quantity, outbound_quantity, shipper_status, out_storage_person, out_storage_time, remark ,outbound_sum_quantity
id, one_form_id, one_out_storage_id, one_out_storage_no, one_out_detail_code, ld_demand_end_id, material_id, material_name, material_code, model, type, unit, application_quantity, outbound_quantity, outbound_sum_quantity, shipper_status, out_storage_person, out_storage_time, department, department_name, department_people_id, department_people_name, remark
</sql>
<select id="selectById" resultMap="ldOnePutStorageDetailResultMap">

@ -69,7 +69,7 @@
WHERE inbound_detail_code LIKE CONCAT(#{prefix}, #{date}, '%')
</select>
<select id="selectSummaryDat" resultType="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail">
<select id="selectSummaryData" resultType="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail">
SELECT
ld_purchase_end_id,
material_id,

@ -5,6 +5,7 @@
<!-- 二级库出库明细表查询映射结果 -->
<resultMap id="ldTwoOutStorageDetailResultMap" type="com.nov.KgLowDurable.pojo.entity.LdTwoOutStorageDetail">
<id column="id" property="id"/>
<result column="two_inventory_id" property="twoInventoryId"/>
<result column="two_out_storage_id" property="twoOutStorageId"/>
<result column="two_out_storage_no" property="twoOutStorageNo"/>
<result column="two_out_detail_code" property="twoOutDetailCode"/>

@ -38,6 +38,9 @@
<select id="selectByDepartmentId" resultType="com.nov.KgLowDurable.pojo.entity.User">
select * from t_user where main_er_department = #{departmentId} and is_del=0
</select>
<select id="selectByLeaderInDept" resultType="com.nov.KgLowDurable.pojo.entity.User">
select * from t_user where leader_in_dept = #{topDepartmentId}
</select>
</mapper>

Loading…
Cancel
Save