Compare commits

...

30 Commits

Author SHA1 Message Date
sxu 94085f8868 drp test 2025-04-29 20:07:09 +08:00
liux 114e26f840 添加h5历史记录周菜谱 2025-04-29 19:12:43 +08:00
liux 8f6432ce38 Merge remote-tracking branch 'origin/ah-sbd-h5' into ah-sbd-h5 2025-04-29 17:46:46 +08:00
liux 85fd6a7868 添加h5历史记录周菜谱 2025-04-29 17:46:13 +08:00
sxu fe539b10e8 驿站退款 2025-04-28 17:24:14 +08:00
gaowdong 9af6395780 驿站付款 2025-04-28 16:48:00 +08:00
sxu abf7640c09 驿站付款 2025-04-28 13:34:22 +08:00
sxu ea0141db6d queryCustInfoDetailForApp 2025-04-27 17:36:46 +08:00
sxu b13833bbee queryCustInfoDetailForApp 2025-04-27 16:34:53 +08:00
sxu 61a5e02b85 测试 2025-04-27 12:51:56 +08:00
sxu 06444498d4 STAGE_SIGN_WHITE_LIST 2025-04-26 11:27:37 +08:00
sxu 3ab2fe439d 删除人员体检报告 2025-04-25 17:52:38 +08:00
sxu 50ab019747 retrunurl 2025-04-25 17:41:05 +08:00
gaowdong 79d970ad93 驿站付款退款 2025-04-25 16:59:23 +08:00
gaowdong 31fc69c7d7 驿站付款退款 2025-04-25 16:35:45 +08:00
gaowdong e43f3643f1 Merge remote-tracking branch 'origin/ah-sbd-h5' into ah-sbd-h5 2025-04-25 16:09:41 +08:00
gaowdong e17699338b 驿站付款退款 2025-04-25 16:09:26 +08:00
sxu bf95ef962f 密码复杂度 2025-04-25 16:08:52 +08:00
sxu 80f37489d3 returnurl 2025-04-25 15:30:38 +08:00
sxu b51e227ed5 returnurl 2025-04-25 14:56:07 +08:00
sxu c458cf1534 密码复杂度 2025-04-25 14:30:08 +08:00
sxu e742bdda37 保存人脸图片失败 2025-04-25 14:06:14 +08:00
sxu abb25643db 密码复杂度 2025-04-25 13:42:48 +08:00
gaowdong acdd2d197d 支付宝支付超时 2025-04-24 19:21:25 +08:00
gaowdong 4abcf5ea43 支付宝支付超时 2025-04-24 19:19:06 +08:00
gaowdong d17a802b56 5614 待支付订单无法取消和支付 2025-04-11 17:48:27 +08:00
gaowdong 227a591da7 5614 待支付订单无法取消和支付 2025-04-11 15:56:33 +08:00
gaowdong 46557a9a19 5614 待支付订单无法取消和支付 2025-04-11 15:55:42 +08:00
sxu 51b0c0bb21 http://192.168.0.14:1888/bug-view-5628.html 2025-04-10 18:28:46 +08:00
sxu 6552d03890 删除actuator 2025-04-03 10:11:47 +08:00
53 changed files with 2079 additions and 433 deletions

View File

