Просмотр исходного кода

[停车券保存][新增]:停车券新增

release_toaliyun_real
Stormeye.Wu 7 лет назад
Родитель
Сommit
02d233e0f2
6 измененных файлов: 93 добавлений и 21 удалений
  1. +71
    -4
      mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java
  2. +2
    -2
      mallinkAdmin/src/main/java/com/simple/controller/WxCouponCarController.java
  3. +2
    -2
      mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java
  4. +3
    -3
      mallinkService/src/main/java/com/simple/domain/po/WxCouponCar.java
  5. +9
    -2
      mallinkService/src/main/java/com/simple/service/WxCouponCarService.java
  6. +6
    -8
      mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java

+ 71
- 4
mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java Просмотреть файл

@@ -9,10 +9,7 @@ import com.simple.common.ResultData;
import com.simple.domain.po.*;
import com.simple.enums.EnumCarCmd;
import com.simple.enums.EnumCarVendor;
import com.simple.service.WxCUserCarService;
import com.simple.service.WxCarCmdLogService;
import com.simple.service.WxMerchantService;
import com.simple.service.WxParkService;
import com.simple.service.*;
import com.simple.utils.ETCPUtil;
import com.simple.utils.TJDCarUtil;
import io.swagger.annotations.ApiImplicitParam;
@@ -50,6 +47,12 @@ public class WxCarController extends BaseController
@Autowired
WxCarCmdLogService wxCarCmdLogService;

@Autowired
WxCouponService wxCouponService;

@Autowired
WxCouponCarService wxCouponCarService;

private WxPark getCurrentPark(MallUserInfo user) {
WxPark parkQ = new WxPark();
parkQ.setTenantId(user.getTenantId());
@@ -171,4 +174,68 @@ public class WxCarController extends BaseController
businessId = objParams1.getString("businessId");
return businessId;
}

@ApiOperation("新增接口")
@PostMapping("add")
@ApiImplicitParams({
@ApiImplicitParam(name="coupon",value="coupon",dataType="WxCoupon", paramType = "body",required=true),
@ApiImplicitParam(name="vendorParams",value="vendor_params",dataType="String", paramType = "body",required=true)})
public ResultData add(@RequestBody WxCoupon coupon, String vendorParams) {
/*
amount: 1000
avaliavleNum: 1000
businessId: "IgWGUtpAX68="
businessName: "fmtest5678"
category: "1"
categoryValue: "2.00"
couponType: "0"
coverImg: "http://202.165.179.86:8081/images/5411b414-b90e-4f51-bdd4-834fca86a722.png"
effectiveEnd: "2018-11-30"
effectiveStart: "2018-08-26"
name: "优免2小时券"
priceStr: "2.00元"
type: "5"
validEndDate: "undefined 00:00:00"
validStartDate: "undefined 00:00:00"
*/
//Assert.notNull(wxCoupon.getName(), "角色名不能为空");
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
// Save to wx_counpon
if(StringUtils.isNotEmpty(coupon.getSalePriceStr())){
coupon.setSalePrice((int)Double.parseDouble(coupon.getSalePriceStr())*100);
}
if(StringUtils.isNotEmpty(coupon.getUsePriceStr())){
coupon.setUsePrice((int)Double.parseDouble(coupon.getUsePriceStr())*100);
}
if(StringUtils.isNotEmpty(coupon.getPriceStr())){
coupon.setPrice((int)Double.parseDouble(coupon.getPriceStr())*100);
}
if(StringUtils.isNotBlank(coupon.getBusiness())) {
String[] arys = coupon.getBusiness().split(",");
coupon.setBusiness(JSON.toJSONString(arys));
}
coupon.setTenantId(getUser().getTenantId());
coupon.setChannels("");
Long id = wxCouponService.saveOrUpdate(coupon);


// Save to wx_coupon_car
WxCouponCar couponCar = new WxCouponCar();
couponCar.setId(id);
couponCar.setTenantId(coupon.getTenantId());
couponCar.setMerchantId(coupon.getMerchantId());

MallUserInfo user = getUser();
WxPark park = getCurrentPark(user);
couponCar.setParkId(park.getId());
couponCar.setVendorType(park.getVendorType());
couponCar.setVendorParams(vendorParams);
Date curDate = new Date();
couponCar.setCreateDate(curDate);
couponCar.setUpdateDate(curDate);
wxCouponCarService.save(couponCar);


return new ResultData(id);
}
}

+ 2
- 2
mallinkAdmin/src/main/java/com/simple/controller/WxCouponCarController.java Просмотреть файл

@@ -40,14 +40,14 @@ public class WxCouponCarController extends BaseController
public ResultData add(@RequestBody WxCouponCar wxCouponCar) {
//Assert.notNull(wxCouponCar.getName(), "角色名不能为空");
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
wxCouponCarService.saveOrUpdate(wxCouponCar);
wxCouponCarService.save(wxCouponCar);
return new ResultData();
}

@ApiOperation("根据id更新接口")
@PostMapping("update")
public ResultData update(@RequestBody WxCouponCar wxCouponCar) {
wxCouponCarService.saveOrUpdate(wxCouponCar);
wxCouponCarService.update(wxCouponCar);
return new ResultData();
}



+ 2
- 2
mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java Просмотреть файл

@@ -42,14 +42,14 @@ public class WxCouponCarController extends BaseController
public ResultData add(@RequestBody WxCouponCar wxCouponCar) {
//Assert.notNull(wxCouponCar.getName(), "角色名不能为空");
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
wxCouponCarService.saveOrUpdate(wxCouponCar);
wxCouponCarService.save(wxCouponCar);
return new ResultData();
}

@ApiOperation("根据id更新接口")
@PostMapping("update")
public ResultData update(@RequestBody WxCouponCar wxCouponCar) {
wxCouponCarService.saveOrUpdate(wxCouponCar);
wxCouponCarService.update(wxCouponCar);
return new ResultData();
}



+ 3
- 3
mallinkService/src/main/java/com/simple/domain/po/WxCouponCar.java Просмотреть файл

@@ -43,7 +43,7 @@ public class WxCouponCar implements Serializable {
/*租户ID**/
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private Long tenantId;
private String tenantId;
/*停车场ID**/
@io.swagger.annotations.ApiModelProperty(value="停车场ID",name="parkId")
private Long parkId;
@@ -62,10 +62,10 @@ public class WxCouponCar implements Serializable {
/*更新时间**/
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long _tenantId) {
public void setTenantId(String _tenantId) {
tenantId = _tenantId;
}
public Long getParkId() {


+ 9
- 2
mallinkService/src/main/java/com/simple/service/WxCouponCarService.java Просмотреть файл

@@ -24,12 +24,19 @@ public interface WxCouponCarService {
*/
WxCouponCar getById(Long id);
/**
/**
* 保存或更新实体
*
* @param record
*/
void saveOrUpdate(WxCouponCar record);
void save(WxCouponCar record);

/**
* 更新实体
*
* @param record
*/
void update(WxCouponCar record);

/**
* 根据Id删除实体


+ 6
- 8
mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java Просмотреть файл

@@ -28,15 +28,13 @@ public class WxCouponCarServiceImpl implements WxCouponCarService {
}

@Override
public void saveOrUpdate(WxCouponCar record) {
if (record.getId() == null) {
//record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
public void save(WxCouponCar record) {
wxCouponCarMapper.insertSelective(record);
} else {
wxCouponCarMapper.updateByPrimaryKeySelective(record);
}
}

@Override
public void update(WxCouponCar record) {
wxCouponCarMapper.updateByPrimaryKey(record);
}

@Override


Загрузка…
Отмена
Сохранить