Bläddra i källkod

财务结算 init

yangzian 4 år sedan
förälder
incheckning
f47a949859

+ 18 - 0
jeecg-boot-finance/pom.xml

@@ -38,6 +38,24 @@
             <artifactId>jeecg-system-local-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-web</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-annotation</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.15</version>
+        </dependency>
+
+
 
     </dependencies>
 

+ 90 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/SettlementController.java

@@ -0,0 +1,90 @@
+package org.jeecg.ctop.finance.settlement.controller;
+
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.ctop.finance.settlement.entity.pojo.SettlementInfoPojo;
+import org.jeecg.ctop.finance.settlement.entity.vo.BytedanceAccountImportVo;
+
+
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Administrator
+ * 2021/7/28
+ **/
+
+@Slf4j
+@RestController
+@RequestMapping("/finance/settLementController")
+public class SettlementController {
+
+    @Autowired
+    private ISettlementInfoService settlementInfoService;
+
+
+
+    @ApiOperation(value="test", notes="test")
+    @GetMapping(value = "/test")
+    public Result test(
+                                                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                                   HttpServletRequest req) {
+        PageHelper.startPage(pageNo,pageSize);
+        List<SettlementInfoPojo> list = settlementInfoService.getList();
+        PageInfo<SettlementInfoPojo> pageInfo = new PageInfo<SettlementInfoPojo>(list);
+        return Result.successMsg("chenggong.",pageInfo);
+    }
+
+
+
+
+
+
+
+
+
+
+    @PostMapping("/import")
+    public Result getProjects(@RequestParam("files") MultipartFile[] files) {
+
+        try {
+            ImportParams importParams = new ImportParams();
+            //表格标题行数
+            importParams.setTitleRows(1);
+            //表头行数
+            importParams.setHeadRows(1);
+            //表头
+            importParams.setImportFields(new String[]{"账户ID", "账户名称"});
+
+            for (MultipartFile file : files) {
+                ExcelImportResult<BytedanceAccountImportVo> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(),BytedanceAccountImportVo.class,importParams);
+                if (excelImportResult.getList().size() < 1){
+                    return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入。");
+                }
+                log.info("{}",excelImportResult.getList());
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            return Result.error("账户数据上传失败,请使用正确的模板导入!");
+        }
+        return Result.successMsg("账户数据上传成功。",null);
+    }
+
+
+}

+ 90 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/pojo/SettlementInfoPojo.java

@@ -0,0 +1,90 @@
+package org.jeecg.ctop.finance.settlement.entity.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 财务结算 账户信息
+ * zian Y
+ * 2021/7/28
+ **/
+
+@Data
+public class SettlementInfoPojo implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    /**
+     * 主键id
+     */
+    private Long id;
+
+    /**
+     * 广告主公司id
+     */
+    private String advertiserId;
+
+    /**
+     * 产品id
+     */
+    private String productId;
+
+    /**
+     * 项目id
+     */
+    private String projectId;
+
+    /**
+     * 媒体类型 1-头条 2-快手 3-头条内广 4-快手内广
+     */
+    private Integer mediaId;
+
+    /**
+     * 运营方式 1-自运营 2-代运营
+     */
+    private Integer operateType;
+
+    /**
+     * 账户id
+     */
+    private String accountId;
+
+    /**
+     * 账户名称
+     */
+    private String accountName;
+
+    /**
+     * 快手id
+     */
+    private String kuaiShouId;
+
+    /**
+     * 账户状态 0-开 1-关
+     */
+    private Integer status;
+
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    private Integer delFlag;
+
+    /**
+     * 创建人id
+     */
+    private String createUserId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+}

+ 25 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/BytedanceAccountImportVo.java

@@ -0,0 +1,25 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 头条账户 上传 数据 excel
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class BytedanceAccountImportVo implements Serializable {
+
+    @Excel(name = "账户ID")
+    private String accountId;
+
+    @Excel(name = "账户名称")
+    private String accountName;
+
+
+}

+ 25 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/KuaiShouAccountImportVo.java

@@ -0,0 +1,25 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 快手账户 上传 数据 excel
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class KuaiShouAccountImportVo implements Serializable {
+
+    @Excel(name = "快手ID")
+    private String ksId;
+
+    @Excel(name = "快手账户ID")
+    private String ksAccountId;
+
+    @Excel(name = "账户名称")
+    private String accountName;
+}

+ 21 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/SettlementInfoMapper.java

@@ -0,0 +1,21 @@
+package org.jeecg.ctop.finance.settlement.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.settlement.entity.pojo.SettlementInfoPojo;
+
+import java.util.List;
+
+
+/**
+ *
+ * @description:
+ *
+ * @return:
+ * @author: zianY
+ * @time: 2021/7/28 17:07
+ */
+public interface SettlementInfoMapper extends BaseMapper<SettlementInfoPojo> {
+
+    List<SettlementInfoPojo> getList();
+
+}

+ 13 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/SettlementInfoMapper.xml

@@ -0,0 +1,13 @@
+<?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="org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper">
+
+    <select id="getList" resultType="org.jeecg.ctop.finance.settlement.entity.pojo.SettlementInfoPojo">
+
+select * from ctop_cwjs_settlement_info
+
+
+    </select>
+
+
+</mapper>

+ 12 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/ISettlementInfoService.java

@@ -0,0 +1,12 @@
+package org.jeecg.ctop.finance.settlement.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.settlement.entity.pojo.SettlementInfoPojo;
+
+import java.util.List;
+
+public interface ISettlementInfoService extends IService<SettlementInfoPojo> {
+
+    List<SettlementInfoPojo> getList();
+
+}

+ 24 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementInfoServiceImpl.java

@@ -0,0 +1,24 @@
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.ctop.finance.settlement.entity.pojo.SettlementInfoPojo;
+import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+@Service
+public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper, SettlementInfoPojo> implements ISettlementInfoService {
+
+    @Resource
+    private SettlementInfoMapper settlementInfoMapper;
+
+
+    @Override
+    public List<SettlementInfoPojo> getList() {
+        return settlementInfoMapper.getList();
+    }
+}