浏览代码

账户2.0

zhaoxian 3 年之前
父节点
当前提交
313235ba08

+ 10 - 0
ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveUserAccountController.java

@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
@@ -91,6 +92,15 @@ public class KuaishouLiveUserAccountController extends BaseController {
     }
 
     /**
+     * 通过excel导入账户
+     */
+    @PostMapping(value = "/insertByExcel")
+    @ApiOperation(value = "通过excel导入账户")
+    public ResultResponse insertByExcel(@ApiParam("excel文档") @RequestParam(value = "file", required = false) MultipartFile file) {
+        return kuaishouLiveUserAccountService.insertByExcel(file);
+    }
+
+    /**
      * 修改快手直播账户
      */
     @PostMapping(value = "/edit")

+ 46 - 0
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveProject.java

@@ -0,0 +1,46 @@
+package com.ruixuan.live.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 快手直播项目对象 kuaishou_live_project
+ */
+@Data
+@ApiModel(value = "kuaishouLiveProject", description = "快手直播项目")
+public class KuaishouLiveProject {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 账户ID
+     */
+    private Long id;
+
+    /**
+     * 项目名称
+     */
+    @ApiModelProperty(name = "项目名称")
+    private String projectName;
+
+    /**
+     * 项目状态:1-生效,0-无效
+     */
+    @ApiModelProperty(name = "项目状态:1-生效,0-无效")
+    private String state;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+}

+ 49 - 18
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccount.java

