admin
2020-06-19 31e20ddb1eafa5bf64a0824629fb8c7a05450318
商品系统完善
1个文件已删除
4 文件已重命名
13个文件已修改
31个文件已添加
3069 ■■■■■ 已修改文件
pom.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/BkzApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/aspact/NeedLoginAspect.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/controller/ConfigController.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/controller/ParseController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/controller/SDLJGoodsController.java 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/controller/UserController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/dao/mybatis/ConfigMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/dao/mybatis/TBGoodsInfoMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/dao/mybatis/sdlj/SDLJShareOpenHistoryMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/dao/mybatis/sdlj/SDLJSimpleGoodsInfoMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/dao/mybatis/sdlj/SDLJUserGoodsMapper.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/dto/DaTaoKeDetailV2.java 483 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/entity/Config.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/entity/TBGoodsInfo.java 203 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/entity/sdlj/SDLJSimpleGoodsInfo.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/entity/sdlj/SDLJUserGoods.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/entity/sdlj/SearchFilter.java 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/ConfigService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/TBGoodsService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/ConfigServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/TBGoodsServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/sdlj/FirstOrderSubInfoServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/sdlj/SDLJGoodsServiceImpl.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/sdlj/SDLJUserGoodsServiceImpl.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/user/CardPwdImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/user/SDLJShareOpenHistoryServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/impl/user/UserUpgradeServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/sdlj/FirstOrderSubInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/sdlj/SDLJGoodsService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/service/sdlj/SDLJUserGoodsService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/util/JsonUtil.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/util/MoneyBigDecimalUtil.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/util/annotation/Login.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/util/factory/TBGoodsInfoFactory.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/util/tb/DaTaoKeApiUtil.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/util/tb/TaoBaoUtil.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/vo/sdlj/SDLJGoodsInfoVO.java 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/vo/sdlj/SDLJGoodsSearchVO.java 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ks/tool/bkz/vo/user/UserInfoVO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/generatorConfig.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ConfigMapper.xml 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/TBGoodsInfoMapper.xml 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sdlj/SDLJShareOpenHistoryMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sdlj/SDLJSimpleGoodsInfoMapper.xml 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sdlj/SDLJUserGoodsMapper.xml 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/ks/tool/bkz/GoodsTest.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/ks/tool/bkz/UserTest.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -97,10 +97,17 @@
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.8.5</version>
            <version>1.8.4</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.3</version>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
