Browse Source

添加音乐库接口

syh 4 years ago
parent
commit
18277bfb50
14 changed files with 85 additions and 144 deletions
  1. 22 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicTypeController.java
  2. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  3. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
  4. 25 9
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 9 35
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/entity/BytedanceMusicType.java
  6. 3 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/DictMusicTypeMapper.java
  7. 2 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/xml/DictMusicTypeMapper.xml
  8. 11 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/service/impl/DictMusicTypeServiceImpl.java
  9. 0 74
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java
  10. 0 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  11. 0 3
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java
  12. 0 3
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatTokenServiceImpl.java
  13. 8 8
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  14. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

+ 22 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicTypeController.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicInfo;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicType;
+import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicInfoService;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicTypeService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,9 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
- /**
+/**
  * 音乐类型信息
  * @author jeecg-boot
  * @date   2020-10-28
@@ -26,6 +30,8 @@ import java.util.Arrays;
 public class BytedanceMusicTypeController {
 	@Autowired
 	private IBytedanceMusicTypeService bytedanceMusicTypeService;
+	@Autowired
+	private IBytedanceMusicInfoService bytedanceMusicInfoService;
 
 	/**
 	  * 分页列表查询
@@ -40,10 +46,25 @@ public class BytedanceMusicTypeController {
 														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 														   HttpServletRequest req) {
+		String typeValue = bytedanceMusicType.getTypeValue();
+		bytedanceMusicType.setTypeValue(null);
 		Result<IPage<BytedanceMusicType>> result = new Result<>();
 		QueryWrapper<BytedanceMusicType> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicType, req.getParameterMap());
+		queryWrapper.like("type_value",typeValue);
 		Page<BytedanceMusicType> page = new Page<>(pageNo, pageSize);
 		IPage<BytedanceMusicType> pageList = bytedanceMusicTypeService.page(page, queryWrapper);
+		List<BytedanceMusicType> records = pageList.getRecords();
+		if(null!=records&&!records.isEmpty()){
+			List<BytedanceMusicType> setRecords = new ArrayList<>();
+			for (BytedanceMusicType type:records) {
+				BytedanceMusicInfo musicInfo = bytedanceMusicInfoService.getById(type.getMusicId());
+				if(null!=musicInfo){
+					type.setMusicInfo(musicInfo);
+				}
+				setRecords.add(type);
+			}
+			pageList.setRecords(setRecords);
+		}
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

@@ -584,5 +584,9 @@ public class ProjectMemberController {
 
     }
 
+    public static void main(String[] args) {
+
+    }
+
 
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java

@@ -122,7 +122,7 @@ public class SysBaseApiImpl implements ISysBaseApi {
 	}
 
 	@Override
-	@Cacheable(cacheNames=CacheConstant.SYS_USERS_CACHE, key="#username")
+//	@Cacheable(cacheNames=CacheConstant.SYS_USERS_CACHE, key="#username")
 	public LoginUser getUserByName(String username) {
 		if(oConvertUtils.isEmpty(username)) {
 			return null;

File diff suppressed because it is too large
+ 25 - 9
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java


+ 9 - 35
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/entity/BytedanceMusicType.java

@@ -1,19 +1,15 @@
 package cn.com.ctop.crawler.modules.music.entity;
 
-import java.io.Serializable;
-import java.util.Date;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
 
 /**
  * 音乐类型信息
@@ -28,39 +24,17 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @ApiModel(value="ctop_music_type对象", description="音乐类型信息")
 public class BytedanceMusicType {
 
-	/**id*/
-	@TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "id")
-	private Integer id;
-	/**type*/
-	@Excel(name = "type", width = 15)
-    @ApiModelProperty(value = "type")
+	@TableId(type = IdType.AUTO)
+	private Long id;
 	private String type;
-	/**typeValue*/
-	@Excel(name = "typeValue", width = 15)
-    @ApiModelProperty(value = "typeValue")
 	private String typeValue;
-	/**extType*/
-	@Excel(name = "extType", width = 15)
-    @ApiModelProperty(value = "extType")
 	private String extType;
-	/**extTypeValue*/
-	@Excel(name = "extTypeValue", width = 15)
-    @ApiModelProperty(value = "extTypeValue")
 	private String extTypeValue;
-	/**musicId*/
-	@Excel(name = "musicId", width = 15)
-    @ApiModelProperty(value = "musicId")
-	private Integer musicId;
-	/**musicName*/
-	@Excel(name = "musicName", width = 15)
-    @ApiModelProperty(value = "musicName")
+	private Long musicId;
 	private String musicName;
-	/**author*/
-	@Excel(name = "author", width = 15)
-    @ApiModelProperty(value = "author")
 	private String author;
-	/**createTime*/
-    @ApiModelProperty(value = "createTime")
 	private Date createTime;
+
+	@TableField(exist = false)
+	private BytedanceMusicInfo musicInfo;
 }

