Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2025-04-27 08:56:43 +08:00
commit d486c7a194
13 changed files with 75 additions and 36 deletions

View File

@ -12,29 +12,25 @@ import org.springframework.stereotype.Service;
@Service @Service
public class DeviceServiceImpl implements DeviceService { public class DeviceServiceImpl implements DeviceService {
@Autowired
private DeviceMapper mapper;
@Value("${face.android.appId}")
private String appId;
@Value("${face.android.sdkKey}")
private String appKey;
@Override @Override
public AjaxResult getDeviceInfo(AppDTO dto) { public AjaxResult getDeviceInfo(AppDTO dto) {
return null; //判断设备是否存在
DeviceInfoVo deviceInfoVo = mapper.getDeviceInfo(dto);
if (deviceInfoVo == null) {
return AjaxResult.error("设备不存在");
}
deviceInfoVo.setAppId(appId);
deviceInfoVo.setAppKey(appKey);
deviceInfoVo.setTenantId(String.valueOf(GlobalConstants.TENANT_ID));
return AjaxResult.success(deviceInfoVo);
} }
// @Autowired
// private DeviceMapper mapper;
//
//
// @Value("${face.android.appId}")
// private String appId;
// @Value("${face.android.sdkKey}")
// private String appKey;
//
// @Override
// public AjaxResult getDeviceInfo(AppDTO dto) {
// //判断设备是否存在
// DeviceInfoVo deviceInfoVo = mapper.getDeviceInfo(dto);
// if (deviceInfoVo == null){
// return AjaxResult.error("设备不存在");
// }
// deviceInfoVo.setAppId(appId);
// deviceInfoVo.setAppKey(appKey);
// deviceInfoVo.setTenantId(String.valueOf(GlobalConstants.TENANT_ID));
// return AjaxResult.success(deviceInfoVo);
// }
} }

View File

@ -5,6 +5,7 @@ import com.bonus.canteen.core.android.mapper.UserMapper;
import com.bonus.canteen.core.android.service.UserService; import com.bonus.canteen.core.android.service.UserService;
import com.bonus.canteen.core.android.vo.UserInfoVo; import com.bonus.canteen.core.android.vo.UserInfoVo;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.houqin.utils.SM4EncryptUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -26,6 +27,9 @@ public class UserServiceImpl implements UserService {
List<UserInfoVo> moneyList = mapper.getMoneyList(); List<UserInfoVo> moneyList = mapper.getMoneyList();
if (!list.isEmpty()){ if (!list.isEmpty()){
list.forEach(userInfoVo -> { list.forEach(userInfoVo -> {
if (userInfoVo.getPhone().length() != 11){
userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone()));
}
UserInfoVo money = moneyList.stream().filter(moneyVo -> moneyVo.getUserId().equals(userInfoVo.getUserId())).findFirst().orElse(null); UserInfoVo money = moneyList.stream().filter(moneyVo -> moneyVo.getUserId().equals(userInfoVo.getUserId())).findFirst().orElse(null);
if (money != null){ if (money != null){
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance()); userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
@ -38,4 +42,5 @@ public class UserServiceImpl implements UserService {
} }
return AjaxResult.success(list); return AjaxResult.success(list);
} }
} }

View File

@ -13,6 +13,10 @@ public class UserInfoVo {
private String userName; private String userName;
private String phone;
private String loginType;
private String accId; private String accId;
/** /**
* 卡号 * 卡号

View File

@ -0,0 +1,18 @@
package com.bonus.canteen.core.common.utils;
import com.bonus.common.core.exception.ServiceException;
import java.lang.reflect.Field;
public class ObjectUtils {
public static void setAllFieldsToNull(Object obj) {
for (Field field : obj.getClass().getDeclaredFields()) {
field.setAccessible(true);
try {
field.set(obj, null);
} catch (IllegalAccessException e) {
throw new ServiceException("系统异常");
}
}
}
}

View File

@ -3,6 +3,7 @@ package com.bonus.canteen.core.order.business;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO; import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
import com.bonus.canteen.core.account.service.IAccInfoService; import com.bonus.canteen.core.account.service.IAccInfoService;
import com.bonus.canteen.core.common.utils.ObjectUtils;
import com.bonus.canteen.core.menu.domain.MenuRecipeDishes; import com.bonus.canteen.core.menu.domain.MenuRecipeDishes;
import com.bonus.canteen.core.menu.service.IMenuRecipeDishesService; import com.bonus.canteen.core.menu.service.IMenuRecipeDishesService;
import com.bonus.canteen.core.order.constants.OrderDetailTypeEnum; import com.bonus.canteen.core.order.constants.OrderDetailTypeEnum;
@ -51,6 +52,7 @@ public class OrderBusiness {
continue; continue;
} }
MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes(); MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes();
ObjectUtils.setAllFieldsToNull(menuRecipeDishes);
menuRecipeDishes.setDetailId(orderDetail.getMenuDetailId()); menuRecipeDishes.setDetailId(orderDetail.getMenuDetailId());
menuRecipeDishes.setDishesId(orderDetail.getGoodsId()); menuRecipeDishes.setDishesId(orderDetail.getGoodsId());
menuRecipeDishesService.reduceMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity()); menuRecipeDishesService.reduceMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity());
@ -63,6 +65,7 @@ public class OrderBusiness {
continue; continue;
} }
MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes(); MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes();
ObjectUtils.setAllFieldsToNull(menuRecipeDishes);
menuRecipeDishes.setDetailId(orderDetail.getDetailId()); menuRecipeDishes.setDetailId(orderDetail.getDetailId());
menuRecipeDishes.setDishesId(orderDetail.getGoodsId()); menuRecipeDishes.setDishesId(orderDetail.getGoodsId());
menuRecipeDishesService.addMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity()); menuRecipeDishesService.addMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity());

View File

@ -189,8 +189,6 @@ public class OrderInfo extends BaseEntity
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY)); orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY)); orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
orderInfo.setUserId(param.getUserId()); orderInfo.setUserId(param.getUserId());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setSourceType(param.getSourceType()); orderInfo.setSourceType(param.getSourceType());
orderInfo.setCreateBy(SecurityUtils.getUsername()); orderInfo.setCreateBy(SecurityUtils.getUsername());
orderInfo.setCreateTime(DateUtils.getNowDate()); orderInfo.setCreateTime(DateUtils.getNowDate());
@ -210,7 +208,6 @@ public class OrderInfo extends BaseEntity
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey()); orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey()); orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey()); orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
orderInfo.setPayType(param.getPayType());
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey()); orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey()); orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
orderInfo.setDeliveryAmount(BigDecimal.ZERO); orderInfo.setDeliveryAmount(BigDecimal.ZERO);
@ -286,14 +283,11 @@ public class OrderInfo extends BaseEntity
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY)); orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
orderInfo.setIdentityVerification(orderInfoAddParam.getIdentityVerification()); orderInfo.setIdentityVerification(orderInfoAddParam.getIdentityVerification());
orderInfo.setUserId(param.getUserId()); orderInfo.setUserId(param.getUserId());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setSourceType(param.getSourceType()); orderInfo.setSourceType(param.getSourceType());
orderInfo.setCreateBy(SecurityUtils.getUsername()); orderInfo.setCreateBy(SecurityUtils.getUsername());
orderInfo.setCreateTime(DateUtils.getNowDate()); orderInfo.setCreateTime(DateUtils.getNowDate());
orderInfo.setUpdateBy(SecurityUtils.getUsername()); orderInfo.setUpdateBy(SecurityUtils.getUsername());
orderInfo.setUpdateTime(DateUtils.getNowDate()); orderInfo.setUpdateTime(DateUtils.getNowDate());
orderInfo.setPayType(param.getPayType());
Long canteenId = orderInfoAddParam.getCanteenId(); Long canteenId = orderInfoAddParam.getCanteenId();
orderInfo.setCanteenId(Objects.isNull(canteenId) ? -1 : canteenId); orderInfo.setCanteenId(Objects.isNull(canteenId) ? -1 : canteenId);
Long stallId = orderInfoAddParam.getStallId(); Long stallId = orderInfoAddParam.getStallId();

View File

@ -62,8 +62,6 @@ public class ShopOrderAddParam {
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY)); orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY)); orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
orderInfo.setUserId(param.getUserId()); orderInfo.setUserId(param.getUserId());
orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setSourceType(param.getSourceType()); orderInfo.setSourceType(param.getSourceType());
orderInfo.setCreateBy(SecurityUtils.getUsername()); orderInfo.setCreateBy(SecurityUtils.getUsername());
orderInfo.setCreateTime(DateUtils.getNowDate()); orderInfo.setCreateTime(DateUtils.getNowDate());
@ -76,7 +74,6 @@ public class ShopOrderAddParam {
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey()); orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey()); orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey()); orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
orderInfo.setPayType(param.getPayType());
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey()); orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey()); orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
orderInfo.setDeliveryAmount(BigDecimal.ZERO); orderInfo.setDeliveryAmount(BigDecimal.ZERO);
@ -86,7 +83,7 @@ public class ShopOrderAddParam {
orderInfo.setOrderTime(DateUtils.getNowDate()); orderInfo.setOrderTime(DateUtils.getNowDate());
orderInfo.setExternalPayAmount(BigDecimal.ZERO); orderInfo.setExternalPayAmount(BigDecimal.ZERO);
orderInfo.setRefundAmount(BigDecimal.ZERO); orderInfo.setRefundAmount(BigDecimal.ZERO);
orderInfo.setPayableAmount(param.getRealAmount()); orderInfo.setPayableAmount(param.getPayableAmount());
orderInfo.setDiscountsAmount(BigDecimal.ZERO); orderInfo.setDiscountsAmount(BigDecimal.ZERO);
orderInfo.setRealAmount(param.getRealAmount()); orderInfo.setRealAmount(param.getRealAmount());
orderInfo.setAccountPayAmount(param.getRealAmount()); orderInfo.setAccountPayAmount(param.getRealAmount());

View File

@ -139,6 +139,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
accInfoService.checkAccStatus(accInfoVO); accInfoService.checkAccStatus(accInfoVO);
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam); List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
orderPay(orderInfoList); orderPay(orderInfoList);
return 1; return 1;
@ -154,6 +155,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
accInfoService.checkAccStatus(accInfoVO); accInfoService.checkAccStatus(accInfoVO);
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam); List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
orderPay(orderInfoList); orderPay(orderInfoList);
return 1; return 1;
@ -291,6 +293,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
return orderPayDTO; return orderPayDTO;
} }
private void checkOrdersTotalAmount(List<OrderInfo> orderInfoList ,BigDecimal totalAmountParam) {
BigDecimal totalAmount = BigDecimal.ZERO;
if(CollUtil.isNotEmpty(orderInfoList)) {
totalAmount = orderInfoList.stream()
.map(OrderInfo::getRealAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
if(totalAmount.compareTo(totalAmountParam) != 0) {
throw new ServiceException("订单金额有误");
}
}
/** /**
* 修改订单 * 修改订单

View File

@ -10,6 +10,7 @@ import java.time.LocalDateTime;
public class DeptIncomeOutcomeVO implements Serializable { public class DeptIncomeOutcomeVO implements Serializable {
private Long deptId; private Long deptId;
private String deptName; private String deptName;
private String deptFullName;
private BigDecimal walletBal; private BigDecimal walletBal;
private BigDecimal income; private BigDecimal income;
private BigDecimal outcome; private BigDecimal outcome;

View File

@ -11,6 +11,7 @@ public class UserIncomeOutcomeVO implements Serializable {
private String phonenumber; private String phonenumber;
private Long deptId; private Long deptId;
private String deptName; private String deptName;
private String deptFullName;
private String nickName; private String nickName;
private BigDecimal walletBal; private BigDecimal walletBal;
private BigDecimal walletBalNow; private BigDecimal walletBalNow;

View File

@ -10,7 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ac.acc_id as accId, ac.acc_id as accId,
ac.card_num as cardNum, ac.card_num as cardNum,
ac.serial_num as serialNum, ac.serial_num as serialNum,
ai.acc_status as accStatus ai.acc_status as accStatus,
su.phone as phone,
su.login_type as loginType
from sys_user su from sys_user su
left join acc_card ac on ac.user_id = su.user_id left join acc_card ac on ac.user_id = su.user_id
left join acc_info ai on ai.user_id = su.user_id left join acc_info ai on ai.user_id = su.user_id

View File

@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
c.dept_id, c.dept_id,
c.dept_name, c.dept_name,
c.dept_full_name,
c.wallet_bal_dept as wallet_bal, c.wallet_bal_dept as wallet_bal,
b.income, b.income,
b.outcome, b.outcome,
@ -95,7 +96,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select select
IFNULL(sum(a.wallet_bal), 0) as wallet_bal_dept , IFNULL(sum(a.wallet_bal), 0) as wallet_bal_dept ,
su.dept_id, su.dept_id,
sd.dept_name sd.dept_name,
sd.dept_full_name
from from
( (
select select
@ -144,6 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.phonenumber, su.phonenumber,
sd.dept_id, sd.dept_id,
sd.dept_name, sd.dept_name,
sd.dept_full_name,
SUM(IFNULL(CASE SUM(IFNULL(CASE
WHEN at2.trade_type in (10, 20, 130) then WHEN at2.trade_type in (10, 20, 130) then
at2.actual_amount at2.actual_amount
@ -188,6 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user su on left join sys_user su on
a.user_id = su.user_id a.user_id = su.user_id
where where
1 = 1
<if test="param.deptIdList != null and param.deptIdList.size() > 0"> <if test="param.deptIdList != null and param.deptIdList.size() > 0">
and su.dept_id in and su.dept_id in
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")"> <foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">

View File

@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select select
oi.canteen_id, oi.canteen_id,
oi.stall_id, oi.stall_id,
CONCAT(ac.canteen_name , '/', ast.stall_name), CONCAT(ac.canteen_name , '/', ast.stall_name) as canteenAndStallName,
count(distinct case when oi.mealtime_type = 1 then count(distinct case when oi.mealtime_type = 1 then
oi.user_id else null oi.user_id else null
end) as breakfast_user_count, end) as breakfast_user_count,
@ -324,7 +324,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select select
od.goods_id, od.goods_id,
od.goods_name, od.goods_name,
mrd.sale_price, ifnull(mrd.sale_price, 0) as sale_price,
sum(case when oi.mealtime_type = 1 then sum(case when oi.mealtime_type = 1 then
od.quantity else 0 od.quantity else 0
end) as breakfast_quantity_count, end) as breakfast_quantity_count,