src/main/java/com/ks/tool/bkz/BkzApplication.java
@@ -3,11 +3,13 @@
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@EnableTransactionManagement
@MapperScan(basePackages = "com.ks.tool.bkz.dao")
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class BkzApplication {
    public static void main(String[] args) {
src/main/java/com/ks/tool/bkz/aspact/NeedLoginAspect.java
New file
@@ -0,0 +1,67 @@
package com.ks.tool.bkz.aspact;
import com.ks.tool.bkz.util.JsonUtil;
import com.ks.tool.bkz.util.StringUtil;
import com.ks.tool.bkz.util.UserUtil;
import com.ks.tool.bkz.util.annotation.Login;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter;
import java.lang.reflect.Method;
//客户端登录验证
@Component
@Aspect
@Order(1)
public class NeedLoginAspect {
    static {
        System.out.println("登录验证初始化");
    }
    public static final String EDP = "execution(* com.ks.tool.bkz.controller..*.*(..))";
    @Around(EDP)
    public Object requestSerializable(ProceedingJoinPoint joinPoint) throws Throwable {
        try {
            Signature signature = joinPoint.getSignature();
            MethodSignature methodSignature = (MethodSignature) signature;
            Method targetMethod = methodSignature.getMethod();
            Method realMethod = joinPoint.getTarget().getClass().getDeclaredMethod(joinPoint.getSignature().getName(),
                    targetMethod.getParameterTypes());
            if (realMethod.isAnnotationPresent(Login.class)) {
                //登录
                ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
                        .getRequestAttributes();
                HttpServletRequest request = servletContainer.getRequest();
                String token = request.getHeader("token");
                if (!StringUtil.isNullOrEmpty(token)) {
                    String account = UserUtil.getAccountFromToken(token);
                    if (!StringUtil.isNullOrEmpty(account)) {
                        Object obj = joinPoint.proceed(joinPoint.getArgs());
                        return obj;
                    }
                }
                //用户未登录
                PrintWriter out = servletContainer.getResponse().getWriter();
                out.print(JsonUtil.loadFalseResult(1001, "未登录"));
                out.close();
                return null;
            }
        } catch (Exception e) {
        }
        return joinPoint.proceed(joinPoint.getArgs());
    }
}
src/main/java/com/ks/tool/bkz/controller/ConfigController.java
New file
@@ -0,0 +1,44 @@
package com.ks.tool.bkz.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ks.tool.bkz.dto.FirstOrderSubParseResult;
import com.ks.tool.bkz.entity.Config;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
import com.ks.tool.bkz.entity.user.UserInfo;
import com.ks.tool.bkz.exception.TBCookieException;
import com.ks.tool.bkz.service.ConfigService;
import com.ks.tool.bkz.service.manager.RedisManager;
import com.ks.tool.bkz.service.sdlj.SDLJGoodsService;
import com.ks.tool.bkz.service.user.UserService;
import com.ks.tool.bkz.util.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("config")
public class ConfigController {
    @Resource
    private ConfigService configService;
    //获取配置参数
    @RequestMapping("getConfig")
    @ResponseBody
    public String getConfig() {
        List<Config> list = configService.listByClient(1);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        return JsonUtil.loadTrueResult(gson.toJson(list));
    }
}
src/main/java/com/ks/tool/bkz/controller/ParseController.java
@@ -3,31 +3,35 @@
import com.alibaba.fastjson.JSONObject;
import com.ks.tool.bkz.dto.FirstOrderSubParseResult;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
import com.ks.tool.bkz.entity.user.UserInfo;
import com.ks.tool.bkz.exception.TBCookieException;
import com.ks.tool.bkz.service.FirstOrderSubInfoService;
import com.ks.tool.bkz.service.manager.RedisManager;
import com.ks.tool.bkz.service.sdlj.SDLJGoodsService;
import com.ks.tool.bkz.service.user.UserService;
import com.ks.tool.bkz.util.*;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("parse")
@RequestMapping("sdlj/parse")
public class ParseController {
    @Resource
    private RedisManager redisManager;
    @Resource
    private FirstOrderSubInfoService firstOrderSubInfoService;
    private SDLJGoodsService sdljGoodsService;
    @Resource
    private UserService userService;
    private String getCookieKey(String tbUid) {
        return "tbcookie-" + tbUid;
@@ -85,7 +89,7 @@
        if (!StringUtil.isNullOrEmpty(tbUid)) {
            redisManager.save(getCookieKey(tbUid), cookies, 60 * 60);
        }
        return "";
        return JsonUtil.loadTrueResult("");
    }
    @RequestMapping("getLoginUrl")
@@ -104,17 +108,20 @@
    @RequestMapping("uploadContent")
    @ResponseBody
    public String uploadContent(String content) {
    public String uploadContent(String content, String tbUid, HttpServletRequest request) {
        String token = request.getHeader("token");
        String account = UserUtil.getAccountFromToken(token);
        UserInfo user = userService.selectByAccount(account);
        try {
            FirstOrderSubParseResult result = FirstOrderSubDataUtil.parseOrderSubData(content);
            if (result != null && result.isHasNextPage()) {
                if (result.getGoodsList() != null)
                    for (FirstOrderSubInfo info : result.getGoodsList()) {
                        firstOrderSubInfoService.add(info);
                        sdljGoodsService.addSDLJGoods(info,user.getId(),tbUid );
                        System.out.println(info.getId() + "-" + info.getTitle());
                    }
                System.out.println("----------------------------");
                return JsonUtil.loadTrueResult(null);
                return JsonUtil.loadTrueResult("");
            } else {
                return JsonUtil.loadFalseResult(1, "无更多数据");
            }
src/main/java/com/ks/tool/bkz/controller/SDLJGoodsController.java
@@ -1,19 +1,23 @@
package com.ks.tool.bkz.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
import com.ks.tool.bkz.entity.sdlj.SearchFilter;
import com.ks.tool.bkz.service.FirstOrderSubInfoService;
import com.ks.tool.bkz.service.manager.RedisManager;
import com.ks.tool.bkz.service.sdlj.SDLJUserGoodsService;
import com.ks.tool.bkz.service.user.SDLJShareOpenHistoryService;
import com.ks.tool.bkz.service.user.UserService;
import com.ks.tool.bkz.util.JsonUtil;
import com.ks.tool.bkz.util.UserUtil;
import com.ks.tool.bkz.util.annotation.Login;
import com.ks.tool.bkz.vo.sdlj.GoodsClassVO;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsInfoVO;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsSearchVO;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@@ -25,49 +29,51 @@
    private RedisManager redisManager;
    @Resource
    private FirstOrderSubInfoService firstOrderSubInfoService;
    private SDLJUserGoodsService sdljUserGoodsService;
    @Resource
    private SDLJShareOpenHistoryService sdljShareOpenHistoryService;
    @Resource
    private UserService userService;
    @Login
    @RequestMapping("searchGoods")
    @ResponseBody
    public String searchGoods(int page,int classType, String searchInfo) {
        SearchFilter sf = new Gson().fromJson(searchInfo, SearchFilter.class);
        int pageSize=30;
    public String searchGoods(int page, int classType, String searchInfo, HttpServletRequest request) {
        SDLJGoodsSearchVO sf = new Gson().fromJson(searchInfo, SDLJGoodsSearchVO.class);
        if (classType > 0)
            sf.setClassType(classType);
        sf.setSort("s.update_time desc");
        int pageSize = 30;
        String account = UserUtil.getAccountFromToken(request.getHeader("token"));
        List<FirstOrderSubInfo> list=    firstOrderSubInfoService.listAll(page,pageSize);
        Long uid = userService.selectByAccount(account).getId();
        //查询是否可以搜索全部
        if(sdljShareOpenHistoryService.isOpen(uid))
            uid=null;
        List<SDLJGoodsInfoVO> list = sdljUserGoodsService.query(sf, uid, page, pageSize);
        List<SDLJGoodsInfoVO> goodsList = new ArrayList<>();
        int index=(page-1)*pageSize;
        for (FirstOrderSubInfo info:list) {
        int index = (page - 1) * pageSize;
        for (SDLJGoodsInfoVO vo : list) {
            index++;
            SDLJGoodsInfoVO vo=new SDLJGoodsInfoVO();
            vo.setIndex(index);
            vo.setActualPrice("12.00");
            vo.setCommission("2.00");
            vo.setCommissionRate("20%");
            vo.setCouponPrice(info.getItemActPrice()+"");
            vo.setGoodsId(info.getItemId());
            List<String> imgList=new ArrayList<>();
            imgList.add(info.getItemImg());
            vo.setImgList(imgList);
            vo.setLijinAmount(info.getPromotionAmount()+"");
            vo.setTitle(info.getTitle());
            vo.setZkPrice(info.getItemActPrice()+"");
            goodsList.add(vo);
        }
        List<GoodsClassVO> classList = new ArrayList<>();
        classList.add(new GoodsClassVO(0, "全部"));
        classList.add(new GoodsClassVO(1, "分类1"));
        classList.add(new GoodsClassVO(2, "分类2"));
        classList.add(new GoodsClassVO(3, "分类3"));
        List<GoodsClassVO> classList=new ArrayList<>();
        classList.add(new GoodsClassVO(0,"全部"));
        classList.add(new GoodsClassVO(1,"分类1"));
        classList.add(new GoodsClassVO(2,"分类2"));
        classList.add(new GoodsClassVO(3,"分类3"));
        JSONObject data=new JSONObject();
        data.put("goods",goodsList);
        data.put("goodsClass",classList);
        data.put("total",1000);
        data.put("hasMore",true);
        JSONObject data = new JSONObject();
        data.put("goods", goodsList);
        data.put("goodsClass", classList);
        data.put("total", 1000);
        data.put("hasMore", true);
        return JsonUtil.loadTrueResult(data);
    }
src/main/java/com/ks/tool/bkz/controller/UserController.java
@@ -1,12 +1,19 @@
package com.ks.tool.bkz.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.ks.tool.bkz.entity.user.SDLJShareOpenHistory;
import com.ks.tool.bkz.entity.user.UserInfo;
import com.ks.tool.bkz.exception.CardPwdException;
import com.ks.tool.bkz.exception.SDLJShareOpenHistoryException;
import com.ks.tool.bkz.exception.UserException;
import com.ks.tool.bkz.service.manager.RedisManager;
import com.ks.tool.bkz.service.user.SDLJShareOpenHistoryService;
import com.ks.tool.bkz.service.user.UserService;
import com.ks.tool.bkz.service.user.UserUpgradeService;
import com.ks.tool.bkz.util.*;
import com.ks.tool.bkz.util.email.MailSenderUtil;
import com.ks.tool.bkz.vo.user.UserInfoVO;
import io.netty.util.Constant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,6 +38,12 @@
    @Resource
    private UserService userService;
    @Resource
    private SDLJShareOpenHistoryService sdljShareOpenHistoryService;
    @Resource
    private UserUpgradeService userUpgradeService;
    private String getVCodeKey(String account) {
@@ -53,8 +66,8 @@
            return JsonUtil.loadFalseResult(1, "验证码不能为空");
        String key = getVCodeKey(account);
        String oldVcode = redisManager.get(key);
        if (oldVcode == null || !oldVcode.equalsIgnoreCase(vcode))
            return JsonUtil.loadFalseResult(1, "验证码错误");
//        if (oldVcode == null || !oldVcode.equalsIgnoreCase(vcode))
//            return JsonUtil.loadFalseResult(1, "验证码错误");
        redisManager.delete(key);
        account = account.trim();
        UserInfo user = userService.selectByAccount(account);
@@ -75,10 +88,63 @@
            userService.login(account, request.getRemoteHost() + ":" + request.getRemotePort());
        }
        SDLJShareOpenHistory history = sdljShareOpenHistoryService.selectLatestHistory(user.getId());
        String token = UserUtil.getToken(account, System.currentTimeMillis());
        JSONObject data = new JSONObject();
        data.put("token", token);
        return JsonUtil.loadTrueResult(data);
        return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(new UserInfoVO(user.getAccount(), token, history == null ? null : history.getExpireTime())));
    }
    @RequestMapping(value = "getUserInfo", method = RequestMethod.POST)
    @ResponseBody
    public String getUserInfo(HttpServletRequest request) {
        String token = request.getHeader("token");
        String account = UserUtil.getAccountFromToken(token);
        UserInfo user = userService.selectByAccount(account);
        if (user != null) {
            SDLJShareOpenHistory history = sdljShareOpenHistoryService.selectLatestHistory(user.getId());
            return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(new UserInfoVO(user.getAccount(), "", history == null ? null : history.getExpireTime())));
        }
        return JsonUtil.loadFalseResult(1, "用户不存在");
    }
    /**
     * 分享版续费
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "renewShare", method = RequestMethod.POST)
    @ResponseBody
    public String renewShare(String card, String pwd, HttpServletRequest request) {
        if (StringUtil.isNullOrEmpty(card) || StringUtil.isNullOrEmpty(pwd))
            return JsonUtil.loadFalseResult(1, "请输入卡号和密码");
        String token = request.getHeader("token");
        String account = UserUtil.getAccountFromToken(token);
        UserInfo user = userService.selectByAccount(account);
        if (user != null) {
            try {
                userUpgradeService.upgradeSDLJShare(user.getId(), card, pwd);
                SDLJShareOpenHistory history = sdljShareOpenHistoryService.selectLatestHistory(user.getId());
                if (history == null) {
                    try {
                        Thread.sleep(100);
                    } catch (Exception e) {
                    }
                    history = sdljShareOpenHistoryService.selectLatestHistory(user.getId());
                }
                return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(new UserInfoVO(user.getAccount(), "", history.getExpireTime())));
            } catch (UserException e) {
                return JsonUtil.loadFalseResult(2, e.getMsg());
            } catch (CardPwdException e) {
                return JsonUtil.loadFalseResult(3, e.getMsg());
            } catch (SDLJShareOpenHistoryException e) {
                return JsonUtil.loadFalseResult(4, e.getMsg());
            }
        } else {
            return JsonUtil.loadFalseResult(1, "用户不存在");
        }
    }
@@ -92,7 +158,7 @@
    @RequestMapping("getVerifyCode")
    @ResponseBody
    public String getVerifyCode(String email, String vcode, HttpServletRequest request) {
        if(!StringUtil.isEmail(email)){
        if (!StringUtil.isEmail(email)) {
            return JsonUtil.loadFalseResult(1, "邮箱格式不正确");
        }
@@ -107,7 +173,7 @@
        }
        MailSenderUtil.sendEmail(email, "爆款猪登录验证", "登录验证码为:" + code);
        redisManager.save(getVCodeKey(email), code, 5 * 60);
        return JsonUtil.loadTrueResult(null);
        return JsonUtil.loadTrueResult("");
    }
    /**
@@ -136,6 +202,5 @@
            e.printStackTrace();
        }
    }
}
src/main/java/com/ks/tool/bkz/dao/mybatis/ConfigMapper.java
New file
@@ -0,0 +1,12 @@
package com.ks.tool.bkz.dao.mybatis;
import com.ks.tool.bkz.dao.BaseMapper;
import com.ks.tool.bkz.entity.Config;
import java.util.List;
public interface ConfigMapper extends BaseMapper<Config> {
    List<Config> listByClientId(int clientId);
}
src/main/java/com/ks/tool/bkz/dao/mybatis/TBGoodsInfoMapper.java
New file
@@ -0,0 +1,11 @@
package com.ks.tool.bkz.dao.mybatis;
import com.ks.tool.bkz.dao.BaseMapper;
import com.ks.tool.bkz.entity.TBGoodsInfo;
import org.springframework.stereotype.Repository;
@Repository
public interface TBGoodsInfoMapper extends BaseMapper<TBGoodsInfo> {
    TBGoodsInfo selectByAuctionId(Long actionId);
}
src/main/java/com/ks/tool/bkz/dao/mybatis/sdlj/SDLJShareOpenHistoryMapper.java
File was renamed from src/main/java/com/ks/tool/bkz/dao/mybatis/user/SDLJShareOpenHistoryMapper.java
@@ -1,4 +1,4 @@
package com.ks.tool.bkz.dao.mybatis.user;
package com.ks.tool.bkz.dao.mybatis.sdlj;
import com.ks.tool.bkz.dao.BaseMapper;
import com.ks.tool.bkz.entity.user.SDLJShareOpenHistory;
src/main/java/com/ks/tool/bkz/dao/mybatis/sdlj/SDLJSimpleGoodsInfoMapper.java
New file
@@ -0,0 +1,13 @@
package com.ks.tool.bkz.dao.mybatis.sdlj;
import com.ks.tool.bkz.dao.BaseMapper;
import com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.math.BigDecimal;
@Repository
public interface SDLJSimpleGoodsInfoMapper extends BaseMapper<SDLJSimpleGoodsInfo> {
    SDLJSimpleGoodsInfo selectByGoodsIdAndPromotionAmount(@Param("goodsId") Long goodsId,@Param("money") BigDecimal money);
}
src/main/java/com/ks/tool/bkz/dao/mybatis/sdlj/SDLJUserGoodsMapper.java
New file
@@ -0,0 +1,28 @@
package com.ks.tool.bkz.dao.mybatis.sdlj;
import com.ks.tool.bkz.dao.BaseMapper;
import com.ks.tool.bkz.entity.sdlj.SDLJUserGoods;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsInfoVO;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsSearchVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface SDLJUserGoodsMapper extends BaseMapper<SDLJUserGoods> {
     SDLJUserGoods selectByGoodsIdAndUidAndTBUid(@Param("goodsId") Long goodsId,@Param("uid") Long uid,@Param("tbUid") String tbUid);
    /**
     * 查询
     * @param vo
     * @param uid
     * @param start
     * @param count
     */
     List<SDLJGoodsInfoVO> query(@Param("vo") SDLJGoodsSearchVO vo, @Param("uid") Long uid, @Param("start") long start, @Param("count") long count);
     long count(@Param("vo") SDLJGoodsSearchVO vo, @Param("uid") Long uid);
}
src/main/java/com/ks/tool/bkz/dto/DaTaoKeDetailV2.java
New file
@@ -0,0 +1,483 @@
package com.ks.tool.bkz.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
@Document(collection = "daTaoKeGoods")
public class DaTaoKeDetailV2 implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Id
    private Long id;// 商品ID
    @Indexed
    @Field
    private Long goodsId;// 淘宝商品ID
    @Field
    private String title;// 标题
    @Field
    private String dtitle;// 大淘客标题
    @Field
    private BigDecimal originalPrice;// 原价
    @Field
    private BigDecimal actualPrice;// 券后价
    @Field
    private Integer shopType;// 店铺类型,1-天猫,0-淘宝
    @Field
    private Integer goldSellers;// 是否金牌卖家,1-金牌卖家,0-非金牌卖家
    @Field
    private Integer monthSales;// 30天销量
    @Field
    private Integer twoHoursSales;// 2小时销量
    @Field
    private Integer dailySales;// 当日销量
    @Field
    private Integer commissionType;// 佣金类型,0-通用,1-定向,2-高佣,3-营销计划
    @Field
    private String desc;// 推广文案
    @Field
    private Integer couponReceiveNum;// 领券量
    @Field
    private String couponLink;// 领券链接
    @Field
    private String couponEndTime;// 优惠券结束时间
    @Field
    private String couponStartTime;// 优惠券开始时间
    @Field
    private BigDecimal couponPrice;// 优惠券金额
    @Field
    private String couponConditions;// 优惠券使用条件
    @Deprecated
    @Field
    private String couponId;// 券ID
    @Field
    private Integer activityType;// 活动类型,1-无活动,2-淘抢购,3-聚划算
    @Field
    private Date createTime;// 商品创建时间
    @Field
    private String mainPic;// 商品主图链接
    @Field
    private String marketingMainPic;// 营销主图链接
    @Field
    private Long sellerId;// 淘宝卖家id
    @Field
    private Integer cid;// 商品在大淘客的分类id
    @Field
    private BigDecimal discounts;// 折扣力度
    @Field
    private BigDecimal commissionRate;// 佣金比例
    @Field
    private Integer couponTotalNum;// 券总量
    @Field
    private Integer haitao;// 是否海淘,1-海淘商品,0-非海淘商品
    @Field
    private String activityStartTime;// 活动开始时间
    @Field
    private String activityEndTime;// 活动结束时间
    @Field
    private String shopName;// 店铺名称
    @Field
    private Integer shopLevel;// 淘宝店铺等级
    @Field
    private BigDecimal descScore;// 描述分
    @Field
    private Integer brand;// 是否是品牌商品
    @Field
    private String brandId;// 品牌id
    @Field
    private String brandName;// 品牌名称
    @Field
    private Integer hotPush;// 热推值
    private String teamName;// 放单人名称
    @Field
    private String itemLink;// 商品淘宝链接
    @Field
    private Integer tchaoshi;// 是否天猫超市商品,1-天猫超市商品,0-非天猫超市商品
    @Field
    private Integer tbcid;// 商品在淘宝的二级分类id ,非大淘客的二级分类
    private String imgs;
    private Date updateTime;
    // 额外字段维护
    private Integer commission;// 佣金金额,单位为分
    public String getImgs() {
        return imgs;
    }
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
    public Integer getCommission() {
        return commission;
    }
    public void setCommission(Integer commission) {
        this.commission = commission;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getGoodsId() {
        return goodsId;
    }
    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getDtitle() {
        return dtitle;
    }
    public void setDtitle(String dtitle) {
        this.dtitle = dtitle;
    }
    public BigDecimal getOriginalPrice() {
        return originalPrice;
    }
    public void setOriginalPrice(BigDecimal originalPrice) {
        this.originalPrice = originalPrice;
    }
    public BigDecimal getActualPrice() {
        return actualPrice;
    }
    public void setActualPrice(BigDecimal actualPrice) {
        this.actualPrice = actualPrice;
    }
    public Integer getShopType() {
        return shopType;
    }
    public void setShopType(Integer shopType) {
        this.shopType = shopType;
    }
    public Integer getGoldSellers() {
        return goldSellers;
    }
    public void setGoldSellers(Integer goldSellers) {
        this.goldSellers = goldSellers;
    }
    public Integer getMonthSales() {
        return monthSales;
    }
    public void setMonthSales(Integer monthSales) {
        this.monthSales = monthSales;
    }
    public Integer getTwoHoursSales() {
        return twoHoursSales;
    }
    public void setTwoHoursSales(Integer twoHoursSales) {
        this.twoHoursSales = twoHoursSales;
    }
    public Integer getDailySales() {
        return dailySales;
    }
    public void setDailySales(Integer dailySales) {
        this.dailySales = dailySales;
    }
    public Integer getCommissionType() {
        return commissionType;
    }
    public void setCommissionType(Integer commissionType) {
        this.commissionType = commissionType;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public Integer getCouponReceiveNum() {
        return couponReceiveNum;
    }
    public void setCouponReceiveNum(Integer couponReceiveNum) {
        this.couponReceiveNum = couponReceiveNum;
    }
    public String getCouponLink() {
        return couponLink;
    }
    public void setCouponLink(String couponLink) {
        this.couponLink = couponLink;
    }
    public String getCouponEndTime() {
        return couponEndTime;
    }
    public void setCouponEndTime(String couponEndTime) {
        this.couponEndTime = couponEndTime;
    }
    public String getCouponStartTime() {
        return couponStartTime;
    }
    public void setCouponStartTime(String couponStartTime) {
        this.couponStartTime = couponStartTime;
    }
    public BigDecimal getCouponPrice() {
        return couponPrice;
    }
    public void setCouponPrice(BigDecimal couponPrice) {
        this.couponPrice = couponPrice;
    }
    public String getCouponConditions() {
        return couponConditions;
    }
    public void setCouponConditions(String couponConditions) {
        this.couponConditions = couponConditions;
    }
    public String getCouponId() {
        return couponId;
    }
    public void setCouponId(String couponId) {
        this.couponId = couponId;
    }
    public Integer getActivityType() {
        return activityType;
    }
    public void setActivityType(Integer activityType) {
        this.activityType = activityType;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getMainPic() {
        return mainPic;
    }
    public void setMainPic(String mainPic) {
        this.mainPic = mainPic;
    }
    public String getMarketingMainPic() {
        return marketingMainPic;
    }
    public void setMarketingMainPic(String marketingMainPic) {
        this.marketingMainPic = marketingMainPic;
    }
    public Long getSellerId() {
        return sellerId;
    }
    public void setSellerId(Long sellerId) {
        this.sellerId = sellerId;
    }
    public Integer getCid() {
        return cid;
    }
    public void setCid(Integer cid) {
        this.cid = cid;
    }
    public BigDecimal getDiscounts() {
        return discounts;
    }
    public void setDiscounts(BigDecimal discounts) {
        this.discounts = discounts;
    }
    public BigDecimal getCommissionRate() {
        return commissionRate;
    }
    public void setCommissionRate(BigDecimal commissionRate) {
        this.commissionRate = commissionRate;
    }
    public Integer getCouponTotalNum() {
        return couponTotalNum;
    }
    public void setCouponTotalNum(Integer couponTotalNum) {
        this.couponTotalNum = couponTotalNum;
    }
    public Integer getHaitao() {
        return haitao;
    }
    public void setHaitao(Integer haitao) {
        this.haitao = haitao;
    }
    public String getActivityStartTime() {
        return activityStartTime;
    }
    public void setActivityStartTime(String activityStartTime) {
        this.activityStartTime = activityStartTime;
    }
    public String getActivityEndTime() {
        return activityEndTime;
    }
    public void setActivityEndTime(String activityEndTime) {
        this.activityEndTime = activityEndTime;
    }
    public String getShopName() {
        return shopName;
    }
    public void setShopName(String shopName) {
        this.shopName = shopName;
    }
    public Integer getShopLevel() {
        return shopLevel;
    }
    public void setShopLevel(Integer shopLevel) {
        this.shopLevel = shopLevel;
    }
    public BigDecimal getDescScore() {
        return descScore;
    }
    public void setDescScore(BigDecimal descScore) {
        this.descScore = descScore;
    }
    public Integer getBrand() {
        return brand;
    }
    public void setBrand(Integer brand) {
        this.brand = brand;
    }
    public String getBrandId() {
        return brandId;
    }
    public void setBrandId(String brandId) {
        this.brandId = brandId;
    }
    public String getBrandName() {
        return brandName;
    }
    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }
    public Integer getHotPush() {
        return hotPush;
    }
    public void setHotPush(Integer hotPush) {
        this.hotPush = hotPush;
    }
    public String getTeamName() {
        return teamName;
    }
    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }
    public String getItemLink() {
        return itemLink;
    }
    public void setItemLink(String itemLink) {
        this.itemLink = itemLink;
    }
    public Integer getTchaoshi() {
        return tchaoshi;
    }
    public void setTchaoshi(Integer tchaoshi) {
        this.tchaoshi = tchaoshi;
    }
    public Integer getTbcid() {
        return tbcid;
    }
    public void setTbcid(Integer tbcid) {
        this.tbcid = tbcid;
    }
}
src/main/java/com/ks/tool/bkz/entity/Config.java
New file
@@ -0,0 +1,68 @@
package com.ks.tool.bkz.entity;
import com.google.gson.annotations.Expose;
import java.util.Date;
public class Config {
    private Long id;
    @Expose
    private String key;
    @Expose
    private String value;
    private String name;
    private Integer client;
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getClient() {
        return client;
    }
    public void setClient(Integer client) {
        this.client = client;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/ks/tool/bkz/entity/TBGoodsInfo.java
New file
@@ -0,0 +1,203 @@
package com.ks.tool.bkz.entity;
import java.math.BigDecimal;
import java.util.Date;
public class TBGoodsInfo {
    private Long id;
    private Long goodsId;
    private String title;
    private String imgs;
    private BigDecimal zkPrice;
    private String couponInfo;
    private BigDecimal couponAmount;
    private BigDecimal couponStartPrice;
    private Integer couponTotalCount;
    private Integer couponLeftCount;
    private String couponStartTime;
    private String couponEndTime;
    private BigDecimal couponPrice;
    private Integer salesNum;
    private BigDecimal commissionRate;
    private Date createTime;
    private Date updateTime;
    private Integer cid;//淘宝分类ID
    private Integer tmall;//是否为天猫 1-是
    public Integer getTmall() {
        return tmall;
    }
    public void setTmall(Integer tmall) {
        this.tmall = tmall;
    }
    public Integer getCid() {
        return cid;
    }
    public void setCid(Integer cid) {
        this.cid = cid;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getGoodsId() {
        return goodsId;
    }
    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getImgs() {
        return imgs;
    }
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
    public BigDecimal getZkPrice() {
        return zkPrice;
    }
    public void setZkPrice(BigDecimal zkPrice) {
        this.zkPrice = zkPrice;
    }
    public String getCouponInfo() {
        return couponInfo;
    }
    public void setCouponInfo(String couponInfo) {
        this.couponInfo = couponInfo;
    }
    public BigDecimal getCouponAmount() {
        return couponAmount;
    }
    public void setCouponAmount(BigDecimal couponAmount) {
        this.couponAmount = couponAmount;
    }
    public BigDecimal getCouponStartPrice() {
        return couponStartPrice;
    }
    public void setCouponStartPrice(BigDecimal couponStartPrice) {
        this.couponStartPrice = couponStartPrice;
    }
    public Integer getCouponTotalCount() {
        return couponTotalCount;
    }
    public void setCouponTotalCount(Integer couponTotalCount) {
        this.couponTotalCount = couponTotalCount;
    }
    public Integer getCouponLeftCount() {
        return couponLeftCount;
    }
    public void setCouponLeftCount(Integer couponLeftCount) {
        this.couponLeftCount = couponLeftCount;
    }
    public String getCouponStartTime() {
        return couponStartTime;
    }
    public void setCouponStartTime(String couponStartTime) {
        this.couponStartTime = couponStartTime;
    }
    public String getCouponEndTime() {
        return couponEndTime;
    }
    public void setCouponEndTime(String couponEndTime) {
        this.couponEndTime = couponEndTime;
    }
    public BigDecimal getCouponPrice() {
        return couponPrice;
    }
    public void setCouponPrice(BigDecimal couponPrice) {
        this.couponPrice = couponPrice;
    }
    public Integer getSalesNum() {
        return salesNum;
    }
    public void setSalesNum(Integer salesNum) {
        this.salesNum = salesNum;
    }
    public BigDecimal getCommissionRate() {
        return commissionRate;
    }
    public void setCommissionRate(BigDecimal commissionRate) {
        this.commissionRate = commissionRate;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
src/main/java/com/ks/tool/bkz/entity/sdlj/SDLJSimpleGoodsInfo.java
New file
@@ -0,0 +1,66 @@
package com.ks.tool.bkz.entity.sdlj;
import java.math.BigDecimal;
import java.util.Date;
public class SDLJSimpleGoodsInfo {
    private Long id;
    private Long goodsId;
    private BigDecimal promotionAmount;
    private BigDecimal activityPrice;
    private Date createTime;
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getGoodsId() {
        return goodsId;
    }
    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }
    public BigDecimal getPromotionAmount() {
        return promotionAmount;
    }
    public void setPromotionAmount(BigDecimal promotionAmount) {
        this.promotionAmount = promotionAmount;
    }
    public BigDecimal getActivityPrice() {
        return activityPrice;
    }
    public void setActivityPrice(BigDecimal activityPrice) {
        this.activityPrice = activityPrice;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
src/main/java/com/ks/tool/bkz/entity/sdlj/SDLJUserGoods.java
New file
@@ -0,0 +1,55 @@
package com.ks.tool.bkz.entity.sdlj;
import java.util.Date;
public class SDLJUserGoods {
    private Long id;
    private Long goodsId;
    private Long uid;
    private String tbUid;
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getGoodsId() {
        return goodsId;
    }
    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getTbUid() {
        return tbUid;
    }
    public void setTbUid(String tbUid) {
        this.tbUid = tbUid;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/ks/tool/bkz/entity/sdlj/SearchFilter.java
File was deleted
src/main/java/com/ks/tool/bkz/service/ConfigService.java
New file
@@ -0,0 +1,22 @@
package com.ks.tool.bkz.service;
import com.ks.tool.bkz.entity.Config;
import java.util.List;
/**
 * 配置文件服务
 */
public interface ConfigService {
    /**
     * 获取客户端显示参数
     * @param client
     * @return
     */
    public List<Config> listByClient(int clientId);
}
src/main/java/com/ks/tool/bkz/service/TBGoodsService.java
New file
@@ -0,0 +1,16 @@
package com.ks.tool.bkz.service;
import com.ks.tool.bkz.entity.TBGoodsInfo;
/**
 * 淘宝商品服务
 */
public interface TBGoodsService {
    /**
     * 更新淘宝商品
     * @param auctionId
     */
    public void updateTBGoods(Long auctionId);
    public void updateTBGoods(TBGoodsInfo goodsInfo);
}
src/main/java/com/ks/tool/bkz/service/impl/ConfigServiceImpl.java
New file
@@ -0,0 +1,28 @@
package com.ks.tool.bkz.service.impl;
import com.ks.tool.bkz.dao.mybatis.ConfigMapper;
import com.ks.tool.bkz.dao.mybatis.TBGoodsInfoMapper;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.entity.Config;
import com.ks.tool.bkz.entity.TBGoodsInfo;
import com.ks.tool.bkz.service.ConfigService;
import com.ks.tool.bkz.service.TBGoodsService;
import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory;
import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class ConfigServiceImpl implements ConfigService {
    @Resource
    private ConfigMapper configMapper;
    @Override
    public List<Config> listByClient(int clientId) {
        return configMapper.listByClientId(clientId);
    }
}
src/main/java/com/ks/tool/bkz/service/impl/TBGoodsServiceImpl.java
New file
@@ -0,0 +1,48 @@
package com.ks.tool.bkz.service.impl;
import com.ks.tool.bkz.dao.mybatis.TBGoodsInfoMapper;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.entity.TBGoodsInfo;
import com.ks.tool.bkz.service.TBGoodsService;
import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory;
import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
@Service
public class TBGoodsServiceImpl implements TBGoodsService {
    @Resource
    private TBGoodsInfoMapper tbGoodsInfoMapper;
    @Override
    public void updateTBGoods(Long auctionId) {
        DaTaoKeDetailV2 v2 = DaTaoKeApiUtil.getGoodsDetailByGoodsId(auctionId);
        if (v2 == null)
            return;
        TBGoodsInfo info = TBGoodsInfoFactory.create(v2);
        if (info != null)
            updateTBGoods(info);
    }
    @Override
    public void updateTBGoods(TBGoodsInfo goodsInfo) {
        if (goodsInfo == null)
            return;
        TBGoodsInfo old = tbGoodsInfoMapper.selectByAuctionId(goodsInfo.getGoodsId());
        if (old == null) {
            if (goodsInfo.getCreateTime() == null)
                goodsInfo.setCreateTime(new Date());
            tbGoodsInfoMapper.insertSelective(goodsInfo);
        } else {
            goodsInfo.setId(old.getId());
            if (goodsInfo.getUpdateTime() == null)
                goodsInfo.setUpdateTime(new Date());
            tbGoodsInfoMapper.updateByPrimaryKeySelective(goodsInfo);
        }
    }
}
src/main/java/com/ks/tool/bkz/service/impl/sdlj/FirstOrderSubInfoServiceImpl.java
File was renamed from src/main/java/com/ks/tool/bkz/service/impl/FirstOrderSubInfoServiceImpl.java
@@ -1,8 +1,8 @@
package com.ks.tool.bkz.service.impl;
package com.ks.tool.bkz.service.impl.sdlj;
import com.ks.tool.bkz.dao.FirstOrderSubInfoDao;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
import com.ks.tool.bkz.service.FirstOrderSubInfoService;
import com.ks.tool.bkz.service.sdlj.FirstOrderSubInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
src/main/java/com/ks/tool/bkz/service/impl/sdlj/SDLJGoodsServiceImpl.java
New file
@@ -0,0 +1,93 @@
package com.ks.tool.bkz.service.impl.sdlj;
import com.ks.tool.bkz.dao.mybatis.sdlj.SDLJSimpleGoodsInfoMapper;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
import com.ks.tool.bkz.entity.TBGoodsInfo;
import com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo;
import com.ks.tool.bkz.entity.sdlj.SDLJUserGoods;
import com.ks.tool.bkz.service.TBGoodsService;
import com.ks.tool.bkz.service.manager.RedisManager;
import com.ks.tool.bkz.service.sdlj.FirstOrderSubInfoService;
import com.ks.tool.bkz.service.sdlj.SDLJGoodsService;
import com.ks.tool.bkz.service.sdlj.SDLJUserGoodsService;
import com.ks.tool.bkz.util.StringUtil;
import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory;
import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
@Service
public class SDLJGoodsServiceImpl implements SDLJGoodsService {
    @Resource
    private RedisManager redisManager;
    @Resource
    private TBGoodsService tbGoodsService;
    @Resource
    private FirstOrderSubInfoService firstOrderSubInfoService;
    @Resource
    private SDLJSimpleGoodsInfoMapper sdljSimpleGoodsInfoMapper;
    @Resource
    private SDLJUserGoodsService sdljUserGoodsService;
    private String getTBGoodsKey(String auctionId) {
        return "tb-goods-" + auctionId;
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void addSDLJGoods(FirstOrderSubInfo subInfo, Long uid, String tbUid) {
        //保存原始信息
        firstOrderSubInfoService.add(subInfo);
        addSimpleSDLJInfo(subInfo);
        //保存用户商品信息
        SDLJUserGoods userGoods = new SDLJUserGoods();
        userGoods.setGoodsId(Long.parseLong(subInfo.getItemId()));
        userGoods.setTbUid(tbUid);
        userGoods.setUid(uid);
        sdljUserGoodsService.addUserGoods(userGoods);
        //更新淘宝商品信息
        String key = getTBGoodsKey(subInfo.getItemId());
        if (!StringUtil.isNullOrEmpty(redisManager.get(key)))//暂时不需要更新
            return;
        DaTaoKeDetailV2 v2 = DaTaoKeApiUtil.getGoodsDetailByGoodsId(Long.parseLong(subInfo.getItemId()));
        if (v2 != null) {
            TBGoodsInfo goods = TBGoodsInfoFactory.create(v2);
            tbGoodsService.updateTBGoods(goods);
            //更新
            redisManager.save(key, "1", 60 * 10);
        }
    }
    private void addSimpleSDLJInfo(FirstOrderSubInfo info) {
        SDLJSimpleGoodsInfo sinfo = new SDLJSimpleGoodsInfo();
        sinfo.setActivityPrice(info.getItemActPrice());
        sinfo.setGoodsId(Long.parseLong(info.getItemId()));
        sinfo.setPromotionAmount(new BigDecimal(info.getPromotionDisplayAmount()));
        SDLJSimpleGoodsInfo old = sdljSimpleGoodsInfoMapper.selectByGoodsIdAndPromotionAmount(sinfo.getGoodsId(), sinfo.getPromotionAmount());
        if(old==null){
            sinfo.setCreateTime(new Date());
            sinfo.setUpdateTime(new Date());
            sinfo.setPromotionAmount(new BigDecimal(info.getPromotionDisplayAmount()));
            sdljSimpleGoodsInfoMapper.insertSelective(sinfo);
        }else{
           if(System.currentTimeMillis()- old.getUpdateTime().getTime()>1000*60*10){//超过10分钟更新
               sinfo.setId(old.getId());
               sinfo.setUpdateTime(new Date());
               sdljSimpleGoodsInfoMapper.updateByPrimaryKeySelective(sinfo);
           }
        }
    }
}
src/main/java/com/ks/tool/bkz/service/impl/sdlj/SDLJUserGoodsServiceImpl.java
New file
@@ -0,0 +1,72 @@
package com.ks.tool.bkz.service.impl.sdlj;
import com.ks.tool.bkz.dao.mybatis.sdlj.SDLJUserGoodsMapper;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
import com.ks.tool.bkz.entity.TBGoodsInfo;
import com.ks.tool.bkz.entity.sdlj.SDLJUserGoods;
import com.ks.tool.bkz.service.TBGoodsService;
import com.ks.tool.bkz.service.manager.RedisManager;
import com.ks.tool.bkz.service.sdlj.FirstOrderSubInfoService;
import com.ks.tool.bkz.service.sdlj.SDLJGoodsService;
import com.ks.tool.bkz.service.sdlj.SDLJUserGoodsService;
import com.ks.tool.bkz.util.MoneyBigDecimalUtil;
import com.ks.tool.bkz.util.StringUtil;
import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory;
import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsInfoVO;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsSearchVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class SDLJUserGoodsServiceImpl implements SDLJUserGoodsService {
    @Resource
    private SDLJUserGoodsMapper sdljUserGoodsMapper;
    @Override
    public void addUserGoods(SDLJUserGoods goods) {
        if (goods == null)
            return;
        //查询是否存在
        SDLJUserGoods old = sdljUserGoodsMapper.selectByGoodsIdAndUidAndTBUid(goods.getGoodsId(), goods.getUid(), goods.getTbUid());
        if (old == null) {//新增
            if (goods.getCreateTime() == null)
                goods.setCreateTime(new Date());
            sdljUserGoodsMapper.insertSelective(goods);
        } else {//更改时间
            SDLJUserGoods update = new SDLJUserGoods();
            update.setId(old.getId());
            update.setCreateTime(new Date());
            sdljUserGoodsMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public List<SDLJGoodsInfoVO> query(SDLJGoodsSearchVO vo, Long uid, int page, int pageSize) {
        return buildGoods(sdljUserGoodsMapper.query(vo, uid, (page - 1) * pageSize, pageSize));
    }
    private List<SDLJGoodsInfoVO> buildGoods(List<SDLJGoodsInfoVO> goodsList) {
        if (goodsList != null)
            for (SDLJGoodsInfoVO vo : goodsList) {
                if(vo.getActualPrice().compareTo(new BigDecimal(1))<=0)
                    vo.setMark(true);
                vo.setCommission(MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(vo.getActualPrice(),vo.getCommissionRate()),new BigDecimal(100)));
                List<String> imgList = new ArrayList<>();
                for (String st : vo.getImgs().split(","))
                    imgList.add(st);
                vo.setImgList(imgList);
            }
            return goodsList;
    }
}
src/main/java/com/ks/tool/bkz/service/impl/user/CardPwdImpl.java
@@ -38,7 +38,7 @@
        CardPwdInfo info = selectByCard(card);
        if (info == null)
            throw new CardPwdException(1, "卡号不存在");
        if (info.getPwd().equalsIgnoreCase(pwd))
        if (!info.getPwd().equalsIgnoreCase(pwd))
            throw new CardPwdException(2, "卡密不匹配");
        if (info.getConsumeState() == CardPwdInfo.STATE_CONSUMED)
            throw new CardPwdException(3, "卡密已被使用");
src/main/java/com/ks/tool/bkz/service/impl/user/SDLJShareOpenHistoryServiceImpl.java
@@ -1,6 +1,6 @@
package com.ks.tool.bkz.service.impl.user;
import com.ks.tool.bkz.dao.mybatis.user.SDLJShareOpenHistoryMapper;
import com.ks.tool.bkz.dao.mybatis.sdlj.SDLJShareOpenHistoryMapper;
import com.ks.tool.bkz.entity.user.SDLJShareOpenHistory;
import com.ks.tool.bkz.exception.SDLJShareOpenHistoryException;
import com.ks.tool.bkz.service.user.SDLJShareOpenHistoryService;
src/main/java/com/ks/tool/bkz/service/impl/user/UserUpgradeServiceImpl.java
@@ -50,6 +50,7 @@
        Date expireTime = CardPwdUtil.getExpireTime(startTime, type);
        SDLJShareOpenHistory history = new SDLJShareOpenHistory();
        history.setUid(uid);
        history.setExpireTime(expireTime);
        history.setCreateTime(new Date());
        history.setStartTime(startTime);
src/main/java/com/ks/tool/bkz/service/sdlj/FirstOrderSubInfoService.java
File was renamed from src/main/java/com/ks/tool/bkz/service/FirstOrderSubInfoService.java
@@ -1,4 +1,4 @@
package com.ks.tool.bkz.service;
package com.ks.tool.bkz.service.sdlj;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
src/main/java/com/ks/tool/bkz/service/sdlj/SDLJGoodsService.java
New file
@@ -0,0 +1,14 @@
package com.ks.tool.bkz.service.sdlj;
import com.ks.tool.bkz.entity.FirstOrderSubInfo;
/**
 * 首单立减商品服务
 */
public interface SDLJGoodsService {
    /**
     * 添加首单礼金商品
     * @param subInfo
     */
    public void addSDLJGoods(FirstOrderSubInfo subInfo,Long uid,String tbUid);
}
src/main/java/com/ks/tool/bkz/service/sdlj/SDLJUserGoodsService.java
New file
@@ -0,0 +1,14 @@
package com.ks.tool.bkz.service.sdlj;
import com.ks.tool.bkz.entity.sdlj.SDLJUserGoods;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsInfoVO;
import com.ks.tool.bkz.vo.sdlj.SDLJGoodsSearchVO;
import java.util.List;
public interface SDLJUserGoodsService {
    public void addUserGoods(SDLJUserGoods goods);
    public List<SDLJGoodsInfoVO> query(SDLJGoodsSearchVO vo, Long uid, int page, int pageSize);
}
src/main/java/com/ks/tool/bkz/util/JsonUtil.java
@@ -1,22 +1,44 @@
package com.ks.tool.bkz.util;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.*;
import net.sf.json.JSONObject;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.Date;
public class JsonUtil {
    public static String loadTrueResult(JSONObject data) {
    public static String loadTrueResult(Object data) {
        JSONObject root = new JSONObject();
        root.put("code", 0);
        root.put("data", data);
        return root.toJSONString();
        return root.toString();
    }
    public static String loadFalseResult(int code, String msg) {
        JSONObject root = new JSONObject();
        root.put("code", code);
        root.put("msg", msg);
        return root.toJSONString();
        return root.toString();
    }
    public static Gson getSimpleGson(){
        return new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return null;
                } else {
                    return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(),"yyyy-MM-dd HH:mm:ss"));
                }
            }
        }).create();
    }
}
src/main/java/com/ks/tool/bkz/util/MoneyBigDecimalUtil.java
New file
@@ -0,0 +1,51 @@
package com.ks.tool.bkz.util;
import java.math.BigDecimal;
public class MoneyBigDecimalUtil {
    public static BigDecimal add(BigDecimal v1, BigDecimal v2) {
        return v1.add(v2).setScale(2, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal sub(BigDecimal b1, BigDecimal b2) {
        return b1.subtract(b2).setScale(2, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal mul(BigDecimal d1, BigDecimal d2) { // 进行乘法运算
        return d1.multiply(d2).setScale(2, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal mul2(BigDecimal d1, BigDecimal d2) { // 进行乘法运算
        return d1.multiply(d2).setScale(2, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal mul(BigDecimal d1, BigDecimal d2,int scale) { // 进行乘法运算
        return d1.multiply(d2).setScale(scale, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal div(BigDecimal d1, BigDecimal d2) {// 进行除法运算
        return d1.divide(d2, 2, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal divUp(BigDecimal d1, BigDecimal d2) {// 进行除法运算
        return d1.divide(d2, 2, BigDecimal.ROUND_UP);
    }
    public static BigDecimal div3(BigDecimal d1, BigDecimal d2) {// 进行除法运算
        return d1.divide(d2, 3, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal div(BigDecimal d1, BigDecimal d2,int scale) {// 进行除法运算
        return d1.divide(d2, scale, BigDecimal.ROUND_DOWN);
    }
    public static BigDecimal getWithNoZera(BigDecimal num) {// 进行除法运算
        while (num.toString().endsWith("0") && num.toString().indexOf(".") > -1) {
            num = new BigDecimal(num.toString().substring(0, num.toString().length() - 1));
            return getWithNoZera(num);
        }
        return num;
    }
}
src/main/java/com/ks/tool/bkz/util/annotation/Login.java
New file
@@ -0,0 +1,21 @@
package com.ks.tool.bkz.util.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 * 金币获得版本控制器
 *
 * @author Administrator
 *
 */
@Documented
@Target(ElementType.METHOD)
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface Login {
}
src/main/java/com/ks/tool/bkz/util/factory/TBGoodsInfoFactory.java
New file
@@ -0,0 +1,43 @@
package com.ks.tool.bkz.util.factory;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.entity.TBGoodsInfo;
import com.ks.tool.bkz.util.StringUtil;
import com.ks.tool.bkz.util.tb.TaoBaoUtil;
import java.math.BigDecimal;
import java.util.List;
public class TBGoodsInfoFactory {
    public static TBGoodsInfo create(DaTaoKeDetailV2 dg) {
        TBGoodsInfo goods = new TBGoodsInfo();
        goods.setCommissionRate(dg.getCommissionRate());
        if (dg.getCouponPrice().compareTo(new BigDecimal(0)) <= 0) {
            goods.setZkPrice(dg.getActualPrice());
        } else {
            goods.setZkPrice(dg.getOriginalPrice());
        }
        goods.setCouponAmount(dg.getCouponPrice());
        goods.setCouponEndTime(dg.getCouponEndTime());
        goods.setCouponLeftCount(dg.getCouponTotalNum());
        goods.setCouponPrice(dg.getActualPrice());
        if (!StringUtil.isNullOrEmpty(dg.getCouponConditions())) {
            List<BigDecimal> moneys = TaoBaoUtil.getCouponInfo(dg.getCouponConditions());
            goods.setCouponStartPrice(moneys.get(0));
        }
        goods.setCouponStartTime(dg.getCouponStartTime());
        goods.setCouponTotalCount(dg.getCouponTotalNum() - dg.getCouponReceiveNum());
        goods.setGoodsId(dg.getGoodsId());
        goods.setImgs(dg.getImgs());
        goods.setSalesNum(dg.getMonthSales());
        goods.setTitle(dg.getTitle());
        goods.setCid(dg.getTbcid());
        if (dg.getItemLink().contains("detail.tmall.com"))
            goods.setTmall(1);
        else
            goods.setTmall(0);
        return goods;
    }
}
src/main/java/com/ks/tool/bkz/util/tb/DaTaoKeApiUtil.java
New file
@@ -0,0 +1,130 @@
package com.ks.tool.bkz.util.tb;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.util.HttpUtil;
import com.ks.tool.bkz.util.StringUtil;
import com.ks.tool.bkz.util.TimeUtil;
import net.sf.json.JSONObject;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
public class DaTaoKeApiUtil {
    final static String APP_KEY = "5cf75b0f2c0e4";
    final static String APP_KEY_SECRET = "b14f1fa115129a447937ca998b311d1e";
    static Gson gson = null;
    static {
        gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() {
            @Override
            public boolean shouldSkipField(FieldAttributes f) {
                return f.getName().equals("createTime");// 忽略createTime的解析
            }
            @Override
            public boolean shouldSkipClass(Class<?> clazz) {
                return false;
            }
        }).create();
    }
    private static String get(String url) {
        HttpClient client = new HttpClient();
        try {
            client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
            client.getHttpConnectionManager().getParams().setSoTimeout(5000);
            GetMethod method = new GetMethod(url);
            client.executeMethod(method);
            return method.getResponseBodyAsString();
        } catch (HttpException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }
    private static String request(String url) {
        String result = null;
        while (result == null) {
            try {
                result = get(url);
                if ((result != null && result.startsWith("<html>")) || StringUtil.isNullOrEmpty(result))
                    result = null;
            } catch (Exception e) {
                try {
                    Thread.sleep(400);
                } catch (InterruptedException e1) {
                }
            }
        }
        return result;
    }
    public static DaTaoKeDetailV2 getGoodsDetailByGoodsId(Long goodsId) {
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.1.1");
        params.put("appKey",APP_KEY);
        params.put("goodsId", goodsId + "");
        params.put("sign", getSign(params, APP_KEY_SECRET));
        String result = HttpUtil
                .get("https://openapi.dataoke.com/api/goods/get-goods-details", params,
                new HashMap<>());
        System.out.println(result);
        JSONObject json = JSONObject.fromObject(result);
        JSONObject dataJson = json.optJSONObject("data");
        if (dataJson != null) {
            return parseDaTaoKeDetailV2(dataJson);
        }
        return null;
    }
    private static DaTaoKeDetailV2 parseDaTaoKeDetailV2(JSONObject json) {
        DaTaoKeDetailV2 detail = gson.fromJson(json.toString(), DaTaoKeDetailV2.class);
        return detail;
    }
    private static String requestGet(String url, Map<String, String> params) {
        Iterator<String> keys = params.keySet().iterator();
        url += "?";
        while (keys.hasNext()) {
            String key = keys.next();
            try {
                url += String.format("%s=%s&", key, URLEncoder.encode(params.get(key), "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        return HttpUtil.get(url, 10000);
    }
    private static String getSign(Map<String, String> map, String secretKey) {
        if (map.size() == 0) {
            return "";
        }
        StringBuffer sb = new StringBuffer("");
        Set<String> keySet = map.keySet();
        Iterator<String> iter = keySet.iterator();
        while (iter.hasNext()) {
            String key = iter.next();
            sb.append("&" + key + "=" + map.get(key));
        }
        sb.deleteCharAt(0);
        String signStr = "";
        signStr = sb.toString() + "&key=" + secretKey;
        return StringUtil.Md5(signStr).toUpperCase();
    }
}
src/main/java/com/ks/tool/bkz/util/tb/TaoBaoUtil.java
New file
@@ -0,0 +1,30 @@
package com.ks.tool.bkz.util.tb;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TaoBaoUtil {
    public static List<BigDecimal> getCouponInfo(String info) {
        Pattern p = Pattern.compile("满\\d+(\\.\\d+)?元减\\d+(\\.\\d+)?元");
        Matcher matcher = p.matcher(info);
        Pattern p2 = Pattern.compile("\\d+元无条件券");
        Matcher matcher2 = p2.matcher(info);
        List<BigDecimal> list = new ArrayList<BigDecimal>();
        if (matcher.matches()) {
            String[] sts = info.split("元减");
            list.add(new BigDecimal(sts[0].replace("满", "").trim()));
            list.add(new BigDecimal(sts[1].replace("元", "").trim()));
        } else if (matcher2.matches()) {
            String[] split = info.split("元无条件券");
            list.add(new BigDecimal(0));
            list.add(new BigDecimal(split[0]));
        } else {
            list.add(new BigDecimal(0));
            list.add(new BigDecimal(0));
        }
        return list;
    }
}
src/main/java/com/ks/tool/bkz/vo/sdlj/SDLJGoodsInfoVO.java
@@ -1,18 +1,56 @@
package com.ks.tool.bkz.vo.sdlj;
import java.math.BigDecimal;
import java.util.List;
public class SDLJGoodsInfoVO {
    private int index;
    private String title;
    private String zkPrice;
    private String couponPrice;
    private String lijinAmount;
    private String goodsId;
    private String actualPrice;
    private String commission;
    private String commissionRate;
    private BigDecimal zkPrice;
    private BigDecimal couponPrice;
    private BigDecimal lijinAmount;
    private Long goodsId;
    private BigDecimal actualPrice;
    private BigDecimal commission;
    private BigDecimal commissionRate;
    private List<String> imgList;
    private String imgs;
    private String salesNum;//销量
    private BigDecimal couponAmount;//券面额
    private Integer tmall;//天猫
    private Boolean mark;
    public Boolean getMark() {
        return mark;
    }
    public void setMark(Boolean mark) {
        this.mark = mark;
    }
    public String getSalesNum() {
        return salesNum;
    }
    public void setSalesNum(String salesNum) {
        this.salesNum = salesNum;
    }
    public BigDecimal getCouponAmount() {
        return couponAmount;
    }
    public void setCouponAmount(BigDecimal couponAmount) {
        this.couponAmount = couponAmount;
    }
    public Integer getTmall() {
        return tmall;
    }
    public void setTmall(Integer tmall) {
        this.tmall = tmall;
    }
    public int getIndex() {
        return index;
@@ -30,59 +68,59 @@
        this.title = title;
    }
    public String getZkPrice() {
    public BigDecimal getZkPrice() {
        return zkPrice;
    }
    public void setZkPrice(String zkPrice) {
    public void setZkPrice(BigDecimal zkPrice) {
        this.zkPrice = zkPrice;
    }
    public String getCouponPrice() {
    public BigDecimal getCouponPrice() {
        return couponPrice;
    }
    public void setCouponPrice(String couponPrice) {
    public void setCouponPrice(BigDecimal couponPrice) {
        this.couponPrice = couponPrice;
    }
    public String getLijinAmount() {
    public BigDecimal getLijinAmount() {
        return lijinAmount;
    }
    public void setLijinAmount(String lijinAmount) {
    public void setLijinAmount(BigDecimal lijinAmount) {
        this.lijinAmount = lijinAmount;
    }
    public String getGoodsId() {
    public Long getGoodsId() {
        return goodsId;
    }
    public void setGoodsId(String goodsId) {
    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }
    public String getActualPrice() {
    public BigDecimal getActualPrice() {
        return actualPrice;
    }
    public void setActualPrice(String actualPrice) {
    public void setActualPrice(BigDecimal actualPrice) {
        this.actualPrice = actualPrice;
    }
    public String getCommission() {
    public BigDecimal getCommission() {
        return commission;
    }
    public void setCommission(String commission) {
    public void setCommission(BigDecimal commission) {
        this.commission = commission;
    }
    public String getCommissionRate() {
    public BigDecimal getCommissionRate() {
        return commissionRate;
    }
    public void setCommissionRate(String commissionRate) {
    public void setCommissionRate(BigDecimal commissionRate) {
        this.commissionRate = commissionRate;
    }
@@ -94,5 +132,16 @@
        this.imgList = imgList;
    }
    public String getImgs() {
        return imgs;
    }
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
}
src/main/java/com/ks/tool/bkz/vo/sdlj/SDLJGoodsSearchVO.java
New file
@@ -0,0 +1,172 @@
package com.ks.tool.bkz.vo.sdlj;
import java.math.BigDecimal;
//首单礼金搜索条件
public class SDLJGoodsSearchVO {
    public static int COUPON_TYPE_ALL=0;
    public static int COUPON_TYPE_HAVE = 1;
    public static int COUPON_TYPE_NO = 2;
    public static int SHOP_TYPE_ALL = 0;
    public static int SHOP_TYPE_TM = 1;
    public static int SHOP_TYPE_TAOBAO = 2;
    private String key; //关键字
    private Integer couponType;//券类型
    private Integer shopType;//店铺类型
    private BigDecimal minCouponPrice;//券后价
    private BigDecimal maxCouponPrice;
    private BigDecimal minLiJin; //礼金
    private BigDecimal maxLiJin;
    private BigDecimal minActualPrice;//到手价
    private BigDecimal maxActualPrice;
    private Integer minSalesNum; //月销
    private Integer maxSalesNum;
    private BigDecimal minCommission; //佣金
    private BigDecimal maxCommission;
    private BigDecimal minCommissionRate; //佣金比例
    private BigDecimal maxCommissionRate;
    private String sort;//排序
    private Integer classType;//商品分类
    public Integer getClassType() {
        return classType;
    }
    public void setClassType(Integer classType) {
        this.classType = classType;
    }
    public String getSort() {
        return sort;
    }
    public void setSort(String sort) {
        this.sort = sort;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public Integer getCouponType() {
        return couponType;
    }
    public void setCouponType(Integer couponType) {
        this.couponType = couponType;
    }
    public Integer getShopType() {
        return shopType;
    }
    public void setShopType(Integer shopType) {
        this.shopType = shopType;
    }
    public BigDecimal getMinCouponPrice() {
        return minCouponPrice;
    }
    public void setMinCouponPrice(BigDecimal minCouponPrice) {
        this.minCouponPrice = minCouponPrice;
    }
    public BigDecimal getMaxCouponPrice() {
        return maxCouponPrice;
    }
    public void setMaxCouponPrice(BigDecimal maxCouponPrice) {
        this.maxCouponPrice = maxCouponPrice;
    }
    public BigDecimal getMinLiJin() {
        return minLiJin;
    }
    public void setMinLiJin(BigDecimal minLiJin) {
        this.minLiJin = minLiJin;
    }
    public BigDecimal getMaxLiJin() {
        return maxLiJin;
    }
    public void setMaxLiJin(BigDecimal maxLiJin) {
        this.maxLiJin = maxLiJin;
    }
    public BigDecimal getMinActualPrice() {
        return minActualPrice;
    }
    public void setMinActualPrice(BigDecimal minActualPrice) {
        this.minActualPrice = minActualPrice;
    }
    public BigDecimal getMaxActualPrice() {
        return maxActualPrice;
    }
    public void setMaxActualPrice(BigDecimal maxActualPrice) {
        this.maxActualPrice = maxActualPrice;
    }
    public Integer getMinSalesNum() {
        return minSalesNum;
    }
    public void setMinSalesNum(Integer minSalesNum) {
        this.minSalesNum = minSalesNum;
    }
    public Integer getMaxSalesNum() {
        return maxSalesNum;
    }
    public void setMaxSalesNum(Integer maxSalesNum) {
        this.maxSalesNum = maxSalesNum;
    }
    public BigDecimal getMinCommission() {
        return minCommission;
    }
    public void setMinCommission(BigDecimal minCommission) {
        this.minCommission = minCommission;
    }
    public BigDecimal getMaxCommission() {
        return maxCommission;
    }
    public void setMaxCommission(BigDecimal maxCommission) {
        this.maxCommission = maxCommission;
    }
    public BigDecimal getMinCommissionRate() {
        return minCommissionRate;
    }
    public void setMinCommissionRate(BigDecimal minCommissionRate) {
        this.minCommissionRate = minCommissionRate;
    }
    public BigDecimal getMaxCommissionRate() {
        return maxCommissionRate;
    }
    public void setMaxCommissionRate(BigDecimal maxCommissionRate) {
        this.maxCommissionRate = maxCommissionRate;
    }
}
src/main/java/com/ks/tool/bkz/vo/user/UserInfoVO.java
New file
@@ -0,0 +1,43 @@
package com.ks.tool.bkz.vo.user;
import java.util.Date;
public class UserInfoVO {
    private String account;//账号
    private String token;//token
    private Date sdljShareExpireTime;//首单优惠结束时间
    public UserInfoVO(String account, String token, Date sdljShareExpireTime) {
        this.account = account;
        this.token = token;
        this.sdljShareExpireTime = sdljShareExpireTime;
    }
    public UserInfoVO() {
    }
    public String getAccount() {
        return account;
    }
    public void setAccount(String account) {
        this.account = account;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public Date getSdljShareExpireTime() {
        return sdljShareExpireTime;
    }
    public void setSdljShareExpireTime(Date sdljShareExpireTime) {
        this.sdljShareExpireTime = sdljShareExpireTime;
    }
}
src/main/resources/application.yml
@@ -51,7 +51,7 @@
        max-idle: 200
        max-active: 1024
    database: 2
mybatis:
  mapper-locations: classpath:mapper/*.xml
  mapper-locations: classpath:mapper/*.xml,classpath:mapper/sdlj/*.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
src/main/resources/generatorConfig.xml
@@ -69,10 +69,27 @@
                       enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
                       selectByExampleQueryId="false"/>
        -->
        <!--
                <table tableName="tt_sdlj_share_open_history" domainObjectName="SDLJShareOpenHistory"  enableCountByExample="false"
                       enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
                       selectByExampleQueryId="false"/>
        <table tableName="tt_sdlj_goods_info" domainObjectName="SDLJSimpleGoodsInfo"  enableCountByExample="false"
               enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
               selectByExampleQueryId="false"/>
        <table tableName="tt_user_goods" domainObjectName="SDLJUserGoods"  enableCountByExample="false"
               enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
               selectByExampleQueryId="false"/>
        <table tableName="tt_tb_goods_info" domainObjectName="TBGoodsInfo"  enableCountByExample="false"
               enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
               selectByExampleQueryId="false"/>
      -->
        <table tableName="tt_config" domainObjectName="Config"  enableCountByExample="false"
               enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
               selectByExampleQueryId="false"/>
src/main/resources/mapper/ConfigMapper.xml
New file
@@ -0,0 +1,115 @@
<?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.ks.tool.bkz.dao.mybatis.ConfigMapper">
    <resultMap id="BaseResultMap" type="com.ks.tool.bkz.entity.Config">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="key" property="key" jdbcType="VARCHAR"/>
        <result column="value" property="value" jdbcType="VARCHAR"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="client" property="client" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">
    id, `key`, `value`, `name`, client, create_time
  </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List"/>
        from tt_config
        where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="listByClientId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from tt_config
        where client = #{0}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from tt_config
    where id = #{id,jdbcType=BIGINT}
  </delete>
    <insert id="insert" parameterType="com.ks.tool.bkz.entity.Config">
    insert into tt_config (id, `key`, `value`,
      `name`, client, create_time
      )
    values (#{id,jdbcType=BIGINT}, #{key,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR},
      #{name,jdbcType=VARCHAR}, #{client,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
    <insert id="insertSelective" parameterType="com.ks.tool.bkz.entity.Config">
        insert into tt_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="key != null">
                `key`,
            </if>
            <if test="value != null">
                `value`,
            </if>
            <if test="name != null">
                `name`,
            </if>
            <if test="client != null">
                client,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="key != null">
                #{key,jdbcType=VARCHAR},
            </if>
            <if test="value != null">
                #{value,jdbcType=VARCHAR},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="client != null">
                #{client,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.ks.tool.bkz.entity.Config">
        update tt_config
        <set>
            <if test="key != null">
                `key` = #{key,jdbcType=VARCHAR},
            </if>
            <if test="value != null">
                `value` = #{value,jdbcType=VARCHAR},
            </if>
            <if test="name != null">
                `name` = #{name,jdbcType=VARCHAR},
            </if>
            <if test="client != null">
                client = #{client,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.ks.tool.bkz.entity.Config">
    update tt_config
    set `key` = #{key,jdbcType=VARCHAR},
      `value` = #{value,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      client = #{client,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
src/main/resources/mapper/TBGoodsInfoMapper.xml
New file
@@ -0,0 +1,268 @@
<?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.ks.tool.bkz.dao.mybatis.TBGoodsInfoMapper">
  <resultMap id="BaseResultMap" type="com.ks.tool.bkz.entity.TBGoodsInfo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="goods_id" jdbcType="BIGINT" property="goodsId" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="imgs" jdbcType="VARCHAR" property="imgs" />
    <result column="zk_price" jdbcType="DECIMAL" property="zkPrice" />
    <result column="coupon_info" jdbcType="VARCHAR" property="couponInfo" />
    <result column="coupon_amount" jdbcType="DECIMAL" property="couponAmount" />
    <result column="coupon_start_price" jdbcType="DECIMAL" property="couponStartPrice" />
    <result column="coupon_total_count" jdbcType="INTEGER" property="couponTotalCount" />
    <result column="coupon_left_count" jdbcType="INTEGER" property="couponLeftCount" />
    <result column="coupon_start_time" jdbcType="VARCHAR" property="couponStartTime" />
    <result column="coupon_end_time" jdbcType="VARCHAR" property="couponEndTime" />
    <result column="coupon_price" jdbcType="DECIMAL" property="couponPrice" />
    <result column="sales_num" jdbcType="INTEGER" property="salesNum" />
    <result column="commission_rate" jdbcType="DECIMAL" property="commissionRate" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="tmall" jdbcType="INTEGER" property="tmall" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="cid" jdbcType="INTEGER" property="cid" />
  </resultMap>
  <sql id="Base_Column_List">
    id, goods_id, title, imgs, zk_price, coupon_info, coupon_amount, coupon_start_price,
    coupon_total_count, coupon_left_count, coupon_start_time, coupon_end_time, coupon_price,
    sales_num, commission_rate, create_time, tmall, update_time, cid
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from tt_tb_goods_info
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByAuctionId" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from tt_tb_goods_info
    where goods_id = #{0}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from tt_tb_goods_info
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.ks.tool.bkz.entity.TBGoodsInfo">
    insert into tt_tb_goods_info (id, goods_id, title,
      imgs, zk_price, coupon_info,
      coupon_amount, coupon_start_price, coupon_total_count,
      coupon_left_count, coupon_start_time, coupon_end_time,
      coupon_price, sales_num, commission_rate,
      create_time, tmall, update_time,
      cid)
    values (#{id,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
      #{imgs,jdbcType=VARCHAR}, #{zkPrice,jdbcType=DECIMAL}, #{couponInfo,jdbcType=VARCHAR},
      #{couponAmount,jdbcType=DECIMAL}, #{couponStartPrice,jdbcType=DECIMAL}, #{couponTotalCount,jdbcType=INTEGER},
      #{couponLeftCount,jdbcType=INTEGER}, #{couponStartTime,jdbcType=VARCHAR}, #{couponEndTime,jdbcType=VARCHAR},
      #{couponPrice,jdbcType=DECIMAL}, #{salesNum,jdbcType=INTEGER}, #{commissionRate,jdbcType=DECIMAL},
      #{createTime,jdbcType=TIMESTAMP}, #{tmall,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP},
      #{cid,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.ks.tool.bkz.entity.TBGoodsInfo">
    insert into tt_tb_goods_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="goodsId != null">
        goods_id,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="imgs != null">
        imgs,
      </if>
      <if test="zkPrice != null">
        zk_price,
      </if>
      <if test="couponInfo != null">
        coupon_info,
      </if>
      <if test="couponAmount != null">
        coupon_amount,
      </if>
      <if test="couponStartPrice != null">
        coupon_start_price,
      </if>
      <if test="couponTotalCount != null">
        coupon_total_count,
      </if>
      <if test="couponLeftCount != null">
        coupon_left_count,
      </if>
      <if test="couponStartTime != null">
        coupon_start_time,
      </if>
      <if test="couponEndTime != null">
        coupon_end_time,
      </if>
      <if test="couponPrice != null">
        coupon_price,
      </if>
      <if test="salesNum != null">
        sales_num,
      </if>
      <if test="commissionRate != null">
        commission_rate,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="tmall != null">
        tmall,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="cid != null">
        cid,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="goodsId != null">
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="imgs != null">
        #{imgs,jdbcType=VARCHAR},
      </if>
      <if test="zkPrice != null">
        #{zkPrice,jdbcType=DECIMAL},
      </if>
      <if test="couponInfo != null">
        #{couponInfo,jdbcType=VARCHAR},
      </if>
      <if test="couponAmount != null">
        #{couponAmount,jdbcType=DECIMAL},
      </if>
      <if test="couponStartPrice != null">
        #{couponStartPrice,jdbcType=DECIMAL},
      </if>
      <if test="couponTotalCount != null">
        #{couponTotalCount,jdbcType=INTEGER},
      </if>
      <if test="couponLeftCount != null">
        #{couponLeftCount,jdbcType=INTEGER},
      </if>
      <if test="couponStartTime != null">
        #{couponStartTime,jdbcType=VARCHAR},
      </if>
      <if test="couponEndTime != null">
        #{couponEndTime,jdbcType=VARCHAR},
      </if>
      <if test="couponPrice != null">
        #{couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="salesNum != null">
        #{salesNum,jdbcType=INTEGER},
      </if>
      <if test="commissionRate != null">
        #{commissionRate,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tmall != null">
        #{tmall,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cid != null">
        #{cid,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ks.tool.bkz.entity.TBGoodsInfo">
    update tt_tb_goods_info
    <set>
      <if test="goodsId != null">
        goods_id = #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="imgs != null">
        imgs = #{imgs,jdbcType=VARCHAR},
      </if>
      <if test="zkPrice != null">
        zk_price = #{zkPrice,jdbcType=DECIMAL},
      </if>
      <if test="couponInfo != null">
        coupon_info = #{couponInfo,jdbcType=VARCHAR},
      </if>
      <if test="couponAmount != null">
        coupon_amount = #{couponAmount,jdbcType=DECIMAL},
      </if>
      <if test="couponStartPrice != null">
        coupon_start_price = #{couponStartPrice,jdbcType=DECIMAL},
      </if>
      <if test="couponTotalCount != null">
        coupon_total_count = #{couponTotalCount,jdbcType=INTEGER},
      </if>
      <if test="couponLeftCount != null">
        coupon_left_count = #{couponLeftCount,jdbcType=INTEGER},
      </if>
      <if test="couponStartTime != null">
        coupon_start_time = #{couponStartTime,jdbcType=VARCHAR},
      </if>
      <if test="couponEndTime != null">
        coupon_end_time = #{couponEndTime,jdbcType=VARCHAR},
      </if>
      <if test="couponPrice != null">
        coupon_price = #{couponPrice,jdbcType=DECIMAL},
      </if>
      <if test="salesNum != null">
        sales_num = #{salesNum,jdbcType=INTEGER},
      </if>
      <if test="commissionRate != null">
        commission_rate = #{commissionRate,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tmall != null">
        tmall = #{tmall,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cid != null">
        cid = #{cid,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ks.tool.bkz.entity.TBGoodsInfo">
    update tt_tb_goods_info
    set goods_id = #{goodsId,jdbcType=BIGINT},
      title = #{title,jdbcType=VARCHAR},
      imgs = #{imgs,jdbcType=VARCHAR},
      zk_price = #{zkPrice,jdbcType=DECIMAL},
      coupon_info = #{couponInfo,jdbcType=VARCHAR},
      coupon_amount = #{couponAmount,jdbcType=DECIMAL},
      coupon_start_price = #{couponStartPrice,jdbcType=DECIMAL},
      coupon_total_count = #{couponTotalCount,jdbcType=INTEGER},
      coupon_left_count = #{couponLeftCount,jdbcType=INTEGER},
      coupon_start_time = #{couponStartTime,jdbcType=VARCHAR},
      coupon_end_time = #{couponEndTime,jdbcType=VARCHAR},
      coupon_price = #{couponPrice,jdbcType=DECIMAL},
      sales_num = #{salesNum,jdbcType=INTEGER},
      commission_rate = #{commissionRate,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      tmall = #{tmall,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      cid = #{cid,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
src/main/resources/mapper/sdlj/SDLJShareOpenHistoryMapper.xml
File was renamed from src/main/resources/mapper/SDLJShareOpenHistoryMapper.xml
@@ -1,6 +1,6 @@
<?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.ks.tool.bkz.dao.mybatis.user.SDLJShareOpenHistoryMapper" >
<mapper namespace="com.ks.tool.bkz.dao.mybatis.sdlj.SDLJShareOpenHistoryMapper" >
  <resultMap id="BaseResultMap" type="com.ks.tool.bkz.entity.user.SDLJShareOpenHistory" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="uid" property="uid" jdbcType="BIGINT" />
@@ -29,7 +29,7 @@
    select
    <include refid="Base_Column_List" />
    from tt_sdlj_share_open_history
    where uid = #{uid} and create_time>=#{time} and #{time}>expire_time limit 1
    where uid = #{uid} and #{time}>=start_time and expire_time>=#{time} limit 1
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
src/main/resources/mapper/sdlj/SDLJSimpleGoodsInfoMapper.xml
New file
@@ -0,0 +1,114 @@
<?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.ks.tool.bkz.dao.mybatis.sdlj.SDLJSimpleGoodsInfoMapper" >
  <resultMap id="BaseResultMap" type="com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="goods_id" property="goodsId" jdbcType="BIGINT" />
    <result column="promotion_amount" property="promotionAmount" jdbcType="DECIMAL" />
    <result column="activity_price" property="activityPrice" jdbcType="DECIMAL" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, goods_id, promotion_amount, activity_price, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select
    <include refid="Base_Column_List" />
    from tt_sdlj_goods_info
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByGoodsIdAndPromotionAmount" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from tt_sdlj_goods_info
    where promotion_amount = #{money} and goods_id=#{goodsId}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from tt_sdlj_goods_info
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo" >
    insert into tt_sdlj_goods_info (id, goods_id, promotion_amount,
      activity_price, create_time, update_time
      )
    values (#{id,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, #{promotionAmount,jdbcType=DECIMAL},
      #{activityPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo" >
    insert into tt_sdlj_goods_info
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="goodsId != null" >
        goods_id,
      </if>
      <if test="promotionAmount != null" >
        promotion_amount,
      </if>
      <if test="activityPrice != null" >
        activity_price,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="goodsId != null" >
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="promotionAmount != null" >
        #{promotionAmount,jdbcType=DECIMAL},
      </if>
      <if test="activityPrice != null" >
        #{activityPrice,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo" >
    update tt_sdlj_goods_info
    <set >
      <if test="goodsId != null" >
        goods_id = #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="promotionAmount != null" >
        promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
      </if>
      <if test="activityPrice != null" >
        activity_price = #{activityPrice,jdbcType=DECIMAL},
      </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>
  <update id="updateByPrimaryKey" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJSimpleGoodsInfo" >
    update tt_sdlj_goods_info
    set goods_id = #{goodsId,jdbcType=BIGINT},
      promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
      activity_price = #{activityPrice,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
src/main/resources/mapper/sdlj/SDLJUserGoodsMapper.xml
New file
@@ -0,0 +1,207 @@
<?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.ks.tool.bkz.dao.mybatis.sdlj.SDLJUserGoodsMapper">
    <resultMap id="BaseResultMap" type="com.ks.tool.bkz.entity.sdlj.SDLJUserGoods">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="goods_id" property="goodsId" jdbcType="BIGINT"/>
        <result column="uid" property="uid" jdbcType="BIGINT"/>
        <result column="tb_uid" property="tbUid" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    </resultMap>
    <resultMap id="QueryResultMap" type="com.ks.tool.bkz.vo.sdlj.SDLJGoodsInfoVO">
        <result column="title" property="title" jdbcType="VARCHAR"/>
        <result column="zkPrice" property="zkPrice" jdbcType="DECIMAL"/>
        <result column="couponPrice" property="couponPrice" jdbcType="DECIMAL"/>
        <result column="lijinAmount" property="lijinAmount" jdbcType="DECIMAL"/>
        <result column="goodsId" property="goodsId" jdbcType="BIGINT"/>
        <result column="actualPrice" property="actualPrice" jdbcType="DECIMAL"/>
        <result column="commissionRate" property="commissionRate" jdbcType="DECIMAL"/>
        <result column="imgs" property="imgs" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
    id, goods_id, uid, tb_uid, create_time
  </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List"/>
        from tt_user_goods
        where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from tt_user_goods
    where id = #{id,jdbcType=BIGINT}
  </delete>
    <insert id="insert" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJUserGoods">
    insert into tt_user_goods (id, goods_id, uid,
      tb_uid, create_time)
    values (#{id,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT},
      #{tbUid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
    <insert id="insertSelective" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJUserGoods">
        insert into tt_user_goods
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="goodsId != null">
                goods_id,
            </if>
            <if test="uid != null">
                uid,
            </if>
            <if test="tbUid != null">
                tb_uid,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="goodsId != null">
                #{goodsId,jdbcType=BIGINT},
            </if>
            <if test="uid != null">
                #{uid,jdbcType=BIGINT},
            </if>
            <if test="tbUid != null">
                #{tbUid,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJUserGoods">
        update tt_user_goods
        <set>
            <if test="goodsId != null">
                goods_id = #{goodsId,jdbcType=BIGINT},
            </if>
            <if test="uid != null">
                uid = #{uid,jdbcType=BIGINT},
            </if>
            <if test="tbUid != null">
                tb_uid = #{tbUid,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJUserGoods">
    update tt_user_goods
    set goods_id = #{goodsId,jdbcType=BIGINT},
      uid = #{uid,jdbcType=BIGINT},
      tb_uid = #{tbUid,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
    <sql id="queryWhere">
        1=1 and tg.id>0 AND t.id>0 and s.id>0
        <if test="uid!=null">
            AND t.`uid`=#{uid}
        </if>
        <if test="vo.couponType!=null">
            <if test="vo.couponType==1">
                AND tg.`coupon_amount`>=0
            </if>
            <if test="vo.couponType==2">
                AND 0>= tg.`coupon_amount`
            </if>
        </if>
        <if test="vo.shopType!=null">
            <if test="vo.shopType==1">
                AND tg.`tmall`=1
            </if>
            <if test="vo.shopType==2">
                AND tg.`tmall`=0
            </if>
        </if>
        <if test="vo.minCouponPrice!=null">
            AND    tg.`coupon_price`>=#{vo.minCouponPrice}
        </if>
        <if test="vo.maxCouponPrice!=null">
            AND   #{vo.maxCouponPrice}>= tg.`coupon_price`
        </if>
        <if test="vo.minLiJin!=null">
            AND   s.`promotion_amount`>=#{vo.minLiJin}
        </if>
        <if test="vo.maxLiJin!=null">
            AND  #{vo.maxLiJin}>=s.`promotion_amount`
        </if>
        <if test="vo.minActualPrice!=null">
            AND  (tg.`coupon_price`-s.`promotion_amount`)>=#{vo.minActualPrice}
        </if>
        <if test="vo.maxActualPrice!=null">
            AND  #{vo.maxActualPrice}>=(tg.`coupon_price`-s.`promotion_amount`)
        </if>
        <if test="vo.minSalesNum!=null">
            AND  tg.sales_num>=#{vo.minSalesNum}
        </if>
        <if test="vo.maxSalesNum!=null">
            AND  #{vo.maxSalesNum}>=tg.sales_num
        </if>
        <if test="vo.minCommission!=null">
            AND  ((tg.`coupon_price`-s.`promotion_amount`)*tg.commission_rate/100)>=#{vo.minCommission}
        </if>
        <if test="vo.maxCommission!=null">
            AND  #{vo.maxCommission}>=((tg.`coupon_price`-s.`promotion_amount`)*tg.commission_rate/100)
        </if>
        <if test="vo.minCommissionRate!=null">
            AND  tg.commission_rate>=#{vo.minCommissionRate}
        </if>
        <if test="vo.maxCommissionRate!=null">
            AND  #{vo.maxCommissionRate}>=tg.commission_rate
        </if>
        <if test="vo.key!=null">
            AND  tg.title like CONCAT('%',#{vo.key},'%')
        </if>
        <if test="vo.classType!=null">
            AND  tg.cid =vo.classType
        </if>
        GROUP BY t.`goods_id`
    </sql>
    <select id="query" resultMap="QueryResultMap">
        SELECT tg.`title` AS title,tg.`zk_price` AS zkPrice,tg.`coupon_price` AS couponPrice,s.`promotion_amount` AS
        lijinAmount,tg.`goods_id` AS goodsId,(tg.`coupon_price`-s.`promotion_amount`) AS actualPrice,
        tg.`commission_rate` AS commissionRate,tg.`imgs` AS imgs,tg.sales_num as salesNum,tg.coupon_amount as couponAmount,tg.tmall
        FROM `tt_user_goods` t
        LEFT JOIN `tt_sdlj_goods_info` s ON s.`goods_id`=t.`goods_id`
        LEFT JOIN `tt_tb_goods_info` tg ON tg.`goods_id`=t.`goods_id`
        WHERE <include refid="queryWhere"></include> ORDER BY #{vo.sort} LIMIT #{start},#{count}
    </select>
    <select id="count" resultType="java.lang.Long">
        SELECT count(*)
        FROM `tt_user_goods` t
        LEFT JOIN `tt_sdlj_goods_info` s ON s.`goods_id`=t.`goods_id`
        LEFT JOIN `tt_tb_goods_info` tg ON tg.`goods_id`=t.`goods_id`
        WHERE <include refid="queryWhere"></include>
    </select>
    <select id="selectByGoodsIdAndUidAndTBUid" resultMap="BaseResultMap" >
        select
        <include refid="Base_Column_List"/>
        from tt_user_goods
        where goods_id = #{goodsId} and uid=#{uid} and tb_uid=#{tbUid}
    </select>
</mapper>
src/test/java/com/ks/tool/bkz/GoodsTest.java
New file
@@ -0,0 +1,19 @@
package com.ks.tool.bkz;
import com.ks.tool.bkz.dto.DaTaoKeDetailV2;
import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory;
import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil;
import org.junit.jupiter.api.Test;
public class GoodsTest {
    @Test
    public void daTaoKe(){
        DaTaoKeDetailV2 dg= DaTaoKeApiUtil.getGoodsDetailByGoodsId(568984817165L);
        TBGoodsInfoFactory.create(dg);
    }
}
src/test/java/com/ks/tool/bkz/UserTest.java
@@ -1,7 +1,7 @@
package com.ks.tool.bkz;
import com.ks.tool.bkz.dao.mybatis.user.CardPwdInfoMapper;
import com.ks.tool.bkz.dao.mybatis.user.SDLJShareOpenHistoryMapper;
import com.ks.tool.bkz.dao.mybatis.sdlj.SDLJShareOpenHistoryMapper;
import com.ks.tool.bkz.dao.mybatis.user.UserInfoMapper;
import com.ks.tool.bkz.entity.user.CardPwdTypeEnum;
import com.ks.tool.bkz.util.CardPwdUtil;