diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml index c2a7cce4..366dd1f2 100644 --- a/hiver-admin/src/main/resources/application.yml +++ b/hiver-admin/src/main/resources/application.yml @@ -367,6 +367,8 @@ ignored: - /hiver/social/** - /hiver/ws/** - /hiver/setting/notice + - /hiver/setting/app-update/latest + - /hiver/setting/app-update/download - /hiver/common/** - /druid/** - /doc.html diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index 3557e0f9..6087dbba 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • -八月 11, 2026 15:27:11 +八月 13, 2026 11:52:38
  • @@ -84,7 +84,7 @@

    passTest

    -

    15:27:11 下午 / 0.038 secs

    +

    11:52:38 上午 / 0.033 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -08.11.2026 15:27:11 -08.11.2026 15:27:11 -0.038 secs +08.13.2026 11:52:38 +08.13.2026 11:52:39 +0.033 secs
    @@ -104,7 +104,7 @@ Pass - 15:27:11 + 11:52:39 Test passed @@ -128,13 +128,13 @@

    Started

    -

    八月 11, 2026 15:27:11

    +

    八月 13, 2026 11:52:38

    Ended

    -

    八月 11, 2026 15:27:11

    +

    八月 13, 2026 11:52:39

    diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/SettingConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/SettingConstant.java index f594c7ba..d96b1aa6 100644 --- a/hiver-core/src/main/java/cc/hiver/core/common/constant/SettingConstant.java +++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/SettingConstant.java @@ -138,4 +138,9 @@ public interface SettingConstant { * 鍏憡閰嶇疆 */ String NOTICE_SETTING = "NOTICE_SETTING"; + + /** + * APP鐑洿鏂伴厤缃 + */ + String APP_UPDATE_SETTING = "APP_UPDATE_SETTING"; } diff --git a/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java b/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java index 61a762f3..8f37a29a 100644 --- a/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java +++ b/hiver-core/src/main/java/cc/hiver/core/dao/UserDao.java @@ -45,7 +45,7 @@ public interface UserDao extends HiverBaseDao { * @param mobile * @return */ - @Query("select u from User u where u.mobile = ?1 and u.type = ?2 ") + @Query("select u from User u where u.mobile = ?1 and u.type like %?2% ") User findByMobile(String mobile,String type); /** diff --git a/hiver-core/src/main/java/cc/hiver/core/vo/AppUpdateSetting.java b/hiver-core/src/main/java/cc/hiver/core/vo/AppUpdateSetting.java new file mode 100644 index 00000000..b2abd017 --- /dev/null +++ b/hiver-core/src/main/java/cc/hiver/core/vo/AppUpdateSetting.java @@ -0,0 +1,21 @@ +package cc.hiver.core.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * APP鐑洿鏂伴厤缃 + */ +@Data +public class AppUpdateSetting implements Serializable { + @ApiModelProperty(value = "鐗堟湰鍙") + private String version; + + @ApiModelProperty(value = "wgt鍖呬笅杞藉湴鍧") + private String url; + + @ApiModelProperty(value = "鏂囦欢鍚") + private String fileName; +} diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/SettingController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/SettingController.java index 6812085e..23b424e8 100644 --- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/SettingController.java +++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/SettingController.java @@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -173,6 +175,35 @@ public class SettingController { return new ResultUtil().setData(noticeSetting); } + @RequestMapping(value = "/app-update", method = RequestMethod.GET) + @ApiOperation(value = "鏌ョ湅APP鐑洿鏂伴厤缃") + public Result appUpdate() { + AppUpdateSetting appUpdateSetting = getAppUpdateSetting(); + return new ResultUtil().setData(appUpdateSetting); + } + + @RequestMapping(value = "/app-update/latest", method = RequestMethod.GET) + @ApiOperation(value = "鏌ョ湅APP鏈鏂扮増鏈") + public Result appUpdateLatest() { + AppUpdateSetting appUpdateSetting = getAppUpdateSetting(); + if (appUpdateSetting == null || StrUtil.isBlank(appUpdateSetting.getVersion()) + || StrUtil.isBlank(appUpdateSetting.getUrl())) { + return new ResultUtil().setData(null); + } + return new ResultUtil().setData(appUpdateSetting); + } + + @RequestMapping(value = "/app-update/download", method = RequestMethod.GET) + @ApiOperation(value = "涓嬭浇APP鐑洿鏂板寘") + public void appUpdateDownload(HttpServletResponse response) throws IOException { + AppUpdateSetting appUpdateSetting = getAppUpdateSetting(); + if (appUpdateSetting == null || StrUtil.isBlank(appUpdateSetting.getUrl())) { + response.sendError(HttpServletResponse.SC_NOT_FOUND, "APP鐑洿鏂板寘涓嶅瓨鍦"); + return; + } + response.sendRedirect(appUpdateSetting.getUrl()); + } + @RequestMapping(value = "/oss/set", method = RequestMethod.POST) @ApiOperation(value = "OSS閰嶇疆") public Result ossSet(OssSetting ossSetting) { @@ -266,4 +297,25 @@ public class SettingController { settingService.saveOrUpdate(setting); return ResultUtil.data(null); } + + @RequestMapping(value = "/app-update/set", method = RequestMethod.POST) + @ApiOperation(value = "APP鐑洿鏂伴厤缃") + public Result appUpdateSet(AppUpdateSetting appUpdateSetting) { + if (appUpdateSetting == null || StrUtil.isBlank(appUpdateSetting.getVersion()) + || StrUtil.isBlank(appUpdateSetting.getUrl())) { + return ResultUtil.error("鐗堟湰鍙峰拰wgt鍖呭湴鍧涓嶈兘涓虹┖"); + } + Setting setting = settingService.get(SettingConstant.APP_UPDATE_SETTING); + setting.setValue(new Gson().toJson(appUpdateSetting)); + settingService.saveOrUpdate(setting); + return ResultUtil.data(null); + } + + private AppUpdateSetting getAppUpdateSetting() { + Setting setting = settingService.get(SettingConstant.APP_UPDATE_SETTING); + if (setting == null || StrUtil.isBlank(setting.getValue())) { + return null; + } + return new Gson().fromJson(setting.getValue(), AppUpdateSetting.class); + } } diff --git a/hiver-modules/hiver-file/src/main/java/cc/hiver/file/controller/UploadController.java b/hiver-modules/hiver-file/src/main/java/cc/hiver/file/controller/UploadController.java index cc484ca4..09977ef7 100644 --- a/hiver-modules/hiver-file/src/main/java/cc/hiver/file/controller/UploadController.java +++ b/hiver-modules/hiver-file/src/main/java/cc/hiver/file/controller/UploadController.java @@ -43,6 +43,8 @@ import java.io.InputStream; @RequestMapping("/hiver/upload") @Transactional public class UploadController { + private static final String APP_UPDATE_FILE_KEY = "merchant-app.wgt"; + @Value("${hiver.maxUploadFile:50}") private Long maxUploadFile; @@ -108,6 +110,47 @@ public class UploadController { return ResultUtil.data(result); } + @RequestMapping(value = "/app-update", method = RequestMethod.POST) + @ApiOperation(value = "APP鐑洿鏂板寘涓婁紶") + public Result uploadAppUpdate(@RequestParam(required = false) MultipartFile file, + HttpServletRequest request) { + if (file == null) { + return ResultUtil.error("缂哄皯鏂囦欢鍙傛暟"); + } + if (file.getSize() > maxUploadFile * 1024 * 1024) { + return ResultUtil.error("鏂囦欢澶у皬杩囧ぇ锛屼笉鑳借秴杩" + maxUploadFile + "MB"); + } + String originalFilename = file.getOriginalFilename(); + if (StrUtil.isBlank(originalFilename) || !originalFilename.toLowerCase().endsWith(".wgt")) { + return ResultUtil.error("鍙兘涓婁紶wgt鏍煎紡鐨勭儹鏇存柊鍖"); + } + Setting setting = settingService.get(SettingConstant.OSS_USED); + if (setting == null || StrUtil.isBlank(setting.getValue())) { + return ResultUtil.error(501, "鎮ㄨ繕鏈厤缃甇SS瀛樺偍鏈嶅姟"); + } + Boolean token = redisRaterLimiter.acquireByRedis("uploadAppUpdate:" + ipInfoUtil.getIpAddr(request), 50L, 1000L); + if (!token) { + throw new LimitException("涓婁紶閭d箞澶氬共鍢涳紝绛夌瓑鍐嶄紶鍚"); + } + String result = ""; + File f = new File(); + try { + InputStream inputStream = file.getInputStream(); + result = fileManageFactory.getFileManage(null).inputStreamUpload(inputStream, APP_UPDATE_FILE_KEY, file); + f.setLocation(getType(setting.getValue())).setTitle(originalFilename).setSize(file.getSize()) + .setType(file.getContentType()).setFKey(APP_UPDATE_FILE_KEY).setUrl(result).setCategoryId("app-update"); + fileService.save(f); + } catch (Exception e) { + log.error(e.toString()); + return ResultUtil.error(e.toString()); + } + if (setting.getValue().equals(SettingConstant.LOCAL_OSS)) { + OssSetting os = new Gson().fromJson(settingService.get(SettingConstant.LOCAL_OSS).getValue(), OssSetting.class); + result = os.getHttp() + os.getEndpoint() + "/" + f.getId(); + } + return ResultUtil.data(result); + } + public Integer getType(String type) { switch (type) { case SettingConstant.QINIU_OSS: diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallDeliveryOrderServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallDeliveryOrderServiceImpl.java index 139aec81..684dc6be 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallDeliveryOrderServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallDeliveryOrderServiceImpl.java @@ -1300,7 +1300,7 @@ public class MallDeliveryOrderServiceImpl extends ServiceImpl 0){ mallRefundRecord1.setRefundAmount(order.getTotalAmount().subtract(shopRefund)); }else{ diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallRefundRecordServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallRefundRecordServiceImpl.java index 2297ae1e..cd361f69 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallRefundRecordServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/MallRefundRecordServiceImpl.java @@ -138,17 +138,32 @@ public class MallRefundRecordServiceImpl extends ServiceImpl 0; } - private BigDecimal selectedGoodsPackageAmount(MallRefundRecord refundRecord) { + private BigDecimal selectedGoodsPackageAmount(MallOrder order, MallRefundRecord refundRecord) { + boolean includePackageFee = shouldIncludePackageFee(order); if (refundRecord == null || refundRecord.getItems() == null || refundRecord.getItems().isEmpty()) { + BigDecimal packageFee = includePackageFee + ? safeAmount(refundRecord == null ? null : refundRecord.getPackageFee()) + : BigDecimal.ZERO; return safeAmount(refundRecord == null ? null : refundRecord.getGoodsAmount()) - .add(safeAmount(refundRecord == null ? null : refundRecord.getPackageFee())); + .add(packageFee); } BigDecimal amount = BigDecimal.ZERO; for (MallReturnOrderGoods item : refundRecord.getItems()) { BigDecimal quantity = item.getQuantity() == null ? BigDecimal.ZERO : new BigDecimal(item.getQuantity()); - amount = amount.add(safeAmount(item.getPrice()).add(safeAmount(item.getPackageFee())).multiply(quantity)); + BigDecimal packageFee = includePackageFee ? safeAmount(item.getPackageFee()) : BigDecimal.ZERO; + amount = amount.add(safeAmount(item.getPrice()).add(packageFee).multiply(quantity)); } return amount.setScale(2, RoundingMode.HALF_UP); } @@ -379,7 +400,7 @@ public class MallRefundRecordServiceImpl extends ServiceImpl 0){ mallRefundRecord.setRefundAmount(mallRefundRecord.getRefundAmount() .subtract(mallRefundRecord.getRefundAmount().multiply(ratio)).setScale(2, RoundingMode.UP)); @@ -399,8 +420,9 @@ public class MallRefundRecordServiceImpl extends ServiceImpl 0){ mallRefundRecord.setRefundAmount(mallRefundRecord.getRefundAmount() .subtract(mallRefundRecord.getRefundAmount().multiply(ratio)).setScale(2, RoundingMode.UP)); @@ -414,14 +436,15 @@ public class MallRefundRecordServiceImpl extends ServiceImpl 0){ mallRefundRecord1.setRefundAmount(order.getTotalAmount().subtract(shopRefund)); @@ -488,7 +514,7 @@ public class MallRefundRecordServiceImpl extends ServiceImpl - AND d.transfer_delivery = #{q.transferDelivery} + AND d.transfer_delivery = #{q.transferDelivery} and d.status not in (-1,4) - AND d.transfer_arrive_time IS NULL + AND d.transfer_arrive_time IS NULL and d.status not in (-1,4) - AND d.transfer_arrive_time IS NOT NULL + AND d.transfer_arrive_time IS NOT NULL and d.status not in (-1,4) ORDER BY