|
@@ -13,6 +13,7 @@ import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import cn.hutool.log.StaticLog;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -27,9 +28,7 @@ import com.pj.current.config.WxConfig;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.project.relation_business_car.RelationBusinessCar;
|
|
|
import com.pj.project.relation_business_car.RelationBusinessCarService;
|
|
|
-import com.pj.project.relation_goods_type.RelationGoodsTypeService;
|
|
|
-import com.pj.project.relation_type_item.RelationTypeItem;
|
|
|
-import com.pj.project.relation_type_item.RelationTypeItemService;
|
|
|
+
|
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
|
import com.pj.project.tb_business_car.TbBusinessCarService;
|
|
|
import com.pj.project.tb_business_item.TbBusinessItem;
|
|
@@ -138,8 +137,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
private TbSortGroupService tbSortGroupService;
|
|
|
@Resource
|
|
|
private TbGoodsService tbGoodsService;
|
|
|
- @Resource
|
|
|
- private RelationTypeItemService relationTypeItemService;
|
|
|
+
|
|
|
@Resource
|
|
|
private RelationBusinessCarService relationBusinessCarService;
|
|
|
|
|
@@ -349,6 +347,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.setConfirmInputTime(new Date())
|
|
|
.setConfirmInputBy(StpUserUtil.getAdmin().getName());
|
|
|
this.updateById(business);
|
|
|
+ TbGoods tbGoods = tbGoodsService.getById(business.getGoodsId());
|
|
|
+ Integer payStep = tbGoods.getPayStep();
|
|
|
List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(business.getId());
|
|
|
String carNoStr = cars.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
|
|
|
storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认" + DateUtil.now() + "。");
|
|
@@ -356,11 +356,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
String bigBusinessType = business.getGoodsId();
|
|
|
items.forEach(item -> {
|
|
|
String businessType = item.getBusinessType();
|
|
|
- if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
|
|
|
- String customerId = business.getCustomerId();
|
|
|
+ //合作伙伴创建+是否下单后付款
|
|
|
+ if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())
|
|
|
+ &&TbGoods.PayStep.BEFORE_CONFIRM.getCode().equals(payStep)) {
|
|
|
+ String customerId = business.getCreateByCustomerId();
|
|
|
TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
- String customerType = tbCostomer.getType();
|
|
|
- if (StrUtil.equals(businessType, customerType)) {
|
|
|
+ List<String> customerType = StrUtil.splitTrim(tbCostomer.getType(),",");
|
|
|
+ if (customerType.contains(businessType)) {
|
|
|
+ StaticLog.error("订单自动确认======================="+id);
|
|
|
MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), "系统自动确认",
|
|
|
DateUtil.now(),
|
|
|
business.getGoodsName() + "(" + item.getItemTypeName() + item.getItemName() + "-" + carNoStr + ")");
|
|
@@ -431,9 +434,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
public BigDecimal calculationPartMoney(Date iTime, Date oTime) {
|
|
|
BigDecimal zero = new BigDecimal("0");
|
|
|
if (iTime == null || oTime == null) {
|
|
@@ -477,12 +477,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
cars.add(tbBusinessCarService.getById(businessCarId));
|
|
|
}
|
|
|
businessList = businessList.stream().filter(tbBusiness -> {
|
|
|
- TbGoods tbGoods=tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
+ TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
Integer payStep = tbGoods.getPayStep();
|
|
|
//确认订单后方可缴费
|
|
|
return TbGoods.PayStep.AFTER_CONFIRM.getCode().equals(payStep) && tbBusiness.getAdminConfirmInput() == 1
|
|
|
//或者下单后可缴费
|
|
|
- || TbGoods.PayStep.BEFORE_CONFIRM.getCode().equals(payStep)&& tbBusiness.getAdminConfirmInput() >=0;
|
|
|
+ || TbGoods.PayStep.BEFORE_CONFIRM.getCode().equals(payStep) && tbBusiness.getAdminConfirmInput() >= 0;
|
|
|
}).collect(Collectors.toList());
|
|
|
businessList.forEach(tbBusiness -> {
|
|
|
List<TbBusinessCar> businessCars = tbBusinessCarService.findOtherBusinessCar(tbBusiness.getId());
|
|
@@ -533,12 +533,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
carsList.add(carMap);
|
|
|
}
|
|
|
- result.put("carList",carsList.stream().sorted(Comparator.comparingDouble(obj->Double.valueOf(obj.get("price").toString()))).collect(Collectors.toList()));
|
|
|
+ result.put("carList", carsList.stream().sorted(Comparator.comparingDouble(obj -> Double.valueOf(obj.get("price").toString()))).collect(Collectors.toList()));
|
|
|
BigDecimal itemsPrice = new BigDecimal("0");
|
|
|
List<Map<String, Object>> itemList = new ArrayList<>();
|
|
|
for (TbBusinessItem item : items) {
|
|
|
BigDecimal itemPrice = item.getItemPrice().multiply(new BigDecimal(item.getNum()));
|
|
|
- if (item.getPayStatus()==1){
|
|
|
+ if (item.getPayStatus() == 1) {
|
|
|
continue;
|
|
|
}
|
|
|
itemsPrice = itemsPrice.add(itemPrice);
|
|
@@ -828,10 +828,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
//原来已存在的
|
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
|
//如果修改了车牌号
|
|
|
- String dbCarNo=dbBusinessCar.getCarNo();
|
|
|
+ String dbCarNo = dbBusinessCar.getCarNo();
|
|
|
if (!dbCarNo.equals(carNo)) {
|
|
|
//把关联删除掉,然后添加新的关联
|
|
|
- relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(),businessCarId);
|
|
|
+ relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(), businessCarId);
|
|
|
TbBusinessCar otherCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
if (otherCar == null ||//不存在或者已离场===>新建
|
|
|
(otherCar.getRealInTime() != null && otherCar.getRealOutTime() != null)) {
|
|
@@ -846,7 +846,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
tbBusinessCarService.save(otherCar);
|
|
|
} else {
|
|
|
List<TbBusiness> tbBusinessList = this.findOtherBusinessByCarId(businessCarId);
|
|
|
- if (tbBusinessList.size() == 1&&dbBusinessCar.getRealInTime()==null) {
|
|
|
+ if (tbBusinessList.size() == 1 && dbBusinessCar.getRealInTime() == null) {
|
|
|
tbBusinessCarService.removeById(businessCarId);
|
|
|
}
|
|
|
}
|
|
@@ -884,9 +884,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
String declareNo = otherBusinessBO.getDeclareNo();
|
|
|
if (!StrUtil.equals(declareNo, dbBusiness.getDeclareNo())) {
|
|
|
tbDeclareService.rebackDeclareNo(dbBusiness.getDeclareNo());
|
|
|
- TbDeclare tbDeclare= tbDeclareService.findByDeclareNo(declareNo);
|
|
|
- tbDeclare.setBusinessId(dbBusiness.getId());
|
|
|
- tbDeclareService.updateById(tbDeclare);
|
|
|
+ TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(declareNo);
|
|
|
+ tbDeclare.setBusinessId(dbBusiness.getId());
|
|
|
+ tbDeclareService.updateById(tbDeclare);
|
|
|
}
|
|
|
dbBusiness.setCardSize(otherBusinessBO.getCarSize()).setNetWeight(otherBusinessBO.getNetWeight())
|
|
|
.setOperator(otherBusinessBO.getOperator()).setOperateTime(otherBusinessBO.getOperateTime())
|
|
@@ -925,7 +925,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
private void checkOtherBusiness(String itemTypeId, String operateTimeStr, String businessId, String carNo) {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
TbBusinessSort sort = tbBusinessSortService.findByItemTypeId(itemTypeId);
|
|
|
- if (sort==null){
|
|
|
+ if (sort == null) {
|
|
|
return;
|
|
|
}
|
|
|
List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sort.getGroupId());
|
|
@@ -969,9 +969,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
|
|
|
public TbBusiness findByDeclareNo(String declareNo) {
|
|
|
- QueryWrapper<TbBusiness>ew=new QueryWrapper<>();
|
|
|
- ew.eq("declare_no",declareNo).orderByDesc("id");
|
|
|
- List<TbBusiness>list=this.list(ew);
|
|
|
- return list.isEmpty()?null:list.get(0);
|
|
|
+ QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
|
|
|
+ ew.eq("declare_no", declareNo).orderByDesc("id");
|
|
|
+ List<TbBusiness> list = this.list(ew);
|
|
|
+ return list.isEmpty() ? null : list.get(0);
|
|
|
}
|
|
|
}
|