+ 3 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/DictMusicTypeMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.crawler.modules.music.mapper;
 
 import cn.com.ctop.crawler.modules.music.entity.DictMusicType;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -14,5 +15,6 @@ import java.util.List;
 public interface DictMusicTypeMapper extends BaseMapper<DictMusicType> {
 
     List<DictMusicType> getAllExtTypeZh();
-    List<DictMusicType> getExtTypeValueZhByType(String extType);
+
+    List<DictMusicType> getAllExtInfoByExtTypeZh(@Param(value = "extTypeZh")String extTypeZh);
 }

+ 2 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/mapper/xml/DictMusicTypeMapper.xml

@@ -6,8 +6,8 @@
         select distinct ext_type_zh,ext_type from ctop_dict_music_type_zh
     </select>
 
-    <select id="getExtTypeValueZhByType" resultType="cn.com.ctop.crawler.modules.music.entity.DictMusicType">
+    <select id="getAllExtInfoByExtTypeZh" resultType="cn.com.ctop.crawler.modules.music.entity.DictMusicType">
         select distinct ext_type_value,ext_type_zh from ctop_dict_music_type_zh
-        where ext_type = #{extType}
+        where ext_type_zh = #{extTypeZh}
     </select>
 </mapper>

+ 11 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/music/service/impl/DictMusicTypeServiceImpl.java

@@ -22,7 +22,17 @@ public class DictMusicTypeServiceImpl extends ServiceImpl<DictMusicTypeMapper, D
     private DictMusicTypeMapper musicTypeMapper;
     @Override
     public JSONObject listAll() {
+        JSONObject data = new JSONObject();
         List<DictMusicType> musicTypeList = musicTypeMapper.getAllExtTypeZh();
-        return null;
+        if(null!=musicTypeList&&!musicTypeList.isEmpty()){
+            List<DictMusicType> setList = musicTypeMapper.getAllExtTypeZh();
+            for (DictMusicType type:musicTypeList) {
+                List<DictMusicType>children = musicTypeMapper.getAllExtInfoByExtTypeZh(type.getExtTypeZh());
+                type.setDetail(children);
+                setList.add(type);
+            }
+            data.put("data",setList);
+        }
+        return data;
     }
 }

+ 0 - 74
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java

@@ -51,81 +51,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
         String sign = DigestUtils.md5Hex(token + "&" + paramMap.get("t") + "&" + paramMap.get("appKey") + "&" + paramMap.get("data"));
         paramMap.put("sign", sign);
         headerMap.put("Cookie", cookie);
-//        System.out.println(cookie);
         result = HttpUtils.httpGet(url, paramMap, headerMap);
         return result;
     }
