|
|
|
@ -1,11 +1,13 @@ |
|
|
|
|
package com.cweb.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hfkj.common.exception.ErrorCode; |
|
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.common.pay.util.SignatureUtil; |
|
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
import com.hfkj.common.utils.HttpsUtils; |
|
|
|
|
import com.hfkj.common.utils.RedisUtil; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.config.CommonSysConst; |
|
|
|
@ -35,6 +37,8 @@ import java.util.Map; |
|
|
|
|
@Api(value = "普惠go业务") |
|
|
|
|
public class PhgController { |
|
|
|
|
private static Logger log = LoggerFactory.getLogger(PhgController.class); |
|
|
|
|
@Resource |
|
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/login",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
@ -55,4 +59,33 @@ public class PhgController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/queryPhgList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询普惠GO优惠券列表") |
|
|
|
|
public ResponseData queryPhgList(@RequestParam(name = "status", required = true) Integer status) { |
|
|
|
|
try { |
|
|
|
|
// 用户信息
|
|
|
|
|
UserSessionObject userSessionObject = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
// 状态转换
|
|
|
|
|
if (status == 3) { |
|
|
|
|
status = 0; // 已过期
|
|
|
|
|
} |
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
param.put("appid", CommonSysConst.getSysConfig().getPhgAppid()); |
|
|
|
|
param.put("phone", userSessionObject.getUser().getPhone()); |
|
|
|
|
param.put("status", status); // 状态 0:已过期 1:未使用 2:已使用
|
|
|
|
|
param.put("sign", SignatureUtil.createSign(param, CommonSysConst.getSysConfig().getPhgAppSecret())); |
|
|
|
|
JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getPhgReqUrl()+"/crest/output/getListUserDiscount", JSONObject.toJSONString(param)); |
|
|
|
|
if (!response.getString("return_code").equals("000000")) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg")); |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success(JSONArray.parse(response.getString("return_data"))); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|