Commit 07129a4a authored by cy's avatar cy

充值卡重复提示

parent 2db4c24f
......@@ -48,6 +48,12 @@ public interface CardMapper extends BaseMapper<CardInfo> {
*/
List<CardInfo> getListByCardNo(@Param("cardNo")String cardNo);
/**
* 获取所以卡片信息
* @return CardInfo
*/
List<String> getAllCarInfo();
}
......@@ -89,6 +89,7 @@
<where>
<if test="status != null">and status =#{status}</if>
<if test="type != null">and type =#{type}</if>
<if test="title != null and title != ''">and title like #{title}</if>
</where>
order by create_time desc
limit #{pageNo},#{pageSize}
......
......@@ -116,4 +116,14 @@
</where>
</select>
<select id="getAllCarInfo" resultType="java.lang.String">
select
card_number
from
<include refid="table"/>
<where>
is_delete=0
</where>
</select>
</mapper>
......@@ -44,9 +44,9 @@
<sql id="criteria">
<if test="userName != null">and card_number = #{cardNumber}</if>
<if test="password != null"> and batch_number =#{batchNumber}</if>
<if test="password != null">and batch_number =#{batchNumber}</if>
<if test="phone != null">and is_make_card =#{isMakeCard}</if>
<if test="headImage != null"> and is_activite =#{isMakeCard}</if>
<if test="headImage != null">and is_activite =#{isMakeCard}</if>
<if test="examType != null">and is_delete = #{isDelete}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
......@@ -73,24 +73,41 @@
</where>
</update>
<select id="getList" resultMap="refillCardMap" parameterType="map">
<select id="getList" resultMap="refillCardMap" parameterType="cn.wisenergy.model.vo.RefillCardVo">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
is_delete=0
<if test="startTime != null">
and create_time
between #{startTime}
</if>
<if test="endTime != null ">and #{endTime}</if>
order by create_time desc
limit #{pageNo},#{pageSize}
</where>
</select>
<select id="getUserNumbers" resultType="java.lang.Integer">
<select id="getUserNumbers" resultType="java.lang.Integer" parameterType="cn.wisenergy.model.vo.RefillCardVo">
SELECT COUNT(id)
FROM
<include refid="table"/>
where is_delete=0
<where>
is_delete=0
<if test="startTime != null">
and create_time
between #{startTime}
</if>
<if test="endTime != null ">and #{endTime}</if>
</where>
</select>
<select id="getById" resultMap="refillCardMap">
......@@ -109,6 +126,14 @@
where batch_number=#{batchNumber}
</select>
<select id="getByCardNo" resultMap="refillCardMap" parameterType="string">
select
<include refid="cols_all"/>
from
<include refid="table"/>
where card_no=#{cardNo}
</select>
<update id="setIsMakeCard">
UPDATE
<include refid="table"/>
......
......@@ -18,6 +18,7 @@
<result column="politics_grade" property="politicsGrade"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="ranking" property="ranking"/>
</resultMap>
<sql id="table">
......@@ -31,12 +32,12 @@
<sql id="cols_exclude_id">
user_id,culture_grade, major_grade,language_grade,math_grade,english_grade, physics_grade,chemistry_grade,
biology_grade,history_grade,geography_grade,politics_grade, create_time,update_time
biology_grade,history_grade,geography_grade,politics_grade, create_time,update_time,ranking
</sql>
<sql id="vals">
#{userId},#{cultureGrade},#{majorGrade},#{languageGrade},#{mathGrade},#{englishGrade},#{physicsGrade},
#{chemistryGrade},#{biologyGrade}, #{historyGrade},#{geographyGrade},#{politicsGrade},now(),now()
#{chemistryGrade},#{biologyGrade}, #{historyGrade},#{geographyGrade},#{politicsGrade},now(),now(),#{ranking}
</sql>
<sql id="updateCondition">
......@@ -52,7 +53,8 @@
<if test="historyGrade != null">history_grade = #{historyGrade},</if>
<if test="geographyGrade != null">geography_grade = #{geographyGrade},</if>
<if test="politicsGrade != null">politics_grade = #{politicsGrade},</if>
update_time =now()
update_time =now(),
<if test="ranking != null">ranking = #{ranking}</if>
</sql>
<sql id="updateCondition2">
......@@ -68,7 +70,8 @@
history_grade = #{historyGrade},
geography_grade = #{geographyGrade},
politics_grade = #{politicsGrade},
update_time =now()
update_time =now(),
ranking = #{ranking}
</sql>
<sql id="criteria">
......@@ -87,6 +90,7 @@
<if test="politicsGrade != null">and politics_grade = #{politicsGrade}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
<if test="ranking != null">and #{ranking} &gt;= ranking</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.ScoreInfo" keyProperty="id" useGeneratedKeys="true">
......
......@@ -53,6 +53,18 @@ public class RefillCardServiceImpl implements RefillCardService {
if (byCardNo.size() > 0) {
return R.error("该初始卡号已经存在,请重新添加");
}
List<String> allCarInfo = cardMapper.getAllCarInfo();
BigInteger finalCardNumber = refillCard.getCardNo();
BigInteger num = new BigInteger("1");
for (int i = 0; i < refillCard.getCardNumber() - 1; i++) {
finalCardNumber = finalCardNumber.add(num);
BigInteger finalCardNumber1 = finalCardNumber;
boolean present = allCarInfo.stream().filter(m -> m.equals(finalCardNumber1.toString())).findAny().isPresent();
if (present) {
return R.error("该数量区间内存在相同卡号,请重新添加");
}
}
//设置初始状态
String time = DateUtil.getTime(new Date(), "yyyy.MM.dd.HH.mm.sss");
refillCard.setBatchNumber(time);
......@@ -112,13 +124,13 @@ public class RefillCardServiceImpl implements RefillCardService {
List<CardInfo> listByCardNo = cardMapper.getList(card.getBatchNumber());
listByCardNo.sort(Comparator.comparing(CardInfo::getCardNumber));
if (listByCardNo.size() > 1) {
CardInfo minCard=listByCardNo.get(0);
CardInfo maxCard = listByCardNo.get(listByCardNo.size()-1);
CardInfo minCard = listByCardNo.get(0);
CardInfo maxCard = listByCardNo.get(listByCardNo.size() - 1);
card.setCardNoInfo(minCard.getCardNumber() + "~" + maxCard.getCardNumber());
} else if(listByCardNo.size()==1) {
CardInfo minCard=listByCardNo.get(0);
} else if (listByCardNo.size() == 1) {
CardInfo minCard = listByCardNo.get(0);
card.setCardNoInfo(minCard.getCardNumber());
}else{
} else {
BigInteger bigInteger = BigInteger.valueOf(card.getCardNumber() - 1);
BigInteger cardNo = card.getCardNo();
if (card.getCardNumber() - 1 == 0) {
......@@ -145,6 +157,7 @@ public class RefillCardServiceImpl implements RefillCardService {
return R.error("该充值卡不存在");
}
BigInteger cardNumber = new BigInteger(byId.getCardNo() + "");
/* String cardNo=byId.getCardNo()+"";
cardNo=cardNo.substring(0,6)+"%";
List<CardInfo> card = cardMapper.getListByCardNo(cardNo);
......
......@@ -39,24 +39,24 @@ public class Common {
* 支付宝--回调地址
*/
//测试
//public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/aliPayCallBack.do";
public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/aliPayCallBack.do";
//线上
public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/aliPayCallBack.do";
//public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/aliPayCallBack.do";
/***
* 支付宝--pc端支付成功跳转地址
*/
//测试
//public static final String RETURN_URL_PC = "http://111.203.232.171:8999/#/wallet";
public static final String RETURN_URL_PC = "http://111.203.232.171:8999/#/wallet";
//线上
public static final String RETURN_URL_PC = "https://jygkzy.com/#/wallet";
//public static final String RETURN_URL_PC = "https://jygkzy.com/#/wallet";
/***
* 支付宝--手机网页支付成功跳转地址
*/
//测试
//public static final String RETURN_URL_WAP = "http://111.203.232.171:8999/#/history";
public static final String RETURN_URL_WAP = "http://111.203.232.171:8999/#/history";
//线上
public static final String RETURN_URL_WAP = "https://jygkzy.com/#/history";
//public static final String RETURN_URL_WAP = "https://jygkzy.com/#/history";
/**
......
......@@ -47,7 +47,6 @@ public class RefillCardManager {
cardInfo.setSecretKey(SecretkeyUtil.getSecretkey());
cardInfo.setCardNumber(String.valueOf(cardNumber));
cardInfos.add(cardInfo);
for (int i = 0; i < byId.getCardNumber() - 1; i++) {
CardInfo card = new CardInfo();
cardNumber = cardNumber.add(num);
......
......@@ -9,9 +9,9 @@ package cn.wisenergy.service.wxpay;
public class WxCommon {
//测试
//public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/wxPayCallBack.do";
public static final String NOTIFY_URL = "http://111.203.232.171:8997/pay/wxPayCallBack.do";
//线上
public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/wxPayCallBack.do";
//public static final String NOTIFY_URL = "https://jygkzy.com/api/pay/wxPayCallBack.do";
......
......@@ -77,9 +77,4 @@ public class RefillCardController {
return refillCardService.createExcel(batchNumber,response);
}
public static void main(String[] args) {
int num=123;
DecimalFormat df = new DecimalFormat("0000000000");
System.out.println(df.format(num));
}
}
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