mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
-26
@@ -1,26 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.OrderDTO;
|
||||
import com.cf.imes.module.executor.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/22 17:56
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 订单报表数据源")
|
||||
public interface OrderDatasourceApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/order";
|
||||
|
||||
@GetMapping(PREFIX +"/info")
|
||||
@Operation(summary = "获取生产单信息")
|
||||
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
|
||||
CommonResult<OrderDTO> getOrderInfo(@RequestParam("orderId") Long orderId);
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.PartGoodsRespDTO;
|
||||
import com.cf.imes.module.executor.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/30 9:22
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 配件报表数据源")
|
||||
public interface OrderPartDatasourceApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/order-part";
|
||||
|
||||
@GetMapping(PREFIX + "/detail")
|
||||
@Operation(summary = "配件明细")
|
||||
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
|
||||
CommonResult<List<PartGoodsRespDTO>> selectPartDetail(@RequestParam("orderId") Long orderId);
|
||||
|
||||
@GetMapping(PREFIX + "/summary")
|
||||
@Operation(summary = "配件汇总")
|
||||
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
|
||||
CommonResult<List<PartGoodsRespDTO>> selectPartAll(@RequestParam("orderId") Long orderId);
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.PlateGoodsRespDTO;
|
||||
import com.cf.imes.module.executor.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 12:00
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 板材报表数据源")
|
||||
public interface OrderPlateDatasourceApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/order-plate";
|
||||
|
||||
@GetMapping(PREFIX + "/summary")
|
||||
@Operation(summary = "板材汇总")
|
||||
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
|
||||
CommonResult<List<PlateGoodsRespDTO>> selectPlateGoodsListSummary(@RequestParam("orderId") Long orderId);
|
||||
|
||||
@GetMapping(PREFIX + "/detail")
|
||||
@Operation(summary = "板材明细")
|
||||
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
|
||||
CommonResult<List<PlateGoodsRespDTO>> selectPlateGoodsList(@RequestParam("orderId") Long orderId);
|
||||
}
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/22 17:54
|
||||
*/
|
||||
@Schema(description = "管理后台 - 生产单表 RPC Response DTO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3574973837176279383L;
|
||||
|
||||
@Schema(description = "生产单号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父单号")
|
||||
private Long parentNo;
|
||||
|
||||
@Schema(description = "源生产单号")
|
||||
private String apiOrderId;
|
||||
|
||||
@Schema(description = "生产单日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime orderDate;
|
||||
|
||||
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime deliveryDate;
|
||||
|
||||
@Schema(description = "生产单类型,1主单 2子单", example = "1")
|
||||
private Integer orderType;
|
||||
|
||||
@Schema(description = "生产单排序号")
|
||||
private Integer orderSort;
|
||||
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,订单状态,0空订单1新单2生产中3生产完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "自定义单号")
|
||||
private String customOrderNo;
|
||||
|
||||
@Schema(description = "客户", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String customer;
|
||||
|
||||
@Schema(description = "客户地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String address;
|
||||
|
||||
@Schema(description = "客户电话", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "经销商", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String dealer;
|
||||
|
||||
@Schema(description = "经销商电话", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String dealerPhoneNumber;
|
||||
|
||||
@Schema(description = "业务员")
|
||||
private String salesman;
|
||||
|
||||
@Schema(description = "拆单员")
|
||||
private String splitter;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "管理后台 - 配件对应板材信息 Resp DTO")
|
||||
public class PartGoodsRespDTO {
|
||||
|
||||
@Schema(description = "柜体号", example = "11087")
|
||||
private Long bodyId;
|
||||
|
||||
@Schema(description = "柜体名称", example = "11087")
|
||||
private String bodyName;
|
||||
|
||||
@Schema(description = "房间号", example = "11087")
|
||||
private Long roomId;
|
||||
|
||||
@Schema(description = "房间名称", example = "11087")
|
||||
private String roomName;
|
||||
|
||||
@Schema(description = "配件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29347")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "材质", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String material;
|
||||
|
||||
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String model;
|
||||
|
||||
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String factory;
|
||||
|
||||
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double price;
|
||||
|
||||
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean isComposite;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double num;
|
||||
|
||||
@Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
|
||||
private Double totalPrice;
|
||||
}
|
||||
-179
@@ -1,179 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "管理后台 - 板件对应板材信息 Response DTO")
|
||||
public class PlateGoodsRespDTO {
|
||||
|
||||
@Schema(description = "柜体号", example = "11087")
|
||||
private Long bodyId;
|
||||
|
||||
@Schema(description = "柜体名称", example = "11087")
|
||||
private String bodyName;
|
||||
|
||||
@Schema(description = "房间号", example = "11087")
|
||||
private Long roomId;
|
||||
|
||||
@Schema(description = "房间名称", example = "11087")
|
||||
private String roomName;
|
||||
|
||||
@Schema(description = "板id", example = "11087")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "板数量", example = "11087")
|
||||
private Integer count = 1;
|
||||
|
||||
@Schema(description = "生产单号", example = "11087")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "板名称", example = "晨丰")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "自定义板编号,设计有板编号,则保留设计板编号;设计没有且在机台设置中设置了自定义板编号规则,则按规则自动生成")
|
||||
private String plateNo;
|
||||
|
||||
@Schema(description = "板类型,0 层板 1 立板 2 背板", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "商品 ID", example = "14195")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", example = "西西")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "商品材质", example = "颗粒板")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "商品颜色", example = "白色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "商品宽度", example = "14195")
|
||||
private BigDecimal goodsWidth;
|
||||
|
||||
@Schema(description = "商品高度", example = "14195")
|
||||
private BigDecimal goodsHeight;
|
||||
|
||||
@Schema(description = "商品厚度", example = "14195")
|
||||
private BigDecimal goodsThickness;
|
||||
|
||||
@Schema(description = "商品价格", example = "14195")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "商品品牌", example = "柏柏")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "商品规格", example = "14195*21")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "高度")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "厚度")
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "拆单宽度")
|
||||
private BigDecimal splitWidth;
|
||||
|
||||
@Schema(description = "拆单高度")
|
||||
private BigDecimal splitHeight;
|
||||
|
||||
@Schema(description = "拆单厚度")
|
||||
private BigDecimal splitThickness;
|
||||
|
||||
@Schema(description = "左封边厚度")
|
||||
private BigDecimal sealLeft;
|
||||
|
||||
@Schema(description = "右封边厚度")
|
||||
private BigDecimal sealRight;
|
||||
|
||||
@Schema(description = "上封边厚度")
|
||||
private BigDecimal sealUp;
|
||||
|
||||
@Schema(description = "下封边厚度")
|
||||
private BigDecimal sealDown;
|
||||
|
||||
@Schema(description = "面积")
|
||||
private BigDecimal area;
|
||||
|
||||
@Schema(description = "纹路类型,0 正纹 1 可翻转 2 反纹")
|
||||
private Integer texture;
|
||||
|
||||
@Schema(description = "孔面类型,0 正面 1 反面 2 侧面")
|
||||
private Integer holeFace;
|
||||
|
||||
@Schema(description = "排孔类型,0 正纹 1 反面 2 随意面")
|
||||
private Integer holeArrange;
|
||||
|
||||
@Schema(description = "异型孔数量", example = "28477")
|
||||
private Short unregularPointCount;
|
||||
|
||||
@Schema(description = "正面孔数量", example = "20823")
|
||||
private Short frontHoleCount;
|
||||
|
||||
@Schema(description = "背面孔数量", example = "3441")
|
||||
private Short backHoleCount;
|
||||
|
||||
@Schema(description = "侧面孔数量", example = "25509")
|
||||
private Short sideHoleCount;
|
||||
|
||||
@Schema(description = "正面造型量", example = "31547")
|
||||
private Short frontModelCount;
|
||||
|
||||
@Schema(description = "背面造型量", example = "26725")
|
||||
private Short backModelCount;
|
||||
|
||||
@Schema(description = "是否门板")
|
||||
private Boolean isDoor;
|
||||
|
||||
@Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", example = "2")
|
||||
private Integer openDoorType;
|
||||
|
||||
@Schema(description = "异型偏移 x")
|
||||
private Double offsetX;
|
||||
|
||||
@Schema(description = "异型偏移 y")
|
||||
private Double offsetY;
|
||||
|
||||
@Schema(description = "是否孤形对角")
|
||||
private Boolean isArcAcross;
|
||||
|
||||
@Schema(description = "是否异形")
|
||||
private Boolean isSpecialShaped;
|
||||
|
||||
@Schema(description = "是否造型")
|
||||
private Boolean isSculpt;
|
||||
|
||||
@Schema(description = "模块类型 ID", example = "12800")
|
||||
private Long moduleTypeId;
|
||||
|
||||
@Schema(description = "排单过滤类型,1 有挖穿造型 2 有挖穿孔 4 有二维刀路 8 可叠", example = "1")
|
||||
private String filterType;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否作废")
|
||||
private Boolean isCancel;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -151,11 +151,6 @@
|
||||
<groupId>uk.co.jemos.podam</groupId>
|
||||
<artifactId>podam</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-report-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON -->
|
||||
<dependency>
|
||||
@@ -188,10 +183,6 @@
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-executor-api</artifactId>
|
||||
</include>
|
||||
<include>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-report-api</artifactId>
|
||||
</include>
|
||||
<include>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-system-api</artifactId>
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.OrderDTO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/22 17:57
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class OrderDatasourceApiImpl implements OrderDatasourceApi {
|
||||
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Override
|
||||
public CommonResult<OrderDTO> getOrderInfo(Long orderId) {
|
||||
// 查询生产单
|
||||
OrderDO orderDO = orderMapper.selectOrderOne(orderId, OrganContextHolder.getOrganId());
|
||||
OrderDTO orderDTO = BeanUtils.toBean(orderDO, OrderDTO.class);
|
||||
return CommonResult.success(orderDTO);
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.PartGoodsRespDTO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/30 9:21
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class OrderPartDatasourceApiImpl implements OrderPartDatasourceApi {
|
||||
|
||||
@Resource
|
||||
private OrderPartsMapper orderPartsMapper;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<PartGoodsRespDTO>> selectPartDetail(Long orderId) {
|
||||
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
|
||||
// 查询明细列表
|
||||
List<PartGoodsRespVO> partGoodsRespVOS = orderPartsMapper.selectPartDetail(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
|
||||
return CommonResult.success(BeanUtils.toBean(partGoodsRespVOS, PartGoodsRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<PartGoodsRespDTO>> selectPartAll(Long orderId) {
|
||||
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
|
||||
// 查询明细列表
|
||||
List<PartGoodsRespVO> partGoodsRespVOS = orderPartsMapper.selectPartAll(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
|
||||
return CommonResult.success(BeanUtils.toBean(partGoodsRespVOS, PartGoodsRespDTO.class));
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.cf.imes.module.executor.api.datasource;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.PlateGoodsRespDTO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 14:26
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class OrderPlateDatasourceApiImpl implements OrderPlateDatasourceApi {
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<List<PlateGoodsRespDTO>> selectPlateGoodsListSummary(Long orderId) {
|
||||
// 查询分组统计
|
||||
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
|
||||
List<PlateGoodsRespVO> plateGoodsRespVOS = plateMapper.selectPlateGoodsListSummary(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
|
||||
return CommonResult.success(BeanUtils.toBean(plateGoodsRespVOS, PlateGoodsRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<PlateGoodsRespDTO>> selectPlateGoodsList(Long orderId) {
|
||||
// 查询分组列表
|
||||
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
|
||||
List<PlateGoodsRespVO> plateGoodsRespVOS = plateMapper.selectPlateGoodsList(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
|
||||
return CommonResult.success(BeanUtils.toBean(plateGoodsRespVOS, PlateGoodsRespDTO.class));
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -6,10 +6,10 @@ import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -42,9 +42,9 @@ public class OrderPageReqVOCopy extends PageParam {
|
||||
private Boolean twoDimensionalToolPath;
|
||||
@Schema(description = "门板")
|
||||
private Boolean isDoor;
|
||||
@Schema(description = "生产单订单日期", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
@Schema(description = "生产单订单日期", example = "[2022-07-01 ,2022-07-01]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate[] createTime;
|
||||
@Schema(description = "长 小范围")
|
||||
private BigDecimal longMinRang;
|
||||
@Schema(description = "长 大范围")
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package com.cf.imes.module.executor.framework.rpc.config;
|
||||
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
import com.cf.imes.module.report.api.template.ReportTemplateApi;
|
||||
import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||
@@ -18,6 +17,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {AdminUserApi.class, MachineApi.class, DictDataApi.class,AdminUserApi.class,
|
||||
FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class, ApplicationApi.class, ProcessApi.class, ReportTemplateApi.class, OrganApi.class})
|
||||
FileApi.class, ProcessGroupApi.class, FileApi.class, DataSourceApi.class, ApplicationApi.class, ProcessApi.class, OrganApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
@@ -177,8 +177,7 @@
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-executor-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.cf.imes.module.report.api.template;
|
||||
|
||||
import com.cf.imes.module.report.api.template.dto.ReportTemplateGenerateReqDTO;
|
||||
import com.cf.imes.module.report.enums.ApiConstants;
|
||||
import feign.Response;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* 报表模板feign service
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 11:31
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 报表模板")
|
||||
public interface ReportTemplateApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/template";
|
||||
|
||||
@PostMapping(value = PREFIX + "/export")
|
||||
@Operation(summary = "下载模板excel")
|
||||
Response excel(@RequestBody ReportTemplateGenerateReqDTO reqDTO);
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.cf.imes.module.report.api.template.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 15:03
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 报表模板生成 Request DTO")
|
||||
@Data
|
||||
public class ReportTemplateGenerateReqDTO {
|
||||
@Schema(description = "模板id")
|
||||
@NotNull(message = "模板id不能为空")
|
||||
private Long templateId;
|
||||
|
||||
@Schema(description = "参数集合")
|
||||
private Map<String, Object> params;
|
||||
|
||||
@Schema(description = "生成文件类型,pdf/word/excel")
|
||||
@NotNull(message = "生成文件类型不能为空")
|
||||
private String producerType;
|
||||
}
|
||||
@@ -134,12 +134,6 @@
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>${commons-text.version}</version>
|
||||
</dependency>
|
||||
<!-- executor feign 远程调用-->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-executor-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!--ureport-core 相关start-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
@@ -185,10 +179,6 @@
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-infra-api</artifactId>
|
||||
</include>
|
||||
<include>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-executor-api</artifactId>
|
||||
</include>
|
||||
<include>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-report-api</artifactId>
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class ReportDatasetController {
|
||||
}
|
||||
|
||||
@GetMapping("/dataset/{id}")
|
||||
@Operation(summary = "获得报表数据集")
|
||||
@Operation(summary = "获取报表数据集")
|
||||
@Parameter(name = "id", description = "数据集id", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<ReportDatasetRespVO> getDataset(@PathVariable("id") Long id) {
|
||||
|
||||
+2
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -22,5 +23,6 @@ public class ReportDatasetFieldVO implements Serializable {
|
||||
* 字段名称
|
||||
*/
|
||||
@Schema(description = "字段名称")
|
||||
@NotBlank(message = "字段名称不能为空")
|
||||
private String name;
|
||||
}
|
||||
|
||||
+3
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -22,12 +23,14 @@ public class ReportDatasetParameterVO implements Serializable {
|
||||
* 参数名称
|
||||
*/
|
||||
@Schema(description = "参数名称")
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Schema(description = "参数类型")
|
||||
@NotBlank(message = "参数类型不能为空")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
||||
+6
@@ -7,8 +7,10 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -47,8 +49,12 @@ public class ReportDatasetSaveReqVO implements Serializable {
|
||||
private String method;
|
||||
|
||||
@Schema(description = "参数列表")
|
||||
@Size(max = 30, message = "参数列表数量不能超过30个")
|
||||
@Valid
|
||||
private List<ReportDatasetParameterVO> parameters = new ArrayList<>();
|
||||
|
||||
@Schema(description = "字段列表")
|
||||
@Size(max = 30, message = "字段列表数量不能超过30个")
|
||||
@Valid
|
||||
private List<ReportDatasetFieldVO> fields = new ArrayList<>();
|
||||
}
|
||||
|
||||
+13
-10
@@ -8,8 +8,10 @@ import com.bstek.ureport.definition.dataset.Field;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportBeanDatasourceRespVO;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportDatasourcePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportDatasourceRespVO;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportDatasourceSaveReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportDatasourceTestConnReqVO;
|
||||
import com.cf.imes.module.report.dal.dataobject.datasource.ReportDatasourceDO;
|
||||
import com.cf.imes.module.report.service.datasource.ReportDatasourceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -22,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -99,7 +102,7 @@ public class ReportDatasourceController {
|
||||
@Operation(summary = "获取springbean数据源返回对象")
|
||||
@Parameter(name = "clazz", description = "返回对象类路径全名不能为空", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public List<Field> springbeanFieldList(@RequestParam(value = "clazz") @NotEmpty(message = "类路径全名不能为空") String clazz) {
|
||||
public List<Field> springbeanFieldList(@RequestParam(value = "clazz") @NotEmpty(message = "类路径全名不能为空") @Size(max = 100, message = "类路径全名不能超过100个字符") String clazz) {
|
||||
return datasourceService.getSpringBeanResultFieldList(clazz);
|
||||
}
|
||||
|
||||
@@ -107,7 +110,7 @@ public class ReportDatasourceController {
|
||||
@Operation(summary = "获取springbean数据源方法类表")
|
||||
@Parameter(name = "beanId", description = "springbeanId", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<List<String>> getBeanDatasourceList(@RequestParam(value = "beanId") @NotEmpty(message = "beanId不能为空") String beanId) {
|
||||
public CommonResult<List<String>> getBeanDatasourceList(@RequestParam(value = "beanId") @NotEmpty(message = "beanId不能为空") @Size(max = 100, message = "beanId不能超过100个字符") String beanId) {
|
||||
return success(datasourceService.loadBeanMethods(beanId));
|
||||
}
|
||||
|
||||
@@ -115,29 +118,29 @@ public class ReportDatasourceController {
|
||||
@PostMapping("/datasource/connect")
|
||||
@Operation(summary = "测试数据源连接")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<Boolean> testDatasourceConnect(@RequestBody DataSourceInfo info) {
|
||||
String success = MultipleJdbcTemplate.testConnection(info);
|
||||
public CommonResult<Boolean> testDatasourceConnect(@RequestBody @Valid ReportDatasourceTestConnReqVO reqVO) {
|
||||
String success = MultipleJdbcTemplate.testConnection(BeanUtils.toBean(reqVO, DataSourceInfo.class));
|
||||
return Objects.equals("success", success) ? success(true) : error(DATASOURCE_CONNECT_FAIL);
|
||||
}
|
||||
|
||||
@PostMapping("/datasource/tables")
|
||||
@Operation(summary = "获取数据库表列表")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<List<Map<String, String>>> getDatasourceTables(@RequestBody DataSourceInfo info) {
|
||||
return success(ureportDataSourceService.selectTableList(info));
|
||||
public CommonResult<List<Map<String, String>>> getDatasourceTables(@RequestBody @Valid ReportDatasourceTestConnReqVO reqVO) {
|
||||
return success(ureportDataSourceService.selectTableList(BeanUtils.toBean(reqVO, DataSourceInfo.class)));
|
||||
}
|
||||
|
||||
@PostMapping("/datasource/table/fields")
|
||||
@Operation(summary = "获取数据源表字段")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<List<Field>> getDatasourceTableFields(@RequestBody PreviewParams previewParams) {
|
||||
return success(datasourceService.getTableFields(previewParams));
|
||||
public CommonResult<List<Field>> getDatasourceTableFields(@RequestBody @Valid ReportDatasourcePreviewReqVO reqVO) {
|
||||
return success(datasourceService.getTableFields(BeanUtils.toBean(reqVO, PreviewParams.class)));
|
||||
}
|
||||
|
||||
@PostMapping("/datasource/preview")
|
||||
@Operation(summary = "数据源预览")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<Map<String, Object>> previewData(@RequestBody PreviewParams previewParams) {
|
||||
return success(ureportDataSourceService.previewData(previewParams));
|
||||
public CommonResult<Map<String, Object>> previewData(@RequestBody @Valid ReportDatasourcePreviewReqVO reqVO) {
|
||||
return success(ureportDataSourceService.previewData(BeanUtils.toBean(reqVO, PreviewParams.class)));
|
||||
}
|
||||
}
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.cf.imes.module.report.controller.admin.datasource.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/8 11:36
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "管理后台 - 报表数据源查询参数 Request VO")
|
||||
public class ReportDatasourceParameterVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 2752387952196201725L;
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
@Schema(description = "参数名称")
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Schema(description = "参数类型")
|
||||
@NotBlank(message = "参数类型不能为空")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
*/
|
||||
@Schema(description = "参数默认值")
|
||||
private String defaultValue;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.cf.imes.module.report.controller.admin.datasource.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/10/16 16:39
|
||||
*/
|
||||
@Schema(description = "管理后台 - 报表数据源预览 Request VO")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ReportDatasourcePreviewReqVO {
|
||||
@Schema(description = "数据源连接信息")
|
||||
@NotNull
|
||||
@Valid
|
||||
private ReportDatasourceTestConnReqVO info;
|
||||
|
||||
@Schema(description = "查询语句")
|
||||
@NotBlank(message = "查询语句不能为空")
|
||||
private String sql;
|
||||
|
||||
@Schema(description = "查询参数列表")
|
||||
@Size(max = 30, message = "查询参数列表数量不能超过30个")
|
||||
@Valid
|
||||
private List<ReportDatasourceParameterVO> parameters;
|
||||
}
|
||||
+3
@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@@ -65,8 +66,10 @@ public class ReportDatasourceSaveReqVO implements Serializable {
|
||||
private String password;
|
||||
|
||||
@Schema(description = "备注", example = "该模板仅供生产使用")
|
||||
@Length(max = 64, message = "备注长度不能超过64个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "请求头参数")
|
||||
@Size(max = 30, message = "请求头参数数量不能超过30个")
|
||||
private List<Map<String, String>> headers;
|
||||
}
|
||||
|
||||
+7
-14
@@ -1,14 +1,12 @@
|
||||
package com.cf.imes.module.report.controller.admin.datasource.vo;
|
||||
|
||||
import com.cf.imes.module.report.controller.admin.dataset.vo.ReportDatasetParameterVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
@@ -21,24 +19,19 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
public class ReportDatasourceTestConnReqVO {
|
||||
|
||||
@Schema(description = "数据源驱动类",example = "com.mysql.cj.jdbc.Driver")
|
||||
private String driver;
|
||||
@Schema(description = "数据源驱动类", example = "com.mysql.cj.jdbc.Driver")
|
||||
@NotBlank(message = "数据源驱动类不能为空")
|
||||
private String driverClassName;
|
||||
|
||||
@Schema(description = "数据源地址", example = "https://www.cf.com")
|
||||
@NotBlank(message = "数据源地址不能为空")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "数据源用户名", example = "晨丰")
|
||||
@NotBlank(message = "数据源用户名不能为空")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "数据源密码", example = "晨丰")
|
||||
@NotBlank(message = "数据源密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "数据源id", example = "1")
|
||||
private Long datasourceId;
|
||||
|
||||
@Schema(description = "数据库语句")
|
||||
private String sql;
|
||||
|
||||
@Schema(description = "参数列表")
|
||||
private List<ReportDatasetParameterVO> parameters = new ArrayList<>();
|
||||
}
|
||||
|
||||
+10
-34
@@ -1,23 +1,18 @@
|
||||
package com.cf.imes.module.report.controller.admin.template;
|
||||
|
||||
import com.bstek.designer.bean.PreviewParameters;
|
||||
import com.bstek.designer.bean.ReportDefinitionWrapper;
|
||||
import com.bstek.designer.excel.ExcelParserUtils;
|
||||
import com.bstek.ureport.definition.ReportDefinition;
|
||||
import com.bstek.ureport.dsl.ReportParserLexer;
|
||||
import com.bstek.ureport.dsl.ReportParserParser;
|
||||
import com.bstek.ureport.exception.ReportException;
|
||||
import com.bstek.ureport.export.ExportUtils;
|
||||
import com.bstek.ureport.export.ProducerEnum;
|
||||
import com.bstek.ureport.export.html.HtmlReport;
|
||||
import com.bstek.ureport.expression.ErrorInfo;
|
||||
import com.bstek.ureport.expression.ScriptErrorListener;
|
||||
import com.bstek.ureport.model.Report;
|
||||
import com.bstek.ureport.utils.StringUtils;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.report.api.template.dto.ReportTemplateGenerateReqDTO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateRespVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateSaveReqVO;
|
||||
@@ -30,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.antlr.v4.runtime.ANTLRInputStream;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -41,9 +35,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -106,7 +101,7 @@ public class ReportTemplateController {
|
||||
@GetMapping("/templates")
|
||||
@Operation(summary = "获取报表模板信息列表")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<List<ReportTemplateRespVO>> getTemplatePage(@RequestParam(value = "name", required = false) String name) {
|
||||
public CommonResult<List<ReportTemplateRespVO>> getTemplatePage(@RequestParam(value = "name", required = false) @Size(max = 64, message = "模板名称长度不能超过64个字符") String name) {
|
||||
ReportTemplateReqVO reqVO = new ReportTemplateReqVO(name, null);
|
||||
return success(BeanUtils.toBean(templateService.getReportTemplateList(reqVO), ReportTemplateRespVO.class));
|
||||
}
|
||||
@@ -114,41 +109,22 @@ public class ReportTemplateController {
|
||||
@PostMapping("/template/preview")
|
||||
@Operation(summary = "模板预览")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
public CommonResult<HtmlReport> preview(@RequestBody PreviewParameters params) {
|
||||
return success(templateService.preview(params));
|
||||
public CommonResult<HtmlReport> preview(@RequestBody ReportTemplatePreviewReqVO reqVO) {
|
||||
return success(templateService.preview(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/template/print")
|
||||
@Operation(summary = "模板预览打印")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
public void print(@RequestBody PreviewParameters reportParameters, HttpServletResponse response) {
|
||||
templateService.print(reportParameters, response);
|
||||
public void print(@RequestBody ReportTemplatePreviewReqVO reqVO, HttpServletResponse response) {
|
||||
templateService.print(reqVO, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/download/{type}")
|
||||
@Operation(summary = "模板预览下载")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
public void print(@PathVariable @Valid @ReportTemplateProducerTypeInEnum String type, @RequestBody PreviewParameters reportParameters, HttpServletResponse response) {
|
||||
templateService.download(type, reportParameters, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/export")
|
||||
@Operation(summary = "模板导出")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public void generateTemplate(@Valid @RequestBody ReportTemplateGenerateReqDTO reqDTO, HttpServletResponse response) {
|
||||
OutputStream out = null;
|
||||
try {
|
||||
Report report = templateService.generateReport(reqDTO);
|
||||
out = response.getOutputStream();
|
||||
ProducerEnum p = ProducerEnum.valueOf(reqDTO.getProducerType().toUpperCase());
|
||||
ExportUtils.export(out, report, p);
|
||||
} catch (ReportException rex) {
|
||||
throw rex;
|
||||
} catch (Exception ex) {
|
||||
log.error("[generateExcel] 报表模板生成excel异常", ex);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
public void print(@PathVariable @ReportTemplateProducerTypeInEnum @NotBlank(message = "模板下载类型不能为空") String type, @RequestBody ReportTemplatePreviewReqVO reqVO, HttpServletResponse response) {
|
||||
templateService.download(type, reqVO, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/excel/import")
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.cf.imes.module.report.controller.admin.template.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 9:22
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "管理后台 - 报表模板预览分页参数 Request VO")
|
||||
public class ReportTemplatePreviewPageParametersVO {
|
||||
@Schema(description = "页码",example = "1")
|
||||
private int pageIndex;
|
||||
|
||||
@Schema(description = "预览参数")
|
||||
private ReportTemplatePreviewParametersVO params;
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package com.cf.imes.module.report.controller.admin.template.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 9:22
|
||||
*/
|
||||
@Schema(description = "管理后台 - 报表模板预览参数 Request VO")
|
||||
@Data
|
||||
public class ReportTemplatePreviewParametersVO {
|
||||
/**
|
||||
* 报表内容
|
||||
*/
|
||||
@Schema(description = "报表内容")
|
||||
@NotNull(message = "预览报表内容不能为空")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
@Schema(description = "报表名称")
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 表单参数
|
||||
*/
|
||||
@Schema(description = "表单参数")
|
||||
private Map<String, Object> query = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 表单对应组件唯一标识
|
||||
*/
|
||||
@Schema(description = "表单对应组件唯一标识")
|
||||
private Map<String, String> component = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 图表图片目前用于PDF导出
|
||||
*/
|
||||
@Schema(description = "图表图片目前用于PDF导出")
|
||||
private Map<String, String> chartImages = new HashMap<>();
|
||||
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.cf.imes.module.report.controller.admin.template.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 9:22
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "管理后台 - 报表模板预览请求参数 Request VO")
|
||||
public class ReportTemplatePreviewReqVO {
|
||||
@Schema(description = "页码",example = "1")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
private int pageIndex;
|
||||
|
||||
@Schema(description = "报表内容")
|
||||
@NotNull(message = "预览报表内容不能为空")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 表单参数
|
||||
*/
|
||||
@Schema(description = "表单参数")
|
||||
@Size(max = 30, message = "表单参数数量不能超过30个")
|
||||
private Map<String, Object> query;
|
||||
|
||||
/**
|
||||
* 表单对应组件唯一标识
|
||||
*/
|
||||
@Schema(description = "表单对应组件唯一标识")
|
||||
@Size(max = 30, message = "表单对应组件唯一标识数量不能超过30个")
|
||||
private Map<String, String> component;
|
||||
|
||||
/**
|
||||
* 图表图片目前用于PDF导出
|
||||
*/
|
||||
@Schema(description = "图表图片")
|
||||
@Size(max = 30, message = "图表图片数量不能超过30个")
|
||||
private Map<String, String> chartImages;
|
||||
|
||||
}
|
||||
+4
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -33,11 +34,14 @@ public class ReportTemplateSaveReqVO {
|
||||
private String content;
|
||||
|
||||
@Schema(description = "备注", example = "该模板仅供生产使用")
|
||||
@Length(max = 64, message = "备注长度不能超过64个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "数据源id列表")
|
||||
@Size(max = 30, message = "数据源数量不能超过30个")
|
||||
private Set<Long> datasourceIds;
|
||||
|
||||
@Schema(description = "数据集id列表")
|
||||
@Size(max = 30, message = "数据集数量不能超过30个")
|
||||
private Set<Long> datasetIds;
|
||||
}
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.cf.imes.module.report.framework.rpc.config;
|
||||
|
||||
import com.cf.imes.module.executor.api.datasource.OrderDatasourceApi;
|
||||
import com.cf.imes.module.executor.api.datasource.OrderPartDatasourceApi;
|
||||
import com.cf.imes.module.executor.api.datasource.OrderPlateDatasourceApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {OrderPlateDatasourceApi.class, OrderDatasourceApi.class, OrderPartDatasourceApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
-278
@@ -1,278 +0,0 @@
|
||||
package com.cf.imes.module.report.framework.ureport.bean;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.executor.api.datasource.OrderDatasourceApi;
|
||||
import com.cf.imes.module.executor.api.datasource.OrderPartDatasourceApi;
|
||||
import com.cf.imes.module.executor.api.datasource.OrderPlateDatasourceApi;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.OrderDTO;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.PartGoodsRespDTO;
|
||||
import com.cf.imes.module.executor.api.datasource.dto.PlateGoodsRespDTO;
|
||||
import com.cf.imes.module.executor.enums.OrderPlateOpenDoorTypeEnum;
|
||||
import com.cf.imes.module.report.framework.ureport.annotation.CfReportSpringbeanDatasource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 14:41
|
||||
*/
|
||||
@CfReportSpringbeanDatasource(value = "OrderSummaryBeanDatasource", name = "生产单导出统计数据源")
|
||||
@Slf4j
|
||||
public class OrderSummaryBeanDatasource {
|
||||
|
||||
@Resource
|
||||
private OrderPlateDatasourceApi orderPlateDatasourceApi;
|
||||
|
||||
@Resource
|
||||
private OrderDatasourceApi orderDatasourceApi;
|
||||
|
||||
@Resource
|
||||
private OrderPartDatasourceApi orderPartDatasourceApi;
|
||||
|
||||
// 常用的字段key
|
||||
private static final String ORDER_ID_FIELD_NAME = "orderId";
|
||||
private static final String BODY_NAME_FIELD_NAME = "bodyName";
|
||||
private static final String ROOM_NAME_FIELD_NAME = "roomName";
|
||||
private static final String REMARK_FIELD_NAME = "remark";
|
||||
|
||||
/**
|
||||
* 生产单信息
|
||||
*
|
||||
* @param dsName
|
||||
* @param datasetName
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> orderInfo(String dsName, String datasetName, Map<String, Object> parameters) {
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderInfo][{}][{}]调用开始", dsName, datasetName);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
|
||||
if (ObjectUtil.isNull(orderId)) {
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
CommonResult<OrderDTO> commonResult = orderDatasourceApi.getOrderInfo(Long.parseLong(orderId.toString()));
|
||||
OrderDTO orderDTO = commonResult.getData();
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
if (orderDTO != null) {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
// 构造报表所需结构
|
||||
resultMap.put(ORDER_ID_FIELD_NAME, orderDTO.getId());
|
||||
resultMap.put("customOrderNo", orderDTO.getCustomOrderNo());
|
||||
resultMap.put("dealer", orderDTO.getDealer());
|
||||
LocalDateTime orderDate = orderDTO.getOrderDate();
|
||||
resultMap.put("orderDate", ObjectUtil.isNotNull(orderDate) ? formatter.format(orderDate) : null);
|
||||
LocalDateTime deliveryDate = orderDTO.getDeliveryDate();
|
||||
resultMap.put("deliveryDate", ObjectUtil.isNotNull(deliveryDate) ? formatter.format(deliveryDate) : null);
|
||||
resultMap.put("customer", orderDTO.getCustomer());
|
||||
resultMap.put("phoneNumber", orderDTO.getPhoneNumber());
|
||||
resultList.add(resultMap);
|
||||
}
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderInfo][{}][{}]调用结束", dsName, datasetName);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 板材汇总
|
||||
*
|
||||
* @param dsName
|
||||
* @param datasetName
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> orderPlateGoodsSummary(String dsName, String datasetName, Map<String, Object> parameters) {
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPlateGoodsSummary][{}][{}]调用开始", dsName, datasetName);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
|
||||
// 查询统计信息
|
||||
CommonResult<List<PlateGoodsRespDTO>> commonResult = orderPlateDatasourceApi.selectPlateGoodsListSummary(Long.parseLong(orderId.toString()));
|
||||
List<PlateGoodsRespDTO> plateGoodsRespDTOS = commonResult.getData();
|
||||
|
||||
if (CollUtil.isNotEmpty(plateGoodsRespDTOS)) {
|
||||
plateGoodsRespDTOS.forEach(p -> {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
BigDecimal area = p.getArea();
|
||||
Integer count = p.getCount();
|
||||
// 构造报表所需结构
|
||||
resultMap.put(ROOM_NAME_FIELD_NAME, p.getRoomName());
|
||||
resultMap.put(BODY_NAME_FIELD_NAME, p.getBodyName());
|
||||
resultMap.put("thickness", stripTrailingZeros(p.getThickness()));
|
||||
resultMap.put("name", p.getName());
|
||||
resultMap.put("height", stripTrailingZeros(p.getHeight()));
|
||||
resultMap.put("width", stripTrailingZeros(p.getWidth()));
|
||||
resultMap.put("count", count);
|
||||
resultMap.put("area", stripTrailingZeros(area));
|
||||
resultMap.put("openDoorType", OrderPlateOpenDoorTypeEnum.getDescFromCode(p.getOpenDoorType()));
|
||||
resultMap.put("material", p.getMaterial());
|
||||
resultMap.put("color", p.getColor());
|
||||
resultMap.put(REMARK_FIELD_NAME, p.getRemark());
|
||||
resultMap.put("areaAll", stripTrailingZeros(area.multiply(BigDecimal.valueOf(count))));
|
||||
resultList.add(resultMap);
|
||||
});
|
||||
}
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPlateGoodsSummary][{}][{}]调用结束", dsName, datasetName);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 板材明细
|
||||
*
|
||||
* @param dsName
|
||||
* @param datasetName
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> orderPlateGoodsList(String dsName, String datasetName, Map<String, Object> parameters) {
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPlateGoodsList][{}][{}]调用开始", dsName, datasetName);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
|
||||
// 查询统计信息
|
||||
CommonResult<List<PlateGoodsRespDTO>> commonResult = orderPlateDatasourceApi.selectPlateGoodsList(Long.parseLong(orderId.toString()));
|
||||
List<PlateGoodsRespDTO> plateGoodsRespDTOS = commonResult.getData();
|
||||
|
||||
if (CollUtil.isNotEmpty(plateGoodsRespDTOS)) {
|
||||
plateGoodsRespDTOS.forEach(p -> {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
BigDecimal area = p.getArea();
|
||||
Integer count = p.getCount();
|
||||
// 构造报表所需结构
|
||||
resultMap.put("goodsName", p.getGoodsName());
|
||||
resultMap.put("name", p.getName());
|
||||
resultMap.put("material", p.getMaterial());
|
||||
resultMap.put("color", p.getColor());
|
||||
resultMap.put("goodsThickness", p.getGoodsThickness());
|
||||
resultMap.put("count", p.getCount());
|
||||
resultMap.put(ROOM_NAME_FIELD_NAME, p.getRoomName());
|
||||
resultMap.put(BODY_NAME_FIELD_NAME, p.getBodyName());
|
||||
resultMap.put("plateNo", p.getPlateNo());
|
||||
resultMap.put("height", stripTrailingZeros(p.getHeight()));
|
||||
resultMap.put("width", stripTrailingZeros(p.getWidth()));
|
||||
resultMap.put("thickness", stripTrailingZeros(p.getThickness()));
|
||||
resultMap.put("area", stripTrailingZeros(area));
|
||||
resultMap.put(REMARK_FIELD_NAME, p.getRemark());
|
||||
resultMap.put("isSpecialShaped", getBooleanString(p.getIsSpecialShaped()));
|
||||
resultMap.put("isSculpt", getBooleanString(p.getIsSculpt()));
|
||||
resultMap.put("openDoorType", OrderPlateOpenDoorTypeEnum.getDescFromCode(p.getOpenDoorType()));
|
||||
resultMap.put("seal", String.join(",", stripTrailingZeros(p.getSealLeft()), stripTrailingZeros(p.getSealRight()), stripTrailingZeros(p.getSealUp()), stripTrailingZeros(p.getSealDown())));
|
||||
resultMap.put("areaAll", stripTrailingZeros(area.multiply(BigDecimal.valueOf(count))));
|
||||
resultList.add(resultMap);
|
||||
});
|
||||
}
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPlateGoodsList][{}][{}]调用结束", dsName, datasetName);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件明细
|
||||
*
|
||||
* @param dsName
|
||||
* @param datasetName
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> orderPartDetailList(String dsName, String datasetName, Map<String, Object> parameters) {
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPartDetailList][{}][{}]调用开始", dsName, datasetName);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
|
||||
CommonResult<List<PartGoodsRespDTO>> commonResult = orderPartDatasourceApi.selectPartDetail(Long.parseLong(orderId.toString()));
|
||||
List<PartGoodsRespDTO> partGoodsRespDTOS = commonResult.getData();
|
||||
|
||||
if (CollUtil.isNotEmpty(partGoodsRespDTOS)) {
|
||||
partGoodsRespDTOS.forEach(p -> {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
// 构造报表所需结构
|
||||
resultMap.put(ROOM_NAME_FIELD_NAME, p.getRoomName());
|
||||
resultMap.put(BODY_NAME_FIELD_NAME, p.getBodyName());
|
||||
resultMap.put("name", p.getName());
|
||||
resultMap.put("brand", p.getBrand());
|
||||
resultMap.put("factory", p.getFactory());
|
||||
resultMap.put("model", p.getModel());
|
||||
resultMap.put("spec", p.getSpec());
|
||||
resultMap.put("num", p.getNum());
|
||||
resultMap.put("unit", p.getUnit());
|
||||
resultMap.put("price", p.getPrice());
|
||||
resultMap.put("totalPrice", p.getTotalPrice());
|
||||
resultMap.put(REMARK_FIELD_NAME, p.getRemark());
|
||||
resultList.add(resultMap);
|
||||
});
|
||||
}
|
||||
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPartDetailList][{}][{}]调用结束", dsName, datasetName);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件汇总
|
||||
*
|
||||
* @param dsName
|
||||
* @param datasetName
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> orderPartSummary(String dsName, String datasetName, Map<String, Object> parameters) {
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPartSummary][{}][{}]调用开始", dsName, datasetName);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
|
||||
CommonResult<List<PartGoodsRespDTO>> commonResult = orderPartDatasourceApi.selectPartAll(Long.parseLong(orderId.toString()));
|
||||
List<PartGoodsRespDTO> partGoodsRespDTOS = commonResult.getData();
|
||||
|
||||
if (CollUtil.isNotEmpty(partGoodsRespDTOS)) {
|
||||
partGoodsRespDTOS.forEach(p -> {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
// 构造报表所需结构
|
||||
resultMap.put("name", p.getName());
|
||||
resultMap.put("model", p.getModel());
|
||||
resultMap.put("spec", p.getSpec());
|
||||
resultMap.put("num", p.getNum());
|
||||
resultMap.put("unit", p.getUnit());
|
||||
resultMap.put("brand", p.getBrand());
|
||||
resultMap.put(REMARK_FIELD_NAME, p.getRemark());
|
||||
resultList.add(resultMap);
|
||||
});
|
||||
}
|
||||
|
||||
log.info("报表数据源[OrderSummaryBeanDatasource][orderPartSummary][{}][{}]调用结束", dsName, datasetName);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除尾数的0,600.000 -> 600
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private String stripTrailingZeros(BigDecimal data) {
|
||||
if (ObjectUtil.isNotNull(data)) {
|
||||
return data.stripTrailingZeros().toPlainString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 布尔值转是否
|
||||
*
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
private String getBooleanString(Boolean b) {
|
||||
return b ? "是" : "否";
|
||||
}
|
||||
}
|
||||
+4
-15
@@ -1,10 +1,8 @@
|
||||
package com.cf.imes.module.report.service.template;
|
||||
|
||||
import com.bstek.designer.bean.PreviewParameters;
|
||||
import com.bstek.designer.bean.ReportDefinitionWrapper;
|
||||
import com.bstek.ureport.export.html.HtmlReport;
|
||||
import com.bstek.ureport.model.Report;
|
||||
import com.cf.imes.module.report.api.template.dto.ReportTemplateGenerateReqDTO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateRespVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateSaveReqVO;
|
||||
@@ -80,21 +78,12 @@ public interface ReportTemplateService {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
HtmlReport preview(PreviewParameters params);
|
||||
|
||||
|
||||
/**
|
||||
* 构造生成报表report对象
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Report generateReport(ReportTemplateGenerateReqDTO dto);
|
||||
HtmlReport preview(ReportTemplatePreviewReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 模版预览打印
|
||||
*/
|
||||
void print(PreviewParameters params, HttpServletResponse response);
|
||||
void print(ReportTemplatePreviewReqVO reqVO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 模版预览下载
|
||||
@@ -103,5 +92,5 @@ public interface ReportTemplateService {
|
||||
* @param params
|
||||
* @param response
|
||||
*/
|
||||
void download(String type, PreviewParameters params, HttpServletResponse response);
|
||||
void download(String type, ReportTemplatePreviewReqVO reqVO, HttpServletResponse response);
|
||||
}
|
||||
|
||||
+12
-25
@@ -34,8 +34,8 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.report.api.template.dto.ReportTemplateGenerateReqDTO;
|
||||
import com.cf.imes.module.report.config.CfReportProperties;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateRespVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateSaveReqVO;
|
||||
@@ -353,7 +353,9 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HtmlReport preview(PreviewParameters params) {
|
||||
public HtmlReport preview(ReportTemplatePreviewReqVO reqVO) {
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
Long userOrganId = SecurityFrameworkUtils.getUserOrganId();
|
||||
|
||||
HtmlProducer htmlProducer = new HtmlProducer();
|
||||
@@ -391,7 +393,10 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(PreviewParameters params, HttpServletResponse response) {
|
||||
public void print(ReportTemplatePreviewReqVO reqVO, HttpServletResponse response) {
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params);
|
||||
@@ -416,7 +421,10 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(String type, PreviewParameters params, HttpServletResponse response) {
|
||||
public void download(String type, ReportTemplatePreviewReqVO reqVO, HttpServletResponse response) {
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params);
|
||||
Report report = reportRender.render(reportDefinition, params.getQuery());
|
||||
@@ -469,27 +477,6 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
return reportDefinition;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Report generateReport(ReportTemplateGenerateReqDTO reqDTO) {
|
||||
// 校验生成文件类型
|
||||
validateProducerType(reqDTO.getProducerType());
|
||||
Long templateId = reqDTO.getTemplateId();
|
||||
// 校验模板
|
||||
ReportTemplateDO template = validateTemplateExists(templateId);
|
||||
String xmlContent = template.getContent();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
// 解析xml
|
||||
ReportDefinition reportDefinition = reportRender.getReportDefinition(xmlContent, CharsetUtil.UTF_8);
|
||||
// 查询数据源
|
||||
queryDatasource(template, reportDefinition);
|
||||
// 设置参数
|
||||
PreviewParameters previewParameters = new PreviewParameters();
|
||||
previewParameters.setQuery(reqDTO.getParams());
|
||||
|
||||
return reportRender.render(reportDefinition, previewParameters.getQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板生成文件类型校验
|
||||
*
|
||||
|
||||
-4
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.system.controller.admin.auth.vo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.validation.InEnum;
|
||||
import com.cf.imes.module.system.enums.social.SocialTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -33,9 +32,6 @@ public class AuthLoginReqVO {
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "组织名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰科技")
|
||||
private String organName;
|
||||
|
||||
// ========== 图片验证码相关 ==========
|
||||
|
||||
@Schema(description = "验证码,验证码开启时,需要传递", requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
|
||||
+6
@@ -1,22 +1,28 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.post;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Schema(description = "管理后台 - 岗位分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PostPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "岗位编码,模糊匹配", example = "chenfeng")
|
||||
@Size(max = 64, message = "岗位编码长度不能超过64个字符")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "岗位名称,模糊匹配", example = "晨丰")
|
||||
@Size(max = 50, message = "岗位名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
private Long organId;
|
||||
|
||||
+3
-3
@@ -1,7 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.post;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.validation.InEnum;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -31,10 +30,11 @@ public class PostSaveReqVO {
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "快乐的备注")
|
||||
@Size(max = 256, message = "备注长度不能超过256个字符")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import com.cf.imes.module.system.controller.admin.label.vo.LabelRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.label.vo.LabelSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.lable.LabelDO;
|
||||
import com.cf.imes.module.system.service.lable.LabelService;
|
||||
import com.cf.imes.module.system.validation.label.LabelTemplateTypeValid;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -87,7 +88,7 @@ public class LabelController {
|
||||
@Parameter(name = "type", description = "类型", required = false, example = "1024")
|
||||
//@PreAuthorize("@ss.hasPermission('system:label:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<List<LabelRespVO>> getList(@RequestParam("type") String type) {
|
||||
public CommonResult<List<LabelRespVO>> getList(@RequestParam("type") @LabelTemplateTypeValid String type) {
|
||||
return success(BeanUtils.toBean(labelService.list(type), LabelRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -18,12 +19,15 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class LabelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "标签类型", example = "2")
|
||||
@Size(max = 32, message = "标签类型长度不能超过32个字符")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标签名称", example = "王五")
|
||||
@Size(max = 50, message = "标签名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
|
||||
+4
-2
@@ -1,12 +1,11 @@
|
||||
package com.cf.imes.module.system.controller.admin.label.vo;
|
||||
|
||||
import co.elastic.clients.elasticsearch.watcher.DeactivateWatchRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Schema(description = "管理后台 - 标签模板新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -17,14 +16,17 @@ public class LabelSaveReqVO {
|
||||
|
||||
@Schema(description = "标签类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "标签类型不能为空")
|
||||
@Size(max = 32, message = "标签类型长度不能超过32个字符")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标签名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "标签名称不能为空")
|
||||
@Size(max = 50, message = "标签名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
import com.cf.imes.module.system.service.machine.MachineService;
|
||||
import com.cf.imes.module.system.service.machine.MachineTemplateService;
|
||||
import com.cf.imes.module.system.validation.machine.MachineTypeValid;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -119,7 +120,7 @@ public class MachineController {
|
||||
@GetMapping("getBrandAndModel")
|
||||
@Operation(summary = "获得机台的品牌跟型号")
|
||||
//@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||
public CommonResult<List<MachineBrandModelRespVO>> getBrandAndModel(@RequestParam Integer type) {
|
||||
public CommonResult<List<MachineBrandModelRespVO>> getBrandAndModel(@RequestParam @MachineTypeValid Integer type) {
|
||||
return success(machineService.getBrandAndModel(type));
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -1,12 +1,15 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.es.core.valid.CreateGroup;
|
||||
import com.cf.imes.framework.es.core.valid.UpdateGroup;
|
||||
import com.cf.imes.module.system.validation.machine.MachineTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -21,13 +24,16 @@ public class CuttingSaveReqVO {
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
@Size(max = 100, message = "名称长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "1开料机台设备 2钻孔机台设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "1开料机台设备 2钻孔机台设备 不能为空")
|
||||
@MachineTypeValid
|
||||
private Integer machineType;
|
||||
|
||||
@Schema(description = "标签id")
|
||||
@NotNull(message = "标签id不能空")
|
||||
private Long labelId;
|
||||
|
||||
// // 新的机台逻辑需要删除
|
||||
@@ -36,6 +42,7 @@ public class CuttingSaveReqVO {
|
||||
// private Long templateId;
|
||||
|
||||
@Schema(description = "品牌ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "品牌ID不能为空")
|
||||
private Long brandId;
|
||||
|
||||
|
||||
@@ -47,6 +54,7 @@ public class CuttingSaveReqVO {
|
||||
|
||||
|
||||
@Schema(description = "机台的型号-机台的ID")
|
||||
@NotNull(message = "机台型号不能为空",groups = CreateGroup.class)
|
||||
private Long machineId;
|
||||
|
||||
|
||||
|
||||
+7
-2
@@ -2,11 +2,13 @@ package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.es.core.valid.UpdateGroup;
|
||||
import com.cf.imes.module.system.validation.machine.MachineTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -19,18 +21,21 @@ public class CuttingTemplateSaveReqVO {
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
@Size(max = 100, message = "名称长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "1开料机台设备 2钻孔机台设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "1开料机台设备 2钻孔机台设备 不能为空")
|
||||
@MachineTypeValid
|
||||
private Integer machineType;
|
||||
|
||||
|
||||
@Schema(description = "当前品牌ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "当前品牌ID不能为空")
|
||||
private Long nowBrandId;
|
||||
|
||||
|
||||
@Schema(description = "引用的品牌ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@Schema(description = "引用的品牌ID", example = "2")
|
||||
private Long brandId;
|
||||
|
||||
|
||||
@@ -50,7 +55,7 @@ public class CuttingTemplateSaveReqVO {
|
||||
// private String model;
|
||||
|
||||
|
||||
@Schema(description = "机台的型号-机台ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@Schema(description = "机台的型号-机台ID", example = "2")
|
||||
private Long machineId;
|
||||
|
||||
|
||||
|
||||
+8
@@ -3,6 +3,8 @@ package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author Beal
|
||||
*/
|
||||
@@ -10,26 +12,32 @@ import lombok.Data;
|
||||
public class MachineOrgAuthReq {
|
||||
|
||||
@Schema(description = "组织id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "组织id不能为空")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "开料机授权数量")
|
||||
@NotNull(message = "开料机授权数量不能为空")
|
||||
private Integer cutLimit;
|
||||
|
||||
|
||||
@Schema(description = "钻孔机授权数量")
|
||||
@NotNull(message = "钻孔机授权数量不能为空")
|
||||
private Integer drillLimit;
|
||||
|
||||
|
||||
@Schema(description = "贴标机授权数量")
|
||||
@NotNull(message = "贴标机授权数量不能为空")
|
||||
private Integer labelLimit;
|
||||
|
||||
|
||||
@Schema(description = "裁板锯授权数量")
|
||||
@NotNull(message = "裁板锯授权数量不能为空")
|
||||
private Integer sawLimit;
|
||||
|
||||
|
||||
@Schema(description = "封边机授权数量")
|
||||
@NotNull(message = "封边机授权数量不能为空")
|
||||
private Integer sealedgeLimit;
|
||||
|
||||
|
||||
|
||||
+5
-1
@@ -1,10 +1,12 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.cf.imes.module.system.validation.machine.MachineTypeValid;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -16,9 +18,11 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class MachinePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "名称", example = "王五")
|
||||
@Size(max = 100, message = "名称长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "1机台设备 2CNC设备", example = "2")
|
||||
@MachineTypeValid
|
||||
private Integer machineType;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
|
||||
+4
@@ -1,10 +1,12 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.validation.machine.MachineTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -16,6 +18,7 @@ public class MachineTemplateBrandReqVO {
|
||||
|
||||
@Schema(description = "1开料机台设备 2钻孔机台设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "1开料机台设备 2钻孔机台设备 不能为空")
|
||||
@MachineTypeValid
|
||||
private Integer machineType;
|
||||
|
||||
@Schema(description = "机台的品牌ID")
|
||||
@@ -24,6 +27,7 @@ public class MachineTemplateBrandReqVO {
|
||||
|
||||
@Schema(description = "机台的品牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "品牌名称不能为空")
|
||||
@Size(max = 64, message = "品牌名称长度不能超过64个字符")
|
||||
private String brand;
|
||||
|
||||
|
||||
|
||||
+3
-1
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -10,10 +11,11 @@ import lombok.Data;
|
||||
@Data
|
||||
public class OrganMachinePage extends PageParam {
|
||||
|
||||
@Schema(description = "组织名称")
|
||||
@Schema(description = "组织编号")
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "组织状态(0正常 1停用)")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -9,7 +9,6 @@ import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
||||
import com.cf.imes.module.system.api.logger.dto.LoginLogCreateReqDTO;
|
||||
import com.cf.imes.module.system.api.sms.SmsCodeApi;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import com.cf.imes.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import com.cf.imes.module.system.api.social.dto.SocialUserRespDTO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
@@ -105,8 +104,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 校验机构有效性
|
||||
organService.validOrgan(user.getOrganId());
|
||||
// 校验密码
|
||||
String userPassword = user.getPassword();
|
||||
if (StringUtils.isNotEmpty(userPassword) && !userService.isPasswordMatch(password, userPassword)) {
|
||||
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
||||
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
|
||||
}
|
||||
|
||||
+24
-4
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.service.machine;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
@@ -148,7 +149,11 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
// MachineBrandDO machineBrandDO = machineBrandMapper.selectById(reqVO.getId());
|
||||
|
||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectByBrand(reqVO.getId());
|
||||
Long brandId = reqVO.getId();
|
||||
// 校验品牌是否存在
|
||||
validateBrandExistes(brandId);
|
||||
|
||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectByBrand(brandId);
|
||||
|
||||
if (!machineTemplateDOS.isEmpty()) {
|
||||
// throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
@@ -160,7 +165,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
}
|
||||
|
||||
|
||||
machineBrandMapper.deleteById(reqVO.getId());
|
||||
machineBrandMapper.deleteById(brandId);
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
@@ -281,8 +286,8 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
public void updateMachineTemplateBrand(MachineTemplateBrandReqVO reqVO) {
|
||||
|
||||
// MachineBrandDO machineBrandDO = machineBrandMapper.selectBrand(reqVO.getBrand(), reqVO.getMachineType());
|
||||
|
||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(reqVO.getId());
|
||||
// 校验机台品牌是否存在
|
||||
MachineBrandDO machineBrandDO = validateBrandExistes(reqVO.getId());
|
||||
|
||||
machineBrandDO.setBrand(reqVO.getBrand());
|
||||
|
||||
@@ -291,6 +296,21 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验机台品牌是否存在
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private MachineBrandDO validateBrandExistes(Long id) {
|
||||
MachineBrandDO machineBrandDO = machineBrandMapper.selectById(id);
|
||||
if (ObjectUtil.isNull(machineBrandDO)) {
|
||||
throw exception(THE_CURRENT_BRAND);
|
||||
}
|
||||
return machineBrandDO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TemplateAutoResp getTemplateAuth(Long organId) {
|
||||
|
||||
|
||||
+3
-3
@@ -60,9 +60,6 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
public void sendSmsCode(SmsCodeSendReqDTO reqDTO) {
|
||||
AdminUserDO user = userService.getUserByUsernameAndOrganId(reqDTO.getMobile(), null);
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new ServiceException(GlobalErrorCodeConstants.UNAUTHORIZED);
|
||||
}
|
||||
// 更新手机号场景检查
|
||||
if (ObjectUtil.equal(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) {
|
||||
userUpdateMobileValid(user, loginUser);
|
||||
@@ -89,6 +86,9 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
* @param loginUser
|
||||
*/
|
||||
private void userUpdateMobileValid(AdminUserDO user, LoginUser loginUser) {
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new ServiceException(GlobalErrorCodeConstants.UNAUTHORIZED);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
if (ObjectUtil.equal(user.getId(), loginUser.getId())) {
|
||||
// 手机号没有改变无需验证码
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.system.validation.machine;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 机台类型校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/16 10:20
|
||||
*/
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
ElementType.FIELD,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {MachineTypeValidator.class}
|
||||
)
|
||||
public @interface MachineTypeValid {
|
||||
String message() default "机台类型类型不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.system.validation.machine;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 机台类型校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/16 10:21
|
||||
*/
|
||||
public class MachineTypeValidator implements ConstraintValidator<MachineTypeValid, Integer> {
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (MachineTypeEnum typeEnum : MachineTypeEnum.values()) {
|
||||
if (ObjectUtil.equal(typeEnum.getType(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user