| | |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <!-- 设置为true,让热部署devtools生效 --> |
| | | <fork>true</fork> |
| | | <addResources>true</addResources> |
| | | </configuration> |
| | | |
| | | |
| | | </plugin> |
| | |
| | | } else { |
| | | dto.setPayDevice(""); |
| | | } |
| | | dto.setPayMerchant(order.getPayMerchant()); |
| | | dataList.add(dto); |
| | | } |
| | | |
New file |
| | |
| | | package com.taoke.autopay.controller.admin; |
| | | |
| | | import com.google.gson.*; |
| | | import com.taoke.autopay.dao.PayMoneySettingMapper; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.PayMoneySetting; |
| | | import com.taoke.autopay.entity.SystemConfigKeyEnum; |
| | | import com.taoke.autopay.exception.PayMoneySettingException; |
| | | import com.taoke.autopay.service.PayMoneySettingService; |
| | | 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.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | 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.Date; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("/admin/api/paymoneysetting") |
| | | public class AdminPayMoneySettingController { |
| | | |
| | | @Resource |
| | | private PayMoneySettingService payMoneySettingService; |
| | | |
| | | private Gson gson = new GsonBuilder() |
| | | .registerTypeAdapter(OrderChannelEnum.class, new JsonSerializer<OrderChannelEnum>() { |
| | | @Override |
| | | public JsonElement serialize(OrderChannelEnum value, Type theType, JsonSerializationContext context) { |
| | | if(value==null){ |
| | | return new JsonPrimitive(""); |
| | | } |
| | | if(value == OrderChannelEnum.unknown){ |
| | | return new JsonPrimitive("不限制"); |
| | | } |
| | | return new JsonPrimitive(value.getName()); |
| | | } |
| | | }).registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { |
| | | return value == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | }) |
| | | .create(); |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("list") |
| | | public String list(String key, int page, int limit) { |
| | | PayMoneySettingMapper.DaoQuery query = new PayMoneySettingMapper.DaoQuery(); |
| | | if (!StringUtil.isNullOrEmpty(key)) { |
| | | query.money = new BigDecimal(key).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | List<PayMoneySetting> list = payMoneySettingService.list(query, page, limit); |
| | | long count = payMoneySettingService.count(query); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | data.put("list", gson.toJson(list)); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("get") |
| | | public String get(Long id) { |
| | | PayMoneySetting setting = payMoneySettingService.selectByPrimaryKey(id); |
| | | if(setting==null){ |
| | | return JsonUtil.loadFalseResult("ID不存在"); |
| | | } |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(setting)); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("add") |
| | | public String add(PayMoneySetting setting) { |
| | | PayMoneySetting old = payMoneySettingService.getSettingByMoney(setting.getMoney()); |
| | | if(old!=null){ |
| | | return JsonUtil.loadFalseResult("金额已存在"); |
| | | } |
| | | try { |
| | | payMoneySettingService.addSetting(setting); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (PayMoneySettingException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("update") |
| | | public String update(PayMoneySetting setting) { |
| | | if(setting.getId()==null){ |
| | | return JsonUtil.loadFalseResult("ID不存在"); |
| | | } |
| | | payMoneySettingService.updateSelective(setting); |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(setting)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("delete") |
| | | public String delete(Long id) { |
| | | if(id==null){ |
| | | return JsonUtil.loadFalseResult("ID不存在"); |
| | | } |
| | | payMoneySettingService.deleteByPrimaryKey(id); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("setPayMoneyAndTime") |
| | | public String setPayMoneyAndTime(String moneys, String startSubmitTime, String endSubmitTime) { |
| | | if (StringUtil.isNullOrEmpty(moneys)) { |
| | | return JsonUtil.loadFalseResult("未上传金额"); |
| | | } |
| | | public String setPayMoneyAndTime(String startSubmitTime, String endSubmitTime) { |
| | | 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(); |
| | |
| | | @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); |
| | | String value = systemConfigService.getValue(SystemConfigKeyEnum.KEY_SUBMIT_TIME_RANGE); |
| | | if (StringUtil.isNullOrEmpty(value)) { |
| | | vo.setStartSubmitTime(""); |
| | | vo.setEndSubmitTime(""); |
| | |
| | | import com.taoke.autopay.service.*; |
| | | import com.taoke.autopay.utils.*; |
| | | import com.taoke.autopay.utils.order.DYOrderApi; |
| | | import com.taoke.autopay.utils.order.OrderChannelApiUtil; |
| | | import com.taoke.autopay.utils.order.OrderChannelUtil; |
| | | import com.taoke.autopay.vo.AcceptData; |
| | | import com.taoke.autopay.vo.KeyOrderVO; |
| | | import com.taoke.autopay.vo.OrderFilter; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | |
| | | |
| | | @Resource |
| | | private OrderPayFailProcessor orderPayFailProcessor; |
| | | |
| | | @Resource |
| | | private PayMoneySettingService payMoneySettingService; |
| | | |
| | | @Resource |
| | | private UserSettingService userSettingService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String 返回是否可以去支付 |
| | | * @author hxh |
| | | * @description 设置订单号 |
| | | * @date 23:08 2024/6/24 |
| | | * @param: acceptData |
| | | * @param: id 订单ID |
| | | * @param: orderNo 订单号 |
| | | * @param: orderStatus 订单状态:订单已取消/已支付 |
| | | **/ |
| | | @ResponseBody |
| | | @RequestMapping("setOrderNo") |
| | | public String setOrderNo(AcceptData acceptData, String id, String orderNo, String orderStatus) { |
| | | loggerPay.info("setOrderNo: {}-{}-{}", id, orderNo, orderStatus); |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | return JsonUtil.loadFalseResult("请上传id"); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(orderNo)) { |
| | | return JsonUtil.loadFalseResult("orderNo"); |
| | | } |
| | | |
| | | KeyOrder order = keyOrderService.selectById(id); |
| | | if (order == null) { |
| | | return JsonUtil.loadFalseResult("口令不存在"); |
| | | } |
| | | |
| | | try { |
| | | if (order.getOrderNo() != null && !order.getOrderNo().equalsIgnoreCase(orderNo)) { |
| | | throw new KeyOrderException("已经处理过,与之前处理的订单号不一致"); |
| | | } |
| | | } catch (KeyOrderException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | |
| | | try { |
| | | if (!StringUtil.isNullOrEmpty(orderStatus)) { |
| | | throw new KeyOrderException(orderStatus); |
| | | } |
| | | DYOrderDto dto = DYOrderApi.getOrderDetail(orderNo); |
| | | // dto.setOrder_status(1); |
| | | if (dto.getOrder_status() != DYOrderDto.ORDER_STATUS_NOT_PAY) { |
| | | // 订单不处于尚未付款状态 |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setOrderState(dto.getOrder_status()); |
| | | orderUpdate.setOrderType(1); |
| | | orderUpdate.setOrderNo(orderNo); |
| | | orderUpdate.setOrderChannel(dto.getOrderChannel()); |
| | | orderUpdate.setPayType(Constant.PAY_TYPE_WITH_ORDER_NO); |
| | | if (order.getState() == KeyOrder.STATE_NOT_PROCESS) { |
| | | if (dto.getOrder_status() == DYOrderDto.ORDER_STATUS_CANCELED) { |
| | | orderUpdate.setState(KeyOrder.STATE_PAY); |
| | | orderUpdate.setStateDesc(dto.getOrder_status_desc()); |
| | | } else { |
| | | orderUpdate.setState(KeyOrder.STATE_PAY); |
| | | orderUpdate.setStateDesc(dto.getOrder_status_desc()); |
| | | } |
| | | } |
| | | keyOrderService.update(orderUpdate); |
| | | if (dto.getOrder_status() == DYOrderDto.ORDER_STATUS_CANCELED) { |
| | | throw new Exception("订单已取消"); |
| | | } else { |
| | | throw new Exception("订单已支付"); |
| | | } |
| | | } |
| | | |
| | | if (order.getUid() != null) { |
| | | WxUserOrderCount countInfo = wxUserOrderCountService.get(order.getUid(), OrderCountTypeEnum.DY_ORDER_PAY, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); |
| | | if (countInfo != null) { |
| | | WxUserSettings settings = wxUserSettingService.getUserSettings(order.getUid()); |
| | | if (settings.getDyOrderCountPerDay() <= countInfo.getOrderCount()) { |
| | | throw new Exception("今日已达支付次数上限:" + settings.getDyOrderCountPerDay()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 设置进入 |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setOrderType(1); |
| | | orderUpdate.setOrderState(dto.getOrder_status()); |
| | | orderUpdate.setOrderNo(orderNo); |
| | | orderUpdate.setOrderChannel(dto.getOrderChannel()); |
| | | orderUpdate.setPayType(Constant.PAY_TYPE_WITH_ORDER_NO); |
| | | 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.setOrderNo(orderNo); |
| | | 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("setOrderNoV2") |
| | | public String setOrderNoV2(AcceptData acceptData, String id, String orderNoDesc, String orderStatus, String money) { |
| | |
| | | |
| | | DYOrderDto dyOrderDto =null; |
| | | try { |
| | | // 验证订单是否可以支付 |
| | | dyOrderDto = keyOrderService.verifyKey(orderNoDesc, orderStatus, money, null, null); |
| | | }catch(KeyVerifyException ve){ |
| | | throw new KeyOrderException("口令验证失败:" + ve.getMessage()); |
| | |
| | | orderNo = dyOrderDto.getOrder_id(); |
| | | } |
| | | |
| | | OrderChannelEnum orderChannel = null; |
| | | if (dyOrderDto != null) { |
| | | orderChannel =OrderChannelUtil.getChannelByKey(dyOrderDto.getOrderChannel()); |
| | | }else{ |
| | | orderChannel = OrderChannelEnum.unknown; |
| | | } |
| | | |
| | | // 验证渠道支付次数是否达到上限 |
| | | if (order.getUid() != null) { |
| | | OrderCountTypeEnum orderCountType=null; |
| | | switch (orderType){ |
| | | case Constant.ORDER_TYPE_DY: |
| | | orderCountType= OrderCountTypeEnum.DY_ORDER_PAY; |
| | | break; |
| | | case Constant.ORDER_TYPE_KS: |
| | | orderCountType= OrderCountTypeEnum.KS_ORDER_PAY; |
| | | break; |
| | | } |
| | | |
| | | WxUserOrderCount countInfo = wxUserOrderCountService.get(order.getUid(), orderCountType, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); |
| | | if (countInfo != null) { |
| | | WxUserSettings settings = wxUserSettingService.getUserSettings(order.getUid()); |
| | | int maxOrderCount = settings.getDyOrderCountPerDay(); |
| | | if(orderCountType == OrderCountTypeEnum.KS_ORDER_PAY){ |
| | | maxOrderCount = settings.getKsOrderCountPerDay(); |
| | | } |
| | | if (maxOrderCount <= countInfo.getOrderCount()) { |
| | | throw new Exception("老铁今日已达支付次数上限:" + settings.getDyOrderCountPerDay()); |
| | | } |
| | | long todayCount = wxUserOrderCountService.sum(order.getUid(), null,orderChannel, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); |
| | | long totalCount = wxUserOrderCountService.sum(order.getUid(), null,orderChannel,null); |
| | | int maxPayCount = userSettingService.getLimitCountByTotalCount(totalCount, orderChannel); |
| | | if(todayCount>=maxPayCount){ |
| | | throw new Exception( String.format("老铁今日已达支付次数(%s)上限:%s" ,orderChannel.getName(), maxPayCount)); |
| | | } |
| | | } |
| | | |
| | |
| | | orderUpdate.setExcutePayTime(new Date()); |
| | | keyOrderService.update(orderUpdate); |
| | | order = keyOrderService.selectById(id); |
| | | order.setPayType(orderUpdate.getPayType()); |
| | | return JsonUtil.loadTrueResult(gson.toJson(OrderFactory.create(order))); |
| | | } catch (KeyOrderException e) { |
| | | loggerPay.info(String.format("设置订单号出错:%s-%s", id, e.getMessage())); |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setOrderType(orderType); |
| | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("isMerchantCanPay") |
| | | public String isMerchantCanPay(AcceptData acceptData, String id, String merchant) { |
| | | loggerPay.info("isMerchantCanPay: {}-{}", id, merchant); |
| | | // 判断是否为卡金额 |
| | | KeyOrder keyOrder = keyOrderService.selectById(id); |
| | | if (keyOrder == null) { |
| | | return JsonUtil.loadFalseResult("订单ID不存在"); |
| | | } |
| | | OrderChannelEnum orderChannel = OrderChannelUtil.getChannelByKey(keyOrder.getOrderChannel()); |
| | | if (orderChannel != OrderChannelEnum.unknown) { |
| | | // 不是卡金额的订单可直接支付 |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | // 获取卡金额的设置信息 |
| | | PayMoneySetting payMoneySetting = payMoneySettingService.getSettingByMoney(keyOrder.getOrderMoney()); |
| | | if(payMoneySetting == null){ |
| | | return JsonUtil.loadFalseResult("该金额不属于卡金额范围"); |
| | | } |
| | | if(payMoneySetting.getVerifyMerchantChannel()==null||payMoneySetting.getVerifyMerchantChannel()==OrderChannelEnum.unknown){ |
| | | // 没有设置校验渠道 |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | try { |
| | | // 目前只判断超享佣 |
| | | boolean isCanPay = OrderChannelApiUtil.isMerchantCanPay(payMoneySetting.getVerifyMerchantChannel(), merchant); |
| | | if(isCanPay){ |
| | | return JsonUtil.loadTrueResult(""); |
| | | }else{ |
| | | return JsonUtil.loadFalseResult("商家校验未通过"); |
| | | } |
| | | } catch (UnsupportedEncodingException 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, msg); |
| | | public String setPayResult(AcceptData acceptData, String id, boolean paySuccess, String msg,String payMerchant) { |
| | | loggerPay.info("setPayResult: {}-{}-{}-{}", id, paySuccess, msg, payMerchant); |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | return JsonUtil.loadFalseResult("请上传id"); |
| | | } |
| | |
| | | if (order.getState() == KeyOrder.STATE_NOT_PROCESS) { |
| | | if (!paySuccess) { |
| | | // 支付失败 |
| | | if(msg!=null&&msg.contains("超时")) |
| | | { |
| | | if (msg != null && msg.contains("超时")) { |
| | | loggerPay.info(String.format("因为超时支付失败不处理:%s-%s", order.getId(), msg)); |
| | | orderPayFailProcessor.processPayFail(order.getId(), msg); |
| | | }else { |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setState(KeyOrder.STATE_NOT_PAY); |
| | | orderUpdate.setStateDesc("支付失败"); |
| | | orderUpdate.setStateDesc("支付失败:"+msg); |
| | | orderUpdate.setPayMerchant(payMerchant); |
| | | keyOrderService.update(orderUpdate); |
| | | } |
| | | loggerPay.info("处理支付失败完成"); |
| | | } else { |
| | | try { |
| | | keyOrderService.paySuccess(id, "支付成功", TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); |
| | | keyOrderService.paySuccess(id, "支付成功", TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT), payMerchant); |
| | | loggerPay.info("处理支付成功完成"); |
| | | } catch (WxOrderCountException e) { |
| | | loggerPay.error(e.getMessage()); |
| | |
| | | return JsonUtil.loadFalseResult("只有管理员才能删除"); |
| | | } |
| | | |
| | | // 删除24小时之前的数据 |
| | | // keyOrderService.deleteAll(new Date(System.currentTimeMillis() - 24*60*60*1000L)); |
| | | keyOrderService.deleteAll(new Date(System.currentTimeMillis())); |
| | | // 删除10天之前的数据 |
| | | keyOrderService.deleteAll(new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000L * 10)); |
| | | // keyOrderService.deleteAll(new Date(System.currentTimeMillis())); |
| | | // 刪除所有數據 |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
New file |
| | |
| | | package com.taoke.autopay.dao; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import java.util.Date; |
| | | import java.lang.Long; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import com.taoke.autopay.entity.PayMoneySetting; |
| | | import org.yeshi.utils.mybatis.BaseMapper; |
| | | |
| | | public interface PayMoneySettingMapper extends BaseMapper<PayMoneySetting> { |
| | | |
| | | PayMoneySetting selectByPrimaryKeyForUpdate(@Param("id") Long id); |
| | | |
| | | List<PayMoneySetting> list(@Param("query") DaoQuery query); |
| | | |
| | | long count(@Param("query") DaoQuery query); |
| | | |
| | | public static class DaoQuery{ |
| | | public Long id; |
| | | public BigDecimal money; |
| | | public OrderChannelEnum verifyMerchantChannel; |
| | | public Date minCreateTime; |
| | | public Date maxCreateTime; |
| | | public Date minUpdateTime; |
| | | public Date maxUpdateTime; |
| | | public long start; |
| | | public int count; |
| | | public List<String> sortList; |
| | | } |
| | | } |
| | |
| | | import java.lang.Long; |
| | | import java.util.List; |
| | | |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.taoke.autopay.entity.WxUserOrderCount; |
| | |
| | | public String day; |
| | | public Long uid; |
| | | public Integer orderCount; |
| | | public OrderChannelEnum orderChannel; |
| | | public Integer orderType; |
| | | public Date minCreateTime; |
| | | public Date maxCreateTime; |
| | |
| | | @Builder |
| | | public class UserSubmitKeyLimitDto { |
| | | private int totalCount; |
| | | private int perCount; |
| | | private int perCountCyx; |
| | | private int perCountBps; |
| | | private int perCountUnknown; |
| | | |
| | | } |
| | |
| | | package com.taoke.autopay.dto.admin; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.experimental.Tolerate; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | * @description: 订单excel输出 |
| | | * @date 2024/7/18 22:44 |
| | | */ |
| | | |
| | | @Data |
| | | @Builder |
| | | public class OrderExcelDataDto { |
| | | @Tolerate |
| | | public OrderExcelDataDto(){ |
| | | |
| | | } |
| | | |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | |
| | | private int totalCount; |
| | | @ExcelProperty("总金额") |
| | | private String totalMoney; |
| | | @ExcelProperty("商家名称") |
| | | private String payMerchant; |
| | | |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getPaySuccess() { |
| | | return paySuccess; |
| | | } |
| | | |
| | | public void setPaySuccess(String paySuccess) { |
| | | this.paySuccess = paySuccess; |
| | | } |
| | | |
| | | public String getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(String orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public String getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(String payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public String getOrderNo() { |
| | | return orderNo; |
| | | } |
| | | |
| | | public void setOrderNo(String orderNo) { |
| | | this.orderNo = orderNo; |
| | | } |
| | | |
| | | public String getOrderChannel() { |
| | | return orderChannel; |
| | | } |
| | | |
| | | public void setOrderChannel(String orderChannel) { |
| | | this.orderChannel = orderChannel; |
| | | } |
| | | |
| | | public int getTotalCount() { |
| | | return totalCount; |
| | | } |
| | | |
| | | public void setTotalCount(int totalCount) { |
| | | this.totalCount = totalCount; |
| | | } |
| | | |
| | | public String getTotalMoney() { |
| | | return totalMoney; |
| | | } |
| | | |
| | | public void setTotalMoney(String totalMoney) { |
| | | this.totalMoney = totalMoney; |
| | | } |
| | | |
| | | public String getPlatform() { |
| | | return platform; |
| | | } |
| | | |
| | | public void setPlatform(String platform) { |
| | | this.platform = platform; |
| | | } |
| | | |
| | | public String getStateDesc() { |
| | | return stateDesc; |
| | | } |
| | | |
| | | public void setStateDesc(String stateDesc) { |
| | | this.stateDesc = stateDesc; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public String getPayTime() { |
| | | return payTime; |
| | | } |
| | | |
| | | public void setPayTime(String payTime) { |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | public String getPayDevice() { |
| | | return payDevice; |
| | | } |
| | | |
| | | public void setPayDevice(String payDevice) { |
| | | this.payDevice = payDevice; |
| | | } |
| | | |
| | | public String getAgent() { |
| | | return agent; |
| | | } |
| | | |
| | | public void setAgent(String agent) { |
| | | this.agent = agent; |
| | | } |
| | | } |
| | |
| | | @Column(name = "agent_id") |
| | | private Long agentId; |
| | | |
| | | @Column(name = "pay_merchant") |
| | | private String payMerchant; |
| | | |
| | | private WxUserInfo user; |
| | | } |
New file |
| | |
| | | package com.taoke.autopay.entity; |
| | | |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.experimental.Tolerate; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: PayMoneySetting |
| | | * @description: 可支付金额设置 |
| | | * @date 2024/9/15 9:43 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @Table("table_pay_money_setting") |
| | | public class PayMoneySetting { |
| | | |
| | | @Tolerate |
| | | public PayMoneySetting(){ |
| | | |
| | | } |
| | | |
| | | @Column(name = "_id") |
| | | private Long id; |
| | | /** |
| | | * 卡的金额 |
| | | */ |
| | | @Column(name = "_money") |
| | | private BigDecimal money; |
| | | /** |
| | | * 商家校验渠道 |
| | | */ |
| | | @Column(name = "_verify_merchant_channel") |
| | | private OrderChannelEnum verifyMerchantChannel; |
| | | @Column(name = "_create_time") |
| | | private Date createTime; |
| | | @Column(name = "_update_time") |
| | | private Date updateTime; |
| | | |
| | | |
| | | } |
| | |
| | | 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", "可支付金额列表"), |
| | | ALIPAY_KEY_VERIFY("alipay_key_verify_state", "是否需要提前验证支付宝口令"), |
| | | AGENT_SUBMIT_KEY_LINK("agent_submit_key_link", "代理口令提交链接"), |
| | | AGENT_ADMIN_LINK("agent_admin_link", "代理后台管理链接"), |
| | |
| | | package com.taoke.autopay.entity; |
| | | |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.experimental.Tolerate; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | |
| | | * @date 2024/6/28 17:08 |
| | | */ |
| | | @Table("table_wx_user_order_count") |
| | | @Data |
| | | @Builder |
| | | public class WxUserOrderCount { |
| | | @Tolerate |
| | | public WxUserOrderCount(){ |
| | | |
| | | } |
| | | @Id |
| | | @Column(name = "id") |
| | | private String id; |
| | |
| | | private Integer orderCount; |
| | | @Column(name = "order_type") |
| | | private Integer orderType; |
| | | @Column(name = "order_channel") |
| | | private OrderChannelEnum orderChannel; |
| | | @Column(name = "create_time") |
| | | private Date createTime; |
| | | @Column(name = "update_time") |
| | | private Date updateTime; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Integer getOrderCount() { |
| | | return orderCount; |
| | | } |
| | | |
| | | public void setOrderCount(Integer orderCount) { |
| | | this.orderCount = orderCount; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.taoke.autopay.exception; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: LoginException |
| | | * @description: 支付金额设置异常 |
| | | * @date 2024/6/14 18:46 |
| | | */ |
| | | public class PayMoneySettingException extends Exception{ |
| | | |
| | | public PayMoneySettingException(String msg){ |
| | | super(msg); |
| | | } |
| | | |
| | | } |
| | |
| | | vo.setState(KeyOrderVO.STATE_PROCESSED); |
| | | break; |
| | | } |
| | | vo.setPayType(order.getPayType()); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | vo.setUid(order.getUid()); |
| | | OrderChannelEnum orderChannel=OrderChannelUtil.getChannelByKey(order.getOrderChannel()); |
| | | vo.setOrderChannel(orderChannel==null?"未知":orderChannel.getName()); |
| | | vo.setPayMerchant(order.getPayMerchant()); |
| | | if(agent!=null){ |
| | | vo.setAgent(agent.getName()); |
| | | }else{ |
| | |
| | | } |
| | | |
| | | public static String createId(WxUserOrderCount orderCountInfo) { |
| | | return String.format("%s-%s-%s", orderCountInfo.getDay(), orderCountInfo.getUid(), orderCountInfo.getOrderType()); |
| | | return String.format("%s-%s-%s-%s", orderCountInfo.getDay(), orderCountInfo.getUid(), orderCountInfo.getOrderType(),orderCountInfo.getOrderChannel()==null?"": orderCountInfo.getOrderChannel().name()); |
| | | } |
| | | |
| | | |
| | |
| | | * @param: day |
| | | * @return void |
| | | **/ |
| | | public void paySuccess(String id, String stateDesc,String day) throws WxOrderCountException ; |
| | | public void paySuccess(String id, String stateDesc,String day,String payMerchant) throws WxOrderCountException ; |
| | | |
| | | |
| | | /** |
New file |
| | |
| | | package com.taoke.autopay.service; |
| | | |
| | | import com.taoke.autopay.dao.PayMoneySettingMapper; |
| | | import com.taoke.autopay.entity.PayMoneySetting; |
| | | import com.taoke.autopay.exception.PayMoneySettingException; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: PayMoneySettingService |
| | | * @description: 支付金额设置 |
| | | * @date 2024/9/15 9:52 |
| | | */ |
| | | public interface PayMoneySettingService { |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 添加设置 |
| | | * @date 9:53 2024/9/15 |
| | | * @param: setting |
| | | * @return void |
| | | **/ |
| | | public void addSetting(PayMoneySetting setting) throws PayMoneySettingException; |
| | | |
| | | |
| | | public PayMoneySetting selectByPrimaryKey(Long id); |
| | | |
| | | public void updateSelective(PayMoneySetting setting); |
| | | |
| | | public void deleteByPrimaryKey(Long id); |
| | | |
| | | |
| | | public List<PayMoneySetting> list(PayMoneySettingMapper.DaoQuery query,int page,int pageSize); |
| | | |
| | | |
| | | public long count(PayMoneySettingMapper.DaoQuery query); |
| | | |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 根据金额查找 |
| | | * @date 9:57 2024/9/15 |
| | | * @param: money |
| | | * @return com.taoke.autopay.entity.PayMoneySetting |
| | | **/ |
| | | public PayMoneySetting getSettingByMoney(BigDecimal money); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 查询所有的资金金额s |
| | | * @date 10:02 2024/9/15 |
| | | * @return java.util.List<java.lang.String> |
| | | **/ |
| | | public Set<String> listAllMoneyAsStr(); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.taoke.autopay.service; |
| | | |
| | | import com.taoke.autopay.dto.UserSubmitKeyLimitDto; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param: totalCount |
| | | * @return int |
| | | **/ |
| | | public int getLimitCountByTotalCount(int totalCount); |
| | | public int getLimitCountByTotalCount(long totalCount, OrderChannelEnum orderChannel); |
| | | |
| | | } |
| | |
| | | package com.taoke.autopay.service; |
| | | |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.OrderCountTypeEnum; |
| | | import com.taoke.autopay.entity.WxUserOrderCount; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | |
| | | * @date 2024/6/28 19:17 |
| | | */ |
| | | public interface WxUserOrderCountService { |
| | | public void addOrderCount(Long uid, OrderCountTypeEnum orderType, String day, int count, Integer maxCount) throws WxOrderCountException; |
| | | public void addOrderCount(Long uid, OrderCountTypeEnum orderType,OrderChannelEnum orderChannel, String day, int count, Integer maxCount) throws WxOrderCountException; |
| | | |
| | | public void isOrderCountLimit(Long uid, OrderCountTypeEnum orderType, String day, int count, Integer maxCount) throws WxOrderCountException; |
| | | public void isOrderCountLimit(Long uid, OrderCountTypeEnum orderType, OrderChannelEnum orderChannel, String day, int count, Integer maxCount) throws WxOrderCountException; |
| | | |
| | | public WxUserOrderCount get(Long uid, OrderCountTypeEnum orderType, String day); |
| | | public WxUserOrderCount get(Long uid, OrderCountTypeEnum orderType,OrderChannelEnum orderChannel, String day); |
| | | |
| | | |
| | | public long sum(Long uid, OrderCountTypeEnum orderType,OrderChannelEnum orderChannel,String day); |
| | | } |
| | |
| | | import com.taoke.autopay.dto.DYOrderDto; |
| | | import com.taoke.autopay.entity.*; |
| | | import com.taoke.autopay.entity.agent.ChannelAgent; |
| | | import com.taoke.autopay.entity.agent.ChannelAgentSettings; |
| | | import com.taoke.autopay.exception.KeyOrderException; |
| | | import com.taoke.autopay.exception.KeyVerifyException; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | | import com.taoke.autopay.factory.OrderFactory; |
| | | import com.taoke.autopay.service.*; |
| | | import com.taoke.autopay.service.agent.ChannelAgentService; |
| | | import com.taoke.autopay.service.agent.ChannelAgentSettingService; |
| | | import com.taoke.autopay.service.agent.ChannelAgentSharingRatioService; |
| | | import com.taoke.autopay.utils.*; |
| | | import com.taoke.autopay.utils.order.DYOrderApi; |
| | | import com.taoke.autopay.utils.order.OrderChannelUtil; |
| | | import com.taoke.autopay.vo.SubmitKeyInfo; |
| | | import net.sf.json.JSONArray; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ChannelAgentSharingRatioService channelAgentSharingRatioService; |
| | | |
| | | @Resource |
| | | private ChannelAgentSettingService channelAgentSettingService; |
| | | |
| | | @Resource |
| | | private ClientInfoService clientInfoService; |
| | | |
| | | @Resource |
| | | private PayMoneySettingService payMoneySettingService; |
| | | |
| | | |
| | | @Override |
| | |
| | | if (uid != null) { |
| | | WxUserSettings settings = wxUserSettingService.getUserSettings(uid); |
| | | OrderCountTypeEnum countType = OrderCountTypeEnum.SUBMIT_TOKEN_COUNT; |
| | | wxUserOrderCountService.addOrderCount(uid, countType, day, 1, settings.getTotalOrderCountPerDay()); |
| | | wxUserOrderCountService.addOrderCount(uid, countType,null, day, 1, settings.getTotalOrderCountPerDay()); |
| | | } |
| | | String id = OrderFactory.createId(keyInfo.getKey()); |
| | | KeyOrder order = keyOrderMapper.selectById(id); |
| | |
| | | if (agent.getStatus() != ChannelAgent.STATUS_NOMAL) { |
| | | throw new KeyOrderException("渠道受限"); |
| | | } |
| | | // 验证渠道时间 |
| | | ChannelAgentSettings settings = channelAgentSettingService.selectByAgentId(agent.getId()); |
| | | if(settings!=null&&!StringUtil.isNullOrEmpty(settings.getStartSubmitTime())&&!StringUtil.isNullOrEmpty(settings.getEndSubmitTime())){ |
| | | String now = TimeUtil.getGernalTime(System.currentTimeMillis(), "HHmmss"); |
| | | String startTime = settings.getStartSubmitTime().replace(":",""); |
| | | String endTime = settings.getEndSubmitTime().replace(":",""); |
| | | if (Integer.parseInt(now) < Integer.parseInt(startTime) || Integer.parseInt(now) > Integer.parseInt(endTime)) { |
| | | throw new KeyOrderException(String.format("口令提交时间段为:%s-%s",settings.getStartSubmitTime(), settings.getEndSubmitTime())); |
| | | } |
| | | } |
| | | |
| | | order.setAgentId(agent.getId()); |
| | | } |
| | | } |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void paySuccess(String id, String stateDesc, String day) throws WxOrderCountException { |
| | | public void paySuccess(String id, String stateDesc, String day,String payMerchant) throws WxOrderCountException { |
| | | KeyOrder old = keyOrderMapper.selectByPrimaryKeyForUpdate(id); |
| | | if (old == null) { |
| | | return; |
| | |
| | | } |
| | | if (old.getUid() != null) { |
| | | Integer orderType = old.getOrderType(); |
| | | wxUserOrderCountService.addOrderCount(old.getUid(), (orderType==null||orderType==Constant.ORDER_TYPE_DY)? OrderCountTypeEnum.DY_ORDER_PAY:OrderCountTypeEnum.KS_ORDER_PAY, day, 1, null); |
| | | wxUserOrderCountService.addOrderCount(old.getUid(), (orderType==null||orderType==Constant.ORDER_TYPE_DY)? OrderCountTypeEnum.DY_ORDER_PAY:OrderCountTypeEnum.KS_ORDER_PAY, OrderChannelUtil.getChannelByKey( old.getOrderChannel()), day, 1, null); |
| | | } |
| | | KeyOrder orderUpdate = new KeyOrder(); |
| | | orderUpdate.setId(id); |
| | | orderUpdate.setState(KeyOrder.STATE_PAY); |
| | | orderUpdate.setStateDesc(stateDesc); |
| | | orderUpdate.setPayMerchant(payMerchant); |
| | | if (old.getPayTime() == null) { |
| | | orderUpdate.setPayTime(new Date()); |
| | | } |
| | |
| | | @Override |
| | | public List<ChannelOrderStatistic> statisticChannelOrders(Long agentId, Date startTime, Date endTime) { |
| | | KeyOrderMapper.DaoQuery daoQuery = new KeyOrderMapper.DaoQuery(); |
| | | daoQuery.oMinCreateTime = startTime; |
| | | daoQuery.oMaxCreateTime = endTime; |
| | | daoQuery.minCreateTime = startTime; |
| | | daoQuery.maxCreateTime = endTime; |
| | | daoQuery.agentId = agentId; |
| | | daoQuery.state = KeyOrder.STATE_PAY; |
| | | daoQuery.hasPayTime = true; |
| | | // 将数据拉出来 |
| | | long count = keyOrderMapper.count(daoQuery); |
| | | daoQuery.count = (int)count; |
| | | List<KeyOrder> orderList = keyOrderMapper.list(daoQuery); |
| | | Map<String,Set<Long>> uidsMap = new HashMap<>(); |
| | | Map<String,Integer> countMap = new HashMap<>(); |
| | | Map<String,BigDecimal> moneyMap = new HashMap<>(); |
| | | |
| | | return keyOrderMapper.statisticChannelOrders(daoQuery); |
| | | Set<String> orderIds=new HashSet<>(); |
| | | for(KeyOrder order:orderList){ |
| | | String orderId=order.getOrderType()+"#"+ order.getOrderNo(); |
| | | if(!StringUtil.isNullOrEmpty(order.getOrderNo())){ |
| | | if(orderIds.contains(orderId)){ |
| | | continue; |
| | | } |
| | | orderIds.add(orderId); |
| | | } |
| | | String orderChannel = order.getOrderChannel(); |
| | | |
| | | if(!uidsMap.containsKey(orderChannel)){ |
| | | uidsMap.put(orderChannel, new HashSet<>()); |
| | | } |
| | | uidsMap.get(orderChannel).add(order.getUid()); |
| | | |
| | | if(!countMap.containsKey(orderChannel)){ |
| | | countMap.put(orderChannel,0); |
| | | } |
| | | countMap.put(orderChannel, countMap.get(orderChannel)+1); |
| | | |
| | | |
| | | if(!moneyMap.containsKey(orderChannel)){ |
| | | moneyMap.put(orderChannel, new BigDecimal(0)); |
| | | } |
| | | moneyMap.put(orderChannel, moneyMap.get(orderChannel).add(order.getOrderMoney())); |
| | | } |
| | | |
| | | List<ChannelOrderStatistic> results=new ArrayList<>(); |
| | | for(String orderChannel: moneyMap.keySet()){ |
| | | ChannelOrderStatistic statistic=new ChannelOrderStatistic(); |
| | | statistic.setCount(countMap.get(orderChannel)); |
| | | statistic.setMoney(moneyMap.get(orderChannel)); |
| | | statistic.setUserCount(uidsMap.get(orderChannel).size()); |
| | | statistic.setOrderChannel(orderChannel); |
| | | results.add(statistic); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Long getCanDistributeUid(int maxQueueSize) { |
| | | // 最近1小时有活跃,且不算12以上未执行的数据 |
| | | List<OrderDistributeCountInfo> list = keyOrderMapper.listDistributeUids(new Date(System.currentTimeMillis() - 1000 * 60 * 60L), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 12L)); |
| | | List<OrderDistributeCountInfo> list = keyOrderMapper.listDistributeUids(new Date(System.currentTimeMillis() - 1000 * 60 * 31L), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 12L)); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | |
| | | maxCount = settings.getKsOrderCountPerDay(); |
| | | break; |
| | | } |
| | | |
| | | try { |
| | | wxUserOrderCountService.isOrderCountLimit(uid, orderCountType, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT), 1, maxCount); |
| | | } catch (WxOrderCountException e) { |
| | | e.printStackTrace(); |
| | | throw new KeyVerifyException(KeyVerifyException.CODE_COMMON, "今日提交超过" +maxCount + "次"); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } catch (KeyOrderException e) { |
| | | // 抖音订单未验证通过,匹配金额 |
| | | // 验证提交的金额是否正确 |
| | | String moneyStr = systemConfigService.getValueCache(SystemConfigKeyEnum.PAY_MONEY_LIST); |
| | | if (StringUtil.isNullOrEmpty(moneyStr)) { |
| | | throw new KeyVerifyException(KeyVerifyException.CODE_KEY_MONEY_NOT_MATCH, "尚未配置金额"); |
| | | } |
| | | 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)))); |
| | | } |
| | | Set<String> moneySet =payMoneySettingService.listAllMoneyAsStr(); |
| | | // 匹配金额 |
| | | if (!moneySet.contains(money)) { |
| | | throw new KeyVerifyException(KeyVerifyException.CODE_KEY_MONEY_NOT_MATCH, String.format("金额未在系统设置中:%s", money)); |
New file |
| | |
| | | package com.taoke.autopay.service.impl; |
| | | |
| | | import com.taoke.autopay.dao.PayMoneySettingMapper; |
| | | import com.taoke.autopay.entity.PayMoneySetting; |
| | | import com.taoke.autopay.exception.PayMoneySettingException; |
| | | import com.taoke.autopay.service.PayMoneySettingService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: PayMoneySettingServiceImpl |
| | | * @description: |
| | | * @date 2024/9/15 9:52 |
| | | */ |
| | | @Service |
| | | public class PayMoneySettingServiceImpl implements PayMoneySettingService { |
| | | |
| | | @Resource |
| | | private PayMoneySettingMapper payMoneySettingMapper; |
| | | |
| | | @Override |
| | | public void addSetting(PayMoneySetting setting) throws PayMoneySettingException { |
| | | if (setting.getMoney() == null) { |
| | | throw new PayMoneySettingException("金额为空"); |
| | | } |
| | | |
| | | PayMoneySetting oldSetting = getSettingByMoney(setting.getMoney()); |
| | | if (oldSetting != null) { |
| | | setting.setId(oldSetting.getId()); |
| | | setting.setUpdateTime(new Date()); |
| | | payMoneySettingMapper.updateByPrimaryKeySelective(setting); |
| | | } else { |
| | | if (setting.getCreateTime() == null) { |
| | | setting.setCreateTime(new Date()); |
| | | } |
| | | payMoneySettingMapper.insertSelective(setting); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PayMoneySetting selectByPrimaryKey(Long id) { |
| | | return payMoneySettingMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public void updateSelective(PayMoneySetting setting) { |
| | | if (setting.getUpdateTime() == null) { |
| | | setting.setUpdateTime(new Date()); |
| | | } |
| | | payMoneySettingMapper.updateByPrimaryKeySelective(setting); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByPrimaryKey(Long id) { |
| | | payMoneySettingMapper.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<PayMoneySetting> list(PayMoneySettingMapper.DaoQuery query, int page, int pageSize) { |
| | | query.start = (page - 1) * pageSize; |
| | | query.count = pageSize; |
| | | return payMoneySettingMapper.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public long count(PayMoneySettingMapper.DaoQuery query) { |
| | | return payMoneySettingMapper.count(query); |
| | | } |
| | | |
| | | @Override |
| | | public PayMoneySetting getSettingByMoney(BigDecimal money) { |
| | | PayMoneySettingMapper.DaoQuery daoQuery = new PayMoneySettingMapper.DaoQuery(); |
| | | daoQuery.money = money; |
| | | daoQuery.count = 1; |
| | | List<PayMoneySetting> list = payMoneySettingMapper.list(daoQuery); |
| | | if (list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Set<String> listAllMoneyAsStr() { |
| | | List<PayMoneySetting> list = list(new PayMoneySettingMapper.DaoQuery(), 1, Integer.MAX_VALUE); |
| | | Set<String> sets = new HashSet<>(); |
| | | for (PayMoneySetting s : list) { |
| | | sets.add(s.getMoney().setScale(2, RoundingMode.HALF_UP).toString()); |
| | | } |
| | | return sets; |
| | | } |
| | | } |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.taoke.autopay.dto.UserSubmitKeyLimitDto; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.SystemConfigKeyEnum; |
| | | import com.taoke.autopay.service.SystemConfigService; |
| | | import com.taoke.autopay.service.UserSettingService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int getLimitCountByTotalCount(int totalCount) { |
| | | public int getLimitCountByTotalCount(long totalCount, OrderChannelEnum orderChannel) { |
| | | List<UserSubmitKeyLimitDto> list = getUserSubmitKeyCountList(true); |
| | | if (list.size() == 0) { |
| | | return Integer.MAX_VALUE; |
| | | } |
| | | for (UserSubmitKeyLimitDto t : list) { |
| | | if (totalCount >= t.getTotalCount()) { |
| | | return t.getPerCount(); |
| | | if(orderChannel==OrderChannelEnum.cyx){ |
| | | return t.getPerCountCyx(); |
| | | } |
| | | else if(orderChannel==OrderChannelEnum.bps){ |
| | | return t.getPerCountBps(); |
| | | } |
| | | else if(orderChannel==OrderChannelEnum.unknown){ |
| | | return t.getPerCountUnknown(); |
| | | } |
| | | return Integer.MAX_VALUE; |
| | | } |
| | | } |
| | | return Integer.MAX_VALUE; |
| | |
| | | |
| | | import com.taoke.autopay.dao.KeyOrderMapper; |
| | | import com.taoke.autopay.dao.WxUserOrderCountMapper; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.OrderCountTypeEnum; |
| | | import com.taoke.autopay.entity.WxUserOrderCount; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void addOrderCount(Long uid, OrderCountTypeEnum orderType, String day, int count, Integer maxCount) throws WxOrderCountException { |
| | | public void addOrderCount(Long uid, OrderCountTypeEnum orderType, OrderChannelEnum orderChannel, String day, int count, Integer maxCount) throws WxOrderCountException { |
| | | // 统计用户总次数 |
| | | WxUserOrderCountMapper.DaoQuery daoQuery=new WxUserOrderCountMapper.DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | if(orderType!=null) { |
| | | daoQuery.orderType=orderType.getType(); |
| | | } |
| | | daoQuery.orderChannel = orderChannel; |
| | | Long totalCount = wxUserOrderCountMapper.sumOrderCount(daoQuery); |
| | | if(totalCount==null){ |
| | | totalCount = 0L; |
| | |
| | | if(totalCount>Integer.MAX_VALUE){ |
| | | totalCount = (long)Integer.MAX_VALUE; |
| | | } |
| | | int submitCount = userSettingService.getLimitCountByTotalCount((int)totalCount.longValue()); |
| | | int submitCount = userSettingService.getLimitCountByTotalCount((int)totalCount.longValue(), orderChannel); |
| | | if(maxCount==null){ |
| | | maxCount =Integer.MAX_VALUE; |
| | | } |
| | | maxCount = Math.min(submitCount, maxCount); |
| | | WxUserOrderCount info = new WxUserOrderCount(); |
| | | info.setDay(day); |
| | | if(orderType!=null) { |
| | | info.setOrderType(orderType.getType()); |
| | | } |
| | | info.setUid(uid); |
| | | info.setOrderChannel(orderChannel); |
| | | info.setId(OrderFactory.createId(info)); |
| | | // 判断是否存在 |
| | | WxUserOrderCount old = wxUserOrderCountMapper.selectByPrimaryKeyForUpdate(info.getId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void isOrderCountLimit(Long uid, OrderCountTypeEnum orderType, String day, int count, Integer maxCount) throws WxOrderCountException{ |
| | | public void isOrderCountLimit(Long uid, OrderCountTypeEnum orderType,OrderChannelEnum orderChannel, String day, int count, Integer maxCount) throws WxOrderCountException{ |
| | | |
| | | WxUserOrderCountMapper.DaoQuery daoQuery=new WxUserOrderCountMapper.DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | if(orderType!=null) { |
| | | daoQuery.orderType=orderType.getType(); |
| | | } |
| | | daoQuery.orderChannel = orderChannel; |
| | | Long totalCount = wxUserOrderCountMapper.sumOrderCount(daoQuery); |
| | | if(totalCount==null){ |
| | | totalCount = 0L; |
| | |
| | | if(totalCount>Integer.MAX_VALUE){ |
| | | totalCount = (long)Integer.MAX_VALUE; |
| | | } |
| | | int submitCount = userSettingService.getLimitCountByTotalCount((int)totalCount.longValue()); |
| | | int submitCount = userSettingService.getLimitCountByTotalCount((int)totalCount.longValue(),orderChannel); |
| | | if(maxCount==null){ |
| | | maxCount =Integer.MAX_VALUE; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public WxUserOrderCount get(Long uid, OrderCountTypeEnum orderType, String day) { |
| | | public WxUserOrderCount get(Long uid, OrderCountTypeEnum orderType,OrderChannelEnum orderChannel, String day) { |
| | | WxUserOrderCountMapper.DaoQuery daoQuery = new WxUserOrderCountMapper.DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | daoQuery.day = day; |
| | | if(orderType!=null) { |
| | | daoQuery.orderType = orderType.getType(); |
| | | } |
| | | daoQuery.orderChannel = orderChannel; |
| | | List<WxUserOrderCount> list = wxUserOrderCountMapper.list(daoQuery); |
| | | if (list.size() > 0) { |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public long sum(Long uid, OrderCountTypeEnum orderType, OrderChannelEnum orderChannel,String day) { |
| | | WxUserOrderCountMapper.DaoQuery daoQuery=new WxUserOrderCountMapper.DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | if(orderType!=null) { |
| | | daoQuery.orderType = orderType.getType(); |
| | | } |
| | | daoQuery.orderChannel = orderChannel; |
| | | daoQuery.day = day; |
| | | Long totalCount = wxUserOrderCountMapper.sumOrderCount(daoQuery); |
| | | if(totalCount==null){ |
| | | return 0; |
| | | } |
| | | return totalCount; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | private static String requestByOrderNo2(String orderNo) { |
| | | String url = String.format("https://api.bpshe.com/mall/douyinOMS/getSubsidyOrderInfo?orderId=%s", orderNo); |
| | | String url = String.format("https://api.bpshe.com/mall/douyinOMS/getSubsidyOrderInfo?appKey=cdaef330f1324961a73e15a85ab67fd2&orderId=%s", orderNo); |
| | | Map<String,String> headers=new HashMap<>(); |
| | | headers.put("Accept","application/json;charset=utf-8"); |
| | | String result = HttpUtil.get(url, headers); |
| | |
| | | String result = requestByOrderNo1(orderNo); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | if (root.optInt("code") != 1000) { |
| | | logger.error(String.format("抖音订单查询出错(1):%s - %s",orderNo, result)); |
| | | logger.error(String.format("抖音订单查询出错(超享佣):%s - %s",orderNo, result)); |
| | | throw new KeyOrderException(root.optString("message")); |
| | | } |
| | | JSONObject data = root.optJSONObject("data"); |
| | |
| | | |
| | | private static DYOrderDto getOrderDetail2(String orderNo) throws KeyOrderException { |
| | | String result = requestByOrderNo2(orderNo); |
| | | logger.info(String.format("爆品社接口%s:%s", orderNo, result)); |
| | | System.out.println(result); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | if (root.optInt("errCode") != 0) { |
| | | logger.error(String.format("抖音订单查询出错(2):%s - %s",orderNo, result)); |
| | | logger.error(String.format("抖音订单查询出错(爆品社):%s - %s",orderNo, result)); |
| | | throw new KeyOrderException(root.optString("errMsg")); |
| | | } |
| | | JSONObject data = root.optJSONObject("data"); |
| | |
| | | logger.error(String.format("抖音订单查询无数据(2):%s - %s",orderNo, result)); |
| | | throw new KeyOrderException("订单查询无数据"); |
| | | } |
| | | if(!data.optBoolean("subsidyFullyCoversOrder")){ |
| | | throw new KeyOrderException("不满足支付条件"); |
| | | } |
| | | |
| | | |
| | | JSONObject orderDetailData = data.optJSONObject("orderDetail"); |
| | | JSONArray subsidyDetailData = data.optJSONArray("subsidyDetail"); |
| | | if(orderDetailData==null||subsidyDetailData==null){ |
| | | logger.error(String.format("订单与补贴无数据(2):%s - %s",orderNo, result)); |
| | | throw new KeyOrderException("订单与补贴无数据"); |
| | | |
| | | if(orderDetailData==null){ |
| | | logger.error(String.format("订单无数据(2):%s - %s",orderNo, result)); |
| | | throw new KeyOrderException("订单无数据"); |
| | | } |
| | | orderDetailData = orderDetailData.optJSONObject("shop_order_detail"); |
| | | DYOrderDto dyOrder = gson.fromJson(orderDetailData.toString(),DYOrderDto.class); |
| | | List<DYSubsidyDto> subsidyList = gson.fromJson(subsidyDetailData.toString(), new TypeToken<List<DYSubsidyDto>>(){}.getType()); |
| | | if(subsidyList.size()!=dyOrder.getSku_order_list().size()){ |
| | | throw new KeyOrderException("订单商品与补贴商品不相等"); |
| | | } |
| | | Map<String, DYSkuOrderDto> skuMap=new HashMap<>(); |
| | | for(DYSkuOrderDto d: dyOrder.getSku_order_list()){ |
| | | skuMap.put(d.getProduct_id()+"", d); |
| | | } |
| | | for(DYSubsidyDto d:subsidyList){ |
| | | if(skuMap.get(d.getGoodsId())==null){ |
| | | throw new KeyOrderException("补贴商品没在订单商品中"); |
| | | } |
| | | if(skuMap.get(d.getGoodsId()).getPay_amount()> d.getSubsidyAmount()){ |
| | | throw new KeyOrderException("订单商品金额高于补贴金额"); |
| | | } |
| | | if(!d.getStatus().equalsIgnoreCase("online")){ |
| | | throw new KeyOrderException("补贴下线"); |
| | | } |
| | | } |
| | | dyOrder.setOrderChannel(Constant.ORDER_CHANNEL_BPS); |
| | | return dyOrder; |
| | | } |
| | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | // DYOrderDto dto = (DYOrderApi.getOrderDetail("6932591080266339994")); |
| | | DYOrderDto result = getOrderDetail("6932676890890213137"); |
| | | System.out.println(result); |
| | | // DYOrderDto result = getOrderDetail("6933551928932504940"); |
| | | // System.out.println(result); |
| | | System.out.println(getOrderDetail("6934328696568616274")); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.taoke.autopay.utils.order; |
| | | |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.utils.HttpUtil; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: OrderChannelApiUtil |
| | | * @description: |
| | | * @date 2024/9/14 17:07 |
| | | */ |
| | | public class OrderChannelApiUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger("dyorderApiLogger"); |
| | | |
| | | /** |
| | | * @return boolean |
| | | * @author hxh |
| | | * @description 获取渠道商家是否可以付款 |
| | | * @date 17:10 2024/9/14 |
| | | * @param: channel |
| | | * @param: orderChannelName |
| | | **/ |
| | | public static boolean isMerchantCanPay(OrderChannelEnum channel, String merchant) throws UnsupportedEncodingException { |
| | | if (channel == OrderChannelEnum.cyx) { |
| | | String url = String.format("https://api.youihuo.com/open/free.checkKsCompanyName?bsName=%s&apiKey=%s", URLEncoder.encode(merchant, "UTF-8"), OrderChannelUtil.CYX_API_KEY); |
| | | String result = HttpUtil.get(url); |
| | | logger.info(String.format("超佣享商家付款判断:%s-%s", merchant, result)); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | System.out.println(result); |
| | | if(root.optInt("code") == 1000){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static void main(String[] args) throws UnsupportedEncodingException { |
| | | |
| | | System.out.print( isMerchantCanPay(OrderChannelEnum.cyx,"广州市天河区长兴街安尔雅服饰商行1")); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | /** |
| | | * @author hxh |
| | | * @title: OrderChannelUtil |
| | | * @description: TODO |
| | | * @description: |
| | | * @date 2024/7/31 0:20 |
| | | */ |
| | | public class OrderChannelUtil { |
| | | public final static String CYX_API_KEY = "sTIFFTyunIFZfp5i4V6g19PN9biudl4v"; |
| | | public final static String BPS_API_KEY = "cdaef330f1324961a73e15a85ab67fd2"; |
| | | |
| | | |
| | | public static OrderChannelEnum getChannelByKey(String key) { |
| | | |
| | | for (OrderChannelEnum channel : OrderChannelEnum.values()) { |
| | |
| | | package com.taoke.autopay.vo; |
| | | |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.experimental.Tolerate; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Builder |
| | | public class KeyOrderVO { |
| | | public final static int STATE_NOT_PROCESS = 0; |
| | | public final static int STATE_PROCESSED = 1; |
| | | public final static int STATE_PROCESS_ERROR = 2; |
| | | |
| | | @Tolerate |
| | | public KeyOrderVO(){ |
| | | |
| | | } |
| | | |
| | | private String id; |
| | | private String key; |
| | | private int state; |
| | | private Integer payType; |
| | | private Date createTime; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(int state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | package com.taoke.autopay.vo.admin; |
| | | |
| | | import com.taoke.autopay.entity.ClientInfo; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.experimental.Tolerate; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | * @description: 后台订单信息 |
| | | * @date 2024/6/29 19:49 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | public class AdminOrderVO { |
| | | |
| | | @Tolerate |
| | | public AdminOrderVO(){ |
| | | |
| | | } |
| | | |
| | | private String id; |
| | | private Long uid; |
| | | private String key; |
| | |
| | | private Date payTime; |
| | | private String agent; |
| | | private String orderChannel; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(int state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getStateDesc() { |
| | | return stateDesc; |
| | | } |
| | | |
| | | public void setStateDesc(String stateDesc) { |
| | | this.stateDesc = stateDesc; |
| | | } |
| | | |
| | | public String getOrderStateDesc() { |
| | | return orderStateDesc; |
| | | } |
| | | |
| | | public void setOrderStateDesc(String orderStateDesc) { |
| | | this.orderStateDesc = orderStateDesc; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public String getOrderNo() { |
| | | return orderNo; |
| | | } |
| | | |
| | | public void setOrderNo(String orderNo) { |
| | | this.orderNo = orderNo; |
| | | } |
| | | |
| | | public ClientInfo getDistributedClientInfo() { |
| | | return distributedClientInfo; |
| | | } |
| | | |
| | | public void setDistributedClientInfo(ClientInfo distributedClientInfo) { |
| | | this.distributedClientInfo = distributedClientInfo; |
| | | } |
| | | |
| | | public Date getDistributedTime() { |
| | | return distributedTime; |
| | | } |
| | | |
| | | public void setDistributedTime(Date distributedTime) { |
| | | this.distributedTime = distributedTime; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getExcutePayTime() { |
| | | return excutePayTime; |
| | | } |
| | | |
| | | public void setExcutePayTime(Date excutePayTime) { |
| | | this.excutePayTime = excutePayTime; |
| | | } |
| | | |
| | | public Date getPayTime() { |
| | | return payTime; |
| | | } |
| | | |
| | | public void setPayTime(Date payTime) { |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | public String getAgent() { |
| | | return agent; |
| | | } |
| | | |
| | | public void setAgent(String agent) { |
| | | this.agent = agent; |
| | | } |
| | | |
| | | public String getOrderChannel() { |
| | | return orderChannel; |
| | | } |
| | | |
| | | public void setOrderChannel(String orderChannel) { |
| | | this.orderChannel = orderChannel; |
| | | } |
| | | private String payMerchant; |
| | | } |
| | |
| | | # username: root |
| | | # password: Yeshi2016@ |
| | | |
| | | url: jdbc:mysql://47.121.122.141:3306/taoke_autopay?serverTimezone=GMT%2B8 |
| | | username: taoke_autopay |
| | | password: xcp123123 |
| | | url: jdbc:mysql://rm-f8z0j143g151fp995no.mysql.rds.aliyuncs.com:3306/taoke_autopay?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8 |
| | | username: root |
| | | password: xcp123123@ |
| | | |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | |
| | | # username: root |
| | | # password: Yeshi2016@ |
| | | # XCP |
| | | url: jdbc:mysql://127.0.0.1:3306/taoke_autopay?serverTimezone=GMT%2B8 |
| | | username: taoke_autopay |
| | | password: xcp123123 |
| | | url: jdbc:mysql://rm-f8z0j143g151fp995.mysql.rds.aliyuncs.com:3306/taoke_autopay?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8 |
| | | username: root |
| | | password: xcp123123@ |
| | | |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | active: pro |
| | |
| | | <result column="order_channel" property="orderChannel" jdbcType="VARCHAR"/> |
| | | <result column="pay_type" property="payType" jdbcType="INTEGER"/> |
| | | <result column="agent_id" property="agentId" jdbcType="BIGINT"/> |
| | | <result column="pay_merchant" property="payMerchant" 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</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</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> |
| | | from table_order where id = #{id,jdbcType=BIGINT} |
| | |
| | | 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, |
| | | order_channel, pay_type, agent_id) |
| | | order_channel, pay_type, agent_id,pay_merchant) |
| | | values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=BIGINT}, #{key,jdbcType=VARCHAR}, |
| | | #{orderType,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, |
| | | #{orderState,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, |
| | |
| | | #{updateTime,jdbcType=TIMESTAMP}, #{id,jdbcType=VARCHAR}, |
| | | #{excutePayTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, |
| | | #{orderMoney,jdbcType=DECIMAL}, #{orderChannel,jdbcType=VARCHAR}, |
| | | #{payType,jdbcType=INTEGER}, #{agentId,jdbcType=BIGINT})</insert> |
| | | #{payType,jdbcType=INTEGER}, #{agentId,jdbcType=BIGINT},#{payMerchant, jdbcType=VARCHAR})</insert> |
| | | <insert id="insertSelective" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true" |
| | | keyProperty="id">insert into table_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="orderChannel != null">order_channel,</if> |
| | | <if test="payType != null">pay_type,</if> |
| | | <if test="agentId != null">agent_id,</if> |
| | | <if test="payMerchant!=null">pay_merchant,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="orderChannel != null">#{orderChannel,jdbcType=VARCHAR},</if> |
| | | <if test="payType != null">#{payType,jdbcType=INTEGER},</if> |
| | | <if test="agentId != null">#{agentId,jdbcType=BIGINT},</if> |
| | | <if test="payMerchant != null">#{payMerchant,jdbcType=VARCHAR},</if> |
| | | |
| | | |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order |
| | |
| | | order_channel =#{orderChannel,jdbcType=VARCHAR}, |
| | | pay_type =#{payType,jdbcType=INTEGER}, |
| | | agent_id =#{agentId,jdbcType=BIGINT}, |
| | | pay_merchant =#{payMerchant,jdbcType=VARCHAR}, |
| | | |
| | | where id = #{id,jdbcType=VARCHAR}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order |
| | | <set> |
| | |
| | | <if test="orderChannel !=null">order_channel =#{orderChannel,jdbcType=VARCHAR},</if> |
| | | <if test="payType !=null">pay_type =#{payType,jdbcType=INTEGER},</if> |
| | | <if test="agentId !=null">agent_id =#{agentId,jdbcType=BIGINT},</if> |
| | | <if test="payMerchant !=null">pay_merchant =#{payMerchant,jdbcType=VARCHAR},</if> |
| | | |
| | | </set> |
| | | where id = #{id,jdbcType=VARCHAR} |
| | | </update> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.taoke.autopay.dao.PayMoneySettingMapper"> |
| | | <resultMap id="BaseResultMap" type="com.taoke.autopay.entity.PayMoneySetting"> |
| | | <id column="_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="_money" property="money" jdbcType="DECIMAL"/> |
| | | <result column="_verify_merchant_channel" property="verifyMerchantChannel" jdbcType="VARCHAR"/> |
| | | <result column="_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">_id,_money,_verify_merchant_channel,_create_time,_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> from table_pay_money_setting where _id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> from table_pay_money_setting where _id = #{id,jdbcType=BIGINT} for update |
| | | </select> |
| | | <sql id="listWhereSQL"> |
| | | <if test="query.id!=null">AND _id = #{query.id}</if> |
| | | <if test="query.money!=null">AND _money = #{query.money}</if> |
| | | <if test="query.verifyMerchantChannel!=null">AND _verify_merchant_channel = #{query.verifyMerchantChannel}</if> |
| | | <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> |
| | | </sql> |
| | | <select id="list" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> from table_pay_money_setting where 1=1 |
| | | <include refid="listWhereSQL"/> |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" item="item" open=" order by " separator=",">#{item}</foreach> |
| | | </if>limit #{query.start},#{query.count} |
| | | </select> |
| | | <select id="count" resultType="java.lang.Long">select count(*) from table_pay_money_setting where 1=1 |
| | | <include refid="listWhereSQL"/> |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_pay_money_setting where _id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.taoke.autopay.entity.PayMoneySetting" useGeneratedKeys="true" keyProperty="id">insert into table_pay_money_setting (_id,_money,_verify_merchant_channel,_create_time,_update_time) values (#{id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{verifyMerchantChannel,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.taoke.autopay.entity.PayMoneySetting" useGeneratedKeys="true" keyProperty="id">insert into table_pay_money_setting |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">_id,</if> |
| | | <if test="money != null">_money,</if> |
| | | <if test="verifyMerchantChannel != null">_verify_merchant_channel,</if> |
| | | <if test="createTime != null">_create_time,</if> |
| | | <if test="updateTime != null">_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="verifyMerchantChannel != null">#{verifyMerchantChannel,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.PayMoneySetting">update table_pay_money_setting set _money = #{money,jdbcType=DECIMAL},_verify_merchant_channel = #{verifyMerchantChannel,jdbcType=VARCHAR},_create_time = #{createTime,jdbcType=TIMESTAMP},_update_time = #{updateTime,jdbcType=TIMESTAMP} where _id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.PayMoneySetting">update table_pay_money_setting |
| | | <set> |
| | | <if test="money != null">_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="verifyMerchantChannel != null">_verify_merchant_channel=#{verifyMerchantChannel,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where _id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | <result column="order_type" property="orderType" jdbcType="VARCHAR"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="order_channel" property="orderChannel" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,day,uid,order_count,order_type,create_time,update_time</sql> |
| | | <sql id="Base_Column_List">id,day,uid,order_count,order_type,create_time,update_time,order_channel</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> from table_wx_user_order_count where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | |
| | | <if test="query.uid!=null">AND uid = #{query.uid}</if> |
| | | <if test="query.orderCount!=null">AND order_count = #{query.orderCount}</if> |
| | | <if test="query.orderType!=null">AND order_type = #{query.orderType}</if> |
| | | <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.orderChannel!=null">AND order_channel = #{query.orderChannel}</if> |
| | | <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> |
| | | </sql> |
| | | <select id="list" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> from table_wx_user_order_count where 1=1 |
| | |
| | | <select id="count" resultType="java.lang.Long">select count(*) from table_wx_user_order_count where 1=1 |
| | | <include refid="listWhereSQL"/> |
| | | </select> |
| | | |
| | | <select id="sumOrderCount" resultType="java.lang.Long">select sum(order_count) from table_wx_user_order_count where 1=1 |
| | | <include refid="listWhereSQL"/> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_wx_user_order_count where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.taoke.autopay.entity.WxUserOrderCount" useGeneratedKeys="true" keyProperty="id">insert into table_wx_user_order_count (id,day,uid,order_count,order_type,create_time,update_time) values (#{id,jdbcType=VARCHAR},#{day,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{orderCount,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.taoke.autopay.entity.WxUserOrderCount" useGeneratedKeys="true" keyProperty="id">insert into table_wx_user_order_count (id,day,uid,order_count,order_type,create_time,update_time,order_channel) values (#{id,jdbcType=VARCHAR},#{day,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{orderCount,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderChannel,jdbcType=VARCHAR})</insert> |
| | | <insert id="insertSelective" parameterType="com.taoke.autopay.entity.WxUserOrderCount" useGeneratedKeys="true" keyProperty="id">insert into table_wx_user_order_count |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | |
| | | <if test="orderType != null">order_type,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="orderChannel != null">order_channel,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=VARCHAR},</if> |
| | |
| | | <if test="orderType != null">#{orderType,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderChannel != null">#{orderChannel,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.WxUserOrderCount">update table_wx_user_order_count set day = #{day,jdbcType=VARCHAR},uid = #{uid,jdbcType=BIGINT},order_count = #{orderCount,jdbcType=VARCHAR},order_type = #{orderType,jdbcType=VARCHAR},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=VARCHAR}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.WxUserOrderCount">update table_wx_user_order_count set day = #{day,jdbcType=VARCHAR},uid = #{uid,jdbcType=BIGINT},order_count = #{orderCount,jdbcType=VARCHAR},order_type = #{orderType,jdbcType=VARCHAR},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} ,order_channel =#{orderChannel,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.WxUserOrderCount">update table_wx_user_order_count |
| | | <set> |
| | | <if test="day != null">day=#{day,jdbcType=VARCHAR},</if> |
| | |
| | | <if test="orderType != null">order_type=#{orderType,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderChannel !=null">order_channel =#{orderChannel,jdbcType=VARCHAR},</if> |
| | | </set> where id = #{id,jdbcType=VARCHAR} |
| | | </update> |
| | | </mapper> |
| | |
| | | <div class="layui-inline"> |
| | | <input type="text" name="key" id="key" placeholder="按渠道ID/名称搜索" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search"><i class="layui-icon layui-icon-search"></i>搜索</button> |
| | | <a href="javascript:void();" class="layui-btn layui-btn-warm" onclick="add_agent()"><i class="layui-icon layui-icon-add-circle"></i> 创建代理</a> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | | <table class="layui-table" lay-even lay-skin="nob" id="table"> |
| | |
| | | <div class="layui-inline"> |
| | | <input type="text" name="day" placeholder="日期" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search"><i |
| | | class="layui-icon layui-icon-search"></i>搜索</button> |
| | | <a href="javascript:void();" class="layui-btn layui-btn-warm" onclick="start_settle()"><i |
| | |
| | | <i class="layui-icon"></i>上传结算确认单 |
| | | </a> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | | <table class="layui-table" lay-even lay-skin="nob" id="table"> |
| | |
| | | <option value="4">已驳回</option> |
| | | </select> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search"><i |
| | | class="layui-icon layui-icon-search"></i>搜索</button> |
| | | <a href="javascript:void();" class="layui-btn layui-disabled" onclick="passWidthdraw()" id="pass"> 通过</a> |
| | | <a href="javascript:void();" class="layui-btn layui-btn-danger layui-disabled" onclick="rejectWidthdraw()" id="reject"> 驳回</a> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | | <table class="layui-table" lay-even lay-skin="nob" id="table" lay-filter="table"> |
| | |
| | | .layui-input-block { |
| | | margin-left: 80px; |
| | | } |
| | | |
| | | } |
| | |
| | | <input type="text" name="account" id="account" placeholder="按登录账号搜索" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search"><i class="layui-icon layui-icon-search"></i>搜索</button> |
| | | <a href="javascript:void();" class="layui-btn layui-btn-warm" onclick="showCreateClient()"><i class="layui-icon layui-icon-add-circle"></i> 添加设备</a> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | | <table class="layui-table" lay-even lay-skin="nob" id="table"> |
| | |
| | | <a href="javascript:;"><i class="iconfont"></i>系统设置</a> |
| | | <dl class="layui-nav-child"> |
| | | <dd><a href="javascript:;" data-url="pay_settings.html" data-id='40' data-text="付款金额设置"><span class="l-line"></span>付款金额设置</a></dd> |
| | | <dd><a href="javascript:;" data-url="pay_money_list.html" data-id='49' data-text="付款金额设置(新)"><span class="l-line"></span>付款金额设置(新)</a></dd> |
| | | <dd><a href="javascript:;" data-url="settings_edit.html" data-id='41' data-text="默认参数设置"><span class="l-line"></span>默认参数设置</a></dd> |
| | | <dd><a href="javascript:;" data-url="user-actioncount-limit.html" data-id='42' data-text="限制代付单数"><span class="l-line"></span>限制代付单数</a></dd> |
| | | <dd><a href="javascript:;" data-url="settings_timeout_device.html" data-id='43' data-text="重新支付设备"><span class="l-line"></span>重新支付设备</a></dd> |
| | |
| | | <div class="layui-inline"> |
| | | <input type="text" name="endDate" placeholder="结束日期" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search">搜索</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-xs" lay-submit lay-filter="download" |
| | | id="download">下载</button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | |
| | | } |
| | | }, |
| | | { |
| | | field: 'key', |
| | | title: '口令', |
| | | width: 150, |
| | | templet: '<textarea readonly>{{d.key}}</textarea>' |
| | | }, |
| | | { |
| | | field: 'payMerchant', |
| | | title: '商家', |
| | | width: 150 |
| | | }, |
| | | { |
| | | field: 'distributedTime', |
| | | title: '支付设备分配时间', |
| | | width: 170, |
| | |
| | | title: '支付成功时间', |
| | | width: 170, |
| | | }, |
| | | { |
| | | field: 'key', |
| | | title: '口令', |
| | | width: 150, |
| | | templet: '<textarea readonly>{{d.key}}</textarea>' |
| | | }, |
| | | |
| | | { |
| | | field: '', |
| | | title: '操作', |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <meta name="viewport" content="width=device-width,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" /> |
| | | <style> |
| | | body { |
| | | padding: 10px; |
| | | } |
| | | |
| | | #sure{ |
| | | visibility: hidden; |
| | | } |
| | | |
| | | .layui-form-label { |
| | | width: 200px; |
| | | } |
| | | |
| | | .layui-input-block { |
| | | margin-left: 240px; |
| | | max-width: 500px; |
| | | } |
| | | |
| | | .layui-input-block input { |
| | | max-width: 150px; |
| | | } |
| | | |
| | | .small { |
| | | max-width: 75px !important; |
| | | } |
| | | |
| | | .share-ratio { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .share-ratio .layui-form-label { |
| | | width: 50px; |
| | | padding-left: 0; |
| | | font-size: 12px; |
| | | text-align: left; |
| | | } |
| | | |
| | | .share-ratio input { |
| | | width: 60px; |
| | | margin-right: 10px; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | |
| | | <form class="layui-form" lay-filter="edit"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">金额:</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="money" required lay-verify="required|money" placeholder="金额" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">商家验证渠道:</label> |
| | | <div class="layui-input-inline"> |
| | | <select name ="verifyMerchantChannel"> |
| | | <option value = "unknown">无需验证</option> |
| | | <option value = "cyx">超佣享</option> |
| | | <option value = "bps">爆品社</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-input-block"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="sure" id="sure">确定</button> |
| | | </div> |
| | | </form> |
| | | <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http_api.js"></script> |
| | | <script> |
| | | var listener; |
| | | |
| | | function submit(callback) { |
| | | //暂存回调方法 |
| | | listener = callback; |
| | | //表单提交按钮 |
| | | $("#sure").click(); |
| | | } |
| | | |
| | | layui.use(['form', 'layedit', 'laydate', 'laytpl'], function() { |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | laydate = layui.laydate, |
| | | laytpl = layui.laytpl; |
| | | //自定义验证规则 |
| | | form.verify({ |
| | | money: [/^\d+(\.\d{1,2})?$/, "金额最多保留2位小数"] |
| | | }); |
| | | //监听提交 |
| | | form.on('submit(sure)', function(data) { |
| | | listener(data.field); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,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" /> |
| | | <link rel="stylesheet" type="text/css" href="./css/admin.css" /> |
| | | <style> |
| | | |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div class="page-content-wrap"> |
| | | <form class="layui-form" action="" lay-filter='search'> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | |
| | | <input type="text" name="key" id="key" placeholder="金额" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search"><i |
| | | class="layui-icon layui-icon-search"></i>搜索</button> |
| | | <a href="javascript:void();" class="layui-btn layui-btn-warm" onclick="add_money()"><i |
| | | class="layui-icon layui-icon-add-circle"></i> 添加金额</a> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | | <table class="layui-table" lay-even lay-skin="nob" id="table"> |
| | | |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http_api.js"></script> |
| | | <!-- <script src="js/common.js" type="text/javascript" charset="utf-8"></script> --> |
| | | <script> |
| | | function add_money() { |
| | | var layerIndex = layer.open({ |
| | | title: "添加卡金额", |
| | | type: 2, |
| | | area: ['500px', '350px'], |
| | | shade: 0.3, |
| | | shadeClose: false, //默认开启遮罩关闭 |
| | | resize: false, //默认重设大小是否 |
| | | //如果不让iframe出现滚动条, |
| | | //可以content: ['http://sentsin.com', 'no'] |
| | | content: 'pay_money_add.html', |
| | | btn: ['确定', '取消'], |
| | | yes: function(index) { |
| | | //submit方法为弹框内容中的方法 |
| | | window["layui-layer-iframe" + index].submit(function(res) { |
| | | if (res.verifyMerchantChannel.length == 0) { |
| | | delete res.verifyMerchantChannel; |
| | | } |
| | | console.log(res); |
| | | try { |
| | | var index = layer.load(1); |
| | | $.post("/admin/api/paymoneysetting/add", res, function(response) { |
| | | layer.close(index); |
| | | if (response.code == 0) { |
| | | layer.close(layerIndex); |
| | | layer.msg("添加成功"); |
| | | } else { |
| | | layer.msg(response.msg); |
| | | } |
| | | }, 'json').fail(function(jqXHR, textStatus, errorThrown) { |
| | | layer.close(index); |
| | | layer.msg("网络请求失败"); |
| | | }); |
| | | } catch (e) { |
| | | console.log(e); |
| | | } |
| | | }); |
| | | }, |
| | | cancel: function() {} |
| | | }); |
| | | } |
| | | |
| | | |
| | | function update_money(id) { |
| | | var layerIndex = layer.open({ |
| | | title: "修改卡金额设置", |
| | | type: 2, |
| | | area: ['500px', '350px'], |
| | | shade: 0.3, |
| | | shadeClose: false, //默认开启遮罩关闭 |
| | | resize: false, //默认重设大小是否 |
| | | //如果不让iframe出现滚动条, |
| | | //可以content: ['http://sentsin.com', 'no'] |
| | | content: 'pay_money_update.html?id=' + id, |
| | | btn: ['确定', '取消'], |
| | | yes: function(index) { |
| | | //submit方法为弹框内容中的方法 |
| | | window["layui-layer-iframe" + index].submit(function(res) { |
| | | console.log(res); |
| | | try { |
| | | var index = layer.load(1); |
| | | $.post("/admin/api/paymoneysetting/update", res, function(response) { |
| | | layer.close(index); |
| | | if (response.code == 0) { |
| | | layer.close(layerIndex); |
| | | layer.msg("更改成功"); |
| | | $("#search").click(); |
| | | } else { |
| | | layer.msg(response.msg); |
| | | } |
| | | }, 'json').fail(function(jqXHR, textStatus, errorThrown) { |
| | | layer.close(index); |
| | | layer.msg("网络请求失败"); |
| | | }); |
| | | } catch (e) { |
| | | console.log(e); |
| | | } |
| | | }); |
| | | }, |
| | | cancel: function() {} |
| | | }); |
| | | } |
| | | |
| | | function delete_money(id) { |
| | | $.post("/admin/api/paymoneysetting/delete", { |
| | | id: id |
| | | }, function(response) { |
| | | if (response.code == 0) { |
| | | layer.msg("删除成功"); |
| | | $("#search").click(); |
| | | |
| | | } else { |
| | | layer.msg(response.msg); |
| | | } |
| | | }, 'json').fail(function(jqXHR, textStatus, errorThrown) { |
| | | layer.msg("网络请求失败"); |
| | | }); |
| | | } |
| | | |
| | | layui.use(['form', 'jquery', 'layer', 'table', 'laydate'], function() { |
| | | var table = layui.table; |
| | | var form = layui.form; |
| | | var $ = layui.jquery; |
| | | var laydate = layui.laydate; |
| | | |
| | | |
| | | let table_option = { |
| | | elem: '#table', |
| | | url: '/admin/api/paymoneysetting/list', //数据接口 |
| | | where: { |
| | | 'key': $("#key").val() |
| | | }, |
| | | parseData: function(res) { //res 即为原始返回的数据 |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | } |
| | | }, |
| | | page: true, //开启分页 |
| | | cols: [ |
| | | [ //表头 |
| | | { |
| | | field: 'id', |
| | | title: 'ID', |
| | | width: 150, |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | | field: 'money', |
| | | title: '金额', |
| | | width: 100, |
| | | sort: false, |
| | | }, |
| | | { |
| | | field: 'verifyMerchantChannel', |
| | | title: '验证渠道', |
| | | width: 100, |
| | | sort: false |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | title: '创建时间', |
| | | width: 180, |
| | | sort: false |
| | | }, |
| | | { |
| | | field: 'updateTime', |
| | | title: '更新时间', |
| | | width: 180, |
| | | sort: false |
| | | }, |
| | | { |
| | | field: '', |
| | | title: '操作', |
| | | sort: false, |
| | | templet: function(d) { |
| | | var html = "<button onclick='delete_money(" + d.id + ")' class='layui-btn layui-btn-primary layui-border-red layui-btn-xs'>删除</button>"; |
| | | html += "<button onclick='update_money(" + d.id + ")' class='layui-btn layui-btn-primary layui-border-blue layui-btn-xs'>修改</button>"; |
| | | return html; |
| | | } |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | }; |
| | | |
| | | |
| | | |
| | | var key = http_util.getQueryString("key"); |
| | | if (key != null && key != undefined) { |
| | | form.val("search", { |
| | | "key": key |
| | | }); |
| | | table_option.data = []; |
| | | setTimeout(function() { |
| | | $("#search").click(); |
| | | }, 100); |
| | | } |
| | | |
| | | //第一个实例 |
| | | let tableIns = table.render(table_option); |
| | | |
| | | //监听提交 |
| | | form.on('submit(search)', function(data) { |
| | | tableIns.reload({ |
| | | where: data.field, |
| | | page: { |
| | | curr: 1 //重新从第 1 页开始 |
| | | } |
| | | }); |
| | | |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <meta name="viewport" content="width=device-width,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" /> |
| | | <style> |
| | | body { |
| | | padding: 10px; |
| | | } |
| | | |
| | | #sure { |
| | | visibility: hidden; |
| | | } |
| | | |
| | | .layui-form-label { |
| | | width: 200px; |
| | | } |
| | | |
| | | .layui-input-block { |
| | | margin-left: 240px; |
| | | max-width: 500px; |
| | | } |
| | | |
| | | .layui-input-block input { |
| | | max-width: 150px; |
| | | } |
| | | |
| | | .small { |
| | | max-width: 75px !important; |
| | | } |
| | | |
| | | .share-ratio { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .share-ratio .layui-form-label { |
| | | width: 50px; |
| | | padding-left: 0; |
| | | font-size: 12px; |
| | | text-align: left; |
| | | } |
| | | |
| | | .share-ratio input { |
| | | width: 60px; |
| | | margin-right: 10px; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | |
| | | <form class="layui-form" lay-filter="edit"> |
| | | <input type="hidden" name="id" /> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">金额:</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="money" required lay-verify="required|money" placeholder="金额" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">商家验证渠道:</label> |
| | | <div class="layui-input-inline"> |
| | | <select name ="verifyMerchantChannel"> |
| | | <option value = "unknown">无需验证</option> |
| | | <option value = "cyx">超佣享</option> |
| | | <option value = "bps">爆品社</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-input-block"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="sure" id="sure">确定</button> |
| | | </div> |
| | | </form> |
| | | <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http_api.js"></script> |
| | | <script> |
| | | var listener; |
| | | |
| | | function submit(callback) { |
| | | //暂存回调方法 |
| | | listener = callback; |
| | | //表单提交按钮 |
| | | $("#sure").click(); |
| | | } |
| | | |
| | | layui.use(['form', 'layedit', 'laydate', 'laytpl'], function() { |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | laydate = layui.laydate, |
| | | laytpl = layui.laytpl; |
| | | //自定义验证规则 |
| | | form.verify({ |
| | | money: [/^\d+(\.\d{1,2})?$/, "金额最多保留2位小数"] |
| | | }); |
| | | var id = http_util.getQueryString("id"); |
| | | // 获取值 |
| | | $.post("/admin/api/paymoneysetting/get", { |
| | | "id":id |
| | | }, function(response) { |
| | | if (response.code == 0) { |
| | | form.val("edit", response.data); |
| | | } else { |
| | | layer.msg(response.msg); |
| | | } |
| | | }, 'json').fail(function(jqXHR, textStatus, errorThrown) { |
| | | layer.msg("网络请求失败"); |
| | | }); |
| | | //监听提交 |
| | | form.on('submit(sure)', function(data) { |
| | | listener(data.field); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | <span>以往订单>=</span> |
| | | <input type="text" name="totalCount_{{d.index}}" required lay-verify="required|num" placeholder="正整数" |
| | | autocomplete="off" value="{{ d.totalCount }}" class="layui-input totalCount"> |
| | | <span>单,限制提交</span> |
| | | <input type="text" name="perCount_{{d.index}}" required lay-verify="required|num" placeholder="正整数" |
| | | autocomplete="off" value="{{ d.perCount }}" class="layui-input"> |
| | | <span>单,限制提交:</span> |
| | | |
| | | <span>超佣享</span> |
| | | <input type="text" name="perCountCyx_{{d.index}}" required lay-verify="required|num" placeholder="正整数" |
| | | autocomplete="off" value="{{ d.perCountCyx }}" class="layui-input"> |
| | | <span>单,</span> |
| | | |
| | | <span>爆品社</span> |
| | | <input type="text" name="perCountBps_{{d.index}}" required lay-verify="required|num" placeholder="正整数" |
| | | autocomplete="off" value="{{ d.perCountBps }}" class="layui-input"> |
| | | <span>单,</span> |
| | | |
| | | <span>卡金额</span> |
| | | <input type="text" name="perCountUnknown_{{d.index}}" required lay-verify="required|num" placeholder="正整数" |
| | | autocomplete="off" value="{{ d.perCountUnknown }}" class="layui-input"> |
| | | <span>单</span> |
| | | |
| | | <span class="layui-icon layui-icon-close delete"></span> |
| | |
| | | laytpl($('#payMoneyTemplate').html()).render({ |
| | | "index": index, |
| | | "totalCount": "", |
| | | "perCount": "" |
| | | "perCountCyx": "", |
| | | "perCountBps": "", |
| | | "perCountUnknown": "", |
| | | }, function(html) { |
| | | $("#add").parent().parent().before(html); |
| | | }); |
| | |
| | | laytpl($('#payMoneyTemplate').html()).render({ |
| | | "index": i + 1, |
| | | "totalCount": item.totalCount, |
| | | "perCount": item.perCount |
| | | "perCountCyx": item.perCountCyx, |
| | | "perCountBps": item.perCountBps, |
| | | "perCountUnknown": item.perCountUnknown, |
| | | }, function(html) { |
| | | $("#add").parent().parent().before(html); |
| | | $(".delete").bind("click", function(e) { |
| | |
| | | let index = key.replace("totalCount_", ""); |
| | | params.push({ |
| | | "totalCount": data.field[key], |
| | | "perCount": data.field["perCount_" + index] |
| | | "perCountCyx": data.field["perCountCyx_" + index], |
| | | "perCountBps": data.field["perCountBps_" + index], |
| | | "perCountUnknown": data.field["perCountUnknown_" + index] |
| | | }); |
| | | } |
| | | } |
| | |
| | | <input type="text" name="uid" id="uid" placeholder="请输入老铁ID搜索" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-normal" lay-submit lay-filter="search" id="search">搜索</button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <div class="layui-form" id="table-list"> |
| | | <table class="layui-table" lay-even lay-skin="nob" id="table"> |
| | |
| | | <script src="layui/layui.js"></script> |
| | | <style> |
| | | body{ |
| | | |
| | | background: #FFF; |
| | | } |
| | | .container{ |
| | |
| | | package com.taoke.autopay; |
| | | |
| | | import com.taoke.autopay.dao.agent.ChannelAgentMapper; |
| | | import com.taoke.autopay.dao.agent.ChannelAgentSettleDetailMapper; |
| | | import com.taoke.autopay.dao.agent.ChannelAgentSettleRecordMapper; |
| | | import com.taoke.autopay.dao.agent.ChannelAgentSharingRatioMapper; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.agent.ChannelAgent; |
| | | import com.taoke.autopay.entity.agent.ChannelAgentSettings; |
| | | import com.taoke.autopay.entity.agent.ChannelAgentSettleRecord; |
| | | import com.taoke.autopay.entity.agent.ChannelAgentSharingRatio; |
| | | import com.taoke.autopay.exception.ChannelAgentException; |
| | | import com.taoke.autopay.exception.ChannelAgentSettleException; |
| | | import com.taoke.autopay.service.agent.ChannelAgentService; |
| | | import com.taoke.autopay.service.agent.ChannelAgentSettingService; |
| | | import com.taoke.autopay.service.agent.ChannelAgentSettleService; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private ChannelAgentSettingService channelAgentSettingService; |
| | | |
| | | @Test |
| | | public void testSettings(){ |
| | | ChannelAgentSettings settings = channelAgentSettingService.selectByAgentId(16L); |
| | | if(settings!=null&&!StringUtil.isNullOrEmpty(settings.getStartSubmitTime())&&!StringUtil.isNullOrEmpty(settings.getEndSubmitTime())){ |
| | | String now = TimeUtil.getGernalTime(System.currentTimeMillis(), "HHmmss"); |
| | | String startTime = settings.getStartSubmitTime().replace(":",""); |
| | | String endTime = settings.getEndSubmitTime().replace(":",""); |
| | | if (Integer.parseInt(now) < Integer.parseInt(startTime) || Integer.parseInt(now) > Integer.parseInt(endTime)) { |
| | | System.out.println(""); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | private KeyOrderService keyOrderService; |
| | | |
| | | @Resource |
| | | private KeyOrderMapper keyOrderMapper; |
| | | |
| | | @Resource |
| | | private OrderPayFailProcessor orderPayFailProcessor; |
| | | |
| | | private void addKey(SubmitKeyInfo keyInfo, Long wxUid) throws KeyVerifyException, KeyOrderException, WxOrderCountException { |
| | |
| | | @Test |
| | | public void test1() { |
| | | SubmitKeyInfo keyInfo = new SubmitKeyInfo(); |
| | | keyInfo.setKey("【支fu`寳】亲,复制 Q:/dYsUzQV77s5 p:/S ZH2412 2020/11/27打开支付宝就可以帮我🏮付款啦💪https://ur.alipay.com/_Ig4toHTlLHbBqiJqb3dpC"); |
| | | keyInfo.setKey("【支.f.u.宝】亲,复制 m:/AYyvvyJ32pG Y:/e CA8474 2021/01/18打开支付宝\uD83C\uDFEE就可以帮我\uD83C\uDFEE付款啦\uD83C\uDFEEhttps://ur.alipay.com/_1kIJISKdMN6PREE9laoYWS"); |
| | | try { |
| | | addKey(keyInfo, 1L); |
| | | KeyOrder keyOrder=new KeyOrder(); |
| | | keyOrder.setId("test21123123"); |
| | | keyOrder.setKey(keyInfo.getKey()); |
| | | keyOrderMapper.insertSelective(keyOrder); |
| | | } catch (KeyVerifyException e) { |
| | | e.printStackTrace(); |
| | | } catch (KeyOrderException e) { |
| | |
| | | |
| | | @Test |
| | | public void testCount() throws Exception{ |
| | | Long uid = 5413L; |
| | | int orderType = Constant.ORDER_TYPE_DY; |
| | | WxUserSettings settings = wxUserSettingService.getUserSettings(uid); |
| | | |
| | | OrderCountTypeEnum orderCountType = OrderCountTypeEnum.SUBMIT_TOKEN_COUNT; |
| | | int maxCount = settings.getTotalOrderCountPerDay(); |
| | | switch (orderType) { |
| | | case Constant.ORDER_TYPE_DY: |
| | | orderCountType = OrderCountTypeEnum.DY_ORDER_PAY; |
| | | maxCount = settings.getDyOrderCountPerDay(); |
| | | break; |
| | | case Constant.ORDER_TYPE_KS: |
| | | orderCountType = OrderCountTypeEnum.KS_ORDER_PAY; |
| | | maxCount = settings.getKsOrderCountPerDay(); |
| | | break; |
| | | |
| | | } |
| | | |
| | | try { |
| | | wxUserOrderCountService.isOrderCountLimit(uid, orderCountType, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"), 1, maxCount); |
| | | } catch (WxOrderCountException e) { |
| | | e.printStackTrace(); |
| | | throw new KeyVerifyException(KeyVerifyException.CODE_COMMON, "今日提交超过" + maxCount + "次"); |
| | | } |
| | | |
| | | @Test |
| | | public void testSettle(){ |
| | | keyOrderService.statisticChannelOrders(5L,new Date(TimeUtil.convertToTimeTemp("20240809","yyyyMMdd")),new Date(TimeUtil.convertToTimeTemp("20240810","yyyyMMdd"))); |
| | | } |
| | | |
| | | |
| | |
| | | package com.taoke.autopay; |
| | | |
| | | import com.taoke.autopay.entity.KeyOrder; |
| | | import com.taoke.autopay.entity.PayMoneySetting; |
| | | import com.taoke.autopay.entity.UserPayCount; |
| | | import com.taoke.autopay.entity.WxUserOrderCount; |
| | | import com.taoke.autopay.entity.agent.*; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.generater.GeneraterManagerV2; |
| | |
| | | |
| | | @Test |
| | | public void test() { |
| | | // MyBatisMapperUtil.createMapper(ChannelAgent.class); |
| | | // MyBatisMapperUtil.createMapper(PayMoneySetting.class); |
| | | // MyBatisMapperUtil.createMapper(KeyOrder.class); |
| | | // MyBatisMapperUtil.createMapper(SystemConfig.class); |
| | | // MyBatisMapperUtil.createMapper(WxUserInfo.class); |
| | |
| | | // MyBatisMapperUtil.createMapper(AdminUser.class); |
| | | |
| | | |
| | | // ColumnParseUtil.parseColumn(ChannelAgentSettleRecord.class, |
| | | // "D:\\项目\\淘客代付系统\\taoke_autopay_server\\src\\main\\resources\\mapper\\ChannelAgentSettleRecordMapper.xml"); |
| | | ColumnParseUtil.parseColumn(WxUserOrderCount.class, |
| | | "D:\\项目\\淘客代付系统\\taoke_autopay_server\\src\\main\\resources\\mapper\\WxUserOrderCountMapper.xml"); |
| | | // System.out.println( MyBatisMapperUtil.createSQL(ChannelAgentOrderStatisticRecord.class)); |
| | | // System.out.println( MyBatisMapperUtil.createSQL(ChannelAgentSettings.class)); |
| | | // System.out.println(MyBatisMapperUtil.createSQL(ChannelAgentSettleRecord.class)); |
| | | System.out.println( MyBatisMapperUtil.createSQL(UserPayCount.class)); |
| | | // System.out.println( MyBatisMapperUtil.createSQL(UserPayCount.class)); |
| | | |
| | | // MyBatisMapperUtil.createMapper(ChannelAgentOrderStatisticRecord.class); |
| | | // MyBatisMapperUtil.createMapper(ChannelAgentSettings.class); |
| | | // MyBatisMapperUtil.createMapper(ChannelAgentSettleRecord.class); |
| | | MyBatisMapperUtil.createMapper(UserPayCount.class); |
| | | // MyBatisMapperUtil.createMapper(UserPayCount.class); |
| | | |
| | | |
| | | // System.out.println( new BigDecimal("3.26").multiply(new BigDecimal(100)).setScale(0, RoundingMode.FLOOR).intValue()); |
New file |
| | |
| | | package com.taoke.autopay; |
| | | |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.PayMoneySetting; |
| | | import com.taoke.autopay.exception.PayMoneySettingException; |
| | | import com.taoke.autopay.service.PayMoneySettingService; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: PayMoneySettingTest |
| | | * @description: 支付金额单元测试 |
| | | * @date 2024/9/15 10:11 |
| | | */ |
| | | @SpringBootTest |
| | | public class PayMoneySettingTest { |
| | | |
| | | @Resource |
| | | private PayMoneySettingService payMoneySettingService; |
| | | |
| | | @Test |
| | | public void add() throws PayMoneySettingException { |
| | | PayMoneySetting setting = new PayMoneySetting(); |
| | | setting.setMoney(new BigDecimal("10.23")); |
| | | setting.setVerifyMerchantChannel(OrderChannelEnum.cyx); |
| | | payMoneySettingService.addSetting(setting); |
| | | setting = new PayMoneySetting(); |
| | | setting.setMoney(new BigDecimal("10.24")); |
| | | payMoneySettingService.addSetting(setting); |
| | | } |
| | | |
| | | @Test |
| | | public void listAll() { |
| | | PayMoneySetting setting = payMoneySettingService.getSettingByMoney(new BigDecimal("10.23")); |
| | | Set<String> sts = payMoneySettingService.listAllMoneyAsStr(); |
| | | System.out.println(sts.toArray()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.taoke.autopay; |
| | | |
| | | import com.taoke.autopay.entity.SystemConfigKeyEnum; |
| | | import com.taoke.autopay.exception.KeyVerifyException; |
| | | import com.taoke.autopay.service.SystemConfigService; |
| | | import com.taoke.autopay.utils.MoneyUtil; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import net.sf.json.JSONArray; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | package com.taoke.autopay; |
| | | |
| | | import com.taoke.autopay.dao.WxUserOrderCountMapper; |
| | | import com.taoke.autopay.entity.OrderChannelEnum; |
| | | import com.taoke.autopay.entity.OrderCountTypeEnum; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | | import com.taoke.autopay.service.UserSettingService; |
| | | import com.taoke.autopay.service.WxUserOrderCountService; |
| | | import com.taoke.autopay.service.WxUserService; |
| | | import com.taoke.autopay.utils.Constant; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | |
| | | public void getPercount() { |
| | | int[] tc = new int[]{1000, 500, 400, 300, 200, 100}; |
| | | for (int t : tc) { |
| | | System.out.println(t + "=>" + userSettingService.getLimitCountByTotalCount(t)); |
| | | System.out.println(t + "=>" + userSettingService.getLimitCountByTotalCount(t, OrderChannelEnum.bps)); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Test |
| | | public void testAdd() throws WxOrderCountException { |
| | | long uid = 2L; |
| | | String day="2024-08-01"; |
| | | |
| | | wxUserOrderCountService.addOrderCount(uid, OrderCountTypeEnum.SUBMIT_TOKEN_COUNT, day, 1,100); |
| | | long uid = 2L; |
| | | String day="20240926"; |
| | | OrderChannelEnum orderChannel= OrderChannelEnum.bps; |
| | | long todayCount = wxUserOrderCountService.sum(uid, null,orderChannel, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT)); |
| | | long totalCount = wxUserOrderCountService.sum(uid, null,orderChannel,null); |
| | | int maxPayCount = userSettingService.getLimitCountByTotalCount(totalCount, orderChannel); |
| | | if(todayCount>=maxPayCount){ |
| | | ; |
| | | } |
| | | |
| | | // wxUserOrderCountService.addOrderCount(uid, OrderCountTypeEnum.SUBMIT_TOKEN_COUNT,null, day, 1,null); |
| | | // wxUserOrderCountService.addOrderCount(uid,null,OrderChannelEnum.bps, day, 1,null); |
| | | // wxUserOrderCountService.addOrderCount(uid,OrderCountTypeEnum.DY_ORDER_PAY,OrderChannelEnum.bps, day, 1,null); |
| | | } |
| | | |
| | | @Test |