mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
@@ -7,6 +7,11 @@ spring:
|
||||
|
||||
server:
|
||||
port: 48080
|
||||
# 开启Gzip压缩,默认只压缩超过2048字节的数据
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 2048
|
||||
mime-types: application/json
|
||||
|
||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
||||
logging:
|
||||
|
||||
+3
-3
@@ -34,9 +34,9 @@ public class PlanRespVO {
|
||||
@ExcelProperty("排单状态:0 新单,1 板材已申请,2 开料中,3 已开料")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否支付:0 否,1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否支付:0 否,1 是")
|
||||
private Boolean isPay;
|
||||
// @Schema(description = "是否支付:0 否,1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// @ExcelProperty("是否支付:0 否,1 是")
|
||||
// private Boolean isPay;
|
||||
|
||||
@Schema(description = "机台 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16707")
|
||||
@ExcelProperty("机台 ID")
|
||||
|
||||
+12
-12
@@ -49,10 +49,10 @@ public class PlanDO extends BaseDO {
|
||||
* 排单状态:0 新单,1 板材已申请,2 开料中,3 已开料
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 是否支付:0 否,1 是
|
||||
*/
|
||||
private Boolean isPay;
|
||||
// /**
|
||||
// * 是否支付:0 否,1 是
|
||||
// */
|
||||
// private Boolean isPay;
|
||||
/**
|
||||
* 机台 ID
|
||||
*/
|
||||
@@ -65,14 +65,14 @@ public class PlanDO extends BaseDO {
|
||||
* 生产单号
|
||||
*/
|
||||
private String orderNos;
|
||||
/**
|
||||
* 排单优化文件地址
|
||||
*/
|
||||
private String placeDateFileUrl;
|
||||
/**
|
||||
* 排单优化文件地址
|
||||
*/
|
||||
private String placeOrderFileUrl;
|
||||
// /**
|
||||
// * 排单优化文件地址
|
||||
// */
|
||||
// private String placeDateFileUrl;
|
||||
// /**
|
||||
// * 排单优化文件地址
|
||||
// */
|
||||
// private String placeOrderFileUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
+35
-34
@@ -165,40 +165,41 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
@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;
|
||||
return null;
|
||||
// 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
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
validatePlanExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanDO plan = BeanUtils.toBean(updateReqVO, PlanDO.class);
|
||||
plan.setIsPay(Boolean.FALSE);
|
||||
|
||||
planMapper.updateById(plan);
|
||||
|
||||
}
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.cf.imes.module.manage.api.pack.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单包裹信息")
|
||||
@Data
|
||||
public class PrintOrderPackReqVO {
|
||||
|
||||
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
|
||||
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String packNo;
|
||||
|
||||
|
||||
@Schema(description = "包裹ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long packId;
|
||||
|
||||
|
||||
@Schema(description = "包裹数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long packNum;
|
||||
|
||||
|
||||
}
|
||||
+3
@@ -27,6 +27,9 @@ public class OtherPackReqVO {
|
||||
private String name;
|
||||
|
||||
|
||||
@Schema(description = "配件数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
|
||||
private Double num;
|
||||
|
||||
@Schema(description = "包裹编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "9822")
|
||||
private String packNo;
|
||||
|
||||
|
||||
+3
-1
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@TableName("order_item")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@@ -44,7 +46,7 @@ public class OrderItemDO {
|
||||
private Long packageId;
|
||||
|
||||
// 部件数量
|
||||
private Float num;
|
||||
private Double num;
|
||||
|
||||
// 组织 ID
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum OrderPackStatusEnums {
|
||||
|
||||
|
||||
UNPACKAGED(0,"未打包"),
|
||||
INPACKAGING(1, "打包中"),
|
||||
PACKAGED(1, "打包完成");
|
||||
private Integer status;
|
||||
private String description;
|
||||
|
||||
|
||||
public boolean equals(Integer status) {
|
||||
return this.status .equals(status) ;
|
||||
}
|
||||
|
||||
public boolean equals(OrderPackStatusEnums enableStatusEnum) {
|
||||
return enableStatusEnum != null && enableStatusEnum.status .equals(this.getStatus()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+2
-8
@@ -565,7 +565,7 @@ public class PackServiceImpl implements PackService {
|
||||
orderItemDO.setOrderId(reqVO.getOrderId());
|
||||
orderItemDO.setPartsId(orderParts.getId());
|
||||
orderItemDO.setPackageId(orderPackageDO.getId());
|
||||
orderItemDO.setNum(Float.valueOf(1));
|
||||
orderItemDO.setNum(reqVO.getNum());
|
||||
|
||||
|
||||
// 在生产单明细表中新增数据
|
||||
@@ -591,12 +591,6 @@ public class PackServiceImpl implements PackService {
|
||||
throw exception(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT);
|
||||
}
|
||||
|
||||
// 判断配件名称是否重复
|
||||
OrderPartsNDO orderPartsNDO = orderPartsMapper.selectOneParts(reqVO.getName(),getUserOrganId());
|
||||
|
||||
if (orderPartsNDO != null) {
|
||||
throw exception(THE_ACCESSORY_NAME_CANNOT_BE_DUPLICATED);
|
||||
}
|
||||
|
||||
// 配件表新增数据
|
||||
OrderPartsNDO orderParts = BeanUtils.toBean(reqVO, OrderPartsNDO.class);
|
||||
@@ -609,7 +603,7 @@ public class PackServiceImpl implements PackService {
|
||||
orderItemDO.setOrderId(reqVO.getOrderId());
|
||||
orderItemDO.setPartsId(orderParts.getId());
|
||||
orderItemDO.setPackageId(orderPackageDO.getId());
|
||||
orderItemDO.setNum(Float.valueOf(1));
|
||||
orderItemDO.setNum(reqVO.getNum());
|
||||
|
||||
// 在生产单明细表中新增数据
|
||||
orderItemMapper.insert(orderItemDO);
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.cf.imes.module.manage.util;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class MinuteCounter {
|
||||
private static final int MASK = 0x7FFFFFFF;
|
||||
private final AtomicInteger atom;
|
||||
|
||||
public MinuteCounter() {
|
||||
atom = new AtomicInteger(0);
|
||||
}
|
||||
|
||||
public final int incrementAndGet() {
|
||||
return atom.incrementAndGet() & MASK;
|
||||
}
|
||||
|
||||
public int get() {
|
||||
return atom.get() & MASK;
|
||||
}
|
||||
|
||||
public void set(int newValue) {
|
||||
atom.set(newValue & MASK);
|
||||
}
|
||||
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.cf.imes.module.manage.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @ClassName: SnowflakeIdWorker3rd
|
||||
* @Description:snowflake算法改进
|
||||
* @author: yonnie
|
||||
* @date: 2024/06/18 14:10:47
|
||||
* @version V1.0
|
||||
*
|
||||
* 将产生的Id类型更改为Integer 32bit <br>
|
||||
* 把时间戳的单位改为分钟,使用25bit的时间戳
|
||||
* 7bit作为自增值即 2^7 = 128
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SnowflakeIdWorker3rd {
|
||||
/** 初始时间 (2024-01-01: 1704038400) */
|
||||
// private final int twepoch = 28400640;// 1704038400000L/1000/60;
|
||||
private final int twepoch = 1704038400;
|
||||
/** 序列在id中占位数 */
|
||||
private final long sequenceBits = 7L;
|
||||
/** 时间截向左移7bit */
|
||||
private final long timestampLeftShift = sequenceBits;
|
||||
/** 生成序列的MASK (0x7F) */
|
||||
private final int sequenceMask = -1 ^ (-1 << sequenceBits);
|
||||
/** 分钟内序 (0~127) */
|
||||
private int sequence = 0;
|
||||
private int laterSequence = 0;
|
||||
/** 上次生成ID的时间戳 */
|
||||
private int lastTimestamp = -1;
|
||||
private final MinuteCounter counter = new MinuteCounter();
|
||||
/** 预支时间标志 */
|
||||
boolean isAdvance = false;
|
||||
|
||||
// ==============================Constructors=====================================
|
||||
|
||||
public SnowflakeIdWorker3rd() {
|
||||
}
|
||||
|
||||
// ==============================Test=============================================
|
||||
|
||||
/** 测试 */
|
||||
public static void main(String[] args) {
|
||||
SnowflakeIdWorker3rd idWorker = new SnowflakeIdWorker3rd();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
long id = idWorker.nextId();
|
||||
System.out.println(i + ": " + id + " " + "2406" + Long.toString(id).substring(2));
|
||||
}
|
||||
// long id = idWorker.nextId();
|
||||
// System.out.println(id);
|
||||
}
|
||||
|
||||
// ==============================Methods==========================================
|
||||
/**
|
||||
* 获取当前年月
|
||||
* @return null
|
||||
*/
|
||||
public static int obtainingTime() {
|
||||
LocalDate now = LocalDate.now();
|
||||
int year = now.getYear();
|
||||
String year_last_two_digits = String.valueOf(year).substring(2);
|
||||
int month = now.getMonthValue();
|
||||
String formatted_date = year_last_two_digits + String.format("%02d", month);
|
||||
return Integer.parseInt(formatted_date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得下一个ID (该方法是线程安全)
|
||||
*
|
||||
* @return SnowflakeId
|
||||
*/
|
||||
public synchronized int nextId() {
|
||||
int timestamp = timeGen();
|
||||
// 如果当前时间小于上一次ID生成的时间戳,说明系统时钟修改过
|
||||
if (timestamp < lastTimestamp) {
|
||||
throw new RuntimeException(String.format(
|
||||
"Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
|
||||
}
|
||||
|
||||
if (timestamp > counter.get()) {
|
||||
counter.set(timestamp);
|
||||
isAdvance = false;
|
||||
}
|
||||
|
||||
// 如果是同时间生成的,则进行分钟内序列
|
||||
if (lastTimestamp == timestamp || isAdvance) {
|
||||
if (!isAdvance) {
|
||||
sequence = (sequence + 1) & sequenceMask;
|
||||
}
|
||||
|
||||
// 分钟内自增列溢出
|
||||
if (sequence == 0) {
|
||||
// 预支下一分获得新的时间戳
|
||||
isAdvance = true;
|
||||
int laterTimestamp = counter.get();
|
||||
if (laterSequence == 0) {
|
||||
laterTimestamp = counter.incrementAndGet();
|
||||
}
|
||||
int nextId = ((laterTimestamp - twepoch) << timestampLeftShift) | laterSequence;
|
||||
laterSequence = (laterSequence + 1) & sequenceMask;
|
||||
return nextId;
|
||||
}
|
||||
} else { // 时间戳改变,分钟内序列置0
|
||||
sequence = 0;
|
||||
laterSequence = 0;
|
||||
}
|
||||
// 上次生成ID的时间截
|
||||
lastTimestamp = timestamp;
|
||||
// 移位并或运算拼成32位的ID
|
||||
return ((timestamp - twepoch) << timestampLeftShift) | sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回以分钟为单位的当前时
|
||||
*
|
||||
* @return 当前时间(分钟)
|
||||
*/
|
||||
protected int timeGen() {
|
||||
// String timestamp = String.valueOf(System.currentTimeMillis() / 1000 / 60);
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return Integer.valueOf(timestamp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,6 +110,26 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/src/main/resources/lib/ureport-core-2.3.0-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>${dom4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<version>${antlr4.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>${commons-text.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
|
||||
+3
@@ -29,6 +29,9 @@ public class ReportDatasetRespVO {
|
||||
@Schema(description = "动态查询SQL")
|
||||
private String sql;
|
||||
|
||||
@Schema(description = "bean数据源方法名")
|
||||
private String method;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
+12
-4
@@ -1,11 +1,13 @@
|
||||
package com.cf.imes.module.report.controller.admin.template;
|
||||
|
||||
import com.bstek.designer.bean.ReportDefinitionWrapper;
|
||||
import com.bstek.ureport.export.html.HtmlReport;
|
||||
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.template.vo.ReportTemplatePreviewPageParametersVO;
|
||||
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;
|
||||
import com.cf.imes.module.report.dal.dataobject.template.ReportTemplateDO;
|
||||
import com.cf.imes.module.report.service.template.ReportTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -63,9 +65,8 @@ public class ReportTemplateController {
|
||||
@Operation(summary = "获得报表模板信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('report:template:query')")
|
||||
public CommonResult<ReportTemplateRespVO> getReportTemplate(@PathVariable("id") Long id) {
|
||||
ReportTemplateDO template = templateService.getReportTemplate(id);
|
||||
return success(BeanUtils.toBean(template, ReportTemplateRespVO.class));
|
||||
public CommonResult<ReportDefinitionWrapper> getReportTemplate(@PathVariable("id") Long id) {
|
||||
return success(templateService.getReportTemplateDefinition(id));
|
||||
}
|
||||
|
||||
@GetMapping("/templates")
|
||||
@@ -75,4 +76,11 @@ public class ReportTemplateController {
|
||||
ReportTemplateReqVO reqVO = new ReportTemplateReqVO(name, null);
|
||||
return success(BeanUtils.toBean(templateService.getReportTemplateList(reqVO), ReportTemplateRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/template/preview")
|
||||
@Operation(summary = "模板预览")
|
||||
@PreAuthorize("@ss.hasPermission('report:template:query')")
|
||||
public CommonResult<HtmlReport> preview(@Valid @RequestBody ReportTemplatePreviewPageParametersVO pageParametersVO) {
|
||||
return success(templateService.preview(pageParametersVO));
|
||||
}
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
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
@@ -0,0 +1,48 @@
|
||||
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<>();
|
||||
|
||||
}
|
||||
+5
@@ -46,6 +46,11 @@ public class ReportDatasetDO extends BaseDO {
|
||||
* 数据源id
|
||||
*/
|
||||
private Long datasourceId;
|
||||
|
||||
/**
|
||||
* bean数据源方法名
|
||||
*/
|
||||
private String method;
|
||||
/**
|
||||
* 动态查询SQL
|
||||
*/
|
||||
|
||||
+20
-1
@@ -1,5 +1,8 @@
|
||||
package com.cf.imes.module.report.service.template;
|
||||
|
||||
import com.bstek.designer.bean.ReportDefinitionWrapper;
|
||||
import com.bstek.ureport.export.html.HtmlReport;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewPageParametersVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateSaveReqVO;
|
||||
import com.cf.imes.module.report.dal.dataobject.template.ReportTemplateDO;
|
||||
@@ -37,13 +40,21 @@ public interface ReportTemplateService {
|
||||
void deleteReportTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得报表模板信息
|
||||
* 获取报表模板信息
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 报表模板信息
|
||||
*/
|
||||
ReportTemplateDO getReportTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获取模板定义信息(xml+数据源)
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ReportDefinitionWrapper getReportTemplateDefinition(Long id);
|
||||
|
||||
/**
|
||||
* 获得报表模板信息列表
|
||||
*
|
||||
@@ -51,4 +62,12 @@ public interface ReportTemplateService {
|
||||
* @return 报表模板信息列表
|
||||
*/
|
||||
List<ReportTemplateDO> getReportTemplateList(ReportTemplateReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 模板预览
|
||||
*
|
||||
* @param pageParametersVO
|
||||
* @return
|
||||
*/
|
||||
HtmlReport preview(ReportTemplatePreviewPageParametersVO pageParametersVO);
|
||||
}
|
||||
|
||||
+109
@@ -1,14 +1,36 @@
|
||||
package com.cf.imes.module.report.service.template;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import com.bstek.designer.bean.PreviewPageParameters;
|
||||
import com.bstek.designer.bean.PreviewParameters;
|
||||
import com.bstek.designer.bean.ReportDefinitionWrapper;
|
||||
import com.bstek.ureport.build.paging.Page;
|
||||
import com.bstek.ureport.definition.Paper;
|
||||
import com.bstek.ureport.definition.ReportDefinition;
|
||||
import com.bstek.ureport.definition.dataset.BeanDatasetDefinition;
|
||||
import com.bstek.ureport.definition.dataset.DatasetDefinition;
|
||||
import com.bstek.ureport.definition.dataset.SqlDatasetDefinition;
|
||||
import com.bstek.ureport.definition.datasource.DatasourceDefinition;
|
||||
import com.bstek.ureport.definition.datasource.JdbcDatasourceDefinition;
|
||||
import com.bstek.ureport.definition.datasource.SpringBeanDatasourceDefinition;
|
||||
import com.bstek.ureport.export.PageBuilder;
|
||||
import com.bstek.ureport.export.ReportRender;
|
||||
import com.bstek.ureport.export.SinglePageData;
|
||||
import com.bstek.ureport.export.html.HtmlProducer;
|
||||
import com.bstek.ureport.export.html.HtmlReport;
|
||||
import com.bstek.ureport.export.html.SearchFormData;
|
||||
import com.bstek.ureport.model.Report;
|
||||
import com.bstek.ureport.parser.ReportParser;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.report.controller.admin.dataset.vo.ReportDatasetReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.dataset.vo.ReportDatasetSaveReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportDatasourceReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.datasource.vo.ReportDatasourceSaveReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewPageParametersVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateSaveReqVO;
|
||||
import com.cf.imes.module.report.dal.dataobject.dataset.ReportDatasetDO;
|
||||
@@ -24,8 +46,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
@@ -160,6 +185,43 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportDefinitionWrapper getReportTemplateDefinition(Long id) {
|
||||
// 查询模板
|
||||
ReportTemplateDO template = templateMapper.selectById(id);
|
||||
String xmlContent = template.getContent();
|
||||
// 解析xml
|
||||
ReportDefinition reportDefinition = new ReportParser().parse(new ByteArrayInputStream(xmlContent.getBytes()), template.getName());
|
||||
List<DatasourceDefinition> datasourceDefinitions = new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(template)) {
|
||||
// 查询数据源
|
||||
List<ReportDatasourceDO> datasourceList = datasourceService.getTemplateDatasourceList(ReportDatasourceReqVO.builder().templateId(template.getId()).build());
|
||||
for (ReportDatasourceDO ds : datasourceList) {
|
||||
// 查询数据集
|
||||
List<ReportDatasetDO> datasetList = datasetService.getDatasetList(ReportDatasetReqVO.builder().datasourceId(ds.getId()).build());
|
||||
List<DatasetDefinition> datasetDefinitions = new ArrayList<>();
|
||||
switch (ds.getType()) {
|
||||
case JDBC, BUILDIN -> {
|
||||
// 转换对应的ureport对象
|
||||
JdbcDatasourceDefinition jdbcDatasourceDefinition = BeanUtils.toBean(ds, JdbcDatasourceDefinition.class);
|
||||
datasetDefinitions.addAll(BeanUtils.toBean(datasetList, SqlDatasetDefinition.class));
|
||||
jdbcDatasourceDefinition.setDatasets(datasetDefinitions);
|
||||
datasourceDefinitions.add(jdbcDatasourceDefinition);
|
||||
}
|
||||
case SPRING -> {
|
||||
// 转换对应的ureport对象
|
||||
SpringBeanDatasourceDefinition springBeanDatasourceDefinition = BeanUtils.toBean(ds, SpringBeanDatasourceDefinition.class);
|
||||
datasetDefinitions.addAll(BeanUtils.toBean(datasetList, BeanDatasetDefinition.class));
|
||||
springBeanDatasourceDefinition.setDatasets(datasetDefinitions);
|
||||
datasourceDefinitions.add(springBeanDatasourceDefinition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
reportDefinition.setDatasources(datasourceDefinitions);
|
||||
return new ReportDefinitionWrapper(reportDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportTemplateDO> getReportTemplateList(ReportTemplateReqVO reqVO) {
|
||||
return templateMapper.selectList(new LambdaQueryWrapperX<ReportTemplateDO>()
|
||||
@@ -169,4 +231,51 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
// 不返回content xml,点击具体的模板中返回xml
|
||||
.select(ReportTemplateDO::getId, ReportTemplateDO::getName, ReportTemplateDO::getCreateTime, ReportTemplateDO::getRemark));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HtmlReport preview(ReportTemplatePreviewPageParametersVO pageParametersVO) {
|
||||
HtmlProducer htmlProducer = new HtmlProducer();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
HtmlReport htmlReport = new HtmlReport();
|
||||
|
||||
// 转换ureport参数
|
||||
PreviewPageParameters pageParameters = BeanUtils.toBean(pageParametersVO,PreviewPageParameters.class);
|
||||
PreviewParameters params = pageParameters.getParams();
|
||||
|
||||
// 解析xml
|
||||
ReportDefinition reportDefinition = reportRender.getReportDefinition(URLUtil.decode(params.getContent()), CharsetUtil.UTF_8);
|
||||
|
||||
Map<String, Object> parameters = params.getQuery();
|
||||
|
||||
Paper paper = reportDefinition.getPaper();
|
||||
Report report;
|
||||
String html;
|
||||
// 构建html
|
||||
if (paper.isPageEnabled()) {
|
||||
// todo 后续有可能做成缓存
|
||||
report = reportRender.render(reportDefinition, parameters);
|
||||
int pageIndex = pageParameters.getPageIndex();
|
||||
SinglePageData pageData = PageBuilder.buildSinglePageData(pageIndex, report);
|
||||
List<Page> pages = pageData.getPages();
|
||||
html = htmlProducer.produce(report.getContext(), pages, pageData.getColumnMargin(), false);
|
||||
htmlReport.setTotalPage(pageData.getTotalPages());
|
||||
htmlReport.setPageIndex(pageIndex);
|
||||
if (reportDefinition.getPaper().isColumnEnabled()) {
|
||||
htmlReport.setColumn(reportDefinition.getPaper().getColumnCount());
|
||||
}
|
||||
} else {
|
||||
report = reportRender.render(reportDefinition, parameters);
|
||||
html = htmlProducer.produce(report);
|
||||
}
|
||||
htmlReport.setChartDatas(report.getContext().getChartDataMap().values());
|
||||
htmlReport.setContent(html);
|
||||
htmlReport.setStyle(reportDefinition.getStyle());
|
||||
SearchFormData searchFormData = reportDefinition.buildSearchFormData(report.getContext().getDatasetMap(),parameters);
|
||||
htmlReport.setSearchFormData(searchFormData);
|
||||
htmlReport.setReportAlign(report.getPaper().getHtmlReportAlign().name());
|
||||
htmlReport.setBgImage(report.getPaper().getBgImage());
|
||||
htmlReport.setFreeze(reportDefinition.getFreeze());
|
||||
htmlReport.setFloatImages(reportDefinition.getFloatImages());
|
||||
return htmlReport;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Binary file not shown.
@@ -20,4 +20,11 @@
|
||||
report 模块,主要实现数据可视化报表等功能。
|
||||
</description>
|
||||
|
||||
|
||||
<properties>
|
||||
<dom4j.version>1.6.1</dom4j.version>
|
||||
<commons-io.version>2.11.0</commons-io.version>
|
||||
<antlr4.version>4.5.3</antlr4.version>
|
||||
<commons-text.version>1.10.0</commons-text.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
+5
@@ -266,6 +266,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode THE_CURRENT_PACKAGE_HAS_AN_UNSEALED_PACKAGE = new ErrorCode(1_002_038_666, "当前包裹还有未封包包裹");
|
||||
ErrorCode THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT = new ErrorCode(1_002_038_777, "当前包裹类型错误");
|
||||
ErrorCode FAILED_TO_MODIFY_THE_STATUS_OF_THE_CURRENT_PRODUCTION_ORDER = new ErrorCode(1_002_038_778, "修改当前生产单的工序状态和生产单的状态失败");
|
||||
ErrorCode NO_OPTIMIZATION_INFORMATION_AVAILABLE = new ErrorCode(1_002_038_779, "当前订单无优化信息");
|
||||
|
||||
|
||||
//=========== 应用信息 1-002-037-000 ============
|
||||
@@ -278,4 +279,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_002, "余料板未使用");
|
||||
ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_003, "余料板使用类型为不可核销类型");
|
||||
ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_004, "未选中余料板,请选择余料板");
|
||||
|
||||
|
||||
//=========== 用户的系统配置 1-002-039-000 ============
|
||||
ErrorCode CURRENTLY_NO_CONFIGURATION_AVAILABLE = new ErrorCode(1_002_039_001, "当前没有配置信息,请前往设置配置");
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,6 +24,6 @@ public class DataSourceApiImpl implements DataSourceApi {
|
||||
if(Objects.isNull(dataSourceDO)) {
|
||||
throw exception(new ErrorCode(2133,"数据源不存在"));
|
||||
}
|
||||
return CommonResult.success(dataSourceDO.getSqlStr()) ;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.cf.imes.module.system.controller.admin.setting;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
import com.cf.imes.module.system.service.setting.SettingService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 系统配置")
|
||||
@RestController
|
||||
@RequestMapping("/system/setting")
|
||||
@Validated
|
||||
public class SettingController {
|
||||
|
||||
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
|
||||
|
||||
|
||||
@PutMapping("/insert")
|
||||
@Operation(summary = "新增系统配置")
|
||||
//@PreAuthorize("@ss.hasPermission('system:data-source:query')")
|
||||
public CommonResult<Long> insertSetting( @RequestBody PackageConfigReqVO reqVO ) {
|
||||
|
||||
return success(settingService.insertSetting(reqVO));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "更新系统配置")
|
||||
//@PreAuthorize("@ss.hasPermission('system:data-source:query')")
|
||||
public CommonResult<Long> updateSetting( @RequestBody PackageConfigReqVO reqVO ) {
|
||||
|
||||
return success(settingService.updateSetting(reqVO));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/select")
|
||||
@Operation(summary = "查看当前用户的配置信息")
|
||||
@Parameter(name = "type", description = "配置类型", required = true)
|
||||
public CommonResult<PackageConfigReqVO> selectSetting( @RequestParam("type") Integer type ) {
|
||||
|
||||
return success(settingService.selectSetting(type));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.system.controller.admin.setting.vo;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.framework.es.core.valid.UpdateGroup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "打包配置信息")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class PackageConfigReqVO {
|
||||
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Schema(description = "配置类型: 1 预打包,2 打包", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer type;
|
||||
|
||||
|
||||
@Schema(description = "配置信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private JSONObject setting;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.cf.imes.module.system.dal.dataobject.setting;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
|
||||
@TableName(value = "package_config")
|
||||
@KeySequence("package_config_seq")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PackageConfigDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
// 组织 ID,默认为1
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long organId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 配置类型: 1 预打包,2 打包
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
|
||||
/**
|
||||
* 配置信息
|
||||
*/
|
||||
private String setting;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.cf.imes.module.system.dal.mysql.setting;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.MachinePageReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.setting.PackageConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SettingMapper extends BaseMapperX<PackageConfigDO> {
|
||||
|
||||
|
||||
|
||||
default PackageConfigDO selectSetting(Integer type, Long id, Long organId) {
|
||||
return selectOne( new LambdaQueryWrapperX<PackageConfigDO>()
|
||||
.eqIfPresent(PackageConfigDO::getOrganId,organId)
|
||||
.eqIfPresent(PackageConfigDO::getUserId,id)
|
||||
.eqIfPresent(PackageConfigDO::getType,type));
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.cf.imes.module.system.service.setting;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
public interface SettingService {
|
||||
|
||||
|
||||
|
||||
Long insertSetting(PackageConfigReqVO reqVO);
|
||||
|
||||
Long updateSetting(PackageConfigReqVO reqVO);
|
||||
|
||||
PackageConfigReqVO selectSetting(Integer type);
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.cf.imes.module.system.service.setting;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.setting.PackageConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.setting.SettingMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class SettingServiceImpl implements SettingService{
|
||||
|
||||
|
||||
@Resource
|
||||
private SettingMapper settingMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertSetting(PackageConfigReqVO reqVO) {
|
||||
|
||||
LoginUser loginUser = getLoginUser();
|
||||
PackageConfigDO packageConfigDO = PackageConfigDO.builder()
|
||||
.userId(loginUser.getId())
|
||||
.organId(loginUser.getOrganId())
|
||||
.setting(JsonUtils.zipString(reqVO.getSetting().toJSONString()))
|
||||
.type(reqVO.getType())
|
||||
.build();
|
||||
|
||||
settingMapper.insert(packageConfigDO);
|
||||
|
||||
|
||||
return packageConfigDO.getId();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long updateSetting(PackageConfigReqVO reqVO) {
|
||||
|
||||
// 更新
|
||||
PackageConfigDO packageConfigDO = settingMapper.selectById(reqVO.getId());
|
||||
if (packageConfigDO == null) {
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE);
|
||||
}
|
||||
if(reqVO.getSetting() != null) {
|
||||
packageConfigDO.setSetting(JsonUtils.zipString(reqVO.getSetting().toJSONString()));
|
||||
}
|
||||
settingMapper.updateById(packageConfigDO);
|
||||
|
||||
return packageConfigDO.getId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PackageConfigReqVO selectSetting(Integer type) {
|
||||
|
||||
LoginUser loginUser = getLoginUser();
|
||||
|
||||
PackageConfigDO packageConfigDO = settingMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId());
|
||||
|
||||
if (packageConfigDO == null) {
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE);
|
||||
}
|
||||
|
||||
packageConfigDO.setSetting(JsonUtils.unzipString(packageConfigDO.getSetting()));
|
||||
|
||||
return BeanUtils.toBean(packageConfigDO,PackageConfigReqVO.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user