1 文件已重命名
11个文件已修改
4个文件已添加
| | |
| | | import com.taoke.autopay.service.WxUserOrderCountService; |
| | | import com.taoke.autopay.service.WxUserService; |
| | | import com.taoke.autopay.utils.*; |
| | | import com.taoke.autopay.vo.SubmitKeyInfo; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Controller |
| | | @RequestMapping("webapi") |
| | |
| | | return JsonUtil.loadFalseResult("支付宝口令不正确"); |
| | | } |
| | | try { |
| | | KeyOrder order = keyOrderService.addKeyOrder(key, null, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd")); |
| | | KeyOrder order = keyOrderService.addKeyOrder(new SubmitKeyInfo(key), null, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd")); |
| | | Long uid = keyOrderService.getCanDistributeUid(); |
| | | if (uid != null) { |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | |
| | | } |
| | | } |
| | | |
| | | private void addKey(String key, Long wxUid) throws KeyOrderException, WxOrderCountException { |
| | | KeyOrder order = keyOrderService.addKeyOrder(key, wxUid, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd")); |
| | | private void addKey(SubmitKeyInfo keyInfo, Long wxUid) throws KeyOrderException, WxOrderCountException { |
| | | KeyOrder order = keyOrderService.addKeyOrder(keyInfo, wxUid, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd")); |
| | | Long uid = keyOrderService.getCanDistributeUid(); |
| | | if (uid != null) { |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "submitKeyV2") |
| | | public String submitKeyV2(String key, HttpSession session) { |
| | | public String submitKeyV2(SubmitKeyInfo keyInfo, HttpSession session) { |
| | | WxUserInfo user = (WxUserInfo) session.getAttribute(Constant.SESSION_KEY_USER); |
| | | if (StringUtil.isNullOrEmpty(key)) { |
| | | if (StringUtil.isNullOrEmpty(keyInfo.getKey())) { |
| | | return JsonUtil.loadFalseResult(0, "请上传key"); |
| | | } |
| | | List<String> urllist = UrlUtils.parseUrlsFromText(key); |
| | | List<String> urllist = UrlUtils.parseUrlsFromText(keyInfo.getKey()); |
| | | if (urllist.isEmpty() || !urllist.get(0).contains("ur.alipay.com")) { |
| | | return JsonUtil.loadFalseResult("支付宝口令不正确"); |
| | | } |
| | |
| | | if (user == null) { |
| | | // 先保存KEY |
| | | // SESSION_KEY_TEMP_ALIPAY_KEY |
| | | session.setAttribute(Constant.SESSION_KEY_TEMP_ALIPAY_KEY, key); |
| | | session.setAttribute(Constant.SESSION_KEY_TEMP_ALIPAY_KEY, keyInfo); |
| | | wxLogger.info("微信没有授权:" + session.getId()); |
| | | String redictLink = systemConfigService.getValueCache(SystemConfigKeyEnum.WX_REDIRECT_LINK); |
| | | if (StringUtil.isNullOrEmpty(redictLink)) { |
| | |
| | | wxLogger.info("微信有授权:" + session.getId()); |
| | | |
| | | try { |
| | | addKey(key, user.getId()); |
| | | addKey(keyInfo, user.getId()); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (KeyOrderException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } catch (WxOrderCountException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 带口令与金额的口令提交接口 |
| | | * @date 0:12 2024/7/9 |
| | | * @param: keyInfo |
| | | * @param: session |
| | | * @return java.lang.String |
| | | **/ |
| | | @ResponseBody |
| | | @RequestMapping(value = "submitKeyV3") |
| | | public String submitKeyV3(SubmitKeyInfo keyInfo, HttpSession session) { |
| | | WxUserInfo user = (WxUserInfo) session.getAttribute(Constant.SESSION_KEY_USER); |
| | | if (StringUtil.isNullOrEmpty(keyInfo.getKey())) { |
| | | return JsonUtil.loadFalseResult(0, "请上传key"); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(keyInfo.getMoney())) { |
| | | return JsonUtil.loadFalseResult(0, "请上传money"); |
| | | } |
| | | List<String> urllist = UrlUtils.parseUrlsFromText(keyInfo.getKey()); |
| | | if (urllist.isEmpty() || !urllist.get(0).contains("ur.alipay.com")) { |
| | | return JsonUtil.loadFalseResult("支付宝口令不正确"); |
| | | } |
| | | // 验证提交时间 |
| | | String timeStr = systemConfigService.getValueCache(SystemConfigKeyEnum.KEY_SUBMIT_TIME_RANGE); |
| | | if(StringUtil.isNullOrEmpty(timeStr)){ |
| | | return JsonUtil.loadFalseResult("尚未配置生效时间"); |
| | | } |
| | | String startTime = timeStr.split(",")[0].trim().replace(":",""); |
| | | String endTime = timeStr.split(",")[1].trim().replace(":",""); |
| | | String now = TimeUtil.getGernalTime(System.currentTimeMillis(),"HHmmss"); |
| | | if(Integer.parseInt(now)<Integer.parseInt(startTime)||Integer.parseInt(now)>Integer.parseInt(endTime)){ |
| | | return JsonUtil.loadFalseResult(String.format("口令提交时间段为:%s-%s",timeStr.split(",")[0],timeStr.split(",")[1])); |
| | | } |
| | | // 验证提交的金额是否正确 |
| | | String moneyStr = systemConfigService.getValueCache(SystemConfigKeyEnum.PAY_MONEY_LIST); |
| | | if(StringUtil.isNullOrEmpty(moneyStr)){ |
| | | return JsonUtil.loadFalseResult("尚未配置金额"); |
| | | } |
| | | JSONArray array=JSONArray.fromObject(moneyStr); |
| | | Set<String> moneySet=new HashSet<>(); |
| | | for(int i=0;i<array.size();i++){ |
| | | moneySet.add(MoneyUtil.getMoneyStr(new BigDecimal(array.optString(i)))); |
| | | } |
| | | if(!moneySet.contains(MoneyUtil.getMoneyStr(new BigDecimal(keyInfo.getMoney())))){ |
| | | return JsonUtil.loadFalseResult("提交金额不符合要求"); |
| | | } |
| | | if (user == null) { |
| | | // 先保存KEY |
| | | // SESSION_KEY_TEMP_ALIPAY_KEY |
| | | session.setAttribute(Constant.SESSION_KEY_TEMP_ALIPAY_KEY, keyInfo); |
| | | wxLogger.info("微信没有授权:" + session.getId()); |
| | | String redictLink = systemConfigService.getValueCache(SystemConfigKeyEnum.WX_REDIRECT_LINK); |
| | | if (StringUtil.isNullOrEmpty(redictLink)) { |
| | | return JsonUtil.loadFalseResult("无法获取到授权链接"); |
| | | } |
| | | // 没有登录,返回登录链接 |
| | | JSONObject root = new JSONObject(); |
| | | root.put("link", redictLink); |
| | | return JsonUtil.loadTrueResult(Constant.RESULT_CODE_NEED_LOGIN, root); |
| | | } |
| | | wxLogger.info("微信有授权:" + session.getId()); |
| | | try { |
| | | addKey(keyInfo, user.getId()); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (KeyOrderException e) { |
| | | e.printStackTrace(); |
| | |
| | | WxUserInfo user = wxUserService.login(tokenInfo.getOpenid()); |
| | | session.setAttribute(Constant.SESSION_KEY_USER, user); |
| | | wxLogger.info("微信保存用户信息:{} id-{}", session.getId(), user.getId()); |
| | | String alipayKey = (String) session.getAttribute(Constant.SESSION_KEY_TEMP_ALIPAY_KEY); |
| | | wxLogger.info("从session读取到key:{}", alipayKey); |
| | | if (alipayKey != null) { |
| | | addKey(alipayKey, user.getId()); |
| | | SubmitKeyInfo alipayKeyInfo = (SubmitKeyInfo) session.getAttribute(Constant.SESSION_KEY_TEMP_ALIPAY_KEY); |
| | | wxLogger.info("从session读取到key:{}", alipayKeyInfo); |
| | | if (alipayKeyInfo != null) { |
| | | addKey(alipayKeyInfo, user.getId()); |
| | | } |
| | | response.sendRedirect(successLink); |
| | | return; |
| | |
| | | import com.google.gson.stream.JsonReader; |
| | | import com.google.gson.stream.JsonWriter; |
| | | import com.taoke.autopay.dao.KeyOrderMapper; |
| | | import com.taoke.autopay.dao.WxUserInfoMapper; |
| | | import com.taoke.autopay.entity.*; |
| | | import com.taoke.autopay.factory.OrderFactory; |
| | | import com.taoke.autopay.factory.WxUserFactory; |
| | | import com.taoke.autopay.service.AdminUserService; |
| | | import com.taoke.autopay.service.ClientInfoService; |
| | | import com.taoke.autopay.service.KeyOrderService; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import com.taoke.autopay.vo.AdminOrderVO; |
| | | import com.taoke.autopay.vo.WxUserVO; |
| | | import com.taoke.autopay.vo.admin.AdminOrderVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | |
| | | package com.taoke.autopay.controller.admin; |
| | | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.taoke.autopay.entity.SystemConfigKeyEnum; |
| | | import com.taoke.autopay.service.SystemConfigService; |
| | | import com.taoke.autopay.vo.admin.PayMoneySettingsVO; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.BigDecimalUtil; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import static java.math.BigDecimal.ROUND_FLOOR; |
| | | |
| | | @Controller |
| | | @RequestMapping("/admin/api/settings") |
| | |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("setPayMoneyAndTime") |
| | | public String setPayMoneyAndTime(String moneys, String startSubmitTime, String endSubmitTime) { |
| | | if(StringUtil.isNullOrEmpty(moneys)){ |
| | | return JsonUtil.loadFalseResult("未上传金额"); |
| | | } |
| | | if(StringUtil.isNullOrEmpty(startSubmitTime)){ |
| | | return JsonUtil.loadFalseResult("未上传开始时间"); |
| | | } |
| | | if(StringUtil.isNullOrEmpty(endSubmitTime)){ |
| | | return JsonUtil.loadFalseResult("未上传结束时间"); |
| | | } |
| | | JSONArray moneyArrays = JSONArray.fromObject(moneys); |
| | | JSONArray fa=new JSONArray(); |
| | | for(int i=0;i<moneyArrays.size();i++){ |
| | | // 统一保留2位小数 |
| | | double money = moneyArrays.optDouble(i); |
| | | fa.add(new BigDecimal(money).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | systemConfigService.setValue(SystemConfigKeyEnum.PAY_MONEY_LIST, fa.toString()); |
| | | // 设置时间,用逗号分隔 |
| | | systemConfigService.setValue(SystemConfigKeyEnum.KEY_SUBMIT_TIME_RANGE, startSubmitTime+","+endSubmitTime); |
| | | systemConfigService.clearCache(); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("getPayMoneyAndTime") |
| | | public String getPayMoneyAndTime() { |
| | | String value = systemConfigService.getValue(SystemConfigKeyEnum.PAY_MONEY_LIST); |
| | | PayMoneySettingsVO vo=new PayMoneySettingsVO(); |
| | | if(StringUtil.isNullOrEmpty(value)){ |
| | | vo.setMoneys(new ArrayList<>()); |
| | | }else{ |
| | | vo.setMoneys(JsonUtil.getSimpleGson().fromJson(value,new TypeToken<List<String>>(){}.getType() )); |
| | | } |
| | | // 设置时间,用逗号分隔 |
| | | value = systemConfigService.getValue(SystemConfigKeyEnum.KEY_SUBMIT_TIME_RANGE); |
| | | if(StringUtil.isNullOrEmpty(value)){ |
| | | vo.setStartSubmitTime(""); |
| | | vo.setEndSubmitTime(""); |
| | | }else{ |
| | | vo.setStartSubmitTime(value.split(",")[0]); |
| | | vo.setEndSubmitTime(value.split(",")[1]); |
| | | } |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(vo)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.taoke.autopay.exception.KeyOrderException; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | | import com.taoke.autopay.factory.OrderFactory; |
| | | import com.taoke.autopay.service.ClientInfoService; |
| | | import com.taoke.autopay.service.KeyOrderService; |
| | | import com.taoke.autopay.service.WxUserOrderCountService; |
| | | import com.taoke.autopay.service.WxUserSettingService; |
| | | import com.taoke.autopay.service.*; |
| | | import com.taoke.autopay.utils.JsonUtil; |
| | | import com.taoke.autopay.utils.MoneyUtil; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import com.taoke.autopay.utils.order.DYOrderApi; |
| | |
| | | |
| | | @Resource |
| | | private WxUserSettingService wxUserSettingService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("setOrderNoV2") |
| | | public String setOrderNoV2(AcceptData acceptData, String id, String orderNoDesc, String orderStatus, String money) { |
| | | loggerPay.info("setOrderNo: {}-{}-{}-{}", id, orderNoDesc, orderStatus, money); |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | return JsonUtil.loadFalseResult("请上传id"); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(money)) { |
| | | return JsonUtil.loadFalseResult("请上传money"); |
| | | } |
| | | |
| | | KeyOrder order = keyOrderService.selectById(id); |
| | | if (order == null) { |
| | | return JsonUtil.loadFalseResult("口令不存在"); |
| | | } |
| | | |
| | | try { |
| | | if (!StringUtil.isNullOrEmpty(orderStatus)) { |
| | | throw new KeyOrderException(orderStatus); |
| | | } |
| | | money = money.replace("¥",""); |
| | | // 匹配金额 |
| | | if(!MoneyUtil.getMoneyStr(order.getOrderMoney()).equalsIgnoreCase(money)){ |
| | | throw new KeyOrderException("金额不匹配"); |
| | | } |
| | | if (order.getUid() != null) { |
| | | WxUserOrderCount countInfo = wxUserOrderCountService.get(order.getUid(), OrderCountTypeEnum.DY_ORDER_PAY, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd")); |
| | | if (countInfo != null) { |
| | | WxUserSettings settings = wxUserSettingService.selectByUid(order.getUid()); |
| | | if (settings.getDyOrderCountPerDay() <= countInfo.getOrderCount()) { |
| | | throw new Exception("今日已达支付次数上限:" + settings.getDyOrderCountPerDay()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 设置进入 |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setOrderType(1); |
| | | orderUpdate.setExcutePayTime(new Date()); |
| | | keyOrderService.update(orderUpdate); |
| | | order = keyOrderService.selectById(id); |
| | | return JsonUtil.loadTrueResult(gson.toJson(OrderFactory.create(order))); |
| | | } catch (KeyOrderException e) { |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setOrderType(1); |
| | | orderUpdate.setOrderState(0); |
| | | orderUpdate.setState(KeyOrder.STATE_REJECT_PAY); |
| | | if (order.getExcutePayTime() == null) { |
| | | orderUpdate.setExcutePayTime(new Date()); |
| | | } |
| | | orderUpdate.setStateDesc(e.getMessage()); |
| | | keyOrderService.update(orderUpdate); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("setPayResult") |
| | | public String setPayResult(AcceptData acceptData, String id, boolean paySuccess, String msg) { |
| | | loggerPay.info("setPayResult: {}-{}", id, paySuccess); |
| | |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | private Date excutePayTime; |
| | | @Column(name = "pay_time") |
| | | private Date payTime; |
| | | @Column(name = "order_money") |
| | | private BigDecimal orderMoney; |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | public void setPayTime(Date payTime) { |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | public BigDecimal getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(BigDecimal orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | } |
| | |
| | | DY_ORDER_MAX_PAY_COUNT_DEFAULT("dy_order_pay_count_default","抖音订单最大默认付款次数"), |
| | | KS_ORDER_MAX_PAY_COUNT_DEFAULT("ks_order_pay_count_default","快手订单最大默认付款次数"), |
| | | ORDER_MAX_SUBMIT_COUNT_DEFAULT("order_submit_count_default","订单最大默认提交次数"), |
| | | |
| | | |
| | | KEY_SUBMIT_TIME_RANGE("order_key_submit_time_range","订单口令提交时间段"), |
| | | PAY_MONEY_LIST("pay_money_list","可支付金额列表") |
| | | ; |
| | | |
| | | |
| | |
| | | import com.taoke.autopay.utils.Constant; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import com.taoke.autopay.vo.AdminOrderVO; |
| | | import com.taoke.autopay.vo.admin.AdminOrderVO; |
| | | import com.taoke.autopay.vo.KeyOrderVO; |
| | | import com.taoke.autopay.vo.OrderFilter; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | import com.taoke.autopay.entity.KeyOrder; |
| | | import com.taoke.autopay.exception.KeyOrderException; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | | import com.taoke.autopay.vo.SubmitKeyInfo; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | * @date 19:19 2024/6/14 |
| | | * @param: key |
| | | **/ |
| | | public KeyOrder addKeyOrder(String key, Long uid,String day) throws KeyOrderException, WxOrderCountException; |
| | | public KeyOrder addKeyOrder(SubmitKeyInfo keyInfo, Long uid, String day) throws KeyOrderException, WxOrderCountException; |
| | | |
| | | /** |
| | | * @return void |
| | |
| | | import com.taoke.autopay.service.KeyOrderService; |
| | | import com.taoke.autopay.service.WxUserOrderCountService; |
| | | import com.taoke.autopay.service.WxUserSettingService; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import com.taoke.autopay.vo.SubmitKeyInfo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public KeyOrder addKeyOrder(String key, Long uid, String day) throws KeyOrderException, WxOrderCountException { |
| | | public KeyOrder addKeyOrder(SubmitKeyInfo keyInfo, Long uid, String day) throws KeyOrderException, WxOrderCountException { |
| | | // 判断提交次数是否过量 |
| | | if (uid != null) { |
| | | WxUserSettings settings = wxUserSettingService.selectByUid(uid); |
| | | wxUserOrderCountService.addOrderCount(uid, OrderCountTypeEnum.SUBMIT_TOKEN_COUNT, day, 1, settings.getTotalOrderCountPerDay()); |
| | | } |
| | | String id = OrderFactory.createId(key); |
| | | String id = OrderFactory.createId(keyInfo.getKey()); |
| | | KeyOrder order = keyOrderMapper.selectById(id); |
| | | if (order != null) { |
| | | throw new KeyOrderException("请勿重复提交口令"); |
| | | } |
| | | order = new KeyOrder(); |
| | | order.setId(id); |
| | | order.setKey(key); |
| | | order.setKey(keyInfo.getKey()); |
| | | if(!StringUtil.isNullOrEmpty(keyInfo.getMoney())){ |
| | | order.setOrderMoney(new BigDecimal(keyInfo.getMoney())); |
| | | } |
| | | order.setUid(uid); |
| | | order.setState(KeyOrder.STATE_NOT_PROCESS); |
| | | order.setStateDesc("尚未处理"); |
New file |
| | |
| | | package com.taoke.autopay.utils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: MoneyUtil |
| | | * @description: TODO |
| | | * @date 2024/7/8 23:29 |
| | | */ |
| | | public class MoneyUtil { |
| | | |
| | | public static String getMoneyStr(BigDecimal money) { |
| | | if(money==null){ |
| | | return ""; |
| | | } |
| | | return money.setScale(2, RoundingMode.HALF_UP).toString(); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.taoke.autopay.vo; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: SubmitKeyInfo |
| | | * @description: TODO |
| | | * @date 2024/7/9 0:03 |
| | | */ |
| | | public class SubmitKeyInfo implements Serializable { |
| | | |
| | | private String key; |
| | | private String money; |
| | | |
| | | public SubmitKeyInfo() { |
| | | } |
| | | |
| | | public SubmitKeyInfo(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
File was renamed from src/main/java/com/taoke/autopay/vo/AdminOrderVO.java |
| | |
| | | package com.taoke.autopay.vo; |
| | | package com.taoke.autopay.vo.admin; |
| | | |
| | | import com.taoke.autopay.entity.ClientInfo; |
| | | |
New file |
| | |
| | | package com.taoke.autopay.vo.admin; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: PayMoneySettingsVO |
| | | * @description: TODO |
| | | * @date 2024/7/8 22:35 |
| | | */ |
| | | public class PayMoneySettingsVO { |
| | | |
| | | private List<String> moneys; |
| | | private String startSubmitTime; |
| | | private String endSubmitTime; |
| | | |
| | | public List<String> getMoneys() { |
| | | return moneys; |
| | | } |
| | | |
| | | public void setMoneys(List<String> moneys) { |
| | | this.moneys = moneys; |
| | | } |
| | | |
| | | public String getStartSubmitTime() { |
| | | return startSubmitTime; |
| | | } |
| | | |
| | | public void setStartSubmitTime(String startSubmitTime) { |
| | | this.startSubmitTime = startSubmitTime; |
| | | } |
| | | |
| | | public String getEndSubmitTime() { |
| | | return endSubmitTime; |
| | | } |
| | | |
| | | public void setEndSubmitTime(String endSubmitTime) { |
| | | this.endSubmitTime = endSubmitTime; |
| | | } |
| | | } |
| | |
| | | <result column="distribute_client_uid" property="distributeClientUid" jdbcType="BIGINT"/> |
| | | <result column="distribute_time" property="distributeTime" jdbcType="TIMESTAMP"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="excute_pay_time" property="excutePayTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/> |
| | | <result column="order_money" property="orderMoney" jdbcType="DECIMAL"/> |
| | | </resultMap> |
| | | <resultMap id="DistributeResultMap" type="com.taoke.autopay.entity.OrderDistributeCountInfo"> |
| | | <result column="uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="count" property="count" jdbcType="INTEGER"/> |
| | | </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</sql> |
| | | <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</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> from table_order where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | |
| | | <if test="query.minCreateTime!=null">AND create_time >= #{query.minCreateTime}</if> |
| | | <if test="query.maxCreateTime!=null">AND #{query.maxCreateTime} > create_time</if> |
| | | <if test="query.minUpdateTime!=null">AND update_time >= #{query.minUpdateTime}</if> |
| | | <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} > update_time</if> |
| | | <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} > update_time</if> |
| | | </sql> |
| | | <select id="list" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> from table_order where 1=1 |
| | |
| | | <include refid="listWhereSQL"/> |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_order where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true" keyProperty="id">insert into table_order (id,uid,key,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,id,excute_pay_time,pay_time) values (#{id,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{orderType,jdbcType=INTEGER},#{orderNo,jdbcType=VARCHAR},#{orderState,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{distributeClientUid,jdbcType=BIGINT},#{distributeTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=VARCHAR},#{excutePayTime,jdbcType=TIMESTAMP},#{payTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true" keyProperty="id">insert into table_order (id,uid,key,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,id,excute_pay_time,pay_time,order_money) values (#{id,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{orderType,jdbcType=INTEGER},#{orderNo,jdbcType=VARCHAR},#{orderState,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{distributeClientUid,jdbcType=BIGINT},#{distributeTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=VARCHAR},#{excutePayTime,jdbcType=TIMESTAMP},#{payTime,jdbcType=TIMESTAMP},#{orderMoney,jdbcType=DECIMAL})</insert> |
| | | <insert id="insertSelective" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true" keyProperty="id">insert into table_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | |
| | | <if test="distributeClientUid != null">distribute_client_uid,</if> |
| | | <if test="distributeTime != null">distribute_time,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="excutePayTime != null">excute_pay_time,</if> |
| | | <if test="payTime != null">pay_time,</if> |
| | | <if test="payTime != null">pay_time,</if> |
| | | <if test="orderMoney != null">order_money,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=VARCHAR},</if> |
| | |
| | | <if test="distributeClientUid != null">#{distributeClientUid,jdbcType=BIGINT},</if> |
| | | <if test="distributeTime != null">#{distributeTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="excutePayTime != null">#{excutePayTime,jdbcType=TIMESTAMP}</if> |
| | | <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP}</if> |
| | | <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP}</if> |
| | | <if test="orderMoney != null">#{orderMoney,jdbcType=DECIMAL}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order set uid = #{uid,jdbcType=BIGINT},`key` = #{key,jdbcType=VARCHAR},order_type = #{orderType,jdbcType=INTEGER},order_no = #{orderNo,jdbcType=VARCHAR},order_state = #{orderState,jdbcType=INTEGER},state = #{state,jdbcType=INTEGER},state_desc = #{stateDesc,jdbcType=VARCHAR},distribute_client_uid = #{distributeClientUid,jdbcType=BIGINT},distribute_time = #{distributeTime,jdbcType=TIMESTAMP},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} ,excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=VARCHAR}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order set uid = #{uid,jdbcType=BIGINT},`key` = #{key,jdbcType=VARCHAR},order_type = #{orderType,jdbcType=INTEGER},order_no = #{orderNo,jdbcType=VARCHAR},order_state = #{orderState,jdbcType=INTEGER},state = #{state,jdbcType=INTEGER},state_desc = #{stateDesc,jdbcType=VARCHAR},distribute_client_uid = #{distributeClientUid,jdbcType=BIGINT},distribute_time = #{distributeTime,jdbcType=TIMESTAMP},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} ,excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP} ,order_money =#{orderMoney,jdbcType=DECIMAL}, where id = #{id,jdbcType=VARCHAR}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order |
| | | <set> |
| | | <if test="uid != null">uid=#{uid,jdbcType=BIGINT},</if> |
| | |
| | | <if test="distributeTime != null">distribute_time=#{distributeTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="excutePayTime !=null">excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="excutePayTime !=null">pay_time =#{payTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="excutePayTime !=null">excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="payTime !=null">pay_time =#{payTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderMoney !=null">order_money =#{orderMoney,jdbcType=DECIMAL},</if> |
| | | </set> where id = #{id,jdbcType=VARCHAR} |
| | | </update> |
| | | </update> |
| | | <select id="listDistributeUids" resultMap="DistributeResultMap" parameterType="java.util.Date">SELECT u.`id` as uid, IF( a.count IS NULL,0,a.count) AS `count` FROM `table_user` u LEFT JOIN (SELECT o.`distribute_client_uid` AS uid,COUNT(*) AS `count` FROM `table_order` o WHERE o.`state` = 0 GROUP BY o.`distribute_client_uid`) a ON a.uid = u.`id` WHERE rule=0 |
| | | <if test="minActiveTime!=null">and active_time >=#{minActiveTime}</if> |
| | | </select> |
| | | </select> |
| | | <select id="listNotDistributed" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> from table_order where distribute_client_uid is null and state=0 limit #{start},#{count} |
| | | </select> |
| | | </select> |
| | | <delete id="deleteAll" parameterType="java.util.Date">delete from table_order where #{maxCreateTime} >= create_time</delete> |
| | | </mapper> |
| | |
| | | <li class="layui-nav-item"> |
| | | <a href="javascript:;"><i class="iconfont"></i>系统设置</a> |
| | | <dl class="layui-nav-child"> |
| | | <dd><a href="javascript:;" data-url="pay_settings.html" data-id='5' data-text="付款金额设置"><span class="l-line"></span>付款金额设置</a></dd> |
| | | <dd><a href="javascript:;" data-url="settings_edit.html" data-id='4' data-text="默认参数设置"><span class="l-line"></span>默认参数设置</a></dd> |
| | | </dl> |
| | | </li> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> |
| | | <title>福利发放</title> |
| | | <link rel="stylesheet" type="text/css" href="layui/css/layui.css" /> |
| | | <script src="js/jquery.min.js"></script> |
| | | <script src="layui/layui.js"></script> |
| | | <style> |
| | | body{ |
| | | background: #FFF; |
| | | } |
| | | .container{ |
| | | display: flex; |
| | | align-items: center; |
| | | flex-direction: column; |
| | | } |
| | | .edit{ |
| | | border-radius: 1rem; |
| | | width: 80%; |
| | | margin-top: 3rem; |
| | | } |
| | | .money { |
| | | border-radius: 0.5rem; |
| | | width: 80%; |
| | | margin-top: 2rem; |
| | | } |
| | | |
| | | .btn{ |
| | | background-color: #FF2B4B; |
| | | border-radius: 0.5rem; |
| | | width: 80%; |
| | | margin-top: 2rem; |
| | | font-size: 1.2rem; |
| | | } |
| | | |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | | <div class="container"> |
| | | <img src="img/icon.png" style="width: 40%;margin-top: 1rem;"/> |
| | | |
| | | <textarea class="layui-textarea edit" placeholder="长按粘贴口令"></textarea> |
| | | |
| | | <input class="layui-input money" placeholder="请输入付款金额" /> |
| | | |
| | | <button class="layui-btn btn" >提交</button> |
| | | |
| | | </div> |
| | | |
| | | <script> |
| | | $(function(){ |
| | | function getQueryString(name) { |
| | | console.log(window.location.search) |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return unescape(decodeURI(r[2])); |
| | | return null; |
| | | } |
| | | var state = getQueryString("state"); |
| | | var msg = getQueryString("msg"); |
| | | if(state=="SUCCESS"){ |
| | | layer.msg("提交成功"); |
| | | }else if(state =="FAIL"){ |
| | | if(msg!=null&&msg!=undefined&&msg!=""){ |
| | | layer.msg(msg); |
| | | }else { |
| | | layer.msg("提交失败"); |
| | | } |
| | | } |
| | | |
| | | $(".btn").click(function(){ |
| | | var text = $(".edit").val(); |
| | | var money = $(".money").val(); |
| | | if (text.length <= 0) { |
| | | layer.msg("请输入口令"); |
| | | return; |
| | | } |
| | | const moneyRegex = /^\d+(\.\d{1,2})?$/; |
| | | if (!moneyRegex.test(money)) { |
| | | layer.msg("付款金额输入错误"); |
| | | return; |
| | | } |
| | | var index = layer.load(); |
| | | // 上传口令 |
| | | $.post("/webapi/submitKeyV3",{"key":text,"money": money},function(response){ |
| | | layer.close(index); |
| | | if(response.code==0){ |
| | | layer.msg("提交成功"); |
| | | $(".edit").val(""); |
| | | } else if(response.code==1001){ |
| | | window.location.replace(response.data.link); |
| | | }else{ |
| | | layer.msg(response.msg); |
| | | } |
| | | },'json').fail(function(jqXHR, textStatus, errorThrown){ |
| | | layer.close(index); |
| | | layer.msg("网络请求失败"); |
| | | }); |
| | | }); |
| | | |
| | | |
| | | }); |
| | | |
| | | </script> |
| | | |
| | | |
| | | </body> |
| | | </html> |