!57 2022-1-20 Carl

Merge pull request !57 from Admin/sit-Carl-V3
This commit is contained in:
Admin 2022-01-20 09:12:29 +00:00 committed by Gitee
commit 3e833d2d15
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 247 additions and 3 deletions

View File

@ -72,8 +72,8 @@ public class SmartAuthenticationInterceptor extends HandlerInterceptorAdapter {
}
Boolean noNeedLogin = request.getServletPath().contains("royalcanin");
Boolean noNeedLoginToo = request.getContextPath().contains("royalcanin");
System.out.println("request.getContextPath() : " + request.getRequestURI());
System.out.println("request.getRequestURI() : " + request.getRequestURI());
// System.out.println("request.getContextPath() : " + request.getRequestURI());
// System.out.println("request.getRequestURI() : " + request.getRequestURI());
if (noNeedLogin||noNeedLoginToo) {
return true;
}

View File

@ -17,6 +17,9 @@ import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductMasterQ
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductQueryEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.CartService;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService;
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity;
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.service.ProductSearchTagService;
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
import net.lab1024.smartadmin.util.SmartJWTUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -25,7 +28,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API})
@OperateLog
@ -40,6 +45,9 @@ public class GoodController {
@Autowired
private CartService cartService;
@Autowired
private ProductSearchTagService productSearchTagService;
@Autowired
private GoodService goodService;
@ -58,6 +66,55 @@ public class GoodController {
@ApiOperation(value = "查询标品信息", notes = "查询标品信息")
@PostMapping("royalcanin/product/query")
public String transferBrand(ProductQueryEntity productQueryEntity) throws Exception {
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productQueryEntity);
List<String> brandNameList = new ArrayList<>();
List<String> tagNameList = new ArrayList<>();
int count = 0;
String categoryName = "";
for (String categoryKey : paramMap.keySet()) {
if(categoryKey == "categoryName" || categoryKey == "tagFunction" || categoryKey == "tagUsedAge" || categoryKey == "tagBreed") {
switch (categoryKey) {
case "categoryName":
categoryName = "专区";
break;
case "tagFunction":
categoryName = "功能";
break;
case "tagUsedAge":
categoryName = "年龄";
break;
case "tagBreed":
categoryName = "品种";
break;
}
brandNameList.add(categoryName);
count++;
for (String tagName : paramMap.get(categoryKey).split(",")) {
tagNameList.add(tagName);
}
}
}
if(count > 0) {
List<ProductSearchTagEntity> productSearchTagList = productSearchTagService.findAllByCondition(brandNameList, productQueryEntity.getPetType(), tagNameList, productQueryEntity.getTagStatus());
List<String> tagCodeList = new ArrayList<>();
for (ProductSearchTagEntity productSearchTagEntity : productSearchTagList) {
tagCodeList.add(productSearchTagEntity.getTagCode());
}
String tagCode = String.join(",", tagCodeList);
productQueryEntity.setTags(tagCode);
}
if(productQueryEntity.getTagStatus() != null && productQueryEntity.getTagStatus() != "") {
if (productQueryEntity.getTagStatus().equals("1") || productQueryEntity.getTagStatus().equals("0")) {
productQueryEntity.setCount("4");
}else{
productQueryEntity.setCount("1");
}
}else{
productQueryEntity.setCount(StringUtil.toString(count));
}
long startTime = System.currentTimeMillis();
String result = goodService.brandQuery(productQueryEntity);
long acceptTime = System.currentTimeMillis() ;

View File

@ -10,18 +10,37 @@ import lombok.NoArgsConstructor;
public class ProductQueryEntity {
private String channelId;
private String secret;
private String page;
private String rows;
private String productCode;
private String name;
private String brandCode;
private String brandName;
private String petType;
private String categoryName;
private String tagUsedAge;
private String tagFunction;
private String tagBreed;
private String tagStatus;
private String tags;
private String isSales;
private String count;
}

View File

@ -40,6 +40,12 @@ public class GoodService {
public String brandQuery(ProductQueryEntity productQueryEntity) throws Exception {
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productQueryEntity);
// paramMap.remove("petType");
paramMap.remove("categoryName");
paramMap.remove("tagUsedAge");
paramMap.remove("tagFunction");
paramMap.remove("tagBreed");
paramMap.remove("tagStatus");
MapRemoveNullUtil.removeNullEntry(paramMap);
paramMap.put("secret","H5@2021");
paramMap.put("channelId","15");

View File

@ -62,6 +62,6 @@ public class MemberAddressUpdateEntity {
/**
* 是否默认地址
*/
private boolean isDefault;
private String isDefault;
}

View File

@ -0,0 +1,16 @@
package net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.Dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
@Component
public interface ProductSearchTagDao extends BaseMapper<ProductSearchTagEntity> {
List<ProductSearchTagEntity> findAllByCondition(@Param("brandNameList") List<String> brandNameList,@Param("petType")String petType,@Param("tagNameList") List<String> tagNameList,@Param("tagStatus")String tagStatus);
}

View File

@ -0,0 +1,27 @@
package net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("t_royalcanin_productSearchTag")
public class ProductSearchTagEntity {
private String id ;
private String brandCode;
private String brandName;
private String petType;
private String tagName;
private String tagType;
private String tagCode;
private String isDelete;
}

View File

@ -0,0 +1,20 @@
package net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.service;
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.Dao.ProductSearchTagDao;
import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ProductSearchTagService {
@Autowired
private ProductSearchTagDao productSearchTagDao;
public List<ProductSearchTagEntity> findAllByCondition( List<String> brandNameList,String petType,List<String> tagNameList,String tagStatus){
return productSearchTagDao.findAllByCondition(brandNameList,petType,tagNameList,tagStatus);
}
}

View File

@ -21,4 +21,5 @@
where order_no = #{out_trade_no}
</update>
</mapper>

View File

@ -0,0 +1,34 @@
<?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="net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.Dao.ProductSearchTagDao">
<resultMap id="ProductSearchTagEntity"
type="net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.model.ProductSearchTagEntity"></resultMap>
<select id="findAllByCondition" resultMap="ProductSearchTagEntity">
select tag_code,brand_name,tag_name from t_royalcanin_productsearchtag WHERE
is_delete = 0
<if test="petType != null and petType != ''">
AND pet_type = #{petType}
</if>
<if test="brandNameList != null and brandNameList.size > 0">
AND brand_name in
<foreach collection="brandNameList" open="(" close=")" separator="," item="brandName">
#{brandName}
</foreach>
</if>
<if test="tagNameList != null and tagNameList.size > 0">
AND tag_name in
<foreach collection="tagNameList" open="(" close=")" separator="," item="tagName">
#{tagName}
</foreach>
</if>
<if test="tagStatus != null and tagStatus == 1">
AND tag_name not like '%湿粮%'
</if>
<if test="tagStatus != null and tagStatus == 2">
AND tag_name like '%湿粮%'
</if>
</select>
</mapper>

View File

@ -1707,4 +1707,68 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_notify_operate_log` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `t_royalcanin_productsearchtag` (
`id` int(50) NOT NULL,
`brand_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`brand_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`pet_type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`tag_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`tag_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`tag_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`is_delete` INT(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `t_royalcanin_productsearchtag` (`id`, `brand_code`, `brand_name`, `pet_type`, `tag_name`, `tag_type`, `tag_code`, `is_delete`, `create_time`) VALUES
(1019, '16518816', '品种', '1', '贵宾', '1017', '1017001', 0, '2022-01-19 16:41:55'),
(1020, '16518816', '品种', '1', '法斗', '1017', '1017002', 0, '2022-01-19 16:41:55'),
(1021, '16518816', '品种', '1', '德牧', '1017', '1017003', 0, '2022-01-19 16:41:55'),
(1022, '16518816', '品种', '1', '拉布拉多', '1017', '1017004', 0, '2022-01-19 16:41:55'),
(1023, '16518816', '品种', '1', '金毛', '1017', '1017005', 0, '2022-01-19 16:41:55'),
(1024, '16518816', '品种', '1', '比熊', '1017', '1017006', 0, '2022-01-19 16:41:55'),
(1025, '16518816', '品种', '1', '雪纳瑞', '1017', '1017007', 0, '2022-01-19 16:41:55'),
(1026, '16518816', '品种', '1', '约克夏', '1017', '1017008', 0, '2022-01-19 16:41:55'),
(1027, '16518816', '品种', '1', '吉娃娃', '1017', '1017009', 0, '2022-01-19 16:41:55'),
(1028, '16518816', '品种', '1', '柴犬', '1017', '1017010', 0, '2022-01-19 16:41:55'),
(1029, '16518816', '品种', '0', '巴哥', '1017', '1017011', 0, '2022-01-19 16:41:55'),
(1030, '16518816', '品种', '0', '英短', '1017', '1017012', 0, '2022-01-19 16:41:55'),
(1031, '16518816', '品种', '0', '美短', '1017', '1017013', 0, '2022-01-19 16:41:55'),
(1032, '16518816', '品种', '0', '布偶', '1017', '1017014', 0, '2022-01-19 16:41:55'),
(1033, '16518816', '品种', '0', '暹罗', '1017', '1017015', 0, '2022-01-19 16:41:55'),
(1034, '16518816', '品种', '0', '缅因', '1017', '1017016', 0, '2022-01-19 16:41:55'),
(1035, '16518816555131355', '年龄', '1', '幼年', '1018', '1018001', 0, '2022-01-19 16:41:55'),
(1036, '16518816555131355', '年龄', '1', '成年', '1018', '1018002', 0, '2022-01-19 16:41:55'),
(1037, '16518816', '年龄', '1', '老年', '1018', '1018003', 0, '2022-01-19 16:41:55'),
(1038, '16518816', '年龄', '0', '4-12月龄', '1018', '1018004', 0, '2022-01-19 16:41:55'),
(1039, '16518816', '年龄', '0', '1-7岁', '1018', '1018005', 0, '2022-01-19 16:41:55'),
(1040, '16518816', '年龄', '0', '>7岁', '1018', '1018006', 0, '2022-01-19 16:41:55'),
(1041, '16518816', '功能', '1', '被毛呵护', '1019', '1019001', 0, '2022-01-19 16:41:55'),
(1042, '16518816', '功能', '1', '绝育呵护', '1019', '1019002', 0, '2022-01-19 16:41:55'),
(1043, '16518816', '功能', '1', '皮肤呵护', '1019', '1019003', 0, '2022-01-19 16:41:55'),
(1044, '16518816', '功能', '1', '体重呵护', '1019', '1019004', 0, '2022-01-19 16:41:55'),
(1045, '16518816', '功能', '1', '消化呵护', '1019', '1019005', 0, '2022-01-19 16:41:55'),
(1046, '16518816', '功能', '0', '绝育呵护', '1019', '1019006', 0, '2022-01-19 16:41:55'),
(1047, '16518816', '功能', '0', '口腔护理', '1019', '1019007', 0, '2022-01-19 16:41:55'),
(1048, '16518816', '功能', '0', '美毛呵护', '1019', '1019008', 0, '2022-01-19 16:41:55'),
(1049, '16518816', '功能', '0', '去毛球', '1019', '1019009', 0, '2022-01-19 16:41:55'),
(1050, '16518816', '功能', '0', '体重呵护', '1019', '1019010', 0, '2022-01-19 16:41:55'),
(1059, '16518816', '年龄', '0', '<4月龄', '1018', '1018007', 0, '2022-01-19 16:41:55'),
(1060, '16518816', '年龄', '1', '离乳期', '1018', '1018008', 0, '2022-01-19 16:41:55'),
(1062, '16518816', '专区', '1', '体型犬粮', '1021', '1021001', 0, '2022-01-19 16:41:55'),
(1063, '16518816', '专区', '1', '功能犬粮', '1021', '1021002', 0, '2022-01-19 16:41:55'),
(1064, '16518816', '专区', '1', '品种犬粮', '1021', '1021003', 0, '2022-01-19 16:41:55'),
(1065, '16518816', '专区', '1', '犬湿粮', '1021', '1021004', 0, '2022-01-19 16:41:55'),
(1066, '16518816', '专区', '0', '功能猫粮', '1021', '1021005', 0, '2022-01-19 16:41:55'),
(1067, '16518816', '专区', '0', '品种猫粮', '1021', '1021006', 0, '2022-01-19 16:41:55'),
(1068, '16518816', '专区', '0', '营养猫粮', '1021', '1021007', 0, '2022-01-19 16:41:55'),
(1069, '16518816', '功能', '0', '消化优选', '1019', '1019011', 0, '2022-01-19 16:41:55'),
(1070, '16518816', '品种', '0', '波斯', '1017', '1017017', 0, '2022-01-19 16:41:55'),
(1071, '16518816', '品种', '0', '孟加拉豹猫', '1017', '1017018', 0, '2022-01-19 16:41:55'),
(1073, '16518816', '品种', '0', '斯芬克斯', '1017', '1017020', 0, '2022-01-19 16:41:55'),
(1083, '16518816', '专区', '0', '猫湿粮', '1021', '1021111', 0, '2022-01-19 16:41:55'),
(1084, '16518816', '品种', '1', '博美', '1017', '1017021', 0, '2022-01-19 16:41:55'),
(1086, '16518816', '专区', '1', '优卡产品', '1021', '1021050', 0, '2022-01-19 16:41:55');
--