Merge branch 'new-dev' into 2.0-dev

# Conflicts:
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
master
袁野 8 months ago
parent ec679f98c9
commit 42813d4068
  1. 127
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  2. 1
      hai-service/src/main/resources/dev/commonConfig.properties
  3. 5
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  4. 5
      hai-service/src/main/resources/prod/commonConfig.properties
  5. 28
      v1/src/main/java/com/v1/controller/WxMsgController.java

@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.PayloService;
import com.hai.config.PetroConfig;
import com.hai.config.PetroCouponConfig;
import com.hai.entity.ApiCoupon;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiBlxCouponService;
@ -22,8 +23,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Controller
@RequestMapping(value = "/apiCoupon")
@ -64,62 +68,81 @@ public class ApiCouponController {
public ResponseData synCouponRule(@RequestParam(name = "type", required = true) Integer type) {
try {
PetroConfig.init(type);
JSONObject jsonObject = petroConfig.synCouponRule();
if (jsonObject.getString("resultCode").equals("0000")) {
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONArray jsonArray = JSONArray.parseArray(data);
System.out.println(jsonArray);
ApiCoupon apiCoupon;
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
apiCoupon = apiCouponService.findCoupon(object.getString("alias"));
if (apiCoupon == null ) {
apiCoupon = new ApiCoupon();
apiCoupon.setCode(object.getString("alias"));
apiCoupon.setDesc(object.getString("declare"));
apiCoupon.setGoodsType(object.getString("bizType"));
apiCoupon.setName(object.getString("title"));
apiCoupon.setValidType(object.getInteger("validType"));
if (object.getInteger("validType") == 1) {
apiCoupon.setValidDate(object.getDate("validDate"));
}
apiCoupon.setEffectiveDays(object.getInteger("validDate"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setCreateTime(new Date());
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("faceValue"));
apiCouponService.insertCoupon(apiCoupon);
} else {
apiCoupon.setCode(object.getString("alias"));
apiCoupon.setDesc(object.getString("declare"));
apiCoupon.setGoodsType(object.getString("bizType"));
apiCoupon.setName(object.getString("title"));
apiCoupon.setValidType(object.getInteger("validType"));
if (object.getInteger("validType") == 1) {
apiCoupon.setValidDate(object.getDate("validDate"));
if (type == 4) {
JSONObject jsonObject = PetroCouponConfig.getCouponList();
JSONArray array = jsonObject.getJSONArray("data");
List<JSONObject> list = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
object.put("alias" , object.getString("reqCode"));
object.put("title" , object.getString("tplName"));
object.put("qty" , object.getString("ticketBalance"));
object.put("faceValue" , object.getBigDecimal("tplAmount").divide(new BigDecimal(100)));
object.put("bizTypeDesc" , "汽油券");
object.put("validDate" , "180");
list.add(object);
}
return ResponseMsgUtil.success(list);
} else {
PetroConfig.init(type);
JSONObject jsonObject = petroConfig.synCouponRule();
if (jsonObject.getString("resultCode").equals("0000")) {
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONArray jsonArray = JSONArray.parseArray(data);
ApiCoupon apiCoupon;
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
apiCoupon = apiCouponService.findCoupon(object.getString("alias"));
if (apiCoupon == null ) {
apiCoupon = new ApiCoupon();
apiCoupon.setCode(object.getString("alias"));
apiCoupon.setDesc(object.getString("declare"));
apiCoupon.setGoodsType(object.getString("bizType"));
apiCoupon.setName(object.getString("title"));
apiCoupon.setValidType(object.getInteger("validType"));
if (object.getInteger("validType") == 1) {
apiCoupon.setValidDate(object.getDate("validDate"));
}
apiCoupon.setEffectiveDays(object.getInteger("validDate"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setCreateTime(new Date());
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("faceValue"));
apiCouponService.insertCoupon(apiCoupon);
} else {
apiCoupon.setCode(object.getString("alias"));
apiCoupon.setDesc(object.getString("declare"));
apiCoupon.setGoodsType(object.getString("bizType"));
apiCoupon.setName(object.getString("title"));
apiCoupon.setValidType(object.getInteger("validType"));
if (object.getInteger("validType") == 1) {
apiCoupon.setValidDate(object.getDate("validDate"));
}
apiCoupon.setEffectiveDays(object.getInteger("validDate"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("faceValue"));
apiCouponService.editCoupon(apiCoupon);
}
apiCoupon.setEffectiveDays(object.getInteger("validDate"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("faceValue"));
apiCouponService.editCoupon(apiCoupon);
}
}
return ResponseMsgUtil.success(jsonArray);
return ResponseMsgUtil.success(jsonArray);
}
}
return ResponseMsgUtil.success("请求失败");

@ -179,5 +179,4 @@ NdKey= 5df3f620-e269-458d-9556-87e26d30256a
#Sph
SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry
SphMerchant = 355920109860
SphReqCode = z9zhwgk31j2kkk4b
SphSecret = Es9cshhRoDxeFAuGItLZUDi8Qj3PWrje

@ -157,3 +157,8 @@ NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
wxZxjzAppId=wxc872cb59b56681a7
wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a
#Sph
SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry
SphMerchant = 618809656349
SphSecret = xstEWAhjw74GzMkXcPr2Cf7z00aYXaSy

@ -162,3 +162,8 @@ NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
wxZxjzAppId=wxc872cb59b56681a7
wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a
#Sph
SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry
SphMerchant = 618809656349
SphSecret = xstEWAhjw74GzMkXcPr2Cf7z00aYXaSy

@ -595,32 +595,4 @@ public class WxMsgController {
// @RequestMapping(value = "/verifyWx", method = RequestMethod.GET)
// @ResponseBody
// @ApiOperation(value = "微信签名")
// public String verifyWx() {
//
// try {
//
// Map<String, Object> params = new HashMap<>();
// params.put("appid", SysConst.getSysConfig().getWxH5AppId());
// params.put("secret", SysConst.getSysConfig().getWxH5AppSecret());
// params.put("grant_type", "client_credential");
//
// JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params);
//
// Map<String, Object> map = new HashMap<>();
// map.put("noncestr","Wm3WZYTPz0wzccnW");
// map.put("jsapi_ticket",accessTokenObject.getString("ticket"));
// map.put("timestamp","1414587457");
// map.put("url","http://mp.weixin.qq.com?params=value");
//
// return WxUtils.getSHA1(map);
// } catch (Exception e) {
// return null;
// }
//
// }
}

Loading…
Cancel
Save