提交 c7620757 authored 作者: zgy's avatar zgy

商品管理功能优化

上级 c1c2fc75
......@@ -211,4 +211,11 @@ public class TbCfStationItemController extends ApiBaseAction {
tbCfStationItemService.importShopifyProducts(multipartFile);
return R.ok();
}
@RequestMapping("/queryCreator")
@ResponseBody
public R queryCreator() {
List<SysUserEntity> userList = tbCfStationItemService.queryCreator();
return R.ok().put("list", userList);
}
}
package com.platform.controller.test;
import com.platform.utils.IdUtil;
/**
* @Auther: wudepeng
* @Date: 2020/04/08
* @Description:
*/
public class MainTest {
public static void main(String[] args) {
for (int i = 0; i <10 ; i++) {
Thread thread=new Thread(()->{
String uuid = IdUtil.createIdbyUUID();
System.out.println(uuid);
});
thread.start();
}
}
}
......@@ -5,11 +5,11 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 实体
* 商品规格表实体
* 表名 tb_cf_item_skus
*
* @author lipengjun
* @date 2019-12-26 20:47:21
* @date 2020-04-08 13:45:07
*/
public class TbCfItemSkusEntity implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -22,14 +22,18 @@ public class TbCfItemSkusEntity implements Serializable {
* 商品ID
*/
private String itemId;
/**
* 数量
*/
private Integer skuCount;
/**
* 规格名称
*/
private String skuName;
/**
* 商品规格图片
*/
private String skuImg;
/**
* 商品规格编码
*/
private String skuCode;
/**
* 规格描述
*/
......@@ -42,6 +46,10 @@ public class TbCfItemSkusEntity implements Serializable {
* 属性IDS
*/
private String optionIds;
/**
* 数量
*/
private Integer skuCount;
/**
* 排序号
*/
......@@ -72,7 +80,6 @@ public class TbCfItemSkusEntity implements Serializable {
public String getId() {
return id;
}
/**
* 设置:商品ID
*/
......@@ -86,7 +93,6 @@ public class TbCfItemSkusEntity implements Serializable {
public String getItemId() {
return itemId;
}
/**
* 设置:规格名称
*/
......@@ -100,7 +106,32 @@ public class TbCfItemSkusEntity implements Serializable {
public String getSkuName() {
return skuName;
}
/**
* 设置:商品规格图片
*/
public void setSkuImg(String skuImg) {
this.skuImg = skuImg;
}
/**
* 获取:商品规格图片
*/
public String getSkuImg() {
return skuImg;
}
/**
* 设置:商品规格编码
*/
public void setSkuCode(String skuCode) {
this.skuCode = skuCode;
}
/**
* 获取:商品规格编码
*/
public String getSkuCode() {
return skuCode;
}
/**
* 设置:规格描述
*/
......@@ -114,7 +145,6 @@ public class TbCfItemSkusEntity implements Serializable {
public String getSkuDesc() {
return skuDesc;
}
/**
* 设置:价格
*/
......@@ -128,7 +158,6 @@ public class TbCfItemSkusEntity implements Serializable {
public BigDecimal getSkuPrice() {
return skuPrice;
}
/**
* 设置:属性IDS
*/
......@@ -142,7 +171,6 @@ public class TbCfItemSkusEntity implements Serializable {
public String getOptionIds() {
return optionIds;
}
/**
* 设置:数量
*/
......@@ -156,7 +184,6 @@ public class TbCfItemSkusEntity implements Serializable {
public Integer getSkuCount() {
return skuCount;
}
/**
* 设置:排序号
*/
......@@ -170,7 +197,6 @@ public class TbCfItemSkusEntity implements Serializable {
public Integer getOrderNum() {
return orderNum;
}
/**
* 设置:删除标记
*/
......@@ -184,7 +210,6 @@ public class TbCfItemSkusEntity implements Serializable {
public Integer getDelFlag() {
return delFlag;
}
/**
* 设置:创建时间
*/
......@@ -198,7 +223,6 @@ public class TbCfItemSkusEntity implements Serializable {
public Date getCreateTime() {
return createTime;
}
/**
* 设置:更新时间
*/
......
......@@ -11,6 +11,15 @@ public class TbCfStationItemEntityExtends extends TbCfStationItemEntity implemen
private String goodtype;
private String itemDesc;
private BigDecimal discountPrice;
private String uname;
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
@Override
public BigDecimal getDiscountPrice() {
......
......@@ -2,6 +2,7 @@ package com.platform.service;
import com.platform.entity.ItemDescSkus;
import com.platform.entity.ItemInfo;
import com.platform.entity.SysUserEntity;
import com.platform.entity.TbCfStationItemEntity;
import com.platform.utils.R;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -96,4 +97,5 @@ public interface TbCfStationItemService {
void importExcel(MultipartFile multipartFile);
R importShopifyProducts(MultipartFile multipartFile);
List<SysUserEntity> queryCreator();
}
......@@ -46,6 +46,8 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
@Autowired
private TbCfOptionDao tbCfOptionDao;
@Autowired
private SysUserDao sysUserDao;
@Override
public ItemInfo queryItemInfoById(String itemId) {
//查询商品主体信息
......@@ -438,5 +440,10 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
return null;
}
@Override
public List<SysUserEntity> queryCreator() {
return sysUserDao.queryList(null);
}
}
......@@ -7,6 +7,8 @@
<result property="id" column="id"/>
<result property="itemId" column="item_id"/>
<result property="skuName" column="sku_name"/>
<result property="skuImg" column="sku_img"/>
<result property="skuCode" column="sku_code"/>
<result property="skuDesc" column="sku_desc"/>
<result property="skuPrice" column="sku_price"/>
<result property="optionIds" column="option_ids"/>
......@@ -18,10 +20,12 @@
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfItemSkusEntity">
select
select
`id`,
`item_id`,
`sku_name`,
`sku_img`,
`sku_code`,
`sku_desc`,
`sku_price`,
`option_ids`,
......@@ -39,6 +43,8 @@
`id`,
`item_id`,
`sku_name`,
`sku_img`,
`sku_code`,
`sku_desc`,
`sku_price`,
`option_ids`,
......@@ -83,6 +89,8 @@
`id`,
`item_id`,
`sku_name`,
`sku_img`,
`sku_code`,
`sku_desc`,
`sku_price`,
`option_ids`,
......@@ -95,6 +103,8 @@
#{id},
#{itemId},
#{skuName},
#{skuImg},
#{skuCode},
#{skuDesc},
#{skuPrice},
#{optionIds},
......@@ -108,15 +118,17 @@
<update id="update" parameterType="com.platform.entity.TbCfItemSkusEntity">
update tb_cf_item_skus
<set>
<if test="itemId != null">`item_id` = #{itemId},</if>
<if test="skuName != null">`sku_name` = #{skuName},</if>
<if test="skuDesc != null">`sku_desc` = #{skuDesc},</if>
<if test="skuPrice != null">`sku_price` = #{skuPrice},</if>
<if test="optionIds != null">`option_ids` = #{optionIds},</if>
<if test="skuCount != null">`sku_count` = #{skuCount},</if>
<if test="orderNum != null">`order_num` = #{orderNum},</if>
<if test="delFlag != null">`del_flag` = #{delFlag},</if>
<if test="createTime != null">`create_time` = #{createTime},</if>
<if test="itemId != null">`item_id` = #{itemId}, </if>
<if test="skuName != null">`sku_name` = #{skuName}, </if>
<if test="skuImg != null">`sku_img` = #{skuImg}, </if>
<if test="skuCode != null">`sku_code` = #{skuCode}, </if>
<if test="skuDesc != null">`sku_desc` = #{skuDesc}, </if>
<if test="skuPrice != null">`sku_price` = #{skuPrice}, </if>
<if test="optionIds != null">`option_ids` = #{optionIds}, </if>
<if test="skuCount != null">`sku_count` = #{skuCount}, </if>
<if test="orderNum != null">`order_num` = #{orderNum}, </if>
<if test="delFlag != null">`del_flag` = #{delFlag}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
</set>
where id = #{id}
......
......@@ -130,13 +130,15 @@
i.creator,
d.descripition_name dname,
t.goodstwotype_title title,
o.goodstype_title goodtype
o.goodstype_title goodtype,
u.user_name uname
FROM
tb_cf_station_item i
left JOIN tb_cf_goodstype o ON o.goodstype_id = i.item_category
left JOIN tb_cf_goodstwotype t ON i.item_categorytwo=t.goodstwotype_id
left JOIN tb_cf_descripiton d ON i.item_descrition_id=d.descripition_id
left JOIN tb_cf_express_template e ON i.item_descrition_id = e.template_id
left join sys_user u on i.creator=u.user_id
WHERE 1=1 and i.enable_flag!=0
<if test="name != null and name.trim() != ''">
AND item_name LIKE concat('%',#{name},'%') or item_id LIKE concat('%',#{name},'%')
......@@ -156,6 +158,12 @@
<if test="typeThree != null and typeThree.trim() != ''">
AND item_descrition_id=#{typeThree}
</if>
<if test="supplier != null and supplier.trim() != ''">
AND supplier=#{supplier}
</if>
<if test="creator != null and creator.trim() != ''">
AND creator=#{creator}
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
......@@ -203,6 +211,12 @@
<if test="typeThree != null and typeThree.trim() != ''">
AND item_descrition_id=#{typeThree}
</if>
<if test="supplier != null and supplier.trim() != ''">
AND supplier=#{supplier}
</if>
<if test="creator != null and creator.trim() != ''">
AND creator=#{creator}
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfStationItemEntity">
......@@ -269,7 +283,7 @@
<if test="itemCategory != null">`item_category` = #{itemCategory},</if>
`item_price` = #{itemPrice},
<if test="discountPrice != null">`discount_price` = #{discountPrice},</if>
<if test="costPrice != null">`cost_price` = #{costPrice}, </if>
<if test="costPrice != null">`cost_price` = #{costPrice},</if>
<if test="itemUrl != null">`item_url` = #{itemUrl},</if>
<if test="itemImg != null">`item_img` = #{itemImg},</if>
<if test="itemTags != null">`item_tags` = #{itemTags},</if>
......
package test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.*;
/**
* 并发测试
*
* @author 爱酱油不爱醋
* @version 1.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:/applicationContext-test.xml"})
public class ConcurrencyApi {
private final int corePoolSize = 15;
private final int maximumPoolSize = 35;
@Test
public void test() {
ExecutorService executor = Executors.newCachedThreadPool();
int i = 0;
while (true) {
RunningTest test = new RunningTest(i);
executor.submit(test);
System.out.println("正在执行的线程编号:" + i);
i++;
}
}
}
//package test;
//
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//
//import java.util.concurrent.*;
//
///**
// * 并发测试
// *
// * @author 爱酱油不爱醋
// * @version 1.0
// */
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations = {"classpath*:/applicationContext-test.xml"})
//public class ConcurrencyApi {
//
// private final int corePoolSize = 15;
//
// private final int maximumPoolSize = 35;
//
// @Test
// public void test() {
// ExecutorService executor = Executors.newCachedThreadPool();
// int i = 0;
// while (true) {
// test.RunningTest test = new test.RunningTest(i);
// executor.submit(test);
// System.out.println("正在执行的线程编号:" + i);
// i++;
// }
//
// }
//
//
//}
package test;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.IdUtil;
import cn.hutool.http.HttpRequest;
import com.platform.controller.api.ProductExitException;
import com.platform.dao.*;
import com.platform.entity.*;
import com.platform.utils.OssUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @author 爱酱油不爱醋
* @version 1.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:/applicationContext-test.xml"})
public class TestApi {
@Autowired
private TbCfStationItemDao tbCfStationItemDao;
@Autowired
private TbCfItemDescDao tbCfItemDescDao;
@Autowired
private TbCfItemSkusDao tbCfItemSkusDao;
@Autowired
private TbCfCategoryDao tbCfCategoryDao;
@Autowired
private TbCfOptionDao tbCfOptionDao;
@Autowired
private TbCfGoodstypeDao tbCfGoodstypeDao;
@Autowired
private TbProductMissDao tbProductMissDao;
@Autowired
private TbCategoryTemplateDao tbCategoryTemplateDao;
@Autowired
private TbCfGoodstwotypeDao tbCfGoodstwotypeDao;
@Autowired
private TbCfDescripitonDao tbCfDescripitonDao;
/**
* 接口数据版本号
*/
private final String VERSION = "2020-01";
/**
* 接口路径
*/
private final String API_URL = "https://mollykitty.myshopify.com/admin/api/" + VERSION + "/products.json";
@Test
public void host() {
String link = API_URL + "?limit=250&page_info=eyJwcm9kdWN0X3R5cGUiOiJXb21lbiIsImxhc3RfaWQiOjQ0OTc2Nzg5NTg2ODksImxhc3RfdmFsdWUiOiJDYXN1YWwgU2xpbSBTd2VhdGVycyIsImRpcmVjdGlvbiI6Im5leHQifQ";
Console.error(link);
link = HttpRequest.get(link)
.header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
.execute().header("link")
.split(",")[1];
Console.error(link);
link = link.substring(2, link.indexOf(">"));
Console.log("链接:" + link);
}
/**
* 测试分类的商品数量
*/
@Test
public void testCount() {
List<String> list = Arrays.asList("Men", "Women", "Children", "Afri Home", "Cosmetics", "Hair", "Sportswear", "Electronics");
for (String product_type : list) {
String link = "https://mollykitty.myshopify.com/admin/api/" + VERSION + "/products/count.json" + "?&product_type=" + product_type;
System.out.println(link);
link = HttpRequest.get(link)
.header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
.execute().body();
System.err.println(product_type + ":" + link);
}
}
/**
* 测试第一次连接时的返回
*/
@Test
public void getLink() {
String link = API_URL + "?&product_type=" + "Men" + "&limit=250";
String headerLink = HttpRequest.get(link)
.header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
.execute().header("link");
headerLink = headerLink.split(";")[0].replaceAll("<", "").replaceAll(">", "");
System.err.println(headerLink);
}
/**
* 连接测试
*/
@Test
public void linkTest() {
String link = "https://mollykitty.myshopify.com/admin/api/2020-01/products.json?vendor=%E6%B3%B0%E9%82%A6%E6%9C%8D%E9%A5%B0&limit=100&vendor=戴菊";
link = HttpRequest.get(link)
.header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
.execute().body();
JSONObject json = JSONObject.fromObject(link);
JSONArray productArr = json.getJSONArray("products");
for (int j = 0; j < productArr.size(); j++) {
JSONObject product = productArr.getJSONObject(j);
String tags = product.getString("tags");
String[] s = tags.split(",");
if (s.length > 1) {
for (String i : s) {
if (i.contains("#")) {
System.out.println(i);
String three = i.replaceAll("#", "");
System.out.println(three);
}
}
} else {
}
JSONArray variantsArr = product.getJSONArray("variants");
for (int i = 0; i < variantsArr.size(); i++) {
JSONObject variantsObj = variantsArr.getJSONObject(i);
String compare_at_price = variantsObj.getString("compare_at_price");
if (!"null".equals(compare_at_price)) {
System.out.println(compare_at_price);
}
}
}
}
/**
* 导入商品
*/
@Test
public void test() {
String link = "";
// 这个请求需要密钥,可以先拿着账号密码去浏览器请求一遍,F12 获取 token 复制粘贴即可
String result = HttpRequest.get(link)
.header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
.execute().body();
JSONObject jsonObject = JSONObject.fromObject(result);
String headerLink = HttpRequest.get(link)
.header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
.execute().header("link");
headerLink = headerLink.split(";")[0].replaceAll("<", "").replaceAll(">", "");
}
/**
* 通过URL获取网络图片
* 获取网络图片流
*
* @param url 传入的 URL 必须是以 http:// 开头的,因为我们使用了 HttpURLConnection
* @return 输入流
*/
public static InputStream getImageStream(String url) {
try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.setRequestMethod("GET");
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
return connection.getInputStream();
}
} catch (IOException e) {
System.out.println("获取网络图片出现异常,图片路径为:" + url);
e.printStackTrace();
}
return null;
}
/**
* 将 InputStream 流转换为 byte[]
*
* @param input InputStream
* @return byte[]
* @throws IOException IO流异常
*/
public static byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[1024 * 4];
int n = 0;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
}
return output.toByteArray();
}
}
//package test;
//
//import cn.hutool.core.lang.Console;
//import cn.hutool.core.util.IdUtil;
//import cn.hutool.http.HttpRequest;
//import com.platform.controller.api.ProductExitException;
//import com.platform.dao.*;
//import com.platform.entity.*;
//import com.platform.utils.OssUtil;
//import net.sf.json.JSONArray;
//import net.sf.json.JSONObject;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//
//import java.io.ByteArrayOutputStream;
//import java.io.IOException;
//import java.io.InputStream;
//import java.math.BigDecimal;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.util.Arrays;
//import java.util.Date;
//import java.util.List;
//
///**
// * @author 爱酱油不爱醋
// * @version 1.0
// */
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations = {"classpath*:/applicationContext-test.xml"})
//public class TestApi {
//
// @Autowired
// private TbCfStationItemDao tbCfStationItemDao;
// @Autowired
// private TbCfItemDescDao tbCfItemDescDao;
// @Autowired
// private TbCfItemSkusDao tbCfItemSkusDao;
// @Autowired
// private TbCfCategoryDao tbCfCategoryDao;
// @Autowired
// private TbCfOptionDao tbCfOptionDao;
// @Autowired
// private TbCfGoodstypeDao tbCfGoodstypeDao;
// @Autowired
// private TbProductMissDao tbProductMissDao;
// @Autowired
// private TbCategoryTemplateDao tbCategoryTemplateDao;
// @Autowired
// private TbCfGoodstwotypeDao tbCfGoodstwotypeDao;
// @Autowired
// private TbCfDescripitonDao tbCfDescripitonDao;
//
// /**
// * 接口数据版本号
// */
// private final String VERSION = "2020-01";
// /**
// * 接口路径
// */
// private final String API_URL = "https://mollykitty.myshopify.com/admin/api/" + VERSION + "/products.json";
//
// @Test
// public void host() {
// String link = API_URL + "?limit=250&page_info=eyJwcm9kdWN0X3R5cGUiOiJXb21lbiIsImxhc3RfaWQiOjQ0OTc2Nzg5NTg2ODksImxhc3RfdmFsdWUiOiJDYXN1YWwgU2xpbSBTd2VhdGVycyIsImRpcmVjdGlvbiI6Im5leHQifQ";
// Console.error(link);
// link = HttpRequest.get(link)
// .header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
// .execute().header("link")
// .split(",")[1];
// Console.error(link);
// link = link.substring(2, link.indexOf(">"));
// Console.log("链接:" + link);
// }
//
// /**
// * 测试分类的商品数量
// */
// @Test
// public void testCount() {
// List<String> list = Arrays.asList("Men", "Women", "Children", "Afri Home", "Cosmetics", "Hair", "Sportswear", "Electronics");
// for (String product_type : list) {
// String link = "https://mollykitty.myshopify.com/admin/api/" + VERSION + "/products/count.json" + "?&product_type=" + product_type;
// System.out.println(link);
// link = HttpRequest.get(link)
// .header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
// .execute().body();
// System.err.println(product_type + ":" + link);
// }
// }
//
// /**
// * 测试第一次连接时的返回
// */
// @Test
// public void getLink() {
// String link = API_URL + "?&product_type=" + "Men" + "&limit=250";
// String headerLink = HttpRequest.get(link)
// .header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
// .execute().header("link");
// headerLink = headerLink.split(";")[0].replaceAll("<", "").replaceAll(">", "");
// System.err.println(headerLink);
// }
//
// /**
// * 连接测试
// */
// @Test
// public void linkTest() {
// String link = "https://mollykitty.myshopify.com/admin/api/2020-01/products.json?vendor=%E6%B3%B0%E9%82%A6%E6%9C%8D%E9%A5%B0&limit=100&vendor=戴菊";
// link = HttpRequest.get(link)
// .header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
// .execute().body();
//
// JSONObject json = JSONObject.fromObject(link);
// JSONArray productArr = json.getJSONArray("products");
// for (int j = 0; j < productArr.size(); j++) {
// JSONObject product = productArr.getJSONObject(j);
//
// String tags = product.getString("tags");
// String[] s = tags.split(",");
// if (s.length > 1) {
// for (String i : s) {
// if (i.contains("#")) {
// System.out.println(i);
// String three = i.replaceAll("#", "");
// System.out.println(three);
// }
// }
// } else {
//
// }
//
// JSONArray variantsArr = product.getJSONArray("variants");
// for (int i = 0; i < variantsArr.size(); i++) {
// JSONObject variantsObj = variantsArr.getJSONObject(i);
// String compare_at_price = variantsObj.getString("compare_at_price");
// if (!"null".equals(compare_at_price)) {
// System.out.println(compare_at_price);
// }
// }
//
// }
//
//
// }
//
// /**
// * 导入商品
// */
// @Test
// public void test() {
// String link = "";
// // 这个请求需要密钥,可以先拿着账号密码去浏览器请求一遍,F12 获取 token 复制粘贴即可
// String result = HttpRequest.get(link)
// .header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
// .execute().body();
// JSONObject jsonObject = JSONObject.fromObject(result);
// String headerLink = HttpRequest.get(link)
// .header("Authorization", "Basic N2YwZTA0OGFjNDAxNmI5MzU3YmIxZWIyMjE3ZTQyMDE6MWM5N2ExMjIyYzViNDBlMDU5N2M4MTZjNmRmZWNhYzA=")
// .execute().header("link");
// headerLink = headerLink.split(";")[0].replaceAll("<", "").replaceAll(">", "");
// }
//
// /**
// * 通过URL获取网络图片
// * 获取网络图片流
// *
// * @param url 传入的 URL 必须是以 http:// 开头的,因为我们使用了 HttpURLConnection
// * @return 输入流
// */
// public static InputStream getImageStream(String url) {
// try {
// HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
// connection.setReadTimeout(5000);
// connection.setConnectTimeout(5000);
// connection.setRequestMethod("GET");
// if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
// return connection.getInputStream();
// }
// } catch (IOException e) {
// System.out.println("获取网络图片出现异常,图片路径为:" + url);
// e.printStackTrace();
// }
// return null;
// }
//
// /**
// * 将 InputStream 流转换为 byte[]
// *
// * @param input InputStream
// * @return byte[]
// * @throws IOException IO流异常
// */
// public static byte[] toByteArray(InputStream input) throws IOException {
// ByteArrayOutputStream output = new ByteArrayOutputStream();
// byte[] buffer = new byte[1024 * 4];
// int n = 0;
// while (-1 != (n = input.read(buffer))) {
// output.write(buffer, 0, n);
// }
// return output.toByteArray();
// }
//
//
//}
......@@ -289,13 +289,29 @@
<i-input v-model="q.code" @on-enter="query" placeholder="商品编号" style="width:160px">
</i-input>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<span>
商品名称:
<i-input v-model="q.name" @on-enter="query" placeholder="商品名称" style="width:160px">
</i-input>
</span> &nbsp;&nbsp;
<span>
供应商:
<i-input v-model="q.supplier" @on-enter="query" placeholder="供应商" style="width:160px">
</i-input>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
<span>
创建人:
<i-select v-model="q.creator" @on-enter="query"
placeholder="创建人" style="width:160px">
<i-option v-for="(el,i) in creatorList" :key='i'
:value="el.userId">{{el.userName}}
</i-option>
</i-select>
</span>
&nbsp;&nbsp;&nbsp;
<span>
一级分类:
<i-select v-model="q.itemCategory" @on-enter="query"
......
......@@ -19,7 +19,8 @@ $(function () {
{label: '商品二级分类', name: 'title', index: 'title', width: 80},
{label: '商品三级分类', name: 'dname', index: 'itemDescritionId', width: 80},
{label: '状态', name: 'enableFlag', index: 'enable_flag', width: 60, formatter: itemStatusFormat},
{label: '创建日期', name: 'createTime', index: 'create_time', width: 80}
{label: '创建日期', name: 'createTime', index: 'create_time', width: 80},
{label: '创建人', name: 'uname', index: 'uname', width: 80}
]
});
});
......@@ -34,6 +35,8 @@ let vm = new Vue({
Goodstype: null,
Goodstype2: null,
uploadList: [],
uploadList1: [],
creatorList: [],
Goodstype3: null,
handleCreateSelect: null,
ruleValidate: {
......@@ -45,7 +48,9 @@ let vm = new Vue({
name: '',
code: '',
status: '',
itemCategory: ''
supplier: '',
itemCategory: '',
creator:''
},
......@@ -144,7 +149,6 @@ let vm = new Vue({
this.$set(vm.tbCfStationItem, 'tree', this.attrItem)
let _this = this
vm.tbCfStationItem.itemImg = vm.uploadList.map(res => res).join(';');
;
vm.tbCfStationItem.itemDesc = encodeURI(UE.getEditor('itemDesc').getContent()); // 富文本取值
vm.tbCfStationItem.itemDesc = vm.tbCfStationItem.itemDesc.replace(/&nbsp;/g, " ");
......@@ -288,7 +292,9 @@ let vm = new Vue({
'name': vm.q.name.trim(),
'code': vm.q.code.trim(),
'status': vm.q.status.trim(),
'itemCategory': vm.q.itemCategory.trim()
'supplier': vm.q.supplier.trim(),
'itemCategory': vm.q.itemCategory.trim(),
'creator': vm.q.creator.trim(),
},
page: page
}).trigger("reloadGrid");
......@@ -299,7 +305,9 @@ let vm = new Vue({
name: '',
code: '',
status: '',
itemCategory: ''
supplier: '',
itemCategory: '',
creator: ''
};
vm.reload();
},
......@@ -600,9 +608,12 @@ let vm = new Vue({
}
$.get('../tbcfgoodstype/queryAll', res => {
this.Goodstype = res.list;
console.log('一级分类', this.Goodstype)
})
$.get('../tbcfstationitem/queryCreator', res => {
let parse = JSON.parse(res);
this.creatorList = parse.list;
console.log('用户', this.creatorList)
})
//获取默认规格
$.get('../tbcategorytemplate/queryAll', res => {
let _res = JSON.parse(res)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论