demo测试模块类初始化v1

ccongli-dev-0821
LI-CCONG\李聪聪 1 year ago
commit 3f7b71623b

10
node_modules/.yarn-integrity generated vendored

@ -1,10 +0,0 @@
{
"systemParams": "win32-x64-93",
"modulesFolders": [],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}

@ -1,11 +1,11 @@
package com.yunxi.scm.framework.excel.core.convert;
import com.yunxi.scm.framework.common.util.json.JsonUtils;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.yunxi.scm.framework.common.util.json.JsonUtils;
/**
* Excel Json
@ -16,11 +16,13 @@ public class JsonConvert implements Converter<Object> {
@Override
public Class<?> supportJavaTypeKey() {
throw new UnsupportedOperationException("暂不支持,也不需要");
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
throw new UnsupportedOperationException("暂不支持,也不需要");
}

@ -0,0 +1,81 @@
package com.yunxi.scm.framework.excel.core.convert;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.yunxi.scm.framework.dict.core.util.DictFrameworkUtils;
import com.yunxi.scm.framework.excel.core.annotations.DictFormat;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class MutilDictConvert implements Converter<List<String>> {
// 分隔符
private static final String COMMA = ",";
// 指定转化参数的Java类型
@Override
public Class<?> supportJavaTypeKey() {
return List.class;
}
// 指定转化参数对应的单元格类型
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public List<String> convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
// 使用字典解析
String type = getType(contentProperty);
String strings = readCellData.getStringValue();
// Class<?> fieldClazz = contentProperty.getField().getType(); // 获取被注解的字段类型
List<String> labels = StrUtil.splitTrim(strings, COMMA);
List<String> values = new ArrayList<>();
for(String label : labels) {
String value = DictFrameworkUtils.parseDictDataValue(type, label);
if (value == null) {
log.error("[convertToJavaData][type({}) 解析不掉 label({})]", type, label);
return null;
}
values.add(value);
}
// return Convert.convert(fieldClazz, value); // 类型转换
return values;
}
@Override
public WriteCellData<String> convertToExcelData(List<String> values, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
// 空时,返回空
if (values == null || values.isEmpty()) {
return new WriteCellData<>("");
}
// 使用字典格式化
String type = getType(contentProperty);
List<String> labels = new ArrayList<>();
for(String value : values) {
String label = DictFrameworkUtils.getDictDataLabel(type, value);
if (label == null) {
log.error("[convertToExcelData][type({}) 转换不了 label({})]", type, value);
} else {
labels.add(label);
}
}
// 生成 Excel 小表格
return new WriteCellData<>(CollUtil.join(labels, COMMA));
}
private static String getType(ExcelContentProperty contentProperty) {
return contentProperty.getField().getAnnotation(DictFormat.class).value();
}
}

@ -67,6 +67,7 @@ public class EncryptTypeHandler extends BaseTypeHandler<String> {
}
// 构建 AES
String password = SpringUtil.getProperty(ENCRYPTOR_PROPERTY_NAME);
// String password = Optional.ofNullable(SpringUtil.getProperty(ENCRYPTOR_PROPERTY_NAME)).orElse("X+aZvWkl9jtRP9b2");
Assert.notEmpty(password, "配置项({}) 不能为空", ENCRYPTOR_PROPERTY_NAME);
aes = SecureUtil.aes(password.getBytes());
return aes;

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yunxi-module-demo</artifactId>
<groupId>com.yunxi.scm</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yunxi-module-demo-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
demo 模块 API暴露给其它模块调用
</description>
<!-- 新增 yudao-common 依赖 -->
<dependencies>
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-common</artifactId>
</dependency>
</dependencies>
</project>

@ -1,18 +0,0 @@
package com.yunxi.scm.module.demo.enums;
/**
* System
*
* @author
*/
public interface DictTypeConstants {
String USER_TYPE = "user_type"; // 用户类型
String COMMON_STATUS = "common_status"; // 系统状态
String MATERIAL_STATUS = "material_status"; // 物料状态
// ========== SYSTEM 模块 ==========
String TRADE_ORDER_TYPE = "trade_order_type"; // 订单交易类型
}

