|
@@ -31,14 +31,12 @@ import com.fs.hisStore.config.FsErpConfig;
|
|
|
import com.fs.hisStore.domain.*;
|
|
import com.fs.hisStore.domain.*;
|
|
|
import com.fs.hisStore.dto.FsStoreOrderComputeDTO;
|
|
import com.fs.hisStore.dto.FsStoreOrderComputeDTO;
|
|
|
import com.fs.hisStore.enums.OrderInfoEnum;
|
|
import com.fs.hisStore.enums.OrderInfoEnum;
|
|
|
|
|
+import com.fs.hisStore.mapper.FsStoreCartScrmMapper;
|
|
|
import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
|
|
import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
|
|
|
import com.fs.hisStore.mapper.FsStoreVerifyCodeScrmMapper;
|
|
import com.fs.hisStore.mapper.FsStoreVerifyCodeScrmMapper;
|
|
|
import com.fs.hisStore.param.*;
|
|
import com.fs.hisStore.param.*;
|
|
|
import com.fs.hisStore.service.*;
|
|
import com.fs.hisStore.service.*;
|
|
|
-import com.fs.hisStore.vo.FsHuiFuPayInfo;
|
|
|
|
|
-import com.fs.hisStore.vo.FsMyStoreOrderListQueryVO;
|
|
|
|
|
-import com.fs.hisStore.vo.FsStoreOrderGroupStoreVO;
|
|
|
|
|
-import com.fs.hisStore.vo.FsStoreOrderItemVO;
|
|
|
|
|
|
|
+import com.fs.hisStore.vo.*;
|
|
|
import com.fs.hospital580.entity.Hospital580PrescriptionScrmEntity;
|
|
import com.fs.hospital580.entity.Hospital580PrescriptionScrmEntity;
|
|
|
import com.fs.hospital580.service.Hospital580PrescriptionScrmService;
|
|
import com.fs.hospital580.service.Hospital580PrescriptionScrmService;
|
|
|
import com.fs.hospital580.vo.CacheOpenInformationVo;
|
|
import com.fs.hospital580.vo.CacheOpenInformationVo;
|
|
@@ -157,6 +155,9 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SnowflakeFactory snowflakeFactory;
|
|
private SnowflakeFactory snowflakeFactory;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FsStoreCartScrmMapper cartMapper;
|
|
|
|
|
+
|
|
|
private static final String CACHE_KEY_PREFIX = "cacheSquareInformation";
|
|
private static final String CACHE_KEY_PREFIX = "cacheSquareInformation";
|
|
|
|
|
|
|
|
//TODO 应该没用到
|
|
//TODO 应该没用到
|
|
@@ -455,10 +456,17 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
order.setPayMoney(order.getPayPrice());
|
|
order.setPayMoney(order.getPayPrice());
|
|
|
order.setPayDelivery(BigDecimal.ZERO);
|
|
order.setPayDelivery(BigDecimal.ZERO);
|
|
|
} else if (param.getPayType().equals(2)) {
|
|
} else if (param.getPayType().equals(2)) {
|
|
|
|
|
+ BigDecimal editAmount = param.getEditAmount();
|
|
|
|
|
+ BigDecimal orderPrice = order.getPayPrice();
|
|
|
|
|
+ if (ObjectUtil.isNull(editAmount) || param.getEditAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
+ return R.error("请输入正确的改价金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (editAmount.compareTo(orderPrice) > 0) {
|
|
|
|
|
+ return R.error("改价金额不能大于订单金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal payMoney = editAmount.setScale(2, RoundingMode.HALF_UP);
|
|
|
order.setPayType("2");
|
|
order.setPayType("2");
|
|
|
- BigDecimal payMoney = order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
|
|
|
- payMoney = new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
|
|
- order.setPayDelivery(order.getPayPrice().subtract(payMoney));
|
|
|
|
|
|
|
+ order.setPayDelivery(orderPrice.subtract(payMoney).setScale(2, RoundingMode.HALF_UP));
|
|
|
order.setPayMoney(payMoney);
|
|
order.setPayMoney(payMoney);
|
|
|
} else if (param.getPayType().equals(3)) {
|
|
} else if (param.getPayType().equals(3)) {
|
|
|
//货到付款
|
|
//货到付款
|
|
@@ -592,12 +600,21 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
order.setPayDelivery(BigDecimal.ZERO);
|
|
order.setPayDelivery(BigDecimal.ZERO);
|
|
|
payMoneyTotal = NumberUtil.add(payMoneyTotal, order.getPayPrice());
|
|
payMoneyTotal = NumberUtil.add(payMoneyTotal, order.getPayPrice());
|
|
|
} else if (param.getPayType().equals(2)) {
|
|
} else if (param.getPayType().equals(2)) {
|
|
|
|
|
+ BigDecimal editAmount = param.getEditAmount();
|
|
|
|
|
+ BigDecimal orderPrice = order.getPayPrice();
|
|
|
|
|
+ if (orders.size() > 1 && Objects.equals(2, param.getPayType())) {
|
|
|
|
|
+ return R.error("多店铺订单不能改价");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtil.isNull(editAmount) || param.getEditAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
+ return R.error("请输入正确的改价金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (editAmount.compareTo(orderPrice) > 0) {
|
|
|
|
|
+ return R.error("改价金额不能大于订单金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal payMoney = editAmount.setScale(2, RoundingMode.HALF_UP);
|
|
|
order.setPayType("2");
|
|
order.setPayType("2");
|
|
|
- BigDecimal payMoney = order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
|
|
|
- payMoney = new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
|
|
- order.setPayDelivery(order.getPayPrice().subtract(payMoney));
|
|
|
|
|
|
|
+ order.setPayDelivery(orderPrice.subtract(payMoney).setScale(2, RoundingMode.HALF_UP));
|
|
|
order.setPayMoney(payMoney);
|
|
order.setPayMoney(payMoney);
|
|
|
-
|
|
|
|
|
payMoneyTotal = NumberUtil.add(payMoneyTotal, payMoney);
|
|
payMoneyTotal = NumberUtil.add(payMoneyTotal, payMoney);
|
|
|
|
|
|
|
|
} else if (param.getPayType().equals(3)) {
|
|
} else if (param.getPayType().equals(3)) {
|
|
@@ -804,11 +821,17 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
order.setPayDelivery(BigDecimal.ZERO);
|
|
order.setPayDelivery(BigDecimal.ZERO);
|
|
|
}
|
|
}
|
|
|
else if(param.getPayType().equals(2)){
|
|
else if(param.getPayType().equals(2)){
|
|
|
-
|
|
|
|
|
|
|
+ BigDecimal editAmount = param.getEditAmount();
|
|
|
|
|
+ BigDecimal orderPrice = order.getPayPrice();
|
|
|
|
|
+ if (ObjectUtil.isNull(editAmount) || param.getEditAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
+ return R.error("请输入正确的改价金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (editAmount.compareTo(orderPrice) > 0) {
|
|
|
|
|
+ return R.error("改价金额不能大于订单金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal payMoney = editAmount.setScale(2, RoundingMode.HALF_UP);
|
|
|
order.setPayType("2");
|
|
order.setPayType("2");
|
|
|
- BigDecimal payMoney=order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
|
|
|
- payMoney = payMoney.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
- order.setPayDelivery(order.getPayPrice().subtract(payMoney));
|
|
|
|
|
|
|
+ order.setPayDelivery(orderPrice.subtract(payMoney).setScale(2, RoundingMode.HALF_UP));
|
|
|
order.setPayMoney(payMoney);
|
|
order.setPayMoney(payMoney);
|
|
|
}
|
|
}
|
|
|
else if(param.getPayType().equals(3)){
|
|
else if(param.getPayType().equals(3)){
|
|
@@ -1620,6 +1643,17 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
@Login
|
|
@Login
|
|
|
@PostMapping("/cachePayInfo")
|
|
@PostMapping("/cachePayInfo")
|
|
|
public R cachePayInfo(@RequestBody Map<String, Object> vo) {
|
|
public R cachePayInfo(@RequestBody Map<String, Object> vo) {
|
|
|
|
|
+ String cateIds = vo.get("cateIds").toString();
|
|
|
|
|
+ List<FsStoreCartQueryVO> carts = cartMapper.selectFsStoreCartListByIds(cateIds);
|
|
|
|
|
+ if ("2".equals(vo.get("payType").toString())) {
|
|
|
|
|
+ long distinctStoreCount = carts.stream()
|
|
|
|
|
+ .map(FsStoreCartQueryVO::getStoreId)
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .count();
|
|
|
|
|
+ if (distinctStoreCount > 1) {
|
|
|
|
|
+ return R.error("先定后付不能同时选择不同店铺的商品创建订单");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
TwelveDigitSnowflake snowflake = snowflakeFactory.getSnowflake();
|
|
TwelveDigitSnowflake snowflake = snowflakeFactory.getSnowflake();
|
|
|
String key = String.valueOf(snowflake.nextId());
|
|
String key = String.valueOf(snowflake.nextId());
|
|
|
//缓存支付信息-6小时
|
|
//缓存支付信息-6小时
|