hcst_sunzhen 5 gadi atpakaļ
vecāks
revīzija
e29d22d2c0
13 mainītis faili ar 627 papildinājumiem un 10 dzēšanām
  1. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  2. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java
  3. 96 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  4. 243 0
      performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/controller/AccountVideoQuarterInfoController.java
  5. 113 0
      performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/entity/AccountVideoQuarterInfo.java
  6. 17 0
      performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/mapper/AccountVideoQuarterInfoMapper.java
  7. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/mapper/xml/AccountVideoQuarterInfoMapper.xml
  8. 14 0
      performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/service/IAccountVideoQuarterInfoService.java
  9. 19 0
      performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/service/impl/AccountVideoQuarterInfoServiceImpl.java
  10. 33 1
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/impl/PerformanceOptimizerServiceImpl.java
  11. 4 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/VideoDTO.java
  12. 4 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  13. 58 9
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -758,4 +758,23 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "绩效-获取快手、头条下各账户下视频的季度消耗")
+    @ApiOperation(value = "绩效-获取快手、头条下各账户下视频的季度消耗", notes = "绩效-获取快手、头条下各账户下视频的季度消耗")
+    @PostMapping(value = "/getQuarterVideoInfoByAccountId")
+    public Result getQuarterVideoInfoByAccountId(@RequestBody PerformanceTimeDTO dto,
+                                                          HttpServletRequest req) {
+        Result result = new Result<>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        if(year==null || quarter == null  ){
+            result.setSuccess(false);
+            result.setMessage("媒体类型均不能为空");
+        }
+        performanceService.getQuarterVideoInfoByAccountId(year, quarter);
+        result.setSuccess(true);
+        return result;
+    }
+
+
+
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java

@@ -136,4 +136,6 @@ public interface IPerformanceService2 extends IService<Performance> {
     List<VideoDTO> getUserQuarterVideo(Integer year, Integer quarter, String userId);
 
     List<VideoDTO> getUserQuarterEffiVideo(Integer year, Integer quarter, String userId);
+
+    void getQuarterVideoInfoByAccountId(Integer year, Integer quarter);
 }

+ 96 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.system.service.impl;
 
+import cn.com.ctop.accountvideoquarterinfo.entity.AccountVideoQuarterInfo;
+import cn.com.ctop.accountvideoquarterinfo.mapper.AccountVideoQuarterInfoMapper;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.performanceaccount.entity.PerformanceAccount;
 import cn.com.ctop.performanceappraisal.entity.Performance;
@@ -49,6 +51,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     private PlaneProjectCostMapper planeProjectCostMapper;
     @Autowired
     private UserVideoMapMapper userVideoMapMapper;
+    @Autowired
+    private AccountVideoQuarterInfoMapper accountVideoQuarterInfoMapper;
 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //有效视频计算开始
@@ -2652,6 +2656,98 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userEfficientVideoMapMapper.getToutiaoQuarterVideoInfoByAccountId(startDate, endDate, accountId);
     }
 