-
-    public static void main(String[] args) {
-        try {
-            PrintStream out = new PrintStream("D:/bybt0929.csv");
-            System.setOut(out);
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        }
-        System.out.println("商品id,商品名,销量,商品logo,设计图,商品图,商品链接,正常价,,,补贴价,补贴券");
-
-        TaobaoJhsbybtServiceImpl tb = new TaobaoJhsbybtServiceImpl();
-        int i = 1;
-        Boolean hasMore = true;
-        while (hasMore) {
-            try {
-                String result = tb.getGoodsList(i);
-                result = result.replace("mtopjsonp2(", "");
-                result = result.substring(0, result.length() - 1);
-                ObjectMapper mapper = new ObjectMapper();
-                JsonNode rootNode = mapper.readTree(result);
-//                System.out.println(HttpUtils.COOKIESTORE.toString());
-//                System.out.println(result);
-                Boolean success = rootNode.get("data").get("resultValue").get("8613423").get("success").asBoolean();
-                while (!success) {
-                    Thread.sleep(3000L);
-                    result = tb.getGoodsList(i);
-                    result = result.replace("mtopjsonp2(", "");
-                    result = result.substring(0, result.length() - 1);
-                    mapper = new ObjectMapper();
-                    rootNode = mapper.readTree(result);
-                    success = rootNode.get("data").get("resultValue").get("8613423").get("success").asBoolean();
-                }
-                hasMore = rootNode.get("data").get("resultValue").get("8613423").get("data").get("hasMore").asBoolean();
-                Iterator<JsonNode> items = rootNode.get("data").get("resultValue").get("8613423").get("data").get("items").iterator();
-                while (items.hasNext()) {
-                    JsonNode itemNode = items.next();
-                    String cjmsItemName = itemNode.get("cjmsItemName").asText();
-                    String itemSoldInfo = itemNode.get("itemSoldInfo").asText();
-                    String picUrl = itemNode.get("picUrl").asText();
-                    String cjmsTaobaoEntrance = itemNode.get("cjmsTaobaoEntrance").asText();
-                    String couponAmount = itemNode.get("couponAmount").asText();
-                    String orgPrice = itemNode.get("orgPrice").asText();
-                    String brandLogo = itemNode.get("brandLogo").asText();
-                    String couponPrice = itemNode.get("couponPrice").asText();
-                    String actPrice = itemNode.get("actPrice").asText();
-                    String cutPrice = itemNode.get("cutPrice").asText();
-                    String itemUrl = itemNode.get("itemUrl").asText();
-                    String itemId = itemNode.get("itemId").asText();
-                    System.out.println(itemId+","+cjmsItemName+","+
-                            itemSoldInfo+","+
-                            brandLogo+","+
-                            picUrl+","+
-                            cjmsTaobaoEntrance+","+
-                            itemUrl+","+
-                            actPrice+","+
-                            cutPrice+","+
-                            orgPrice+","+
-                            couponPrice+","+
-                            couponAmount);
-                }
-                i++;
-
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            try {
-                Thread.sleep(3000L);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-
-    }
 }

+ 0 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -2620,11 +2620,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             List<KuaiShouImageGet> imageGets = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
                 var detailJson = details.getJSONObject(i);
-
-               /* if (Check.isNull(detailJson.getString("signature"))) {
-                    continue;
-                }*/
-
                 var kuaiShouImageGet = JSONObject.toJavaObject(detailJson, KuaiShouImageGet.class);
 
                 if (StringUtils.isBlank(String.valueOf(kuaiShouImageGet.getImageToken()))) {

+ 0 - 3
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java

@@ -141,9 +141,6 @@ public class WechatNoListServiceImpl extends ServiceImpl<WechatNoListMapper, Wec
                             JSONObject applyer = info.getJSONObject("applyer");
                             if (!Check.isNull(applyer)) {
                                 userId = applyer.getString("userid");
-                                if ("LiuJing".equals(userId)) {
-                                    System.out.println(info);
-                                }
                             }
                             //审批申请数据
                             JSONObject applyData = info.getJSONObject("apply_data");

+ 0 - 3
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatTokenServiceImpl.java

@@ -19,7 +19,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
             params.put("corpsecret", QYWxConstant.QYWX_CORP_SECRET);
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
-            //System.out.println(resultStr);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             Integer errcode = resultJson.getInteger("errcode");
             if (errcode == 0) {
@@ -43,7 +42,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
             params.put("corpsecret", QYWxConstant.QYWX_OA_CORP_SECRET);
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
-            //System.out.println(resultStr);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             Integer errcode = resultJson.getInteger("errcode");
             if (errcode == 0) {
@@ -74,7 +72,6 @@ public class WechatTokenServiceImpl implements IWechatTokenService {
             params.put("corpid", QYWxConstant.QYWX_CORP_ID);
             params.put("corpsecret", QYWxConstant.QYWX_APPROVA_CORP_SECRET);
             String resultStr = HttpUtils.httpGetRequest(QYWxConstant.QYWX_API_URL + QYWxConstant.QYWX_GET_TOKEN, null, params);
-            //System.out.println(resultStr);
             JSONObject resultJson = JSONObject.parseObject(resultStr);
             Integer errcode = resultJson.getInteger("errcode");
             if (errcode == 0) {

+ 8 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -244,7 +244,7 @@
         sum(report.show_material)                                     as 'show_num',
         sum(report.convert_material)                                  as 'convert',
         report.image_url                                           as 'image_url',
-        report.code                                           as 'signature',
+        report.material_id                                           as 'signature',
         group_concat(distinct report.project_name)                    as 'project_name',
         report.stat_datetime                                          as 'stat_date',
         report.plane_id as 'user_id',
@@ -253,7 +253,7 @@
             left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
         1=1
-        and report.code is not null
+        and report.material_id is not null
         <if test="startDate!=null">
             and report.stat_datetime &gt;= #{startDate}
         </if>
@@ -267,9 +267,9 @@
             </foreach>
         </if>
         <if test="code!=null">
-            and report.code = #{code}
+            and report.material_id = #{code}
         </if>
-        group by report.code
+        group by report.material_id
         order by sum(report.cost) desc
     </select>
 
@@ -333,7 +333,7 @@ where a.plane_id is not null and a.plane_name is null
         sum(report.show_material)                                     as 'show_num',
         sum(report.convert_material)                                  as 'convert',
         report.image_url                                           as 'image_url',
-        report.code                                           as 'signature',
+        report.material_id                                           as 'signature',
         group_concat(distinct report.project_name)                    as 'project_name',
         report.stat_datetime                                          as 'stat_date',
         report.plane_id as 'user_id',
@@ -341,7 +341,7 @@ where a.plane_id is not null and a.plane_name is null
         from ctop_bytedance_report_image_daily report
         where
         1=1
-        and report.code is not null
+        and report.material_id is not null
         <if test="startDate!=null">
             and report.stat_datetime &gt;= #{startDate}
         </if>
@@ -355,9 +355,9 @@ where a.plane_id is not null and a.plane_name is null
             </foreach>
         </if>
         <if test="code!=null">
-            and report.code = #{code}
+            and report.material_id = #{code}
         </if>
-        group by report.code
+        group by report.material_id
         order by sum(report.cost) desc
     </select>
 

+ 0 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -82,7 +82,6 @@ public class ReportServiceImpl implements IReportService {
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
         JSONObject getObject = getAdvertiserStat(token, jsonObject);
-        System.out.println(getObject);
         if(null == getObject){
             XxlJobLogger.log("头条广告主数据获取异常");
             return;