@ -1,9 +0,0 @@
// TODO 待办:请将下面的错误码复制到 yunxi-module-demo-api 模块的 ErrorCodeConstants 类中。注意请给“TODO 补充编号”设置一个错误码编号!!!
// ========== 物料管理 TODO 补充编号 ==========
package com.yunxi.scm.module.demo.enums;
import com.yunxi.scm.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode MATERIAL_NOT_EXISTS = new ErrorCode(2023091001, "物料管理不存在");
}

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yunxi-module-demo</artifactId>
<groupId>com.yunxi.scm</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>yunxi-module-demo-biz</artifactId>
<name>${project.artifactId}</name>
<description>
demo 模块,主要实现 XXX、YYY、ZZZ 等功能。
</description>
<!-- 新增依赖,这里引入的都是比较常用的业务组件、技术组件 -->
<dependencies>
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-module-demo-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-spring-boot-starter-test</artifactId>
</dependency>
<!-- Excel 相关 -->
<dependency>
<groupId>com.yunxi.scm</groupId>
<artifactId>yunxi-spring-boot-starter-excel</artifactId>
</dependency>
</dependencies>
</project>

@ -1,28 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin;
import com.yunxi.scm.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.security.PermitAll;
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - Test")
@RestController
@RequestMapping("/demo/test")
@Validated
public class DemoTestController {
@GetMapping("/get")
@Operation(summary = "获取 test 信息")
@PermitAll // 无需认证即可访问
public CommonResult<String> get() {
return success("无需认证即可访问的后台接口");
}
}

