|
@@ -998,11 +998,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
return list.isEmpty() ? null : list.get(0);
|
|
|
}
|
|
|
|
|
|
- public List<TbBusiness> getPay(String day) {
|
|
|
- QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
|
|
|
- ew.eq("date_format(pay_time,'%Y-%m-%d')", day).orderByDesc("id");
|
|
|
- return this.list(ew);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 选择异常单发送
|
|
@@ -1015,17 +1011,34 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (tbBusiness == null) {
|
|
|
throw new AjaxError("业务已被删除");
|
|
|
}
|
|
|
+ String businessId = tbBusiness.getId();
|
|
|
+ List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
|
|
|
tbBusiness.setPayStatus(errorBusinessBO.getPayStatus())
|
|
|
- .setSupplement(1)
|
|
|
+ .setSupplement(1)
|
|
|
.setSupplementBy(errorBusinessBO.getSupplementBy())
|
|
|
.setSupplementTime(new Date())
|
|
|
.setSupplementReason(errorBusinessBO.getSupplementReason());
|
|
|
- if (TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()==errorBusinessBO.getPayStatus()) {
|
|
|
+ if (TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus()) {
|
|
|
tbBusiness.setPayMoney(tbBusiness.getItemPrice())
|
|
|
.setPayTime(errorBusinessBO.getPayTime());
|
|
|
+ items.forEach(item -> item.setPayTime(errorBusinessBO.getPayTime()).setPayStatus(1));
|
|
|
+ tbBusinessItemService.updateBatchById(items);
|
|
|
}
|
|
|
List<TbBusinessCar> tbBusinessCars = errorBusinessBO.getCars();
|
|
|
- for (TbBusinessCar tbBusinessCar : tbBusinessCars) {
|
|
|
+ tbBusinessCars.forEach(this::handlerCarPay);
|
|
|
+ tbBusinessCarService.updateBatchById(tbBusinessCars);
|
|
|
+ if (isAdmin) {
|
|
|
+ //发起审批
|
|
|
+ sendOA(tbBusiness, items, tbBusinessCars, errorBusinessBO.getSupplementBy());
|
|
|
+ }
|
|
|
+ this.updateById(tbBusiness);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理车辆支付
|
|
|
+ * @param tbBusinessCar
|
|
|
+ */
|
|
|
+ private void handlerCarPay(TbBusinessCar tbBusinessCar) {
|
|
|
String carNo = tbBusinessCar.getCarNo();
|
|
|
String payType = tbBusinessCar.getPayType();
|
|
|
Date payTime = tbBusinessCar.getPayTime();
|
|
@@ -1046,25 +1059,29 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
//计算停车费
|
|
|
BigDecimal parkMoney = this.calculationPartMoney(inTime, outTime);
|
|
|
tbBusinessCar.setMoney(parkMoney);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起流程审批
|
|
|
+ *
|
|
|
+ * @param tbBusiness
|
|
|
+ * @param items
|
|
|
+ * @param tbBusinessCars
|
|
|
+ * @param sendBy
|
|
|
+ */
|
|
|
+ private void sendOA(TbBusiness tbBusiness, List<TbBusinessItem> items, List<TbBusinessCar> tbBusinessCars, String sendBy) {
|
|
|
+ ParamsBO paramsBO = buildParams(tbBusiness, items, tbBusinessCars);
|
|
|
+ String json = JSONUtil.toJsonStr(paramsBO);
|
|
|
+ log.info("构建流程表单数据:{}", json);
|
|
|
+ String resp = HttpUtil.createPost(oaConfig.getUrl())
|
|
|
+ .timeout(2000).setReadTimeout(3000).body(json)
|
|
|
+ .execute().body();
|
|
|
+ log.info("请求返回:{}", resp);
|
|
|
+ OAResultBO oaResultBO = JSONUtil.toBean(resp, OAResultBO.class);
|
|
|
+ if (oaResultBO.getSuccess() && oaResultBO.getCode() == 200) {
|
|
|
+ tbBusiness.setSendOa(1).setSendTime(new Date()).setSendBy(sendBy)
|
|
|
+ .setOaFdId(oaResultBO.getData().getFdId());
|
|
|
}
|
|
|
- tbBusinessCarService.updateBatchById(tbBusinessCars);
|
|
|
- if (isAdmin) {
|
|
|
- String businessId = tbBusiness.getId();
|
|
|
- List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
|
|
|
- ParamsBO paramsBO = buildParams(tbBusiness, items, tbBusinessCars);
|
|
|
- String json = JSONUtil.toJsonStr(paramsBO);
|
|
|
- log.info("构建流程表单数据:{}", json);
|
|
|
- /* String resp = HttpUtil.createPost(oaConfig.getUrl())
|
|
|
- .timeout(2000).setReadTimeout(3000).body(json)
|
|
|
- .execute().body();
|
|
|
- log.info("请求返回:{}", resp);
|
|
|
- OAResultBO oaResultBO = JSONUtil.toBean(resp, OAResultBO.class);
|
|
|
- if (oaResultBO.getSuccess() && oaResultBO.getCode() == 200) {
|
|
|
- tbBusiness.setSendOa(1).setSendTime(new Date()).setSendBy(errorBusinessBO.getSupplementBy())
|
|
|
- .setOaFdId(oaResultBO.getData().getFdId());
|
|
|
- }*/
|
|
|
- }
|
|
|
- this.updateById(tbBusiness);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1096,6 +1113,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
ParamsBO.DataBO.FormValuesBO.SpecificBusinessItemsBO specificBusinessItemsBO = buildItemPrams(items);
|
|
|
formValuesBO.setSpecificBusinessItems(specificBusinessItemsBO);
|
|
|
dataBO.setFormValues(formValuesBO);
|
|
|
+ paramsBO.setData(dataBO);
|
|
|
return paramsBO;
|
|
|
}
|
|
|
|
|
@@ -1122,7 +1140,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
unitList.add(item.getUnit());
|
|
|
numList.add(item.getNum());
|
|
|
payStatusList.add(item.getPayStatus() == 1 ? "已支付" : "未支付");
|
|
|
- payTimeList.add(DateUtil.format(item.getPayTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ payTimeList.add(item.getPayTime()==null?"-":DateUtil.format(item.getPayTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
remarkList.add(StrUtil.isEmpty(item.getRemark()) ? "-" : item.getRemark());
|
|
|
});
|
|
|
specificBusinessItemsBO.setChargingItem(itemTypeNameList)
|
|
@@ -1197,31 +1215,38 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
TbGoods tbGoods = tbGoodsService.getById(errorBusinessBO.getGoodsId());
|
|
|
TbBusiness tbBusiness = new TbBusiness();
|
|
|
String customerId = errorBusinessBO.getCustomerId();
|
|
|
- tbBusiness.setCreateBy(StpUserUtil.getAdmin().getName());
|
|
|
+ tbBusiness.setCreateBy(StpUserUtil.getAdmin().getNickname());
|
|
|
tbBusiness.setPayStep(tbGoods.getPayStep());
|
|
|
TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
if (tbCostomer != null) {
|
|
|
tbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
|
|
|
}
|
|
|
+ boolean businessIsPay=TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus();
|
|
|
+ Date businessPayTime=errorBusinessBO.getPayTime();
|
|
|
+
|
|
|
BigDecimal price = new BigDecimal("0");
|
|
|
List<TbBusinessItem> itemList = new ArrayList<>();
|
|
|
String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
|
|
|
int index = 1;
|
|
|
for (TbItem tbItem : tbItems) {
|
|
|
TbItem db = tbItemService.getById(tbItem.getId());
|
|
|
- TbBusinessItem item = new TbBusinessItem();
|
|
|
+ TbBusinessItem tbBusinessItem = new TbBusinessItem();
|
|
|
int num = tbItem.getNum();
|
|
|
String typeId = tbItem.getTypeId();
|
|
|
TbItemType tbItemType = tbItemTypeService.getById(typeId);
|
|
|
BigDecimal itemTotalPrice = tbItem.getPrice().multiply(new BigDecimal(num));
|
|
|
- item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
|
|
|
- .setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2));
|
|
|
- item.setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId())
|
|
|
+ tbBusinessItem.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
|
|
|
+ .setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2))
|
|
|
+ .setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId())
|
|
|
.setItemName(db.getItemName()).setItemPrice(db.getPrice()).setRemark(tbItem.getRemark())
|
|
|
.setItemTypeId(typeId).setItemTypeName(tbItemType.getName())
|
|
|
.setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now);
|
|
|
price = price.add(itemTotalPrice);
|
|
|
- itemList.add(item);
|
|
|
+ if (businessIsPay){
|
|
|
+ tbBusinessItem.setPayTime(businessPayTime)
|
|
|
+ .setPayStatus(1);
|
|
|
+ }
|
|
|
+ itemList.add(tbBusinessItem);
|
|
|
index++;
|
|
|
}
|
|
|
String declareNo = errorBusinessBO.getDeclareNo();
|
|
@@ -1234,6 +1259,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
tbBusiness.setCreateTime(now).setCreateByCustomerId(StpUserUtil.getCustomerId())
|
|
|
.setItemPrice(price).setTotalMoney(price).setOwner(errorBusinessBO.getOwner());
|
|
|
tbBusiness.setChinaCarNo(errorBusinessBO.getChinaCarNo());
|
|
|
+ if (businessIsPay) {//如果已支付
|
|
|
+ tbBusiness.setPayMoney(tbBusiness.getItemPrice())
|
|
|
+ .setPayTime(businessPayTime);
|
|
|
+ }
|
|
|
this.save(tbBusiness);
|
|
|
Integer chinaCarPay = tbGoods.getChinaCarPay();
|
|
|
Integer vietnamCarPay = tbGoods.getVietnamCarPay();
|
|
@@ -1244,30 +1273,29 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (StrUtil.isEmpty(carType)) {
|
|
|
throw new BusinessException(carNo + "类型不能为空");
|
|
|
}
|
|
|
- //新增放行记录
|
|
|
- TbBusinessCar db = new TbBusinessCar();
|
|
|
- db.setCreateTime(now).setPay(0).setNo(carBuseinssNo + RandomUtil.randomNumbers(4));
|
|
|
- db.setPayType(TbBusinessCar.PayTypeEnum.NO_PAY_TYPE.getType());
|
|
|
+
|
|
|
+ car.setCreateTime(now).setNo(carBuseinssNo + RandomUtil.randomNumbers(4));
|
|
|
if ((TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType) && chinaCarPay == 0)
|
|
|
|| (TbItem.ItemTypeEnum.WEIGHT_TYPE.getType().equals(carType) && vietnamCarPay == 0)) {
|
|
|
- db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
|
|
|
+ car.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
|
|
|
}
|
|
|
TbCar tbCar = tbCarService.findByCardNo(carNo);
|
|
|
if (tbCar != null) {
|
|
|
- db.setCarCompany(tbCar.getCustomerName());
|
|
|
+ car.setCarCompany(tbCar.getCustomerName());
|
|
|
if (!TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
|
|
|
- db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
|
|
|
+ car.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
|
|
|
}
|
|
|
}
|
|
|
- db.setCarNo(carNo).setIsLock(0);
|
|
|
- db.setCarSize(car.getCarSize())
|
|
|
+ car.setCarNo(carNo).setIsLock(0);
|
|
|
+ car.setCarSize(car.getCarSize())
|
|
|
.setTimeUpdate(now).setCarType(car.getCarType())
|
|
|
.setNetWeight(car.getNetWeight())
|
|
|
.setCustomerId(customerId)
|
|
|
.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
|
|
|
- tbBusinessCarService.save(db);
|
|
|
+ //新增放行记录
|
|
|
+ tbBusinessCarService.save(car);
|
|
|
RelationBusinessCar relationBusinessCar = new RelationBusinessCar();
|
|
|
- relationBusinessCar.setBusinessId(tbBusiness.getId()).setBusinessCarId(db.getId());
|
|
|
+ relationBusinessCar.setBusinessId(tbBusiness.getId()).setBusinessCarId(car.getId());
|
|
|
relationBusinessCarService.save(relationBusinessCar);
|
|
|
}
|
|
|
if (StrUtil.isNotEmpty(declareNo)) {
|
|
@@ -1279,4 +1307,16 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
tbBusinessItemService.saveBatch(itemList);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单独发起审批
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ public void applyOA(String id, String sendBy) {
|
|
|
+ TbBusiness tbBusiness = this.getById(id);
|
|
|
+ List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(id);
|
|
|
+ List<TbBusinessCar> tbBusinessCars = tbBusinessCarService.findOtherBusinessCar(id);
|
|
|
+ sendOA(tbBusiness, items, tbBusinessCars, sendBy);
|
|
|
+ this.updateById(tbBusiness);
|
|
|
+ }
|
|
|
}
|