| | |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | |
| | | private void addKey(SubmitKeyInfo keyInfo, Long wxUid, String ip, IPUtil.IPInfo ipInfo) throws KeyVerifyException, KeyOrderException, WxOrderCountException { |
| | | private void addKey(SubmitKeyInfo keyInfo, Long wxUid) throws KeyVerifyException, KeyOrderException, WxOrderCountException { |
| | | |
| | | // 查询没有处理的数量 |
| | | long notProcessCount = keyOrderService.countUserNotDoOrder(wxUid, new Date(System.currentTimeMillis() - 1000*60*30)); |
| | |
| | | if (verifyAlipayKey != null && verifyAlipayKey.trim().equalsIgnoreCase("1")) { |
| | | try { |
| | | // 需要验证支付宝口令 |
| | | if (urllist.size() < 1) { |
| | | if (urllist.isEmpty()) { |
| | | throw new Exception("口令中不包含链接"); |
| | | } |
| | | AlipayOrderUtil.AlipayOrderTradeInfo tradeInfo = AlipayOrderUtil.getTradeInfo(urllist.get(0)); |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | keyInfo.setIpInfo(ipInfoMap.get(ip)); |
| | | |
| | | String citys = systemConfigService.getValueCache(SystemConfigKeyEnum.FORBIDDEN_SUBMIT_CITYS); |
| | | if(citys!=null&&ipInfoMap.get(ip)!=null){ |
| | |
| | | wxLogger.info("微信有授权:" + session.getId()); |
| | | LogUtil.loggerDebug.warn("GEO信息:{}-{}-{}", user.getId(),ip, new Gson().toJson(ipInfoMap.get(ip))); |
| | | try { |
| | | addKey(keyInfo, user.getId(),ip, ipInfoMap.get(ip)); |
| | | addKey(keyInfo, user.getId()); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (KeyOrderException e) { |
| | | e.printStackTrace(); |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | addKey(alipayKeyInfo, user.getId(),alipayKeyInfo.getIp(),ipInfoMap.get(alipayKeyInfo.getIp())); |
| | | addKey(alipayKeyInfo, user.getId()); |
| | | } |
| | | response.sendRedirect(successLink); |
| | | return; |
| | |
| | | @Column(name = "pay_merchant") |
| | | private String payMerchant; |
| | | |
| | | @Column(name = "ip") |
| | | private String ip; |
| | | |
| | | @Column(name = "ip_info") |
| | | private String ipInfo; |
| | | |
| | | private WxUserInfo user; |
| | | } |
| | |
| | | package com.taoke.autopay.service.impl; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.taoke.autopay.dao.KeyOrderMapper; |
| | | import com.taoke.autopay.dao.WxUserSettingsMapper; |
| | | import com.taoke.autopay.dto.ChannelOrderStatistic; |
| | |
| | | order.setOrderNo(orderDto.getOrder_id()); |
| | | } |
| | | |
| | | order.setIp(keyInfo.getIp()); |
| | | if(keyInfo.getIpInfo()!=null) { |
| | | order.setIpInfo(new Gson().toJson(keyInfo.getIpInfo())); |
| | | } |
| | | keyOrderMapper.insertSelective(order); |
| | | |
| | | |
| | | return order; |
| | | } |
| | | |
| | |
| | | package com.taoke.autopay.utils; |
| | | |
| | | import com.google.gson.Gson; |
| | | import lombok.Data; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.Serializable; |
| | | import java.net.URLEncoder; |
| | | |
| | | public class IPUtil { |
| | |
| | | } |
| | | } |
| | | |
| | | public static class IPInfo { |
| | | @Data |
| | | public static class IPInfo implements Serializable { |
| | | private String province; |
| | | private String city; |
| | | private String country; |
| | |
| | | public IPInfo(String country, String province, String city) { |
| | | this.province = province; |
| | | this.city = city; |
| | | this.country = country; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getCountry() { |
| | | return country; |
| | | } |
| | | |
| | | public void setCountry(String country) { |
| | | this.country = country; |
| | | } |
| | | } |
| | |
| | | package com.taoke.autopay.vo; |
| | | |
| | | import com.taoke.autopay.utils.IPUtil; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | * @description: TODO |
| | | * @date 2024/7/9 0:03 |
| | | */ |
| | | @Data |
| | | public class SubmitKeyInfo implements Serializable { |
| | | |
| | | private String key; |
| | |
| | | private String referer; |
| | | private String a; |
| | | private String ip; |
| | | private IPUtil.IPInfo ipInfo; |
| | | |
| | | public SubmitKeyInfo() { |
| | | } |
| | |
| | | public SubmitKeyInfo(String key, String money) { |
| | | this.key = key; |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public String getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(String money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return key+"-"+money; |
| | | } |
| | | |
| | | public String getReferer() { |
| | | return referer; |
| | | } |
| | | |
| | | public void setReferer(String referer) { |
| | | this.referer = referer; |
| | | } |
| | | |
| | | public String getA() { |
| | | return a; |
| | | } |
| | | |
| | | public void setA(String a) { |
| | | this.a = a; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | } |
| | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | active: pro |
| | |
| | | <result column="pay_type" property="payType" jdbcType="INTEGER"/> |
| | | <result column="agent_id" property="agentId" jdbcType="BIGINT"/> |
| | | <result column="pay_merchant" property="payMerchant" jdbcType="VARCHAR"/> |
| | | <result column="ip" property="ip" jdbcType="VARCHAR"/> |
| | | <result column="ip_info" property="ipInfo" jdbcType="VARCHAR"/> |
| | | <association property="user" javaType="com.taoke.autopay.entity.WxUserInfo"> |
| | | <id column="uid" property="id" jdbcType="BIGINT"/> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR"/> |
| | |
| | | <result column="money" property="money" jdbcType="DECIMAL"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id |
| | | ,uid,`key`,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,excute_pay_time,pay_time,order_money,order_channel,pay_type,agent_id,pay_merchant</sql> |
| | | ,uid,`key`,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,excute_pay_time,pay_time,order_money,order_channel,pay_type,agent_id,pay_merchant,ip,ip_info</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> |
| | | from table_order where id = #{id,jdbcType=BIGINT} |
| | |
| | | <if test="payType != null">pay_type,</if> |
| | | <if test="agentId != null">agent_id,</if> |
| | | <if test="payMerchant!=null">pay_merchant,</if> |
| | | <if test="ip!=null">ip,</if> |
| | | <if test="ipInfo!=null">ip_info,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="payType != null">#{payType,jdbcType=INTEGER},</if> |
| | | <if test="agentId != null">#{agentId,jdbcType=BIGINT},</if> |
| | | <if test="payMerchant != null">#{payMerchant,jdbcType=VARCHAR},</if> |
| | | |
| | | |
| | | <if test="ip != null">#{ip,jdbcType=VARCHAR},</if> |
| | | <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order |