| | |
| | | package com.ks.tool.bkz.controller; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate; |
| | | import com.ks.tool.bkz.exception.SDLJDocTemplateException; |
| | | import com.ks.tool.bkz.service.manager.RedisManager; |
| | | import com.ks.tool.bkz.service.sdlj.SDLJDocTemplateService; |
| | | 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.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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Controller |
| | | @RequestMapping("sdlj/goods") |
| | |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @Resource |
| | | private SDLJDocTemplateService sdljDocTemplateService; |
| | | |
| | | @Login |
| | | @RequestMapping("searchGoods") |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置模板 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @Login |
| | | @PostMapping("setTemplate") |
| | | @ResponseBody |
| | | public String setTemplate(@RequestParam Map<String, String> params, HttpServletRequest request) { |
| | | int type= Integer.parseInt(params.get("type")); |
| | | String template=params.get("template"); |
| | | String account = UserUtil.getAccountFromToken(request.getHeader("token")); |
| | | Long uid = userService.selectByAccount(account).getId(); |
| | | if (type == 0) {//保存模板 |
| | | SDLJDocTemplate t = new SDLJDocTemplate(); |
| | | t.setTemplate(template); |
| | | t.setUid(uid); |
| | | try { |
| | | sdljDocTemplateService.addTemplate(t); |
| | | } catch (SDLJDocTemplateException e) { |
| | | return JsonUtil.loadFalseResult(e.getCode(), e.getMsg()); |
| | | } |
| | | } else {//还原模板 |
| | | sdljDocTemplateService.deleteByUid(uid); |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | //获取模板 |
| | | @Login |
| | | @RequestMapping("getTemplate") |
| | | @ResponseBody |
| | | public String getTemplate(HttpServletRequest request) { |
| | | String account = UserUtil.getAccountFromToken(request.getHeader("token")); |
| | | Long uid = userService.selectByAccount(account).getId(); |
| | | SDLJDocTemplate template= sdljDocTemplateService.selectByUid(uid); |
| | | if(template==null) |
| | | return JsonUtil.loadFalseResult(1,"无自定义模板"); |
| | | JSONObject data=new JSONObject(); |
| | | data.put("template",template.getTemplate()); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.tool.bkz.dao.mybatis.sdlj; |
| | | |
| | | import com.ks.tool.bkz.dao.BaseMapper; |
| | | import com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface SDLJDocTemplateMapper extends BaseMapper<SDLJDocTemplate> { |
| | | |
| | | List<SDLJDocTemplate> listByUid(Long uid); |
| | | } |
| | |
| | | |
| | | 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-是 |
| | | private String tkl; |
| | | private Date tklUpdateTime; |
| | | |
| | | public String getTkl() { |
| | | return tkl; |
| | | } |
| | | |
| | | public void setTkl(String tkl) { |
| | | this.tkl = tkl; |
| | | } |
| | | |
| | | public Date getTklUpdateTime() { |
| | | return tklUpdateTime; |
| | | } |
| | | |
| | | public void setTklUpdateTime(Date tklUpdateTime) { |
| | | this.tklUpdateTime = tklUpdateTime; |
| | | } |
| | | |
| | | public Integer getTmall() { |
| | | return tmall; |
New file |
| | |
| | | package com.ks.tool.bkz.entity.sdlj; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class SDLJDocTemplate { |
| | | private Long id; |
| | | |
| | | private Long uid; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | private String template; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getTemplate() { |
| | | return template; |
| | | } |
| | | |
| | | public void setTemplate(String template) { |
| | | this.template = template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.tool.bkz.exception; |
| | | |
| | | public class SDLJDocTemplateException extends BaseException{ |
| | | |
| | | |
| | | public SDLJDocTemplateException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | } |
| | |
| | | import com.ks.tool.bkz.service.TBGoodsService; |
| | | import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory; |
| | | import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil; |
| | | import com.ks.tool.bkz.util.tb.ZheTaoKeApiUtil; |
| | | import com.ks.tool.bkz.vo.tb.ZheTaoKeConvertResult; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | if (old == null) { |
| | | if (goodsInfo.getCreateTime() == null) |
| | | goodsInfo.setCreateTime(new Date()); |
| | | //获取淘口令 |
| | | ZheTaoKeConvertResult result= ZheTaoKeApiUtil.getTkl(goodsInfo.getGoodsId()); |
| | | if(result!=null){ |
| | | goodsInfo.setTkl(result.getTkl()); |
| | | goodsInfo.setTklUpdateTime(new Date()); |
| | | } |
| | | tbGoodsInfoMapper.insertSelective(goodsInfo); |
| | | } else { |
| | | goodsInfo.setId(old.getId()); |
| | | if (goodsInfo.getUpdateTime() == null) |
| | | goodsInfo.setUpdateTime(new Date()); |
| | | //25天更新淘口令 |
| | | if(old.getTklUpdateTime()==null||System.currentTimeMillis()- old.getTklUpdateTime().getTime()>1000*60*60*24*25L){ |
| | | ZheTaoKeConvertResult result= ZheTaoKeApiUtil.getTkl(goodsInfo.getGoodsId()); |
| | | if(result!=null){ |
| | | goodsInfo.setTkl(result.getTkl()); |
| | | goodsInfo.setTklUpdateTime(new Date()); |
| | | } |
| | | } |
| | | tbGoodsInfoMapper.updateByPrimaryKeySelective(goodsInfo); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.tool.bkz.service.impl.sdlj; |
| | | |
| | | import com.ks.tool.bkz.dao.mybatis.sdlj.SDLJDocTemplateMapper; |
| | | import com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate; |
| | | import com.ks.tool.bkz.exception.SDLJDocTemplateException; |
| | | import com.ks.tool.bkz.service.sdlj.SDLJDocTemplateService; |
| | | import com.ks.tool.bkz.util.StringUtil; |
| | | import com.ks.tool.bkz.util.sdlj.DocTemplateUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class SDLJDocTemplateServiceImpl implements SDLJDocTemplateService { |
| | | |
| | | @Resource |
| | | private SDLJDocTemplateMapper sdljDocTemplateMapper; |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void addTemplate(SDLJDocTemplate template) throws SDLJDocTemplateException { |
| | | if (template == null || StringUtil.isNullOrEmpty(template.getTemplate()) || template.getUid() == null) |
| | | throw new SDLJDocTemplateException(1, "参数不完整"); |
| | | //验证格式是否正确 |
| | | if (!DocTemplateUtil.IsRight(template.getTemplate())) { |
| | | throw new SDLJDocTemplateException(2, "模板格式有误"); |
| | | } |
| | | SDLJDocTemplate old = selectByUid(template.getUid()); |
| | | if (old == null) { |
| | | if (template.getCreateTime() == null) |
| | | template.setCreateTime(new Date()); |
| | | sdljDocTemplateMapper.updateByPrimaryKeySelective(template); |
| | | }else{//更新 |
| | | template.setId(old.getId()); |
| | | template.setUpdateTime(new Date()); |
| | | sdljDocTemplateMapper.updateByPrimaryKeySelective(template); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public SDLJDocTemplate selectByUid(Long uid) { |
| | | List<SDLJDocTemplate> list= sdljDocTemplateMapper.listByUid(uid); |
| | | if(list!=null&&list.size()>0) |
| | | return list.get(0); |
| | | return null; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void deleteByUid(Long uid) { |
| | | List<SDLJDocTemplate> list= sdljDocTemplateMapper.listByUid(uid); |
| | | if(list!=null) |
| | | for(SDLJDocTemplate template:list){ |
| | | sdljDocTemplateMapper.deleteByPrimaryKey(template.getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | for (String st : vo.getImgs().split(",")) |
| | | imgList.add(st); |
| | | vo.setImgList(imgList); |
| | | if(vo.getTmall()==1){ |
| | | vo.setItemUrl("https://detail.tmall.com/item.htm?id="+vo.getGoodsId()); |
| | | }else{ |
| | | vo.setItemUrl("https://item.taobao.com/item.htm?id="+vo.getGoodsId()); |
| | | } |
| | | } |
| | | return goodsList; |
| | | } |
New file |
| | |
| | | package com.ks.tool.bkz.service.sdlj; |
| | | |
| | | import com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate; |
| | | import com.ks.tool.bkz.exception.SDLJDocTemplateException; |
| | | |
| | | public interface SDLJDocTemplateService { |
| | | |
| | | public void addTemplate(SDLJDocTemplate template) throws SDLJDocTemplateException; |
| | | |
| | | public SDLJDocTemplate selectByUid(Long uid); |
| | | |
| | | public void deleteByUid(Long uid); |
| | | |
| | | } |
| | |
| | | package com.ks.tool.bkz.util; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | public class UserUtil { |
| | | |
| | | /** |
New file |
| | |
| | | package com.ks.tool.bkz.util.sdlj; |
| | | |
| | | public class DocTemplateUtil { |
| | | |
| | | public static boolean IsRight(String doc) { |
| | | //匹配两个中括号 |
| | | int start1= doc.indexOf("["); |
| | | if (start1 <= -1) { |
| | | return false; |
| | | } |
| | | |
| | | int end1 = doc.indexOf("]", start1); |
| | | if (end1 <= -1) { |
| | | return false; |
| | | } |
| | | |
| | | int start2 = doc.indexOf("[", end1); |
| | | if (start2 <= -1) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | int end2 = doc.indexOf("]", start2); |
| | | if (end2 <= -1) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.tool.bkz.util.tb; |
| | | |
| | | import com.ks.tool.bkz.util.HttpUtil; |
| | | import com.ks.tool.bkz.vo.tb.ZheTaoKeConvertResult; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class ZheTaoKeApiUtil { |
| | | |
| | | private static String baseRequest(String baseUrl, Map<String, String> params) { |
| | | params.put("appkey", "fe65b15d74d84c75b99578543da75264"); |
| | | String result = HttpUtil.get(baseUrl, params, null); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取淘口令 |
| | | * @param auctionId |
| | | * @return |
| | | */ |
| | | public static ZheTaoKeConvertResult getTkl(Long auctionId) { |
| | | try { |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("sid", "34116"); |
| | | params.put("pid", "mm_106929643_20324269_81478350"); |
| | | params.put("num_iid", auctionId + ""); |
| | | params.put("signurl", 5 + ""); |
| | | String result = baseRequest("https://api.zhetaoke.com:10001/api/open_gaoyongzhuanlian.ashx", params); |
| | | JSONObject resultJson = JSONObject.fromObject(result); |
| | | if (resultJson.optInt("status") == 200) { |
| | | JSONObject item= resultJson.optJSONArray("content").optJSONObject(0); |
| | | return new ZheTaoKeConvertResult(item.optString("taobao_url"),item.optString("tkl"),item.optLong("tao_id")); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private BigDecimal couponAmount;//券面额 |
| | | private Integer tmall;//天猫 |
| | | private Boolean mark; |
| | | private String tkl;//淘口令 |
| | | private String itemUrl;//商品链接 |
| | | |
| | | public String getItemUrl() { |
| | | return itemUrl; |
| | | } |
| | | |
| | | public void setItemUrl(String itemUrl) { |
| | | this.itemUrl = itemUrl; |
| | | } |
| | | |
| | | public String getTkl() { |
| | | return tkl; |
| | | } |
| | | |
| | | public void setTkl(String tkl) { |
| | | this.tkl = tkl; |
| | | } |
| | | |
| | | public Boolean getMark() { |
| | | return mark; |
New file |
| | |
| | | package com.ks.tool.bkz.vo.tb; |
| | | |
| | | public class ZheTaoKeConvertResult { |
| | | private String taoBaoUrl; |
| | | private String tkl; |
| | | private Long goodsId; |
| | | |
| | | public ZheTaoKeConvertResult(String taoBaoUrl, String tkl, Long goodsId) { |
| | | this.taoBaoUrl = taoBaoUrl; |
| | | this.tkl = tkl; |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public String getTaoBaoUrl() { |
| | | return taoBaoUrl; |
| | | } |
| | | |
| | | public void setTaoBaoUrl(String taoBaoUrl) { |
| | | this.taoBaoUrl = taoBaoUrl; |
| | | } |
| | | |
| | | public String getTkl() { |
| | | return tkl; |
| | | } |
| | | |
| | | public void setTkl(String tkl) { |
| | | this.tkl = tkl; |
| | | } |
| | | |
| | | public Long getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(Long goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | } |
| | |
| | | <!DOCTYPE generatorConfiguration |
| | | PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
| | | PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
| | | <generatorConfiguration> |
| | | <!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包--> |
| | | <classPathEntry |
| | |
| | | enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" |
| | | selectByExampleQueryId="false"/> |
| | | --> |
| | | |
| | | <!-- |
| | | <table tableName="tt_config" domainObjectName="Config" enableCountByExample="false" |
| | | enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" |
| | | selectByExampleQueryId="false"/> |
| | | --> |
| | | |
| | | |
| | | <table tableName="tt_sdlj_doc_template" domainObjectName="SDLJDocTemplate" enableCountByExample="false" |
| | | enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" |
| | | selectByExampleQueryId="false"/> |
| | | |
| | | |
| | | |
| | | |
| | |
| | | <!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" /> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="goods_id" property="goodsId" jdbcType="BIGINT" /> |
| | | <result column="title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="imgs" property="imgs" jdbcType="VARCHAR" /> |
| | | <result column="zk_price" property="zkPrice" jdbcType="DECIMAL" /> |
| | | <result column="coupon_info" property="couponInfo" jdbcType="VARCHAR" /> |
| | | <result column="coupon_amount" property="couponAmount" jdbcType="DECIMAL" /> |
| | | <result column="coupon_start_price" property="couponStartPrice" jdbcType="DECIMAL" /> |
| | | <result column="coupon_total_count" property="couponTotalCount" jdbcType="INTEGER" /> |
| | | <result column="coupon_left_count" property="couponLeftCount" jdbcType="INTEGER" /> |
| | | <result column="coupon_start_time" property="couponStartTime" jdbcType="VARCHAR" /> |
| | | <result column="coupon_end_time" property="couponEndTime" jdbcType="VARCHAR" /> |
| | | <result column="coupon_price" property="couponPrice" jdbcType="DECIMAL" /> |
| | | <result column="sales_num" property="salesNum" jdbcType="INTEGER" /> |
| | | <result column="commission_rate" property="commissionRate" jdbcType="DECIMAL" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="tmall" property="tmall" jdbcType="INTEGER" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="cid" property="cid" jdbcType="INTEGER" /> |
| | | <result column="tkl" property="tkl" jdbcType="VARCHAR" /> |
| | | <result column="tkl_update_time" property="tklUpdateTime" jdbcType="TIMESTAMP" /> |
| | | </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 |
| | | sales_num, commission_rate, create_time, tmall, update_time, cid, tkl, tkl_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from tt_tb_goods_info |
| | |
| | | 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} |
| | |
| | | coupon_left_count, coupon_start_time, coupon_end_time, |
| | | coupon_price, sales_num, commission_rate, |
| | | create_time, tmall, update_time, |
| | | cid) |
| | | cid, tkl, tkl_update_time |
| | | ) |
| | | 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}) |
| | | #{cid,jdbcType=INTEGER}, #{tkl,jdbcType=VARCHAR}, #{tklUpdateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.tool.bkz.entity.TBGoodsInfo"> |
| | | insert into tt_tb_goods_info |
| | |
| | | <if test="cid != null"> |
| | | cid, |
| | | </if> |
| | | <if test="tkl != null" > |
| | | tkl, |
| | | </if> |
| | | <if test="tklUpdateTime != null" > |
| | | tkl_update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | |
| | | </if> |
| | | <if test="cid != null"> |
| | | #{cid,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="tkl != null" > |
| | | #{tkl,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="tklUpdateTime != null" > |
| | | #{tklUpdateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <if test="cid != null"> |
| | | cid = #{cid,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="tkl != null" > |
| | | tkl = #{tkl,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="tklUpdateTime != null" > |
| | | tkl_update_time = #{tklUpdateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | tmall = #{tmall,jdbcType=INTEGER}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | cid = #{cid,jdbcType=INTEGER} |
| | | cid = #{cid,jdbcType=INTEGER}, |
| | | tkl = #{tkl,jdbcType=VARCHAR}, |
| | | tkl_update_time = #{tklUpdateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ks.tool.bkz.dao.mybatis.sdlj.SDLJDocTemplateMapper" > |
| | | <resultMap id="BaseResultMap" type="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" > |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <resultMap id="ResultMapWithBLOBs" type="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" extends="BaseResultMap" > |
| | | <result column="template" property="template" jdbcType="LONGVARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | id, uid, create_time, update_time |
| | | </sql> |
| | | <sql id="Blob_Column_List" > |
| | | template |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | , |
| | | <include refid="Blob_Column_List" /> |
| | | from tt_sdlj_doc_template |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="listByUid" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | , |
| | | <include refid="Blob_Column_List" /> |
| | | from tt_sdlj_doc_template |
| | | where uid = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > |
| | | delete from tt_sdlj_doc_template |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" > |
| | | insert into tt_sdlj_doc_template (id, uid, create_time, |
| | | update_time, template) |
| | | values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{updateTime,jdbcType=TIMESTAMP}, #{template,jdbcType=LONGVARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" > |
| | | insert into tt_sdlj_doc_template |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | id, |
| | | </if> |
| | | <if test="uid != null" > |
| | | uid, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time, |
| | | </if> |
| | | <if test="template != null" > |
| | | template, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null" > |
| | | #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="template != null" > |
| | | #{template,jdbcType=LONGVARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" > |
| | | update tt_sdlj_doc_template |
| | | <set > |
| | | <if test="uid != null" > |
| | | uid = #{uid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="template != null" > |
| | | template = #{template,jdbcType=LONGVARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" > |
| | | update tt_sdlj_doc_template |
| | | set uid = #{uid,jdbcType=BIGINT}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | template = #{template,jdbcType=LONGVARCHAR} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.tool.bkz.entity.sdlj.SDLJDocTemplate" > |
| | | update tt_sdlj_doc_template |
| | | set uid = #{uid,jdbcType=BIGINT}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | <result column="actualPrice" property="actualPrice" jdbcType="DECIMAL"/> |
| | | <result column="commissionRate" property="commissionRate" jdbcType="DECIMAL"/> |
| | | <result column="imgs" property="imgs" jdbcType="VARCHAR"/> |
| | | <result column="tkl" property="tkl" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | |
| | | <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 |
| | | tg.`commission_rate` AS commissionRate,tg.`imgs` AS imgs,tg.sales_num as salesNum,tg.coupon_amount as couponAmount,tg.tmall,tg.tkl |
| | | 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` |
| | |
| | | import com.ks.tool.bkz.dto.DaTaoKeDetailV2; |
| | | import com.ks.tool.bkz.util.factory.TBGoodsInfoFactory; |
| | | import com.ks.tool.bkz.util.tb.DaTaoKeApiUtil; |
| | | import com.ks.tool.bkz.util.tb.ZheTaoKeApiUtil; |
| | | import com.ks.tool.bkz.vo.tb.ZheTaoKeConvertResult; |
| | | import org.junit.jupiter.api.Test; |
| | | |
| | | public class GoodsTest { |
| | |
| | | |
| | | } |
| | | |
| | | @Test |
| | | public void zheTaoKe() { |
| | | ZheTaoKeConvertResult token = ZheTaoKeApiUtil.getTkl(596804372243L); |
| | | System.out.println(token); |
| | | } |
| | | |
| | | } |