update 下发停车优惠券时,记录到数据库表中

This commit is contained in:
Lemon
2024-10-15 16:02:43 +08:00
parent 1776075ac2
commit 2196fbf8d8
4 changed files with 42 additions and 2 deletions

View File

@@ -651,6 +651,7 @@ public class CommonService {
.secretKey(parkingInfo.getSecretKey())
.plateNumber(orderBasicInfo.getPlateNumber())
.plateColor(5) // 5-绿牌车
.orderBasicInfo(orderBasicInfo)
.build();
// 绑定优惠券
return ltytService.bindCoupon(dto);

View File

@@ -9,8 +9,11 @@ import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.sign.MD5Util;
import com.jsowell.pile.domain.CarCouponRecord;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
import com.jsowell.pile.dto.lutongyunting.GetTokenDTO;
import com.jsowell.pile.service.CarCouponRecordService;
import com.jsowell.thirdparty.lutongyunting.common.LTYTCommonParams;
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
import org.slf4j.Logger;
@@ -35,6 +38,9 @@ public class LTYTServiceImpl implements LTYTService {
@Autowired
private RedisCache redisCache;
@Autowired
private CarCouponRecordService carCouponRecordService;
// private static final String APP_ID = "I2qa3hdr116100dc"; // I2qa3hdr116100dc I2qa3jfnd96f267c
// private static final String SECRET_KEY = "2qa3hdr13754a8e"; // 2qa3hdr13754a8e 2qa3jfndb37926d
@@ -94,6 +100,7 @@ public class LTYTServiceImpl implements LTYTService {
*/
@Override
public String bindCoupon(BindCouponDTO dto) throws UnsupportedEncodingException {
OrderBasicInfo orderBasicInfo = dto.getOrderBasicInfo();
// 获取令牌
GetTokenDTO tokenDTO = new GetTokenDTO();
tokenDTO.setAppId(dto.getAppId());
@@ -123,8 +130,19 @@ public class LTYTServiceImpl implements LTYTService {
String result = HttpUtil.post(url, JSON.toJSONString(jsonObject));
log.info("给指定车辆绑定优惠券 params:{}, result:{}", JSON.toJSONString(jsonObject), result);
JSONObject resultJson = JSONObject.parseObject(result);
String msg = resultJson.getString("msg");
return resultJson.getString("msg");
// 将下发优惠券信息存入表
CarCouponRecord carCouponRecord = new CarCouponRecord();
carCouponRecord.setOrderCode(orderBasicInfo.getOrderCode());
carCouponRecord.setReturnCode(String.valueOf(resultJson.get("code")));
carCouponRecord.setReturnMsg(msg);
carCouponRecord.setPlateNumber(dto.getPlateNumber());
carCouponRecord.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
carCouponRecordService.insertCarCouponRecord(carCouponRecord);
return msg;
}
public static void main(String[] args) throws UnsupportedEncodingException {