|
|
|
@@ -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); |
|
|
|
} |
|
|
|
} |