From d3b39a582e3ae6ccd98f0a6999e7fb325f8e94da Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期三, 03 九月 2025 17:06:59 +0800 Subject: [PATCH] Merge branch 'master' of http://xearth.cn:6600/r/web-manage/web-manage-back --- target/classes/application-prod.yml | 70 +++++++ src/main/java/com/webmanage/mapper/PointsTransactionMapper.java | 11 + src/main/java/com/webmanage/service/PointsFlowService.java | 6 src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java | 131 ++++++++++++- target/classes/application.yml | 72 +++++++ src/main/java/com/webmanage/entity/PointsTransaction.java | 74 +++++++ src/main/java/com/webmanage/dto/DeductUserPointsDTO.java | 41 ++++ src/main/java/com/webmanage/controller/PointsController.java | 18 + target/classes/application-dev.yml | 69 ++++++ target/classes/application-test.yml | 69 ++++++ 10 files changed, 551 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/webmanage/controller/PointsController.java b/src/main/java/com/webmanage/controller/PointsController.java index 837b163..7be6840 100644 --- a/src/main/java/com/webmanage/controller/PointsController.java +++ b/src/main/java/com/webmanage/controller/PointsController.java @@ -272,6 +272,24 @@ } } + // ==================== 绉垎鎵e噺 ==================== + + @PostMapping("/user/deduct") + @ApiOperation("鎵e噺鐢ㄦ埛绉垎") + public Result<Object> deductUserPoints(@Valid @RequestBody DeductUserPointsDTO deductDTO) { + try { + boolean result = pointsFlowService.deductUserPoints(deductDTO); + if (result) { + return Result.success("绉垎鎵e噺鎴愬姛"); + } else { + return Result.error("绉垎鎵e噺澶辫触"); + } + } catch (Exception e) { + log.error("绉垎鎵e噺澶辫触", e); + return Result.error("绉垎鎵e噺澶辫触锛�" + e.getMessage()); + } + } + // ==================== 绉垎娴佹按鏁版嵁绫荤洰 ==================== @GetMapping("/flow/categories") diff --git a/src/main/java/com/webmanage/dto/DeductUserPointsDTO.java b/src/main/java/com/webmanage/dto/DeductUserPointsDTO.java new file mode 100644 index 0000000..a3eed51 --- /dev/null +++ b/src/main/java/com/webmanage/dto/DeductUserPointsDTO.java @@ -0,0 +1,41 @@ +package com.webmanage.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; + +/** + * 鎵e噺鐢ㄦ埛绉垎DTO + */ +@Data +@ApiModel(value = "DeductUserPointsDTO", description = "鎵e噺鐢ㄦ埛绉垎") +public class DeductUserPointsDTO { + + @ApiModelProperty("鐢ㄦ埛ID") + @NotBlank(message = "鐢ㄦ埛ID涓嶈兘涓虹┖") + private String userId; + + @ApiModelProperty("鍗曚綅ID") + private String unitId; + + @ApiModelProperty("鎵e噺绉垎鏁伴噺") + @NotNull(message = "鎵e噺绉垎鏁伴噺涓嶈兘涓虹┖") + @Positive(message = "鎵e噺绉垎鏁伴噺蹇呴』澶т簬0") + private Integer points; + + @ApiModelProperty("璁㈠崟ID") + private String orderId; + + @ApiModelProperty("鎵e噺鍘熷洜/澶囨敞") + private String remark; + + @ApiModelProperty("鏁版嵁绫荤洰") + private String dataCategory = "resource_transaction"; + + @ApiModelProperty("鏁版嵁绫诲瀷") + private Integer dataType = 1; // 1琛ㄧず娑堣�� +} diff --git a/src/main/java/com/webmanage/entity/PointsTransaction.java b/src/main/java/com/webmanage/entity/PointsTransaction.java new file mode 100644 index 0000000..e261d2e --- /dev/null +++ b/src/main/java/com/webmanage/entity/PointsTransaction.java @@ -0,0 +1,74 @@ +package com.webmanage.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 绉垎浜ゆ槗璁板綍瀹炰綋锛屽搴旇〃 tb_points_transaction + */ +@Data +@TableName("tb_points_transaction") +@ApiModel(value = "PointsTransaction", description = "绉垎浜ゆ槗璁板綍") +public class PointsTransaction { + + @ApiModelProperty("涓婚敭ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("鏁版嵁绫荤洰") + @TableField("data_category") + private String dataCategory; + + @ApiModelProperty("鍚嶇О") + @TableField("transaction_name") + private String transactionName; + + @ApiModelProperty("鏃堕棿") + @TableField("transaction_time") + private LocalDateTime transactionTime; + + @ApiModelProperty("绉垎鍙樺姩鍊�") + @TableField("points_change") + private Integer pointsChange; + + @ApiModelProperty("绉垎瑙勫垯绫诲瀷锛氳幏鍙�/娑堣��") + @TableField("rule_type") + private String ruleType; + + @ApiModelProperty("鐢ㄦ埛ID") + @TableField("user_id") + private Long userId; + + @ApiModelProperty("浼佷笟ID") + @TableField("unit_id") + private Long unitId; + + @ApiModelProperty("鐢ㄦ埛绫诲瀷锛氫釜浜虹敤鎴�/鍗曚綅鐢ㄦ埛") + @TableField("user_type") + private String userType; + + @ApiModelProperty("鍏宠仈瑙勫垯ID") + @TableField("rule_id") + private Long ruleId; + + @ApiModelProperty("鍏宠仈瑙勫垯璇︽儏ID") + @TableField("detail_id") + private Long detailId; + + @ApiModelProperty("鍒涘缓鏃堕棿") + @TableField("created_at") + private LocalDateTime createdAt; + + @ApiModelProperty("閫昏緫鍒犻櫎") + @TableField("deleted") + private Integer deleted; +} + + diff --git a/src/main/java/com/webmanage/mapper/PointsTransactionMapper.java b/src/main/java/com/webmanage/mapper/PointsTransactionMapper.java new file mode 100644 index 0000000..ac0678f --- /dev/null +++ b/src/main/java/com/webmanage/mapper/PointsTransactionMapper.java @@ -0,0 +1,11 @@ +package com.webmanage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.webmanage.entity.PointsTransaction; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface PointsTransactionMapper extends BaseMapper<PointsTransaction> { +} + + diff --git a/src/main/java/com/webmanage/service/PointsFlowService.java b/src/main/java/com/webmanage/service/PointsFlowService.java index 85c4a47..13c7df0 100644 --- a/src/main/java/com/webmanage/service/PointsFlowService.java +++ b/src/main/java/com/webmanage/service/PointsFlowService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.webmanage.common.PageResult; import com.webmanage.dto.AddPointsFlowDTO; +import com.webmanage.dto.DeductUserPointsDTO; import com.webmanage.dto.PointsFlowQueryDTO; import com.webmanage.entity.PointsFlow; import com.webmanage.entity.UserPoints; @@ -41,6 +42,11 @@ boolean addPointsFlowByRule(AddPointsFlowDTO addPointsFlowDTO); /** + * 鎵e噺鐢ㄦ埛绉垎 + */ + boolean deductUserPoints(DeductUserPointsDTO deductDTO); + + /** * 鑾峰彇鐢ㄦ埛绉垎缁熻 */ UserPoints getUserPointsTotal(String userId); diff --git a/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java b/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java index d2605cb..fd44187 100644 --- a/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java +++ b/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java @@ -7,6 +7,7 @@ import com.webmanage.common.BusinessException; import com.webmanage.common.PageResult; import com.webmanage.dto.AddPointsFlowDTO; +import com.webmanage.dto.DeductUserPointsDTO; import com.webmanage.dto.PointsFlowQueryDTO; import com.webmanage.emun.RuleTypeEnum; import com.webmanage.entity.PointsFlow; @@ -14,6 +15,8 @@ import com.webmanage.entity.UserPoints; import com.webmanage.mapper.PointsFlowMapper; import com.webmanage.mapper.UserPointsMapper; +import com.webmanage.mapper.PointsTransactionMapper; +import com.webmanage.entity.PointsTransaction; import com.webmanage.service.PointsFlowService; import com.webmanage.service.PointsRuleService; import lombok.extern.slf4j.Slf4j; @@ -39,6 +42,9 @@ @Resource private PointsRuleService pointsRuleService; + + @Resource + private PointsTransactionMapper pointsTransactionMapper; @Override public PageResult<PointsFlow> getPersonalPointsFlowPage(PointsFlowQueryDTO queryDTO) { @@ -381,7 +387,7 @@ * 妫�鏌ョН鍒嗕綑棰濇槸鍚﹁冻澶� */ private void checkBalanceSufficient(String userId, String unitId, Integer requiredPoints) { - // 妫�鏌ヤ釜浜虹Н鍒嗕綑棰� + // 浠呮鏌ヤ釜浜虹Н鍒嗕綑棰濓紙绉婚櫎鍗曚綅浣欓鍒ゅ畾锛� QueryWrapper<UserPoints> userWrapper = new QueryWrapper<>(); userWrapper.eq("deleted", 0) .eq("user_id", userId); @@ -391,15 +397,7 @@ throw new BusinessException("涓汉绉垎浣欓涓嶈冻锛屽綋鍓嶄綑棰�: " + (userPoints != null ? userPoints.getBalance() : 0) + "锛岄渶瑕佹墸闄�: " + requiredPoints); } - // 妫�鏌ュ崟浣嶇Н鍒嗕綑棰� - QueryWrapper<UserPoints> unitWrapper = new QueryWrapper<>(); - unitWrapper.eq("deleted", 0) - .eq("unit_id", unitId); - - UserPoints unitPoints = userPointsMapper.selectOne(unitWrapper); - if (unitPoints == null || unitPoints.getBalance() < requiredPoints) { - throw new BusinessException("鍗曚綅绉垎浣欓涓嶈冻锛屽綋鍓嶄綑棰�: " + (unitPoints != null ? unitPoints.getBalance() : 0) + "锛岄渶瑕佹墸闄�: " + requiredPoints); - } + // 鍘熷崟浣嶄綑棰濇牎楠屽凡绉婚櫎 } /** @@ -566,6 +564,83 @@ } /** + * 鎵e噺鐢ㄦ埛绉垎 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deductUserPoints(DeductUserPointsDTO deductDTO) { + try { + String userId = deductDTO.getUserId(); + String unitId = deductDTO.getUnitId(); + Integer points = deductDTO.getPoints(); + String orderId = deductDTO.getOrderId(); + String remark = deductDTO.getRemark(); + String dataCategory = deductDTO.getDataCategory(); + Integer dataType = deductDTO.getDataType(); + + if (!StringUtils.hasText(userId)) { + throw new BusinessException("鐢ㄦ埛ID涓嶈兘涓虹┖"); + } + if (points == null || points <= 0) { + throw new BusinessException("鎵e噺绉垎鏁伴噺蹇呴』澶т簬0"); + } + + // 妫�鏌ョ敤鎴风Н鍒嗕綑棰濇槸鍚﹀厖瓒� + checkBalanceSufficient(userId, unitId, points); + + // 鍒涘缓绉垎娴佹按璁板綍 + PointsFlow pointsFlow = new PointsFlow(); + pointsFlow.setUserId(userId); + pointsFlow.setUnitId(unitId); + pointsFlow.setDataCategory(dataCategory != null ? dataCategory : "绉垎浜ゆ槗"); + pointsFlow.setDataType(dataType != null ? dataType : 1); + pointsFlow.setPoints(-points); // 璐熸暟琛ㄧず鎵e噺 + pointsFlow.setName(remark != null ? remark : "绉垎鎵e噺"); // name瀛楁瀛樺偍remark鍐呭 + pointsFlow.setFlowTime(LocalDateTime.now()); + pointsFlow.setRlueId(null); // 鐩存帴鎵e噺锛屼笉鍏宠仈瑙勫垯 + + boolean saved = save(pointsFlow); + if (!saved) { + throw new BusinessException("淇濆瓨绉垎娴佹按澶辫触"); + } + + // 鏇存柊鐢ㄦ埛绉垎璐︽埛 + updateUserPointsOnly(userId, -points); + + // 鏂板绉垎浜ゆ槗璁板綍锛堜笌娴佹按鍚屼簨鍔★級 + PointsTransaction trans = new PointsTransaction(); + // tb_points_transaction 鐨� chk_data_category 浠呭厑璁� '鐢ㄦ埛鍙備笌'銆�'鍏朵粬' + // 杩欓噷灏嗕笟鍔$被鐩槧灏勪负鏁版嵁搴撳厑璁哥殑鍊� + trans.setDataCategory("鐢ㄦ埛鍙備笌"); + trans.setTransactionName(pointsFlow.getName()); + trans.setTransactionTime(LocalDateTime.now()); + trans.setPointsChange(-points); + trans.setRuleType("娑堣��"); + try { + trans.setUserId(Long.valueOf(userId)); + } catch (Exception ignore) {} + try { + if (StringUtils.hasText(unitId)) trans.setUnitId(Long.valueOf(unitId)); + } catch (Exception ignore) {} + trans.setUserType("涓汉鐢ㄦ埛"); + trans.setRuleId(null); + trans.setDetailId(null); + trans.setCreatedAt(LocalDateTime.now()); + trans.setDeleted(0); + int inserted = pointsTransactionMapper.insert(trans); + log.info("Points transaction inserted rows={}, id={}", inserted, trans.getId()); + if (inserted <= 0 || trans.getId() == null) { + throw new BusinessException("淇濆瓨绉垎浜ゆ槗璁板綍澶辫触"); + } + + return true; + } catch (Exception e) { + log.error("鎵e噺鐢ㄦ埛绉垎澶辫触", e); + throw new BusinessException("鎵e噺鐢ㄦ埛绉垎澶辫触锛�" + e.getMessage()); + } + } + + /** * 浠呮洿鏂版彁渚涜�咃紙鍗曚綅锛夌Н鍒嗚处鎴� */ private void updateProviderUnitPoints(String providerUnitId, Integer pointsValue) { @@ -606,4 +681,40 @@ userPointsMapper.updateById(unitPoints); } } + + /** + * 浠呮洿鏂颁釜浜虹Н鍒嗚处鎴凤紙涓嶆搷浣滃崟浣嶈处鎴凤級 + */ + private void updateUserPointsOnly(String userId, Integer pointsValue) { + // 鏇存柊涓汉绉垎璐︽埛 + QueryWrapper<UserPoints> userWrapper = new QueryWrapper<>(); + userWrapper.eq("deleted", 0) + .eq("user_id", userId); + UserPoints userPoints = userPointsMapper.selectOne(userWrapper); + if (userPoints == null) { + if (pointsValue < 0) { + throw new BusinessException("涓汉绉垎浣欓涓嶈冻锛屾棤娉曟墸闄ょН鍒�"); + } + userPoints = new UserPoints(); + userPoints.setUserId(userId); + userPoints.setUnitId(null); + userPoints.setBalance(pointsValue); + userPoints.setTotalEarned(pointsValue > 0 ? pointsValue : 0); + userPoints.setTotalConsumed(pointsValue < 0 ? Math.abs(pointsValue) : 0); + userPointsMapper.insert(userPoints); + } else { + if (pointsValue < 0 && userPoints.getBalance() + pointsValue < 0) { + throw new BusinessException("涓汉绉垎浣欓涓嶈冻锛屽綋鍓嶄綑棰�: " + userPoints.getBalance() + "锛岄渶瑕佹墸闄�: " + Math.abs(pointsValue)); + } + userPoints.setBalance(userPoints.getBalance() + pointsValue); + if (pointsValue > 0) { + userPoints.setTotalEarned(userPoints.getTotalEarned() != null ? userPoints.getTotalEarned() + pointsValue : pointsValue); + } + if (pointsValue < 0) { + userPoints.setTotalConsumed(userPoints.getTotalConsumed() != null ? userPoints.getTotalConsumed() + Math.abs(pointsValue) : Math.abs(pointsValue)); + } + userPoints.setUpdateTime(LocalDateTime.now()); + userPointsMapper.updateById(userPoints); + } + } } diff --git a/target/classes/application-dev.yml b/target/classes/application-dev.yml new file mode 100644 index 0000000..7981842 --- /dev/null +++ b/target/classes/application-dev.yml @@ -0,0 +1,69 @@ +spring: + # 鏁版嵁婧愰厤缃� + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://localhost:5432/web_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: postgres + password: AES:d9d2d3e0d586e76d02a97c451f3256bffdc806b4c7626904 + druid: + # 鍒濆杩炴帴鏁� + initial-size: 5 + # 鏈�灏忚繛鎺ユ睜鏁伴噺 + min-idle: 10 + # 鏈�澶ц繛鎺ユ睜鏁伴噺 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + min-evictable-idle-time-millis: 300000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + max-evictable-idle-time-millis: 900000 + # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁� + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + # 鎵撳紑PSCache锛屽苟涓旀寚瀹氭瘡涓繛鎺ヤ笂PSCache鐨勫ぇ灏� + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + # 閰嶇疆鐩戞帶缁熻鎷︽埅鐨刦ilters锛屽幓鎺夊悗鐩戞帶鐣岄潰sql鏃犳硶缁熻锛�'wall'鐢ㄤ簬闃茬伀澧� + filters: stat,wall,slf4j + # 閫氳繃connectProperties灞炴�ф潵鎵撳紑mergeSql鍔熻兘锛涙參SQL璁板綍 + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + # 閰嶇疆DruidStatFilter + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" + # 閰嶇疆DruidStatViewServlet + stat-view-servlet: + enabled: true + url-pattern: /druid/* + reset-enable: false + login-username: admin + login-password: 123456 + + # Redis閰嶇疆 + redis: + host: localhost + port: 6379 + password: + database: 0 + timeout: 10000ms + lettuce: + pool: + max-active: 8 + max-wait: -1ms + max-idle: 8 + min-idle: 0 + +# MinIO閰嶇疆 +minio: + endpoint: http://localhost:9000 + access-key: minioadmin + secret-key: minioadmin + bucket-name: web-manage + diff --git a/target/classes/application-prod.yml b/target/classes/application-prod.yml new file mode 100644 index 0000000..7581c4d --- /dev/null +++ b/target/classes/application-prod.yml @@ -0,0 +1,70 @@ + # 鏁版嵁婧愰厤缃� +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://192.168.20.52:5432/zypt-v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: postgres + password: AES:f9d2d3e0d586e76d14aba9d24666acef98c4605be9ec680ac4cbeede7ad2 + druid: + # 鍒濆杩炴帴鏁� + initial-size: 5 + # 鏈�灏忚繛鎺ユ睜鏁伴噺 + min-idle: 10 + # 鏈�澶ц繛鎺ユ睜鏁伴噺 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + min-evictable-idle-time-millis: 300000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + max-evictable-idle-time-millis: 900000 + # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁� + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + # 鎵撳紑PSCache锛屽苟涓旀寚瀹氭瘡涓繛鎺ヤ笂PSCache鐨勫ぇ灏� + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + # 閰嶇疆鐩戞帶缁熻鎷︽埅鐨刦ilters锛屽幓鎺夊悗鐩戞帶鐣岄潰sql鏃犳硶缁熻锛�'wall'鐢ㄤ簬闃茬伀澧� + filters: stat,wall,slf4j + # 閫氳繃connectProperties灞炴�ф潵鎵撳紑mergeSql鍔熻兘锛涙參SQL璁板綍 + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + # 閰嶇疆DruidStatFilter + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" + # 閰嶇疆DruidStatViewServlet + stat-view-servlet: + enabled: true + url-pattern: /druid/* + reset-enable: false + login-username: admin + login-password: 123456 + + # Redis閰嶇疆 + redis: + host: 192.168.20.51 + port: 6379 + password: AES:c8d9cdfddcb4b32c677d657d2c8d56f9e7e4720832656637f5 + database: 4 + timeout: 10000ms + lettuce: + pool: + max-active: 8 + max-wait: -1ms + max-idle: 8 + min-idle: 0 +# MinIO閰嶇疆 +minio: + endpoint: http://192.168.20.52:9000 + access-key: minioadmin + secret-key: AES:c4d4cefddd95e6733df755af0e29839c104ee8baa55eb53cdc24 + part-size: 104857600 + bucket-name: dev + + diff --git a/target/classes/application-test.yml b/target/classes/application-test.yml new file mode 100644 index 0000000..58c3ec5 --- /dev/null +++ b/target/classes/application-test.yml @@ -0,0 +1,69 @@ + # 鏁版嵁婧愰厤缃� +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://localhost:5432/web_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: postgres + password: zkyxpostgres + druid: + # 鍒濆杩炴帴鏁� + initial-size: 5 + # 鏈�灏忚繛鎺ユ睜鏁伴噺 + min-idle: 10 + # 鏈�澶ц繛鎺ユ睜鏁伴噺 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + min-evictable-idle-time-millis: 300000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + max-evictable-idle-time-millis: 900000 + # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁� + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + # 鎵撳紑PSCache锛屽苟涓旀寚瀹氭瘡涓繛鎺ヤ笂PSCache鐨勫ぇ灏� + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + # 閰嶇疆鐩戞帶缁熻鎷︽埅鐨刦ilters锛屽幓鎺夊悗鐩戞帶鐣岄潰sql鏃犳硶缁熻锛�'wall'鐢ㄤ簬闃茬伀澧� + filters: stat,wall,slf4j + # 閫氳繃connectProperties灞炴�ф潵鎵撳紑mergeSql鍔熻兘锛涙參SQL璁板綍 + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + # 閰嶇疆DruidStatFilter + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" + # 閰嶇疆DruidStatViewServlet + stat-view-servlet: + enabled: true + url-pattern: /druid/* + reset-enable: false + login-username: admin + login-password: 123456 + + # Redis閰嶇疆 + redis: + host: 192.168.110.129 + port: 6379 + password: + database: 0 + timeout: 10000ms + lettuce: + pool: + max-active: 8 + max-wait: -1ms + max-idle: 8 + min-idle: 0 +# MinIO閰嶇疆 +minio: + endpoint: http://192.168.110.129:9000 + access-key: minioadmin + secret-key: minioadmin + bucket-name: web-manage + + diff --git a/target/classes/application.yml b/target/classes/application.yml new file mode 100644 index 0000000..52bb679 --- /dev/null +++ b/target/classes/application.yml @@ -0,0 +1,72 @@ +server: + port: 8080 + servlet: + context-path: /admin + +spring: + application: + name: web-manage-back + profiles: + active: dev + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + serialization: + write-dates-as-timestamps: false + #mcv閰嶇疆 + mvc: + pathmatch: + matching-strategy: ant_path_matcher + +# MyBatis Plus閰嶇疆 +mybatis-plus: + configuration: + # 寮�鍚┘宄板懡鍚� + map-underscore-to-camel-case: true + # 寮�鍚痵ql鏃ュ織 + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + # 涓婚敭绫诲瀷 + id-type: auto + # 閫昏緫鍒犻櫎閰嶇疆 + mapper-locations: classpath*:/mapper/**/*.xml + +# 鏃ュ織閰嶇疆 +logging: + level: + com.webmanage: debug + org.springframework.web: debug + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n" + +# Knife4j閰嶇疆 +knife4j: + enable: true + setting: + language: zh-CN + enable-swagger-models: true + enable-document-manage: true + swagger-model-name: 瀹炰綋绫诲垪琛� + basic: + enable: false + +# 璐墿杞﹂厤缃� +cart: + # Redis缂撳瓨杩囨湡鏃堕棿锛堝ぉ锛� + expire-days: 30 + # 鏄惁鍚敤鏁版嵁搴撴寔涔呭寲 + enable-persistence: true + # 鏄惁鍚敤鏁版嵁涓�鑷存�ф鏌� + enable-consistency-check: true + # 鍚屾绛栫暐锛歳ealtime锛堝疄鏃跺悓姝ワ級銆乥atch锛堟壒閲忓悓姝ワ級銆乵anual锛堟墜鍔ㄥ悓姝ワ級 + sync-strategy: realtime + async: + executor: + core-pool-size: 4 + max-pool-size: 16 + queue-capacity: 500 + keep-alive-seconds: 60 + thread-name-prefix: async-cart- + wait-for-tasks-to-complete-on-shutdown: true + await-termination-seconds: 30 -- Gitblit v1.8.0