+    //获取快手、头条下各账户下视频的季度消耗
+    public void getQuarterVideoInfoByAccountId(Integer year, Integer quarter){
+        Map<String,String> dateMap = DateUtils.quarterStartEndDate(year, quarter);
+        String startDate = dateMap.get("startDate");
+        String endDate = dateMap.get("endDate");
+
+        getToutiaoQuarterVideoInfoByAccountId2(startDate, endDate);
+        getKuaishouQuarterVideoInfoByAccountId2(startDate, endDate);
+    }
+
+    //TODO 根据accountId获取季度视频信息
+    public void getKuaishouQuarterVideoInfoByAccountId2(String startDate, String endDate){
+        Integer appType = 2;
+        List<AccountDTO> accountList = userEfficientVideoMapMapper.getAccountInfoByAppType(appType);
+        for (AccountDTO accountDTO:accountList){
+            List<VideoDTO> videoDTOList= userEfficientVideoMapMapper.getKuaishouQuarterVideoInfoByAccountId(startDate, endDate, Long.parseLong(accountDTO.getAccountId()));
+
+            for(VideoDTO video:videoDTOList){
+                AccountVideoQuarterInfo info = new AccountVideoQuarterInfo();
+                info.setAccountId(Long.parseLong(accountDTO.getAccountId()));
+                info.setProjectId(accountDTO.getProjectId());
+                info.setProjectName(accountDTO.getProjectName());
+                info.setSignature(video.getSignature());
+                info.setPlanId(video.getPlanId());
+                info.setPlanName(video.getPlan());
+                info.setClipId(video.getClipId());
+                info.setClipName(video.getClip());
+                info.setShotId(video.getShotId());
+                info.setShotName(video.getShot());
+                info.setPlaneId(video.getPlaneId());
+                info.setPlaneName(video.getPlane());
+                info.setVideoCost(video.getCharge());
+                info.setAppType(appType);
+                info.setYear(2020);
+                info.setQuarter(1);
+                if(video.getClipId() != null){
+                    SysUser user = userEfficientVideoMapMapper.getDesignLeaderInfoByDesignUserId(video.getClipId());
+                    info.setDesignResponsibleId(user==null?null:user.getId());
+                    info.setDesignResponsibleName(user==null?null:user.getRealname());
+                }else{
+                    SysUser user = userEfficientVideoMapMapper.getDesignLeaderInfoByDesignUserId(video.getPlaneId());
+                    info.setDesignResponsibleId(user==null?null:user.getId());
+                    info.setDesignResponsibleName(user==null?null:user.getRealname());
+                }
+                accountVideoQuarterInfoMapper.insert(info);
+            }
+
+        }
+
+
+    }
+
+    //TODO 根据accountId获取季度视频信息
+    public void getToutiaoQuarterVideoInfoByAccountId2(String startDate, String endDate){
+        Integer appType = 1;
+        List<AccountDTO> accountList = userEfficientVideoMapMapper.getAccountInfoByAppType(appType);
+        for (AccountDTO accountDTO:accountList){
+            List<VideoDTO> videoDTOList= userEfficientVideoMapMapper.getToutiaoQuarterVideoInfoByAccountId(startDate, endDate, Long.parseLong(accountDTO.getAccountId()));
+
+            for(VideoDTO video:videoDTOList){
+                AccountVideoQuarterInfo info = new AccountVideoQuarterInfo();
+                info.setAccountId(Long.parseLong(accountDTO.getAccountId()));
+                info.setProjectId(accountDTO.getProjectId());
+                info.setProjectName(accountDTO.getProjectName());
+                info.setSignature(video.getSignature());
+                info.setPlanId(video.getPlanId());
+                info.setPlanName(video.getPlan());
+                info.setClipId(video.getClipId());
+                info.setClipName(video.getClip());
+                info.setShotId(video.getShotId());
+                info.setShotName(video.getShot());
+                info.setPlaneId(video.getPlaneId());
+                info.setPlaneName(video.getPlane());
+                info.setVideoCost(video.getCharge());
+                info.setAppType(appType);
+                info.setYear(2020);
+                info.setQuarter(1);
+                if(video.getClipId() != null){
+                    SysUser user = userEfficientVideoMapMapper.getDesignLeaderInfoByDesignUserId(video.getClipId());
+                    info.setDesignResponsibleId(user==null?null:user.getId());
+                    info.setDesignResponsibleName(user==null?null:user.getRealname());
+                }else{
+                    SysUser user = userEfficientVideoMapMapper.getDesignLeaderInfoByDesignUserId(video.getPlaneId());
+                    info.setDesignResponsibleId(user==null?null:user.getId());
+                    info.setDesignResponsibleName(user==null?null:user.getRealname());
+                }
+                accountVideoQuarterInfoMapper.insert(info);
+            }
+
+        }
+    }
+
     public List<VideoDTO> getUserQuarterVideo(Integer year, Integer quarter, String userId){
         return userEfficientVideoMapMapper.getUserQuarterVideo(userId, year, quarter);
     }

+ 243 - 0
performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/controller/AccountVideoQuarterInfoController.java

