Commit 9ddf0620 authored by licc's avatar licc

修改充值接口

parent e47d9d92
...@@ -38,10 +38,17 @@ public interface RefillCardMapper extends BaseMapper<RefillCardMapper> { ...@@ -38,10 +38,17 @@ public interface RefillCardMapper extends BaseMapper<RefillCardMapper> {
/** /**
* 通过ID查询充值卡信息 * 通过ID查询充值卡信息
* @param id * @param id 主键
* @return * @return 充值卡信息
*/ */
RefillCard getById(@Param("id") Integer id); RefillCard getById(@Param("id") Integer id);
int setIsMakeCard(@Param("id") Integer id); int setIsMakeCard(@Param("id") Integer id);
/**
* 通过批次号查询充值卡信息
* @param batchNumber 批次号
* @return 充值卡信息
*/
RefillCard getByBatchNumber(@Param("batchNumber") String batchNumber);
} }
...@@ -90,7 +90,6 @@ ...@@ -90,7 +90,6 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
secret_key=#{secretKey} secret_key=#{secretKey}
and status=0
and is_delete=0 and is_delete=0
</where> </where>
</select> </select>
......
...@@ -99,6 +99,14 @@ ...@@ -99,6 +99,14 @@
where id=#{id} where id=#{id}
</select> </select>
<select id="getByBatchNumber" resultType="cn.wisenergy.model.app.RefillCard">
select
<include refid="cols_all"/>
from
<include refid="table"/>
where batch_number=#{batchNumber}
</select>
<update id="setIsMakeCard"> <update id="setIsMakeCard">
UPDATE UPDATE
<include refid="table"/> <include refid="table"/>
......
...@@ -19,7 +19,7 @@ public class RefillCard { ...@@ -19,7 +19,7 @@ public class RefillCard {
* 批次号 * 批次号
*/ */
@ApiModelProperty(value = "批次号",name = "batchNumber") @ApiModelProperty(value = "批次号",name = "batchNumber")
private String batchNumber; private String isActivate;
/** /**
* 是否已制卡 0:已制卡 1:未制卡 * 是否已制卡 0:已制卡 1:未制卡
......
...@@ -8,10 +8,10 @@ package cn.wisenergy.model.enums; ...@@ -8,10 +8,10 @@ package cn.wisenergy.model.enums;
public enum CardStatus { public enum CardStatus {
//未使用 //未使用
NO_USE(1, "未使用"), NO_USE(0, "未使用"),
//已使用 //已使用
ALREADY_USED(2, "已使用"); ALREADY_USED(1, "已使用");
private Integer code; private Integer code;
private String desc; private String desc;
......
package cn.wisenergy.service.app.impl;
import com.alibaba.fastjson.JSON;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import java.util.HashMap;
import java.util.Map;
public class SendSms {
public static void main(String[] args) {
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAIuFVMscvCNpMU", "AvotjHvvGzEm8sX9vZaUhVypnZfUk7");
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain("dysmsapi.aliyuncs.com");
request.setSysVersion("2017-05-25");
request.setSysAction("SendSms");
Map<String,Object> map=new HashMap<>();
map.put("code",123456);
request.putQueryParameter("RegionId", "cn-hangzhou");
request.putQueryParameter("PhoneNumbers", "18757121665");
request.putQueryParameter("SignName", "遵义群智科技有限公司");
request.putQueryParameter("TemplateCode", "SMS_157970381");
request.putQueryParameter("TemplateParam", JSON.toJSONString(map));
try {
CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
} catch (ClientException e) {
e.printStackTrace();
}
}
}
...@@ -3,6 +3,7 @@ package cn.wisenergy.service.app.impl; ...@@ -3,6 +3,7 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.*; import cn.wisenergy.mapper.*;
import cn.wisenergy.model.app.*; import cn.wisenergy.model.app.*;
import cn.wisenergy.model.enums.CardStatus;
import cn.wisenergy.model.enums.PayType; import cn.wisenergy.model.enums.PayType;
import cn.wisenergy.model.vo.AddLimitVo; import cn.wisenergy.model.vo.AddLimitVo;
import cn.wisenergy.service.app.UserLimitService; import cn.wisenergy.service.app.UserLimitService;
...@@ -39,6 +40,9 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit ...@@ -39,6 +40,9 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
@Autowired @Autowired
private VolunteerManager volunteerManager; private VolunteerManager volunteerManager;
@Autowired
private RefillCardMapper refillCardMapper;
@Override @Override
public R<UserLimit> getByUserId(Integer userId) { public R<UserLimit> getByUserId(Integer userId) {
log.info("volunteer-service[]UserLimitServiceImpl[]getByUserId[]input.param.userId:" + userId); log.info("volunteer-service[]UserLimitServiceImpl[]getByUserId[]input.param.userId:" + userId);
...@@ -71,13 +75,27 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit ...@@ -71,13 +75,27 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
//1、充值卡 //1、充值卡
if (PayType.REFILL_CARD.getCode().equals(addLimitVo.getPayType())) { if (PayType.REFILL_CARD.getCode().equals(addLimitVo.getPayType())) {
if (StringUtils.isBlank(addLimitVo.getPassword())) { if (StringUtils.isBlank(addLimitVo.getPassword())) {
return R.error("充值卡密码不能为空!"); return R.error(1,"充值卡密码不能为空!",false);
} }
//根据密码获取充值卡信息 //根据密码获取充值卡信息
CardInfo cardInfo = cardMapper.getBySecretKey(addLimitVo.getPassword()); CardInfo cardInfo = cardMapper.getBySecretKey(addLimitVo.getPassword());
if (null == cardInfo) { if (null == cardInfo || StringUtils.isBlank(cardInfo.getBatchNumber())) {
return R.error("充值卡信息不存在!"); return R.error(1,"充值卡信息不存在!",false);
}
if (cardInfo.getStatus().equals(CardStatus.ALREADY_USED.getCode())) {
return R.error(0,"充值卡已使用,请购买新卡!",false);
}
//获取主卡信息
RefillCard refillCard = refillCardMapper.getByBatchNumber(cardInfo.getBatchNumber());
if (null == refillCard) {
return R.error(1,"充值卡信息不存在!",false);
}
if (refillCard.getIsActivite() == 1) {
return R.error(1,"充值卡未激活,请联系管理员激活!",false);
} }
//增加用户可用查询次数 //增加用户可用查询次数
...@@ -95,7 +113,7 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit ...@@ -95,7 +113,7 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
} else { } else {
//2、微信或者支付宝 //2、微信或者支付宝
if (null == addLimitVo.getPayMoney()) { if (null == addLimitVo.getPayMoney()) {
return R.error("支付金额不能为空!"); return R.error(1,"支付金额不能为空!",false);
} }
//根据支付的金额,查询用户新增查询次数 //根据支付的金额,查询用户新增查询次数
......
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