Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d486c7a194
|
|
@ -12,29 +12,25 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
@Service
|
||||
public class DeviceServiceImpl implements DeviceService {
|
||||
@Autowired
|
||||
private DeviceMapper mapper;
|
||||
|
||||
|
||||
@Value("${face.android.appId}")
|
||||
private String appId;
|
||||
@Value("${face.android.sdkKey}")
|
||||
private String appKey;
|
||||
|
||||
@Override
|
||||
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);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.vo.UserInfoVo;
|
||||
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.stereotype.Service;
|
||||
|
||||
|
|
@ -26,6 +27,9 @@ public class UserServiceImpl implements UserService {
|
|||
List<UserInfoVo> moneyList = mapper.getMoneyList();
|
||||
if (!list.isEmpty()){
|
||||
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);
|
||||
if (money != null){
|
||||
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
|
||||
|
|
@ -38,4 +42,5 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ public class UserInfoVo {
|
|||
|
||||
private String userName;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String loginType;
|
||||
|
||||
private String accId;
|
||||
/**
|
||||
* 卡号
|
||||
|
|
|
|||
|
|
@ -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("系统异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.bonus.canteen.core.order.business;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
|
||||
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.service.IMenuRecipeDishesService;
|
||||
import com.bonus.canteen.core.order.constants.OrderDetailTypeEnum;
|
||||
|
|
@ -51,6 +52,7 @@ public class OrderBusiness {
|
|||
continue;
|
||||
}
|
||||
MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes();
|
||||
ObjectUtils.setAllFieldsToNull(menuRecipeDishes);
|
||||
menuRecipeDishes.setDetailId(orderDetail.getMenuDetailId());
|
||||
menuRecipeDishes.setDishesId(orderDetail.getGoodsId());
|
||||
menuRecipeDishesService.reduceMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity());
|
||||
|
|
@ -63,6 +65,7 @@ public class OrderBusiness {
|
|||
continue;
|
||||
}
|
||||
MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes();
|
||||
ObjectUtils.setAllFieldsToNull(menuRecipeDishes);
|
||||
menuRecipeDishes.setDetailId(orderDetail.getDetailId());
|
||||
menuRecipeDishes.setDishesId(orderDetail.getGoodsId());
|
||||
menuRecipeDishesService.addMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity());
|
||||
|
|
|
|||
|
|
@ -189,8 +189,6 @@ public class OrderInfo extends BaseEntity
|
|||
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
|
||||
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
||||
orderInfo.setUserId(param.getUserId());
|
||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
||||
orderInfo.setRealAmount(param.getRealAmount());
|
||||
orderInfo.setSourceType(param.getSourceType());
|
||||
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||
|
|
@ -210,7 +208,6 @@ public class OrderInfo extends BaseEntity
|
|||
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
|
||||
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
|
||||
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
|
||||
orderInfo.setPayType(param.getPayType());
|
||||
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
|
||||
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
||||
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
||||
|
|
@ -286,14 +283,11 @@ public class OrderInfo extends BaseEntity
|
|||
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
||||
orderInfo.setIdentityVerification(orderInfoAddParam.getIdentityVerification());
|
||||
orderInfo.setUserId(param.getUserId());
|
||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
||||
orderInfo.setRealAmount(param.getRealAmount());
|
||||
orderInfo.setSourceType(param.getSourceType());
|
||||
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||
orderInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
orderInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
orderInfo.setPayType(param.getPayType());
|
||||
Long canteenId = orderInfoAddParam.getCanteenId();
|
||||
orderInfo.setCanteenId(Objects.isNull(canteenId) ? -1 : canteenId);
|
||||
Long stallId = orderInfoAddParam.getStallId();
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ public class ShopOrderAddParam {
|
|||
orderInfo.setDeviceSn(StringUtils.defaultString(orderInfoAddParam.getDeviceSn(), StringUtils.EMPTY));
|
||||
orderInfo.setDeviceNum(StringUtils.defaultString(orderInfoAddParam.getDeviceNum(), StringUtils.EMPTY));
|
||||
orderInfo.setUserId(param.getUserId());
|
||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
||||
orderInfo.setRealAmount(param.getRealAmount());
|
||||
orderInfo.setSourceType(param.getSourceType());
|
||||
orderInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||
|
|
@ -76,7 +74,6 @@ public class ShopOrderAddParam {
|
|||
orderInfo.setOrderState(OrderStateEnum.WAIT_PLACE.getKey());
|
||||
orderInfo.setOrderRefundState(OrderRefundStateEnum.UN_REFUND.getKey());
|
||||
orderInfo.setDeductionType(DeductionTypeEnum.PAY_PLACE.getKey());
|
||||
orderInfo.setPayType(param.getPayType());
|
||||
orderInfo.setPayChannel(PayChannelEnum.ACC.getKey());
|
||||
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
||||
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
||||
|
|
@ -86,7 +83,7 @@ public class ShopOrderAddParam {
|
|||
orderInfo.setOrderTime(DateUtils.getNowDate());
|
||||
orderInfo.setExternalPayAmount(BigDecimal.ZERO);
|
||||
orderInfo.setRefundAmount(BigDecimal.ZERO);
|
||||
orderInfo.setPayableAmount(param.getRealAmount());
|
||||
orderInfo.setPayableAmount(param.getPayableAmount());
|
||||
orderInfo.setDiscountsAmount(BigDecimal.ZERO);
|
||||
orderInfo.setRealAmount(param.getRealAmount());
|
||||
orderInfo.setAccountPayAmount(param.getRealAmount());
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
||||
accInfoService.checkAccStatus(accInfoVO);
|
||||
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
|
||||
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
|
||||
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
|
||||
orderPay(orderInfoList);
|
||||
return 1;
|
||||
|
|
@ -154,6 +155,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
|
||||
accInfoService.checkAccStatus(accInfoVO);
|
||||
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
|
||||
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
|
||||
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
|
||||
orderPay(orderInfoList);
|
||||
return 1;
|
||||
|
|
@ -291,6 +293,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
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("订单金额有误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.time.LocalDateTime;
|
|||
public class DeptIncomeOutcomeVO implements Serializable {
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private String deptFullName;
|
||||
private BigDecimal walletBal;
|
||||
private BigDecimal income;
|
||||
private BigDecimal outcome;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public class UserIncomeOutcomeVO implements Serializable {
|
|||
private String phonenumber;
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private String deptFullName;
|
||||
private String nickName;
|
||||
private BigDecimal walletBal;
|
||||
private BigDecimal walletBalNow;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ac.acc_id as accId,
|
||||
ac.card_num as cardNum,
|
||||
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
|
||||
left join acc_card ac on ac.user_id = su.user_id
|
||||
left join acc_info ai on ai.user_id = su.user_id
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT
|
||||
c.dept_id,
|
||||
c.dept_name,
|
||||
c.dept_full_name,
|
||||
c.wallet_bal_dept as wallet_bal,
|
||||
b.income,
|
||||
b.outcome,
|
||||
|
|
@ -95,7 +96,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select
|
||||
IFNULL(sum(a.wallet_bal), 0) as wallet_bal_dept ,
|
||||
su.dept_id,
|
||||
sd.dept_name
|
||||
sd.dept_name,
|
||||
sd.dept_full_name
|
||||
from
|
||||
(
|
||||
select
|
||||
|
|
@ -144,6 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.phonenumber,
|
||||
sd.dept_id,
|
||||
sd.dept_name,
|
||||
sd.dept_full_name,
|
||||
SUM(IFNULL(CASE
|
||||
WHEN at2.trade_type in (10, 20, 130) then
|
||||
at2.actual_amount
|
||||
|
|
@ -188,6 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user su on
|
||||
a.user_id = su.user_id
|
||||
where
|
||||
1 = 1
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id in
|
||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select
|
||||
oi.canteen_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
|
||||
oi.user_id else null
|
||||
end) as breakfast_user_count,
|
||||
|
|
@ -324,7 +324,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select
|
||||
od.goods_id,
|
||||
od.goods_name,
|
||||
mrd.sale_price,
|
||||
ifnull(mrd.sale_price, 0) as sale_price,
|
||||
sum(case when oi.mealtime_type = 1 then
|
||||
od.quantity else 0
|
||||
end) as breakfast_quantity_count,
|
||||
|
|
|
|||
Loading…
Reference in New Issue