@@ -0,0 +1,243 @@
+package cn.com.ctop.accountvideoquarterinfo.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import cn.com.ctop.accountvideoquarterinfo.entity.AccountVideoQuarterInfo;
+import cn.com.ctop.accountvideoquarterinfo.service.IAccountVideoQuarterInfoService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 绩效明细_账户下所有视频的季度消耗数据
+ * @author jeecg-boot
+ * @date   2020-04-13
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="绩效明细_账户下所有视频的季度消耗数据")
+@RestController
+@RequestMapping("/accountvideoquarterinfo/accountVideoQuarterInfo")
+public class AccountVideoQuarterInfoController {
+	@Autowired
+	private IAccountVideoQuarterInfoService accountVideoQuarterInfoService;
+	
+	/**
+	  * 分页列表查询
+	 * @param accountVideoQuarterInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "绩效明细_账户下所有视频的季度消耗数据-分页列表查询")
+	@ApiOperation(value="绩效明细_账户下所有视频的季度消耗数据-分页列表查询", notes="绩效明细_账户下所有视频的季度消耗数据-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<AccountVideoQuarterInfo>> queryPageList(AccountVideoQuarterInfo accountVideoQuarterInfo,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<AccountVideoQuarterInfo>> result = new Result<IPage<AccountVideoQuarterInfo>>();
+		QueryWrapper<AccountVideoQuarterInfo> queryWrapper = QueryGenerator.initQueryWrapper(accountVideoQuarterInfo, req.getParameterMap());
+		Page<AccountVideoQuarterInfo> page = new Page<AccountVideoQuarterInfo>(pageNo, pageSize);
+		IPage<AccountVideoQuarterInfo> pageList = accountVideoQuarterInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param accountVideoQuarterInfo
+	 * @return
+	 */
+	@AutoLog(value = "绩效明细_账户下所有视频的季度消耗数据-添加")
+	@ApiOperation(value="绩效明细_账户下所有视频的季度消耗数据-添加", notes="绩效明细_账户下所有视频的季度消耗数据-添加")
+	@PostMapping(value = "/add")
+	public Result<AccountVideoQuarterInfo> add(@RequestBody AccountVideoQuarterInfo accountVideoQuarterInfo) {
+		Result<AccountVideoQuarterInfo> result = new Result<AccountVideoQuarterInfo>();
+		try {
+			accountVideoQuarterInfoService.save(accountVideoQuarterInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param accountVideoQuarterInfo
+	 * @return
+	 */
+	@AutoLog(value = "绩效明细_账户下所有视频的季度消耗数据-编辑")
+	@ApiOperation(value="绩效明细_账户下所有视频的季度消耗数据-编辑", notes="绩效明细_账户下所有视频的季度消耗数据-编辑")
+	@PutMapping(value = "/edit")
+	public Result<AccountVideoQuarterInfo> edit(@RequestBody AccountVideoQuarterInfo accountVideoQuarterInfo) {
+		Result<AccountVideoQuarterInfo> result = new Result<AccountVideoQuarterInfo>();
+		AccountVideoQuarterInfo accountVideoQuarterInfoEntity = accountVideoQuarterInfoService.getById(accountVideoQuarterInfo.getId());
+		if(accountVideoQuarterInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = accountVideoQuarterInfoService.updateById(accountVideoQuarterInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "绩效明细_账户下所有视频的季度消耗数据-通过id删除")
+	@ApiOperation(value="绩效明细_账户下所有视频的季度消耗数据-通过id删除", notes="绩效明细_账户下所有视频的季度消耗数据-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			accountVideoQuarterInfoService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "绩效明细_账户下所有视频的季度消耗数据-批量删除")
+	@ApiOperation(value="绩效明细_账户下所有视频的季度消耗数据-批量删除", notes="绩效明细_账户下所有视频的季度消耗数据-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<AccountVideoQuarterInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<AccountVideoQuarterInfo> result = new Result<AccountVideoQuarterInfo>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.accountVideoQuarterInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "绩效明细_账户下所有视频的季度消耗数据-通过id查询")
+	@ApiOperation(value="绩效明细_账户下所有视频的季度消耗数据-通过id查询", notes="绩效明细_账户下所有视频的季度消耗数据-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<AccountVideoQuarterInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<AccountVideoQuarterInfo> result = new Result<AccountVideoQuarterInfo>();
+		AccountVideoQuarterInfo accountVideoQuarterInfo = accountVideoQuarterInfoService.getById(id);
+		if(accountVideoQuarterInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(accountVideoQuarterInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<AccountVideoQuarterInfo> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              AccountVideoQuarterInfo accountVideoQuarterInfo = JSON.parseObject(deString, AccountVideoQuarterInfo.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(accountVideoQuarterInfo, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<AccountVideoQuarterInfo> pageList = accountVideoQuarterInfoService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "绩效明细_账户下所有视频的季度消耗数据列表");
+      mv.addObject(NormalExcelConstants.CLASS, AccountVideoQuarterInfo.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("绩效明细_账户下所有视频的季度消耗数据列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<AccountVideoQuarterInfo> listAccountVideoQuarterInfos = ExcelImportUtil.importExcel(file.getInputStream(), AccountVideoQuarterInfo.class, params);
+              accountVideoQuarterInfoService.saveBatch(listAccountVideoQuarterInfos);
+              return Result.ok("文件导入成功!数据行数:" + listAccountVideoQuarterInfos.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 113 - 0
performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/entity/AccountVideoQuarterInfo.java

@@ -0,0 +1,113 @@
+package cn.com.ctop.accountvideoquarterinfo.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+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;
+
+/**
+ * 绩效明细_账户下所有视频的季度消耗数据
+ * @author jeecg-boot
+ * @date   2020-04-13
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_performance_account_video_quarter_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_performance_account_video_quarter_info对象", description="绩效明细_账户下所有视频的季度消耗数据")
+public class AccountVideoQuarterInfo {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**accountId*/
+	@Excel(name = "accountId", width = 15)
+    @ApiModelProperty(value = "accountId")
+	private Long accountId;
+	/**projectId*/
+	@Excel(name = "projectId", width = 15)
+    @ApiModelProperty(value = "projectId")
+	private Long projectId;
+	/**projectName*/
+	@Excel(name = "projectName", width = 15)
+    @ApiModelProperty(value = "projectName")
+	private String projectName;
+	/**signature*/
+	@Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+	private String signature;
+	/**designResponsibleName*/
+	@Excel(name = "designResponsibleName", width = 15)
+    @ApiModelProperty(value = "designResponsibleName")
+	private String designResponsibleName;
+	/**designResponsibleId*/
+	@Excel(name = "designResponsibleId", width = 15)
+    @ApiModelProperty(value = "designResponsibleId")
+	private String designResponsibleId;
+	/**planId*/
+	@Excel(name = "planId", width = 15)
+    @ApiModelProperty(value = "planId")
+	private String planId;
+	/**planName*/
+	@Excel(name = "planName", width = 15)
+    @ApiModelProperty(value = "planName")
+	private String planName;
+	/**clipId*/
+	@Excel(name = "clipId", width = 15)
+    @ApiModelProperty(value = "clipId")
+	private String clipId;
+	/**clipName*/
+	@Excel(name = "clipName", width = 15)
+    @ApiModelProperty(value = "clipName")
+	private String clipName;
+	/**shotId*/
+	@Excel(name = "shotId", width = 15)
+    @ApiModelProperty(value = "shotId")
+	private String shotId;
+	/**shotName*/
+	@Excel(name = "shotName", width = 15)
+    @ApiModelProperty(value = "shotName")
+	private String shotName;
+	/**planeId*/
+	@Excel(name = "planeId", width = 15)
+    @ApiModelProperty(value = "planeId")
+	private String planeId;
+	/**planeName*/
+	@Excel(name = "planeName", width = 15)
+    @ApiModelProperty(value = "planeName")
+	private String planeName;
+	/**videoCost*/
+	@Excel(name = "videoCost", width = 15)
+    @ApiModelProperty(value = "videoCost")
+	private java.math.BigDecimal videoCost;
+	/**appType*/
+	@Excel(name = "appType", width = 15)
+    @ApiModelProperty(value = "appType")
+	private Integer appType;
+	/**year*/
+	@Excel(name = "year", width = 15)
+    @ApiModelProperty(value = "year")
+	private Integer year;
+	/**quarter*/
+	@Excel(name = "quarter", width = 15)
+    @ApiModelProperty(value = "quarter")
+	private Integer quarter;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 17 - 0
performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/mapper/AccountVideoQuarterInfoMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.accountvideoquarterinfo.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.accountvideoquarterinfo.entity.AccountVideoQuarterInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 绩效明细_账户下所有视频的季度消耗数据
+ * @author: jeecg-boot
+ * @date:   2020-04-13
+ * @cersion: V1.0
+ */
+public interface AccountVideoQuarterInfoMapper extends BaseMapper<AccountVideoQuarterInfo> {
+
+}

+ 5 - 0
performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/mapper/xml/AccountVideoQuarterInfoMapper.xml

@@ -0,0 +1,5 @@
+<?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="cn.com.ctop.accountvideoquarterinfo.mapper.AccountVideoQuarterInfoMapper">
+
+</mapper>

+ 14 - 0
performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/service/IAccountVideoQuarterInfoService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.accountvideoquarterinfo.service;
+
+import cn.com.ctop.accountvideoquarterinfo.entity.AccountVideoQuarterInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 绩效明细_账户下所有视频的季度消耗数据
+ * @author jeecg-boot
+ * @date   2020-04-13
+ * @version V1.0
+ */
+public interface IAccountVideoQuarterInfoService extends IService<AccountVideoQuarterInfo> {
+
+}

+ 19 - 0
performance-appraisal/src/main/java/cn/com/ctop/accountvideoquarterinfo/service/impl/AccountVideoQuarterInfoServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.accountvideoquarterinfo.service.impl;
+
+import cn.com.ctop.accountvideoquarterinfo.entity.AccountVideoQuarterInfo;
+import cn.com.ctop.accountvideoquarterinfo.mapper.AccountVideoQuarterInfoMapper;
+import cn.com.ctop.accountvideoquarterinfo.service.IAccountVideoQuarterInfoService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 绩效明细_账户下所有视频的季度消耗数据
+ * @author jeecg-boot
+ * @date   2020-04-13
+ * @version V1.0
+ */
+@Service
+public class AccountVideoQuarterInfoServiceImpl extends ServiceImpl<AccountVideoQuarterInfoMapper, AccountVideoQuarterInfo> implements IAccountVideoQuarterInfoService {
+
+}

+ 33 - 1
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/impl/PerformanceOptimizerServiceImpl.java

@@ -467,6 +467,10 @@ public class PerformanceOptimizerServiceImpl extends ServiceImpl<PerformanceOpti
             List<UserDto2> userList = userEfficientVideoMapMapper.getYunyingLeaderMember(userDto2.getDepId());
 
             for (UserDto2 user:userList){
+                //增加判断:如果项目成员中包含自己的话,不将自己的消耗计算在内
+                if(user.getUserId().equals(userDto2.getUserId())){
+                    continue;
+                }
                 BigDecimal userRoality = userEfficientVideoMapMapper.getYunyingRoyalty(user.getUserId(), year, quarter);
                 if (userRoality == null){
                     userRoality= BigDecimal.ZERO;
@@ -487,8 +491,36 @@ public class PerformanceOptimizerServiceImpl extends ServiceImpl<PerformanceOpti
     }
 
     //TODO 头条运营leader绩效计算
-    public void toutiaoYunyingLeaderQuarterPerformance(){
+    public void toutiaoYunyingLeaderQuarterPerformance(Integer year, Integer quarter){
+        Integer mediaType = 1;
+        //获取快手组下所有运营组长信息列表
+        List<UserDto2> yunyingLeaderList = userEfficientVideoMapMapper.getToutiaoYunyingLeaderUserInfo();
+        for(UserDto2 userDto2:yunyingLeaderList){
+            BigDecimal royalty = BigDecimal.ZERO;
+            List<UserDto2> userList = userEfficientVideoMapMapper.getYunyingLeaderMember(userDto2.getDepId());
 
+            for (UserDto2 user:userList){
+                //增加判断:如果项目成员中包含自己的话,不将自己的消耗计算在内
+                if(user.getUserId().equals(userDto2.getUserId())){
+                    continue;
+                }
+                BigDecimal userRoality = userEfficientVideoMapMapper.getYunyingRoyalty(user.getUserId(), year, quarter);
+                if (userRoality == null){
+                    userRoality= BigDecimal.ZERO;
+                }
+                royalty =  royalty.add(userRoality);
+            }
+            //运营leader绩效数据入库
+            PerformanceOptimizer performanceOptimizer = new PerformanceOptimizer();
+            performanceOptimizer.setAppType(mediaType);
+            performanceOptimizer.setQuarter(quarter + "");
+            performanceOptimizer.setYear(year + "");
+            performanceOptimizer.setRealname(userDto2.getRealname());
+            performanceOptimizer.setTotalCost(royalty);
+            performanceOptimizer.setTotalRoyalty( royalty.multiply(new BigDecimal("0.2")) );
+            performanceOptimizer.setUserId(userDto2.getUserId());
+            performanceOptimizerMapper.insert(performanceOptimizer);
+        }
 
     }
 

+ 4 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/VideoDTO.java

@@ -14,9 +14,13 @@ public class VideoDTO implements Serializable {
     private BigDecimal charge;
     private String creativeUrl;
     private String shot;
+    private String shotId;
     private String plan;
+    private String planId;
     private String plane;
+    private String planeId;
     private String clip;
+    private String clipId;
     private Integer appType;
     private String weekStart;
     private String weekEnd;

+ 4 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -238,6 +238,8 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
 
     List<VideoDTO> getToutiaoQuarterVideoInfoByAccountId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("accountId")Long accountId);
 
+    SysUser getDesignLeaderInfoByDesignUserId(@Param("userId")String userId);
+
     List<VideoDTO> getUserQuarterVideo(@Param("userId")String userId, @Param("year")Integer year, @Param("quarter")Integer quarter);
 
     List<VideoDTO> getUserQuarterEffiVideo(@Param("userId")String userId, @Param("year")Integer year, @Param("quarter")Integer quarter);
@@ -251,5 +253,7 @@ public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVid
     BigDecimal getToutiaoQuarterTotalCostByCode(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("signature")String signature);
 
     BigDecimal getToutiaoQuarterTotalCostByRoleCode(@Param("year")Integer year, @Param("quarter")Integer quarter,@Param("startDate")String startDate, @Param("endDate")String endDate,@Param("roleCode")String roleCode,@Param("userId")String userId);
+
+    List<AccountDTO> getAccountInfoByAppType(@Param("appType")Integer appType);
 }
 

+ 58 - 9
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -988,7 +988,8 @@
         left join sys_user_role ur on u.id = ur.user_id
         left join sys_role r on ur.role_id = r.id
         WHERE b.parent_id = '024b0dc0840045afb048022a8c61253f'  <!-- 快手运营部 -->
-        and r.role_code = 'operator'
+        and (r.role_code in ('operator','kuaishouOperationManager','operationAssistant')
+				or realname = '郭浩')
     </select>
 
     <!-- 获取北京快手运营部所有人的信息 -->
@@ -1008,6 +1009,19 @@
 
     <!-- 获取北京头条运营部所有优化师得信息 -->
     <select id="getToutiaoYunyingDepartUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
+       <!-- select u.id as userId,
+        u.realname as realname,
+        r.role_name as roleName,
+        r.role_code as roleCode,
+        r.id as roleId
+        FROM sys_user_depart ud
+        left join sys_depart b on ud.dep_id = b.id
+        left join sys_user u on ud.user_id = u.id
+        left join sys_user_role ur on u.id = ur.user_id
+        left join sys_role r on ur.role_id = r.id
+        WHERE b.parent_id = 'c869de6bedc44a50803e45a4611df05e'
+        and r.role_code = 'operator' -->
+
         select u.id as userId,
         u.realname as realname,
         r.role_name as roleName,
@@ -1019,7 +1033,7 @@
         left join sys_user_role ur on u.id = ur.user_id
         left join sys_role r on ur.role_id = r.id
         WHERE b.parent_id = 'c869de6bedc44a50803e45a4611df05e'  <!-- 头条运营部 -->
-        and r.role_code = 'operator'
+        and r.role_code in ('operator','kuaishouOperationManager','operationAssistant')
     </select>
 
     <!-- 获取北京头条运营部所有优化师得信息 -->
@@ -1487,7 +1501,7 @@
         and r.role_code = 'kuaishouOperationManager'
     </select>
 
-    <!-- 获取北京头条运营部所有优化师得信息 -->
+    <!-- 获取北京头条运营部所有运营经理的信息 -->
     <select id="getToutiaoYunyingLeaderUserInfo" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
         select u.id as userId,
         u.realname as realname,
@@ -1663,9 +1677,13 @@
             (select url from ctop_kuaishou_video_get where signature = a.signature limit 1) as url,
             b.url as creativeUrl,
             d1.realname as shot,
-            d2.realname as plan,
-            d3.realname as plane,
-            d4.realname as clip
+        d1.id as shotId,
+        d2.realname as plan,
+        d2.id as planId,
+        d3.realname as plane,
+        d3.id as planeid,
+        d4.realname as clip,
+        d4.id as clipId
         from
         (
         select signature, sum(charge) as charge from ctop_kuaishou_report_daily_creative where creative_id in  (
@@ -1673,12 +1691,13 @@
         )
         and stat_date &gt;= #{startDate} and stat_date &lt;= #{endDate} <!-- and signature is not null --> group by signature
         ) a
-        left join ctop_material_info b on a.signature = b.code
+        left join (select id,url,code from ctop_material_info group by code) b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on d1.id = c.shot_id
         left join sys_user d2 on d2.id = c.plan_id
         left join sys_user d3 on d3.id = c.plane_id
         left join sys_user d4 on d4.id = c.clip_id
+        where b.url is not null <!-- TODO delete -->
     </select>
 
     <!-- 头条根据账户获取其下视频制作信息以及消耗 -->
@@ -1689,9 +1708,13 @@
         (select video_url from  ctop_bytedance_video_info where signature = a.signature limit 1) as creativeUrl,
         b.url,
         d1.realname as shot,
+        d1.id as shotId,
         d2.realname as plan,
+        d2.id as planId,
         d3.realname as plane,
-        d4.realname as clip
+        d3.id as planeid,
+        d4.realname as clip,
+        d4.id as clipId
         from
         (
             select creative_id,signature, sum(cost) as charge from ctop_bytedance_report_creative_daily where creative_id in  (
@@ -1701,12 +1724,25 @@
             and date_format(stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
             <!--and  signature is not null --> group by signature
         ) a
-        left join ctop_material_info b on a.signature = b.code
+        left join (select id,url,code from ctop_material_info group by code) b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on d1.id = c.shot_id
         left join sys_user d2 on d2.id = c.plan_id
         left join sys_user d3 on d3.id = c.plane_id
         left join sys_user d4 on d4.id = c.clip_id
+        where b.url is not null <!-- TODO delete -->
+    </select>
+
+    <!-- 根据设计师组员姓名获取组长姓名 -->
+    <select id="getDesignLeaderInfoByDesignUserId" resultType="cn.com.ctop.userefficientvideomap.entity.SysUser">
+            select
+            a.id,
+            a.realname
+        from sys_user a
+        left join sys_user_depart b on a.id = b.user_id
+        left join sys_user_role c on a.id = c.user_id
+        where b.dep_id = (select dep_id from sys_user_depart where user_id = #{userId})
+        and c.role_id = '8d3e2ed58bdedf17716f698ea674da27' <!-- 设计组长roleid -->
     </select>
 
     <select id="getUserQuarterVideo" resultType="cn.com.ctop.userefficientvideomap.entity.VideoDTO">
@@ -1757,4 +1793,17 @@
         group by signature
     </select>
 
+    <select id="getAccountInfoByAppType" resultType="cn.com.ctop.userefficientvideomap.entity.AccountDTO">
+            select
+            account_id as accountId,
+            auth_name as authName,
+            project_id as projectId,
+            project_name as projectName
+        from
+        ctop_user_allocation
+        where
+        media_id = #{appType}
+        order by project_id
+    </select>
+
 </mapper>