|
@@ -37,6 +37,8 @@ import com.pj.project.tb_declare.TbDeclare;
|
|
import com.pj.project.tb_declare.TbDeclareService;
|
|
import com.pj.project.tb_declare.TbDeclareService;
|
|
import com.pj.project.tb_driver.TbDriver;
|
|
import com.pj.project.tb_driver.TbDriver;
|
|
import com.pj.project.tb_driver.TbDriverService;
|
|
import com.pj.project.tb_driver.TbDriverService;
|
|
|
|
+import com.pj.project.tb_goods.TbGoods;
|
|
|
|
+import com.pj.project.tb_goods.TbGoodsService;
|
|
import com.pj.project.tb_item.TbItem;
|
|
import com.pj.project.tb_item.TbItem;
|
|
import com.pj.project.tb_item.TbItemService;
|
|
import com.pj.project.tb_item.TbItemService;
|
|
import com.pj.project.tb_item_type.TbItemType;
|
|
import com.pj.project.tb_item_type.TbItemType;
|
|
@@ -48,6 +50,7 @@ import com.pj.project.tb_pass_record.TbPassRecordService;
|
|
import com.pj.project.tb_unit.TbUnit;
|
|
import com.pj.project.tb_unit.TbUnit;
|
|
import com.pj.project.tb_unit.TbUnitService;
|
|
import com.pj.project.tb_unit.TbUnitService;
|
|
import com.pj.project4sp.admin.SpAdmin;
|
|
import com.pj.project4sp.admin.SpAdmin;
|
|
|
|
+import com.pj.project4sp.global.BusinessException;
|
|
import com.pj.project4sp.role.SpRoleUtil;
|
|
import com.pj.project4sp.role.SpRoleUtil;
|
|
import com.pj.project4sp.role4permission.SpRolePermissionService;
|
|
import com.pj.project4sp.role4permission.SpRolePermissionService;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
@@ -108,6 +111,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
@Resource
|
|
@Resource
|
|
@Lazy
|
|
@Lazy
|
|
TbDeclareService tbDeclareService;
|
|
TbDeclareService tbDeclareService;
|
|
|
|
+ @Resource
|
|
|
|
+ TbGoodsService tbGoodsService;
|
|
|
|
|
|
|
|
|
|
public TbBusiness checkCarNo(String carNo) {
|
|
public TbBusiness checkCarNo(String carNo) {
|
|
@@ -121,6 +126,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
* 增
|
|
* 增
|
|
*/
|
|
*/
|
|
public AjaxJson addOrUpdate(TbBusiness t) {
|
|
public AjaxJson addOrUpdate(TbBusiness t) {
|
|
|
|
+
|
|
if (StrUtil.isNotEmpty(t.getId()) && StrUtil.isNotEmpty(t.getDeclareNo())) {
|
|
if (StrUtil.isNotEmpty(t.getId()) && StrUtil.isNotEmpty(t.getDeclareNo())) {
|
|
TbBusiness db = this.getById(t.getId());
|
|
TbBusiness db = this.getById(t.getId());
|
|
if (!StrUtil.equals(db.getDeclareNo(), t.getDeclareNo())) {
|
|
if (!StrUtil.equals(db.getDeclareNo(), t.getDeclareNo())) {
|
|
@@ -132,7 +138,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Double carSize = t.getCardSize();
|
|
Double carSize = t.getCardSize();
|
|
- if (carSize!=null&&carSize > carConfig.getMaxLength()) {
|
|
|
|
|
|
+ if (carSize != null && carSize > carConfig.getMaxLength()) {
|
|
return AjaxJson.getError("车辆规格不能大于" + carConfig.getMaxLength());
|
|
return AjaxJson.getError("车辆规格不能大于" + carConfig.getMaxLength());
|
|
}
|
|
}
|
|
Double netWeight = t.getNetWeight();
|
|
Double netWeight = t.getNetWeight();
|
|
@@ -156,17 +162,19 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
} else {
|
|
} else {
|
|
storeMsg(t.getCustomerId(), "业务订单:【" + t.getNo() + "】数据发生更改," + DateUtil.now() + "。");
|
|
storeMsg(t.getCustomerId(), "业务订单:【" + t.getNo() + "】数据发生更改," + DateUtil.now() + "。");
|
|
}
|
|
}
|
|
- List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
|
|
|
|
-
|
|
|
|
saveOrUpdate(t);
|
|
saveOrUpdate(t);
|
|
createBusinessPeople(t);
|
|
createBusinessPeople(t);
|
|
tbBusinessItemService.removeByBusinessId(t.getId());
|
|
tbBusinessItemService.removeByBusinessId(t.getId());
|
|
BigDecimal price = new BigDecimal(0);
|
|
BigDecimal price = new BigDecimal(0);
|
|
|
|
+ List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
|
|
|
|
+ List<String> typeNames = new ArrayList<>();
|
|
for (TbBusinessItem item : items) {
|
|
for (TbBusinessItem item : items) {
|
|
Double num = NumberUtil.parseDouble(item.getNum());
|
|
Double num = NumberUtil.parseDouble(item.getNum());
|
|
TbItem tbItem = tbItemService.getById(item.getItemId());
|
|
TbItem tbItem = tbItemService.getById(item.getItemId());
|
|
price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
|
|
price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
|
|
TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
|
|
TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
|
|
|
|
+ String type = tbItemType.getName();
|
|
|
|
+ typeNames.add(type);
|
|
item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
|
|
item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
|
|
.setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
|
|
.setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
|
|
.setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
|
|
.setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
|
|
@@ -427,11 +435,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
List<TbBusinessCar> cars = tbBusinessCarService.findByBusinessId(businessId);
|
|
List<TbBusinessCar> cars = tbBusinessCarService.findByBusinessId(businessId);
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
List<Map<String, Object>> carsList = new ArrayList<>();
|
|
List<Map<String, Object>> carsList = new ArrayList<>();
|
|
- BigDecimal total = new BigDecimal("0");
|
|
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
- if (tbBusinessCar.getPay() == 1) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
double partMoney = tbBusinessCar.getBasePartMoney().doubleValue();
|
|
double partMoney = tbBusinessCar.getBasePartMoney().doubleValue();
|
|
if (!StrUtil.equals("STATE", state)) {
|
|
if (!StrUtil.equals("STATE", state)) {
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
@@ -444,18 +448,16 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
partMoney = 0D;
|
|
partMoney = 0D;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (partMoney > 0) {
|
|
|
|
- total = total.add(new BigDecimal(partMoney));
|
|
|
|
- Map<String, Object> carMap = new HashMap<>();
|
|
|
|
- carMap.put("price", partMoney);
|
|
|
|
- carMap.put("id", tbBusinessCar.getId());
|
|
|
|
- carMap.put("carNo", tbBusinessCar.getCarNo());
|
|
|
|
- carsList.add(carMap);
|
|
|
|
- }
|
|
|
|
|
|
+ Map<String, Object> carMap = new HashMap<>();
|
|
|
|
+ carMap.put("price", partMoney);
|
|
|
|
+ carMap.put("id", tbBusinessCar.getId());
|
|
|
|
+ carMap.put("carNo", tbBusinessCar.getCarNo());
|
|
|
|
+ carMap.put("pay",tbBusinessCar.getPay());
|
|
|
|
+ carsList.add(carMap);
|
|
}
|
|
}
|
|
result.put("carList", carsList);
|
|
result.put("carList", carsList);
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
- if (tbBusiness != null && tbBusiness.getPayStatus() == TbBusiness.PayStatus.NO_PAY.getCode()) {
|
|
|
|
|
|
+ if (tbBusiness != null && tbBusiness.getPayStatus() != TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()) {
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
|
|
result.put("itemsPrice", tbBusiness.getItemPrice());
|
|
result.put("itemsPrice", tbBusiness.getItemPrice());
|
|
result.put("businessId", businessId);
|
|
result.put("businessId", businessId);
|
|
@@ -465,12 +467,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
itemMap.put("id", item.getId());
|
|
itemMap.put("id", item.getId());
|
|
itemMap.put("name", item.getItemName());
|
|
itemMap.put("name", item.getItemName());
|
|
itemMap.put("price", item.getItemPrice());
|
|
itemMap.put("price", item.getItemPrice());
|
|
- total = total.add(item.getItemPrice());
|
|
|
|
|
|
+ itemMap.put("pay", item.getPayStatus());
|
|
itemList.add(itemMap);
|
|
itemList.add(itemMap);
|
|
}
|
|
}
|
|
result.put("itemList", itemList);
|
|
result.put("itemList", itemList);
|
|
}
|
|
}
|
|
- result.put("total", total);
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|