Merge branch '2.0-dev' of http://gitea.dctpay.com/hurui/hai-server into 2.0-dev

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

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

@ -157,3 +157,8 @@ NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
wxZxjzAppId=wxc872cb59b56681a7 wxZxjzAppId=wxc872cb59b56681a7
wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a 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 wxZxjzAppId=wxc872cb59b56681a7
wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a 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