提交代码

master
胡锐 3 months ago
parent 7754b699f5
commit f5ff4a2c00
  1. 15
      cweb/src/main/java/com/cweb/controller/BsUserController.java
  2. 37
      schedule/src/main/java/com/hfkj/schedule/DiscountSchedule.java
  3. 2
      service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumRequestService.java
  4. 7
      service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
  5. 4
      service/src/main/java/com/hfkj/service/discount/impl/BsDiscountServiceImpl.java

@ -9,6 +9,7 @@ import com.hfkj.common.alipay.AlipayUtils;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.pay.util.SignatureUtil;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.MemberValidateUtil; import com.hfkj.common.utils.MemberValidateUtil;
@ -58,16 +59,24 @@ public class BsUserController {
@RequestMapping(value = "/autoLogin", method = RequestMethod.POST) @RequestMapping(value = "/autoLogin", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "登录并注册") @ApiOperation(value = "自动登录并注册")
public ResponseData autoLogin(@RequestBody JSONObject body) { public ResponseData autoLogin(@RequestBody JSONObject body) {
try { try {
if (body == null if (body == null
|| StringUtils.isBlank(body.getString("appid")) || StringUtils.isBlank(body.getString("appid"))
|| StringUtils.isBlank(body.getString("phone"))) { || StringUtils.isBlank(body.getString("phone"))
|| StringUtils.isBlank(body.getString("sign"))
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
// 接入appid // 接入appid
BsAgentApiParam agentApiParam = agentApiParamService.getParamByAppId(body.getString("appid")); BsAgentApiParam agentApiParam = agentApiParamService.getParamByAppId(body.getString("appid"));
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(agentApiParam.getAppId());
if (!SignatureUtil.checkSign(body.getString("sign"), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
String phone = body.getString("phone"); String phone = body.getString("phone");
Map<String, Object> other = new HashMap<>(); Map<String, Object> other = new HashMap<>();
@ -77,7 +86,7 @@ public class BsUserController {
return ResponseMsgUtil.success(userService.login(UserLoginPlatform.TRIPARTITE, UserLoginType.TRIPARTITE, phone, other)); return ResponseMsgUtil.success(userService.login(UserLoginPlatform.TRIPARTITE, UserLoginType.TRIPARTITE, phone, other));
} catch (Exception e) { } catch (Exception e) {
log.error("LoginController --> phone() error!", e); log.error("LoginController --> autoLogin() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }

@ -1,10 +1,17 @@
package com.hfkj.schedule; package com.hfkj.schedule;
import com.hfkj.entity.BsDiscount;
import com.hfkj.service.discount.BsDiscountService;
import com.hfkj.service.discount.BsDiscountUserService; import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.sysenum.discount.DiscountStatusEnum;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @className: DiscountSchedule * @className: DiscountSchedule
@ -16,15 +23,39 @@ public class DiscountSchedule {
@Resource @Resource
private BsDiscountUserService discountUserService; private BsDiscountUserService discountUserService;
@Resource
private BsDiscountService discountService;
/**
* 用户优惠券过期
*/
@Scheduled(cron="0 0/1 * * * ?") //每分钟执行一次 @Scheduled(cron="0 0/1 * * * ?") //每分钟执行一次
public void newLinkGasSchedule() { public void userDiscountExpiration() {
try { try {
// 更新过期数据 // 更新过期数据
discountUserService.expiration();; discountUserService.expiration();;
} catch (Exception e) { } catch (Exception e) {
System.out.println("更新价格失败!!!"); System.out.println("更新失败!!!");
}
}
/**
* 优惠券过期
*/
@Scheduled(cron="0 0/30 * * * ?") //每30分钟执行一次
public void discountExpiration() {
try {
Map<String,Object> param = new HashMap<>();
param.put("status", DiscountStatusEnum.status2.getCode());
param.put("endTimeE", System.currentTimeMillis());
List<BsDiscount> list = discountService.getList(param);
for (BsDiscount discount : list) {
discountService.done(discount.getDiscountNo());
}
} catch (Exception e) {
System.out.println("更新失败!!!");
} }
} }

@ -62,7 +62,7 @@ public class CqShellPetroleumRequestService {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("platMerchantId", PLAT_MERCHANT_ID); param.put("platMerchantId", PLAT_MERCHANT_ID);
param.put("stationCode", stationCode); param.put("stationCode", stationCode);
return request(System.currentTimeMillis()+"","gasPageQueryAllStation", param); return request(System.currentTimeMillis()+"","gasStationQueryDetail", param);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -82,11 +82,8 @@ public class SignatureUtil {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String paramStr = "{\n" + String paramStr = "{\n" +
" \"reqId\": \"cs0005\",\n" + "\t\"appid\": \"hf7356c71fb97ab0\",\n" +
" \"appId\": \"hf7356c71fb97ab0\",\n" + "\t\"phone\": \"17726395120\"" +
" \"discountPkNo\": \"DPK10018\",\n" +
" \"number\": \"1\",\n" +
" \"phone\": \"17726395120\"" +
"}"; "}";
String sign = createSign(JSONObject.parseObject(paramStr), "8aef995ff71485dc19b36e35f04c4016"); String sign = createSign(JSONObject.parseObject(paramStr), "8aef995ff71485dc19b36e35f04c4016");
System.out.println(sign); System.out.println(sign);

@ -160,6 +160,10 @@ public class BsDiscountServiceImpl implements BsDiscountService {
criteria.andCreateUserIdEqualTo(MapUtils.getLong(param, "createUserId") ); criteria.andCreateUserIdEqualTo(MapUtils.getLong(param, "createUserId") );
} }
if (MapUtils.getLong(param, "endTimeE") != null) {
criteria.andEndTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "endTimeE")));
}
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
return discountMapper.selectByExample(example); return discountMapper.selectByExample(example);
} }

Loading…
Cancel
Save