@ -1,99 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material;
import com.yunxi.scm.framework.common.pojo.CommonResult;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.excel.core.util.ExcelUtils;
import com.yunxi.scm.framework.operatelog.core.annotations.OperateLog;
import com.yunxi.scm.module.demo.controller.admin.material.vo.*;
import com.yunxi.scm.module.demo.convert.material.MaterialConvert;
import com.yunxi.scm.module.demo.dal.dataobject.material.MaterialDO;
import com.yunxi.scm.module.demo.service.material.MaterialService;
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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
import static com.yunxi.scm.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 物料管理")
@RestController
@RequestMapping("/demo/material")
@Validated
public class MaterialController {
@Resource
private MaterialService materialServiceDemo;
@PostMapping("/create")
@Operation(summary = "创建物料管理")
@PreAuthorize("@ss.hasPermission('demo:material:create')")
public CommonResult<Long> createMaterial(@Valid @RequestBody MaterialCreateReqVO createReqVO) {
return success(materialServiceDemo.createMaterial(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料管理")
@PreAuthorize("@ss.hasPermission('demo:material:update')")
public CommonResult<Boolean> updateMaterial(@Valid @RequestBody MaterialUpdateReqVO updateReqVO) {
materialServiceDemo.updateMaterial(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除物料管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('demo:material:delete')")
public CommonResult<Boolean> deleteMaterial(@RequestParam("id") Long id) {
materialServiceDemo.deleteMaterial(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得物料管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('demo:material:query')")
public CommonResult<MaterialRespVO> getMaterial(@RequestParam("id") Long id) {
MaterialDO material = materialServiceDemo.getMaterial(id);
return success(MaterialConvert.INSTANCE.convert(material));
}
@GetMapping("/list")
@Operation(summary = "获得物料管理列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('demo:material:query')")
public CommonResult<List<MaterialRespVO>> getMaterialList(@RequestParam("ids") Collection<Long> ids) {
List<MaterialDO> list = materialServiceDemo.getMaterialList(ids);
return success(MaterialConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得物料管理分页")
@PreAuthorize("@ss.hasPermission('demo:material:query')")
public CommonResult<PageResult<MaterialRespVO>> getMaterialPage(@Valid MaterialPageReqVO pageVO) {
PageResult<MaterialDO> pageResult = materialServiceDemo.getMaterialPage(pageVO);
return success(MaterialConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料管理 Excel")
@PreAuthorize("@ss.hasPermission('demo:material:export')")
@OperateLog(type = EXPORT)
public void exportMaterialExcel(@Valid MaterialExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<MaterialDO> list = materialServiceDemo.getMaterialList(exportReqVO);
// 导出 Excel
List<MaterialExcelVO> datas = MaterialConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "物料管理.xls", "数据", MaterialExcelVO.class, datas);
}
}

@ -1,48 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class MaterialBaseVO {
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotNull(message = "名称不能为空")
private String name;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
private Byte status;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "类型不能为空")
private Byte type;
@Schema(description = "分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,2]")
@NotNull(message = "分类不能为空")
private List<Integer> category;
@Schema(description = "图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
@NotNull(message = "图片不能为空")
private String imgurl;
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "库存数量不能为空")
private Integer stock;
@Schema(description = "单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "18.00")
@NotNull(message = "单价不能为空")
private BigDecimal price;
@Schema(description = "备注", example = "物料备注")
private String remark;
}

@ -1,14 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 物料管理创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MaterialCreateReqVO extends MaterialBaseVO {
}

@ -1,55 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yunxi.scm.framework.excel.core.annotations.DictFormat;
import com.yunxi.scm.framework.excel.core.convert.DictConvert;
import com.yunxi.scm.module.demo.enums.DictTypeConstants;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* Excel VO
*
* @author ccongli
*/
@Data
public class MaterialExcelVO {
@ExcelProperty("ID")
private Long id;
@ExcelProperty("名称")
private String name;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.MATERIAL_STATUS)
private Byte status;
@ExcelProperty("类型")
@DictFormat(DictTypeConstants.TRADE_ORDER_TYPE)
private Byte type;
@ExcelProperty("分类")
@DictFormat(DictTypeConstants.TRADE_ORDER_TYPE)
private List<Integer> category;
@ExcelProperty("图片")
private String imgurl;
@ExcelProperty("库存数量")
private Integer stock;
@ExcelProperty("单价")
private BigDecimal price;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -1,32 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 物料管理 Excel 导出 Request VO参数和 MaterialPageReqVO 是一致的")
@Data
public class MaterialExportReqVO {
@Schema(description = "名称", example = "李四")
private String name;
@Schema(description = "状态", example = "1")
private Byte status;
@Schema(description = "类型", example = "2")
private Byte type;
@Schema(description = "分类")
private List<Integer> category;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -1,37 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import com.yunxi.scm.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 物料管理分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MaterialPageReqVO extends PageParam {
@Schema(description = "名称", example = "李四")
private String name;
@Schema(description = "状态", example = "1")
private Byte status;
@Schema(description = "类型", example = "2")
private Byte type;
@Schema(description = "分类", example = "[1,2]")
private List<Integer> category;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -1,19 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 物料管理 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MaterialRespVO extends MaterialBaseVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

@ -1,18 +0,0 @@
package com.yunxi.scm.module.demo.controller.admin.material.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 物料管理更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MaterialUpdateReqVO extends MaterialBaseVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541")
@NotNull(message = "ID不能为空")
private Long id;
}

@ -1,27 +0,0 @@
package com.yunxi.scm.module.demo.controller.app;
import com.yunxi.scm.framework.common.pojo.CommonResult;
import com.yunxi.scm.framework.security.core.annotations.PreAuthenticated;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 App - Test")
@RestController
@RequestMapping("/demo/test")
@Validated
public class AppDemoTestController {
@GetMapping("/get")
@Operation(summary = "获取 test 信息")
@PreAuthenticated // 认证后可访问
public CommonResult<String> get() {
return success("需认证后才能访问的app接口");
}
}

@ -1,34 +0,0 @@
package com.yunxi.scm.module.demo.convert.material;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.demo.dal.dataobject.material.MaterialDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import com.yunxi.scm.module.demo.controller.admin.material.vo.*;
/**
* Convert
*
* @author ccongli
*/
@Mapper
public interface MaterialConvert {
MaterialConvert INSTANCE = Mappers.getMapper(MaterialConvert.class);
MaterialDO convert(MaterialCreateReqVO bean);
MaterialDO convert(MaterialUpdateReqVO bean);
MaterialRespVO convert(MaterialDO bean);
List<MaterialRespVO> convertList(List<MaterialDO> list);
PageResult<MaterialRespVO> convertPage(PageResult<MaterialDO> page);
List<MaterialExcelVO> convertList02(List<MaterialDO> list);
}

@ -1,71 +0,0 @@
package com.yunxi.scm.module.demo.dal.dataobject.material;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
import com.yunxi.scm.framework.mybatis.core.type.IntegerListTypeHandler;
import lombok.*;
import java.math.BigDecimal;
import java.util.List;
/**
* DO
*
* @author ccongli
*/
@TableName(value = "demo_material",autoResultMap = true)
@KeySequence("demo_material_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MaterialDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String name;
/**
*
*
* {@link TODO material_status }
*/
private Byte status;
/**
*
*/
private Byte type;
/**
*
*/
// @TableField(typeHandler = JacksonTypeHandler.class)
@TableField(typeHandler = IntegerListTypeHandler.class)
private List<Integer> category;
/**
*
*/
private String imgurl;
/**
*
*/
private Integer stock;
/**
*
*/
private BigDecimal price;
/**
*
*/
private String remark;
}

@ -1,40 +0,0 @@
package com.yunxi.scm.module.demo.dal.mysql.material;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.scm.module.demo.dal.dataobject.material.MaterialDO;
import org.apache.ibatis.annotations.Mapper;
import com.yunxi.scm.module.demo.controller.admin.material.vo.*;
/**
* Mapper
*
* @author ccongli
*/
@Mapper
public interface MaterialMapper extends BaseMapperX<MaterialDO> {
default PageResult<MaterialDO> selectPage(MaterialPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDO>()
.likeIfPresent(MaterialDO::getName, reqVO.getName())
.eqIfPresent(MaterialDO::getStatus, reqVO.getStatus())
.eqIfPresent(MaterialDO::getType, reqVO.getType())
.eqIfPresent(MaterialDO::getCategory, reqVO.getCategory())
.betweenIfPresent(MaterialDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialDO::getId));
}
default List<MaterialDO> selectList(MaterialExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<MaterialDO>()
.likeIfPresent(MaterialDO::getName, reqVO.getName())
.eqIfPresent(MaterialDO::getStatus, reqVO.getStatus())
.eqIfPresent(MaterialDO::getType, reqVO.getType())
.eqIfPresent(MaterialDO::getCategory, reqVO.getCategory())
.betweenIfPresent(MaterialDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialDO::getId));
}
}

@ -1,70 +0,0 @@
package com.yunxi.scm.module.demo.service.material;
import java.util.*;
import javax.validation.*;
import com.yunxi.scm.module.demo.controller.admin.material.vo.*;
import com.yunxi.scm.module.demo.dal.dataobject.material.MaterialDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
/**
* Service
*
* @author ccongli
*/
public interface MaterialService {
/**
*
*
* @param createReqVO
* @return
*/
Long createMaterial(@Valid MaterialCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateMaterial(@Valid MaterialUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteMaterial(Long id);
/**
*
*
* @param id
* @return
*/
MaterialDO getMaterial(Long id);
/**
*
*
* @param ids
* @return
*/
List<MaterialDO> getMaterialList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<MaterialDO> getMaterialList(MaterialExportReqVO exportReqVO);
}

@ -1,85 +0,0 @@
package com.yunxi.scm.module.demo.service.material;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialCreateReqVO;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialExportReqVO;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialPageReqVO;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialUpdateReqVO;
import com.yunxi.scm.module.demo.convert.material.MaterialConvert;
import com.yunxi.scm.module.demo.dal.dataobject.material.MaterialDO;
import com.yunxi.scm.module.demo.dal.mysql.material.MaterialMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.module.demo.enums.ErrorCodeConstants.MATERIAL_NOT_EXISTS;
/**
* Service
*
* @author ccongli
*/
@Service
@Validated
public class MaterialServiceImpl implements MaterialService {
@Resource
private MaterialMapper materialMapperDemo;
@Override
public Long createMaterial(MaterialCreateReqVO createReqVO) {
// 插入
MaterialDO material = MaterialConvert.INSTANCE.convert(createReqVO);
materialMapperDemo.insert(material);
// 返回
return material.getId();
}
@Override
public void updateMaterial(MaterialUpdateReqVO updateReqVO) {
// 校验存在
validateMaterialExists(updateReqVO.getId());
// 更新
MaterialDO updateObj = MaterialConvert.INSTANCE.convert(updateReqVO);
materialMapperDemo.updateById(updateObj);
}
@Override
public void deleteMaterial(Long id) {
// 校验存在
validateMaterialExists(id);
// 删除
materialMapperDemo.deleteById(id);
}
private void validateMaterialExists(Long id) {
if (materialMapperDemo.selectById(id) == null) {
throw exception(MATERIAL_NOT_EXISTS);
}
}
@Override
public MaterialDO getMaterial(Long id) {
return materialMapperDemo.selectById(id);
}
@Override
public List<MaterialDO> getMaterialList(Collection<Long> ids) {
return materialMapperDemo.selectBatchIds(ids);
}
@Override
public PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO) {
return materialMapperDemo.selectPage(pageReqVO);
}
@Override
public List<MaterialDO> getMaterialList(MaterialExportReqVO exportReqVO) {
return materialMapperDemo.selectList(exportReqVO);
}
}

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yunxi.scm.module.demo.dal.mysql.material.MaterialMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -1,179 +0,0 @@
package com.yunxi.scm.module.demo.service.material;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialCreateReqVO;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialExportReqVO;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialPageReqVO;
import com.yunxi.scm.module.demo.controller.admin.material.vo.MaterialUpdateReqVO;
import com.yunxi.scm.module.demo.dal.dataobject.material.MaterialDO;
import com.yunxi.scm.module.demo.dal.mysql.material.MaterialMapper;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.List;
import static com.yunxi.scm.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
import static com.yunxi.scm.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static com.yunxi.scm.framework.test.core.util.AssertUtils.assertPojoEquals;
import static com.yunxi.scm.framework.test.core.util.AssertUtils.assertServiceException;
import static com.yunxi.scm.framework.test.core.util.RandomUtils.randomLongId;
import static com.yunxi.scm.framework.test.core.util.RandomUtils.randomPojo;
import static com.yunxi.scm.module.demo.enums.ErrorCodeConstants.MATERIAL_NOT_EXISTS;
import static org.junit.jupiter.api.Assertions.*;
/**
* {@link MaterialServiceImpl}
*
* @author ccongli
*/
@Import(MaterialServiceImpl.class)
public class MaterialServiceDemoImplTest extends BaseDbUnitTest {
@Resource
private MaterialServiceImpl materialService;
@Resource
private MaterialMapper materialMapperDemo;
@Test
public void testCreateMaterial_success() {
// 准备参数
MaterialCreateReqVO reqVO = randomPojo(MaterialCreateReqVO.class);
// 调用
Long materialId = materialService.createMaterial(reqVO);
// 断言
assertNotNull(materialId);
// 校验记录的属性是否正确
MaterialDO material = materialMapperDemo.selectById(materialId);
assertPojoEquals(reqVO, material);
}
@Test
public void testUpdateMaterial_success() {
// mock 数据
MaterialDO dbMaterial = randomPojo(MaterialDO.class);
materialMapperDemo.insert(dbMaterial);// @Sql: 先插入出一条存在的数据
// 准备参数
MaterialUpdateReqVO reqVO = randomPojo(MaterialUpdateReqVO.class, o -> {
o.setId(dbMaterial.getId()); // 设置更新的 ID
});
// 调用
materialService.updateMaterial(reqVO);
// 校验是否更新正确
MaterialDO material = materialMapperDemo.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, material);
}
@Test
public void testUpdateMaterial_notExists() {
// 准备参数
MaterialUpdateReqVO reqVO = randomPojo(MaterialUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> materialService.updateMaterial(reqVO), MATERIAL_NOT_EXISTS);
}
@Test
public void testDeleteMaterial_success() {
// mock 数据
MaterialDO dbMaterial = randomPojo(MaterialDO.class);
materialMapperDemo.insert(dbMaterial);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbMaterial.getId();
// 调用
materialService.deleteMaterial(id);
// 校验数据不存在了
assertNull(materialMapperDemo.selectById(id));
}
@Test
public void testDeleteMaterial_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> materialService.deleteMaterial(id), MATERIAL_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetMaterialPage() {
// mock 数据
MaterialDO dbMaterial = randomPojo(MaterialDO.class, o -> { // 等会查询到
o.setName(null);
o.setStatus(null);
o.setType(null);
o.setCategory(null);
o.setCreateTime(null);
});
materialMapperDemo.insert(dbMaterial);
// 测试 name 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setName(null)));
// 测试 status 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setStatus(null)));
// 测试 type 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setType(null)));
// 测试 category 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setCategory(null)));
// 测试 createTime 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setCreateTime(null)));
// 准备参数
MaterialPageReqVO reqVO = new MaterialPageReqVO();
reqVO.setName(null);
reqVO.setStatus(null);
reqVO.setType(null);
reqVO.setCategory(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<MaterialDO> pageResult = materialService.getMaterialPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbMaterial, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetMaterialList() {
// mock 数据
MaterialDO dbMaterial = randomPojo(MaterialDO.class, o -> { // 等会查询到
o.setName(null);
o.setStatus(null);
o.setType(null);
o.setCategory(null);
o.setCreateTime(null);
});
materialMapperDemo.insert(dbMaterial);
// 测试 name 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setName(null)));
// 测试 status 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setStatus(null)));
// 测试 type 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setType(null)));
// 测试 category 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setCategory(null)));
// 测试 createTime 不匹配
materialMapperDemo.insert(cloneIgnoreId(dbMaterial, o -> o.setCreateTime(null)));
// 准备参数
MaterialExportReqVO reqVO = new MaterialExportReqVO();
reqVO.setName(null);
reqVO.setStatus(null);
reqVO.setType(null);
reqVO.setCategory(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
List<MaterialDO> list = materialService.getMaterialList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbMaterial, list.get(0));
}
}

@ -1,2 +0,0 @@
-- SQL yunxi-module-demo-biz test/resources/sql/clean.sql
DELETE FROM "demo_material";

@ -1,19 +0,0 @@
-- SQL yunxi-module-demo-biz test/resources/sql/create_tables.sql
CREATE TABLE IF NOT EXISTS "demo_material" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar NOT NULL,
"status" varchar NOT NULL,
"type" varchar NOT NULL,
"category" varchar NOT NULL,
"imgurl" varchar NOT NULL,
"stock" int NOT NULL,
"price" varchar NOT NULL,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '';

@ -1,55 +0,0 @@
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'', '', 2, 0, 1,
'material', '', 'demo/material/index', 0, 'Material'
);
-- ID
-- MySQL OraclePostgreSQLSQLServer @parentId
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'demo:material:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'demo:material:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'demo:material:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'demo:material:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'demo:material:export', 3, 5, @parentId,
'', '', '', 0
);

@ -19,7 +19,6 @@ import com.yunxi.scm.module.infra.dal.dataobject.file.FileConfigDO;
import com.yunxi.scm.module.infra.dal.mysql.file.FileConfigMapper;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -30,7 +29,6 @@ import javax.validation.Validator;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER;
@ -88,7 +86,7 @@ public class FileConfigServiceImpl implements FileConfigService {
*
*
*/
@Scheduled(initialDelay = 60, fixedRate = 60, timeUnit = TimeUnit.SECONDS)
// @Scheduled(initialDelay = 60, fixedRate = 60, timeUnit = TimeUnit.SECONDS)
public void refreshLocalCache() {
// 情况一:如果缓存里没有数据,则直接刷新缓存
if (CollUtil.isEmpty(fileConfigCache)) {

@ -1,8 +1,9 @@
package com.yunxi.scm.module.infra.service.db;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.crypto.symmetric.AES;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
import com.yunxi.scm.framework.mybatis.core.type.EncryptTypeHandler;
import com.yunxi.scm.framework.mybatis.core.util.JdbcUtils;
import com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
@ -10,12 +11,9 @@ import com.yunxi.scm.module.infra.controller.admin.db.vo.DataSourceConfigCreateR
import com.yunxi.scm.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
import com.yunxi.scm.module.infra.dal.dataobject.db.DataSourceConfigDO;
import com.yunxi.scm.module.infra.dal.mysql.db.DataSourceConfigMapper;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;
import org.mockito.stubbing.Answer;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
@ -28,7 +26,6 @@ import static com.yunxi.scm.framework.test.core.util.RandomUtils.randomLongId;
import static com.yunxi.scm.framework.test.core.util.RandomUtils.randomPojo;
import static com.yunxi.scm.module.infra.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.when;
@ -56,9 +53,9 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
@BeforeEach
public void setUp() {
// mock 一个空实现的 StringEncryptor避免 EncryptTypeHandler 报错
ReflectUtil.setFieldValue(EncryptTypeHandler.class, "aes", aes);
when(aes.encryptBase64(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
when(aes.decryptStr(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
// ReflectUtil.setFieldValue(EncryptTypeHandler.class, "aes", aes);
// when(aes.encryptBase64(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
// when(aes.decryptStr(anyString())).then((Answer<String>) invocation -> invocation.getArgument(0));
// mock DynamicDataSourceProperties
when(dynamicDataSourceProperties.getPrimary()).thenReturn("primary");
@ -145,6 +142,8 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class);
dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据
System.out.println(dbDataSourceConfig.getPassword());
System.out.println(EncryptTypeHandler.encrypt(dbDataSourceConfig.getPassword()));
// 调用
DataSourceConfigDO result = dataSourceConfigMapper.selectOne(DataSourceConfigDO::getPassword,
EncryptTypeHandler.encrypt(dbDataSourceConfig.getPassword()));

@ -29,6 +29,8 @@ spring:
mybatis-plus:
lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
type-aliases-package: ${yunxi.info.base-package}.module.*.dal.dataobject
encryptor:
password: X+aZvWkl9jtRP9b2
--- #################### 定时任务相关配置 ####################

@ -84,7 +84,7 @@ public class SensitiveWordController {
List<SensitiveWordDO> list = sensitiveWordService.getSensitiveWordList(exportReqVO);
// 导出 Excel
List<SensitiveWordExcelVO> datas = SensitiveWordConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "敏感词.xls", "数据", SensitiveWordExcelVO.class, datas);
ExcelUtils.write(response, "敏感词123.xls", "数据", SensitiveWordExcelVO.class, datas);
}
@GetMapping("/get-tags")

@ -171,7 +171,6 @@ public class UserController {
UserImportExcelVO.builder().username("yuanma").deptId(2L).email("yuanma@iocoder.cn").mobile("15601701300")
.nickname("源码").status(CommonStatusEnum.DISABLE.getStatus()).sex(SexEnum.FEMALE.getSex()).build()
);
// 输出
ExcelUtils.write(response, "用户导入模板.xls", "用户列表", UserImportExcelVO.class, list);
}

@ -1,12 +1,12 @@
package com.yunxi.scm.module.system.dal.dataobject.sensitiveword;
import com.yunxi.scm.framework.common.enums.CommonStatusEnum;
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
import com.yunxi.scm.framework.mybatis.core.type.StringListTypeHandler;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yunxi.scm.framework.common.enums.CommonStatusEnum;
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
import com.yunxi.scm.framework.mybatis.core.type.StringListTypeHandler;
import lombok.*;
import java.util.List;

@ -1,6 +1,8 @@
package com.yunxi.scm.module.system.service.sensitiveword;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.yunxi.scm.framework.common.enums.CommonStatusEnum;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.common.util.collection.CollectionUtils;
@ -12,11 +14,8 @@ import com.yunxi.scm.module.system.convert.sensitiveword.SensitiveWordConvert;
import com.yunxi.scm.module.system.dal.dataobject.sensitiveword.SensitiveWordDO;
import com.yunxi.scm.module.system.dal.mysql.sensitiveword.SensitiveWordMapper;
import com.yunxi.scm.module.system.util.collection.SimpleTrie;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -24,7 +23,6 @@ import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.framework.common.util.collection.CollectionUtils.filterList;
@ -115,7 +113,7 @@ public class SensitiveWordServiceImpl implements SensitiveWordService {
*
*
*/
@Scheduled(initialDelay = 60, fixedRate = 60, timeUnit = TimeUnit.SECONDS)
// @Scheduled(initialDelay = 60, fixedRate = 60, timeUnit = TimeUnit.SECONDS)
public void refreshLocalCache() {
// 情况一:如果缓存里没有数据,则直接刷新缓存
if (CollUtil.isEmpty(sensitiveWordCache)) {

@ -12,7 +12,6 @@ import com.yunxi.scm.module.system.dal.dataobject.sms.SmsChannelDO;
import com.yunxi.scm.module.system.dal.mysql.sms.SmsChannelMapper;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@ -20,7 +19,6 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.framework.common.util.collection.CollectionUtils.getMaxValue;
@ -69,7 +67,7 @@ public class SmsChannelServiceImpl implements SmsChannelService {
*
*
*/
@Scheduled(initialDelay = 60, fixedRate = 60, timeUnit = TimeUnit.SECONDS)
// @Scheduled(initialDelay = 60, fixedRate = 60, timeUnit = TimeUnit.SECONDS)
public void refreshLocalCache() {
// 情况一:如果缓存里没有数据,则直接刷新缓存
if (CollUtil.isEmpty(channelCache)) {

@ -86,7 +86,7 @@ aj:
cache-number: 1000 # local 缓存的阈值,达到这个值,清除缓存
timing-clear: 180 # local定时清除过期缓存(单位秒),设置为0代表不执行
type: blockPuzzle # 验证码类型 default两种都实例化。 blockPuzzle 滑块拼图 clickWord 文字点选
water-mark: 芋道源码 # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 UnicodeLinux 可能需要转 unicode
water-mark: \u957f\u6c5f\u4e91\u606f # 右下角水印文字(我的水印),可使用 https://tool.chinaz.com/tools/unicode.aspx 中文转 UnicodeLinux 可能需要转 unicode
interference-options: 0 # 滑动干扰项(0/1/2)
req-frequency-limit-enable: false # 接口请求次数一分钟限制是否开启 true|false
req-get-lock-limit: 5 # 验证失败 5 次get接口锁定
@ -113,7 +113,7 @@ yunxi:
maxOnlineCount: 0 # 最大连接人数
sessionMap: true # 保存sessionMap
swagger:
title: 芋道快速开发平台
title: 云息供应链管理平台接口文档
description: 提供管理后台、用户 App 的所有功能
version: ${yunxi.info.version}
url: ${yunxi.web.admin-ui.url}
@ -194,6 +194,7 @@ yunxi:
- rep_demo_jianpiao
- tmp_report_data_1
- tmp_report_data_income
- demo_xxx
sms-code: # 短信验证码相关的配置项
expire-times: 10m
send-frequency: 1m

@ -49,9 +49,9 @@ export default {
//
this.getUnreadCount()
//
setInterval(() => {
this.getUnreadCount()
},1000 * 60 * 2)
// setInterval(() => {
// this.getUnreadCount()
// },1000 * 60 * 2)
},
methods: {
getList: function() {

@ -9,21 +9,21 @@
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MATERIAL_STATUS)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.TRADE_ORDER_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="分类" prop="category">
<el-select v-model="queryParams.category" placeholder="请选择分类" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.TRADE_ORDER_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<!-- <el-form-item label="分类" prop="category">-->
<!-- <el-select v-model="queryParams.category" placeholder="请选择分类" clearable size="small">-->
<!-- <el-option v-for="dict in this.getDictDatas(DICT_TYPE.TRADE_ORDER_TYPE)"-->
<!-- :key="dict.value" :label="dict.label" :value="dict.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
@ -63,7 +63,7 @@
</el-table-column>
<el-table-column label="分类" align="center" prop="category">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.category" />
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.categories" />
</template>
</el-table-column>
<el-table-column label="图片" align="center" prop="imgurl">
@ -288,11 +288,11 @@ export default {
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有物料管理数据项?').then(() => {
this.exportLoading = true;
// this.exportLoading = true;
return exportMaterialExcel(params);
}).then(response => {
this.$download.excel(response, '物料管理.xls');
this.exportLoading = false;
// this.exportLoading = false;
}).catch(() => {});
}
}

@ -315,7 +315,8 @@ export default {
this.exportLoading = true;
return exportSensitiveWordExcel(params);
}).then(response => {
this.$download.excel(response, '${table.classComment}.xls');
// this.$download.excel(response, '${table.classComment}.xls');
this.$download.excel(response, '敏感词.xls');
this.exportLoading = false;
}).catch(() => {
});

Loading…
Cancel
Save