| @@ -283,17 +283,22 @@ public class WxCarController extends BaseController | |||||
| String carId = retObj.getString("carId"); | String carId = retObj.getString("carId"); | ||||
| // 插入车牌 | // 插入车牌 | ||||
| Date curr = new Date(); | Date curr = new Date(); | ||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("carId", carId); | |||||
| userCar.setVendorParams(JSON.toJSONString(jo)); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| try { | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("carId", carId); | |||||
| userCar.setVendorParams(JSON.toJSONString(jo)); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | |||||
| } | |||||
| return new ResultData(retObj); | return new ResultData(retObj); | ||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | ||||
| @@ -346,11 +351,17 @@ public class WxCarController extends BaseController | |||||
| String ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | String ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| try { | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } else { | } else { | ||||
| logger.error("解绑车牌失败"); | logger.error("解绑车牌失败"); | ||||
| @@ -380,7 +391,13 @@ public class WxCarController extends BaseController | |||||
| String ret = tjd.writeOffCar(url, partner, key, version, carId); | String ret = tjd.writeOffCar(url, partner, key, version, carId); | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getString("returnCode") == "T") { | if (retObj.getString("returnCode") == "T") { | ||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| try { | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| } catch (Exception e) { | |||||
| logger.error("解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | ||||