Browse Source

[车牌绑定][修改]:绑车牌接口修改

release_toaliyun_real
Stormeye.Wu 7 years ago
parent
commit
a11acb8376
3 changed files with 56 additions and 26 deletions
  1. +20
    -17
      mallinkCApi/src/main/java/com/simple/controller/WxCarController.java
  2. +25
    -9
      mallinkService/src/main/java/com/simple/service/WxCUserCarService.java
  3. +11
    -0
      mallinkService/src/main/java/com/simple/service/impl/WxCUserCarServiceImpl.java

+ 20
- 17
mallinkCApi/src/main/java/com/simple/controller/WxCarController.java View File

@@ -261,14 +261,16 @@ public class WxCarController extends BaseController
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空");
}
String carNumColor = paramMap.get("carNumColor");
if (StringUtils.isBlank(carNumColor)) {
logger.error("carNumColor为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumColor为空");
}
//if (StringUtils.isBlank(carNumColor)) {
// logger.error("carNumColor为空");
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumColor为空");
//}
Long newCarId = 0L;
String outCarId = paramMap.get("outCarId");
if (StringUtils.isBlank(outCarId)) {
logger.error("outCarId为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "outCarId为空");
logger.warn("outCarId为空");
newCarId = wxCUserCarService.getNewCarID();
outCarId = String.valueOf(newCarId);
}
String params = park.getVendorParams();
JSONObject objParams = JSON.parseObject(params);
@@ -284,18 +286,19 @@ public class WxCarController extends BaseController
String carId = retObj.getString("carId");
// 插入车牌
Date curr = new Date();
WxCUserCar userCar = new WxCUserCar();
userCar.setId(newCarId);
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);
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);
wxCUserCarService.save(userCar);
} catch (Exception e) {
logger.error(e.getMessage());
return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage());


+ 25
- 9
mallinkService/src/main/java/com/simple/service/WxCUserCarService.java View File

@@ -1,12 +1,13 @@
package com.simple.service;

import java.util.*;
import com.github.pagehelper.PageInfo;
import com.simple.domain.po.WxCUserCar;

import java.util.List;

public interface WxCUserCarService {

/**
/**
* 根据实体查询分页列表
*
* @param record
@@ -14,7 +15,7 @@ public interface WxCUserCarService {
* @param pageSize
* @return
*/
PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize);
PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize);

/**
* 根据实体查询列表
@@ -26,20 +27,34 @@ public interface WxCUserCarService {

/**
* 根据实体查询
*
* @param record
* @return
*/
WxCUserCar getOne(WxCUserCar record);
/**
/**
* 根据Id获得实体
*
* @param id
* @return
*/
WxCUserCar getById(Long id);
/**


/**
* 获取新的ID
*/
Long getNewCarID();

/**
* 保存实体
*
* @param record
*/
void save(WxCUserCar record);

/**
* 保存或更新实体
*
* @param record
@@ -55,9 +70,10 @@ public interface WxCUserCarService {

/**
* 根据WxCUserCar删除实体
*
* @param record
*/
void deleteByObj(WxCUserCar record);
}

+ 11
- 0
mallinkService/src/main/java/com/simple/service/impl/WxCUserCarServiceImpl.java View File

@@ -42,6 +42,17 @@ public class WxCUserCarServiceImpl implements WxCUserCarService {
return wxCUserCarMapper.selectByPrimaryKey(id);
}

@Override
public Long getNewCarID() {
final IdWorker idWorker = IdWorker.get();
return idWorker.nextId();
}

@Override
public void save(WxCUserCar record) {
wxCUserCarMapper.insertSelective(record);
}

@Override
public void saveOrUpdate(WxCUserCar record) {
if (record.getId() == null) {


Loading…
Cancel
Save