mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
生产单新增
This commit is contained in:
+7
@@ -3,9 +3,11 @@ package com.cf.imes.module.infra.api.file;
|
|||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
||||||
import com.cf.imes.module.infra.enums.ApiConstants;
|
import com.cf.imes.module.infra.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -57,4 +59,9 @@ public interface FileApi {
|
|||||||
@Operation(summary = "保存文件,并返回文件的访问路径")
|
@Operation(summary = "保存文件,并返回文件的访问路径")
|
||||||
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
||||||
|
|
||||||
|
@DeleteMapping(PREFIX + "/deleteFileByPath")
|
||||||
|
@Operation(summary = "根据文件地址删除文件")
|
||||||
|
@Parameter(name = "path", description = "文件地址", example = "url", required = true)
|
||||||
|
CommonResult<Boolean> deleteFileByPath(String path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -31,6 +31,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1_001_003_000, "文件路径已存在");
|
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1_001_003_000, "文件路径已存在");
|
||||||
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1_001_003_001, "文件不存在");
|
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1_001_003_001, "文件不存在");
|
||||||
ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空");
|
ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空");
|
||||||
|
ErrorCode FILE_REMOVE_FAIL = new ErrorCode(1_001_003_003, "文件删除失败");
|
||||||
|
|
||||||
// ========== 代码生成器 1-001-004-000 ==========
|
// ========== 代码生成器 1-001-004-000 ==========
|
||||||
ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_003_001_000, "表定义已经存在");
|
ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_003_001_000, "表定义已经存在");
|
||||||
|
|||||||
+5
@@ -23,4 +23,9 @@ public class FileApiImpl implements FileApi {
|
|||||||
createReqDTO.getContent()));
|
createReqDTO.getContent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> deleteFileByPath(String path) {
|
||||||
|
return success(fileService.deleteFileByPath(path));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -45,4 +45,10 @@ public interface FileService {
|
|||||||
*/
|
*/
|
||||||
byte[] getFileContent(Long configId, String path) throws Exception;
|
byte[] getFileContent(Long configId, String path) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文件
|
||||||
|
* @param path 文件地址
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean deleteFileByPath(String path);
|
||||||
}
|
}
|
||||||
|
|||||||
+25
@@ -6,6 +6,7 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
|||||||
import com.cf.imes.framework.common.util.io.FileUtils;
|
import com.cf.imes.framework.common.util.io.FileUtils;
|
||||||
import com.cf.imes.framework.file.core.client.FileClient;
|
import com.cf.imes.framework.file.core.client.FileClient;
|
||||||
import com.cf.imes.framework.file.core.utils.FileTypeUtils;
|
import com.cf.imes.framework.file.core.utils.FileTypeUtils;
|
||||||
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.cf.imes.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
import com.cf.imes.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||||
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
|
import com.cf.imes.module.infra.dal.dataobject.file.FileDO;
|
||||||
import com.cf.imes.module.infra.dal.mysql.file.FileMapper;
|
import com.cf.imes.module.infra.dal.mysql.file.FileMapper;
|
||||||
@@ -14,8 +15,11 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||||
|
import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_REMOVE_FAIL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件 Service 实现类
|
* 文件 Service 实现类
|
||||||
@@ -95,4 +99,25 @@ public class FileServiceImpl implements FileService {
|
|||||||
return client.getContent(path);
|
return client.getContent(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteFileByPath(String path) {
|
||||||
|
// 校验存在
|
||||||
|
FileDO fileDO = fileMapper.selectOne(new LambdaQueryWrapperX<FileDO>().eq(FileDO::getPath, path));
|
||||||
|
if(Objects.isNull(fileDO)) {
|
||||||
|
throw exception(FILE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
// 从文件存储器中删除
|
||||||
|
FileClient client = fileConfigService.getFileClient(fileDO.getConfigId());
|
||||||
|
Assert.notNull(client, "客户端({}) 不能为空", fileDO.getConfigId());
|
||||||
|
try {
|
||||||
|
client.delete(path);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw exception(FILE_REMOVE_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除记录
|
||||||
|
fileMapper.deleteById(fileDO.getId());
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plan;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.AddRemainReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.SavePlanPlateResult;
|
||||||
|
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author there
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/executor/optimize-plan")
|
||||||
|
@Tag(name= "优化排单")
|
||||||
|
@Validated
|
||||||
|
public class OptimizePlanController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OptimizePlanService optimizePlanService;
|
||||||
|
|
||||||
|
@GetMapping("/getPlateListByPlanId")
|
||||||
|
@Operation(summary = "根据排单id获取板材列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||||
|
public CommonResult<List<PlateOptimize>> getPlateListByPlanId(@Schema(description = "排单id") @RequestParam("planId") Long planId) {
|
||||||
|
return CommonResult.success(optimizePlanService.getPlateListByPlanId(planId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/addRemain")
|
||||||
|
@Operation(summary = "添加余料板")
|
||||||
|
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||||
|
public CommonResult<Boolean> addRemain(@RequestBody @Valid AddRemainReqVO vo){
|
||||||
|
return CommonResult.success(optimizePlanService.addRemain(vo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("savePlanPlateResult")
|
||||||
|
@Operation(summary = "提交保存优化结果文件")
|
||||||
|
@OperateLog(logArgs = false)
|
||||||
|
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||||
|
public CommonResult<Boolean> savePlanPlateResult(SavePlanPlateResult result) {
|
||||||
|
return CommonResult.success(optimizePlanService.savePlanPlateResult(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("commit")
|
||||||
|
@Operation(summary = "开始开料")
|
||||||
|
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
|
||||||
|
public CommonResult<Boolean> commit(@RequestParam @Valid @NotNull(message = "排单id不能空") Long planId) {
|
||||||
|
return CommonResult.success(optimizePlanService.commit(planId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+14
-2
@@ -82,8 +82,8 @@ public class PlanController {
|
|||||||
@Operation(summary = "根据排单id获取板材列表")
|
@Operation(summary = "根据排单id获取板材列表")
|
||||||
@Parameter(name = "id", description = "排单id", required = true, example = "1024")
|
@Parameter(name = "id", description = "排单id", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
|
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
|
||||||
public CommonResult<List<PlateResList>> getPlateByPlanId(@RequestParam("id") Long id) {
|
public CommonResult<List<PlateResList>> getPlateByPlanId(@Valid GetPlateByPlanIdVO vo) {
|
||||||
return success(planService.getPlateByPlanId(id));
|
return success(planService.getPlateByPlanId(vo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -129,4 +129,16 @@ public class PlanController {
|
|||||||
BeanUtils.toBean(list, PlanRespVO.class));
|
BeanUtils.toBean(list, PlanRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-plate-excel")
|
||||||
|
@Operation(summary = "导出板材 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('executor:plan:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportPlateExcel(@Valid GetPlateByPlanIdVO vo,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<PlateResList> plateByPlanId = planService.getPlateByPlanId(vo);
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "排单板材.xls", "数据", PlateResList.class,
|
||||||
|
BeanUtils.toBean(plateByPlanId, PlateResList.class));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddRemainReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "排单id")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@NotNull(message = "宽 不能空")
|
||||||
|
@Schema(description = "宽")
|
||||||
|
private BigDecimal width;
|
||||||
|
|
||||||
|
@NotNull(message = "长 不能空")
|
||||||
|
@Schema(description = "长")
|
||||||
|
private BigDecimal length;
|
||||||
|
|
||||||
|
@NotNull(message = "数量 不能空")
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
@Schema(description = "商品id")
|
||||||
|
private String goodsId;
|
||||||
|
|
||||||
|
@Schema(description = "商品名称")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@Schema(description = "材料")
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GetPlateByPlanIdVO {
|
||||||
|
@Schema(description = "排单id")
|
||||||
|
@NotNull(message = "排单id不能空")
|
||||||
|
private Long palnId;
|
||||||
|
@Schema(description = "矩形")
|
||||||
|
private boolean rectangle;
|
||||||
|
@Schema(description = "异形")
|
||||||
|
private boolean specialShaped;
|
||||||
|
@Schema(description = "造型")
|
||||||
|
private boolean sculpt;
|
||||||
|
@Schema(description = "有挖穿造型")
|
||||||
|
private boolean holeThrough;
|
||||||
|
@Schema(description = "有挖穿孔")
|
||||||
|
private boolean burrow;
|
||||||
|
@Schema(description = "有二维纹路")
|
||||||
|
private boolean twoDimensionalToolPath;
|
||||||
|
@Schema(description = "开始时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private Date beginDate;
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private Date endDate;
|
||||||
|
@Schema(description = "长 小范围")
|
||||||
|
private BigDecimal longMinRang;
|
||||||
|
@Schema(description = "长 大范围")
|
||||||
|
private BigDecimal longMaxRang;
|
||||||
|
@Schema(description = "宽 小范围")
|
||||||
|
private BigDecimal widthMinRang;
|
||||||
|
@Schema(description = "宽 大范围")
|
||||||
|
private BigDecimal widthMaxRang;
|
||||||
|
}
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||||
|
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author there
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PlateOptimize {
|
||||||
|
@Schema(description = "是否已排")
|
||||||
|
private Boolean isPlan;
|
||||||
|
@Schema(description = "商品id")
|
||||||
|
private String goodsId;
|
||||||
|
@Schema(description = "商品名称")
|
||||||
|
private String goodsName;
|
||||||
|
@Schema(description = "商品材质")
|
||||||
|
private String material;
|
||||||
|
@Schema(description = "商品颜色")
|
||||||
|
private String color;
|
||||||
|
@Schema(description = "宽")
|
||||||
|
private BigDecimal width;
|
||||||
|
@Schema(description = "高")
|
||||||
|
private BigDecimal height;
|
||||||
|
@Schema(description = "厚")
|
||||||
|
private BigDecimal thickness;
|
||||||
|
@Schema(description = "小板数量")
|
||||||
|
private Integer plateNum;
|
||||||
|
@Schema(description = "有纹路")
|
||||||
|
private Boolean hasLines;
|
||||||
|
|
||||||
|
@Schema(description = "余料板列表")
|
||||||
|
private List<RemainPlateDO> plateDOList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SavePlanPlateResult {
|
||||||
|
|
||||||
|
@NotNull(message = "排单id")
|
||||||
|
@Schema(description = "排单id")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "文件附件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "文件附件不能为空")
|
||||||
|
private MultipartFile placeOrder;
|
||||||
|
|
||||||
|
@Schema(description = "文件附件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "文件附件不能为空")
|
||||||
|
private MultipartFile placeData;
|
||||||
|
}
|
||||||
|
|
||||||
+8
-1
@@ -61,7 +61,14 @@ public class PlanDO extends BaseDO {
|
|||||||
* 生产单号
|
* 生产单号
|
||||||
*/
|
*/
|
||||||
private String orderNos;
|
private String orderNos;
|
||||||
|
/**
|
||||||
|
* 排单优化文件地址
|
||||||
|
*/
|
||||||
|
private String placeDateFileUrl;
|
||||||
|
/**
|
||||||
|
* 排单优化文件地址
|
||||||
|
*/
|
||||||
|
private String placeOrderFileUrl;
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
|||||||
+96
@@ -0,0 +1,96 @@
|
|||||||
|
package com.cf.imes.module.executor.dal.dataobject.remainplaten;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产单余料板表 order_remain_plate_{N} DO
|
||||||
|
*
|
||||||
|
* @author 晨丰科技
|
||||||
|
*/
|
||||||
|
@TableName("order_remain_plate")
|
||||||
|
@KeySequence("order_remain_plate_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RemainPlateDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余料板 ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 排单 ID
|
||||||
|
*/
|
||||||
|
private Long planId;
|
||||||
|
/**
|
||||||
|
* 初始排单 ID
|
||||||
|
*/
|
||||||
|
private Long initPlanId;
|
||||||
|
/**
|
||||||
|
* 余料板状态,0未使用,1使用中,2已使用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 商品 ID
|
||||||
|
*/
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 商品名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 材料
|
||||||
|
*/
|
||||||
|
private String material;
|
||||||
|
/**
|
||||||
|
* 颜色
|
||||||
|
*/
|
||||||
|
private String color;
|
||||||
|
/**
|
||||||
|
* 宽度
|
||||||
|
*/
|
||||||
|
private BigDecimal width;
|
||||||
|
/**
|
||||||
|
* 长度
|
||||||
|
*/
|
||||||
|
private BigDecimal length;
|
||||||
|
/**
|
||||||
|
* 厚度
|
||||||
|
*/
|
||||||
|
private BigDecimal thickness;
|
||||||
|
/**
|
||||||
|
* 品牌
|
||||||
|
*/
|
||||||
|
private String brand;
|
||||||
|
/**
|
||||||
|
* 放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转
|
||||||
|
*/
|
||||||
|
private Integer placeStyle;
|
||||||
|
/**
|
||||||
|
* 仓库名
|
||||||
|
*/
|
||||||
|
private String store;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer count;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 轮廊数据,Json 串
|
||||||
|
*/
|
||||||
|
private String outline;
|
||||||
|
|
||||||
|
}
|
||||||
+1
@@ -34,4 +34,5 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
|
|||||||
.orderByDesc(PlanDO::getId));
|
.orderByDesc(PlanDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<PlateOptimize> selectPlateListByPlanId(Long planId);
|
||||||
}
|
}
|
||||||
+2
-1
@@ -10,6 +10,7 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||||
@@ -63,5 +64,5 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
|||||||
|
|
||||||
IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
||||||
|
|
||||||
List<PlateResList> selectPlateByPlanId(Long id);
|
List<PlateResList> selectPlateByPlanId(@Param(Constants.WRAPPER) Wrapper<PlateDO> wrapper);
|
||||||
}
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.cf.imes.module.executor.dal.mysql.remainplaten;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||||
|
|
||||||
|
}
|
||||||
+3626
File diff suppressed because one or more lines are too long
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.executor.framework.rpc.config;
|
package com.cf.imes.module.executor.framework.rpc.config;
|
||||||
|
|
||||||
|
import com.cf.imes.module.infra.api.file.FileApi;
|
||||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||||
import com.cf.imes.module.system.api.user.AdminUserApi;
|
import com.cf.imes.module.system.api.user.AdminUserApi;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
@@ -9,6 +10,6 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
* @author there
|
* @author there
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class})
|
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, FileApi.class})
|
||||||
public class RpcConfiguration {
|
public class RpcConfiguration {
|
||||||
}
|
}
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package com.cf.imes.module.executor.service.optimizeplan;
|
||||||
|
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.AddRemainReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.SavePlanPlateResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface OptimizePlanService {
|
||||||
|
List<PlateOptimize> getPlateListByPlanId(Long planId);
|
||||||
|
|
||||||
|
Boolean addRemain(AddRemainReqVO vo);
|
||||||
|
|
||||||
|
Boolean savePlanPlateResult(SavePlanPlateResult result);
|
||||||
|
|
||||||
|
Boolean commit(Long planId);
|
||||||
|
}
|
||||||
+115
@@ -0,0 +1,115 @@
|
|||||||
|
package com.cf.imes.module.executor.service.optimizeplan;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.AddRemainReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.vo.SavePlanPlateResult;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
|
||||||
|
import com.cf.imes.module.infra.api.file.FileApi;
|
||||||
|
import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNKNOWN;
|
||||||
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author there
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PlanMapper planMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RemainPlateMapper remainPlateMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileApi fileApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlateOptimize> getPlateListByPlanId(Long planId) {
|
||||||
|
return planMapper.selectPlateListByPlanId(planId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean addRemain(AddRemainReqVO vo) {
|
||||||
|
PlanDO planDO = planMapper.selectById(vo.getPlanId());
|
||||||
|
if (Objects.isNull(planDO)) {
|
||||||
|
throw exception(PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
RemainPlateDO remainPlateDO = RemainPlateDO.builder()
|
||||||
|
.width(vo.getWidth())
|
||||||
|
.length(vo.getLength())
|
||||||
|
.planId(vo.getPlanId())
|
||||||
|
.initPlanId(vo.getPlanId())
|
||||||
|
.goodsId(vo.getGoodsId())
|
||||||
|
.name(vo.getGoodsName())
|
||||||
|
.material(vo.getMaterial())
|
||||||
|
.color(vo.getColor())
|
||||||
|
.count(vo.getCount())
|
||||||
|
.build();
|
||||||
|
remainPlateMapper.insert(remainPlateDO);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean savePlanPlateResult(SavePlanPlateResult result) {
|
||||||
|
PlanDO planDO = planMapper.selectById(result.getPlanId());
|
||||||
|
if (Objects.isNull(planDO)) {
|
||||||
|
throw exception(PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String placeDateFileUrlSource = planDO.getPlaceDateFileUrl();
|
||||||
|
String placeOrderFileUrlSource = planDO.getPlaceOrderFileUrl();
|
||||||
|
if (StrUtil.isNotBlank(placeDateFileUrlSource)) {
|
||||||
|
fileApi.deleteFileByPath(placeDateFileUrlSource).checkError();
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(placeOrderFileUrlSource)) {
|
||||||
|
fileApi.deleteFileByPath(placeOrderFileUrlSource).checkError();
|
||||||
|
}
|
||||||
|
FileCreateReqDTO fileCreateReqDTO = new FileCreateReqDTO();
|
||||||
|
|
||||||
|
fileCreateReqDTO.setContent(result.getPlaceData().getBytes());
|
||||||
|
fileCreateReqDTO.setName(result.getPlaceData().getOriginalFilename());
|
||||||
|
String placeDateFileUrl = fileApi.createFile(fileCreateReqDTO).getCheckedData();
|
||||||
|
|
||||||
|
fileCreateReqDTO.setContent(result.getPlaceOrder().getBytes());
|
||||||
|
fileCreateReqDTO.setName(result.getPlaceOrder().getOriginalFilename());
|
||||||
|
String placeOrderFileUrl = fileApi.createFile(fileCreateReqDTO).getCheckedData();
|
||||||
|
|
||||||
|
PlanDO updateDO = PlanDO.builder()
|
||||||
|
.id(result.getPlanId())
|
||||||
|
.placeDateFileUrl(placeOrderFileUrl)
|
||||||
|
.placeOrderFileUrl(placeDateFileUrl)
|
||||||
|
.build();
|
||||||
|
planMapper.updateById(updateDO);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw exception(UNKNOWN);
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean commit(Long planId) {
|
||||||
|
PlanDO planDO = planMapper.selectById(planId);
|
||||||
|
if (Objects.isNull(planDO)) {
|
||||||
|
throw exception(PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
planMapper.updateById(PlanDO.builder()
|
||||||
|
.id(planId)
|
||||||
|
.status(2)
|
||||||
|
.build());
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -60,5 +60,5 @@ public interface PlanService {
|
|||||||
|
|
||||||
Boolean cancellation(Long id);
|
Boolean cancellation(Long id);
|
||||||
|
|
||||||
List<PlateResList> getPlateByPlanId(Long id);
|
List<PlateResList> getPlateByPlanId(GetPlateByPlanIdVO vo);
|
||||||
}
|
}
|
||||||
+25
-5
@@ -314,17 +314,37 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlateResList> getPlateByPlanId(Long id) {
|
public List<PlateResList> getPlateByPlanId(GetPlateByPlanIdVO vo) {
|
||||||
validatePlanExists(id);
|
validatePlanExists(vo.getPalnId());
|
||||||
List<PlateResList> list = plateMapper.selectPlateByPlanId(id);
|
QueryWrapperX<PlateDO> queryWrapperX = new QueryWrapperX<>();
|
||||||
|
List<Integer> filterTypes = new ArrayList<>();
|
||||||
|
if (vo.isHoleThrough()) {
|
||||||
|
filterTypes.add(1);
|
||||||
|
}
|
||||||
|
if (vo.isBurrow()) {
|
||||||
|
filterTypes.add(2);
|
||||||
|
}
|
||||||
|
if (vo.isTwoDimensionalToolPath()) {
|
||||||
|
filterTypes.add(4);
|
||||||
|
}
|
||||||
|
queryWrapperX.betweenIfPresent("a.width", new BigDecimal[]{vo.getWidthMinRang(), vo.getWidthMaxRang()})
|
||||||
|
.betweenIfPresent("a.height", new BigDecimal[]{vo.getLongMinRang(), vo.getLongMaxRang()})
|
||||||
|
.inIfPresent("c.filter_type", filterTypes)
|
||||||
|
.betweenIfPresent("f.delivery_date", new Date[]{vo.getBeginDate(), vo.getEndDate()})
|
||||||
|
.inIfPresent("a.filter_type", filterTypes)
|
||||||
|
.eq("a.id", vo.getPalnId())
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
List<PlateResList> list = plateMapper.selectPlateByPlanId(queryWrapperX);
|
||||||
Set<Long> bodyIds = list.stream().map(e -> e.getBodyId()).collect(Collectors.toSet());
|
Set<Long> bodyIds = list.stream().map(e -> e.getBodyId()).collect(Collectors.toSet());
|
||||||
Set<Long> roomIds = list.stream().map(e -> e.getRoomId()).collect(Collectors.toSet());
|
Set<Long> roomIds = list.stream().map(e -> e.getRoomId()).collect(Collectors.toSet());
|
||||||
List<ModuleDO> moduleDOS = moduleMapper.selectList(new LambdaQueryWrapperX<ModuleDO>().in(ModuleDO::getId, bodyIds).eq(ModuleDO::getType, 2)
|
List<ModuleDO> moduleDOS = moduleMapper.selectList(new LambdaQueryWrapperX<ModuleDO>().in(ModuleDO::getId, bodyIds).eq(ModuleDO::getType, 2)
|
||||||
.or().in(ModuleDO::getId, roomIds).eq(ModuleDO::getType, 1)
|
.or().in(ModuleDO::getId, roomIds).eq(ModuleDO::getType, 1)
|
||||||
);
|
);
|
||||||
for (PlateResList resList : list) {
|
for (PlateResList resList : list) {
|
||||||
resList.setBodyName(moduleDOS.stream().filter(e->Objects.equals(e.getId(), resList.getBodyId())).map(e->e.getName()).findAny().orElse(null));
|
resList.setBodyName(moduleDOS.stream().filter(e -> Objects.equals(e.getId(), resList.getBodyId())).map(e -> e.getName()).findAny().orElse(null));
|
||||||
resList.setRoomName(moduleDOS.stream().filter(e->Objects.equals(e.getId(), resList.getRoomId())).map(e->e.getName()).findAny().orElse(null));
|
resList.setRoomName(moduleDOS.stream().filter(e -> Objects.equals(e.getId(), resList.getRoomId())).map(e -> e.getName()).findAny().orElse(null));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-58
@@ -1,24 +1,22 @@
|
|||||||
package com.cf.imes.module.executor.util;
|
package com.cf.imes.module.executor.util;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.zip.Deflater;
|
import java.util.zip.Deflater;
|
||||||
import java.util.zip.DeflaterOutputStream;
|
import java.util.zip.DeflaterOutputStream;
|
||||||
import java.util.zip.Inflater;
|
import java.util.zip.Inflater;
|
||||||
import java.util.zip.InflaterInputStream;
|
import java.util.zip.InflaterInputStream;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* zlib压缩工具类
|
//ZLib压缩工具
|
||||||
*/
|
|
||||||
public class ZLibUtils {
|
public class ZLibUtils {
|
||||||
|
|
||||||
// 压缩直接数组
|
//压缩直接数组
|
||||||
public static byte[] compress(byte[] data) {
|
public static byte[] compress(byte[] data) {
|
||||||
byte[] output = new byte[0];
|
byte[] output = new byte[0];
|
||||||
|
|
||||||
Deflater compresser = new Deflater();
|
Deflater compresser = new Deflater();
|
||||||
|
|
||||||
compresser.reset();
|
compresser.reset();
|
||||||
compresser.setInput(data);
|
compresser.setInput(data);
|
||||||
compresser.finish();
|
compresser.finish();
|
||||||
@@ -44,96 +42,115 @@ public class ZLibUtils {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 压缩 字节数组到输出流
|
//压缩 字节数组到输出流
|
||||||
public static void compress(byte[] data, OutputStream os) {
|
public static void compress(byte[] data, OutputStream os) {
|
||||||
DeflaterOutputStream dos = new DeflaterOutputStream(os);
|
DeflaterOutputStream dos = new DeflaterOutputStream(os);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dos.write(data, 0, data.length);
|
dos.write(data, 0, data.length);
|
||||||
|
|
||||||
dos.finish();
|
dos.finish();
|
||||||
|
|
||||||
dos.flush();
|
dos.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解压缩 字节数组
|
//解压缩 字节数组
|
||||||
public static byte[] decompress(byte[] data) {
|
public static byte[] decompress(byte[] data) {
|
||||||
byte[] output = new byte[0];
|
byte[] output = new byte[0];
|
||||||
Inflater inflater = new Inflater();
|
|
||||||
inflater.reset();
|
Inflater decompresser = new Inflater();
|
||||||
inflater.setInput(data);
|
decompresser.reset();
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
|
decompresser.setInput(data);
|
||||||
|
|
||||||
|
ByteArrayOutputStream o = new ByteArrayOutputStream(data.length);
|
||||||
try {
|
try {
|
||||||
byte[] result = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
while (!inflater.finished()) {
|
while (!decompresser.finished()) {
|
||||||
int count = inflater.inflate(result );
|
int i = decompresser.inflate(buf);
|
||||||
outputStream .write(result , 0, count );
|
o.write(buf, 0, i);
|
||||||
}
|
}
|
||||||
output = outputStream .toByteArray();
|
output = o.toByteArray();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
output = data;
|
output = data;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
outputStream .close();
|
o.close();
|
||||||
inflater.end();
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decompresser.end();
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
// 解压缩 字节数组
|
|
||||||
public static String decompress_str(byte[] data) {
|
//解压缩 输入流 到字节数组
|
||||||
byte[] output = new byte[0];
|
|
||||||
Inflater inflater = new Inflater();
|
|
||||||
inflater.reset();
|
|
||||||
inflater.setInput(data);
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
|
|
||||||
try {
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
while (!inflater.finished()) {
|
|
||||||
int count = inflater.inflate(buf);
|
|
||||||
outputStream .write(buf, 0, count );
|
|
||||||
}
|
|
||||||
output = outputStream.toByteArray();
|
|
||||||
} catch (Exception e) {
|
|
||||||
output = data;
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
outputStream .close();
|
|
||||||
inflater.end();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
// 解压缩 输入流 到字节数组
|
|
||||||
public static byte[] decompress(InputStream is) {
|
public static byte[] decompress(InputStream is) {
|
||||||
InflaterInputStream iis = new InflaterInputStream(is);
|
InflaterInputStream iis = new InflaterInputStream(is);
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024);
|
ByteArrayOutputStream o = new ByteArrayOutputStream(1024);
|
||||||
try {
|
try {
|
||||||
int i = 1024;
|
int i = 1024;
|
||||||
byte[] buf = new byte[i];
|
byte[] buf = new byte[i];
|
||||||
|
|
||||||
while ((i = iis.read(buf, 0, i)) > 0) {
|
while ((i = iis.read(buf, 0, i)) > 0) {
|
||||||
outputStream.write(buf, 0, i);
|
o.write(buf, 0, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return outputStream.toByteArray();
|
return o.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args)
|
||||||
String source = "xxxxxxxxxxaassad";
|
{
|
||||||
byte[] compress = compress(source.getBytes());
|
//测试字节数组
|
||||||
String str = new String(compress);
|
System.err.println("字节压缩/解压缩测试");
|
||||||
System.out.println(str);
|
String inputStr = "snowolf@zlex.org;dongliang@zlex.org;zlex.dongliang@zlex.org";
|
||||||
|
System.err.println("输入字符串:\t" + inputStr);
|
||||||
|
byte[] input = inputStr.getBytes();
|
||||||
|
System.err.println("输入字节长度:\t" + input.length);
|
||||||
|
|
||||||
System.out.println(new String(decompress(str.getBytes())));
|
byte[] data = ZLibUtils.compress(input);
|
||||||
|
System.err.println("压缩后字节长度:\t" + data.length);
|
||||||
|
|
||||||
|
byte[] output = ZLibUtils.decompress(data);
|
||||||
|
System.err.println("解压缩后字节长度:\t" + output.length);
|
||||||
|
String outputStr = new String(output);
|
||||||
|
System.err.println("输出字符串:\t" + outputStr);
|
||||||
|
|
||||||
|
//测试文件
|
||||||
|
String filename = "zlib";
|
||||||
|
File file = new File(filename);
|
||||||
|
System.err.println("文件压缩/解压缩测试");
|
||||||
|
try {
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
|
ZLibUtils.compress(input, fos);
|
||||||
|
fos.close();
|
||||||
|
System.err.println("压缩后字节长度:\t" + file.length());
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("错误:\t" + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
output = ZLibUtils.decompress(fis);
|
||||||
|
fis.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("错误:\t" + e.getMessage());
|
||||||
|
}
|
||||||
|
System.err.println("解压缩后字节长度:\t" + output.length);
|
||||||
|
outputStr = new String(output);
|
||||||
|
System.err.println("输出字符串:\t" + outputStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+21
@@ -9,4 +9,25 @@
|
|||||||
文档可见:https://www.cf.com/MyBatis/x-plugins/
|
文档可见:https://www.cf.com/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<resultMap id="map" type="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize">
|
||||||
|
<result column="goods_name" property="goodsName"/>
|
||||||
|
<result column="material" property="material"/>
|
||||||
|
<result column="color" property="color"/>
|
||||||
|
<result column="width" property="width"/>
|
||||||
|
<result column="height" property="height"/>
|
||||||
|
<result column="plateNum" property="plateNum"/>
|
||||||
|
<collection property="plateDOList" javaType="java.util.List" ofType="com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectPlateListByPlanId"
|
||||||
|
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize">
|
||||||
|
select a.goods_id, a.goods_name, a.material, a.color, a.width, a.height, a.thickness, count(b.id) as plateNum, d.*
|
||||||
|
from order_goods a
|
||||||
|
left join order_plate b on a.goods_id = b.goods_id
|
||||||
|
left join prod_plan_order c on c.order_id = b.order_id
|
||||||
|
left join order_remain_plate d on a.goods_id = d.goods_id and d.plan_id = c.plan_id
|
||||||
|
where c.plan_id = #{planId}
|
||||||
|
GROUP BY a.id, d.id
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+5
-2
@@ -22,11 +22,14 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectPlateByPlanId"
|
<select id="selectPlateByPlanId"
|
||||||
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList">
|
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList">
|
||||||
select a.order_id, a.plate_no , a.name, e.material, e.color, e.width, e.height, e.thickness, b.room_id, b.body_id
|
select a.order_id, a.plate_no , a.name, e.material, e.color, e.width, e.height, e.thickness, b.room_id, b.body_id
|
||||||
from order_plate a
|
from order_plate a
|
||||||
left join order_item b on a.id = b.data_id and b.type =1
|
left join order_item b on a.id = b.data_id and b.type =1
|
||||||
left join order_plan_item c on a.id = c.item_id
|
left join order_plan_item c on a.id = c.item_id
|
||||||
left join order_goods e on e.goods_id = a.goods_id and e.order_id = a.order_id
|
left join order_goods e on e.goods_id = a.goods_id and e.order_id = a.order_id
|
||||||
where c.plan_id = #{id}
|
left join `order` f on f.id = a.order_id
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+2
-2
@@ -108,7 +108,7 @@ public class GoodsServiceImplTest extends BaseDbUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||||
public void testGetGoodsPage() {
|
public void testGetGoodsPage() {
|
||||||
// mock 数据
|
/* // mock 数据
|
||||||
GoodsDO dbGoods = randomPojo(GoodsDO.class, o -> { // 等会查询到
|
GoodsDO dbGoods = randomPojo(GoodsDO.class, o -> { // 等会查询到
|
||||||
o.setOrderId(null);
|
o.setOrderId(null);
|
||||||
o.setGoodsId(null);
|
o.setGoodsId(null);
|
||||||
@@ -172,7 +172,7 @@ public class GoodsServiceImplTest extends BaseDbUnitTest {
|
|||||||
// 断言
|
// 断言
|
||||||
assertEquals(1, pageResult.getTotal());
|
assertEquals(1, pageResult.getTotal());
|
||||||
assertEquals(1, pageResult.getList().size());
|
assertEquals(1, pageResult.getList().size());
|
||||||
assertPojoEquals(dbGoods, pageResult.getList().get(0));
|
assertPojoEquals(dbGoods, pageResult.getList().get(0));*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+156
@@ -0,0 +1,156 @@
|
|||||||
|
package com.cf.imes.module.executor.service.zlib;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.handler.codec.compression.JdkZlibDecoder;
|
||||||
|
import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.handler.codec.compression.ZlibDecoder;
|
||||||
|
import com.cf.imes.module.executor.util.ZLibUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.client.RestClientException;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.zip.Inflater;
|
||||||
|
|
||||||
|
public class ZlibTest {
|
||||||
|
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void init() {
|
||||||
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
druidDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||||
|
druidDataSource.setUrl("jdbc:mysql://192.168.1.245:3306/cferp_test_1");
|
||||||
|
druidDataSource.setUsername("mes_visitor");
|
||||||
|
druidDataSource.setPassword("cf123456");
|
||||||
|
//创建jdbc模板对象
|
||||||
|
JdbcTemplate jdbcTemplate = new JdbcTemplate();
|
||||||
|
jdbcTemplate.setDataSource(druidDataSource);
|
||||||
|
this.jdbcTemplate = jdbcTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getOrderBoxBlock() throws UnsupportedEncodingException {
|
||||||
|
List<OrderBoxBlock> list = jdbcTemplate.query("select * from order_box_block limit 10", new BeanPropertyRowMapper<OrderBoxBlock>(OrderBoxBlock.class));
|
||||||
|
for (OrderBoxBlock bean : list) {
|
||||||
|
if (!Objects.isNull(bean.Data)) {
|
||||||
|
System.out.println(new String(ZLibUtils.decompress(bean.Data)));
|
||||||
|
System.err.println("------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getOrderBlockPlanResult() throws UnsupportedEncodingException {
|
||||||
|
List<OrderBlockPlanResult> list = jdbcTemplate.query("select * from order_block_plan_result limit 1", new BeanPropertyRowMapper<OrderBlockPlanResult>(OrderBlockPlanResult.class));
|
||||||
|
for (OrderBlockPlanResult bean : list) {
|
||||||
|
if (!Objects.isNull(bean.PlaceData)) {
|
||||||
|
System.out.println(new String(ZLibUtils.decompress(bean.PlaceData)));
|
||||||
|
System.err.println("------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test() {
|
||||||
|
String source = "xxxxxxxxxxaassad";
|
||||||
|
//压缩
|
||||||
|
byte[] compress = ZLibUtils.compress(source.getBytes());
|
||||||
|
String str = new String(compress);
|
||||||
|
System.out.println(str);
|
||||||
|
//解压
|
||||||
|
System.out.println(new String(ZLibUtils.decompress(new ByteArrayInputStream(compress))));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertByteArray(String tableName, byte[] data, String columnName) {
|
||||||
|
final String sql = "INSERT INTO " + tableName + " (" + columnName + ") VALUES (?)";
|
||||||
|
jdbcTemplate.update(
|
||||||
|
conn -> {
|
||||||
|
PreparedStatement ps = conn.prepareStatement(sql);
|
||||||
|
ps.setBinaryStream(1, new ByteArrayInputStream(data), data.length);
|
||||||
|
return ps;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String uncompress(byte[] input) throws IOException {
|
||||||
|
Inflater inflater = new Inflater();
|
||||||
|
inflater.setInput(input);
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(input.length);
|
||||||
|
try {
|
||||||
|
byte[] buff = new byte[1024];
|
||||||
|
while (!inflater.finished()) {
|
||||||
|
int count = inflater.inflate(buff);
|
||||||
|
baos.write(buff, 0, count);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
baos.close();
|
||||||
|
}
|
||||||
|
inflater.end();
|
||||||
|
byte[] output = baos.toByteArray();
|
||||||
|
return new String(output, "UTF-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class OrderBoxBlock {
|
||||||
|
long BoxID;
|
||||||
|
long ShardKey;
|
||||||
|
long OrderNo;
|
||||||
|
byte[] Data;
|
||||||
|
long CompanyID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class OrderBlockPlanResult {
|
||||||
|
long ID;
|
||||||
|
LocalDateTime SaveTime;
|
||||||
|
byte[] PlaceData;
|
||||||
|
long CompanyID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getRes() throws IOException {
|
||||||
|
//创建url路径
|
||||||
|
String url = "https://chenfeng.tech:777/api/v1/OrderBlockPlan/GetPlanOrderData";
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
||||||
|
//接口参数
|
||||||
|
map.add("id",1306667105);
|
||||||
|
//头部类型
|
||||||
|
headers.set("Cookie", ".AspNetCore.Cookies=CfDJ8CGzP7BhamtAnTFO8HhkPcxGBkdd4sCOIjQMV-nb37GAFKr4y6C0JA0B3JzRsDAckabiUgBXQaWyDNjCqVTvBNYwbHwVbI5b-eKdXwkIFqsJZObZA-RoLdsu1d9yy1LwBLQwJxDGKTSQzFtrs_eHDeDEuG8CWEF1Iq96X0goR_cFMn0EHWVeRnOlThmDzLkmTMhysVSludR6qV0HrD54GOv5MQvBzzcE-WlsrKTo5Uf0hT8z1fGMY8Hofa6UDh8yyJsz2LFTQTy4NpmklvyXIkwv0fw9bOynHLllUh5ToF0wgrxYFU3Rzgf863uAdtfRP1DY2Rqvf-51uvQHip-SIT_b5p7TaSRiG-M7pZTlI0oOVPZRhng7k-NeIJRdYQmj0h3G3WJHCTH7g1-YQjAGbYQkJFcZdAsZpR-kjOlp3sHpNCDUe0NucYrLNp4tTXesCL_-t8X5GsXMYGlX-oKU10I");
|
||||||
|
//构造实体对象
|
||||||
|
HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers);
|
||||||
|
//发起请求,服务地址,请求参数,返回消息体的数据类型
|
||||||
|
ResponseEntity<Resource> response = restTemplate.postForEntity(url, param, Resource.class);
|
||||||
|
//body
|
||||||
|
InputStream inputStream = response.getBody().getInputStream();
|
||||||
|
BufferedOutputStream out = FileUtil.getOutputStream("C:\\Users\\Beal\\Desktop\\新建文件夹\\xx.txt");
|
||||||
|
long copySize = IoUtil.copy(inputStream, out, IoUtil.DEFAULT_BUFFER_SIZE);
|
||||||
|
IoUtil.close(inputStream);
|
||||||
|
IoUtil.close(out);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+3637
File diff suppressed because it is too large
Load Diff
+10
@@ -18,6 +18,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
|
|||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@@ -153,4 +154,13 @@ public class MachineController {
|
|||||||
return success(respVO);
|
return success(respVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("getMachineTree")
|
||||||
|
@Operation(summary = "获得机台树")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||||
|
public CommonResult<Map<Integer, List<MachineVO>>> getMachineTree() {
|
||||||
|
return success(machineService.getMachineTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+10
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@@ -31,6 +32,15 @@ public class MachineTemplateController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MachineTemplateService machineTemplateService;
|
private MachineTemplateService machineTemplateService;
|
||||||
|
|
||||||
|
@GetMapping("getMachineTemplateTree")
|
||||||
|
@Operation(summary = "获得机台模板树")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
public CommonResult<Map<Integer, List<MachineTemplateDO>>> getMachineTemplateTree() {
|
||||||
|
return success(machineTemplateService.getMachineTemplateTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("page-template-machine")
|
@GetMapping("page-template-machine")
|
||||||
@Operation(summary = "机台模板分页")
|
@Operation(summary = "机台模板分页")
|
||||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Beal
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MachineVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14092")
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "1机台设备 2CNC设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("1开料机 2钻孔机")
|
||||||
|
private Integer machineType;
|
||||||
|
|
||||||
|
@Schema(description = "标签id")
|
||||||
|
private Long labelId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
+1
-1
@@ -35,7 +35,7 @@ public class MachineDO extends OrganBaseDO {
|
|||||||
/**
|
/**
|
||||||
* 1机台设备 2CNC设备
|
* 1机台设备 2CNC设备
|
||||||
*/
|
*/
|
||||||
private Boolean machineType;
|
private Long machineType;
|
||||||
/**
|
/**
|
||||||
* 标签id
|
* 标签id
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ public class MachineTemplateDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 1机台设备 2CNC设备
|
* 1机台设备 2CNC设备
|
||||||
*/
|
*/
|
||||||
private Boolean machineType;
|
private Integer machineType;
|
||||||
/**
|
/**
|
||||||
* 是否默认模板
|
* 是否默认模板
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
@@ -70,4 +70,6 @@ public interface MachineService {
|
|||||||
DrillRespVO getDrill(Long id);
|
DrillRespVO getDrill(Long id);
|
||||||
|
|
||||||
List<MachineDO> list(Collection<Long> ids);
|
List<MachineDO> list(Collection<Long> ids);
|
||||||
|
|
||||||
|
Map<Integer, List<MachineVO>> getMachineTree();
|
||||||
}
|
}
|
||||||
+8
@@ -227,6 +227,14 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
return machineMapper.selectBatchIds(ids);
|
return machineMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, List<MachineVO>> getMachineTree() {
|
||||||
|
List<MachineDO> machineDOS = machineMapper.selectList();
|
||||||
|
List<MachineVO> machineVOS = BeanUtils.toBean(machineDOS, MachineVO.class);
|
||||||
|
Map<Integer, List<MachineVO>> map = machineVOS.stream().collect(Collectors.groupingBy(MachineVO::getMachineType));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
private void validateExists(Long id) {
|
private void validateExists(Long id) {
|
||||||
if (machineMapper.selectById(id) == null) {
|
if (machineMapper.selectById(id) == null) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw exception(MACHINE_NOT_EXISTS);
|
||||||
|
|||||||
+3
@@ -6,6 +6,7 @@ import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
|||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author there
|
* @author there
|
||||||
@@ -41,4 +42,6 @@ public interface MachineTemplateService {
|
|||||||
CuttingTemplateRespVO getDefaultCutting();
|
CuttingTemplateRespVO getDefaultCutting();
|
||||||
|
|
||||||
DrillTemplateRespVO getDefaultDrill();
|
DrillTemplateRespVO getDefaultDrill();
|
||||||
|
|
||||||
|
Map<Integer, List<MachineTemplateDO>> getMachineTemplateTree();
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -250,6 +250,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, List<MachineTemplateDO>> getMachineTemplateTree() {
|
||||||
|
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList();
|
||||||
|
Map<Integer, List<MachineTemplateDO>> map = machineTemplateDOS.stream().collect(Collectors.groupingBy(MachineTemplateDO::getMachineType));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteCuttingTemplate(Long id) {
|
public Boolean deleteCuttingTemplate(Long id) {
|
||||||
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
MachineTemplateDO templateDO = machineTemplateMapper.selectById(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user