@@ -1,8 +1,8 @@
 package com.ruixuan.live.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -25,81 +25,103 @@ public class KuaishouLiveUserAccount implements Serializable {
     private String id;
 
     /**
+     * 账户ID
+     */
+    private Long projectId;
+
+    /**
      * 快手ID
      */
-    @ApiModelProperty(name = "快手ID")
     private Long ksId;
 
     /**
      * 快手昵称
      */
-    @ApiModelProperty(name = "快手昵称")
     private String ksName;
 
     /**
      * 账户ID
      */
-    @ApiModelProperty(name = "账户ID")
     private Long accountId;
 
     /**
      * 账户名称
      */
-    @ApiModelProperty(name = "账户名称")
     private String accountName;
 
     /**
      * 账户类型
      */
-    @ApiModelProperty(name = "账户类型")
     private String accountType;
 
     /**
+     * 付款方式
+     */
+    private String paymentMethod;
+
+    /**
      * 销售负责人Id
      */
-    @ApiModelProperty(name = "销售负责人Id")
     private String saleLeaderId;
 
     /**
      * 销售负责人
      */
-    @ApiModelProperty(name = "销售负责人")
     private String saleLeader;
 
     /**
-     * 运营负责人Id
+     * 运营(优化)负责人Id
      */
-    @ApiModelProperty(name = "运营负责人Id")
     private String operatorLeaderId;
 
     /**
-     * 运营负责人
+     * 运营(优化)负责人
      */
-    @ApiModelProperty(name = "运营负责人")
     private String operatorLeader;
 
     /**
      * 设计负责人Id
      */
-    @ApiModelProperty(name = "设计负责人Id")
     private String designerLeaderId;
 
     /**
      * 设计负责人
      */
-    @ApiModelProperty(name = "设计负责人")
     private String designerLeader;
 
     /**
-     * 投放类型
+     * 企业名称
      */
-    @ApiModelProperty(name = "投放类型")
-    private String putType;
+    private String enterpriseName;
+
+    /**
+     * 一级行业
+     */
+    private String firstIndustry;
+
+    /**
+     * 二级行业
+     */
+    private String secondaryIndustry;
+
+    /**
+     * 资质状态
+     */
+    private String qualificationStatus;
+
+    /**
+     * 账户状态
+     */
+    private String accountStatus;
+
+    /**
+     * 端口名称
+     */
+    private String portName;
 
     /**
      * 创建人ID
      */
-    @ApiModelProperty(name = "创建人ID")
     private String createrId;
 
     /**
@@ -119,4 +141,13 @@ public class KuaishouLiveUserAccount implements Serializable {
     private Date createTime;
 
     private Integer count;
+
+    public KuaishouLiveUserAccount(JSONObject object) {
+
+
+
+
+
+
+    }
 }

+ 61 - 0
ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveProjectMapper.java

@@ -0,0 +1,61 @@
+package com.ruixuan.live.mapper;
+
+import com.ruixuan.live.entity.KuaishouLiveProject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手直播项目Mapper接口
+ */
+public interface KuaishouLiveProjectMapper {
+    /**
+     * 查询快手直播项目
+     *
+     * @param id 快手直播项目主键
+     * @return 快手直播项目
+     */
+    public KuaishouLiveProject selectKuaishouLiveProjectById(Long id);
+
+    /**
+     * 查询快手直播项目列表
+     *
+     * @param kuaishouLiveProject 快手直播项目
+     * @return 快手直播项目集合
+     */
+    public List<KuaishouLiveProject> selectKuaishouLiveProjectList(KuaishouLiveProject kuaishouLiveProject);
+
+    /**
+     * 新增快手直播项目
+     *
+     * @param kuaishouLiveProject 快手直播项目
+     * @return 结果
+     */
+    public int insertKuaishouLiveProject(KuaishouLiveProject kuaishouLiveProject);
+
+    /**
+     * 修改快手直播项目
+     *
+     * @param kuaishouLiveProject 快手直播项目
+     * @return 结果
+     */
+    public int updateKuaishouLiveProject(KuaishouLiveProject kuaishouLiveProject);
+
+    /**
+     * 删除快手直播项目
+     *
+     * @param id 快手直播项目主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveProjectById(Long id);
+
+    /**
+     * 批量删除快手直播项目
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveProjectByIds(Long[] ids);
+
+    KuaishouLiveProject getOne(@Param("id") Long id, @Param("projectName") String projectName);
+}

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveUserAccountService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.live.entity.KuaishouLiveUserAccount;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
@@ -38,6 +39,7 @@ public interface IKuaishouLiveUserAccountService {
      */
     public ResultResponse insertKuaishouLiveUserAccount(KuaishouLiveUserAccount kuaishouLiveUserAccount);
 
+    ResultResponse insertByExcel(MultipartFile file);
     /**
      * 修改快手直播账户
      *

+ 42 - 1
ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveUserAccountServiceImpl.java

@@ -5,14 +5,17 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.utils.Check;
+import com.ruixuan.data.utils.LiveDataExcelUtils;
+import com.ruixuan.live.entity.KuaishouLiveProject;
 import com.ruixuan.live.entity.KuaishouLiveUserAccount;
-import com.ruixuan.live.entity.KuaishouLiveUserAccountPart;
+import com.ruixuan.live.mapper.KuaishouLiveProjectMapper;
 import com.ruixuan.live.mapper.KuaishouLiveUserAccountMapper;
 import com.ruixuan.live.mapper.KuaishouLiveUserAccountPartMapper;
 import com.ruixuan.live.service.IKuaishouLiveUserAccountService;
 import com.ruixuan.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 import java.util.UUID;
@@ -25,12 +28,17 @@ import java.util.UUID;
  */
 @Service
 public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAccountService {
+
     @Autowired
     private KuaishouLiveUserAccountMapper kuaishouLiveUserAccountMapper;
+
     @Autowired
     private KuaishouLiveUserAccountPartMapper accountPartMapper;
 
     @Autowired
+    private KuaishouLiveProjectMapper kuaishouLiveProjectMapper;
+
+    @Autowired
     private ISysUserService sysUserService;
 
     /**
@@ -58,6 +66,9 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
      */
     @Override
     public List<KuaishouLiveUserAccount> selectKuaishouLiveUserAccountList(KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        if (Check.isNull(kuaishouLiveUserAccount.getAccountType())) {
+            kuaishouLiveUserAccount.setAccountType("cljn");
+        }
         return kuaishouLiveUserAccountMapper.selectKuaishouLiveUserAccountList(kuaishouLiveUserAccount);
     }
 
@@ -88,6 +99,7 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
             }
         }
         account.setId(UUID.randomUUID().toString().replace("-", ""));
+        account.setProjectId(getAndInsertProject(account.getKsId(), account.getKsName()));
         int num = kuaishouLiveUserAccountMapper.insertKuaishouLiveUserAccount(account);
         if (num > 0) {
             return ResultResponse.success();
@@ -95,6 +107,35 @@ public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAcco
         return ResultResponse.error("fail");
     }
 
+    private Long getAndInsertProject(Long id, String projectName) {
+        KuaishouLiveProject project = kuaishouLiveProjectMapper.getOne(id, projectName);
+        if (Check.isNull(project)) {
+            KuaishouLiveProject kuaishouLiveProject = new KuaishouLiveProject();
+            kuaishouLiveProject.setId(id);
+            kuaishouLiveProject.setProjectName(projectName);
+            kuaishouLiveProjectMapper.insertKuaishouLiveProject(kuaishouLiveProject);
+        }
+        return id;
+    }
+
+    @Override
+    public ResultResponse insertByExcel(MultipartFile file) {
+        String fileName = file.getOriginalFilename();
+        try {
+            List<JSONObject> list = LiveDataExcelUtils.analysisFile(file, fileName);
+            for (JSONObject object : list) {
+            KuaishouLiveUserAccount k = new KuaishouLiveUserAccount(object);
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+        return null;
+    }
+
     /**
      * 修改快手直播账户
      */

+ 86 - 0
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveProjectMapper.xml

@@ -0,0 +1,86 @@
+<?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.ruixuan.live.mapper.KuaishouLiveProjectMapper">
+
+    <resultMap type="com.ruixuan.live.entity.KuaishouLiveProject" id="KuaishouLiveProjectResult">
+        <result property="id" column="id"/>
+        <result property="projectName" column="project_name"/>
+        <result property="state" column="state"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveProjectVo">
+        select id, project_name, state, create_time, update_time
+        from kuaishou_live_project
+    </sql>
+
+    <select id="selectKuaishouLiveProjectList" parameterType="com.ruixuan.live.entity.KuaishouLiveProject"
+            resultMap="KuaishouLiveProjectResult">
+        <include refid="selectKuaishouLiveProjectVo"/>
+        <where>
+            <if test="projectName != null  and projectName != ''">and project_name like concat('%', #{projectName},
+                '%')
+            </if>
+            <if test="state != null  and state != ''">and state = #{state}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLiveProjectById" parameterType="Long" resultMap="KuaishouLiveProjectResult">
+        <include refid="selectKuaishouLiveProjectVo"/>
+        where id = #{id}
+    </select>
+
+    <select id="getOne" resultMap="KuaishouLiveProjectResult">
+        <include refid="selectKuaishouLiveProjectVo"/>
+        where id = #{id}
+        <if test="projectName != null">
+            and project_name = #{projectName}
+        </if>
+        and state = 1
+    </select>
+
+    <insert id="insertKuaishouLiveProject" parameterType="com.ruixuan.live.entity.KuaishouLiveProject">
+        insert into kuaishou_live_project
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="projectName != null">project_name,</if>
+            <if test="state != null">state,</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},</if>
+            <if test="projectName != null">#{projectName},</if>
+            <if test="state != null">#{state},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveProject" parameterType="com.ruixuan.live.entity.KuaishouLiveProject">
+        update kuaishou_live_project
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="projectName != null">project_name = #{projectName},</if>
+            <if test="state != null">state = #{state},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLiveProjectById" parameterType="Long">
+        delete
+        from kuaishou_live_project
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLiveProjectByIds" parameterType="String">
+        delete from kuaishou_live_project where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 35 - 10
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveUserAccountMapper.xml

@@ -17,7 +17,6 @@
         <result property="operatorLeader" column="operator_leader"/>
         <result property="designerLeaderId" column="designer_leader_id"/>
         <result property="designerLeader" column="designer_leader"/>
-        <result property="putType" column="put_type"/>
         <result property="createrId" column="creater_id"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
@@ -26,18 +25,25 @@
 
     <sql id="selectKuaishouLiveUserAccountVo">
         select id,
+               project_id,
                ks_id,
                ks_name,
                account_id,
                account_name,
                account_type,
+               payment_method,
                sale_leader_id,
                sale_leader,
                operator_leader_id,
                operator_leader,
                designer_leader_id,
                designer_leader,
-               put_type
+               enterprise_name,
+               first_industry,
+               secondary_industry,
+               qualification_status,
+               account_status,
+               port_name
         from kuaishou_live_user_account
     </sql>
 
@@ -55,7 +61,6 @@
         operator_leader,
         designer_leader_id,
         designer_leader,
-        put_type,
         IFNULL(t2.count,0) as 'count'
         from kuaishou_live_user_account t1
         left join (
@@ -66,10 +71,10 @@
             <if test="ksId != null ">and ks_id = #{ksId}</if>
             <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
             <if test="accountId != null ">and account_id = #{accountId}</if>
-            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
-                '%')
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName}, '%')
+            </if>
+            <if test="accountType != null  and accountType != ''">and account_type like concat('%', #{accountType}, '%')
             </if>
-            <if test="accountType != null  and accountType != ''">and account_type = #{accountType}</if>
             <if test="saleLeaderId != null  and saleLeaderId != ''">and sale_leader_id = #{saleLeaderId}</if>
             <if test="saleLeader != null  and saleLeader != ''">and sale_leader = #{saleLeader}</if>
             <if test="operatorLeaderId != null  and operatorLeaderId != ''">and operator_leader_id =
@@ -80,7 +85,6 @@
                 #{designerLeaderId}
             </if>
             <if test="designerLeader != null  and designerLeader != ''">and designer_leader = #{designerLeader}</if>
-            <if test="putType != null  and putType != ''">and put_type like concat('%', #{putType}, '%')</if>
             <if test="createrId != null  and createrId != ''">and creater_id = #{createrId}</if>
         </where>
         ORDER BY create_time desc
@@ -117,36 +121,50 @@
         insert into kuaishou_live_user_account
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
+            <if test="projectId != null">project_id,</if>
             <if test="ksId != null">ks_id,</if>
             <if test="ksName != null">ks_name,</if>
             <if test="accountId != null">account_id,</if>
             <if test="accountName != null">account_name,</if>
             <if test="accountType != null">account_type,</if>
+            <if test="paymentMethod != null">payment_method,</if>
             <if test="saleLeaderId != null">sale_leader_id,</if>
             <if test="saleLeader != null">sale_leader,</if>
             <if test="operatorLeaderId != null">operator_leader_id,</if>
             <if test="operatorLeader != null">operator_leader,</if>
             <if test="designerLeaderId != null">designer_leader_id,</if>
             <if test="designerLeader != null">designer_leader,</if>
-            <if test="putType != null">put_type,</if>
+            <if test="enterpriseName != null">enterprise_name,</if>
+            <if test="firstIndustry != null">first_industry,</if>
+            <if test="secondaryIndustry != null">secondary_industry,</if>
+            <if test="qualificationStatus != null">qualification_status,</if>
+            <if test="accountStatus != null">account_status,</if>
+            <if test="portName != null">port_name,</if>
             <if test="createrId != null">creater_id,</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},</if>
+            <if test="projectId != null">#{projectId},</if>
             <if test="ksId != null">#{ksId},</if>
             <if test="ksName != null">#{ksName},</if>
             <if test="accountId != null">#{accountId},</if>
             <if test="accountName != null">#{accountName},</if>
             <if test="accountType != null">#{accountType},</if>
+            <if test="paymentMethod != null">#{paymentMethod},</if>
             <if test="saleLeaderId != null">#{saleLeaderId},</if>
             <if test="saleLeader != null">#{saleLeader},</if>
             <if test="operatorLeaderId != null">#{operatorLeaderId},</if>
             <if test="operatorLeader != null">#{operatorLeader},</if>
             <if test="designerLeaderId != null">#{designerLeaderId},</if>
             <if test="designerLeader != null">#{designerLeader},</if>
-            <if test="putType != null">#{putType},</if>
+            <if test="enterpriseName != null">#{enterpriseName},</if>
+            <if test="firstIndustry != null">#{firstIndustry},</if>
+            <if test="secondaryIndustry != null">#{secondaryIndustry},</if>
+            <if test="qualificationStatus != null">#{qualificationStatus},</if>
+            <if test="accountStatus != null">#{accountStatus},</if>
+            <if test="portName != null">#{portName},</if>
             <if test="createrId != null">#{createrId},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
@@ -156,18 +174,25 @@
     <update id="updateKuaishouLiveUserAccount" parameterType="com.ruixuan.live.entity.KuaishouLiveUserAccount">
         update kuaishou_live_user_account
         <trim prefix="SET" suffixOverrides=",">
+            <if test="projectId != null">project_id = #{projectId},</if>
             <if test="ksId != null">ks_id = #{ksId},</if>
             <if test="ksName != null">ks_name = #{ksName},</if>
             <if test="accountId != null">account_id = #{accountId},</if>
             <if test="accountName != null">account_name = #{accountName},</if>
             <if test="accountType != null">account_type = #{accountType},</if>
+            <if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
             <if test="saleLeaderId != null">sale_leader_id = #{saleLeaderId},</if>
             <if test="saleLeader != null">sale_leader = #{saleLeader},</if>
             <if test="operatorLeaderId != null">operator_leader_id = #{operatorLeaderId},</if>
             <if test="operatorLeader != null">operator_leader = #{operatorLeader},</if>
             <if test="designerLeaderId != null">designer_leader_id = #{designerLeaderId},</if>
             <if test="designerLeader != null">designer_leader = #{designerLeader},</if>
-            <if test="putType != null">put_type = #{putType},</if>
+            <if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
+            <if test="firstIndustry != null">first_industry = #{firstIndustry},</if>
+            <if test="secondaryIndustry != null">secondary_industry = #{secondaryIndustry},</if>
+            <if test="qualificationStatus != null">qualification_status = #{qualificationStatus},</if>
+            <if test="accountStatus != null">account_status = #{accountStatus},</if>
+            <if test="portName != null">port_name = #{portName},</if>
             <if test="createrId != null">creater_id = #{createrId},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>