|
@@ -12,6 +12,8 @@ import com.pj.constants.UserTypeEnum;
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
import com.pj.project.tb_account.AutomaticPay;
|
|
import com.pj.project.tb_account.AutomaticPay;
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
|
|
+import com.pj.project.tb_costomer.TbCostomer;
|
|
|
|
+import com.pj.project.tb_costomer.TbCostomerService;
|
|
import com.pj.project.tb_deduction_record.TbDeductionRecord;
|
|
import com.pj.project.tb_deduction_record.TbDeductionRecord;
|
|
import com.pj.project4sp.SP;
|
|
import com.pj.project4sp.SP;
|
|
import com.pj.utils.AesUtil;
|
|
import com.pj.utils.AesUtil;
|
|
@@ -43,7 +45,8 @@ public class TbDeductionBindService extends ServiceImpl<TbDeductionBindMapper, T
|
|
*/
|
|
*/
|
|
@Autowired
|
|
@Autowired
|
|
TbDeductionBindMapper tbDeductionBindMapper;
|
|
TbDeductionBindMapper tbDeductionBindMapper;
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ TbCostomerService tbCostomerService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
* 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
@@ -60,7 +63,8 @@ public class TbDeductionBindService extends ServiceImpl<TbDeductionBindMapper, T
|
|
so.put("endTime",jsonArray.get(1));
|
|
so.put("endTime",jsonArray.get(1));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return tbDeductionBindMapper.getTbDeductionBindList(so);
|
|
|
|
|
|
+ // return tbDeductionBindMapper.getTbDeductionBindList(so);
|
|
|
|
+ return tbDeductionBindMapper.getList(so);
|
|
}
|
|
}
|
|
|
|
|
|
public TbDeductionBind getById(Long id) {
|
|
public TbDeductionBind getById(Long id) {
|
|
@@ -84,7 +88,7 @@ public class TbDeductionBindService extends ServiceImpl<TbDeductionBindMapper, T
|
|
throw new AjaxError("车牌号不能为空!");
|
|
throw new AjaxError("车牌号不能为空!");
|
|
}
|
|
}
|
|
if(NbUtil.isNullStr(bind.getCustomerId())){
|
|
if(NbUtil.isNullStr(bind.getCustomerId())){
|
|
- throw new AjaxError("请选定客户进行绑定!");
|
|
|
|
|
|
+ throw new AjaxError("登陆用户信息已经失效,请重新登陆!");
|
|
}
|
|
}
|
|
bind.setBindCar(bind.getBindCar().trim().toUpperCase());
|
|
bind.setBindCar(bind.getBindCar().trim().toUpperCase());
|
|
bind.setId(null);
|
|
bind.setId(null);
|
|
@@ -110,6 +114,9 @@ public class TbDeductionBindService extends ServiceImpl<TbDeductionBindMapper, T
|
|
if(NbUtil.isNullStr(unbind.getBindCar())){
|
|
if(NbUtil.isNullStr(unbind.getBindCar())){
|
|
throw new AjaxError("车牌号不能为空!");
|
|
throw new AjaxError("车牌号不能为空!");
|
|
}
|
|
}
|
|
|
|
+ if(!checkBind(unbind.getCustomerId(),unbind.getBindCar())){
|
|
|
|
+ throw new AjaxError(unbind.getBindCar()+" 不是"+unbind.getCustomerName()+" 绑定的车辆,不能解绑!");
|
|
|
|
+ }
|
|
unbind.setUpdateBy(StpUserUtil.getLoginName());
|
|
unbind.setUpdateBy(StpUserUtil.getLoginName());
|
|
unbind.setUpdateTime(new Date());
|
|
unbind.setUpdateTime(new Date());
|
|
return tbDeductionBindMapper.updateById(unbind)>0;
|
|
return tbDeductionBindMapper.updateById(unbind)>0;
|
|
@@ -229,4 +236,25 @@ public class TbDeductionBindService extends ServiceImpl<TbDeductionBindMapper, T
|
|
return ObjectUtil.isNotEmpty(idMap)? AesUtil.toStr(idMap.get("id")):null;
|
|
return ObjectUtil.isNotEmpty(idMap)? AesUtil.toStr(idMap.get("id")):null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据当前登陆用户封装一个绑定对象
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public TbDeductionBind getTbDeductionBindByLogin(){
|
|
|
|
+ TbDeductionBind bind = new TbDeductionBind();
|
|
|
|
+ String customerId = StpUserUtil.getCustomerId();
|
|
|
|
+ if(NbUtil.isNull(customerId)){
|
|
|
|
+ throw new AjaxError("登陆用户信息已经失效,请重新登陆!");
|
|
|
|
+ }
|
|
|
|
+ TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
|
+ if(tbCostomer==null){
|
|
|
|
+ throw new AjaxError("登陆用户还没绑定客户信息,不能绑定车辆!");
|
|
|
|
+ }
|
|
|
|
+ bind.setBindTime(new Date());
|
|
|
|
+ bind.setCreateTime(new Date());
|
|
|
|
+ bind.setCreateBy(StpUserUtil.getLoginName());
|
|
|
|
+ bind.setCustomerId(tbCostomer.getId());
|
|
|
|
+ bind.setCustomerName(tbCostomer.getName());
|
|
|
|
+ return bind;
|
|
|
|
+ }
|
|
}
|
|
}
|