mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-08 12:00:11 +08:00
update 下发停车优惠券时,记录到数据库表中
This commit is contained in:
@@ -104,7 +104,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ActiveProfiles("pre")
|
@ActiveProfiles("dev")
|
||||||
@SpringBootTest(classes = JsowellApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(classes = JsowellApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
public class SpringBootTestController {
|
public class SpringBootTestController {
|
||||||
@@ -264,12 +264,27 @@ public class SpringBootTestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PileSnGenerateService pileSnGenerateService;
|
private PileSnGenerateService pileSnGenerateService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarCouponRecordService carCouponRecordService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getEBikePileSnTest() {
|
public void getEBikePileSnTest() {
|
||||||
List<String> strings = pileSnGenerateService.generateEBikeSN(8);
|
List<String> strings = pileSnGenerateService.generateEBikeSN(8);
|
||||||
System.out.println(strings);
|
System.out.println(strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInsetCarCoupon() {
|
||||||
|
CarCouponRecord carCouponRecord = new CarCouponRecord();
|
||||||
|
carCouponRecord.setOrderCode("123456");
|
||||||
|
carCouponRecord.setReturnCode("10004");
|
||||||
|
carCouponRecord.setReturnMsg("该车牌已领取过该券包中的优惠券");
|
||||||
|
carCouponRecord.setPlateNumber("粤BD26691");
|
||||||
|
carCouponRecord.setStationId(Long.parseLong("19"));
|
||||||
|
|
||||||
|
carCouponRecordService.insertCarCouponRecord(carCouponRecord);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getListByMemberIdAndOrderStatusTest() {
|
public void getListByMemberIdAndOrderStatusTest() {
|
||||||
String memberId = "12345678";
|
String memberId = "12345678";
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.dto.lutongyunting;
|
package com.jsowell.pile.dto.lutongyunting;
|
||||||
|
|
||||||
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -39,4 +40,9 @@ public class BindCouponDTO {
|
|||||||
* 车牌颜色
|
* 车牌颜色
|
||||||
*/
|
*/
|
||||||
private Integer plateColor;
|
private Integer plateColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单基本信息
|
||||||
|
*/
|
||||||
|
private OrderBasicInfo orderBasicInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -651,6 +651,7 @@ public class CommonService {
|
|||||||
.secretKey(parkingInfo.getSecretKey())
|
.secretKey(parkingInfo.getSecretKey())
|
||||||
.plateNumber(orderBasicInfo.getPlateNumber())
|
.plateNumber(orderBasicInfo.getPlateNumber())
|
||||||
.plateColor(5) // 5-绿牌车
|
.plateColor(5) // 5-绿牌车
|
||||||
|
.orderBasicInfo(orderBasicInfo)
|
||||||
.build();
|
.build();
|
||||||
// 绑定优惠券
|
// 绑定优惠券
|
||||||
return ltytService.bindCoupon(dto);
|
return ltytService.bindCoupon(dto);
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ import com.jsowell.common.exception.BusinessException;
|
|||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.sign.MD5Util;
|
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.BindCouponDTO;
|
||||||
import com.jsowell.pile.dto.lutongyunting.GetTokenDTO;
|
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.common.LTYTCommonParams;
|
||||||
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
|
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -35,6 +38,9 @@ public class LTYTServiceImpl implements LTYTService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarCouponRecordService carCouponRecordService;
|
||||||
|
|
||||||
// private static final String APP_ID = "I2qa3hdr116100dc"; // I2qa3hdr116100dc I2qa3jfnd96f267c
|
// private static final String APP_ID = "I2qa3hdr116100dc"; // I2qa3hdr116100dc I2qa3jfnd96f267c
|
||||||
|
|
||||||
// private static final String SECRET_KEY = "2qa3hdr13754a8e"; // 2qa3hdr13754a8e 2qa3jfndb37926d
|
// private static final String SECRET_KEY = "2qa3hdr13754a8e"; // 2qa3hdr13754a8e 2qa3jfndb37926d
|
||||||
@@ -94,6 +100,7 @@ public class LTYTServiceImpl implements LTYTService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String bindCoupon(BindCouponDTO dto) throws UnsupportedEncodingException {
|
public String bindCoupon(BindCouponDTO dto) throws UnsupportedEncodingException {
|
||||||
|
OrderBasicInfo orderBasicInfo = dto.getOrderBasicInfo();
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
GetTokenDTO tokenDTO = new GetTokenDTO();
|
GetTokenDTO tokenDTO = new GetTokenDTO();
|
||||||
tokenDTO.setAppId(dto.getAppId());
|
tokenDTO.setAppId(dto.getAppId());
|
||||||
@@ -123,8 +130,19 @@ public class LTYTServiceImpl implements LTYTService {
|
|||||||
String result = HttpUtil.post(url, JSON.toJSONString(jsonObject));
|
String result = HttpUtil.post(url, JSON.toJSONString(jsonObject));
|
||||||
log.info("给指定车辆绑定优惠券 params:{}, result:{}", JSON.toJSONString(jsonObject), result);
|
log.info("给指定车辆绑定优惠券 params:{}, result:{}", JSON.toJSONString(jsonObject), result);
|
||||||
JSONObject resultJson = JSONObject.parseObject(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 {
|
public static void main(String[] args) throws UnsupportedEncodingException {
|
||||||
|
|||||||
Reference in New Issue
Block a user