Commit 5d25985a by tang

添加用户级别定时任务,修改验证类型,以及sdf格式化错误等

parent 985bb501
......@@ -112,7 +112,7 @@ public static final String QUICK_WEB_PAY = "/quick/web/pay";
public static final long seconds = 60;
public static final long minutes = 60;
public static final long hours = 24;
public static final SimpleDateFormat YYYYMMDD_HHMMSS = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
public static final SimpleDateFormat YYYYMMDD_HHMMSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//HH:mm:ss 24小时制
public static final SimpleDateFormat YYYYMMDDHHMM = new SimpleDateFormat("yyyyMMddhhmm");
/**
* 系统公共
......
......@@ -59,8 +59,19 @@ public class IdGen implements IdGenerator, SessionIdGenerator {
public Serializable generateId(Session session) {
return IdGen.uuid();
}
/**
* 六位数字ID
* @return
*/
public static String randomIntId(){
return String.valueOf((int)((Math.random()*9+1)*100000));
}
public static void main(String[] args) {
System.out.println(IdGen.randomIntId());
System.out.println((int)((Math.random()*9+1)*100000));
System.out.println(IdGen.uuid());
System.out.println(IdGen.uuid().length());
System.out.println(new IdGen().getNextId());
......
......@@ -135,7 +135,7 @@ public class JuHeZhongPayJFenService {
dto.put("sign", sign);
logger.info("signBefore:{},sign:{}", signBefore,sign);
String respStr = HttpUtil.post(ComCode.HOST + ComCode.JFEN_QUICK_PAY_URL, dto.toJSONString());
System.out.println(respStr);
logger.debug("请求结果:{}", respStr);
return JSONObject.parseObject(respStr);
}
......
......@@ -698,6 +698,15 @@ public class PayApiService {
// HL2 通道 即JFEN 发送验证码 需要的参数 SubMerchantCode\amount\cardCode\PayChannel 通道\
@Transactional(readOnly = false)
public Response sendMessageJFen(JuHeZhongPayRequest request) throws MyException {
// RateEntity rate = new RateEntity();
// rate.setUserLevel(userEntityRequest.getLevel());
// rate.setPayChannel(ComCode.PAYCHANNEL_HL2);
// rate.setPayMethod("quick");//全部写死是quick
// RateEntity rateEntity = this.getRateByLevel(rate);
// rateEntity.setServiceType("0");
// Thread.sleep(2000);
// // 添加费率
// this.merchantFeelJFen(JFenSubMchId,rateEntity);
request.setPayMethod("quick");
CardEntity cardEntity = userService.getCardInfoSwpaccid(request);
UserSubMchId userSubMchId = new UserSubMchId();
......@@ -786,7 +795,7 @@ public class PayApiService {
return response;
}
// HL2 通道 即JFEN 发送验证码 需要的参数 SubMerchantCode\payNo\passwd\cardCode \
// HL2 通道 即JFEN 支付 需要的参数 SubMerchantCode\payNo\passwd\cardCode \
@Transactional(readOnly = false)
public PayBackDto jFenPayJuhezhong(JuHeZhongPayRequest request) throws Exception {
......@@ -840,7 +849,7 @@ public class PayApiService {
//获取用户对应等级费率以及每笔需要的手续费
RateEntity gradeRate = getGradeRate(userEntity.getLevel(), request.getPayChannel());
logger.debug("用户等级请求结果,费率: {}, 单笔价格: {}",gradeRate.getRate(), gradeRate.getSiglePrice());
//获取扣除手续费后的金额,已经转换为分
// BigDecimal amount = calculationAmount(gradeRate, request.getAmount());
// int amountFen = amount.multiply(BigDecimal.valueOf(100.0)).setScale(2, BigDecimal.ROUND_HALF_UP).intValue();
......@@ -879,9 +888,9 @@ public class PayApiService {
dto.setTimestamp(System.currentTimeMillis());
logger.debug("HL4支付请求参数, expireDate: {}, cvn2: {}, cardMobile: {}, " +
"cardNo: {}, settleBankName: {}, settleBankNo: {}, settleBankPhone:{}, " +
"name:{}, certificateCode:{}", request.getExpireDate(), request.getCvn2(),
"name:{}, certificateCode:{}, userFee:{}", request.getExpireDate(), request.getCvn2(),
cardEntity.getCardMobile(), cardEntity.getCardNo(), cardEntityDebit.getBankName(), cardEntityDebit.getCardNo(),
cardEntityDebit.getCardMobile(), userDetail.getRealName(), userDetail.getIdCard());
cardEntityDebit.getCardMobile(), userDetail.getRealName(), userDetail.getIdCard(),amount);
JSONObject jsonObject = juHeZhongPayService.quickPay(dto);
logger.debug("HL4支付返回结果信息:{}" + jsonObject.toJSONString());
......@@ -1186,10 +1195,11 @@ public class PayApiService {
//修改费率
RateEntity rateEntity = new RateEntity();
rateEntity.setPayChannel("quick_jfen");
rateEntity.setPayMethod("quick");
rateEntity.setUserLevel(userEntity.getLevel());
rateEntity.setServiceType("1");//修改的标识
userDao.getRateByLevel(rateEntity);
userService.merchantFeelJFen(userSubMchIdQuery.getSubmchid(),rateEntity);
RateEntity rateByLevel = userDao.getRateByLevel(rateEntity);
rateByLevel.setServiceType("1");//修改的标识
userService.merchantFeelJFen(userSubMchIdQuery.getSubmchid(),rateByLevel);
}
}
}
......@@ -1420,7 +1430,8 @@ public class PayApiService {
Double rate = Double.valueOf(gradeRate.getRate());
Double amountDouble = Double.valueOf(amount);
//总共所需手续费
int result = BigDecimal.valueOf(amountDouble * rate).add(BigDecimal.valueOf(siglePrice * 100.0)).intValue();
int result = BigDecimal.valueOf(amountDouble * rate).add(BigDecimal.valueOf(siglePrice).subtract(BigDecimal.ONE)).multiply(BigDecimal.valueOf(100)).intValue();
logger.debug("计算出来的费率:"+ result);
//扣除费率及手续费后的金额
// BigDecimal result = BigDecimal.valueOf(amountDouble).subtract(BigDecimal.valueOf(siglePrice))
// .subtract(BigDecimal.valueOf(amountDouble * rate));
......
......@@ -31,10 +31,18 @@ public class TimingService {
@Autowired
private JuHeZhongPayIntegralService juHeZhongPayIntegralService;
@Autowired
private UserApiService userApiService;
@Scheduled(cron = "0 0 0/1 * * ?")
public void updateOrders(){
payApiService.updateOrderTiming();
payApiService.updateOrders();
}
@Scheduled(cron = "0 0/15 * * * ? ")
public void updateUserGrade(){
userApiService.updateUserLevel();
}
}
......@@ -79,7 +79,7 @@ public class UserApiController {
return resp;
}
Map identifyCodeMap = new HashMap();
// identifyCodeMap.put("indentifyCode", userService.getIdentifyCode(request));
identifyCodeMap.put("indentifyCode", userService.getIdentifyCode(request));
resp.setData(identifyCodeMap);
resp.setStatus(ComCode.STATUS_CODE_2000);
resp.setMessage(ComCode.STATUS_CODE_2000_DESC);
......@@ -107,38 +107,38 @@ public class UserApiController {
resp.setMessage(ComCode.STATUS_CODE_4001_DESC);
return resp;
}
// // 根据手机号 + 使用场景 + 验证码查询
// IdentityCodeEntity identityCodeEntity = userService.getIdentifyCode(request);
// // 验证码使用场景
// if (identityCodeEntity == null) {
// resp.setStatus(ComCode.STATUS_CODE_4010);
// resp.setMessage(ComCode.STATUS_CODE_4010_DESC);
// return resp;
// }
// // 验证码是否过期
// if (!userService.checkIdentifyCodeExpired(identityCodeEntity)) {
// resp.setStatus(ComCode.STATUS_CODE_4009);
// resp.setMessage(ComCode.STATUS_CODE_4009_DESC);
// return resp;
// }
// // 查询推荐人是否存在
// if (userService.checkRecommend(request) == null) {
// resp.setStatus(ComCode.STATUS_CODE_4006);
// resp.setMessage(ComCode.STATUS_CODE_4006_DESC);
// return resp;
// }
// // 查询注册手机号是否存在
// if (userService.checkMobile(request) != null) {
// resp.setStatus(ComCode.STATUS_CODE_4007);
// resp.setMessage(ComCode.STATUS_CODE_4007_DESC);
// return resp;
// }
// // 注册手机号与推荐人手机号是否重复
// if (request.getMobile().equals(request.getRecommendedMobile())) {
// resp.setStatus(ComCode.STATUS_CODE_4008);
// resp.setMessage(ComCode.STATUS_CODE_4008_DESC);
// return resp;
// }
// 根据手机号 + 使用场景 + 验证码查询
IdentityCodeEntity identityCodeEntity = userService.getIdentifyCode(request);
// 验证码使用场景
if (identityCodeEntity == null) {
resp.setStatus(ComCode.STATUS_CODE_4010);
resp.setMessage(ComCode.STATUS_CODE_4010_DESC);
return resp;
}
// 验证码是否过期
if (!userService.checkIdentifyCodeExpired(identityCodeEntity)) {
resp.setStatus(ComCode.STATUS_CODE_4009);
resp.setMessage(ComCode.STATUS_CODE_4009_DESC);
return resp;
}
// 查询推荐人是否存在
if (userService.checkRecommend(request) == null) {
resp.setStatus(ComCode.STATUS_CODE_4006);
resp.setMessage(ComCode.STATUS_CODE_4006_DESC);
return resp;
}
// 查询注册手机号是否存在
if (userService.checkMobile(request) != null) {
resp.setStatus(ComCode.STATUS_CODE_4007);
resp.setMessage(ComCode.STATUS_CODE_4007_DESC);
return resp;
}
// 注册手机号与推荐人手机号是否重复
if (request.getMobile().equals(request.getRecommendedMobile())) {
resp.setStatus(ComCode.STATUS_CODE_4008);
resp.setMessage(ComCode.STATUS_CODE_4008_DESC);
return resp;
}
// 保存注册用户
resp.setData(userService.signUp(request));
resp.setStatus(ComCode.STATUS_CODE_2000);
......@@ -368,7 +368,13 @@ public class UserApiController {
resp.setMessage(ComCode.STATUS_CODE_2000_DESC);
} catch (MyException e) {
resp.setStatus(ComCode.STATUS_CODE_5001);
resp.setMessage(ComCode.STATUS_CODE_5001_DESC);
if(e.getMessage().equals("输入银行卡号有误") || e.getMessage().equals("银行卡类别不正确")
|| e.getMessage().equals("手机号码格式不正确")|| e.getMessage().equals("信用卡信息需补全")){
resp.setMessage(e.getMessage());
}else{
resp.setMessage(ComCode.STATUS_CODE_5001_DESC);
}
resp.setError(e.getMessage());
} catch (Exception e) {
resp.setStatus(ComCode.STATUS_CODE_9998);
......@@ -468,21 +474,21 @@ public class UserApiController {
throw new MyException("手机号码格式不正确");
}
// // 根据手机号 + 使用场景 + 验证码查询
// request.setMobile(request.getCardMobile());
// IdentityCodeEntity identityCodeEntity = userService.getIdentifyCode(request);
// // 验证码使用场景
// if (identityCodeEntity == null) {
// resp.setStatus(ComCode.STATUS_CODE_4010);
// resp.setMessage(ComCode.STATUS_CODE_4010_DESC);
// return resp;
// }
// // 验证码是否过期
// if (!userService.checkIdentifyCodeExpired(identityCodeEntity)) {
// resp.setStatus(ComCode.STATUS_CODE_4009);
// resp.setMessage(ComCode.STATUS_CODE_4009_DESC);
// return resp;
// }
// 根据手机号 + 使用场景 + 验证码查询
request.setMobile(request.getCardMobile());
IdentityCodeEntity identityCodeEntity = userService.getIdentifyCode(request);
// 验证码使用场景
if (identityCodeEntity == null) {
resp.setStatus(ComCode.STATUS_CODE_4010);
resp.setMessage(ComCode.STATUS_CODE_4010_DESC);
return resp;
}
// 验证码是否过期
if (!userService.checkIdentifyCodeExpired(identityCodeEntity)) {
resp.setStatus(ComCode.STATUS_CODE_4009);
resp.setMessage(ComCode.STATUS_CODE_4009_DESC);
return resp;
}
userService.certification(request);
resp.setStatus(ComCode.STATUS_CODE_2000);
resp.setMessage(ComCode.STATUS_CODE_2000_DESC);
......@@ -693,4 +699,23 @@ public class UserApiController {
return true;
}
@PostMapping("/testMatch")
public Response testMatch(UserRequest request){
Response resp = new Response();
if(request == null || StringUtils.isBlank(request.getSubMerchantCode())){
resp.setStatus(ComCode.STATUS_CODE_4002);
resp.setMessage(ComCode.STATUS_CODE_4001_DESC);
return resp;
}
try{
userService.updateUserLevel();
resp.setStatus(ComCode.STATUS_CODE_2000);
resp.setMessage(ComCode.STATUS_CODE_2000_DESC);
}catch (Exception e){
resp.setStatus(ComCode.STATUS_CODE_9998);
resp.setMessage(ComCode.STATUS_CODE_9998_DESC);
resp.setError(e.getMessage());
}
return resp;
}
}
......@@ -120,4 +120,10 @@ public interface UserApiDao {
void updateCard(CardEntity cardEntity);
CardEntity getCardEntity(Request request);
//获取所有级别是青铜,推荐数大于等于3的推荐人
List<UserEntity> getUserLevelIsE();
//获取满足条件的数量
Integer getMatchNum(String mobile);
}
......@@ -991,4 +991,55 @@
AND yc.del_flag = '0'
LIMIT 1
</select>
<select id="getUserLevelIsE" resultType="com.thinkgem.jeesite.modules.user.entity.UserEntity">
SELECT
id,
`code`,
nickname,
`level`,
mobile
FROM
youka_users
WHERE
`level` = "E"
AND mobile IN (
SELECT
recommended_mobile
FROM
youka_users
GROUP BY
recommended_mobile
HAVING
count(recommended_mobile) > 2
)
</select>
<select id="getMatchNum" resultType="java.lang.Integer">
SELECT
count(amountSum)
FROM
(
SELECT
a.user_code,
SUM(a.amount) amountSum
FROM
youka_orders a
WHERE
pay_status = 2
AND pay_method = "quick"
AND user_code IN (
SELECT
CODE
FROM
`youka_users` b
WHERE
b.recommended_mobile = #{mobile}
)
GROUP BY
user_code
) a
WHERE
a.amountSum >= 10000;
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment