Administrator
2025-03-05 af0be3243ab0d75e38ae8213de461c4a584652f7
代理订单忽略
2个文件已添加
37个文件已修改
2382 ■■■■■ 已修改文件
src/main/java/com/taoke/autopay/controller/WebApiController.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/admin/AdminAgentController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/admin/AdminOrderController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/admin/AdminSettingsController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/admin/AdminWxUserController.java 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/agent/AgentController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/dao/KeyOrderMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/dao/WxUserInfoMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/dto/admin/OrderExcelDataDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/entity/KeyOrder.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/entity/SystemConfigKeyEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/entity/WxUserInfo.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/entity/agent/ChannelAgent.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/factory/AgentFactory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/factory/OrderFactory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/factory/WxUserFactory.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/service/WxUserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/task/KeyOrderDistributeTask.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/vo/WxUserVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/vo/admin/AdminChannelAgentVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/vo/admin/AdminOrderVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/vo/admin/IgnoreAgentOrderSettingVO.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/vo/admin/OrderSearchVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ChannelAgentMapper.xml 249 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/KeyOrderMapper.xml 482 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WxUserInfoMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/agent-list.html 695 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/agent-update.html 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/index.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/order-list.html 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/pay_money_add.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/pay_money_update.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/settings_ignore_agent_order.html 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/user-edit.html 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/user-list.html 442 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/taoke/autopay/ClientTest.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/taoke/autopay/MapperTest.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/WebApiController.java
@@ -6,6 +6,7 @@
import com.taoke.autopay.entity.KeyOrder;
import com.taoke.autopay.entity.SystemConfigKeyEnum;
import com.taoke.autopay.entity.WxUserInfo;
import com.taoke.autopay.entity.agent.ChannelAgent;
import com.taoke.autopay.exception.KeyOrderException;
import com.taoke.autopay.exception.KeyVerifyException;
import com.taoke.autopay.exception.WxOrderCountException;
@@ -13,6 +14,7 @@
import com.taoke.autopay.service.KeyOrderService;
import com.taoke.autopay.service.SystemConfigService;
import com.taoke.autopay.service.WxUserService;
import com.taoke.autopay.service.agent.ChannelAgentService;
import com.taoke.autopay.utils.*;
import com.taoke.autopay.vo.SubmitKeyInfo;
import net.sf.json.JSONObject;
@@ -20,6 +22,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.yeshi.utils.UrlUtils;
@@ -49,8 +52,11 @@
    @Resource
    private SystemConfigService systemConfigService;
    @Autowired
    @Resource
    private PayCountVerifyManager payCountVerifyManager;
    @Resource
    private ChannelAgentService channelAgentService;
    private KeyOrder addKey(SubmitKeyInfo keyInfo, Long wxUid) throws KeyVerifyException, KeyOrderException, WxOrderCountException {
@@ -146,12 +152,30 @@
        }
        keyInfo.setIpInfo(ipInfoMap.get(ip));
        String citys = systemConfigService.getValueCache(SystemConfigKeyEnum.FORBIDDEN_SUBMIT_CITYS);
        if (citys != null && ipInfoMap.get(ip) != null) {
            List<String> cityList = Arrays.asList(citys.split(","));
            if (cityList.contains(ipInfoMap.get(ip).getCity())) {
                LogUtil.loggerDebug.warn("区域屏蔽:{}-{}", ip, new Gson().toJson(ipInfoMap.get(ip)));
                return JsonUtil.loadFalseResult("暂时无法上传口令");
        AntPathMatcher pathMatcher = new AntPathMatcher();
        Map<String, String> paramsMap = HttpUtil.getPramsFromUrl(keyInfo.getReferer());
        if (paramsMap.containsKey("a") && ipInfoMap.get(ip) != null) {
            String alias = paramsMap.get("a");
            ChannelAgent agent = channelAgentService.selectByAlias(alias);
            if (!StringUtil.isNullOrEmpty(agent.getShieldedAreas())) {
                String[] res = agent.getShieldedAreas().split(",");
                String ipInfoStr = ipInfoMap.get(ip).getProvince() + "/" + ipInfoMap.get(ip).getCity();
                boolean shield = false;
                for (String pattern : res) {
                    if (pathMatcher.match(pattern, ipInfoStr)) {
                        shield = true;
                        break;
                    }
                }
                if (shield) {
                    // 判断用户是否为白名单
                    if (user.getStatus() != WxUserInfo.STATUS_WHITE) {
                        // 不是白名单才限制
                        LogUtil.loggerDebug.warn("区域屏蔽:{}-{}", ip, new Gson().toJson(ipInfoMap.get(ip)));
                        return JsonUtil.loadFalseResult("暂时无法上传口令");
                    }
                }
            }
        }
src/main/java/com/taoke/autopay/controller/admin/AdminAgentController.java
@@ -152,6 +152,7 @@
                .pwd(StringUtil.isNullOrEmpty(vo.getPwd()) ? null :StringUtil.Md5(vo.getPwd()))
                .alipayAccount(StringUtil.isNullOrEmpty(vo.getAlipayAccount()) ? null : vo.getAlipayAccount())
                .alipayName(StringUtil.isNullOrEmpty(vo.getAlipayName()) ? null : vo.getAlipayName())
                .shieldedAreas(vo.getShieldedAreas())
                .build();
            channelAgentService.updateSelective(agent);
            // 添加设置
src/main/java/com/taoke/autopay/controller/admin/AdminOrderController.java
@@ -17,6 +17,7 @@
import com.taoke.autopay.service.KeyOrderService;
import com.taoke.autopay.service.agent.ChannelAgentService;
import com.taoke.autopay.utils.Constant;
import com.taoke.autopay.utils.IPUtil;
import com.taoke.autopay.utils.TimeUtil;
import com.taoke.autopay.vo.admin.AdminOrderVO;
import com.taoke.autopay.vo.admin.OrderSearchVO;
@@ -117,6 +118,8 @@
        if (!StringUtil.isNullOrEmpty(vo.getEndDate())) {
            query.maxCreateTime = TimeUtil.getNextDay(1, new Date(TimeUtil.convertToTimeTemp(vo.getEndDate(), "yyyy-MM-dd")).getTime());
        }
        query.ignore = vo.getIgnore();
        return query;
@@ -298,6 +301,17 @@
                    dto.setPayDevice("");
                }
                dto.setPayMerchant(order.getPayMerchant());
                if(StringUtil.isNullOrEmpty(order.getIpInfo())) {
                    dto.setArea("");
                }else{
                    IPUtil.IPInfo ipInfo = gson.fromJson(order.getIpInfo(), IPUtil.IPInfo.class);
                    dto.setArea(String.format("%s/%s",ipInfo.getProvince(),ipInfo.getCity()));
                }
                if(order.getIgnore()==null) {
                    dto.setIgnore("未知");
                }else{
                    dto.setIgnore(order.getIgnore()?"是":"否");
                }
                dataList.add(dto);
            }
src/main/java/com/taoke/autopay/controller/admin/AdminSettingsController.java
@@ -6,6 +6,7 @@
import com.taoke.autopay.entity.SystemConfigKeyEnum;
import com.taoke.autopay.service.SystemConfigService;
import com.taoke.autopay.service.UserSettingService;
import com.taoke.autopay.vo.admin.IgnoreAgentOrderSettingVO;
import com.taoke.autopay.vo.admin.PayMoneySettingsVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -151,7 +152,6 @@
    }
    @ResponseBody
    @RequestMapping("getForbiddenSubmitCitys")
    public String getForbiddenSubmitCitys() {
@@ -170,4 +170,24 @@
    }
    @ResponseBody
    @RequestMapping("getIgnoreAgentOrderSetting")
    public String getIgnoreAgentOrderSetting() {
        String value = systemConfigService.getValue(SystemConfigKeyEnum.IGNORE_AGENT_ORDER_SETTING);
        IgnoreAgentOrderSettingVO vo = new IgnoreAgentOrderSettingVO();
        if (!StringUtil.isNullOrEmpty(value)) {
            vo = new Gson().fromJson(value, IgnoreAgentOrderSettingVO.class);
        }
        return JsonUtil.loadTrueResult(vo);
    }
    @ResponseBody
    @RequestMapping("setIgnoreAgentOrderSetting")
    public String setIgnoreAgentOrderSetting(IgnoreAgentOrderSettingVO vo) {
        systemConfigService.setValue(SystemConfigKeyEnum.IGNORE_AGENT_ORDER_SETTING, new Gson().toJson(vo));
        return JsonUtil.loadTrueResult("");
    }
}
src/main/java/com/taoke/autopay/controller/admin/AdminWxUserController.java
@@ -61,19 +61,41 @@
    private WxUserSettingService wxUserSettingService;
    /**
     * @param key
     * @param keyType 1-用户ID/昵称   2-地域
     * @param page
     * @param limit
     * @return
     */
    @ResponseBody
    @RequestMapping("list")
    public String listWxUser(String uid, int page, int limit) {
    public String listWxUser(String key, Integer keyType, int page, int limit) {
        //先查询所有的数据
        WxUserInfoMapper.DaoQuery query = new WxUserInfoMapper.DaoQuery();
        query.sortList=Arrays.asList(new String[]{"login_time desc"});
        if (!StringUtil.isNullOrEmpty(uid)) {
            if(NumberUtil.isNumeric(uid)) {
                query.id = Long.parseLong(uid);
            }else{
                query.searchKey = uid;
            }
        query.sortList = Arrays.asList(new String[]{"login_time desc"});
        if (keyType == null) {
            keyType = 1;
        }
        switch (keyType) {
            case 1:
                if (!StringUtil.isNullOrEmpty(key)) {
                    if (NumberUtil.isNumeric(key)) {
                        query.id = Long.parseLong(key);
                    } else {
                        query.searchKey = key;
                    }
                }
                break;
            case 2:
                if (!StringUtil.isNullOrEmpty(key)) {
                    query.searchArea = key;
                }
                break;
        }
        List<WxUserInfo> userList = wxUserService.list(query, page, limit);
        long count = wxUserService.count(query);
        Map<Long, WxUserSettings> settingsMap = new HashMap<>();
@@ -118,5 +140,19 @@
        return JsonUtil.loadTrueResult("");
    }
    @ResponseBody
    @RequestMapping("getUser")
    public String getUser(Long id) {
        WxUserInfo user = wxUserService.selectById(id);
        return JsonUtil.loadTrueResult(user);
    }
    @ResponseBody
    @RequestMapping("updateUser")
    public String updateUser(WxUserInfo user) {
        wxUserService.update(user);
        return JsonUtil.loadTrueResult("");
    }
}
src/main/java/com/taoke/autopay/controller/agent/AgentController.java
@@ -120,6 +120,7 @@
        if (!StringUtil.isNullOrEmpty(filter.getKey())) {
            query.nickName = filter.getKey().trim();
        }
        query.ignore = false;
        query.start = (filter.getPage() - 1) * 20L;
        query.count = 20;
src/main/java/com/taoke/autopay/dao/KeyOrderMapper.java
@@ -72,6 +72,8 @@
        public Date oMinCreateTime;
        public Date oMaxCreateTime;
        public Boolean ignore;
        public String nickName;
        public long start;
        public int count;
src/main/java/com/taoke/autopay/dao/WxUserInfoMapper.java
@@ -22,6 +22,7 @@
        public String openId;
        public String nickName;
        public String searchKey;
        public String searchArea;
        public String portrait;
        public Date minLoginTime;
        public Date maxLoginTime;
src/main/java/com/taoke/autopay/dto/admin/OrderExcelDataDto.java
@@ -53,5 +53,9 @@
    private String totalMoney;
    @ExcelProperty("商家名称")
    private String payMerchant;
    @ExcelProperty("地域")
    private String area;
    @ExcelProperty("是否忽略")
    private String ignore;
}
src/main/java/com/taoke/autopay/entity/KeyOrder.java
@@ -42,6 +42,8 @@
    private Integer orderState;
    @Column(name = "state")
    private Integer state;
    @Column(name = "sub_state")
    private Integer subState;
    @Column(name = "state_desc")
    private String stateDesc;
    @Column(name = "distribute_client_uid")
@@ -77,5 +79,8 @@
    @Column(name = "ip_info")
    private String ipInfo;
    @Column(name = "ignore")
    private Boolean ignore;
    private WxUserInfo user;
}
src/main/java/com/taoke/autopay/entity/SystemConfigKeyEnum.java
@@ -23,6 +23,7 @@
    RE_EXCUTE_PAY_CLIENTS("re_excute_pay_clients", "重新执行支付的账号"),
    USER_SUBMIT_KEY_COUNT_LIMIT("user_submit_key_count_limit_v2", "用户提交口令次数限制"),
    FORBIDDEN_SUBMIT_CITYS("forbidden_submit_citys","禁止提交口令的城市"),
    IGNORE_AGENT_ORDER_SETTING("ignore_agent_order_setting","忽略代理订单设置"),
    ;
src/main/java/com/taoke/autopay/entity/WxUserInfo.java
@@ -17,6 +17,10 @@
@Data
@Table("table_wx_user")
public class WxUserInfo implements Serializable {
    public final static int STATUS_NORMAL = 0;
    // 白名单
    public final static int STATUS_WHITE = 1;
    @Id
    @Column(name="id")
    private Long id;
@@ -36,5 +40,7 @@
    private String latestIPInfo;
    @Column(name="update_time")
    private Date updateTime;
    @Column(name="status")
    private Integer status;
}
src/main/java/com/taoke/autopay/entity/agent/ChannelAgent.java
@@ -81,6 +81,12 @@
    @Column(name = "_status_desc", length = 128)
    private String statusDesc;
    /**
     * 屏蔽区域
     */
    @Column(name = "_shielded_areas", length = 256)
    private String shieldedAreas;
    @Column(name = "_create_time")
    private Date createTime;
src/main/java/com/taoke/autopay/factory/AgentFactory.java
@@ -26,6 +26,7 @@
                .createTime(agent.getCreateTime())
                .status(agent.getStatus())
                .statusDesc(agent.getStatusDesc())
                .shieldedAreas(agent.getShieldedAreas())
                .build();
        if(agentSettings!=null){
            vo.setMaxKeyCountPerDay(agentSettings.getMaxKeyCountPerDay()==null?null:agentSettings.getMaxKeyCountPerDay()+"");
src/main/java/com/taoke/autopay/factory/OrderFactory.java
@@ -115,6 +115,7 @@
        vo.setOrderChannel(orderChannel==null?"未知":orderChannel.getName());
        vo.setPayMerchant(order.getPayMerchant());
        vo.setIp(order.getIp());
        vo.setIgnore(order.getIgnore());
        if(!StringUtil.isNullOrEmpty(order.getIpInfo())){
            vo.setIpInfo(new Gson().fromJson(order.getIpInfo(), IPUtil.IPInfo.class));
        }
src/main/java/com/taoke/autopay/factory/WxUserFactory.java
@@ -27,8 +27,11 @@
        if(!StringUtil.isNullOrEmpty(user.getLatestIPInfo())){
            vo.setIpInfo(new Gson().fromJson(user.getLatestIPInfo(), IPUtil.IPInfo.class));
        }
        WxUserOrderSettingVO settingVO = new WxUserOrderSettingVO(settings.getDyOrderCountPerDay(), settings.getKsOrderCountPerDay(), settings.getTotalOrderCountPerDay());
        vo.setOrderSetting(settingVO);
        vo.setStatus(user.getStatus());
        if(settings!=null) {
            WxUserOrderSettingVO settingVO = new WxUserOrderSettingVO(settings.getDyOrderCountPerDay(), settings.getKsOrderCountPerDay(), settings.getTotalOrderCountPerDay());
            vo.setOrderSetting(settingVO);
        }
        return vo;
    }
src/main/java/com/taoke/autopay/service/WxUserService.java
@@ -25,5 +25,7 @@
    public void setLatestInfoInfo(Long uid, String ip, IPUtil.IPInfo ipInfo);
    public void update(WxUserInfo wxUserInfo);
}
src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java
@@ -20,6 +20,7 @@
import com.taoke.autopay.utils.order.DYOrderApi;
import com.taoke.autopay.utils.order.OrderChannelUtil;
import com.taoke.autopay.vo.SubmitKeyInfo;
import com.taoke.autopay.vo.admin.IgnoreAgentOrderSettingVO;
import net.sf.json.JSONArray;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -89,8 +90,8 @@
        if (uid != null) {
            WxUserSettings settings = wxUserSettingService.getUserSettings(uid);
            OrderCountTypeEnum countType = OrderCountTypeEnum.SUBMIT_TOKEN_COUNT;
            wxUserOrderCountService.addOrderCount(uid, countType,null, day, 1, settings.getTotalOrderCountPerDay());
            wxUserService.setLatestInfoInfo(uid, keyInfo.getIp(),keyInfo.getIpInfo());
            wxUserOrderCountService.addOrderCount(uid, countType, null, day, 1, settings.getTotalOrderCountPerDay());
            wxUserService.setLatestInfoInfo(uid, keyInfo.getIp(), keyInfo.getIpInfo());
        }
        String id = OrderFactory.createId(keyInfo.getKey());
        KeyOrder order = keyOrderMapper.selectById(id);
@@ -113,15 +114,32 @@
                }
                // 验证渠道时间
                ChannelAgentSettings settings = channelAgentSettingService.selectByAgentId(agent.getId());
                if(settings!=null&&!StringUtil.isNullOrEmpty(settings.getStartSubmitTime())&&!StringUtil.isNullOrEmpty(settings.getEndSubmitTime())){
                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(":","");
                    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()));
                        throw new KeyOrderException(String.format("口令提交时间段为:%s-%s", settings.getStartSubmitTime(), settings.getEndSubmitTime()));
                    }
                }
                // 获取渠道忽略订单的配置
                String config = systemConfigService.getValueCache(SystemConfigKeyEnum.IGNORE_AGENT_ORDER_SETTING);
                if (!StringUtil.isNullOrEmpty(config)) {
                    IgnoreAgentOrderSettingVO ignore = JsonUtil.getSimpleGson().fromJson(config, IgnoreAgentOrderSettingVO.class);
                    if (ignore.getPercent() > 0) {
                        // 获取当前代理今日的订单数量
                        KeyOrderMapper.DaoQuery daoQuery = new KeyOrderMapper.DaoQuery();
                        daoQuery.agentId = agent.getId();
                        daoQuery.minCreateTime = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd"), "yyyyMMdd"));
                        long keyCount = count(daoQuery);
                        if (keyCount > ignore.getBeginCount()) {
                            if ((keyCount - ignore.getBeginCount()) % (100 / ignore.getPercent()) == 0) {
                                order.setIgnore(true);
                            }
                        }
                    }
                }
                order.setAgentId(agent.getId());
            }
        }
@@ -136,7 +154,7 @@
        order.setState(KeyOrder.STATE_NOT_PROCESS);
        order.setStateDesc("尚未处理");
        order.setCreateTime(new Date());
        if(orderType!=Constant.ORDER_TYPE_UNKNOWN){
        if (orderType != Constant.ORDER_TYPE_UNKNOWN) {
            order.setOrderType(orderType);
        }
        if (orderDto != null) {
@@ -144,7 +162,7 @@
        }
        order.setIp(keyInfo.getIp());
        if(keyInfo.getIpInfo()!=null) {
        if (keyInfo.getIpInfo() != null) {
            order.setIpInfo(new Gson().toJson(keyInfo.getIpInfo()));
        }
        keyOrderMapper.insertSelective(order);
@@ -169,7 +187,7 @@
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void paySuccess(String id, String stateDesc, String day,String payMerchant) throws WxOrderCountException {
    public void paySuccess(String id, String stateDesc, String day, String payMerchant) throws WxOrderCountException {
        KeyOrder old = keyOrderMapper.selectByPrimaryKeyForUpdate(id);
        if (old == null) {
            return;
@@ -179,7 +197,7 @@
        }
        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, OrderChannelUtil.getChannelByKey( old.getOrderChannel()), 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);
@@ -267,44 +285,44 @@
        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<>();
        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<>();
        Set<String> orderIds=new HashSet<>();
        for(KeyOrder order:orderList){
            String orderId=order.getOrderType()+"#"+ order.getOrderNo();
            if(!StringUtil.isNullOrEmpty(order.getOrderNo())){
                if(orderIds.contains(orderId)){
        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)){
            if (!uidsMap.containsKey(orderChannel)) {
                uidsMap.put(orderChannel, new HashSet<>());
            }
            uidsMap.get(orderChannel).add(order.getUid());
            if(!countMap.containsKey(orderChannel)){
                countMap.put(orderChannel,0);
            if (!countMap.containsKey(orderChannel)) {
                countMap.put(orderChannel, 0);
            }
            countMap.put(orderChannel,  countMap.get(orderChannel)+1);
            countMap.put(orderChannel, countMap.get(orderChannel) + 1);
            if(!moneyMap.containsKey(orderChannel)){
            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();
        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());
@@ -419,7 +437,7 @@
        } catch (KeyOrderException e) {
            // 抖音订单未验证通过,匹配金额
            // 验证提交的金额是否正确
            Set<String> moneySet =payMoneySettingService.listAllMoneyAsStr();
            Set<String> moneySet = payMoneySettingService.listAllMoneyAsStr();
            // 匹配金额
            if (!moneySet.contains(money)) {
                throw new KeyVerifyException(KeyVerifyException.CODE_KEY_MONEY_NOT_MATCH, String.format("金额未在系统设置中:%s", money));
@@ -446,9 +464,9 @@
    @Override
    public long countUserNotDoOrder(Long uid, Date minCreateTime) {
        KeyOrderMapper.DaoQuery daoQuery=new KeyOrderMapper.DaoQuery();
        KeyOrderMapper.DaoQuery daoQuery = new KeyOrderMapper.DaoQuery();
        daoQuery.uid = uid;
        daoQuery.stateList=Arrays.asList(new Integer[]{KeyOrder.STATE_NOT_PROCESS,KeyOrder.STATE_NOT_PAY});
        daoQuery.stateList = Arrays.asList(new Integer[]{KeyOrder.STATE_NOT_PROCESS, KeyOrder.STATE_NOT_PAY});
        daoQuery.minCreateTime = minCreateTime;
        return keyOrderMapper.count(daoQuery);
    }
@@ -456,7 +474,7 @@
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void rejectPay(String id, String rejectMsg) {
        KeyOrder keyOrder=new KeyOrder();
        KeyOrder keyOrder = new KeyOrder();
        keyOrder.setId(id);
        keyOrder.setState(KeyOrder.STATE_REJECT_PAY);
        keyOrder.setStateDesc(rejectMsg);
src/main/java/com/taoke/autopay/service/impl/WxUserServiceImpl.java
@@ -94,4 +94,9 @@
        wxUserInfo.setUpdateTime(new Date());
        wxUserInfoMapper.updateByPrimaryKeySelective(wxUserInfo);
    }
    @Override
    public void update(WxUserInfo wxUserInfo) {
        wxUserInfoMapper.updateByPrimaryKeySelective(wxUserInfo);
    }
}
src/main/java/com/taoke/autopay/task/KeyOrderDistributeTask.java
@@ -2,9 +2,11 @@
import com.taoke.autopay.dao.KeyOrderMapper;
import com.taoke.autopay.dto.DYOrderDto;
import com.taoke.autopay.entity.ClientInfo;
import com.taoke.autopay.entity.KeyOrder;
import com.taoke.autopay.exception.KeyOrderException;
import com.taoke.autopay.manager.OrderPayFailProcessor;
import com.taoke.autopay.service.ClientInfoService;
import com.taoke.autopay.service.KeyOrderService;
import com.taoke.autopay.utils.Constant;
import com.taoke.autopay.utils.StringUtil;
@@ -110,16 +112,47 @@
    private OrderPayFailProcessor orderPayFailProcessor;
    @Scheduled(cron = "0/5 * * * * ? ")
    private void processPayFail(){
        for(int i=0;i<10;i++) {
    private void processPayFail() {
        for (int i = 0; i < 10; i++) {
            // 一次最多处理10条数据
            orderPayFailProcessor.processFromQueue();
        }
    }
    @Scheduled(cron = "0 0 3 * * ? ")
    private void clearProcessPayFailCache(){
    private void clearProcessPayFailCache() {
        orderPayFailProcessor.clearCacheData();
    }
    @Resource
    private ClientInfoService clientInfoService;
    // 处理设备下线
    @Scheduled(cron = "0 0/1 * * * ? ")
    private void processPayClientOffLine() {
        KeyOrderMapper.DaoQuery daoQuery = new KeyOrderMapper.DaoQuery();
        // 分配时间在最近5分钟到最近30分钟的,状态为未处理的需要重新分配
        daoQuery.stateList = Arrays.asList(new Integer[]{KeyOrder.STATE_NOT_PAY, KeyOrder.STATE_NOT_PROCESS});
        daoQuery.minDistributeTime = new Date(System.currentTimeMillis() - 1000 * 60 * 30L);
        daoQuery.maxDistributeTime = new Date(System.currentTimeMillis() - 1000 * 60 * 5L);
        daoQuery.sortList = Arrays.asList(new String[]{"create_time desc"});
        daoQuery.count = 10;
        List<KeyOrder> orderList = keyOrderService.list(daoQuery);
        for (KeyOrder order : orderList) {
            // 查询设备活跃时间是否已经有5分钟未活跃
            if (order.getDistributeClientUid() == null) {
                continue;
            }
            ClientInfo clientInfo = clientInfoService.selectByPrimaryKey(order.getDistributeClientUid());
            if (clientInfo.getActiveTime()==null||System.currentTimeMillis() - clientInfo.getActiveTime().getTime() < 1000 * 60 * 5L) {
                continue;
            }
            // 重新分配
            keyOrderService.removeDistributedClient(order.getId());
        }
    }
}
src/main/java/com/taoke/autopay/vo/WxUserVO.java
@@ -21,4 +21,5 @@
    private String portrait;
    private String ip;
    private IPUtil.IPInfo ipInfo;
    private Integer status;
}
src/main/java/com/taoke/autopay/vo/admin/AdminChannelAgentVO.java
@@ -30,5 +30,6 @@
    private String maxPayMoneyPerDay;
    private Date createTime;
    private String shareRatioInfos;
    private String shieldedAreas;
}
src/main/java/com/taoke/autopay/vo/admin/AdminOrderVO.java
@@ -41,4 +41,5 @@
    private String payMerchant;
    private String ip;
    private IPUtil.IPInfo ipInfo;
    private Boolean ignore;
}
src/main/java/com/taoke/autopay/vo/admin/IgnoreAgentOrderSettingVO.java
New file
@@ -0,0 +1,15 @@
package com.taoke.autopay.vo.admin;
import lombok.Data;
/**
 * 代理订单忽略设置
 */
@Data
public class IgnoreAgentOrderSettingVO {
   // 起始单数
    private int beginCount;
    // 忽略比例
    private int percent;
}
src/main/java/com/taoke/autopay/vo/admin/OrderSearchVO.java
@@ -16,5 +16,6 @@
    private String orderChannel;
    private String startDate;
    private String endDate;
    private Boolean ignore;
}
src/main/resources/mapper/ChannelAgentMapper.xml
@@ -1,146 +1,111 @@
<?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.agent.ChannelAgentMapper">
    <resultMap id="BaseResultMap" type="com.taoke.autopay.entity.agent.ChannelAgent">
        <id column="_id" property="id" jdbcType="BIGINT"/>
        <result column="_name" property="name" jdbcType="VARCHAR"/>
        <result column="_alias" property="alias" jdbcType="VARCHAR"/>
        <result column="_account" property="account" jdbcType="VARCHAR"/>
        <result column="_pwd" property="pwd" jdbcType="VARCHAR"/>
        <result column="_alipay_name" property="alipayName" jdbcType="VARCHAR"/>
        <result column="_alipay_account" property="alipayAccount" jdbcType="VARCHAR"/>
        <result column="_alipay_update_time" property="alipayUpdateTime" jdbcType="TIMESTAMP"/>
        <result column="_status" property="status" jdbcType="INTEGER"/>
        <result column="_status_desc" property="statusDesc" 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
    ,_name,_alias,_account,_pwd,_alipay_name,_alipay_account,_alipay_update_time,_status,_status_desc,_create_time,_update_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>
        from table_agent where _id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>
        from table_agent where _id = #{id,jdbcType=BIGINT} for update
    </select>
    <sql id="listWhereSQL">
        <if test="query.id!=null">AND _id = #{query.id}</if>
        <if test="query.searchKey!=null">AND (_name like '%${query.searchKey}%' or _alias = #{query.searchKey} )</if>
        <if test="query.name!=null">AND _name like '%${query.name}%'</if>
        <if test="query.alias!=null">AND _alias = #{query.alias}</if>
        <if test="query.account!=null">AND _account = #{query.account}</if>
        <if test="query.pwd!=null">AND _pwd = #{query.pwd}</if>
        <if test="query.alipayName!=null">AND _alipay_name = #{query.alipayName}</if>
        <if test="query.alipayAccount!=null">AND _alipay_account = #{query.alipayAccount}</if>
        <if test="query.minAlipayUpdateTime!=null">AND _alipay_update_time >= #{query.minAlipayUpdateTime}</if>
        <if test="query.maxAlipayUpdateTime!=null">AND #{query.maxAlipayUpdateTime} > _alipay_update_time</if>
        <if test="query.status!=null">AND _status = #{query.status}</if>
        <if test="query.statusDesc!=null">AND _status_desc = #{query.statusDesc}</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_agent 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="listByIds" resultMap="BaseResultMap">select
        <include refid="Base_Column_List"/>
        from table_agent where 1=1
        <foreach collection="ids" item="item" open=" AND (" close=")" separator=" or ">
            _id=#{item}
        </foreach>
    </select>
    <select id="count" resultType="java.lang.Long">select count(*) from table_agent where 1=1
        <include refid="listWhereSQL"/>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete
                                                                   from table_agent
                                                                   where _id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.taoke.autopay.entity.agent.ChannelAgent" useGeneratedKeys="true"
            keyProperty="id">insert into table_agent (_id, _name, _alias, _account, _pwd, _alipay_name, _alipay_account,
                                                      _alipay_update_time, _status, _status_desc, _create_time,
                                                      _update_time)
                             values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR},
                                     #{account,jdbcType=VARCHAR}, #{pwd,jdbcType=VARCHAR},
                                     #{alipayName,jdbcType=VARCHAR}, #{alipayAccount,jdbcType=VARCHAR},
                                     #{alipayUpdateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER},
                                     #{statusDesc,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
                                     #{updateTime,jdbcType=TIMESTAMP})</insert>
    <insert id="insertSelective" parameterType="com.taoke.autopay.entity.agent.ChannelAgent" useGeneratedKeys="true"
            keyProperty="id">insert into table_agent
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">_id,</if>
            <if test="name != null">_name,</if>
            <if test="alias != null">_alias,</if>
            <if test="account != null">_account,</if>
            <if test="pwd != null">_pwd,</if>
            <if test="alipayName != null">_alipay_name,</if>
            <if test="alipayAccount != null">_alipay_account,</if>
            <if test="alipayUpdateTime != null">_alipay_update_time,</if>
            <if test="status != null">_status,</if>
            <if test="statusDesc != null">_status_desc,</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="name != null">#{name,jdbcType=VARCHAR},</if>
            <if test="alias != null">#{alias,jdbcType=VARCHAR},</if>
            <if test="account != null">#{account,jdbcType=VARCHAR},</if>
            <if test="pwd != null">#{pwd,jdbcType=VARCHAR},</if>
            <if test="alipayName != null">#{alipayName,jdbcType=VARCHAR},</if>
            <if test="alipayAccount != null">#{alipayAccount,jdbcType=VARCHAR},</if>
            <if test="alipayUpdateTime != null">#{alipayUpdateTime,jdbcType=TIMESTAMP},</if>
            <if test="status != null">#{status,jdbcType=INTEGER},</if>
            <if test="statusDesc != null">#{statusDesc,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.agent.ChannelAgent">update table_agent
                                                                                                set _name               = #{name,jdbcType=VARCHAR},
                                                                                                    _alias              = #{alias,jdbcType=VARCHAR},
                                                                                                    _account            = #{account,jdbcType=VARCHAR},
                                                                                                    _pwd                = #{pwd,jdbcType=VARCHAR},
                                                                                                    _alipay_name        = #{alipayName,jdbcType=VARCHAR},
                                                                                                    _alipay_account     = #{alipayAccount,jdbcType=VARCHAR},
                                                                                                    _alipay_update_time = #{alipayUpdateTime,jdbcType=TIMESTAMP},
                                                                                                    _status             = #{status,jdbcType=INTEGER},
                                                                                                    _status_desc        = #{statusDesc,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.agent.ChannelAgent">update
        table_agent
        <set>
            <if test="name != null">_name=#{name,jdbcType=VARCHAR},</if>
            <if test="alias != null">_alias=#{alias,jdbcType=VARCHAR},</if>
            <if test="account != null">_account=#{account,jdbcType=VARCHAR},</if>
            <if test="pwd != null">_pwd=#{pwd,jdbcType=VARCHAR},</if>
            <if test="alipayName != null">_alipay_name=#{alipayName,jdbcType=VARCHAR},</if>
            <if test="alipayAccount != null">_alipay_account=#{alipayAccount,jdbcType=VARCHAR},</if>
            <if test="alipayUpdateTime != null">_alipay_update_time=#{alipayUpdateTime,jdbcType=TIMESTAMP},</if>
            <if test="status != null">_status=#{status,jdbcType=INTEGER},</if>
            <if test="statusDesc != null">_status_desc=#{statusDesc,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 namespace="com.taoke.autopay.dao.agent.ChannelAgentMapper">
  <resultMap id="BaseResultMap" type="com.taoke.autopay.entity.agent.ChannelAgent">
    <id column="_id" property="id" jdbcType="BIGINT"/>
    <result column="_name" property="name" jdbcType="VARCHAR"/>
    <result column="_alias" property="alias" jdbcType="VARCHAR"/>
    <result column="_account" property="account" jdbcType="VARCHAR"/>
    <result column="_pwd" property="pwd" jdbcType="VARCHAR"/>
    <result column="_alipay_name" property="alipayName" jdbcType="VARCHAR"/>
    <result column="_alipay_account" property="alipayAccount" jdbcType="VARCHAR"/>
    <result column="_alipay_update_time" property="alipayUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="_status" property="status" jdbcType="INTEGER"/>
    <result column="_status_desc" property="statusDesc" jdbcType="VARCHAR"/>
    <result column="_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="_id" property="id" jdbcType="BIGINT"/>
    <result column="_shielded_areas" property="shieldedAreas" jdbcType="VARCHAR"/>
  </resultMap>
  <sql id="Base_Column_List">_id ,_name,_alias,_account,_pwd,_alipay_name,_alipay_account,_alipay_update_time,_status,_status_desc,_create_time,_update_time,_shielded_areas</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/> from table_agent where _id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/> from table_agent where _id = #{id,jdbcType=BIGINT} for update
  </select>
  <sql id="listWhereSQL">
    <if test="query.id!=null">AND _id = #{query.id}</if>
    <if test="query.searchKey!=null">AND (_name like '%${query.searchKey}%' or _alias = #{query.searchKey} )</if>
    <if test="query.name!=null">AND _name like '%${query.name}%'</if>
    <if test="query.alias!=null">AND _alias = #{query.alias}</if>
    <if test="query.account!=null">AND _account = #{query.account}</if>
    <if test="query.pwd!=null">AND _pwd = #{query.pwd}</if>
    <if test="query.alipayName!=null">AND _alipay_name = #{query.alipayName}</if>
    <if test="query.alipayAccount!=null">AND _alipay_account = #{query.alipayAccount}</if>
    <if test="query.minAlipayUpdateTime!=null">AND _alipay_update_time &gt;= #{query.minAlipayUpdateTime}</if>
    <if test="query.maxAlipayUpdateTime!=null">AND #{query.maxAlipayUpdateTime} &gt; _alipay_update_time</if>
    <if test="query.status!=null">AND _status = #{query.status}</if>
    <if test="query.statusDesc!=null">AND _status_desc = #{query.statusDesc}</if>
    <if test="query.minCreateTime!=null">AND _create_time &gt;= #{query.minCreateTime}</if>
    <if test="query.maxCreateTime!=null">AND #{query.maxCreateTime} &gt; _create_time</if>
    <if test="query.minUpdateTime!=null">AND _update_time &gt;= #{query.minUpdateTime}</if>
    <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} &gt; _update_time</if>
  </sql>
  <select id="list" resultMap="BaseResultMap">select
    <include refid="Base_Column_List"/> from table_agent 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="listByIds" resultMap="BaseResultMap">select
    <include refid="Base_Column_List"/> from table_agent where 1=1
    <foreach collection="ids" item="item" open=" AND (" close=")" separator=" or ">_id=#{item}</foreach>
  </select>
  <select id="count" resultType="java.lang.Long">select count(*) from table_agent where 1=1
    <include refid="listWhereSQL"/>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_agent where _id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.taoke.autopay.entity.agent.ChannelAgent" useGeneratedKeys="true" keyProperty="id">insert into table_agent (_id, _name, _alias, _account, _pwd, _alipay_name, _alipay_account, _alipay_update_time, _status, _status_desc, _create_time, _update_time,_id,_shielded_areas) values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR}, #{account,jdbcType=VARCHAR}, #{pwd,jdbcType=VARCHAR}, #{alipayName,jdbcType=VARCHAR}, #{alipayAccount,jdbcType=VARCHAR}, #{alipayUpdateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{statusDesc,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{shieldedAreas,jdbcType=VARCHAR})</insert>
  <insert id="insertSelective" parameterType="com.taoke.autopay.entity.agent.ChannelAgent" useGeneratedKeys="true" keyProperty="id">insert into table_agent
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">_id,</if>
      <if test="name != null">_name,</if>
      <if test="alias != null">_alias,</if>
      <if test="account != null">_account,</if>
      <if test="pwd != null">_pwd,</if>
      <if test="alipayName != null">_alipay_name,</if>
      <if test="alipayAccount != null">_alipay_account,</if>
      <if test="alipayUpdateTime != null">_alipay_update_time,</if>
      <if test="status != null">_status,</if>
      <if test="statusDesc != null">_status_desc,</if>
      <if test="createTime != null">_create_time,</if>
      <if test="updateTime != null">_update_time,</if>
      <if test="shieldedAreas != null">_shielded_areas,</if>
    </trim> values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="alias != null">#{alias,jdbcType=VARCHAR},</if>
      <if test="account != null">#{account,jdbcType=VARCHAR},</if>
      <if test="pwd != null">#{pwd,jdbcType=VARCHAR},</if>
      <if test="alipayName != null">#{alipayName,jdbcType=VARCHAR},</if>
      <if test="alipayAccount != null">#{alipayAccount,jdbcType=VARCHAR},</if>
      <if test="alipayUpdateTime != null">#{alipayUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="status != null">#{status,jdbcType=INTEGER},</if>
      <if test="statusDesc != null">#{statusDesc,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
      <if test="shieldedAreas != null">#{shieldedAreas,jdbcType=VARCHAR}</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.agent.ChannelAgent">update table_agent set _name = #{name,jdbcType=VARCHAR}, _alias = #{alias,jdbcType=VARCHAR}, _account = #{account,jdbcType=VARCHAR}, _pwd = #{pwd,jdbcType=VARCHAR}, _alipay_name = #{alipayName,jdbcType=VARCHAR}, _alipay_account = #{alipayAccount,jdbcType=VARCHAR}, _alipay_update_time = #{alipayUpdateTime,jdbcType=TIMESTAMP}, _status = #{status,jdbcType=INTEGER}, _status_desc = #{statusDesc,jdbcType=VARCHAR}, _create_time = #{createTime,jdbcType=TIMESTAMP}, _update_time = #{updateTime,jdbcType=TIMESTAMP} ,_shielded_areas =#{shieldedAreas,jdbcType=VARCHAR}, where _id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.agent.ChannelAgent">update table_agent
    <set>
      <if test="name != null">_name=#{name,jdbcType=VARCHAR},</if>
      <if test="alias != null">_alias=#{alias,jdbcType=VARCHAR},</if>
      <if test="account != null">_account=#{account,jdbcType=VARCHAR},</if>
      <if test="pwd != null">_pwd=#{pwd,jdbcType=VARCHAR},</if>
      <if test="alipayName != null">_alipay_name=#{alipayName,jdbcType=VARCHAR},</if>
      <if test="alipayAccount != null">_alipay_account=#{alipayAccount,jdbcType=VARCHAR},</if>
      <if test="alipayUpdateTime != null">_alipay_update_time=#{alipayUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="status != null">_status=#{status,jdbcType=INTEGER},</if>
      <if test="statusDesc != null">_status_desc=#{statusDesc,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="shieldedAreas !=null">_shielded_areas =#{shieldedAreas,jdbcType=VARCHAR},</if>
    </set> where _id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
src/main/resources/mapper/KeyOrderMapper.xml
@@ -1,283 +1,209 @@
<?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.KeyOrderMapper">
    <resultMap id="BaseResultMap" type="com.taoke.autopay.entity.KeyOrder">
        <id column="id" property="id" jdbcType="VARCHAR"/>
        <result column="uid" property="uid" jdbcType="BIGINT"/>
        <result column="key" property="key" jdbcType="VARCHAR"/>
        <result column="order_type" property="orderType" jdbcType="INTEGER"/>
        <result column="order_no" property="orderNo" jdbcType="VARCHAR"/>
        <result column="order_state" property="orderState" jdbcType="INTEGER"/>
        <result column="state" property="state" jdbcType="INTEGER"/>
        <result column="state_desc" property="stateDesc" jdbcType="VARCHAR"/>
        <result column="distribute_client_uid" property="distributeClientUid" jdbcType="BIGINT"/>
        <result column="distribute_time" property="distributeTime" jdbcType="TIMESTAMP"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="excute_pay_time" property="excutePayTime" jdbcType="TIMESTAMP"/>
        <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/>
        <result column="order_money" property="orderMoney" jdbcType="DECIMAL"/>
        <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"/>
        <result column="ip" property="ip" jdbcType="VARCHAR"/>
        <result column="ip_info" property="ipInfo" jdbcType="VARCHAR"/>
        <association property="user" javaType="com.taoke.autopay.entity.WxUserInfo">
            <id column="uid" property="id" jdbcType="BIGINT"/>
            <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
            <result column="portrait" property="portrait" jdbcType="VARCHAR"/>
        </association>
    </resultMap>
    <resultMap id="DistributeResultMap" type="com.taoke.autopay.entity.OrderDistributeCountInfo">
        <result column="uid" property="uid" jdbcType="BIGINT"/>
        <result column="count" property="count" jdbcType="INTEGER"/>
    </resultMap>
    <resultMap id="ChannelOrderStatisticMap" type="com.taoke.autopay.dto.ChannelOrderStatistic">
        <result column="order_channel" property="orderChannel" jdbcType="VARCHAR"/>
        <result column="count" property="count" jdbcType="BIGINT"/>
        <result column="money" property="money" jdbcType="DECIMAL"/>
    </resultMap>
    <sql id="Base_Column_List">id
    ,uid,`key`,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,excute_pay_time,pay_time,order_money,order_channel,pay_type,agent_id,pay_merchant,ip,ip_info</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>
        from table_order where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.String">select
        <include refid="Base_Column_List"/>
        from table_order where id = #{id,jdbcType=VARCHAR} for update
    </select>
    <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.String">select
        <include refid="Base_Column_List"/>
        from table_order where id = #{id,jdbcType=VARCHAR}
    </select>
    <sql id="listWhereSQL">
        <if test="query.id!=null">AND id = #{query.id}</if>
        <if test="query.key!=null">AND `key` = #{query.key}</if>
        <if test="query.uid!=null">AND uid = #{query.uid}</if>
        <if test="query.orderType!=null">AND order_type = #{query.orderType}</if>
        <if test="query.orderNo!=null">AND order_no = #{query.orderNo}</if>
        <if test="query.orderState!=null">AND order_state = #{query.orderState}</if>
        <if test="query.state!=null">AND state = #{query.state}</if>
        <if test="query.hasPayTime!=null">AND pay_time is not null</if>
        <if test="query.hasAgentId!=null">AND agent_id is not null</if>
        <if test="query.agentId!=null">AND agent_id = #{query.agentId}</if>
        <if test="query.orderChannel!=null">AND order_channel = #{query.orderChannel}</if>
<mapper namespace="com.taoke.autopay.dao.KeyOrderMapper">
  <resultMap id="BaseResultMap" type="com.taoke.autopay.entity.KeyOrder">
    <id column="id" property="id" jdbcType="VARCHAR"/>
    <result column="uid" property="uid" jdbcType="BIGINT"/>
    <result column="key" property="key" jdbcType="VARCHAR"/>
    <result column="order_type" property="orderType" jdbcType="INTEGER"/>
    <result column="order_no" property="orderNo" jdbcType="VARCHAR"/>
    <result column="order_state" property="orderState" jdbcType="INTEGER"/>
    <result column="state" property="state" jdbcType="INTEGER"/>
    <result column="state_desc" property="stateDesc" jdbcType="VARCHAR"/>
    <result column="distribute_client_uid" property="distributeClientUid" jdbcType="BIGINT"/>
    <result column="distribute_time" property="distributeTime" jdbcType="TIMESTAMP"/>
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="excute_pay_time" property="excutePayTime" jdbcType="TIMESTAMP"/>
    <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/>
    <result column="order_money" property="orderMoney" jdbcType="DECIMAL"/>
    <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"/>
    <result column="ip" property="ip" jdbcType="VARCHAR"/>
    <result column="ip_info" property="ipInfo" jdbcType="VARCHAR"/>
    <result column="`ignore`" property="ignore" jdbcType="BOOLEAN"/>
    <result column="sub_state" property="subState" jdbcType="INTEGER"/>
    <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="portrait" property="portrait" jdbcType="VARCHAR"/>
    </association>
        <if test="query.stateList!=null">
            <foreach collection="query.stateList" item="state" separator=" or " open=" AND (" close=") ">state =
                #{state}
            </foreach>
        </if>
        <if test="query.stateDesc!=null">AND state_desc = #{query.stateDesc}</if>
        <if test="query.distributeClientUid!=null">AND distribute_client_uid = #{query.distributeClientUid}</if>
        <if test="query.minDistributeTime!=null">AND distribute_time &gt;= #{query.minDistributeTime}</if>
        <if test="query.maxDistributeTime!=null">AND #{query.maxDistributeTime} &gt; distribute_time</if>
        <if test="query.minCreateTime!=null">AND create_time &gt;= #{query.minCreateTime}</if>
        <if test="query.maxCreateTime!=null">AND #{query.maxCreateTime} &gt; create_time</if>
        <if test="query.oMinCreateTime!=null">AND o.create_time &gt;= #{query.oMinCreateTime}</if>
        <if test="query.oMaxCreateTime!=null">AND #{query.oMaxCreateTime} &gt; o.create_time</if>
        <if test="query.minUpdateTime!=null">AND update_time &gt;= #{query.minUpdateTime}</if>
        <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} &gt; update_time</if>
        <if test="query.nickName!=null">AND u.nick_name like '%${query.nickName}%' </if>
    </sql>
    <select id="list" resultMap="BaseResultMap">select
        <include refid="Base_Column_List"/>
        from table_order 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="listWithUser" resultMap="BaseResultMap">
        select
        o.*, u.portrait, u.nick_name from table_order o left join table_wx_user u on u.id = o.uid 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_order where 1=1
        <include refid="listWhereSQL"/>
    </select>
    <select id="countWithUser" resultType="java.lang.Long">select count(*) from table_order o left join table_wx_user u
        on u.id = o.uid where 1=1
        <include refid="listWhereSQL"/>
    </select>
    <select id="countUser" resultType="java.lang.Long">select count(distinct(u.id)) from table_order o left join
        table_wx_user u on u.id = o.uid where 1=1
        <include refid="listWhereSQL"/>
    </select>
    <select id="statisticChannelOrders" resultMap="ChannelOrderStatisticMap">
        select
        order_channel, count(o.id) as count, sum(order_money) as money from table_order o left join table_wx_user u on u.id =
        o.uid where 1=1
        <include refid="listWhereSQL"/>
        group by order_channel
    </select>
    <select id="listAgentId" resultType="java.lang.Long">
        select
        distinct(agent_id) from table_order o 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="countAgentId" resultType="java.lang.Long">
        select
        count(distinct(agent_id)) from table_order o where 1=1
        <include refid="listWhereSQL"/>
        <if test="query.sortList!=null">
            <foreach collection="query.sortList" item="item" open=" order by " separator=",">${item}</foreach>
        </if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete
                                                                   from table_order
                                                                   where id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true"
            keyProperty="id">insert into table_order (id, uid, key, order_type, order_no, order_state, state,
                                                      state_desc, distribute_client_uid, distribute_time, create_time,
                                                      update_time, id, excute_pay_time, pay_time, order_money,
                                                      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},
                                     #{stateDesc,jdbcType=VARCHAR}, #{distributeClientUid,jdbcType=BIGINT},
                                     #{distributeTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
                                     #{updateTime,jdbcType=TIMESTAMP}, #{id,jdbcType=VARCHAR},
                                     #{excutePayTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP},
                                     #{orderMoney,jdbcType=DECIMAL}, #{orderChannel,jdbcType=VARCHAR},
                                     #{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="id != null">id,</if>
            <if test="uid != null">uid,</if>
            <if test="key != null">`key`,</if>
            <if test="orderType != null">order_type,</if>
            <if test="orderNo != null">order_no,</if>
            <if test="orderState != null">order_state,</if>
            <if test="state != null">state,</if>
            <if test="stateDesc != null">state_desc,</if>
            <if test="distributeClientUid != null">distribute_client_uid,</if>
            <if test="distributeTime != null">distribute_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="excutePayTime != null">excute_pay_time,</if>
            <if test="payTime != null">pay_time,</if>
            <if test="orderMoney != null">order_money,</if>
            <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>
            <if test="ip!=null">ip,</if>
            <if test="ipInfo!=null">ip_info,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=VARCHAR},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="key != null">#{key,jdbcType=VARCHAR},</if>
            <if test="orderType != null">#{orderType,jdbcType=INTEGER},</if>
            <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
            <if test="orderState != null">#{orderState,jdbcType=INTEGER},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="distributeClientUid != null">#{distributeClientUid,jdbcType=BIGINT},</if>
            <if test="distributeTime != null">#{distributeTime,jdbcType=TIMESTAMP},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="excutePayTime != null">#{excutePayTime,jdbcType=TIMESTAMP},</if>
            <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if>
            <if test="orderMoney != null">#{orderMoney,jdbcType=DECIMAL},</if>
            <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>
            <if test="ip != null">#{ip,jdbcType=VARCHAR},</if>
            <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order
                                                                                      set uid                   = #{uid,jdbcType=BIGINT},
                                                                                          `key`                 = #{key,jdbcType=VARCHAR},
                                                                                          order_type            = #{orderType,jdbcType=INTEGER},
                                                                                          order_no              = #{orderNo,jdbcType=VARCHAR},
                                                                                          order_state           = #{orderState,jdbcType=INTEGER},
                                                                                          state                 = #{state,jdbcType=INTEGER},
                                                                                          state_desc            = #{stateDesc,jdbcType=VARCHAR},
                                                                                          distribute_client_uid = #{distributeClientUid,jdbcType=BIGINT},
                                                                                          distribute_time       = #{distributeTime,jdbcType=TIMESTAMP},
                                                                                          create_time           = #{createTime,jdbcType=TIMESTAMP},
                                                                                          update_time           = #{updateTime,jdbcType=TIMESTAMP},
                                                                                          excute_pay_time       =#{excutePayTime,jdbcType=TIMESTAMP},
                                                                                          pay_time              =#{payTime,jdbcType=TIMESTAMP},
                                                                                          order_money           =#{orderMoney,jdbcType=DECIMAL},
                                                                                          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="uid != null">uid=#{uid,jdbcType=BIGINT},</if>
            <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
            <if test="orderType != null">order_type=#{orderType,jdbcType=INTEGER},</if>
            <if test="orderNo != null">order_no=#{orderNo,jdbcType=VARCHAR},</if>
            <if test="orderState != null">order_state=#{orderState,jdbcType=INTEGER},</if>
            <if test="state != null">state=#{state,jdbcType=INTEGER},</if>
            <if test="stateDesc != null">state_desc=#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="distributeClientUid != null">distribute_client_uid=#{distributeClientUid,jdbcType=BIGINT},</if>
            <if test="distributeTime != null">distribute_time=#{distributeTime,jdbcType=TIMESTAMP},</if>
            <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="excutePayTime !=null">excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP},</if>
            <if test="payTime !=null">pay_time =#{payTime,jdbcType=TIMESTAMP},</if>
            <if test="orderMoney !=null">order_money =#{orderMoney,jdbcType=DECIMAL},</if>
            <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>
    <select id="listDistributeUids" resultMap="DistributeResultMap">SELECT u.`id` as uid, IF( a.count IS NULL,0,a.count)
        AS `count` FROM `table_user` u LEFT JOIN (SELECT o.`distribute_client_uid` AS uid,COUNT(*) AS `count` FROM
        `table_order` o WHERE o.`state` = 0 and create_time &gt; #{minKeyOrderCreateTime} GROUP BY
        o.`distribute_client_uid`) a ON a.uid = u.`id` WHERE rule=0
        <if test="minActiveTime!=null">and active_time &gt;=#{minActiveTime}</if>
    </select>
    <select id="listNotDistributed" resultMap="BaseResultMap">select
        <include refid="Base_Column_List"/>
        from table_order where distribute_client_uid is null and state=0 limit #{start},#{count}
    </select>
    <delete id="deleteAll" parameterType="java.util.Date">delete
                                                          from table_order
                                                          where #{maxCreateTime} &gt;= create_time</delete>
    <update id="removeDistributedClient" parameterType="java.lang.String">
        update table_order
        set distribute_client_uid = null
        where id = #{0}
    </update>
  </resultMap>
  <resultMap id="DistributeResultMap" type="com.taoke.autopay.entity.OrderDistributeCountInfo">
    <result column="uid" property="uid" jdbcType="BIGINT"/>
    <result column="count" property="count" jdbcType="INTEGER"/>
  </resultMap>
  <resultMap id="ChannelOrderStatisticMap" type="com.taoke.autopay.dto.ChannelOrderStatistic">
    <result column="order_channel" property="orderChannel" jdbcType="VARCHAR"/>
    <result column="count" property="count" jdbcType="BIGINT"/>
    <result column="money" property="money" jdbcType="DECIMAL"/>
  </resultMap>
  <sql id="Base_Column_List">id ,uid,`key`,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,excute_pay_time,pay_time,order_money,order_channel,pay_type,agent_id,pay_merchant,ip,ip_info,`ignore`,sub_state</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/> from table_order where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.String">select
    <include refid="Base_Column_List"/> from table_order where id = #{id,jdbcType=VARCHAR} for update
  </select>
  <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.String">select
    <include refid="Base_Column_List"/> from table_order where id = #{id,jdbcType=VARCHAR}
  </select>
  <sql id="listWhereSQL">
    <if test="query.id!=null">AND id = #{query.id}</if>
    <if test="query.key!=null">AND `key` = #{query.key}</if>
    <if test="query.uid!=null">AND uid = #{query.uid}</if>
    <if test="query.orderType!=null">AND order_type = #{query.orderType}</if>
    <if test="query.orderNo!=null">AND order_no = #{query.orderNo}</if>
    <if test="query.orderState!=null">AND order_state = #{query.orderState}</if>
    <if test="query.state!=null">AND state = #{query.state}</if>
    <if test="query.hasPayTime!=null">AND pay_time is not null</if>
    <if test="query.hasAgentId!=null">AND agent_id is not null</if>
    <if test="query.agentId!=null">AND agent_id = #{query.agentId}</if>
    <if test="query.orderChannel!=null">AND order_channel = #{query.orderChannel}</if>
    <if test="query.stateList!=null">
      <foreach collection="query.stateList" item="state" separator=" or " open=" AND (" close=") ">state = #{state}</foreach>
    </if>
    <if test="query.stateDesc!=null">AND state_desc = #{query.stateDesc}</if>
    <if test="query.distributeClientUid!=null">AND distribute_client_uid = #{query.distributeClientUid}</if>
    <if test="query.minDistributeTime!=null">AND distribute_time &gt;= #{query.minDistributeTime}</if>
    <if test="query.maxDistributeTime!=null">AND #{query.maxDistributeTime} &gt; distribute_time</if>
    <if test="query.minCreateTime!=null">AND create_time &gt;= #{query.minCreateTime}</if>
    <if test="query.maxCreateTime!=null">AND #{query.maxCreateTime} &gt; create_time</if>
    <if test="query.oMinCreateTime!=null">AND o.create_time &gt;= #{query.oMinCreateTime}</if>
    <if test="query.oMaxCreateTime!=null">AND #{query.oMaxCreateTime} &gt; o.create_time</if>
    <if test="query.minUpdateTime!=null">AND update_time &gt;= #{query.minUpdateTime}</if>
    <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} &gt; update_time</if>
    <if test="query.nickName!=null">AND u.nick_name like '%${query.nickName}%'</if>
    <if test="query.ignore!=null">AND `ignore` =#{query.ignore}</if>
  </sql>
  <select id="list" resultMap="BaseResultMap">select
    <include refid="Base_Column_List"/> from table_order 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="listWithUser" resultMap="BaseResultMap">select o.*, u.portrait, u.nick_name from table_order o left join table_wx_user u on u.id = o.uid 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_order where 1=1
    <include refid="listWhereSQL"/>
  </select>
  <select id="countWithUser" resultType="java.lang.Long">select count(*) from table_order o left join table_wx_user u on u.id = o.uid where 1=1
    <include refid="listWhereSQL"/>
  </select>
  <select id="countUser" resultType="java.lang.Long">select count(distinct(u.id)) from table_order o left join table_wx_user u on u.id = o.uid where 1=1
    <include refid="listWhereSQL"/>
  </select>
  <select id="statisticChannelOrders" resultMap="ChannelOrderStatisticMap">select order_channel, count(o.id) as count, sum(order_money) as money from table_order o left join table_wx_user u on u.id = o.uid where 1=1
    <include refid="listWhereSQL"/> group by order_channel
  </select>
  <select id="listAgentId" resultType="java.lang.Long">select distinct(agent_id) from table_order o 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="countAgentId" resultType="java.lang.Long">select count(distinct(agent_id)) from table_order o where 1=1
    <include refid="listWhereSQL"/>
    <if test="query.sortList!=null">
      <foreach collection="query.sortList" item="item" open=" order by " separator=",">${item}</foreach>
    </if>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_order where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true" keyProperty="id">insert into table_order (id, uid, key, order_type, order_no, order_state, state, state_desc, distribute_client_uid, distribute_time, create_time, update_time, id, excute_pay_time, pay_time, order_money, order_channel, pay_type, agent_id,pay_merchant,`key`,ip,ip_info,`ignore`,sub_state) values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=BIGINT}, #{key,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{orderState,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, #{stateDesc,jdbcType=VARCHAR}, #{distributeClientUid,jdbcType=BIGINT}, #{distributeTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{id,jdbcType=VARCHAR}, #{excutePayTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{orderMoney,jdbcType=DECIMAL}, #{orderChannel,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, #{agentId,jdbcType=BIGINT},#{payMerchant, jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{ip,jdbcType=VARCHAR},#{ipInfo,jdbcType=VARCHAR},#{ignore,jdbcType=BOOLEAN},#{subState,jdbcType=INTEGER})</insert>
  <insert id="insertSelective" parameterType="com.taoke.autopay.entity.KeyOrder" useGeneratedKeys="true" keyProperty="id">insert into table_order
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="uid != null">uid,</if>
      <if test="key != null">`key`,</if>
      <if test="orderType != null">order_type,</if>
      <if test="orderNo != null">order_no,</if>
      <if test="orderState != null">order_state,</if>
      <if test="state != null">state,</if>
      <if test="stateDesc != null">state_desc,</if>
      <if test="distributeClientUid != null">distribute_client_uid,</if>
      <if test="distributeTime != null">distribute_time,</if>
      <if test="createTime != null">create_time,</if>
      <if test="updateTime != null">update_time,</if>
      <if test="excutePayTime != null">excute_pay_time,</if>
      <if test="payTime != null">pay_time,</if>
      <if test="orderMoney != null">order_money,</if>
      <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>
      <if test="ip!=null">ip,</if>
      <if test="ipInfo!=null">ip_info,</if>
      <if test="ignore != null">`ignore`,</if>
      <if test="subState != null">sub_state,</if>
    </trim> values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=VARCHAR},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="key != null">#{key,jdbcType=VARCHAR},</if>
      <if test="orderType != null">#{orderType,jdbcType=INTEGER},</if>
      <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
      <if test="orderState != null">#{orderState,jdbcType=INTEGER},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if>
      <if test="distributeClientUid != null">#{distributeClientUid,jdbcType=BIGINT},</if>
      <if test="distributeTime != null">#{distributeTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
      <if test="excutePayTime != null">#{excutePayTime,jdbcType=TIMESTAMP},</if>
      <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if>
      <if test="orderMoney != null">#{orderMoney,jdbcType=DECIMAL},</if>
      <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>
      <if test="ip != null">#{ip,jdbcType=VARCHAR},</if>
      <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if>
      <if test="ignore != null">#{ignore,jdbcType=BOOLEAN}</if>
      <if test="subState != null">#{subState,jdbcType=INTEGER}</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order set uid = #{uid,jdbcType=BIGINT}, `key` = #{key,jdbcType=VARCHAR}, order_type = #{orderType,jdbcType=INTEGER}, order_no = #{orderNo,jdbcType=VARCHAR}, order_state = #{orderState,jdbcType=INTEGER}, state = #{state,jdbcType=INTEGER}, state_desc = #{stateDesc,jdbcType=VARCHAR}, distribute_client_uid = #{distributeClientUid,jdbcType=BIGINT}, distribute_time = #{distributeTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP}, excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP}, pay_time =#{payTime,jdbcType=TIMESTAMP}, order_money =#{orderMoney,jdbcType=DECIMAL}, order_channel =#{orderChannel,jdbcType=VARCHAR}, pay_type =#{payType,jdbcType=INTEGER}, agent_id =#{agentId,jdbcType=BIGINT}, pay_merchant =#{payMerchant,jdbcType=VARCHAR}, ip =#{ip,jdbcType=VARCHAR}, ip_info =#{ipInfo,jdbcType=VARCHAR}, ignore =#{ignore,jdbcType=BOOLEAN}, sub_state =#{subState,jdbcType=INTEGER}, where id = #{id,jdbcType=VARCHAR}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order
    <set>
      <if test="uid != null">uid=#{uid,jdbcType=BIGINT},</if>
      <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
      <if test="orderType != null">order_type=#{orderType,jdbcType=INTEGER},</if>
      <if test="orderNo != null">order_no=#{orderNo,jdbcType=VARCHAR},</if>
      <if test="orderState != null">order_state=#{orderState,jdbcType=INTEGER},</if>
      <if test="state != null">state=#{state,jdbcType=INTEGER},</if>
      <if test="stateDesc != null">state_desc=#{stateDesc,jdbcType=VARCHAR},</if>
      <if test="distributeClientUid != null">distribute_client_uid=#{distributeClientUid,jdbcType=BIGINT},</if>
      <if test="distributeTime != null">distribute_time=#{distributeTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      <if test="excutePayTime !=null">excute_pay_time =#{excutePayTime,jdbcType=TIMESTAMP},</if>
      <if test="payTime !=null">pay_time =#{payTime,jdbcType=TIMESTAMP},</if>
      <if test="orderMoney !=null">order_money =#{orderMoney,jdbcType=DECIMAL},</if>
      <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>
      <if test="ip !=null">ip =#{ip,jdbcType=VARCHAR},</if>
      <if test="ipInfo !=null">ip_info =#{ipInfo,jdbcType=VARCHAR},</if>
      <if test="ignore !=null">`ignore` =#{ignore,jdbcType=BOOLEAN},</if>
      <if test="subState !=null">sub_state =#{subState,jdbcType=INTEGER},</if>
    </set> where id = #{id,jdbcType=VARCHAR}
  </update>
  <select id="listDistributeUids" resultMap="DistributeResultMap">SELECT u.`id` as uid, IF( a.count IS NULL,0,a.count) AS `count` FROM `table_user` u LEFT JOIN (SELECT o.`distribute_client_uid` AS uid,COUNT(*) AS `count` FROM `table_order` o WHERE o.`state` = 0 and create_time &gt; #{minKeyOrderCreateTime} GROUP BY o.`distribute_client_uid`) a ON a.uid = u.`id` WHERE rule=0
    <if test="minActiveTime!=null">and active_time &gt;=#{minActiveTime}</if>
  </select>
  <select id="listNotDistributed" resultMap="BaseResultMap">select
    <include refid="Base_Column_List"/> from table_order where distribute_client_uid is null and state=0 limit #{start},#{count}
  </select>
  <delete id="deleteAll" parameterType="java.util.Date">delete from table_order where #{maxCreateTime} &gt;= create_time</delete>
  <update id="removeDistributedClient" parameterType="java.lang.String">update table_order set distribute_client_uid = null, distribute_time = null where id = #{0}</update>
</mapper>
src/main/resources/mapper/WxUserInfoMapper.xml
@@ -10,10 +10,11 @@
    <result column="login_time" property="loginTime" jdbcType="TIMESTAMP"/>  
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>  
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>  
    <result column="latest_ip" property="LatestIP" jdbcType="VARCHAR"/>
    <result column="latest_ip_info" property="latestIPInfo" jdbcType="VARCHAR"/>
    <result column="latest_ip" property="LatestIP" jdbcType="VARCHAR"/>
    <result column="latest_ip_info" property="latestIPInfo" jdbcType="VARCHAR"/>
    <result column="status" property="status" jdbcType="INTEGER"/>
  </resultMap>  
  <sql id="Base_Column_List">id,openid,nick_name,portrait,login_time,create_time,update_time,latest_ip,latest_ip_info</sql>
  <sql id="Base_Column_List">id,openid,nick_name,portrait,login_time,create_time,update_time,latest_ip,latest_ip_info,status</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select 
    <include refid="Base_Column_List"/> from table_wx_user where id = #{id,jdbcType=BIGINT}
  </select>  
@@ -24,8 +25,9 @@
    <if test="query.id!=null">AND id = #{query.id}</if>  
    <if test="query.openId!=null">AND openid = #{query.openId}</if>  
    <if test="query.nickName!=null">AND nick_name = #{query.nickName}</if>  
    <if test="query.searchKey!=null">AND (nick_name like '%${query.searchKey}%' or openid = #{query.searchKey})</if>
    <if test="query.portrait!=null">AND portrait = #{query.portrait}</if>
    <if test="query.searchKey!=null">AND (nick_name like '%${query.searchKey}%' or openid = #{query.searchKey})</if>
    <if test="query.searchArea!=null">AND (latest_ip_info like '%${query.searchArea}%')</if>
    <if test="query.portrait!=null">AND portrait = #{query.portrait}</if>
    <if test="query.minLoginTime!=null">AND login_time &gt;= #{query.minLoginTime}</if>  
    <if test="query.maxLoginTime!=null">AND #{query.maxLoginTime} &gt; login_time</if>  
    <if test="query.minCreateTime!=null">AND create_time &gt;= #{query.minCreateTime}</if>  
@@ -44,7 +46,7 @@
    <include refid="listWhereSQL"/> 
  </select>  
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_wx_user where id = #{id,jdbcType=BIGINT}</delete>  
  <insert id="insert" parameterType="com.taoke.autopay.entity.WxUserInfo" useGeneratedKeys="true" keyProperty="id">insert into table_wx_user (id,openid,nick_name,portrait,login_time,create_time,update_time,id,latest_ip,latest_ip_info) values (#{id,jdbcType=BIGINT},#{openId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{loginTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{LatestIP,jdbcType=VARCHAR},#{latestIPInfo,jdbcType=VARCHAR})</insert>
  <insert id="insert" parameterType="com.taoke.autopay.entity.WxUserInfo" useGeneratedKeys="true" keyProperty="id">insert into table_wx_user (id,openid,nick_name,portrait,login_time,create_time,update_time,id,latest_ip,latest_ip_info,status) values (#{id,jdbcType=BIGINT},#{openId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{loginTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{LatestIP,jdbcType=VARCHAR},#{latestIPInfo,jdbcType=VARCHAR},#{status,jdbcType=INTEGER})</insert>
  <insert id="insertSelective" parameterType="com.taoke.autopay.entity.WxUserInfo" useGeneratedKeys="true" keyProperty="id">insert into table_wx_user 
    <trim prefix="(" suffix=")" suffixOverrides=","> 
      <if test="id != null">id,</if>  
@@ -55,7 +57,8 @@
      <if test="createTime != null">create_time,</if>  
      <if test="updateTime != null">update_time,</if>  
      <if test="LatestIP != null">latest_ip,</if>  
      <if test="latestIPInfo != null">latest_ip_info,</if>
      <if test="latestIPInfo != null">latest_ip_info,</if>
      <if test="status != null">status,</if>
    </trim>values 
    <trim prefix="(" suffix=")" suffixOverrides=","> 
      <if test="id != null">#{id,jdbcType=BIGINT},</if>  
@@ -65,11 +68,12 @@
      <if test="loginTime != null">#{loginTime,jdbcType=TIMESTAMP},</if>  
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>  
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>  
      <if test="LatestIP != null">#{LatestIP,jdbcType=VARCHAR},</if>
      <if test="latestIPInfo != null">#{latestIPInfo,jdbcType=VARCHAR},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.WxUserInfo">update table_wx_user set openid = #{openId,jdbcType=VARCHAR},nick_name = #{nickName,jdbcType=VARCHAR},portrait = #{portrait,jdbcType=VARCHAR},login_time = #{loginTime,jdbcType=TIMESTAMP},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} ,latest_ip =#{LatestIP,jdbcType=VARCHAR}, latest_ip_info =#{latestIPInfo,jdbcType=VARCHAR}, where id = #{id,jdbcType=BIGINT}</update>
      <if test="LatestIP != null">#{LatestIP,jdbcType=VARCHAR},</if>
      <if test="latestIPInfo != null">#{latestIPInfo,jdbcType=VARCHAR},</if>
      <if test="status != null">#{status,jdbcType=INTEGER}</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.WxUserInfo">update table_wx_user set openid = #{openId,jdbcType=VARCHAR},nick_name = #{nickName,jdbcType=VARCHAR},portrait = #{portrait,jdbcType=VARCHAR},login_time = #{loginTime,jdbcType=TIMESTAMP},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} ,latest_ip =#{LatestIP,jdbcType=VARCHAR}, latest_ip_info =#{latestIPInfo,jdbcType=VARCHAR}, status =#{status,jdbcType=INTEGER}, where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.taoke.autopay.entity.WxUserInfo">update table_wx_user 
    <set> 
      <if test="openId != null">openid=#{openId,jdbcType=VARCHAR},</if>  
@@ -79,7 +83,8 @@
      <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if>  
      <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if>  
      <if test="LatestIP !=null">latest_ip =#{LatestIP,jdbcType=VARCHAR},</if>  
      <if test="latestIPInfo !=null">latest_ip_info =#{latestIPInfo,jdbcType=VARCHAR},</if>
      <if test="latestIPInfo !=null">latest_ip_info =#{latestIPInfo,jdbcType=VARCHAR},</if>
      <if test="status !=null">status =#{status,jdbcType=INTEGER},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  </update>
</mapper>
src/main/resources/static/admin/agent-list.html
@@ -1,352 +1,367 @@
<!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>
            #add_client {
                padding: 10px;
            }
        </style>
    </head>
<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>
        #add_client {
            padding: 10px;
        }
    </style>
</head>
    <body>
        <div class="page-content-wrap">
            <form class="layui-form" action="" lay-filter='search'>
                <div class="layui-form-item">
<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="按渠道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="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">
                </table>
            </div>
        </div>
        </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 forbidden(id) {
                // 修改密码
                layer.prompt({
                    formType: 2,
                    value: '',
                    title: '请输入密码',
                    area: ['200px', '50px'] //自定义文本域宽高
                }, function(value, index, elem) {
                    if (value.length < 6) {
                        layer.msg("密码不能少于6位数");
                        return;
                    }
                    $.post("/admin/api//setpwd", {
                        "id": id,
                        "pwd": value
                    }, function(response) {
                        if (response.code == 0) {
                            layer.close(index);
                            layer.msg("密码修改成功");
                        } else {
                            layer.msg(response.msg);
                        }
                    }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                        layer.msg("网络请求失败");
                    });
                });
            }
<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 forbidden(id) {
        // 修改密码
        layer.prompt({
            formType: 2,
            value: '',
            title: '请输入密码',
            area: ['200px', '50px'] //自定义文本域宽高
        }, function (value, index, elem) {
            if (value.length < 6) {
                layer.msg("密码不能少于6位数");
                return;
            }
            $.post("/admin/api//setpwd", {
                "id": id,
                "pwd": value
            }, function (response) {
                if (response.code == 0) {
                    layer.close(index);
                    layer.msg("密码修改成功");
                } else {
                    layer.msg(response.msg);
                }
            }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
                layer.msg("网络请求失败");
            });
        });
    }
            function add_agent() {
                var layerIndex = layer.open({
                    title: "添加代理",
                    type: 2,
                    area: ['800px', '600px'],
                    shade: 0.3,
                    shadeClose: false, //默认开启遮罩关闭
                    resize: false, //默认重设大小是否
                    //如果不让iframe出现滚动条,
                    //可以content: ['http://sentsin.com', 'no']
                    content: 'agent-add.html',
                    btn: ['确定', '取消'],
                    yes: function(index) {
                        //submit方法为弹框内容中的方法
                        window["layui-layer-iframe" + index].submit(function(res) {
                            console.log(res);
                            let fdata = {};
                            for (let key in res) {
                                if (key.indexOf(".") >= 0) {
                                    let k1 = key.split(".")[0];
                                    let k2 = key.split(".")[1];
                                    if (k1 in fdata) {} else {
                                        fdata[k1] = {};
                                    }
                                    fdata[k1][k2] = res[key];
                                } else {
                                    fdata[key] = res[key]
                                }
                            }
                            for (let key in fdata) {
                                console.log(typeof(fdata[key]))
                                if (typeof(fdata[key]) == 'object') {
                                    fdata[key] = JSON.stringify(fdata[key]);
                                }
                            }
                            console.log(fdata);
                            try {
                                var index = layer.load(1);
                                $.post("/admin/api/agent/add", fdata, 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 add_agent() {
        var layerIndex = layer.open({
            title: "添加代理",
            type: 2,
            area: ['800px', '600px'],
            shade: 0.3,
            shadeClose: false, //默认开启遮罩关闭
            resize: false, //默认重设大小是否
            //如果不让iframe出现滚动条,
            //可以content: ['http://sentsin.com', 'no']
            content: 'agent-add.html',
            btn: ['确定', '取消'],
            yes: function (index) {
                //submit方法为弹框内容中的方法
                window["layui-layer-iframe" + index].submit(function (res) {
                    console.log(res);
                    let fdata = {};
                    for (let key in res) {
                        if (key.indexOf(".") >= 0) {
                            let k1 = key.split(".")[0];
                            let k2 = key.split(".")[1];
                            if (k1 in fdata) {
                            } else {
                                fdata[k1] = {};
                            }
                            fdata[k1][k2] = res[key];
                        } else {
                            fdata[key] = res[key]
                        }
                    }
                    for (let key in fdata) {
                        console.log(typeof (fdata[key]))
                        if (typeof (fdata[key]) == 'object') {
                            fdata[key] = JSON.stringify(fdata[key]);
                        }
                    }
                    console.log(fdata);
                    try {
                        var index = layer.load(1);
                        $.post("/admin/api/agent/add", fdata, 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_agent(id) {
                var layerIndex = layer.open({
                    title: "修改代理",
                    type: 2,
                    area: ['800px', '600px'],
                    shade: 0.3,
                    shadeClose: false, //默认开启遮罩关闭
                    resize: false, //默认重设大小是否
                    //如果不让iframe出现滚动条,
                    //可以content: ['http://sentsin.com', 'no']
                    content: 'agent-update.html?id=' + id,
                    btn: ['确定', '取消'],
                    yes: function(index) {
                        //submit方法为弹框内容中的方法
                        window["layui-layer-iframe" + index].submit(function(res) {
                            console.log(res);
                            let fdata = {
                                id: id
                            };
                            for (let key in res) {
                                if (key.indexOf(".") >= 0) {
                                    let k1 = key.split(".")[0];
                                    let k2 = key.split(".")[1];
                                    if (k1 in fdata) {} else {
                                        fdata[k1] = {};
                                    }
                                    fdata[k1][k2] = res[key];
                                } else {
                                    fdata[key] = res[key]
                                }
                            }
                            for (let key in fdata) {
                                console.log(typeof(fdata[key]))
                                if (typeof(fdata[key]) == 'object') {
                                    fdata[key] = JSON.stringify(fdata[key]);
                                }
                            }
                            console.log(fdata);
                            try {
                                var index = layer.load(1);
                                $.post("/admin/api/agent/update", fdata, 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_agent(id) {
        var layerIndex = layer.open({
            title: "修改代理",
            type: 2,
            area: ['800px', '600px'],
            shade: 0.3,
            shadeClose: false, //默认开启遮罩关闭
            resize: false, //默认重设大小是否
            //如果不让iframe出现滚动条,
            //可以content: ['http://sentsin.com', 'no']
            content: 'agent-update.html?id=' + id,
            btn: ['确定', '取消'],
            yes: function (index) {
                //submit方法为弹框内容中的方法
                window["layui-layer-iframe" + index].submit(function (res) {
                    console.log(res);
                    let fdata = {
                        id: id
                    };
                    for (let key in res) {
                        if (key.indexOf(".") >= 0) {
                            let k1 = key.split(".")[0];
                            let k2 = key.split(".")[1];
                            if (k1 in fdata) {
                            } else {
                                fdata[k1] = {};
                            }
                            fdata[k1][k2] = res[key];
                        } else {
                            fdata[key] = res[key]
                        }
                    }
                    for (let key in fdata) {
                        console.log(typeof (fdata[key]))
                        if (typeof (fdata[key]) == 'object') {
                            fdata[key] = JSON.stringify(fdata[key]);
                        }
                    }
                    console.log(fdata);
                    try {
                        var index = layer.load(1);
                        $.post("/admin/api/agent/update", fdata, 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 delete_agent(id) {
                layer.confirm('您确定要执行此操作吗?', {
                    icon: 3,
                    title: '提示'
                }, function(index) {
                    // 确认操作
                    layer.close(index);
                    $.post("/admin/api/agent/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.close(index);
                        layer.msg("网络请求失败");
                    });
                }.bind(this));
            }
            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/agent/list', //数据接口
                    where: {
                        'key': $("#key").val()
                    },
                    parseData: function(res) { //res 即为原始返回的数据
                        let flist = new Array();
                        res.data.list.forEach(function(e) {
                            var fdata = {}
                            for (let key in e) {
                                // 判断属性是否是对象自身的属性而非继承的属性
                                if (e.hasOwnProperty(key)) {
                                    //console.log(key + ": " + json[key]);
                                    if (typeof e[key] == 'object') {
                                        for (let k1 in e[key]) {
                                            fdata[key + "." + k1] = e[key][k1];
                                        }
                                    } else {
                                        fdata[key] = e[key];
                                    }
                                }
                            }
                            console.log(fdata);
                            flist.push(fdata);
                        });
                        return {
                            "code": res.code, //解析接口状态
                            "msg": res.msg, //解析提示文本
                            "count": res.data.count, //解析数据长度
                            "data": flist //解析数据列表
                        }
                    },
                    page: true, //开启分页
                    cols: [
                        [ //表头
                            {
                                field: 'id',
                                title: 'ID',
                                width: 100,
                                fixed: 'left'
                            }, {
                                field: 'name',
                                title: '名称',
                                width: 120
                            }, {
                                field: 'alias',
                                title: '渠道标识',
                                width: 100,
                                sort: false,
                            }, {
                                field: 'submitKeyLink',
                                title: '口令提交链接',
                                width: 100,
                                sort: false,
                            }, {
                                field: '',
                                title: '状态',
                                width: 100,
                                sort: false,
                                templet: function(d) {
                                    return d.status == 0 ? '正常' : '封禁'
                                }
                            }, {
                                field: 'createTime',
                                title: '创建时间',
                                width: 180,
                            }, {
                                field: 'activeTime',
                                title: '活跃时间',
                                width: 180,
                                sort: false,
                            }, {
                                field: '',
                                title: '设置',
                                sort: false,
                                templet: function(d) {
                                    var html = "";
                                    html += "<div><a href='javascript:void' onclick='update_agent(" + d.id + ")' class='layui-table-link'>设置</a></div>";
                                    return html;
                                }
                            }, {
                                field: '',
                                title: '操作',
                                sort: false,
                                templet: function(d) {
                                    var html = "";
                                    html += "<div><a href='javascript:void' onclick='delete_agent(" + d.id + ")' class='layui-table-link'>删除</a></div>";
                                    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;
                });
                form.on('submit(add-client)', function(data) {
                    $.post("/admin/api/clientinfo/add", data.field, function(response) {
                        if (response.code == 0) {
                            layer.msg("添加成功");
                        } else {
                            layer.msg(response.msg);
                        }
                    }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                        layer.msg("网络请求失败");
                    });
                    return false;
                });
            });
        </script>
    </body>
    function delete_agent(id) {
        layer.confirm('您确定要执行此操作吗?', {
            icon: 3,
            title: '提示'
        }, function (index) {
            // 确认操作
            layer.close(index);
            $.post("/admin/api/agent/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.close(index);
                layer.msg("网络请求失败");
            });
        }.bind(this));
    }
    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/agent/list', //数据接口
            where: {
                'key': $("#key").val()
            },
            parseData: function (res) { //res 即为原始返回的数据
                let flist = new Array();
                res.data.list.forEach(function (e) {
                    var fdata = {}
                    for (let key in e) {
                        // 判断属性是否是对象自身的属性而非继承的属性
                        if (e.hasOwnProperty(key)) {
                            //console.log(key + ": " + json[key]);
                            if (typeof e[key] == 'object') {
                                for (let k1 in e[key]) {
                                    fdata[key + "." + k1] = e[key][k1];
                                }
                            } else {
                                fdata[key] = e[key];
                            }
                        }
                    }
                    console.log(fdata);
                    flist.push(fdata);
                });
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.count, //解析数据长度
                    "data": flist //解析数据列表
                }
            },
            page: true, //开启分页
            cols: [
                [ //表头
                    {
                        field: 'id',
                        title: 'ID',
                        width: 100,
                        fixed: 'left'
                    }, {
                    field: 'name',
                    title: '名称',
                    width: 120
                }, {
                    field: 'alias',
                    title: '渠道标识',
                    width: 100,
                    sort: false,
                }, {
                    field: 'submitKeyLink',
                    title: '口令提交链接',
                    width: 100,
                    sort: false,
                }, {
                    field: '',
                    title: '状态',
                    width: 100,
                    sort: false,
                    templet: function (d) {
                        return d.status == 0 ? '正常' : '封禁'
                    }
                }, {
                    field: 'createTime',
                    title: '创建时间',
                    width: 180,
                }, {
                    field: 'activeTime',
                    title: '活跃时间',
                    width: 180,
                    sort: false,
                }, {
                    field: 'shieldedAreas',
                    title: '屏蔽区域',
                    width: 180,
                    sort: false,
                }, {
                    field: '',
                    title: '设置',
                    sort: false,
                    templet: function (d) {
                        var html = "";
                        html += "<div><a href='javascript:void' onclick='update_agent(" + d.id + ")' class='layui-table-link'>设置</a></div>";
                        return html;
                    }
                }, {
                    field: '',
                    title: '操作',
                    sort: false,
                    templet: function (d) {
                        var html = "";
                        html += "<div><a href='javascript:void' onclick='delete_agent(" + d.id + ")' class='layui-table-link'>删除</a></div>";
                        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;
        });
        form.on('submit(add-client)', function (data) {
            $.post("/admin/api/clientinfo/add", data.field, function (response) {
                if (response.code == 0) {
                    layer.msg("添加成功");
                } else {
                    layer.msg(response.msg);
                }
            }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
                layer.msg("网络请求失败");
            });
            return false;
        });
    });
</script>
</body>
</html>
src/main/resources/static/admin/agent-update.html
@@ -141,6 +141,14 @@
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">屏蔽区域表达式:</label>
                <div class="layui-input-inline">
                    <input type="text" name="shieldedAreas" required lay-verify="" placeholder="屏蔽区域表达式" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">表达式之间采用逗号分割 如:重庆/重庆,山东/济南,山东/*</div>
                </div>
            </div>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="sure" id="sure">确定</button>
            </div>
src/main/resources/static/admin/index.html
@@ -54,6 +54,7 @@
                      <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>
                        <dd><a href="javascript:;" data-url="forbidden_submit_areas.html" data-id='44' data-text="禁止口令提交区域"><span class="l-line"></span>禁止口令提交区域</a></dd>
                        <dd><a href="javascript:;" data-url="settings_ignore_agent_order.html" data-id='46' data-text="代理订单忽略设置"><span class="l-line"></span>代理订单忽略设置</a></dd>
                    </dl>
                  </li>
                  <li class="layui-nav-item">
src/main/resources/static/admin/order-list.html
@@ -49,6 +49,14 @@
                               <option value="unknown">卡金额</option>
                        </select>
                    </div>
                    <div class="layui-inline">
                        <select name="ignore" >
                            <option value="">代理所有订单</option>
                            <option value="true">忽略订单</option>
                            <option value="false">未忽略订单</option>
                        </select>
                    </div>
                    
                    <div class="layui-inline">
                        <input type="text" name="startDate" placeholder="开始日期" autocomplete="off" class="layui-input">
@@ -266,6 +274,17 @@
                                    return "";
                                },
                            },
                            {
                                field: 'ignore',
                                title: '是否忽略',
                                width: 170,
                                templet: function(d){
                                    if(d["ignore"]){
                                        return '是';
                                    }
                                    return "否";
                                },
                            },
                            {
                                field: '',
@@ -296,6 +315,10 @@
                //监听提交
                form.on('submit(search)', function(data) {
                    if(data.field["ignore"]==''){
                        delete data.field["ignore"];
                    }
                    tableIns.reload({
                        where: data.field,
                        page: {
src/main/resources/static/admin/pay_money_add.html
@@ -68,6 +68,7 @@
                        <option value = "unknown">无需验证</option>
                        <option value = "cyx">超佣享</option>
                        <option value = "bps">爆品社</option>
                        <option value = "own">自有渠道</option>
                    </select>
                </div>
            </div>
src/main/resources/static/admin/pay_money_update.html
@@ -69,6 +69,7 @@
                        <option value = "unknown">无需验证</option>
                        <option value = "cyx">超佣享</option>
                        <option value = "bps">爆品社</option>
                        <option value = "own">自有渠道</option>
                    </select>
                </div>
            </div>
src/main/resources/static/admin/settings_ignore_agent_order.html
New file
@@ -0,0 +1,96 @@
<!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;
            }
            input {
                width: 200px !important;
            }
        </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-block">
                    <input type="text" name="beginCount" required lay-verify="required|num"
                        placeholder="起始单数" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">当代理每日提交单数达到后才执行忽略</div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">忽略百分比</label>
                <div class="layui-input-block">
                    <input type="text" name="percent" required lay-verify="required|num"
                           placeholder="忽略百分比" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">如:20 就表示忽略掉20%的订单,0表示不忽略</div>
                </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>
            layui.use(['form', 'layedit', 'laydate'], function() {
                var form = layui.form,
                    layer = layui.layer;
                //自定义验证规则
                form.verify({
                    num: [/^(\d)+$/, "只能包含数字"]
                });
                let index = layer.load(1);
                $.post("/admin/api/settings/getIgnoreAgentOrderSetting", {},
                    function(response) {
                        layer.close(index);
                        if (response.code == 0) {
                            form.val("edit", response.data);
                        } else {
                            layer.msg(response.msg);
                        }
                    }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                    layer.msg("网络请求失败");
                    layer.close(index);
                });
                //监听提交
                form.on('submit(sure)', function(data) {
                    var params = data.field;
                    console.log(params);
                    $.post("/admin/api/settings/setIgnoreAgentOrderSetting", params,
                        function(response) {
                            if (response.code == 0) {
                                layer.msg("修改成功");
                            } else {
                                layer.msg(response.msg);
                            }
                        }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                        layer.msg("网络请求失败");
                    });
                    return false;
                });
            });
        </script>
    </body>
</html>
src/main/resources/static/admin/user-edit.html
@@ -43,6 +43,16 @@
                  </div>
                </div>
            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <select name="status">
                        <option value="0">普通用户</option>
                        <option value="1">白名单</option>
                    </select>
                </div>
            </div>
            <div class="layui-input-block" style="visibility: hidden;">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="sure" id="sure">确定</button>
            </div>
@@ -73,10 +83,22 @@
                
                
                var id = http_util.getQueryString("id");
                // 获取值
                $.post("/admin/api/wxuser/getOrderSettings", {"id":id}, function(response) {
                $.post("/admin/api/wxuser/getUser", {"id":id}, function(response) {
                    if (response.code == 0) {
                        form.val("edit", response.data);
                        let status= response.data.status;
                        // 获取值
                        $.post("/admin/api/wxuser/getOrderSettings", {"id":id}, function(response) {
                            if (response.code == 0) {
                                response.data.status= status;
                                form.val("edit", response.data);
                            } else {
                                layer.msg(response.msg);
                            }
                        }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                            layer.msg("网络请求失败");
                        });
                    } else {
                        layer.msg(response.msg);
                    }
@@ -85,6 +107,8 @@
                });
                //监听提交
                form.on('submit(sure)', function(data) {
                    listener(data.field);
src/main/resources/static/admin/user-list.html
@@ -1,234 +1,266 @@
<!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="/admin/layui/css/layui.css" />
        <link rel="stylesheet" type="text/css" href="/admin/css/admin.css" />
        <style>
            .portrait{
                width: 30px;
            }
        </style>
    </head>
<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="/admin/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/css/admin.css"/>
    <style>
        .portrait {
            width: 30px;
        }
    </style>
</head>
    <body>
        <div class="page-content-wrap">
            <form class="layui-form" action="" lay-filter='search'>
                <div class="layui-form-item">
<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="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">
            <div class="layui-inline">
                <input type="text" name="key" id="key" placeholder="请输入老铁ID搜索" autocomplete="off"
                       class="layui-input">
                </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 editUserClick(uid) {
                var layerIndex = layer.open({
                    title: "修改订单频次",
                    type: 2,
                    area: ['400px', '350px'],
                    shade: 0.3,
                    shadeClose: false, //默认开启遮罩关闭
                    resize: false, //默认重设大小是否
            </div>
            <div class="layui-inline">
                <select name="keyType">
                    <option value="1">用户ID/昵称</option>
                    <option value="2">地域</option>
                </select>
            </div>
                    //如果不让iframe出现滚动条,
                    //可以content: ['http://sentsin.com', 'no']
                    content: 'user-edit.html?id=' + uid,
                    btn: ['确定', '取消'],
                    yes: function(index) {
                        //submit方法为弹框内容中的方法
                        window["layui-layer-iframe" + index].submit(function(res) {
                            try {
                                var index = layer.load(1);
                                $.post("/admin/api/wxuser/updateOrderSettings", 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("网络请求失败");
                                });
            <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">
                            } catch (e) {
                                console.log(e);
                            }
                        });
                    },
                    cancel: function() {
        </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 editUserClick(uid) {
        var layerIndex = layer.open({
            title: "修改订单频次",
            type: 2,
            area: ['400px', '350px'],
            shade: 0.3,
            shadeClose: false, //默认开启遮罩关闭
            resize: false, //默认重设大小是否
                    }
                });
            //如果不让iframe出现滚动条,
            //可以content: ['http://sentsin.com', 'no']
            content: 'user-edit.html?id=' + uid,
            btn: ['确定', '取消'],
            yes: function (index) {
                //submit方法为弹框内容中的方法
                window["layui-layer-iframe" + index].submit(function (res) {
                    try {
                        var index = layer.load(1);
                        $.post("/admin/api/wxuser/updateOrderSettings", 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("网络请求失败");
                        });
                        $.post("/admin/api/wxuser/updateUser", res, function (response) {
                            if (response.code == 0) {
                            } else {
                                layer.msg(response.msg);
                            }
                        }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
                            layer.close(index);
                            layer.msg("网络请求失败");
                        });
                    } catch (e) {
                        console.log(e);
                    }
                });
            },
            cancel: function () {
            }
        });
            }
    }
            layui.use(['form', 'jquery', 'layer', 'table'], function() {
    layui.use(['form', 'jquery', 'layer', 'table'], function () {
                var table = layui.table;
                var form = layui.form;
                var $ = layui.jquery;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
                let table_option = {
                    elem: '#table',
                    height: 600,
                    url: '/admin/api/wxuser/list', //数据接口
                    where: {
                        'uid': $("#uid").val()
                    },
                    parseData: function(res) { //res 即为原始返回的数据
                        let flist = new Array();
                        res.data.list.forEach(function(e) {
                            var fdata = {}
                            for (let key in e) {
                                // 判断属性是否是对象自身的属性而非继承的属性
                                if (e.hasOwnProperty(key)) {
                                    //console.log(key + ": " + json[key]);
                                    if (typeof e[key] == 'object') {
                                        for (let k1 in e[key]) {
                                            fdata[key + "." + k1] = e[key][k1];
                                        }
                                    } else {
                                        fdata[key] = e[key];
                                    }
                                }
                            }
                            console.log(fdata);
                            flist.push(fdata);
                        });
                        return {
                            "code": res.code, //解析接口状态
                            "msg": res.msg, //解析提示文本
                            "count": res.data.count, //解析数据长度
                            "data": flist //解析数据列表
                        }
                    },
                    page: true, //开启分页
                    cols: [
                        [ //表头
                            {
                                field: 'id',
                                title: '老铁ID',
                                sort: false,
                                fixed: 'left'
                            },
                            {
                                field: 'nickName',
                                title: '昵称',
                                sort: false
                            },
                            {
                                field: '',
                                title: '头像',
                                sort: false,
                                templet: function(d) {return "<img class='portrait' src='"+d.portrait+"' />";}
                            },
                            {
                                field: 'createTime',
                                title: '首次提交口令时间',
                            }, {
                                field: 'orderSetting.dyPayCount',
                                title: '抖音频次限制',
                                sort: false
                            }, {
                                field: 'orderSetting.ksPayCount',
                                title: '快手频次限制'
                            }, {
        let table_option = {
            elem: '#table',
            height: 600,
            url: '/admin/api/wxuser/list', //数据接口
            where: {
                'uid': $("#uid").val()
            },
            parseData: function (res) { //res 即为原始返回的数据
                let flist = new Array();
                res.data.list.forEach(function (e) {
                    var fdata = {}
                    for (let key in e) {
                        // 判断属性是否是对象自身的属性而非继承的属性
                        if (e.hasOwnProperty(key)) {
                            //console.log(key + ": " + json[key]);
                            if (typeof e[key] == 'object') {
                                for (let k1 in e[key]) {
                                    fdata[key + "." + k1] = e[key][k1];
                                }
                            } else {
                                fdata[key] = e[key];
                            }
                        }
                    }
                    console.log(fdata);
                    flist.push(fdata);
                });
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.count, //解析数据长度
                    "data": flist //解析数据列表
                }
            },
            page: true, //开启分页
            cols: [
                [ //表头
                    {
                        field: 'id',
                        title: '老铁ID',
                        sort: false,
                        fixed: 'left'
                    },
                    {
                        field: 'nickName',
                        title: '昵称',
                        sort: false
                                field: 'orderSetting.totalSubmitCount',
                                title: '总频次限制'
                    },
                    {
                        field: '',
                        title: '头像',
                        sort: false,
                        templet: function (d) {
                            return "<img class='portrait' src='" + d.portrait + "' />";
                        }
                    },
                    {
                        field: 'createTime',
                        title: '首次提交口令时间',
                    }, {
                    field: 'orderSetting.dyPayCount',
                    title: '抖音频次限制',
                    sort: false
                }, {
                    field: 'orderSetting.ksPayCount',
                    title: '快手频次限制'
                }, {
                            },{
                    field: 'orderSetting.totalSubmitCount',
                    title: '总频次限制'
                            field: 'orderSetting.totalSubmitCount',
                            title: '用户地域',
                            templet: function(d){
                                if(d["ipInfo.city"]){
                                    return d["ipInfo.province"] + "/"+ d["ipInfo.city"];
                                }
                                return "";
                            },
                }, {
                        },
                            {
                                field: '',
                                title: '操作',
                                sort: false,
                                templet: '<div><a href="javascript:void" onclick="editUserClick({{d.id}})" class="layui-table-link">修改</a></div>'
                            }
                    field: 'ipInfo',
                    title: '用户地域',
                    templet: function (d) {
                        if (d["ipInfo.city"]) {
                            return d["ipInfo.province"] + "/" + d["ipInfo.city"];
                        }
                        return "";
                    }
                }, {
                        ]
                    ]
                };
                    field: 'status',
                    title: '状态',
                    templet: function (d) {
                        if (d["status"] == 0) {
                            return "普通用户";
                        } else if (d["status"] == 1) {
                            return "白名单用户";
                        }
                        return "未知";
                    },
                var uid = http_util.getQueryString("uid");
                if (uid != null && uid != undefined) {
                    form.val("search", {
                        "uid": uid
                    });
                    table_option.data = [];
                    setTimeout(function() {
                        $("#search").click();
                    }, 100);
                }
                },
                    {
                        field: '',
                        title: '操作',
                        sort: false,
                        templet: '<div><a href="javascript:void" onclick="editUserClick({{d.id}})" class="layui-table-link">修改</a></div>'
                    }
                //第一个实例
                let tableIns = table.render(table_option);
                ]
            ]
        };
                //监听提交
                form.on('submit(search)', function(data) {
                    tableIns.reload({
                        where: data.field,
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                    });
        var uid = http_util.getQueryString("uid");
        if (uid != null && uid != undefined) {
            form.val("search", {
                "uid": uid
            });
            table_option.data = [];
            setTimeout(function () {
                $("#search").click();
            }, 100);
        }
                    return false;
                });
        //第一个实例
        let tableIns = table.render(table_option);
        //监听提交
        form.on('submit(search)', function (data) {
            tableIns.reload({
                where: data.field,
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false;
        });
                //修改状态
                $('#table-list').on('click', '.table-list-status', function() {
                    var That = $(this);
                    var status = That.attr('data-status');
                    var id = That.parent().attr('data-id');
                    if (status == 1) {
                        That.removeClass('layui-btn-normal').addClass('layui-btn-warm').html('隐藏').attr(
                            'data-status', 2);
                    } else if (status == 2) {
                        That.removeClass('layui-btn-warm').addClass('layui-btn-normal').html('显示').attr(
                            'data-status', 1);
        //修改状态
        $('#table-list').on('click', '.table-list-status', function () {
            var That = $(this);
            var status = That.attr('data-status');
            var id = That.parent().attr('data-id');
            if (status == 1) {
                That.removeClass('layui-btn-normal').addClass('layui-btn-warm').html('隐藏').attr(
                    'data-status', 2);
            } else if (status == 2) {
                That.removeClass('layui-btn-warm').addClass('layui-btn-normal').html('显示').attr(
                    'data-status', 1);
                    }
                })
            }
        })
            });
        </script>
    </body>
    });
</script>
</body>
</html>
src/test/java/com/taoke/autopay/ClientTest.java
@@ -8,6 +8,7 @@
import com.taoke.autopay.service.KeyOrderService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.AntPathMatcher;
import javax.annotation.Resource;
import java.util.*;
@@ -74,4 +75,9 @@
        getTargetClientId();
    }
    public static void main(String[] args){
        AntPathMatcher pathMatcher = new AntPathMatcher();
      System.out.println(  pathMatcher.match("四川/广元", "四川/广元"));
    }
}
src/test/java/com/taoke/autopay/MapperTest.java
@@ -27,8 +27,8 @@
//        MyBatisMapperUtil.createMapper(AdminUser.class);
        ColumnParseUtil.parseColumn(WxUserInfo.class,
                "D:\\workspace\\taoke_pay\\src\\main\\resources\\mapper\\WxUserInfoMapper.xml");
        ColumnParseUtil.parseColumn(KeyOrder.class,
                "D:\\workspace\\taoke_pay\\src\\main\\resources\\mapper\\KeyOrderMapper.xml");
//        System.out.println(   MyBatisMapperUtil.createSQL(ChannelAgentOrderStatisticRecord.class));
//        System.out.println(   MyBatisMapperUtil.createSQL(ChannelAgentSettings.class));
//        System.out.println(MyBatisMapperUtil.createSQL(ChannelAgentSettleRecord.class));