@ -70,16 +70,16 @@ public class SM4EncryptUtils {
}
public static void main(String[] args) {
// System.out.println(sm4Encrypt("18110922397"));
// System.out.println(sm4Decrypt("J1KE3IyZqIqgWk09Z2gWpQ==##encrypted"));
System.out.println(sm4Encrypt("18715460609"));
System.out.println(sm4Decrypt("U5BAeCf7edMkUVVHGRBMSg==##encrypted"));
//
// System.out.println(sm4Encrypt("13866134935"));
// System.out.println(sm4Decrypt("29G1AUHDmLvPe1tt0t12Dw==##encrypted"));
String src = decryptBySm4("eNAwpvN8VcbRXal9POGGV5X5y4Pa9oPNn8ewmFkmn9q/EQavDKPbUSpHRc9iI8Yu\n",
String src = decryptBySm4("pr2IC0qcQR8qdVvkdVdyT/zx+NaKimm76M9FRfkop5+U/B2Crl8/Rq5VIHJACwfX",
Base64Decoder.decode("StqtdHhleMKClUGbmBqdrg=="));
System.out.println(src);
String src1 = decryptBySm4("Bkv90NIOHy70kV/ex7l6gaNx7Ir+L61MXjuTr55tXpRZtOOX8XKXqMqBAjBbGLLTlEBycUwDSHAq0Ndu6cEIOyqGLK5ClvqZjWiL/iwPnQ+IEEqA6uV4rWzFtNa9NanlpIo6kzNCXzxiQgFOxgHmI+8Sw8cAyzN7bKZ2dryLQLUD+B68YHwGnGKYuQObIebCPj/wIO1UhoTp9WZqLHog+JTF72cG4nd45JV1xsCbeV8zljplgDlzogWXwhyZHiaphu2O7Si2yfz9/7sIZNyHSF+3SW1OuBgobS5Ia3oxCsKQP+PeJt3P/iPULVJiJDssGVIdFUg9sLkkP6DluszK2T5BMInEutLwqtwwopX97uFLhisKr1LqTKODbnbMWPvJ5hL4GivwWNJVKvBqoYjN7UhupWcTvTAUsd4P0B9rECRB0zut2M2VbkmyQmZsgxoiU5mYoEaoxYunkShHeFZEv6aMpACa9M++7eOk6IAs4b4TUbTV75omnpa7H2g6mR+RKCN0oLhDmJ2LHmsJx/0nZsBmKiKZOTPpGJYJPmxVLT9SZPor2Bj7mO/KK5Hbzklbqn4Lv9l6nx3Xmrjs+LGighfMCBQQyPK2gwJDZapnhphkbTeFY50V60XVdvOZIPCiDzqAm/CkF7NuVSUSy0M24Kd9kYl3Sx+b4v3qTmT0zgaFHiHmkrooz/r1T5pLi3U5/OFAs0gTtYw+KH+hYlFJiAtNm47mBYBCECPfAlB0o1qdluMRDV5L/jv3Pa6hVUgUWhvxnhkX9lEcZgoirqRX6dTYFxYIC/oanmG+CYUnsc7vclvMwzIiDLDt1G6/U0a/hxwIo+kyYvH0EkaFPuT7/9t/hFOjAKfPRUpSzTP+2R6X92meYSMLsUodjW+YaiLre13mMyJ9XUhEnwXn1LxZS8w6L1HIa20UwQ+D6kSWgVp4BpSsAbATKXD5pe650Ky46RIhyEn9cIe0uTOjyoGeQG35so0ChJQE1aCUbipR6wm1THMl8ZqFBkPBQrj+TxvmweNMh99zzqiOeuUPdK4YSthCEzXR7Quby0IxN0pnTIs0Z+FCVdp6pEWoQaRhwIrXZ+bVjRH9XAD7lZbG7Ns2ZfNxah+iIOFdFA4xR/wEXF+31HUXAp+yZqZ61g7lBfhOO7wxyeqUAKlI897G8VpgU2APlwBfTVMTMFwx4HAA9basU6mZcS5UdP8MPJf3ChX25SbYVM3mJvZhdLyD4PoXhuRSQxp3JVgRwlKHEfwSqloGC1fm4WF53fdtHJGl4IIaBeMpoXNWddRe/YTRvi5ljl5Wrhidvu7xkDMXe8WyRQFEsRCR9vbv1z41guFb9bWCh5xbDdy9hQ2dV5J0j2JJnd+LmKf6Fv03Xz8kXxPkpONMVLSk1414P2gdavTgVBFqKKZORdhCCJXPgNy9dZ6ceL/SHG3rgoo8fz/BLhIvtW3OP3Kk+K1hTiKpFnZSc2iKXYRpK2nFikvN/glEgO8xeMtW/Zw3Uz3RhhP0Coqqne4yeNUnBSQLDPkNzoApj2fb983OERVfzs/dcnipJcLhgXFfvbg6vZwHg03EUQ5LALJmjCnJKG0Ubtxe0WPrnFuKafGv8A0RJ4m2kjaMm3M7VEnkNMUpX15RZt6Tm3KWMYejvMMfrTb+hBqFRYhDQ7gK8p2PgK+CuKfAFLWXva3TRI8R09EPqj49kQDHBSMpNgAVRf+3xByImQBufYr37z18ZkEb3ObhWHmc3krdgjJOVmu0sSUz/orEtaxh6CgJh36BQy4tg4Zs2SncFxTTDht84kH1+UJkl3BptHEZvo7pyRVmmCoRgHXSoB+fgNj0spgt/rWkId5KtuLf4L497qoGGMv24G7dElFJq4nrQmn12c76DvELpzKveNffMX/PDCVCqF2NuVH5scEMRt/RjikICzMkh/93L6QhuP/KuBYlisxNWAg3kTp7JE4gS8hoFN6YxMRNPVMAX3zY0DDr6Z4rbObCcnIrHpQGwcofPbpIhJsPxIn7Slig7SFWR9EBfiW5F7TxrF4WVYMowcWKsBJPcn6BHcjljdQ5KFtMFjt6suJxOEjcXl/8CQewd8jZ9uEyzyE6q+sWB4t7rxt7xVOswrLBXZncXdZVi3/a4HvJ46y8ev7I6IBVcvfSEAXQyt0Jny2M5lTlBUOHPmDzU18nYPSkSQmDlbk01XfjOwk0gYgSaCaBpADFYXviw3+8FdKHz46ijLt82X3gzxQDFbEa4iBDFy+z6COprPOuHNviqirh3NGyyGDyohgAaWyGNERxhtxY5WBq21B5ULXRFoRks1ai24NKcDU3EaeorD1hrabdbQ674Mx64y6siaDv2k7wfK7B8nEbnJoVoB1Nvd/9NmCT6sW+HHoqTQGX0pyV7TJYkvK2orUcfGXd/3GQ8G2xTLKrS6TZkPGtZnk+bumWjS1XVSLILFaEc1278p7Uu+lPrnLl/6gdJRO744IUFKfHzdpNAcXcQIhg/YBEKGVy/fNa0VrrFinsmZ/aan+ZropwYqx1YOoeNwzYBSogKP3rdHLO38xcCpqxMtfTDwFdvxBEiMyjRel4HETzo2H1PAmv20ZhoFCCc7Gha/mMUgCnMiuR7EbKPj9tihE7mMPZn00hbZ+5wubdqS6A7AAOUKp2Ns3sDZC/qDm7F4aYZThYWH8mx7oWPngwM9omVLsvy/04IUH8LuJZeGp5H2Bc/MqNMAV34hDa6scIiW5iQn4=",
String src1 = decryptBySm4("pqiIyu7z2qPvINrf73938NyUAqooHQl3cm3gyZtdgY1+t/1HnHININ0DEO35gmnvu1XHp00JQGTkCpYAWqO6XFIUAR/TbHSKBamffOQ0VtE2a3sgYlVs21gC19B/wKKB1xd3x1jIt8svXYd4SWOlAW1gnVSSgvXxa5nqoTZeH1sARkx46xV4U/g+sJ1yi8snW9pNey1fUORzl4VD7D+ojSRuhQYUUfUDXlYX5zQMJCX+MmzzNv/OMq5+mBpgsn2P",
Base64Decoder.decode(src));
System.out.println(src1);

View File

@ -50,10 +50,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<!-- Swagger UI -->
<dependency>

View File

@ -50,10 +50,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<!-- Swagger UI -->
<dependency>

View File

@ -1,8 +1,12 @@
package com.bonus.canteen.core.allocation.api;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.common.enums.AllocBusinessStateEnum;
import com.bonus.canteen.core.order.utils.LeNumUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.houqin.constant.LeConstants;
import com.bonus.canteen.core.allocation.canteen.model.AllocCanteen;
import com.bonus.canteen.core.allocation.canteen.model.AllocMealLine;
@ -11,12 +15,14 @@ import com.bonus.canteen.core.allocation.canteen.service.AllocCanteenService;
import com.bonus.canteen.core.allocation.canteen.service.AllocMealLineService;
import com.bonus.canteen.core.allocation.canteen.vo.AllocAreaFullNameVO;
import com.bonus.canteen.core.menu.vo.AppletReserveCanteenVO;
import com.bonus.common.houqin.i18n.I18n;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.time.LocalTime;
import java.util.List;
import java.util.Set;
@ -78,30 +84,30 @@ public class AllocCanteenApi {
public AllocCanteen getAllocCanteen(Long canteenId) {
return this.allocCanteenService.getAllocCanteenCache(canteenId);
}
//
// public void checkCanteenBusinessState(Long canteenId, LocalTime checkTime) {
// if (!LeNumUtil.isValidId(canteenId)) {
// log.warn("食堂id不合法,无法校验营业状态");
// } else {
// AllocCanteen allocCanteen = this.getAllocCanteen(canteenId);
// if (!LeConstants.COMMON_YES.equals(allocCanteen.getIfDel()) && AllocBusinessStateEnum.OPEN.getKey().equals(allocCanteen.getBusinessState())) {
// if (!ObjectUtil.isNull(checkTime)) {
// if (!ObjectUtil.isNull(allocCanteen.getStartBusinessTime()) && !ObjectUtil.isNull(allocCanteen.getEndBusinessTime())) {
// if (allocCanteen.getStartBusinessTime().isAfter(allocCanteen.getEndBusinessTime())) {
// if (checkTime.isBefore(allocCanteen.getStartBusinessTime()) && checkTime.isAfter(allocCanteen.getEndBusinessTime())) {
// throw new LeException(I18n.getMessage("alloc_canteen_is_rest", new Object[]{allocCanteen.getCanteenName()}));
// }
// } else if (checkTime.isBefore(allocCanteen.getStartBusinessTime()) || checkTime.isAfter(allocCanteen.getEndBusinessTime())) {
// throw new LeException(I18n.getMessage("alloc_canteen_is_rest", new Object[]{allocCanteen.getCanteenName()}));
// }
//
// }
// }
// } else {
// throw new LeException(I18n.getMessage("alloc_canteen_is_rest", new Object[]{allocCanteen.getCanteenName()}));
// }
// }
// }
public void checkCanteenBusinessState(Long canteenId, LocalTime checkTime) {
if (!LeNumUtil.isValidId(canteenId)) {
log.warn("食堂id不合法,无法校验营业状态");
} else {
AllocCanteen allocCanteen = this.getAllocCanteen(canteenId);
if (!LeConstants.COMMON_YES.equals(allocCanteen.getIfDel()) && AllocBusinessStateEnum.OPEN.getKey().equals(allocCanteen.getBusinessState())) {
if (!ObjectUtil.isNull(checkTime)) {
if (!ObjectUtil.isNull(allocCanteen.getStartBusinessTime()) && !ObjectUtil.isNull(allocCanteen.getEndBusinessTime())) {
if (allocCanteen.getStartBusinessTime().isAfter(allocCanteen.getEndBusinessTime())) {
if (checkTime.isBefore(allocCanteen.getStartBusinessTime()) && checkTime.isAfter(allocCanteen.getEndBusinessTime())) {
throw new ServiceException(I18n.getMessage("alloc_canteen_is_rest", allocCanteen.getCanteenName()));
}
} else if (checkTime.isBefore(allocCanteen.getStartBusinessTime()) || checkTime.isAfter(allocCanteen.getEndBusinessTime())) {
throw new ServiceException(I18n.getMessage("alloc_canteen_is_rest", allocCanteen.getCanteenName()));
}
}
}
} else {
throw new ServiceException(I18n.getMessage("alloc_canteen_is_rest", allocCanteen.getCanteenName()));
}
}
}
//
// public AllocStall getAllocStall(Long stallId) {
// return this.allocStallService.getAllocStallCache(stallId);

View File

@ -0,0 +1,6 @@
package com.bonus.canteen.core.common.constant;
public interface OrderConstant {
Integer DEFAULT_APPLET_BOOK_TIME_LIMIT = 24;
Integer DEFAULT_APPLET_BOOK_DAY_LIMIT = 7;
}

View File

@ -63,6 +63,11 @@ public class HeaderFetchUtil {
return NumberUtil.isNumber(value) ? Integer.valueOf(value) : null;
}
public static String getSign(Map<String, String> headers) {
String value = getValueFromHeadersIgnoreCase(headers, "sign");
return value;
}
public static String getValueFromHeadersIgnoreCase(Map<String, String> headers, String targetKey) {
if (CollUtil.isEmpty(headers)) {
return null;

View File

@ -3,6 +3,7 @@ package com.bonus.canteen.core.customer.controller;
import com.bonus.canteen.core.common.base.BaseController;
import com.bonus.canteen.core.customer.dto.*;
import com.bonus.canteen.core.customer.vo.PageCustInfoPhotoVO;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.houqin.constant.SourceTypeEnum;
@ -20,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import static com.bonus.canteen.core.common.encrypt.SM4EncryptUtils.sm4Encrypt;
import static com.bonus.common.core.utils.PageUtils.startPage;
import static com.bonus.common.core.web.domain.AjaxResult.success;
import static com.bonus.canteen.core.common.encrypt.SM4EncryptUtils.sm4Decrypt;
@ -87,6 +89,9 @@ public class CustInfoController extends BaseController {
Integer sourceType = this.getSourceTypeByHeaders(headers);
sourceType = Objects.isNull(sourceType) ? SourceTypeEnum.HT_H5_MOBILE.getKey() : sourceType;
AjaxResult ar = new AjaxResult();
if (StringUtils.isNotEmpty(custInfo.getMobile())) {
custInfo.setMobile(sm4Encrypt(custInfo.getMobile()));
}
CustInfoVo result = this.custInfoService.queryCustInfoDetail(custInfo, sourceType);
//System.out.println(sm4Decrypt("29G1AUHDmLvPe1tt0t12Dw==##encrypted"));
result.setMobile(sm4Decrypt(result.getMobile()));

View File

@ -39,8 +39,8 @@ public class CustPhotoController extends BaseController {
return this.custPhotoService.appletRegisterAndSaveFaceInfo(dto);
}
} catch (Exception e) {
log.error("小程序保存人脸图片失败", e);
return AjaxResult.error("小程序保存人脸图片失败");
log.error("保存人脸图片失败", e);
return AjaxResult.error("保存人脸图片失败");
}
}

View File

@ -23,10 +23,11 @@ public class CustInfo {
@ApiModelProperty("主键自增")
private Long id;
@ApiModelProperty("人员id")
private @NotNull(
message = "{customer.id.nonNull}",
groups = {ValidationGroups.Update.class, ValidationGroups.Delete.class}
) Long custId;
// private @NotNull(
// message = "{customer.id.nonNull}",
// groups = {ValidationGroups.Update.class, ValidationGroups.Delete.class}
//)
Long custId;
@ApiModelProperty("人员编号")
private @NotNull(
message = "{customer.num.nonNull}",

View File

@ -50,6 +50,7 @@ import com.bonus.common.houqin.domain.SmsCodeVerifyDTO;
import com.bonus.common.houqin.utils.AesEncryptUtil;
import com.bonus.common.houqin.utils.LeBeanUtil;
import com.bonus.common.houqin.utils.id.Id;
import com.bonus.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -156,7 +157,11 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
protected CustInfoVo getNormalCustInfoDetail(CustInfo custInfo, Integer sourceType) {
custInfo.setCustState(PersonalStatusEnum.NORMAL.getKey());
CustInfoVo custInfoVo = custInfoMapper.queryCustInfoDetail(custInfo);
return addOrUpdateCustCasual(custInfoVo, sourceType);
if (ObjectUtil.isNotNull(custInfoVo)) {
return addOrUpdateCustCasual(custInfoVo, sourceType);
} else {
return null;
}
}
public CustInfoVo addOrUpdateCustCasual(CustInfoVo custInfoVo, Integer sourceType) {
@ -205,6 +210,31 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
content.setNewPassword(AesEncryptUtil.aesDecode(content.getNewPassword()));
String oldPassword = content.getOldPassword();
String newPassword = content.getNewPassword();
// 1. 检查密码长度
log.error("开始验证密码长度");
if (!isPasswordLengthValid(newPassword)) {
return AjaxResult.error(500, "密码长度应为6至16位");
}
// 2. 检查密码字符类型
log.error("开始验证密码字符");
if (!isPasswordCharacterValid(newPassword)) {
return AjaxResult.error(500, "密码必须包含大、小字母、数字、特殊字符!");
}
// 3. 检查常见弱密码
log.error("开始验证弱密码片段");
if (containsWeakPassword(newPassword.toLowerCase())) {
return AjaxResult.error(500, "密码包含常见的弱密码片段!");
}
// 4. 检查连续字符
log.error("开始验证密码连续字符");
if (containsConsecutiveCharacters(newPassword.toLowerCase(), 3)) {
return AjaxResult.error(500, "密码不能包含超过3位连续字符");
}
// 5. 检查新旧密码是否相同
log.error("开始验证新旧密码");
if (StringUtils.isNotEmpty(oldPassword) && SecurityUtils.matchesPassword(newPassword, oldPassword)) {
return AjaxResult.error(500, "新密码不能与原密码相同!");
}
if (Objects.equals(oldPassword, newPassword)) {
log.error("小程序修改密码错误:两次密码不能一致");
ajaxResult.put("msg", "小程序修改密码错误:两次密码不能一致");
@ -230,12 +260,199 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
return ajaxResult;
}
// public static void main(String[] args) {
// BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
// boolean flag = bCrypt.matches("Bonus$2026", "$2a$10$vrcmG0TyvgH5tS9g8ptaVOK2K3pYWVAa13SWEK7pQBGRtNAPlGV7O");
// System.out.println(flag);
// public AjaxResult validatePassword(String oldPassword, String newPassword) {
// // 1. 检查密码长度
// log.error("开始验证密码长度");
// if (!isPasswordLengthValid(newPassword)) {
// return AjaxResult.error(500, "密码长度应为6至16位");
// }
//
// // 2. 检查密码字符类型
// log.error("开始验证密码字符");
// if (!isPasswordCharacterValid(newPassword)) {
// return AjaxResult.error(500, "密码必须包含大、小字母、数字、特殊字符!");
// }
//
// // 3. 检查常见弱密码
// log.error("开始验证弱密码片段");
// if (containsWeakPassword(newPassword.toLowerCase())) {
// return AjaxResult.error(500, "密码包含常见的弱密码片段!");
// }
//
// // 4. 检查连续字符
// log.error("开始验证密码连续字符");
// if (containsConsecutiveCharacters(newPassword.toLowerCase(), 3)) {
// return AjaxResult.error(500, "密码不能包含超过3位连续字符");
// }
//
// // 5. 检查新旧密码是否相同
// log.error("开始验证新旧密码");
// if (StringUtils.isNotEmpty(oldPassword) && SecurityUtils.matchesPassword(newPassword, oldPassword)) {
// return AjaxResult.error(500, "新密码不能与原密码相同!");
// }
//
// log.error("完成密码复杂度验证");
// return AjaxResult.success();
// }
private boolean isPasswordLengthValid(String password) {
return password.length() >= 6 && password.length() <= 16;
}
private boolean isPasswordCharacterValid(String password) {
boolean hasUpperCase = false, hasLowerCase = false, hasDigit = false, hasSpecialChar = false;
for (char c : password.toCharArray()) {
if (Character.isUpperCase(c)) {
hasUpperCase = true;
}
if (Character.isLowerCase(c)) {
hasLowerCase = true;
}
if (Character.isDigit(c)) {
hasDigit = true;
}
if ("!@#$%^&*()-_=+[{]};:'\",<.>/?".indexOf(c) >= 0) {
hasSpecialChar = true;
}
}
if (!hasUpperCase) {
return false;
}
if (!hasLowerCase) {
return false;
}
if (!hasDigit) {
return false;
}
return !(true && !hasSpecialChar);
}
private boolean containsWeakPassword(String password) {
Set<String> weakPasswords = new HashSet<>(Arrays.asList("111",
"888",
"123",
"234",
"345",
"456",
"567",
"678",
"789",
"1234",
"2345",
"3456",
"4567",
"5678",
"6789",
"abc",
"abcd",
"abcde",
"abcdef",
"abcdefg",
"qwe",
"qwer",
"qwert",
"qwerty",
"asdf",
"asdfg",
"asdfgh",
"password",
"passw0rd",
"letmein",
"welcome",
"admin",
"user",
"test",
"pass",
"root",
"login"));
for (String weakPwd : weakPasswords) {
if (password.contains(weakPwd)) {
return true;
}
}
return false;
}
/**
* 检查密码中是否包含超过 n 个连续相同字符连续递增/递减的数字或字母不区分大小写
*/
private boolean containsConsecutiveCharacters(String password, int n) {
// 检查连续相同字符
n = n + 1;
for (int i = 0; i <= password.length() - n; i++) {
boolean consecutiveSameChar = true;
for (int j = 1; j < n; j++) {
if (password.charAt(i + j) != password.charAt(i)) {
consecutiveSameChar = false;
break;
}
}
if (consecutiveSameChar) {
return true; // 包含超过 n 个连续相同字符
}
}
// 检查连续递增或递减的数字
for (int i = 0; i <= password.length() - n; i++) {
boolean consecutiveIncreasing = true;
boolean consecutiveDecreasing = true;
for (int j = 1; j < n; j++) {
char currentChar = password.charAt(i);
char nextChar = password.charAt(i + j);
// 检查数字递增或递减
if (Character.isDigit(currentChar) && Character.isDigit(nextChar)) {
if (nextChar != currentChar + j) {
consecutiveIncreasing = false;
}
if (nextChar != currentChar - j) {
consecutiveDecreasing = false;
}
} else {
consecutiveIncreasing = false;
consecutiveDecreasing = false;
break;
}
}
if (consecutiveIncreasing || consecutiveDecreasing) {
return true; // 包含超过 n 个递增或递减的连续数字
}
}
// 检查连续递增或递减的字母不区分大小写
for (int i = 0; i <= password.length() - n; i++) {
boolean consecutiveIncreasing = true;
boolean consecutiveDecreasing = true;
for (int j = 1; j < n; j++) {
char currentChar = Character.toLowerCase(password.charAt(i)); // 转为小写
char nextChar = Character.toLowerCase(password.charAt(i + j)); // 转为小写
// 检查字母递增或递减
if (Character.isLetter(currentChar) && Character.isLetter(nextChar)) {
if (nextChar != currentChar + j) {
consecutiveIncreasing = false;
}
if (nextChar != currentChar - j) {
consecutiveDecreasing = false;
}
} else {
consecutiveIncreasing = false;
consecutiveDecreasing = false;
break;
}
}
if (consecutiveIncreasing || consecutiveDecreasing) {
// 包含超过 n 个递增或递减的连续字母
return true;
}
}
// 不包含连续相同字符数字或字母序列
return false;
}
@Override
public AjaxResult custForgetPassword(CustForgetPasswordDTO content) {
AjaxResult ajaxResult = new AjaxResult();
@ -258,6 +475,26 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
ajaxResult.put("code", "500");
} else {
String newPassword = content.getNewPassword();
// 1. 检查密码长度
log.error("开始验证密码长度");
if (!isPasswordLengthValid(newPassword)) {
return AjaxResult.error(500, "密码长度应为6至16位");
}
// 2. 检查密码字符类型
log.error("开始验证密码字符");
if (!isPasswordCharacterValid(newPassword)) {
return AjaxResult.error(500, "密码必须包含大、小字母、数字、特殊字符!");
}
// 3. 检查常见弱密码
log.error("开始验证弱密码片段");
if (containsWeakPassword(newPassword.toLowerCase())) {
return AjaxResult.error(500, "密码包含常见的弱密码片段!");
}
// 4. 检查连续字符
log.error("开始验证密码连续字符");
if (containsConsecutiveCharacters(newPassword.toLowerCase(), 3)) {
return AjaxResult.error(500, "密码不能包含超过3位连续字符");
}
BCryptPasswordEncoder bCrypt = new BCryptPasswordEncoder();
String password = bCrypt.encode(newPassword);
custInfo.setPwd(password);

View File

@ -0,0 +1,39 @@
package com.bonus.canteen.core.drp.controller;
import com.bonus.canteen.core.drp.dto.AndroidSearchMaterialDTO;
import com.bonus.canteen.core.drp.service.AndroidInventoryService;
import com.bonus.canteen.core.drp.vo.AndroidSearchMaterialVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.validation.Valid;
import lombok.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping({"/api/v1/android/inventory"})
@Api(
value = "gyp-电子秤设备接口",
tags = {"gyp-电子秤设备接口"}
)
public class AndroidInventoryController {
@Generated
private static final Logger log = LoggerFactory.getLogger(AndroidInventoryController.class);
@Autowired
@Lazy
private AndroidInventoryService androidInventoryService;
@PostMapping({"/search/material"})
@ApiOperation("电子秤/手持机-根据原料名称模糊查询原料配置信息")
public List<AndroidSearchMaterialVO> searchMaterial(@RequestBody @Valid AndroidSearchMaterialDTO dto) {
return this.androidInventoryService.searchMaterial(dto);
}
}

View File

@ -0,0 +1,58 @@
package com.bonus.canteen.core.drp.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import lombok.Generated;
public class AndroidSearchMaterialDTO implements Serializable {
@ApiModelProperty("原料名称")
private String materialName;
@ApiModelProperty("原料编码")
private String materialCode;
@ApiModelProperty("原料类别id集合")
private List<Long> categoryIdList;
@ApiModelProperty("条码")
private String barCode;
@Generated
public String getMaterialName() {
return this.materialName;
}
@Generated
public String getMaterialCode() {
return this.materialCode;
}
@Generated
public List<Long> getCategoryIdList() {
return this.categoryIdList;
}
@Generated
public String getBarCode() {
return this.barCode;
}
@Generated
public void setMaterialName(final String materialName) {
this.materialName = materialName;
}
@Generated
public void setMaterialCode(final String materialCode) {
this.materialCode = materialCode;
}
@Generated
public void setCategoryIdList(final List<Long> categoryIdList) {
this.categoryIdList = categoryIdList;
}
@Generated
public void setBarCode(final String barCode) {
this.barCode = barCode;
}
}

View File

@ -2,7 +2,9 @@ package com.bonus.canteen.core.drp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.drp.dto.AndroidSearchMaterialDTO;
import com.bonus.canteen.core.drp.model.DrpInventory;
import com.bonus.canteen.core.drp.vo.AndroidSearchMaterialVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -21,9 +23,9 @@ public interface DrpInventoryMapper extends BaseMapper<DrpInventory> {
//
// @Select({"select category_id id, parent_id, category_name from menu_material_category where del_flag = #{delFlag}"})
// List<MenuCategoryTreeVO> selectCategoryTree(Integer delFlag);
//
// List<AndroidSearchMaterialVO> selectAndroidMaterialList(@Param("content") AndroidSearchMaterialDTO content, @Param("pinyinInitials") String pinyinInitials, @Param("pinyinFull") String pinyinFull, @Param("delFlag") Integer delFlag);
//
List<AndroidSearchMaterialVO> selectAndroidMaterialList(@Param("content") AndroidSearchMaterialDTO content, @Param("pinyinInitials") String pinyinInitials, @Param("pinyinFull") String pinyinFull, @Param("delFlag") Integer delFlag);
// List<AndroidSearchInventoryMaterialVO> searchInventoryMaterial(@Param("content") AndroidSearchInventoryMaterialDTO content, @Param("pinyinInitials") String pinyinInitials, @Param("pinyinFull") String pinyinFull, @Param("delFlag") Integer delFlag);
//
// InventoryModel getInventoryNumByMaterialId(@Param("materialId") Long materialId, @Param("warehouseId") Long warehouseId, @Param("unitId") Long unitId);

View File

@ -0,0 +1,31 @@
package com.bonus.canteen.core.drp.service;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.drp.dto.AndroidSearchMaterialDTO;
import com.bonus.canteen.core.drp.mapper.DrpInventoryMapper;
import com.bonus.canteen.core.drp.vo.AndroidSearchMaterialVO;
import com.bonus.common.houqin.constant.DelFlagEnum;
import lombok.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class AndroidInventoryService {
@Generated
private static final Logger log = LoggerFactory.getLogger(AndroidInventoryService.class);
@Autowired
@Lazy
private DrpInventoryMapper drpInventoryMapper;
public List<AndroidSearchMaterialVO> searchMaterial(AndroidSearchMaterialDTO content) {
String materialName = ObjectUtil.isNull(content.getMaterialName()) ? "" : content.getMaterialName();
return this.drpInventoryMapper.selectAndroidMaterialList(content, materialName.toUpperCase(), materialName.toLowerCase(), DelFlagEnum.DEL_FALSE.key());
}
}

View File

@ -0,0 +1,157 @@
package com.bonus.canteen.core.drp.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import lombok.Generated;
@ApiModel("根据原料名称模糊查询原料配置信息")
public class AndroidSearchMaterialVO implements Serializable {
@ApiModelProperty("原料id")
private Long materialId;
@ApiModelProperty("原料名称")
private String materialName;
@ApiModelProperty("原料编码")
private String materialCode;
@ApiModelProperty("类别名称")
private String categoryName;
@ApiModelProperty("供应商id")
private Long supplierId;
@ApiModelProperty("供应商名称")
private String supplierName;
@ApiModelProperty("计量单位id")
private Long unitId;
@ApiModelProperty("计量单位名称")
private String unitName;
@ApiModelProperty("单位类型(1-按份,2-称重)")
private Integer weighType;
@ApiModelProperty("换算比率(换算成?g)")
private BigDecimal rate;
@ApiModelProperty("参考价格")
private Integer unitPrice;
@ApiModelProperty("到期时间(保质期)")
private LocalDate expireTime;
@Generated
public Long getMaterialId() {
return this.materialId;
}
@Generated
public String getMaterialName() {
return this.materialName;
}
@Generated
public String getMaterialCode() {
return this.materialCode;
}
@Generated
public String getCategoryName() {
return this.categoryName;
}
@Generated
public Long getSupplierId() {
return this.supplierId;
}
@Generated
public String getSupplierName() {
return this.supplierName;
}
@Generated
public Long getUnitId() {
return this.unitId;
}
@Generated
public String getUnitName() {
return this.unitName;
}
@Generated
public Integer getWeighType() {
return this.weighType;
}
@Generated
public BigDecimal getRate() {
return this.rate;
}
@Generated
public Integer getUnitPrice() {
return this.unitPrice;
}
@Generated
public LocalDate getExpireTime() {
return this.expireTime;
}
@Generated
public void setMaterialId(final Long materialId) {
this.materialId = materialId;
}
@Generated
public void setMaterialName(final String materialName) {
this.materialName = materialName;
}
@Generated
public void setMaterialCode(final String materialCode) {
this.materialCode = materialCode;
}
@Generated
public void setCategoryName(final String categoryName) {
this.categoryName = categoryName;
}
@Generated
public void setSupplierId(final Long supplierId) {
this.supplierId = supplierId;
}
@Generated
public void setSupplierName(final String supplierName) {
this.supplierName = supplierName;
}
@Generated
public void setUnitId(final Long unitId) {
this.unitId = unitId;
}
@Generated
public void setUnitName(final String unitName) {
this.unitName = unitName;
}
@Generated
public void setWeighType(final Integer weighType) {
this.weighType = weighType;
}
@Generated
public void setRate(final BigDecimal rate) {
this.rate = rate;
}
@Generated
public void setUnitPrice(final Integer unitPrice) {
this.unitPrice = unitPrice;
}
@Generated
public void setExpireTime(final LocalDate expireTime) {
this.expireTime = expireTime;
}
}

View File

@ -4,6 +4,8 @@ import com.bonus.canteen.core.menu.vo.AppletReserveCanteenVO;
import com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
@ -15,4 +17,10 @@ public interface MenuAppRecipeMapper {
List<AppletReserveCanteenVO> selectReserveMealCanteenList(@Param("effIdSet") Set<Long> effIdSet);
List<Long> selectWeekRecipeIdHistory(@Param("recipeIdList") List<Long> recipeId, @Param("effIdSet") Set<Long> effIdSet, @Param("applyDate") LocalDate applyDate);
List<Long> getRecipeIdListByRecipeId(@Param("recipeId") Long recipeId);
String getBingTimeByRecipeId(@Param("recipeId") Long recipeId);
}

View File

@ -152,9 +152,10 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
@Override
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
System.err.println("档口id集合: " + effIdSet.size());
List<Long> recipeIdList = Lists.newArrayList();
if (ObjectUtil.isNull(content.getRecipeId())) {
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
if (ObjectUtil.isEmpty(effIdSet)) {
effIdSet = Sets.newTreeSet();
((Set) effIdSet).add(-1L);
@ -165,7 +166,41 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
return Lists.newArrayList();
}
} else {
((List) recipeIdList).add(content.getRecipeId());
LocalDate applyDate = LocalDate.parse(content.getDate());
LocalDate now = LocalDate.now();
if (applyDate.isBefore(now)) {
System.out.println("applyDate 早于当前日期");
//获取当前菜谱绑定的日期
String bindTime = this.menuAppRecipeMapper.getBingTimeByRecipeId(content.getRecipeId());
if(bindTime !=null){
bindTime = bindTime.substring(0,10);
LocalDate bindDate = LocalDate.parse(bindTime);
System.out.println("Parsed date and time: " + bindDate);
if(bindDate.isBefore(applyDate)){
System.out.println("绑定日期早于查询历史信息日期");
recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeId(content.getRecipeId(), effIdSet);
}else{
System.out.println("绑定日期迟于查询历史信息日期");
List<Long> repeIdList = this.menuAppRecipeMapper.getRecipeIdListByRecipeId(content.getRecipeId());
recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeIdHistory(repeIdList, null,applyDate);
if(recipeIdList == null || recipeIdList.size() == 0){
((List) recipeIdList).add(content.getRecipeId());
}
}
}
} else if (applyDate.isAfter(now)) {
System.out.println("applyDate 晚于当前日期");
recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeId(content.getRecipeId(), effIdSet);
} else {
System.out.println("applyDate 等于当前日期");
recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeId(content.getRecipeId(), effIdSet);
}
if(recipeIdList == null || recipeIdList.size() == 0){
throw new ServiceException("本档口没有更早的历史菜谱记录");
// recipeIdList.add(content.getRecipeId());
}
// ((List) recipeIdList).add(content.getRecipeId());
}
this.generateRecipe((List) recipeIdList, content.getApplyDate());

View File

@ -71,8 +71,8 @@ public class HealthMobileMedicalReportController {
@PostMapping({"/delete-medicalreport"})
// @RequiresGuest
@ApiOperation("删除人员体检报告")
public void deleteMedicalReport(Long medicalId) {
this.healthCustMedicalReportService.deleteMedicalReport(medicalId);
public void deleteMedicalReport(@RequestBody HealthCustMedicalReportEditDTO dto) {
this.healthCustMedicalReportService.deleteMedicalReport(dto.getMedicalId());
}
protected String getOpenidByHeaders(Map<String, String> headers) {

View File

@ -2,13 +2,15 @@ package com.bonus.canteen.core.order.common.business;
import com.bonus.canteen.core.order.common.constants.OrderRefundBizEnum;
import com.bonus.canteen.core.order.common.dto.OrderRefundParam;
import com.bonus.canteen.core.order.common.dto.StageRefundParam;
import com.bonus.canteen.core.order.common.model.OrderInfo;
import com.bonus.canteen.core.order.common.vo.OrderRefundResultVO;
import com.bonus.canteen.core.pay.api.vo.UnifyRefundVO;
import java.util.List;
public interface OrderRefundBusiness {
// void orderCancel(OrderInfo orderInfo);
void orderCancel(OrderInfo orderInfo);
OrderRefundResultVO orderRefund(OrderRefundParam refundParam, OrderRefundBizEnum biz);
@ -21,4 +23,5 @@ public interface OrderRefundBusiness {
// void didEndOrderRefundFlow(Long orderRefundId, boolean isPass, String remark);
//
// void transferUncheckCorrectAfterOrderCreated(String macOrderId);
UnifyRefundVO stageRefund(StageRefundParam stageRefundParam);
}

View File

@ -5,6 +5,9 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import com.bonus.canteen.core.order.common.dto.StageRefundParam;
import com.bonus.canteen.core.pay.common.model.TradeRecord;
import com.bonus.canteen.core.pay.common.service.TradeRecordService;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.common.houqin.constant.LeConstants;
@ -133,21 +136,24 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness {
@Autowired
@Lazy
protected AllocHolidayApi allocHolidayApi;
@Lazy
@Autowired
protected TradeRecordService tradeRecordService;
// public void orderCancel(OrderInfo orderInfo) {
// if (!this.orderCustomBusiness.refund().willCancelOrder(orderInfo)) {
// this.orderCustomBusiness.refund().didCancelOrder(orderInfo);
// } else {
// orderInfo.setOrderState(OrderStateEnum.CANCEL.getKey());
// orderInfo.setPayState(PayStateEnum.PAY_CLOSE.getKey());
// this.orderInfoService.updateOrderState(orderInfo.getOrderId(), orderInfo.getOrderDate(), orderInfo.getPayState(), orderInfo.getOrderState(), (Integer)null, (String)null);
// List<OrderDetail> orderDetailList = this.orderDetailService.getOrderDetailList(orderInfo.getOrderId(), orderInfo.getOrderDate());
// this.marketApi.disableMarketRecord(CollUtil.toList(new Long[]{orderInfo.getOrderId()}));
// this.orderPlaceBusiness.inventoryRestore(orderInfo, orderDetailList);
// OrderMessageSend.orderV3Canceled(orderInfo, orderDetailList);
// this.orderCustomBusiness.refund().didCancelOrder(orderInfo);
// }
// }
public void orderCancel(OrderInfo orderInfo) {
if (!this.orderCustomBusiness.refund().willCancelOrder(orderInfo)) {
this.orderCustomBusiness.refund().didCancelOrder(orderInfo);
} else {
orderInfo.setOrderState(OrderStateEnum.CANCEL.getKey());
orderInfo.setPayState(PayStateEnum.PAY_CLOSE.getKey());
this.orderInfoService.updateOrderState(orderInfo.getOrderId(), orderInfo.getOrderDate(), orderInfo.getPayState(), orderInfo.getOrderState(), (Integer)null, (String)null);
List<OrderDetail> orderDetailList = this.orderDetailService.getOrderDetailList(orderInfo.getOrderId(), orderInfo.getOrderDate());
this.marketApi.disableMarketRecord(CollUtil.toList(new Long[]{orderInfo.getOrderId()}));
this.orderPlaceBusiness.inventoryRestore(orderInfo, orderDetailList);
OrderMessageSend.orderV3Canceled(orderInfo, orderDetailList);
this.orderCustomBusiness.refund().didCancelOrder(orderInfo);
}
}
public OrderRefundResultVO orderRefund(OrderRefundParam refundParam, OrderRefundBizEnum biz) {
LogUtil.info("[订单退款]入参:", refundParam, biz);
@ -197,6 +203,21 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness {
return var8;
}
@Override
public UnifyRefundVO stageRefund(StageRefundParam stageRefundParam) {
LogUtil.printArgsIn("stagePayRefund", stageRefundParam);
TradeRecord tradeRecord = tradeRecordService.getTradeRecordById(stageRefundParam.getTradeId());
if (tradeRecord == null) {
log.error("[统一支付退款]交易记录不存在");
throw new ServiceException("交易记录不存在");
}
UnifyRefundDTO payRefundDTO = new UnifyRefundDTO();
payRefundDTO.setTradeId(stageRefundParam.getTradeId());
payRefundDTO.setRefundId(Id.next());
payRefundDTO.setRefundAmount(tradeRecord.getAmount());
return this.payApi.refund(payRefundDTO);
}
// public void orderCorrect(OrderPartRefundDTO orderPartRefundDTO, OrderRefundBizEnum biz) {
// if (CollUtil.isEmpty(orderPartRefundDTO.getDetailRefundList())) {
// throw new LeException(I18n.getMessage("order.buffet.correct-lack-detail", new Object[0]));

View File

@ -0,0 +1,5 @@
package com.bonus.canteen.core.order.common.constants;
public class StageWhiteList {
public static final String STAGE_SIGN_WHITE_LIST = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkqpPYMDEBTiLgH08AnVYMH1WfHlB5dZC8mRq4aHmvKpGdRgeE11EylhVLsm2N5ryNYI6THgwQpL0jJ9g3lTaq4KzR8LkJlBbyFrnaflB3AtNQugg59f77eMSjHx4cTKbLWtyRfxNR2QK6AjBLkMH2v3GL4dn0aGml9fcN0cL4xLH8g8HJ1DEMGx6cJGQhuE7eQqsUkmmBs7ElbXfOFHWhLFOAgZ98Ieeog5JDnewGMl4yqyytFIPcv2VDlb46MmnZciwXYmZh5W1B9ltmO6LNvJj0itWB1ObTGzKJf9WQDG2Xq38JqFm0TttJAKxYb95ZQGZnmwIDAQAB";
}

View File

@ -17,11 +17,8 @@ public class RequestHeaderDTO {
if (MapUtil.isEmpty(requestHeader)) {
return headerDTO;
} else {
headerDTO.setOpenid(HeaderFetchUtil.getOpenid(requestHeader));
headerDTO.setSourceType(HeaderFetchUtil.getSourceType(requestHeader));
headerDTO.setMachineNum(HeaderFetchUtil.getMachineNum(requestHeader));
headerDTO.setMachineSn(HeaderFetchUtil.getMachineSn(requestHeader));
headerDTO.setCustId(HeaderFetchUtil.getCustId(requestHeader));
return headerDTO;
}
}

View File

@ -0,0 +1,19 @@
package com.bonus.canteen.core.order.common.dto;
import com.bonus.canteen.core.common.utils.SysUtil;
import com.bonus.canteen.core.pay.api.dto.UnifyRefundDTO;
import com.bonus.common.houqin.constant.LeConstants;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
@Data
public class StageRefundParam extends OrderRefundParam {
@NotNull(message = "交易ID不能为空")
private Long tradeId;
}

View File

@ -2,8 +2,11 @@ package com.bonus.canteen.core.order.mobile.business;
import com.bonus.canteen.core.order.common.dto.RequestHeaderDTO;
import com.bonus.canteen.core.order.mobile.dto.OrderPayMobileDTO;
import com.bonus.canteen.core.order.mobile.dto.OrderReserveMealTotalDTO;
import com.bonus.canteen.core.order.mobile.dto.StagePayMobileDTO;
import com.bonus.canteen.core.order.mobile.vo.OrderPayMobileVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
public interface OrderPlaceMobileBusiness {
// OrderPayMobileVO addCurrentMealOrder(RequestHeaderDTO headerDTO, OrderCurrMealTotalDTO currMealTotalDTO);
@ -15,10 +18,12 @@ public interface OrderPlaceMobileBusiness {
// OrderPayMobileVO addShopMealOrder(RequestHeaderDTO headerDTO, OrderShopDTO orderShopDTO);
//
// OrderPayMobileVO addSacnOrder(RequestHeaderDTO headerDTO, OrderMobileScanDTO scanDTO);
//
// OrderPayMobileVO orderPayByOrderId(RequestHeaderDTO headerDTO, OrderPayMobileDTO orderPayDTO);
OrderPayMobileVO orderPayByOrderId(RequestHeaderDTO headerDTO, OrderPayMobileDTO orderPayDTO);
//
// OrderPayMobileVO orderMixPayByTradeId(RequestHeaderDTO headerDTO, OrderMixPayMobileDTO orderMixPayMobileDTO);
//
// void orderPreBookAdd(RequestHeaderDTO headerDTO, OrderPreBookAddDTO addDTO);
UnifyPayVO stageOrderPay(RequestHeaderDTO headerDTO, StagePayMobileDTO stagePayDTO);
}

View File

@ -1,8 +1,14 @@
package com.bonus.canteen.core.order.mobile.business.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.common.constant.OrderConstant;
import com.bonus.canteen.core.order.common.constants.*;
import com.bonus.canteen.core.order.common.service.OrderAmountChangeService;
import com.bonus.canteen.core.order.common.service.OrderDeliveryService;
import com.bonus.canteen.core.order.common.service.OrderDetailService;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.houqin.constant.LeConstants;
import com.bonus.common.houqin.constant.RetCodeEnum;
@ -26,9 +32,6 @@ import com.bonus.canteen.core.order.client.po.MetaDataValueParam;
import com.bonus.canteen.core.order.client.po.OrderConfigQueryParam;
import com.bonus.canteen.core.order.common.business.OrderPlaceBusiness;
import com.bonus.canteen.core.order.common.business.OrderResultBusiness;
import com.bonus.canteen.core.order.common.constants.ChangeDetailTypeEnum;
import com.bonus.canteen.core.order.common.constants.OrderCacheConstants;
import com.bonus.canteen.core.order.common.constants.OrderTips;
import com.bonus.canteen.core.order.common.dto.OrderDetailPayDTO;
import com.bonus.canteen.core.order.common.dto.RequestHeaderDTO;
import com.bonus.canteen.core.order.common.model.OrderAmountChange;
@ -94,15 +97,15 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
@Autowired
@Lazy
protected OrderInfoService orderInfoService;
// @Autowired
// @Lazy
// protected OrderDetailService orderDetailService;
// @Autowired
// @Lazy
// protected OrderAmountChangeService orderAmountChangeService;
// @Autowired
// @Lazy
// protected OrderDeliveryService orderDeliveryService;
@Autowired
@Lazy
protected OrderDetailService orderDetailService;
@Autowired
@Lazy
protected OrderAmountChangeService orderAmountChangeService;
@Autowired
@Lazy
protected OrderDeliveryService orderDeliveryService;
// @Autowired
// @Lazy
// protected OrderPreBookService orderPreBookService;
@ -295,38 +298,57 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
// orderSavePO.setAmountChangeList(amountChangeList);
// return LeConstants.COMMON_YES.equals(orderShopDTO.getIfTrial()) ? this.trialPay(orderSavePO, (OrderDeliveryResultVO)null) : this.saveAndPay(orderSavePO, true, false);
// }
//
// public OrderPayMobileVO orderPayByOrderId(RequestHeaderDTO headerDTO, OrderPayMobileDTO orderPayDTO) {
// LogUtil.info("订单支付|入参", orderPayDTO);
// JavaxValidateUtils.validate(orderPayDTO);
// if (!LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial())) {
// this.checkOrderRepeated(headerDTO.getOpenid(), (Long)null);
// }
//
// OrderInfo orderInfo = this.orderInfoService.checkAndGetOrderInfo(orderPayDTO.getOrderId());
// OrderSavePO orderSavePO = OrderSavePO.byOrderInfo(CollUtil.toList(new OrderInfo[]{orderInfo}), this.orderDetailService.getOrderDetailList(orderInfo.getOrderId(), orderInfo.getOrderDate()), this.orderDeliveryService.listOrderDeliveryByOrderIds(CollUtil.toList(new Long[]{orderInfo.getOrderId()}), CollUtil.toList(new LocalDate[]{orderInfo.getOrderDate()})));
// CustPayVO custInfo = this.getCustInfo(orderInfo.getCustId(), headerDTO.getSourceType());
// this.orderPayForIdCheck(CollUtil.toList(new OrderInfo[]{orderInfo}), orderSavePO.getOrderDetailList(), orderSavePO.getOrderDeliveryList());
// if (LeConstants.COMMON_NO.equals(orderPayDTO.getIfTrial())) {
// this.orderPlaceBusiness.orderHandlerLock(orderSavePO.getMacOrderId(), OrderCacheConstants.MOBILE_PAY_INTERVAL);
// }
//
// orderSavePO.setPayDTO(this.createPay(orderPayDTO.getPayType(), orderPayDTO.getCouponId(), headerDTO.getSourceType(), orderInfo.getCanteenId(), orderInfo.getStallId(), headerDTO.getOpenid(), custInfo, orderPayDTO));
// this.updateOrderField(CollUtil.toList(new OrderInfo[]{orderInfo}), orderSavePO.getPayDTO());
// orderSavePO.getPayDTO().setAmount(orderInfo.calcNeedPayAmount());
// List<OrderAmountChange> amountChangeList = (List)this.orderAmountChangeService.listByOrderIds(CollUtil.toList(new Long[]{orderInfo.getOrderId()}), CollUtil.toList(new LocalDate[]{orderInfo.getOrderDate()})).stream().filter((s) -> {
// return !ChangeDetailTypeEnum.ifFromRule(s.getChangeDetailType());
// }).collect(Collectors.toList());
// orderInfo.setDiscountsAmount(LeNumUtil.sumField(amountChangeList, OrderAmountChange::getChangeAmount));
// List<OrderAmountChange> amountChangeListRole = this.orderPlaceBusiness.calcRuleAmount(orderSavePO.getPayDTO(), orderSavePO.getOrderInfoList(), orderSavePO.getOrderDetailList(), LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial()));
// amountChangeList.addAll(amountChangeListRole);
// if (OrderTypeEnum.isCanteenCategory(orderInfo.getOrderType())) {
// this.orderPlaceBusiness.checkCoupon(orderSavePO.getPayDTO(), CollUtil.toList(new OrderInfo[]{orderInfo}));
// }
//
// orderSavePO.setAmountChangeList(amountChangeList);
// return LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial()) ? this.trialPay(orderSavePO, (OrderDeliveryResultVO)null) : this.saveAndPay(orderSavePO, false, true);
// }
public OrderPayMobileVO orderPayByOrderId(RequestHeaderDTO headerDTO, OrderPayMobileDTO orderPayDTO) {
LogUtil.info("订单支付|入参", orderPayDTO);
JavaxValidateUtils.validate(orderPayDTO);
if (!LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial())) {
this.checkOrderRepeated(headerDTO.getOpenid(), (Long)null);
}
OrderInfo orderInfo = this.orderInfoService.checkAndGetOrderInfo(orderPayDTO.getOrderId());
OrderSavePO orderSavePO = OrderSavePO.byOrderInfo(CollUtil.toList(orderInfo),
this.orderDetailService.getOrderDetailList(orderInfo.getOrderId(), orderInfo.getOrderDate()),
this.orderDeliveryService.listOrderDeliveryByOrderIds(CollUtil.toList(orderInfo.getOrderId()), CollUtil.toList(orderInfo.getOrderDate())));
CustPayVO custInfo = this.getCustInfo(orderInfo.getCustId(), headerDTO.getSourceType());
this.orderPayForIdCheck(CollUtil.toList(new OrderInfo[]{orderInfo}), orderSavePO.getOrderDetailList(), orderSavePO.getOrderDeliveryList());
if (LeConstants.COMMON_NO.equals(orderPayDTO.getIfTrial())) {
this.orderPlaceBusiness.orderHandlerLock(orderSavePO.getMacOrderId(), OrderCacheConstants.MOBILE_PAY_INTERVAL);
}
orderSavePO.setPayDTO(this.createPay(orderPayDTO.getPayType(), orderPayDTO.getCouponId(), headerDTO.getSourceType(), orderInfo.getCanteenId(), orderInfo.getStallId(), headerDTO.getOpenid(), custInfo, orderPayDTO));
this.updateOrderField(CollUtil.toList(orderInfo), orderSavePO.getPayDTO());
orderSavePO.getPayDTO().setAmount(orderInfo.calcNeedPayAmount());
List<OrderAmountChange> amountChangeList = this.orderAmountChangeService.listByOrderIds(CollUtil.toList(new Long[]{orderInfo.getOrderId()}), CollUtil.toList(new LocalDate[]{orderInfo.getOrderDate()})).stream().filter((s) -> {
return !ChangeDetailTypeEnum.ifFromRule(s.getChangeDetailType());
}).collect(Collectors.toList());
orderInfo.setDiscountsAmount(LeNumUtil.sumField(amountChangeList, OrderAmountChange::getChangeAmount));
List<OrderAmountChange> amountChangeListRole = this.orderPlaceBusiness.calcRuleAmount(orderSavePO.getPayDTO(), orderSavePO.getOrderInfoList(), orderSavePO.getOrderDetailList(), LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial()));
amountChangeList.addAll(amountChangeListRole);
if (OrderTypeEnum.isCanteenCategory(orderInfo.getOrderType())) {
this.orderPlaceBusiness.checkCoupon(orderSavePO.getPayDTO(), CollUtil.toList(new OrderInfo[]{orderInfo}));
}
orderSavePO.setAmountChangeList(amountChangeList);
return LeConstants.COMMON_YES.equals(orderPayDTO.getIfTrial()) ? this.trialPay(orderSavePO, (OrderDeliveryResultVO)null) : this.saveAndPay(orderSavePO, false, true);
}
@Override
public UnifyPayVO stageOrderPay(RequestHeaderDTO headerDTO, StagePayMobileDTO stagePayDTO) {
CustPayVO custInfo = this.getCustInfo(stagePayDTO.getCustId(), stagePayDTO.getSourceType());
UnifyPayDTO unifyPayDTO = this.createPay(stagePayDTO.getPayType(),
stagePayDTO.getCouponId(),
stagePayDTO.getSourceType(),
null,
null,
stagePayDTO.getOpenid(),
custInfo,
stagePayDTO);
unifyPayDTO.setAmount(stagePayDTO.getAmount());
unifyPayDTO.setRemark("驿站支付");
return payApi.pay(unifyPayDTO);
}
//
// public OrderPayMobileVO orderMixPayByTradeId(RequestHeaderDTO headerDTO, OrderMixPayMobileDTO orderMixPayMobileDTO) {
// LogUtil.info("订单混合支付|入参", orderMixPayMobileDTO);
@ -451,33 +473,33 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
}
}
//
// protected void currentMealOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
// if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
// Iterator var4 = orderInfoList.iterator();
//
// while(var4.hasNext()) {
// OrderInfo orderInfo = (OrderInfo)var4.next();
// LocalTime nowTime = LocalTime.now();
// if (LeNumUtil.isValidId(orderInfo.getStallId())) {
// this.allocStallApi.checkStallBusinessState(orderInfo.getStallId(), nowTime);
// }
//
// if (orderInfo.getDeliveryType() == null) {
// throw new LeException(OrderTips.mobileNoDelivery());
// }
//
// AllocMealtimeModel mealtime = this.orderPlaceBusiness.checkMealtime(orderInfo.getMealtimeType(), orderInfo.getCanteenId(), orderInfo.getStallId());
// if (mealtime.getCurrStartTime() != null && nowTime.compareTo(mealtime.getCurrStartTime()) < 0 || mealtime.getCurrEndTime() != null && nowTime.compareTo(mealtime.getCurrEndTime()) > 0) {
// throw new LeException(I18n.getMessage("order.mobile.out-of-curr-time", new Object[0]));
// }
//
// orderInfo.setMealtimeType(mealtime.getMealtimeType());
// orderInfo.setMealtimeName(mealtime.getMealtimeName());
// }
//
// }
// }
protected void currentMealOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
Iterator var4 = orderInfoList.iterator();
while(var4.hasNext()) {
OrderInfo orderInfo = (OrderInfo)var4.next();
LocalTime nowTime = LocalTime.now();
if (LeNumUtil.isValidId(orderInfo.getStallId())) {
this.allocStallApi.checkStallBusinessState(orderInfo.getStallId(), nowTime);
}
if (orderInfo.getDeliveryType() == null) {
throw new ServiceException(OrderTips.mobileNoDelivery());
}
AllocMealtimeModel mealtime = this.orderPlaceBusiness.checkMealtime(orderInfo.getMealtimeType(), orderInfo.getCanteenId(), orderInfo.getStallId());
if (mealtime.getCurrStartTime() != null && nowTime.compareTo(mealtime.getCurrStartTime()) < 0 || mealtime.getCurrEndTime() != null && nowTime.compareTo(mealtime.getCurrEndTime()) > 0) {
throw new ServiceException(I18n.getMessage("order.mobile.out-of-curr-time", new Object[0]));
}
orderInfo.setMealtimeType(mealtime.getMealtimeType());
orderInfo.setMealtimeName(mealtime.getMealtimeName());
}
}
}
protected void reserveMealOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
@ -575,147 +597,147 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
}
}
//
// protected void bookMealOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
// if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
// LocalDate nowDate = LocalDate.now();
// LocalTime nowTime = LocalTime.now();
// LocalDate tomorrow = nowDate.plusDays(1L);
// String repeatReserveCheck = this.orderModuleClient.metadataGetValue(MetaDataValueParam.ofMerchant(MetadataModelTypeEnum.MOBILE, "repeatReserveCheck"));
// boolean repeatReserveFlag = "1".equals(repeatReserveCheck);
// Map<String, OrderInfo> goodsDateIntervalMap = new HashMap();
// if (repeatReserveFlag) {
// goodsDateIntervalMap = this.getOrderMapByCustId(((OrderInfo)orderInfoList.get(0)).getCustId(), nowDate);
// }
//
// Map<String, AllocMealtimeModel> mealtimeMap = MapUtil.newHashMap();
// Map<String, AllocCanteenOrderDTO> orderDTOMap = MapUtil.newHashMap();
// Iterator var12 = orderInfoList.iterator();
//
// while(var12.hasNext()) {
// OrderInfo orderInfo = (OrderInfo)var12.next();
// if (LeNumUtil.isValidId(orderInfo.getStallId())) {
// this.allocStallApi.checkStallBusinessState(orderInfo.getStallId(), (LocalTime)null);
// }
//
// String mealtimeKey = CharSequenceUtil.join("_", new Object[]{orderInfo.getCanteenId(), orderInfo.getStallId(), orderInfo.getMealtimeType()});
// String orderDTOKey = CharSequenceUtil.join("_", new Object[]{orderInfo.getCanteenId(), orderInfo.getStallId()});
// AllocMealtimeModel mealtime = mealtimeMap.get(mealtimeKey) != null ? (AllocMealtimeModel)mealtimeMap.get(mealtimeKey) : this.orderPlaceBusiness.checkMealtime(orderInfo.getMealtimeType(), orderInfo.getCanteenId(), orderInfo.getStallId());
// mealtimeMap.put(mealtimeKey, mealtime);
// AllocCanteenOrderDTO canteenOrderDTO = orderDTOMap.get(orderDTOKey) != null ? (AllocCanteenOrderDTO)orderDTOMap.get(orderDTOKey) : this.orderModuleClient.metadataQueryOrderConfig(OrderConfigQueryParam.of(orderInfo.getCanteenId(), orderInfo.getStallId()));
// orderDTOMap.put(orderDTOKey, canteenOrderDTO);
// if (nowDate.isAfter(orderInfo.getOrderDate())) {
// throw new LeException(I18n.getMessage("order.mobile.out-of-reverse-time", new Object[0]));
// }
//
// if (nowDate.equals(orderInfo.getOrderDate())) {
// if (ObjectUtil.isNotNull(mealtime.getBookCurrDeadline()) && LocalTime.now().isAfter(mealtime.getBookCurrDeadline())) {
// String var10002 = I18n.getMessage("order.mobile.book-time-limit", new Object[0]);
// throw new LeException(var10002 + mealtime.getBookCurrDeadline().toString());
// }
// } else {
// boolean ifBookTomorrow = true;
// String bookEndTime = canteenOrderDTO.getBookEndTime();
// if (CharSequenceUtil.isNotBlank(bookEndTime) && nowTime.isAfter(LocalTime.parse(bookEndTime))) {
// ifBookTomorrow = false;
// }
//
// if (tomorrow.equals(orderInfo.getOrderDate()) && !ifBookTomorrow) {
// throw new LeException(I18n.getMessage("order.mobile.not-allow-reverse-tomorrow", new Object[0]));
// }
//
// String limitDay = canteenOrderDTO.getReportMealLimitDay();
// int dayNum = CharSequenceUtil.isBlank(limitDay) ? OrderConstant.DEFAULT_APPLET_BOOK_DAY_LIMIT : Integer.parseInt(limitDay);
// LocalDate limitDate = nowDate.plusDays((long)dayNum);
// if (orderInfo.getOrderDate().isAfter(limitDate)) {
// throw new LeException(I18n.getMessage("order.mobile.book-day-limit", new Object[]{dayNum}));
// }
// }
//
// String var10000 = orderInfo.getOrderDate().toString();
// String orderKey = var10000 + orderInfo.getCanteenId() + orderInfo.getStallId() + orderInfo.getMealtimeType();
// OrderInfo targetOrderInfo = (OrderInfo)((Map)goodsDateIntervalMap).get(orderKey);
// this.reserveOrBookCheck(targetOrderInfo);
// }
//
// }
// }
//
// protected void shopOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
// if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
// Iterator var4 = orderInfoList.iterator();
//
// OrderInfo orderInfo;
// do {
// if (!var4.hasNext()) {
// return;
// }
//
// orderInfo = (OrderInfo)var4.next();
// if (orderInfo.getDeliveryType() == null) {
// throw new LeException(OrderTips.mobileNoDelivery());
// }
// } while(this.supermarketApi.ifBusiness(orderInfo.getCanteenId()));
//
// throw new LeException(I18n.getMessage("order.mobile.shop-not-in-time", new Object[0]));
// }
// }
//
// public void scanOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
// if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
// Iterator var4 = orderInfoList.iterator();
//
// while(var4.hasNext()) {
// OrderInfo orderInfo = (OrderInfo)var4.next();
// LocalTime nowTime = LocalTime.now();
// if (OrderTypeEnum.isMobileScanType(orderInfo.getOrderType())) {
// if (LeNumUtil.isValidId(orderInfo.getCanteenId())) {
// this.allocCanteenApi.checkCanteenBusinessState(orderInfo.getCanteenId(), nowTime);
// }
//
// if (LeNumUtil.isValidId(orderInfo.getStallId())) {
// this.allocStallApi.checkStallBusinessState(orderInfo.getStallId(), nowTime);
// }
//
// AllocMealtimeModel mealtimeModel = this.orderPlaceBusiness.checkMealtime((Integer)null, orderInfo.getCanteenId(), orderInfo.getStallId());
// orderInfo.setMealtimeType(mealtimeModel.getMealtimeType());
// orderInfo.setMealtimeName(mealtimeModel.getMealtimeName());
// } else if (OrderTypeEnum.isMobileScanShopType(orderInfo.getOrderType()) && !this.supermarketApi.ifBusiness(orderInfo.getCanteenId())) {
// throw new LeException(I18n.getMessage("order.mobile.shop-not-in-time", new Object[0]));
// }
// }
//
// }
// }
//
// protected void orderPayForIdCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
// Iterator var4 = orderInfoList.iterator();
//
// OrderInfo orderInfo;
// do {
// if (!var4.hasNext()) {
// if (OrderTypeEnum.isCurrMealType(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
// this.currentMealOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
// } else if (OrderTypeEnum.isReserveMealType(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
// this.reserveMealOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
// } else if (OrderTypeEnum.isBookMealCategory(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
// this.bookMealOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
// } else if (OrderTypeEnum.isShopCategory(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
// this.shopOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
// } else if (OrderTypeEnum.isMobileScanCategory(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
// this.scanOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
// }
//
// this.orderPlaceBusiness.checkOrderPermission(orderInfoList, orderDetailList);
// return;
// }
//
// orderInfo = (OrderInfo)var4.next();
// } while(PayStateEnum.isUnPayState(orderInfo.getPayState()) && !OrderStateEnum.isCancelState(orderInfo.getOrderState()));
//
// log.info("[根据订单id支付]订单{}状态为{}", orderInfo.getOrderId(), orderInfo.getPayState());
// throw new LeException(I18n.getMessage("order.mobile.not-allow-pay", new Object[0]));
// }
protected void bookMealOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
LocalDate nowDate = LocalDate.now();
LocalTime nowTime = LocalTime.now();
LocalDate tomorrow = nowDate.plusDays(1L);
String repeatReserveCheck = this.orderModuleClient.metadataGetValue(MetaDataValueParam.ofMerchant(MetadataModelTypeEnum.MOBILE, "repeatReserveCheck"));
boolean repeatReserveFlag = "1".equals(repeatReserveCheck);
Map<String, OrderInfo> goodsDateIntervalMap = new HashMap();
if (repeatReserveFlag) {
goodsDateIntervalMap = this.getOrderMapByCustId(((OrderInfo)orderInfoList.get(0)).getCustId(), nowDate);
}
Map<String, AllocMealtimeModel> mealtimeMap = MapUtil.newHashMap();
Map<String, AllocCanteenOrderDTO> orderDTOMap = MapUtil.newHashMap();
Iterator var12 = orderInfoList.iterator();
while(var12.hasNext()) {
OrderInfo orderInfo = (OrderInfo)var12.next();
if (LeNumUtil.isValidId(orderInfo.getStallId())) {
this.allocStallApi.checkStallBusinessState(orderInfo.getStallId(), (LocalTime)null);
}
String mealtimeKey = CharSequenceUtil.join("_", new Object[]{orderInfo.getCanteenId(), orderInfo.getStallId(), orderInfo.getMealtimeType()});
String orderDTOKey = CharSequenceUtil.join("_", new Object[]{orderInfo.getCanteenId(), orderInfo.getStallId()});
AllocMealtimeModel mealtime = mealtimeMap.get(mealtimeKey) != null ? (AllocMealtimeModel)mealtimeMap.get(mealtimeKey) : this.orderPlaceBusiness.checkMealtime(orderInfo.getMealtimeType(), orderInfo.getCanteenId(), orderInfo.getStallId());
mealtimeMap.put(mealtimeKey, mealtime);
AllocCanteenOrderDTO canteenOrderDTO = orderDTOMap.get(orderDTOKey) != null ? (AllocCanteenOrderDTO)orderDTOMap.get(orderDTOKey) : this.orderModuleClient.metadataQueryOrderConfig(OrderConfigQueryParam.of(orderInfo.getCanteenId(), orderInfo.getStallId()));
orderDTOMap.put(orderDTOKey, canteenOrderDTO);
if (nowDate.isAfter(orderInfo.getOrderDate())) {
throw new ServiceException(I18n.getMessage("order.mobile.out-of-reverse-time", new Object[0]));
}
if (nowDate.equals(orderInfo.getOrderDate())) {
if (ObjectUtil.isNotNull(mealtime.getBookCurrDeadline()) && LocalTime.now().isAfter(mealtime.getBookCurrDeadline())) {
String var10002 = I18n.getMessage("order.mobile.book-time-limit", new Object[0]);
throw new ServiceException(var10002 + mealtime.getBookCurrDeadline().toString());
}
} else {
boolean ifBookTomorrow = true;
String bookEndTime = canteenOrderDTO.getBookEndTime();
if (CharSequenceUtil.isNotBlank(bookEndTime) && nowTime.isAfter(LocalTime.parse(bookEndTime))) {
ifBookTomorrow = false;
}
if (tomorrow.equals(orderInfo.getOrderDate()) && !ifBookTomorrow) {
throw new ServiceException(I18n.getMessage("order.mobile.not-allow-reverse-tomorrow", new Object[0]));
}
String limitDay = canteenOrderDTO.getReportMealLimitDay();
int dayNum = CharSequenceUtil.isBlank(limitDay) ? OrderConstant.DEFAULT_APPLET_BOOK_DAY_LIMIT : Integer.parseInt(limitDay);
LocalDate limitDate = nowDate.plusDays((long)dayNum);
if (orderInfo.getOrderDate().isAfter(limitDate)) {
throw new ServiceException(I18n.getMessage("order.mobile.book-day-limit", dayNum));
}
}
String var10000 = orderInfo.getOrderDate().toString();
String orderKey = var10000 + orderInfo.getCanteenId() + orderInfo.getStallId() + orderInfo.getMealtimeType();
OrderInfo targetOrderInfo = (OrderInfo)((Map)goodsDateIntervalMap).get(orderKey);
this.reserveOrBookCheck(targetOrderInfo);
}
}
}
protected void shopOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
Iterator var4 = orderInfoList.iterator();
OrderInfo orderInfo;
do {
if (!var4.hasNext()) {
return;
}
orderInfo = (OrderInfo)var4.next();
if (orderInfo.getDeliveryType() == null) {
throw new ServiceException(OrderTips.mobileNoDelivery());
}
} while(this.supermarketApi.ifBusiness(orderInfo.getCanteenId()));
throw new ServiceException(I18n.getMessage("order.mobile.shop-not-in-time", new Object[0]));
}
}
public void scanOrderPlaceCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
if (this.orderCustomBusiness.mobile().willOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList)) {
Iterator var4 = orderInfoList.iterator();
while(var4.hasNext()) {
OrderInfo orderInfo = (OrderInfo)var4.next();
LocalTime nowTime = LocalTime.now();
if (OrderTypeEnum.isMobileScanType(orderInfo.getOrderType())) {
if (LeNumUtil.isValidId(orderInfo.getCanteenId())) {
this.allocCanteenApi.checkCanteenBusinessState(orderInfo.getCanteenId(), nowTime);
}
if (LeNumUtil.isValidId(orderInfo.getStallId())) {
this.allocStallApi.checkStallBusinessState(orderInfo.getStallId(), nowTime);
}
AllocMealtimeModel mealtimeModel = this.orderPlaceBusiness.checkMealtime((Integer)null, orderInfo.getCanteenId(), orderInfo.getStallId());
orderInfo.setMealtimeType(mealtimeModel.getMealtimeType());
orderInfo.setMealtimeName(mealtimeModel.getMealtimeName());
} else if (OrderTypeEnum.isMobileScanShopType(orderInfo.getOrderType()) && !this.supermarketApi.ifBusiness(orderInfo.getCanteenId())) {
throw new ServiceException(I18n.getMessage("order.mobile.shop-not-in-time", new Object[0]));
}
}
}
}
protected void orderPayForIdCheck(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
Iterator var4 = orderInfoList.iterator();
OrderInfo orderInfo;
do {
if (!var4.hasNext()) {
if (OrderTypeEnum.isCurrMealType(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
this.currentMealOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
} else if (OrderTypeEnum.isReserveMealType(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
this.reserveMealOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
} else if (OrderTypeEnum.isBookMealCategory(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
this.bookMealOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
} else if (OrderTypeEnum.isShopCategory(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
this.shopOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
} else if (OrderTypeEnum.isMobileScanCategory(((OrderInfo)orderInfoList.get(0)).getOrderType())) {
this.scanOrderPlaceCheck(orderInfoList, orderDetailList, orderDeliveryList);
}
this.orderPlaceBusiness.checkOrderPermission(orderInfoList, orderDetailList);
return;
}
orderInfo = (OrderInfo)var4.next();
} while(PayStateEnum.isUnPayState(orderInfo.getPayState()) && !OrderStateEnum.isCancelState(orderInfo.getOrderState()));
log.info("[根据订单id支付]订单{}状态为{}", orderInfo.getOrderId(), orderInfo.getPayState());
throw new ServiceException(I18n.getMessage("order.mobile.not-allow-pay", new Object[0]));
}
protected void checkOrderRepeated(String openid, Long custId) {
if (this.orderCustomBusiness.mobile().willCheckOrderRepeated(OrderCustomMobileCheckRepeatPO.of(openid, custId))) {
@ -749,23 +771,23 @@ public class OrderPlaceMobileBusinessImplV3 implements OrderPlaceMobileBusiness
return orderMap;
}
//
// protected void updateOrderField(List<OrderInfo> orderInfoList, UnifyPayDTO unifyPayDTO) {
// Iterator var3 = orderInfoList.iterator();
//
// while(var3.hasNext()) {
// OrderInfo orderInfo = (OrderInfo)var3.next();
// orderInfo.setSourceType(unifyPayDTO.getSourceType());
// orderInfo.setPayType(unifyPayDTO.getPayType());
// orderInfo.fillCustInfo(unifyPayDTO);
// if (unifyPayDTO.getCouponId() != null) {
// orderInfo.setCouponId(unifyPayDTO.getCouponId().toString());
// } else {
// orderInfo.setCouponId("");
// }
// }
//
// }
protected void updateOrderField(List<OrderInfo> orderInfoList, UnifyPayDTO unifyPayDTO) {
Iterator var3 = orderInfoList.iterator();
while(var3.hasNext()) {
OrderInfo orderInfo = (OrderInfo)var3.next();
orderInfo.setSourceType(unifyPayDTO.getSourceType());
orderInfo.setPayType(unifyPayDTO.getPayType());
orderInfo.fillCustInfo(unifyPayDTO);
if (unifyPayDTO.getCouponId() != null) {
orderInfo.setCouponId(unifyPayDTO.getCouponId().toString());
} else {
orderInfo.setCouponId("");
}
}
}
protected UnifyPayDTO createPay(Integer payType, String couponId, Integer sourceType, Long canteenId, Long stallId, String openid, CustPayVO custInfo, OrderMobilePayParam requestParam) {
PayChannelSelectDTO payChannelSelectDTO = new PayChannelSelectDTO();

View File

@ -1,5 +1,8 @@
package com.bonus.canteen.core.order.mobile.controller;
import com.bonus.canteen.core.order.common.constants.StageWhiteList;
import com.bonus.canteen.core.order.common.dto.StageRefundParam;
import com.bonus.canteen.core.pay.api.vo.UnifyRefundVO;
import com.bonus.common.core.domain.R;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
@ -20,11 +23,14 @@ import com.bonus.canteen.core.order.mobile.vo.OrderListMobileVO;
import com.bonus.canteen.core.order.mobile.vo.OrderShoppingCartAddResultVO;
import com.bonus.canteen.core.order.mobile.vo.OrderShoppingCartListMobileVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO;
import com.bonus.common.houqin.utils.LeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@ -93,16 +99,16 @@ public class OrderInfoMobileController extends BaseController {
// OrderInfoMobileVO orderInfo = this.orderInfoMobileBusiness.weightOrderInfo((OrderInfoWeightMobileDTO)request.getContent());
// return LeResponse.succ(orderInfo);
// }
//
// @PostMapping({"/pay/cancel"})
// @ApiOperation(
// value = "取消支付",
// notes = "cmt-取消支付"
// )
// public LeResponse<Object> orderPayCancel(@RequestBody @Valid LeRequest<OrderIdMobileDTO> request) {
// this.orderInfoMobileBusiness.orderPayCancel(((OrderIdMobileDTO)request.getContent()).getOrderId());
// return LeResponse.succ();
// }
@PostMapping({"/pay/cancel"})
@ApiOperation(
value = "取消支付",
notes = "cmt-取消支付"
)
public AjaxResult orderPayCancel(@RequestBody @Valid OrderIdMobileDTO request) {
this.orderInfoMobileBusiness.orderPayCancel(request.getOrderId());
return AjaxResult.success();
}
//
// @PostMapping({"/part/refund"})
// @ApiOperation(
@ -127,7 +133,21 @@ public class OrderInfoMobileController extends BaseController {
OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(request.convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE);
return resultVO.ifSuccess() ? AjaxResult.success(resultVO) : AjaxResult.error(resultVO.getResultCode(), resultVO.getResultMsg());
}
//
@PostMapping({"/stage/refund"})
@ApiOperation(
value = "驿站退款",
notes = "驿站退款"
)
public AjaxResult stageRefundMobile(@RequestHeader Map<String, String> headers,
@RequestBody StageRefundParam request) {
if(request.getTradeId() == null) {
return AjaxResult.error("交易ID不能为空");
}
UnifyRefundVO resultVO = this.orderRefundBusiness.stageRefund(request);
return AjaxResult.success(resultVO);
}
// @PostMapping({"/book/stat"})
// public LeResponse<OrderBookStatMobileVO> orderBookStat(@RequestHeader Map<String, String> headers, @RequestBody LeRequest<?> request) {
// OrderBookStatMobileVO stat = this.reportOrderApi.getBookStat(HeaderFetchUtil.getCustId(headers));

View File

@ -1,6 +1,14 @@
package com.bonus.canteen.core.order.mobile.controller;
import com.bonus.canteen.core.common.utils.HeaderFetchUtil;
import com.bonus.canteen.core.order.common.constants.StageWhiteList;
import com.bonus.canteen.core.order.mobile.dto.OrderPayMobileDTO;
import com.bonus.canteen.core.order.mobile.dto.StagePayMobileDTO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
import com.bonus.canteen.core.pay.common.constants.PayStateEnum;
import com.bonus.canteen.core.pay.common.constants.PayTypeEnum;
import com.bonus.common.core.domain.R;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.houqin.constant.RetCodeEnum;
import com.bonus.canteen.core.common.utils.LogUtil;
@ -8,15 +16,20 @@ import com.bonus.canteen.core.order.common.dto.RequestHeaderDTO;
import com.bonus.canteen.core.order.mobile.business.OrderPlaceMobileBusiness;
import com.bonus.canteen.core.order.mobile.dto.OrderReserveMealTotalDTO;
import com.bonus.canteen.core.order.mobile.vo.OrderPayMobileVO;
import com.bonus.common.houqin.utils.LeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.Map;
import java.util.Objects;
@RestController
@RequestMapping({"/api/v2/mobile/order"})
@ -110,22 +123,58 @@ public class OrderPlaceMobileController {
// LogUtil.info("[到店扫码下单]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
// return mobileVO.success() ? LeResponse.succ(mobileVO) : LeResponse.fail(mobileVO.getCode(), mobileVO.getMsg(), mobileVO);
// }
//
// @PostMapping({"/pay/by/orderId"})
// @ApiOperation(
// value = "根据订单id支付",
// notes = "cmt-根据订单id支付"
// )
// public LeResponse<OrderPayMobileVO> orderPayByOrderId(@RequestHeader Map<String, String> headers, @RequestBody LeRequest<OrderPayMobileDTO> request) {
// long startTime = System.currentTimeMillis();
// RequestHeaderDTO headerDTO = RequestHeaderDTO.of(headers);
// OrderPayMobileDTO orderPayDTO = (OrderPayMobileDTO)request.getContent();
// orderPayDTO.setCustId(headerDTO.getCustId());
// OrderPayMobileVO mobileVO = this.orderPlaceMobileBusiness.orderPayByOrderId(headerDTO, orderPayDTO);
// LogUtil.info("[根据订单id支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
// return !mobileVO.success() ? LeResponse.fail(mobileVO.getCode(), mobileVO.getMsg(), mobileVO) : LeResponse.succ(mobileVO);
// }
//
@PostMapping({"/pay/by/orderId"})
@ApiOperation(
value = "根据订单id支付",
notes = "cmt-根据订单id支付"
)
public AjaxResult orderPayByOrderId(@RequestHeader Map<String, String> headers,
@RequestBody OrderPayMobileDTO orderPayDTO) {
long startTime = System.currentTimeMillis();
RequestHeaderDTO headerDTO = RequestHeaderDTO.of(headers);
orderPayDTO.setCustId(headerDTO.getCustId());
OrderPayMobileVO mobileVO = this.orderPlaceMobileBusiness.orderPayByOrderId(headerDTO, orderPayDTO);
LogUtil.info("[根据订单id支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
return !mobileVO.success() ? AjaxResult.error( mobileVO.getMsg(), mobileVO) : AjaxResult.success(mobileVO);
}
@PostMapping({"/stage/pay"})
@ApiOperation(
value = "驿站付款",
notes = "驿站付款"
)
public AjaxResult stageOrderPay(@RequestHeader Map<String, String> headers,
@RequestBody StagePayMobileDTO stagePayDTO) {
if(stagePayDTO.getAmount() == null) {
return AjaxResult.error("金额不能为空");
}
if(BigDecimal.ZERO.compareTo(stagePayDTO.getAmount()) >= 0) {
return AjaxResult.error("金额必须大于0");
}
UnifyPayVO mobileVO = null;
try{
long startTime = System.currentTimeMillis();
RequestHeaderDTO headerDTO = RequestHeaderDTO.of(headers);
stagePayDTO.setPayType(PayTypeEnum.MEAL_CARD.getKey());
mobileVO = this.orderPlaceMobileBusiness.stageOrderPay(headerDTO, stagePayDTO);
LogUtil.info("[驿站支付]支付耗时", System.currentTimeMillis() - startTime, mobileVO);
if(Objects.isNull(mobileVO)) {
throw new ServiceException("支付失败");
}
if(PayStateEnum.isFailedState(mobileVO.getCode())) {
throw new ServiceException(mobileVO.getMsg());
}
}catch (ServiceException ex) {
log.error("驿站支付异常", ex);
return AjaxResult.error(ex.getMessage());
}catch (Exception ex) {
log.error("驿站支付异常", ex);
return AjaxResult.error("支付失败");
}
return AjaxResult.success(mobileVO);
}
// @PostMapping({"/mixPay/by/orderId"})
// @ApiOperation(
// value = "根据交易id混合支付",

View File

@ -0,0 +1,101 @@
package com.bonus.canteen.core.order.mobile.dto;
import com.bonus.common.houqin.constant.LeConstants;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
@ApiModel("移动端根据订单号支付DTO")
public class OrderPayMobileDTO implements OrderMobilePayParam {
@ApiModelProperty("是否为订单试算")
private Integer ifTrial;
@ApiModelProperty("订单id")
private @NotNull Long orderId;
@ApiModelProperty("支付方式")
private @NotNull Integer payType;
@ApiModelProperty("餐券id")
private String couponId;
@ApiModelProperty("支付密码")
private String payPassword;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("扩展字段")
private JsonNode extParam;
@ApiModelProperty("人员Id")
private Long custId;
public OrderPayMobileDTO() {
this.ifTrial = LeConstants.COMMON_NO;
}
public Integer getIfTrial() {
return this.ifTrial;
}
public Long getOrderId() {
return this.orderId;
}
public Integer getPayType() {
return this.payType;
}
public String getCouponId() {
return this.couponId;
}
public String getPayPassword() {
return this.payPassword;
}
public String getRemark() {
return this.remark;
}
public JsonNode getExtParam() {
return this.extParam;
}
public Long getCustId() {
return this.custId;
}
public void setIfTrial(final Integer ifTrial) {
this.ifTrial = ifTrial;
}
public void setOrderId(final Long orderId) {
this.orderId = orderId;
}
public void setPayType(final Integer payType) {
this.payType = payType;
}
public void setCouponId(final String couponId) {
this.couponId = couponId;
}
public void setPayPassword(final String payPassword) {
this.payPassword = payPassword;
}
public void setRemark(final String remark) {
this.remark = remark;
}
public void setExtParam(final JsonNode extParam) {
this.extParam = extParam;
}
public void setCustId(final Long custId) {
this.custId = custId;
}
public String toString() {
Integer var10000 = this.getIfTrial();
return "OrderPayMobileDTO(ifTrial=" + var10000 + ", orderId=" + this.getOrderId() + ", payType=" + this.getPayType() + ", couponId=" + this.getCouponId() + ", payPassword=" + this.getPayPassword() + ", remark=" + this.getRemark() + ", extParam=" + String.valueOf(this.getExtParam()) + ", custId=" + this.getCustId() + ")";
}
}

View File

@ -0,0 +1,24 @@
package com.bonus.canteen.core.order.mobile.dto;
import com.bonus.common.houqin.constant.LeConstants;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@ApiModel("移动端根据订单号支付DTO")
@Data
public class StagePayMobileDTO extends OrderPayMobileDTO{
@ApiModelProperty("支付金额")
private @NotNull(message = "支付金额不能为空") @Min(value = 0L, message = "金额不能小于0") BigDecimal amount;
@ApiModelProperty("openid")
private String openid;
@ApiModelProperty("sourceType")
private Integer sourceType;
}

View File

@ -11,8 +11,8 @@ import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO;
import java.util.List;
public interface OrderInfoMobileBusiness {
// void orderPayCancel(Long orderId);
//
void orderPayCancel(Long orderId);
UnifyPaySelectVO orderSyncPayState(OrderSyncPayStateMobileDTO dto);
PageVO<OrderListMobileVO> orderList(OrderListMobileDTO orderListDTO, RequestHeaderDTO headerDTO);

View File

@ -5,7 +5,16 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.common.redis.RedisUtil;
import com.bonus.canteen.core.common.utils.AesEncryptUtil;
import com.bonus.canteen.core.common.utils.TenantContextHolder;
import com.bonus.canteen.core.order.common.business.OrderRefundBusiness;
import com.bonus.canteen.core.order.common.constants.*;
import com.bonus.canteen.core.order.common.model.OrderInfo;
import com.bonus.canteen.core.pay.api.PayApi;
import com.bonus.canteen.core.pay.api.dto.UnifyPayCancelDTO;
import com.bonus.canteen.core.pay.common.constants.PayStateEnum;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.houqin.constant.LeConstants;
import com.bonus.canteen.core.common.page.PageVO;
import com.bonus.canteen.core.device.api.DeviceApi;
@ -14,9 +23,6 @@ import com.bonus.canteen.core.device.manage.model.DeviceInfo;
import com.bonus.canteen.core.menu.api.MenuDishesApi;
import com.bonus.canteen.core.menu.utils.NutritionEntity;
import com.bonus.canteen.core.order.common.business.OrderResultBusiness;
import com.bonus.canteen.core.order.common.constants.CheckStateEnum;
import com.bonus.canteen.core.order.common.constants.DetailTypeEnum;
import com.bonus.canteen.core.order.common.constants.OrderTypeEnum;
import com.bonus.canteen.core.order.common.dto.RequestHeaderDTO;
import com.bonus.canteen.core.order.common.model.OrderDelivery;
import com.bonus.canteen.core.order.common.model.OrderRefund;
@ -40,6 +46,7 @@ import com.bonus.canteen.core.pay.api.TradeRecordApi;
import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO;
import com.bonus.canteen.core.pay.common.model.TradeRecord;
import com.bonus.canteen.core.menu.model.MenuDishesTypeModel;
import com.bonus.common.houqin.i18n.I18n;
import com.github.pagehelper.page.PageMethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -92,6 +99,12 @@ public class OrderInfoMobileBusinessImpl implements OrderInfoMobileBusiness {
@Lazy
@Autowired
protected TradeRecordApi tradeRecordApi;
@Lazy
@Autowired
protected OrderRefundBusiness orderRefundBusiness;
@Lazy
@Autowired
protected PayApi payApi;
@Override
public PageVO<OrderListMobileVO> orderList(OrderListMobileDTO orderListDTO, RequestHeaderDTO headerDTO) {
@ -274,5 +287,40 @@ public class OrderInfoMobileBusinessImpl implements OrderInfoMobileBusiness {
return UnifyPaySelectVO.of(tradeRecord);
}
}
public void orderPayCancel(Long orderId) {
OrderInfo orderInfo = this.getAndCheckOrderInfo(orderId);
if (OrderStateEnum.isWaitPlaceState(orderInfo.getOrderState()) && !PayStateEnum.isFinishedState(orderInfo.getPayState())) {
this.orderRefundBusiness.orderCancel(orderInfo);
List<TradeRecord> tradeRecords = this.tradeRecordApi.listTradeRecordByOrderRechargeId(orderInfo.getOrderId(), PayStateEnum.PAY_INPROCESS.getKey());
Iterator var4 = tradeRecords.iterator();
while(var4.hasNext()) {
TradeRecord tradeRecord = (TradeRecord)var4.next();
UnifyPayCancelDTO payCancelDTO = new UnifyPayCancelDTO();
payCancelDTO.setTradeId(tradeRecord.getId());
this.payApi.payCancel(payCancelDTO);
}
} else {
throw new ServiceException(I18n.getMessage("order.cancel-failed", new Object[0]));
}
}
protected OrderInfo getAndCheckOrderInfo(Long orderId) {
Long var10000 = TenantContextHolder.getTenantId();
String cancelKey = "yst:" + var10000 + ":order:cancel:" + orderId;
if (!RedisUtil.setNx(cancelKey, LeConstants.COMMON_YES, OrderCacheConstants.TWO_SECONDS)) {
throw new ServiceException(I18n.getMessage("order.mobile.order-processing", new Object[0]));
} else {
OrderInfo orderInfo = this.orderInfoService.checkAndGetOrderInfo(orderId);
if (!PayStateEnum.UN_PAY.getKey().equals(orderInfo.getPayState())) {
log.info("[取消支付]订单{}支付状态为:{}", orderId, orderInfo.getPayState());
throw new ServiceException(I18n.getMessage("order.mobile.not-allow-cancel", new Object[0]));
} else if (!DishesStateEnum.UN_MAKE.getKey().equals(orderInfo.getDishesState())) {
log.info("[取消支付]订单{}菜品状态为:{}", orderId, orderInfo.getDishesState());
throw new ServiceException(I18n.getMessage("order.mobile.not-allow-cancel-dishes-make", new Object[0]));
} else {
return orderInfo;
}
}
}
}

View File

@ -7,10 +7,7 @@ import com.bonus.canteen.core.common.utils.LogUtil;
import com.bonus.canteen.core.common.utils.TenantContextHolder;
import com.bonus.canteen.core.order.android.dto.MacOrderImageSaveDTO;
import com.bonus.canteen.core.order.common.model.*;
import com.bonus.canteen.core.order.mq.po.OrderCancelPO;
import com.bonus.canteen.core.order.mq.po.OrderDishesStateUpdatePO;
import com.bonus.canteen.core.order.mq.po.OrderRefundPO;
import com.bonus.canteen.core.order.mq.po.OrderPlacedPO;
import com.bonus.canteen.core.order.mq.po.*;
import com.bonus.canteen.core.pay.common.po.PayResultPO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -191,21 +188,21 @@ public class OrderMessageSend {
}
// public static void orderV3Canceled(OrderInfo orderInfo, List<OrderDetail> detailList) {
// log.info("[订单MQv3]发送订单已取消通知");
// OrderCanceledPO po = new OrderCanceledPO();
// po.setTraceId(LogUtil.getCurrentTraceId());
// po.setTenantId(TenantContextHolder.getTenantId());
// po.setOrderInfo(orderInfo);
// po.setDetailList(detailList);
//
// try {
// MqUtil.sendByTxEnd(JacksonUtil.writeValueAsString(po), LeMqConstant.Topic.ORDER_V3_CANCELED);
// } catch (Exception var4) {
// log.error("发送MQ消息失败", var4);
// }
//
// }
public static void orderV3Canceled(OrderInfo orderInfo, List<OrderDetail> detailList) {
log.info("[订单MQv3]发送订单已取消通知");
OrderCanceledPO po = new OrderCanceledPO();
po.setTraceId(LogUtil.getCurrentTraceId());
po.setTenantId(TenantContextHolder.getTenantId());
po.setOrderInfo(orderInfo);
po.setDetailList(detailList);
try {
MqUtil.sendByTxEnd(JacksonUtil.writeValueAsString(po), LeMqConstant.Topic.ORDER_V3_CANCELED);
} catch (Exception var4) {
log.error("发送MQ消息失败", var4);
}
}
public static void orderV3DishesStateUpdated(OrderInfo orderInfo, Integer dishesStateBeforeUpdated) {
OrderDishesStateUpdatePO orderStateUpdatePO = OrderDishesStateUpdatePO.of(orderInfo);

View File

@ -0,0 +1,51 @@
package com.bonus.canteen.core.order.mq.po;
import cn.hutool.core.collection.CollUtil;
import com.bonus.canteen.core.order.common.model.OrderDetail;
import com.bonus.canteen.core.order.common.model.OrderInfo;
import java.util.List;
public class OrderCanceledPO {
private String traceId;
private Long tenantId;
private OrderInfo orderInfo;
private List<OrderDetail> detailList = CollUtil.newArrayList(new OrderDetail[0]);
public String getTraceId() {
return this.traceId;
}
public Long getTenantId() {
return this.tenantId;
}
public OrderInfo getOrderInfo() {
return this.orderInfo;
}
public List<OrderDetail> getDetailList() {
return this.detailList;
}
public void setTraceId(final String traceId) {
this.traceId = traceId;
}
public void setTenantId(final Long tenantId) {
this.tenantId = tenantId;
}
public void setOrderInfo(final OrderInfo orderInfo) {
this.orderInfo = orderInfo;
}
public void setDetailList(final List<OrderDetail> detailList) {
this.detailList = detailList;
}
public String toString() {
String var10000 = this.getTraceId();
return "OrderCanceledPO(traceId=" + var10000 + ", tenantId=" + this.getTenantId() + ", orderInfo=" + String.valueOf(this.getOrderInfo()) + ", detailList=" + String.valueOf(this.getDetailList()) + ")";
}
}

View File

@ -1,7 +1,9 @@
package com.bonus.canteen.core.pay.api;
import com.bonus.canteen.core.pay.api.dto.UnifyPayCancelDTO;
import com.bonus.canteen.core.pay.api.dto.UnifyPayDTO;
import com.bonus.canteen.core.pay.api.dto.UnifyPaySelectDTO;
import com.bonus.canteen.core.pay.api.dto.UnifyRefundDTO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayCancelVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
import com.bonus.canteen.core.pay.api.vo.UnifyRefundVO;
@ -44,9 +46,11 @@ public class PayApi {
public UnifyPaySelectVO paySelect(UnifyPaySelectDTO paySelectDTO) {
return this.payBusiness.unifyPaySelect(paySelectDTO);
}
public UnifyRefundVO refund(UnifyRefundDTO refundDTO) {
return this.refundBusiness.unifyRefund(refundDTO);
}
public UnifyPayCancelVO payCancel(UnifyPayCancelDTO payCancelDTO) {
return this.refundBusiness.unifyPayCancel(payCancelDTO);
}
}

View File

@ -95,4 +95,8 @@ public class TradeRecordApi {
public TradeRecord getLastTradeRecordByOrderId(Long orderId) {
return (TradeRecord)this.tradeRecordService.queryTradeRecordInfoList((String)null, orderId, (Integer)null, (Integer)null).stream().sorted(Comparator.comparing(TradeRecord::getId).reversed()).findFirst().orElse((TradeRecord) null);
}
public List<TradeRecord> listTradeRecordByOrderRechargeId(Long orderRechargeId, Integer... tradeState) {
return this.tradeRecordService.listTradeRecordByOrderRechargeId(orderRechargeId, tradeState);
}
}

View File

@ -0,0 +1,27 @@
package com.bonus.canteen.core.pay.api.dto;
public class UnifyPayCancelDTO {
private Long tradeId;
private Long orderRechargeId;
public Long getTradeId() {
return this.tradeId;
}
public Long getOrderRechargeId() {
return this.orderRechargeId;
}
public void setTradeId(final Long tradeId) {
this.tradeId = tradeId;
}
public void setOrderRechargeId(final Long orderRechargeId) {
this.orderRechargeId = orderRechargeId;
}
public String toString() {
Long var10000 = this.getTradeId();
return "UnifyPayCancelDTO(tradeId=" + var10000 + ", orderRechargeId=" + this.getOrderRechargeId() + ")";
}
}

View File

@ -0,0 +1,36 @@
package com.bonus.canteen.core.pay.api.vo;
public class UnifyPayCancelVO {
private Integer code;
private Integer payState;
private String msg;
public Integer getCode() {
return this.code;
}
public Integer getPayState() {
return this.payState;
}
public String getMsg() {
return this.msg;
}
public void setCode(final Integer code) {
this.code = code;
}
public void setPayState(final Integer payState) {
this.payState = payState;
}
public void setMsg(final String msg) {
this.msg = msg;
}
public String toString() {
Integer var10000 = this.getCode();
return "UnifyPayCancelVO(code=" + var10000 + ", payState=" + this.getPayState() + ", msg=" + this.getMsg() + ")";
}
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.pay.channel.ali.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
@ -15,6 +16,7 @@ import com.alipay.api.domain.*;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.*;
import com.alipay.api.response.*;
import com.bonus.canteen.core.common.utils.LogUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.canteen.core.allocation.alloc.model.AllocPayModel;
import com.bonus.canteen.core.allocation.api.AllocMetadataApi;
@ -60,6 +62,7 @@ import org.springframework.util.ObjectUtils;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@ -854,7 +857,13 @@ public class AliPayServiceImpl implements AliPayExtension {
createModel.setSubject(mobilePayDTO.isIfRecharge() ? "充值" : mobilePayDTO.getCanteenName() + PayTypeEnum.ALI_H5_PAY.getDesc() + ": 消费");
createModel.setPassbackParams(mobilePayDTO.getAttach());
createModel.setProductCode("QUICK_WAP_WAY");
//定制开始
String timeFormat = LocalDateTime.now().plusMinutes(1).format(DatePattern.NORM_DATETIME_FORMATTER);
LogUtil.info("定制超时时间", timeFormat);
createModel.setTimeExpire(timeFormat);
//定制结束
request.setNotifyUrl(this.queryUnifyNotifyHost() + notifyUrl);
//request.setReturnUrl(this.queryUnifyNotifyHost() + "/h5pro/#/pages/remainingSum/payLoding");
request.setBizModel(createModel);
try {

View File

@ -4,6 +4,15 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.pay.api.dto.UnifyPayCancelDTO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayCancelVO;
import com.bonus.canteen.core.pay.common.constants.CancelResultEnum;
import com.bonus.canteen.core.pay.common.dto.MixPayResultDTO;
import com.bonus.canteen.core.pay.common.dto.PayCancelDTO;
import com.bonus.canteen.core.pay.common.dto.PayChannelSplitDTO;
import com.bonus.canteen.core.pay.common.service.*;
import com.bonus.canteen.core.pay.common.vo.PayCancelVO;
import com.bonus.canteen.core.pay.common.vo.PayChannelSplitVO;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.canteen.core.account.v3.api.AccBusinessApi;
import com.bonus.canteen.core.account.v3.constants.AccExceptionRecordStatusEnum;
@ -22,10 +31,6 @@ import com.bonus.canteen.core.pay.common.dto.PayRefundDTO;
import com.bonus.canteen.core.pay.common.model.TradeChannel;
import com.bonus.canteen.core.pay.common.model.TradeOrderRecharge;
import com.bonus.canteen.core.pay.common.model.TradeRecord;
import com.bonus.canteen.core.pay.common.service.PayService;
import com.bonus.canteen.core.pay.common.service.PayTradeService;
import com.bonus.canteen.core.pay.common.service.TradeChannelService;
import com.bonus.canteen.core.pay.common.service.TradeRecordService;
import com.bonus.canteen.core.pay.common.vo.PayRefundVO;
import com.bonus.canteen.core.pay.common.vo.TradeChannelVO;
import com.bonus.canteen.core.pay.custom.PayCustomBusiness;
@ -73,6 +78,9 @@ public class RefundBusiness {
@Lazy
@Autowired
protected PayTradeService payTradeService;
@Lazy
@Autowired
protected PayChannelSelectService payChannelSelectService;
@Transactional(
propagation = Propagation.NOT_SUPPORTED
@ -534,4 +542,143 @@ public class RefundBusiness {
protected String tradeNotExistsMsg() {
return I18n.getMessage("pay.trade-not-exist", new Object[0]);
}
@Transactional(
propagation = Propagation.NOT_SUPPORTED
)
public UnifyPayCancelVO unifyPayCancel(UnifyPayCancelDTO payCancelDTO) {
UnifyPayCancelVO cancelResultVO = new UnifyPayCancelVO();
this.payCustomBusiness.willPayCancelV2(payCancelDTO);
TradeRecord tradeRecord = payCancelDTO.getTradeId() != null ? this.tradeRecordService.getTradeRecordById(payCancelDTO.getTradeId()) : this.tradeRecordService.getTradeRecordByOrderRechargeId(payCancelDTO.getOrderRechargeId());
if (ObjectUtil.isNull(tradeRecord)) {
log.info("[支付取消]交易记录不存在orderRechargeId:{}", payCancelDTO);
cancelResultVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
cancelResultVO.setMsg(CancelResultEnum.CANCEL_FAIL.getDesc());
return cancelResultVO;
} else if (!PayStateEnum.isPayingState(tradeRecord.getTradeState())) {
log.error("交易记录状态不是支付中tradeId={},tradeState={}", tradeRecord.getId(), tradeRecord.getTradeState());
cancelResultVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
cancelResultVO.setMsg(CancelResultEnum.CANCEL_FAIL.getDesc());
return cancelResultVO;
} else if (!PayCacheConstants.lockTrade(tradeRecord.getId())) {
log.warn("[统一支付]交易锁定失败");
cancelResultVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
cancelResultVO.setMsg(CancelResultEnum.CANCEL_FAIL.getDesc());
return cancelResultVO;
} else {
UnifyPayCancelVO var5;
try {
cancelResultVO = this.startCancelFlow(tradeRecord);
log.info("[支付取消]返回结果:{}", JacksonUtil.valueToTreeIgnoreNull(cancelResultVO));
Integer payState;
if (CancelResultEnum.CANCEL_SUCCESS.getKey().equals(cancelResultVO.getCode())) {
payState = PayStateEnum.PAY_CLOSE.getKey();
} else {
payState = PayStateEnum.PAY_INPROCESS.getKey();
}
this.tradeRecordService.updateTradeRecordState(tradeRecord.getId(), payState, cancelResultVO.getMsg());
cancelResultVO.setPayState(payState);
this.payCustomBusiness.didPayCancelV2(payCancelDTO, cancelResultVO);
var5 = cancelResultVO;
} finally {
PayCacheConstants.unlockTrade(tradeRecord.getId());
}
return var5;
}
}
protected UnifyPayCancelVO startCancelFlow(TradeRecord tradeRecord) {
UnifyPayCancelVO unifyPayCancelVO = new UnifyPayCancelVO();
List<TradeChannelVO> tradeChannels = this.tradeChannelService.listChannelDetailByTradeId(tradeRecord.getId());
if (CollUtil.isEmpty(tradeChannels)) {
unifyPayCancelVO.setCode(CancelResultEnum.CANCEL_SUCCESS.getKey());
unifyPayCancelVO.setMsg(CancelResultEnum.CANCEL_SUCCESS.getDesc());
return unifyPayCancelVO;
} else {
TradeChannelVO lastTradeChannel = (TradeChannelVO)CollUtil.getLast(tradeChannels);
if (!PayStateEnum.isPayingState(lastTradeChannel.getTradeState())) {
unifyPayCancelVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
unifyPayCancelVO.setMsg(CancelResultEnum.CANCEL_FAIL.getDesc());
return unifyPayCancelVO;
} else {
UnifyPayDTO unifyPayDTO = UnifyPayDTO.of(tradeRecord);
List<PayChannelSplitVO> payChannelSplits = unifyPayDTO.getPayChannelSplits();
try {
if (CollUtil.isEmpty(payChannelSplits)) {
payChannelSplits = this.payChannelSelectService.splitChannelDetails(PayChannelSplitDTO.of(tradeRecord.getPayType(), tradeRecord.getPayChannel(), unifyPayDTO.getCouponId(), tradeRecord.getCanteenId()));
}
} catch (Exception var12) {
log.error("[渠道支付取消]拆解支付渠道异常", var12);
unifyPayCancelVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
unifyPayCancelVO.setMsg(CancelResultEnum.CANCEL_FAIL.getDesc());
return unifyPayCancelVO;
}
PayChannelSplitVO lastPayChannelSplit = (PayChannelSplitVO)CollUtil.getLast(payChannelSplits);
for(int i = tradeChannels.size() - 1; i >= 0; --i) {
TradeChannelVO tradeChannel = (TradeChannelVO)tradeChannels.get(i);
if (tradeChannel.getPayType().equals(lastPayChannelSplit.getPayType()) && tradeChannel.getPayChannel().equals(lastPayChannelSplit.getPayChannel())) {
PayCancelDTO channelPayCancelDTO = new PayCancelDTO();
this.fillPayCancelDTO(channelPayCancelDTO, unifyPayDTO);
PayCancelVO channelPayCancelVO = this.channelPayCancel(tradeChannel, channelPayCancelDTO);
unifyPayCancelVO.setPayState(channelPayCancelVO.getPayState());
unifyPayCancelVO.setCode(channelPayCancelVO.getCode());
unifyPayCancelVO.setMsg(channelPayCancelVO.getMsg());
if (!CancelResultEnum.CANCEL_SUCCESS.getKey().equals(channelPayCancelVO.getCode())) {
break;
}
} else {
MixPayResultDTO mixPayResultDTO = new MixPayResultDTO();
mixPayResultDTO.setTradeChannelId(tradeChannel.getTradeChannelId());
mixPayResultDTO.setCode(PayStateEnum.PAY_CLOSE.getKey());
mixPayResultDTO.setUnpaidBalance(tradeRecord.getAmount());
this.payBusiness.mixPayResultProcess(tradeChannel, mixPayResultDTO);
}
}
return unifyPayCancelVO;
}
}
}
protected void fillPayCancelDTO(PayCancelDTO cancelDTO, UnifyPayDTO unifyPayDTO) {
cancelDTO.setCanteenId(unifyPayDTO.getCanteenId());
cancelDTO.setStallId((Long)unifyPayDTO.reduceOrderField(UnifyPayDTO.Order::getStallId, (Object)null));
cancelDTO.setMachineSn(unifyPayDTO.getMachineSn());
cancelDTO.setCouponId(unifyPayDTO.getCouponId());
}
protected PayCancelVO channelPayCancel(TradeChannelVO tradeChannel, PayCancelDTO payCancelDTO) {
this.payCustomBusiness.willChannelPayCancel(payCancelDTO);
PayCancelVO cancelResultVO = new PayCancelVO();
cancelResultVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
cancelResultVO.setMsg(CancelResultEnum.CANCEL_FAIL.getDesc());
payCancelDTO.setTradeChannelId(tradeChannel.getTradeChannelId());
payCancelDTO.setPayType(tradeChannel.getPayType());
payCancelDTO.setPayChannel(tradeChannel.getPayChannel());
payCancelDTO.setTradeTime(tradeChannel.getTradeTime());
try {
PayService payService = this.channelBusiness.beanOfChannel(tradeChannel.getPayChannel());
cancelResultVO = payService.payCancel(payCancelDTO);
} catch (Exception var5) {
log.error("[渠道支付取消]异常", var5);
cancelResultVO.setCode(CancelResultEnum.CANCEL_FAIL_RESET.getKey());
cancelResultVO.setMsg(CancelResultEnum.CANCEL_FAIL_RESET.getDesc());
}
log.info("[渠道支付取消]返回结果:{}", cancelResultVO);
Integer payState = cancelResultVO.getCode();
if (CancelResultEnum.CANCEL_SUCCESS.getKey().equals(payState)) {
payState = PayStateEnum.PAY_CLOSE.getKey();
this.tradeChannelService.updateTradeRecordChannelState(tradeChannel.getTradeChannelId(), payState, CancelResultEnum.CANCEL_SUCCESS.getDesc(), (String)null, (BigDecimal)null, (JsonNode)null, (LocalDateTime)null);
} else {
payState = PayStateEnum.PAY_INPROCESS.getKey();
}
cancelResultVO.setPayState(payState);
return cancelResultVO;
}
}

View File

@ -4,6 +4,7 @@ package com.bonus.canteen.core.pay.common.service;
import com.bonus.canteen.core.allocation.alloc.model.AllocPayModel;
import com.bonus.canteen.core.order.utils.LeNumUtil;
import com.bonus.canteen.core.pay.channel.cmb.dto.QrCodeApplyDTO;
import com.bonus.canteen.core.pay.common.constants.CancelResultEnum;
import com.bonus.canteen.core.pay.common.constants.PayChannelEnum;
import com.bonus.canteen.core.pay.common.constants.PayChannelSelectEnum;
import com.bonus.canteen.core.pay.common.constants.PayStateEnum;
@ -127,4 +128,11 @@ public interface PayService {
payRefundVO.setMsg("当前渠道暂不支持退款功能");
return payRefundVO;
}
default PayCancelVO payCancel(PayCancelDTO payCancelDTO) {
PayCancelVO payCancelVO = new PayCancelVO();
payCancelVO.setCode(CancelResultEnum.CANCEL_FAIL.getKey());
payCancelVO.setMsg("当前渠道暂不支持取消功能");
return payCancelVO;
}
}

View File

@ -15,6 +15,8 @@ public interface TradeRecordService {
void updateTradeRecordState(Long tradeId, UnifyPayVO payVO);
void updateTradeRecordState(Long tradeId, Integer tradeState, String tradeResult);
void updateTradeRecordState(Long tradeId, UnifyRefundVO refundVO);
TradeRecord getTradeRecordById(Long tradeId);
@ -32,4 +34,6 @@ public interface TradeRecordService {
void deleteOrderRechargeTrade(Long tradeId);
List<TradeRecord> queryTradeRecordInfoList(String macOrderId, Long orderRechargeId, Integer tradeState, Integer tradeType);
List<TradeRecord> listTradeRecordByOrderRechargeId(@Param("orderRechargeId") Long orderRechargeId, @Param("tradeState") Integer... tradeState);
}

View File

@ -61,6 +61,10 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade
this.updateTradeRecordState(tradeId, payVO.getCode(), payVO.getMsg(), payVO.getOutTradeNo(), payVO.getPayChannel(), payVO.getPayType(), payVO.getPayTime(), payVO.getCustId());
}
public void updateTradeRecordState(Long tradeId, Integer tradeState, String tradeResult) {
this.updateTradeRecordState(tradeId, tradeState, tradeResult, (String)null, (Integer)null, (Integer)null, (LocalDateTime)null, (Long)null);
}
protected void updateTradeRecordState(Long tradeId, Integer tradeState, String tradeResult, String outTradeNo, Integer payChannel, Integer payType, LocalDateTime tradeTime, Long custId) {
log.info("[交易记录] updateTradeRecordState 开始");
List<LocalDateTime> timeRange = LeOrderUtil.queryCreateTimeRange(tradeId);
@ -135,5 +139,11 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade
return tradeRecordList;
}
}
public List<TradeRecord> listTradeRecordByOrderRechargeId(@Param("orderRechargeId") Long orderRechargeId, @Param("tradeState") Integer... tradeState) {
log.info("[交易记录] listTradeRecordByOrderRechargeId 开始");
List<LocalDateTime> timeRange = LeOrderUtil.queryCreateTimeRange();
List<TradeRecord> tradeRecords = ((TradeRecordMapper)this.baseMapper).listTradeRecordByOrderRechargeId(orderRechargeId, (LocalDateTime)timeRange.get(0), (LocalDateTime)timeRange.get(1), tradeState);
log.info("[交易记录] listTradeRecordByOrderRechargeId 结束");
return tradeRecords;
}
}

View File

@ -1,13 +1,16 @@
package com.bonus.canteen.core.pay.custom;
import com.bonus.canteen.core.common.custom.business.CustomBusiness;
import com.bonus.canteen.core.pay.api.dto.UnifyPayCancelDTO;
import com.bonus.canteen.core.pay.api.dto.UnifyPayDTO;
import com.bonus.canteen.core.pay.api.dto.UnifyPaySelectDTO;
import com.bonus.canteen.core.pay.api.dto.UnifyRefundDTO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayCancelVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
import com.bonus.canteen.core.pay.api.vo.UnifyRefundVO;
import com.bonus.canteen.core.pay.common.constants.PayChannelSelectEnum;
import com.bonus.canteen.core.pay.common.dto.ChannelPayDTO;
import com.bonus.canteen.core.pay.common.dto.PayCancelDTO;
import com.bonus.canteen.core.pay.common.service.PayService;
import com.bonus.canteen.core.pay.common.vo.PayChannelSelectDTO;
import com.bonus.canteen.core.pay.common.vo.PayChannelSelectResultVO;
@ -64,5 +67,13 @@ public class PayCustomBusiness implements CustomBusiness {
public void didPayRefundV2(UnifyRefundDTO payRefundDTO, UnifyRefundVO payRefundVO) {
}
public void willPayCancelV2(UnifyPayCancelDTO payCancelDTO) {
}
public void willChannelPayCancel(PayCancelDTO payCancelDTO) {
}
public void didPayCancelV2(UnifyPayCancelDTO payCancelDTO, UnifyPayCancelVO payCancelVO) {
}
}

View File

@ -5,6 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.supermarket.mapper.SupermarketConfigMapper;
import com.bonus.canteen.core.supermarket.po.BusinessConfigModel;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.houqin.constant.DelFlagEnum;
import com.bonus.common.houqin.constant.LeConstants;
@ -36,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -55,9 +58,9 @@ public class SupermarketApi {
@Autowired
@Lazy
private SupermarketProductMapper supermarketProductMapper;
// @Autowired
// @Lazy
// private SupermarketConfigMapper supermarketConfigMapper;
@Autowired
@Lazy
private SupermarketConfigMapper supermarketConfigMapper;
@Autowired
@Lazy
private DrpServiceApi drpServiceApi;
@ -159,19 +162,19 @@ public class SupermarketApi {
}
}
//
// public boolean ifBusiness(Long supermarketId) {
// int weekDay = LocalDate.now().getDayOfWeek().getValue();
// BusinessConfigModel businessInfo = this.supermarketConfigMapper.getBusinessInfo(supermarketId, weekDay);
// if (ObjectUtil.isEmpty(businessInfo)) {
// throw new LeException(I18n.getMessage("supermarket.config-not-exit", new Object[0]));
// } else if (businessInfo.getIfBusiness().equals(LeConstants.COMMON_NO)) {
// return false;
// } else {
// LocalTime nowTime = LocalTime.now();
// return nowTime.isAfter(businessInfo.getOpeningTime()) && nowTime.isBefore(businessInfo.getClosingTime());
// }
// }
public boolean ifBusiness(Long supermarketId) {
int weekDay = LocalDate.now().getDayOfWeek().getValue();
BusinessConfigModel businessInfo = this.supermarketConfigMapper.getBusinessInfo(supermarketId, weekDay);
if (ObjectUtil.isEmpty(businessInfo)) {
throw new ServiceException(I18n.getMessage("supermarket.config-not-exit", new Object[0]));
} else if (businessInfo.getIfBusiness().equals(LeConstants.COMMON_NO)) {
return false;
} else {
LocalTime nowTime = LocalTime.now();
return nowTime.isAfter(businessInfo.getOpeningTime()) && nowTime.isBefore(businessInfo.getClosingTime());
}
}
public boolean ifAllowRefund(Long supermarketId, LocalDateTime ordTime) {
LocalDate ordDate = ordTime.toLocalDate();

View File

@ -0,0 +1,19 @@
package com.bonus.canteen.core.supermarket.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.supermarket.model.SupermarketConfig;
import com.bonus.canteen.core.supermarket.po.BusinessConfigModel;
import com.bonus.canteen.core.supermarket.vo.SupermarketConfigPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SupermarketConfigMapper extends BaseMapper<SupermarketConfig> {
List<SupermarketConfigPageVO> listConfig(Long supermarketId);
List<Integer> listReserveWeek(@Param("supermarketId") Long supermarketId, @Param("trueConfig") Integer trueConfig);
BusinessConfigModel getBusinessInfo(@Param("supermarketId") Long supermarketId, @Param("weekDay") Integer weekDay);
}

View File

@ -0,0 +1,180 @@
package com.bonus.canteen.core.supermarket.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.time.LocalTime;
@ApiModel(
value = "超市营业配置表",
description = "超市营业配置表"
)
public class SupermarketConfig {
@ApiModelProperty("一周id")
private Long weekId;
@ApiModelProperty("超市id")
private Long supermarketId;
@ApiModelProperty("一周名称")
private String weekName;
@ApiModelProperty("一周类型 1:周一 2:周二 3:周三 4:周四 5:周五 6:周六 7:周日")
private Integer weekType;
@ApiModelProperty("营业开始时间")
private LocalTime openingTime;
@ApiModelProperty("营业结束时间")
private LocalTime closingTime;
@ApiModelProperty("是否营业 (1营业, 2休息)")
private Integer ifBusiness;
@ApiModelProperty("是否预定取货日(1是2否)")
private Integer ifReserveFetch;
@ApiModelProperty("乐观锁")
private Integer revision;
@TableField(
value = "crtime",
fill = FieldFill.INSERT
)
@ApiModelProperty("创建时间")
private LocalDateTime crtime;
@TableField(
value = "uptime",
fill = FieldFill.UPDATE
)
@ApiModelProperty("更新时间")
private LocalDateTime uptime;
@TableField(
value = "crby",
fill = FieldFill.INSERT
)
@ApiModelProperty("创建人")
private String crby;
@TableField(
value = "upby",
fill = FieldFill.UPDATE
)
@ApiModelProperty("更新人")
private String upby;
public Long getWeekId() {
return this.weekId;
}
public Long getSupermarketId() {
return this.supermarketId;
}
public String getWeekName() {
return this.weekName;
}
public Integer getWeekType() {
return this.weekType;
}
public LocalTime getOpeningTime() {
return this.openingTime;
}
public LocalTime getClosingTime() {
return this.closingTime;
}
public Integer getIfBusiness() {
return this.ifBusiness;
}
public Integer getIfReserveFetch() {
return this.ifReserveFetch;
}
public Integer getRevision() {
return this.revision;
}
public LocalDateTime getCrtime() {
return this.crtime;
}
public LocalDateTime getUptime() {
return this.uptime;
}
public String getCrby() {
return this.crby;
}
public String getUpby() {
return this.upby;
}
public SupermarketConfig setWeekId(final Long weekId) {
this.weekId = weekId;
return this;
}
public SupermarketConfig setSupermarketId(final Long supermarketId) {
this.supermarketId = supermarketId;
return this;
}
public SupermarketConfig setWeekName(final String weekName) {
this.weekName = weekName;
return this;
}
public SupermarketConfig setWeekType(final Integer weekType) {
this.weekType = weekType;
return this;
}
public SupermarketConfig setOpeningTime(final LocalTime openingTime) {
this.openingTime = openingTime;
return this;
}
public SupermarketConfig setClosingTime(final LocalTime closingTime) {
this.closingTime = closingTime;
return this;
}
public SupermarketConfig setIfBusiness(final Integer ifBusiness) {
this.ifBusiness = ifBusiness;
return this;
}
public SupermarketConfig setIfReserveFetch(final Integer ifReserveFetch) {
this.ifReserveFetch = ifReserveFetch;
return this;
}
public SupermarketConfig setRevision(final Integer revision) {
this.revision = revision;
return this;
}
public SupermarketConfig setCrtime(final LocalDateTime crtime) {
this.crtime = crtime;
return this;
}
public SupermarketConfig setUptime(final LocalDateTime uptime) {
this.uptime = uptime;
return this;
}
public SupermarketConfig setCrby(final String crby) {
this.crby = crby;
return this;
}
public SupermarketConfig setUpby(final String upby) {
this.upby = upby;
return this;
}
public String toString() {
Long var10000 = this.getWeekId();
return "SupermarketConfig(weekId=" + var10000 + ", supermarketId=" + this.getSupermarketId() + ", weekName=" + this.getWeekName() + ", weekType=" + this.getWeekType() + ", openingTime=" + String.valueOf(this.getOpeningTime()) + ", closingTime=" + String.valueOf(this.getClosingTime()) + ", ifBusiness=" + this.getIfBusiness() + ", ifReserveFetch=" + this.getIfReserveFetch() + ", revision=" + this.getRevision() + ", crtime=" + String.valueOf(this.getCrtime()) + ", uptime=" + String.valueOf(this.getUptime()) + ", crby=" + this.getCrby() + ", upby=" + this.getUpby() + ")";
}
}

View File

@ -0,0 +1,45 @@
package com.bonus.canteen.core.supermarket.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
@ApiModel
public class BusinessConfigModel {
@ApiModelProperty("是否营业")
private Integer ifBusiness;
@ApiModelProperty("营业开始时间")
private LocalTime openingTime;
@ApiModelProperty("营业结束时间")
private LocalTime closingTime;
public Integer getIfBusiness() {
return this.ifBusiness;
}
public LocalTime getOpeningTime() {
return this.openingTime;
}
public LocalTime getClosingTime() {
return this.closingTime;
}
public void setIfBusiness(final Integer ifBusiness) {
this.ifBusiness = ifBusiness;
}
public void setOpeningTime(final LocalTime openingTime) {
this.openingTime = openingTime;
}
public void setClosingTime(final LocalTime closingTime) {
this.closingTime = closingTime;
}
public String toString() {
Integer var10000 = this.getIfBusiness();
return "BusinessConfigModel(ifBusiness=" + var10000 + ", openingTime=" + String.valueOf(this.getOpeningTime()) + ", closingTime=" + String.valueOf(this.getClosingTime()) + ")";
}
}

View File

@ -0,0 +1,108 @@
package com.bonus.canteen.core.supermarket.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
@ApiModel(
value = "超市营业配置表",
description = "超市营业配置表"
)
public class SupermarketConfigPageVO {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("一周id")
private Long weekId;
@ApiModelProperty("超市id")
private Long supermarketId;
@ApiModelProperty("一周名称")
private String weekName;
@ApiModelProperty("一周类型 1:周一 2:周二 3:周三 4:周四 5:周五 6:周六 7:周日")
private Integer weekType;
@ApiModelProperty("营业开始时间")
private LocalTime openingTime;
@ApiModelProperty("营业结束时间")
private LocalTime closingTime;
@ApiModelProperty("是否营业 (1营业, 2休息)")
private Integer ifBusiness;
@ApiModelProperty("是否预定取货日(1是2否)")
private Integer ifReserveFetch;
public Long getId() {
return this.id;
}
public Long getWeekId() {
return this.weekId;
}
public Long getSupermarketId() {
return this.supermarketId;
}
public String getWeekName() {
return this.weekName;
}
public Integer getWeekType() {
return this.weekType;
}
public LocalTime getOpeningTime() {
return this.openingTime;
}
public LocalTime getClosingTime() {
return this.closingTime;
}
public Integer getIfBusiness() {
return this.ifBusiness;
}
public Integer getIfReserveFetch() {
return this.ifReserveFetch;
}
public void setId(final Long id) {
this.id = id;
}
public void setWeekId(final Long weekId) {
this.weekId = weekId;
}
public void setSupermarketId(final Long supermarketId) {
this.supermarketId = supermarketId;
}
public void setWeekName(final String weekName) {
this.weekName = weekName;
}
public void setWeekType(final Integer weekType) {
this.weekType = weekType;
}
public void setOpeningTime(final LocalTime openingTime) {
this.openingTime = openingTime;
}
public void setClosingTime(final LocalTime closingTime) {
this.closingTime = closingTime;
}
public void setIfBusiness(final Integer ifBusiness) {
this.ifBusiness = ifBusiness;
}
public void setIfReserveFetch(final Integer ifReserveFetch) {
this.ifReserveFetch = ifReserveFetch;
}
public String toString() {
Long var10000 = this.getId();
return "SupermarketConfigPageVO(id=" + var10000 + ", weekId=" + this.getWeekId() + ", supermarketId=" + this.getSupermarketId() + ", weekName=" + this.getWeekName() + ", weekType=" + this.getWeekType() + ", openingTime=" + String.valueOf(this.getOpeningTime()) + ", closingTime=" + String.valueOf(this.getClosingTime()) + ", ifBusiness=" + this.getIfBusiness() + ", ifReserveFetch=" + this.getIfReserveFetch() + ")";
}
}

View File

@ -23,6 +23,7 @@
WHERE
bc.cust_id = #{custId}
AND bc.source_type = #{sourceType}
order by crtime desc
</select>
<!--&lt;!&ndash; 分页获取投诉建议&ndash;&gt;-->
<!-- <select id="selectPlaintPage" resultType="net.xnzn.core.allocation.advise.vo.BasicsComplaintPageVO">-->

View File

@ -103,8 +103,14 @@
LEFT JOIN cust_place place ON ci.place_id = place.place_id
LEFT JOIN cust_cost_center A ON A.cost_center_id = ci.cost_center_id
LEFT JOIN cust_casual cc on ci.cust_id = cc.cust_id
where ci.cust_id = #{info.custId}
and ci.cust_state = #{info.custState}
where
ci.cust_state = #{info.custState}
<if test="info.custId != null">
and ci.cust_id = #{info.custId}
</if>
<if test="info.mobile != null">
and ci.mobile = #{info.mobile}
</if>
</select>
<!-- 查询用户详细信息 -->

View File

@ -67,57 +67,57 @@
<!-- </select>-->
<!-- &lt;!&ndash; AI电子秤原料搜索 &ndash;&gt;-->
<!-- <select id="selectAndroidMaterialList"-->
<!-- resultType="net.xnzn.core.drp.vo.AndroidSearchMaterialVO">-->
<!-- select-->
<!-- mm.material_id,-->
<!-- mm.material_name,-->
<!-- mm.material_code,-->
<!-- mmc.category_name,-->
<!-- ds.supplier_id,-->
<!-- ds.supplier_name,-->
<!-- mm.unit_id,-->
<!-- du.unit_name,-->
<!-- du.weigh_type,-->
<!-- du.rate,-->
<!-- did.unit_price-->
<!-- from-->
<!-- menu_material mm-->
<!-- left join (-->
<!-- select-->
<!-- a.*-->
<!-- from-->
<!-- drp_into_detail as a,-->
<!-- ( select b.material_id, max( b.id ) as id from drp_into_detail as b group by b.material_id ) as c-->
<!-- where-->
<!-- a.material_id = c.material_id-->
<!-- and a.id = c.id-->
<!-- ) did on mm.material_id = did.material_id-->
<!-- left join menu_material_category mmc on mm.category_id = mmc.category_id-->
<!-- left join drp_supplier ds on did.supplier_id = ds.supplier_id-->
<!-- left join drp_unit du on mm.unit_id = du.unit_id-->
<!-- where-->
<!-- mm.del_flag = #{delFlag}-->
<!-- <if test="content.materialCode != null and content.materialCode != ''">-->
<!-- and mm.material_code = #{content.materialCode}-->
<!-- </if>-->
<!-- <if test="content.materialName != null and content.materialName != ''">-->
<!-- and (-->
<!-- mm.material_name like concat(concat('%', #{content.materialName}), '%')-->
<!-- or mm.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')-->
<!-- or mm.pinyin_full like concat(concat('%', #{pinyinFull}), '%')-->
<!-- )-->
<!-- </if>-->
<!-- <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!-- and mm.category_id in-->
<!-- <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!-- #{categoryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="content.barCode != null and content.barCode != ''">-->
<!-- and mm.bar_code = #{content.barCode}-->
<!-- </if>-->
<!-- </select>-->
<select id="selectAndroidMaterialList"
resultType="com.bonus.canteen.core.drp.vo.AndroidSearchMaterialVO">
select
mm.material_id,
mm.material_name,
mm.material_code,
mmc.category_name,
ds.supplier_id,
ds.supplier_name,
mm.unit_id,
du.unit_name,
du.weigh_type,
du.rate,
did.unit_price
from
menu_material mm
left join (
select
a.*
from
drp_into_detail as a,
( select b.material_id, max( b.id ) as id from drp_into_detail as b group by b.material_id ) as c
where
a.material_id = c.material_id
and a.id = c.id
) did on mm.material_id = did.material_id
left join menu_material_category mmc on mm.category_id = mmc.category_id
left join drp_supplier ds on did.supplier_id = ds.supplier_id
left join drp_unit du on mm.unit_id = du.unit_id
where
mm.del_flag = #{delFlag}
<if test="content.materialCode != null and content.materialCode != ''">
and mm.material_code = #{content.materialCode}
</if>
<if test="content.materialName != null and content.materialName != ''">
and (
mm.material_name like concat(concat('%', #{content.materialName}), '%')
or mm.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')
or mm.pinyin_full like concat(concat('%', #{pinyinFull}), '%')
)
</if>
<if test="content.categoryIdList != null and content.categoryIdList.size() > 0">
and mm.category_id in
<foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">
#{categoryId}
</foreach>
</if>
<if test="content.barCode != null and content.barCode != ''">
and mm.bar_code = #{content.barCode}
</if>
</select>
<!-- <select id="searchInventoryMaterial"-->
<!-- resultType="net.xnzn.core.drp.vo.AndroidSearchInventoryMaterialVO">-->

View File

@ -102,10 +102,12 @@
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
where
bind_type = 3
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
<if test="effIdSet !=null and effIdSet.size()>0">
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</if>
<if test="recipeId != null">
and mar.recipe_id = #{recipeId}
</if>
@ -335,4 +337,31 @@
<!-- #{effId}-->
<!-- </foreach>-->
<!-- </select>-->
<select id="selectWeekRecipeIdHistory" resultType="java.lang.Long">
select
mar.recipe_id
from
menu_app_recipe_history mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
where
bind_type = 3
and mar.recipe_id in
<foreach collection="recipeIdList" item="repiceId" separator="," open="(" close=")">
#{repiceId}
</foreach>
and #{applyDate} >= DATE(mar.bind_time)
ORDER BY bind_time desc limit 1
</select>
<select id="getRecipeIdListByRecipeId" resultType="java.lang.Long">
select recipe_id from menu_recipe where stall_id = (select stall_id from menu_recipe where recipe_id = #{recipeId})
</select>
<select id="getBingTimeByRecipeId" resultType="java.lang.String">
select bind_time from menu_app_recipe where recipe_id = #{recipeId} and bind_type = 3
</select>
</mapper>

View File

@ -0,0 +1,43 @@
<?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.bonus.canteen.core.supermarket.mapper.SupermarketConfigMapper">
<select id="listConfig" resultType="com.bonus.canteen.core.supermarket.vo.SupermarketConfigPageVO">
SELECT
week_id,
supermarket_id,
week_name,
week_type,
opening_time,
closing_time,
if_business,
if_reserve_fetch
FROM
supermarket_config
WHERE
supermarket_id = #{supermarketId}
</select>
<select id="listReserveWeek" resultType="java.lang.Integer">
SELECT
week_type
FROM
supermarket_config
WHERE
supermarket_id = #{supermarketId}
AND if_business = #{trueConfig}
AND if_reserve_fetch = #{trueConfig}
ORDER BY
week_type
</select>
<select id="getBusinessInfo" resultType="com.bonus.canteen.core.supermarket.po.BusinessConfigModel">
SELECT
if_business,
opening_time,
closing_time
FROM
supermarket_config
WHERE
supermarket_id = #{supermarketId}
AND week_type = #{weekDay}
</select>
</mapper>