Commit 899e35c6 authored by EDY's avatar EDY

优化

parent 13db88aa
......@@ -20,6 +20,9 @@ import com.ruoyi.system.domain.business.BaseContractInfo;
import com.ruoyi.system.domain.business.BaseContractPeriodsInfo;
import com.ruoyi.system.domain.business.BaseSubjectInfo;
import com.ruoyi.system.domain.business.vo.ContractCollectVo;
import com.ruoyi.system.domain.business.vo.RateOfReportVo;
import com.ruoyi.system.domain.business.vo.SignAmountReportVo;
import com.ruoyi.system.domain.business.vo.TotalReportVo;
import com.ruoyi.system.service.business.IBaseContractInfoService;
import com.ruoyi.system.service.business.IBaseSubjectInfoService;
......@@ -233,4 +236,22 @@ public class BaseContractInfoController extends BaseController {
return success(baseContractPeriodsInfos);
}
@GetMapping(value = "/total/report")
public AjaxResult totalReport(Integer periodType,Integer subjectId) {
TotalReportVo totalReportVo = baseContractInfoService.totalReport(periodType,subjectId);
return success(totalReportVo);
}
@GetMapping(value = "/signAmount/report")
public AjaxResult signAmountReport(Integer subjectId,Integer year,Long userId) {
List<SignAmountReportVo> signAmountReportVos = baseContractInfoService.signAmountReport(subjectId,year,userId);
return success(signAmountReportVos);
}
@GetMapping(value = "/rateOf/report")
public AjaxResult rateOfReport(Integer subjectId,Integer year,Long userId) {
List<RateOfReportVo> rateOfReport = baseContractInfoService.rateOfReport(subjectId,year,userId);
return success(rateOfReport);
}
}
......@@ -5,6 +5,9 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.business.BaseCustomInfo;
import com.ruoyi.system.domain.business.vo.CustomReportVo;
import com.ruoyi.system.domain.business.vo.ThreadReportVo;
import com.ruoyi.system.domain.business.vo.TotalReportVo;
import com.ruoyi.system.service.business.IBaseCustomInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -109,4 +112,16 @@ public class BaseCustomInfoController extends BaseController
{
return toAjax(baseCustomInfoService.deleteBaseCustomInfoByIds(ids));
}
@GetMapping(value = "/thread/report")
public AjaxResult threadReport(Integer periodType,String subjectName) {
List<ThreadReportVo> threadReportVoList = baseCustomInfoService.threadReport(periodType,subjectName);
return success(threadReportVoList);
}
@GetMapping(value = "/customReport")
public AjaxResult customReport(String subjectName) {
List<CustomReportVo> customReports = baseCustomInfoService.customReport(subjectName);
return success(customReports);
}
}
......@@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.business.BasePerformanceCompleteInfo;
import com.ruoyi.system.domain.business.vo.PerformanceCompleteVo;
import com.ruoyi.system.domain.business.vo.PerformanceReportVo;
import com.ruoyi.system.service.business.IBasePerformanceCompleteInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,7 +39,7 @@ public class BasePerformanceCompleteInfoController extends BaseController
/**
* 查询业绩目标列表
*/
@PreAuthorize("@ss.hasPermi('system:performance:list')")
// @PreAuthorize("@ss.hasPermi('system:performance:list')")
@GetMapping("/list")
public AjaxResult list(BasePerformanceCompleteInfo basePerformanceCompleteInfo)
{
......@@ -50,7 +51,7 @@ public class BasePerformanceCompleteInfoController extends BaseController
/**
* 导出业绩目标列表
*/
@PreAuthorize("@ss.hasPermi('system:performance:export')")
// @PreAuthorize("@ss.hasPermi('system:performance:export')")
@Log(title = "业绩目标", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasePerformanceCompleteInfo basePerformanceCompleteInfo)
......@@ -63,7 +64,7 @@ public class BasePerformanceCompleteInfoController extends BaseController
/**
* 获取业绩目标详细信息
*/
@PreAuthorize("@ss.hasPermi('system:performance:query')")
// @PreAuthorize("@ss.hasPermi('system:performance:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
......@@ -73,7 +74,7 @@ public class BasePerformanceCompleteInfoController extends BaseController
/**
* 新增业绩目标
*/
@PreAuthorize("@ss.hasPermi('system:performance:add')")
//@PreAuthorize("@ss.hasPermi('system:performance:add')")
@Log(title = "业绩目标", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasePerformanceCompleteInfo basePerformanceCompleteInfo)
......@@ -84,7 +85,7 @@ public class BasePerformanceCompleteInfoController extends BaseController
/**
* 修改业绩目标
*/
@PreAuthorize("@ss.hasPermi('system:performance:edit')")
// @PreAuthorize("@ss.hasPermi('system:performance:edit')")
@Log(title = "业绩目标", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PerformanceCompleteVo performanceCompleteVo)
......@@ -96,11 +97,18 @@ public class BasePerformanceCompleteInfoController extends BaseController
/**
* 删除业绩目标
*/
@PreAuthorize("@ss.hasPermi('system:performance:remove')")
//@PreAuthorize("@ss.hasPermi('system:performance:remove')")
@Log(title = "业绩目标", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(basePerformanceCompleteInfoService.deleteBasePerformanceCompleteInfoByIds(ids));
}
@GetMapping(value = "/report")
public AjaxResult performanceReport(Integer periodType)
{
List<PerformanceReportVo> performanceReportVos = basePerformanceCompleteInfoService.performanceReport(periodType);
return success(performanceReportVos);
}
}
......@@ -52,6 +52,9 @@ public class BaiduClueController {
if (ucName.contains("软盈")) {
baseCustomInfo.setKhly(4);
}
if (ucName.contains("软齐")) {
baseCustomInfo.setKhly(6);
}
baseCustomInfo.setSjh(json.getString("cluePhoneNumber"));
baseCustomInfo.setWx(json.getString("wechatAccount"));
......
......@@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://114.115.236.43:3306/ry-crm?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://116.204.99.209:3306/ry-crm?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: um!@#4567
password: VE9#b43G%hAc
# 从库数据源
slave:
# 从数据源开关/默认关闭
......
package com.ruoyi.system.domain.business.vo;
import lombok.Data;
@Data
public class CustomReportVo {
// 月份
private String month;
// 高意向
private Integer highCount;
// 无意向
private Integer noCount;
// 低意向
private Integer lowCount;
// 已签约
private Integer signCount;
}
package com.ruoyi.system.domain.business.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class PerformanceReportVo {
// 名称
private String userId;
// 名称
private String userName;
// 目标
private BigDecimal target;
// 已完成
private BigDecimal complete;
}
package com.ruoyi.system.domain.business.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class RateOfReportVo {
// 增长率
private BigDecimal rateOf;
// 月份 格式为月
private String monthM;
}
package com.ruoyi.system.domain.business.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class SignAmountReportVo {
// 签约金额
private BigDecimal signAmount;
// 回款金额
private BigDecimal returnAmount;
// 月份 格式为年月
private String monthYm;
// 月份 格式为月
private String monthM;
}
package com.ruoyi.system.domain.business.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ThreadReportVo {
// 客户来源
private Integer khly;
// 高意向
private Integer highCount;
// 无意向
private Integer noCount;
// 低意向
private Integer lowCount;
// 无效线索
private Integer invalidCount;
}
package com.ruoyi.system.domain.business.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class TotalReportVo {
// 合同总额
private BigDecimal contractAmount = BigDecimal.ZERO;
// 回款金额
private BigDecimal returnAmount = BigDecimal.ZERO;
// 尾款金额
private BigDecimal finalAmount = BigDecimal.ZERO;
}
......@@ -2,7 +2,11 @@ package com.ruoyi.system.mapper.business;
import com.ruoyi.system.domain.business.BaseContractInfo;
import com.ruoyi.system.domain.business.vo.ContractCollectVo;
import com.ruoyi.system.domain.business.vo.SignAmountReportVo;
import com.ruoyi.system.domain.business.vo.TotalReportVo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -64,4 +68,10 @@ public interface BaseContractInfoMapper
String selectMaxContractNo(String orderNoPrefix);
ContractCollectVo queryContractAmount(Long contractId);
TotalReportVo totalReport(@Param("periodType") Integer periodType, @Param("subjectId") Integer subjectId);
List<SignAmountReportVo> signAmountReport(@Param("subjectId") Integer subjectId,@Param("year") Integer year,@Param("userId") Long userId);
BigDecimal querySignMoney(@Param("periodType") Integer periodType, @Param("userId") String userId);
}
package com.ruoyi.system.mapper.business;
import com.ruoyi.system.domain.business.BaseCustomInfo;
import com.ruoyi.system.domain.business.vo.CustomReportVo;
import com.ruoyi.system.domain.business.vo.ThreadReportVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -59,4 +62,8 @@ public interface BaseCustomInfoMapper
* @return 结果
*/
public int deleteBaseCustomInfoByIds(Long[] ids);
List<ThreadReportVo> threadReport(@Param("periodType") Integer periodType, @Param("khly") Integer khly);
List<CustomReportVo> customReport(Integer khly);
}
package com.ruoyi.system.mapper.business;
import com.ruoyi.system.domain.business.BasePerformanceCompleteInfo;
import com.ruoyi.system.domain.business.vo.PerformanceReportVo;
import java.util.List;
......@@ -59,4 +60,6 @@ public interface BasePerformanceCompleteInfoMapper
* @return 结果
*/
public int deleteBasePerformanceCompleteInfoByIds(Long[] ids);
List<PerformanceReportVo> performanceReport(Integer periodType);
}
......@@ -5,6 +5,9 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.system.domain.business.BaseContractInfo;
import com.ruoyi.system.domain.business.BaseContractPeriodsInfo;
import com.ruoyi.system.domain.business.vo.ContractCollectVo;
import com.ruoyi.system.domain.business.vo.RateOfReportVo;
import com.ruoyi.system.domain.business.vo.SignAmountReportVo;
import com.ruoyi.system.domain.business.vo.TotalReportVo;
import java.util.List;
......@@ -71,4 +74,9 @@ public interface IBaseContractInfoService
List<BaseContractPeriodsInfo> getPeriodInfo(BaseContractInfo baseContractInfo);
TotalReportVo totalReport(Integer periodType,Integer subjectId);
List<SignAmountReportVo> signAmountReport(Integer subjectId, Integer year, Long userId);
List<RateOfReportVo> rateOfReport(Integer subjectId, Integer year, Long userId);
}
package com.ruoyi.system.service.business;
import com.ruoyi.system.domain.business.BaseCustomInfo;
import com.ruoyi.system.domain.business.vo.CustomReportVo;
import com.ruoyi.system.domain.business.vo.ThreadReportVo;
import java.util.List;
......@@ -59,4 +61,8 @@ public interface IBaseCustomInfoService
* @return 结果
*/
public int deleteBaseCustomInfoById(Long id);
List<ThreadReportVo> threadReport(Integer periodType, String subjectName);
List<CustomReportVo> customReport(String subjectName);
}
......@@ -2,6 +2,7 @@ package com.ruoyi.system.service.business;
import com.ruoyi.system.domain.business.BasePerformanceCompleteInfo;
import com.ruoyi.system.domain.business.vo.PerformanceCompleteVo;
import com.ruoyi.system.domain.business.vo.PerformanceReportVo;
import java.util.List;
......@@ -62,4 +63,6 @@ public interface IBasePerformanceCompleteInfoService
public int deleteBasePerformanceCompleteInfoById(Long id);
List<BasePerformanceCompleteInfo> selectBasePerformanceCompleteInfos(BasePerformanceCompleteInfo basePerformanceCompleteInfo);
List<PerformanceReportVo> performanceReport(Integer periodType);
}
......@@ -7,7 +7,6 @@ import java.util.Date;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
......@@ -19,6 +18,9 @@ import com.ruoyi.system.domain.business.BaseContractInfo;
import com.ruoyi.system.domain.business.BaseContractPeriodsInfo;
import com.ruoyi.system.domain.business.BaseInvoiceInfo;
import com.ruoyi.system.domain.business.vo.ContractCollectVo;
import com.ruoyi.system.domain.business.vo.RateOfReportVo;
import com.ruoyi.system.domain.business.vo.SignAmountReportVo;
import com.ruoyi.system.domain.business.vo.TotalReportVo;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.business.BaseContractAuditRecordMapper;
import com.ruoyi.system.mapper.business.BaseContractInfoMapper;
......@@ -247,4 +249,47 @@ public class BaseContractInfoServiceImpl implements IBaseContractInfoService {
}
return result;
}
@Override
public TotalReportVo totalReport(Integer periodType,Integer subjectId) {
return baseContractInfoMapper.totalReport(periodType,subjectId);
}
@Override
public List<SignAmountReportVo> signAmountReport(Integer subjectId, Integer year, Long userId) {
return baseContractInfoMapper.signAmountReport(subjectId,year,userId);
}
@Override
public List<RateOfReportVo> rateOfReport(Integer subjectId, Integer year, Long userId) {
List<RateOfReportVo> result = new ArrayList<RateOfReportVo>();
List<SignAmountReportVo> signAmountReportVos = baseContractInfoMapper.signAmountReport(subjectId, year, userId);
if (!signAmountReportVos.isEmpty()) {
for (int i = 0; i < 12; i++) {
if (i == 0) {
RateOfReportVo rateOfReport = new RateOfReportVo();
rateOfReport.setMonthM("1月");
rateOfReport.setRateOf(BigDecimal.ZERO);
result.add(rateOfReport);
} else {
RateOfReportVo rateOfReport = new RateOfReportVo();
rateOfReport.setMonthM(signAmountReportVos.get(i).getMonthM());
if (signAmountReportVos.get(i).getSignAmount().compareTo(signAmountReportVos.get(i -1).getSignAmount()) == 0) {
rateOfReport.setRateOf(BigDecimal.ZERO);
} else {
if (signAmountReportVos.get(i -1).getSignAmount().compareTo(BigDecimal.ZERO) == 0) {
rateOfReport.setRateOf(BigDecimal.valueOf(100));
} else {
BigDecimal rate = signAmountReportVos.get(i).getSignAmount().subtract(signAmountReportVos.get(i - 1).getSignAmount()).divide(signAmountReportVos.get(i - 1).getSignAmount(),BigDecimal.ROUND_UP).setScale(2);
rateOfReport.setRateOf(rate.multiply(BigDecimal.valueOf(100)));
}
}
result.add(rateOfReport);
}
}
}
return result;
}
}
......@@ -2,8 +2,11 @@ package com.ruoyi.system.service.business.impl;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.business.BaseCustomInfo;
import com.ruoyi.system.domain.business.vo.CustomReportVo;
import com.ruoyi.system.domain.business.vo.ThreadReportVo;
import com.ruoyi.system.mapper.business.BaseCustomInfoMapper;
import com.ruoyi.system.service.business.IBaseCustomInfoService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -93,4 +96,52 @@ public class BaseCustomInfoServiceImpl implements IBaseCustomInfoService {
public int deleteBaseCustomInfoById(Long id) {
return baseCustomInfoMapper.deleteBaseCustomInfoById(id);
}
@Override
public List<ThreadReportVo> threadReport(Integer periodType, String subjectName) {
Integer khly = null;
if (ObjectUtil.isNotEmpty(subjectName) ) {
if (subjectName.contains("软艺")) {
khly = 1;
}
if (subjectName.contains("软通")) {
khly = 2;
}
if (subjectName.contains("网联")) {
khly = 3;
}
if (subjectName.contains("软盈")) {
khly = 4;
}
if (subjectName.contains("软齐")) {
khly = 6;
}
}
return baseCustomInfoMapper.threadReport(periodType,khly);
}
@Override
public List<CustomReportVo> customReport(String subjectName) {
Integer khly = null;
if (ObjectUtil.isNotEmpty(subjectName) ) {
if (subjectName.contains("软艺")) {
khly = 1;
}
if (subjectName.contains("软通")) {
khly = 2;
}
if (subjectName.contains("网联")) {
khly = 3;
}
if (subjectName.contains("软盈")) {
khly = 4;
}
if (subjectName.contains("软齐")) {
khly = 6;
}
}
return baseCustomInfoMapper.customReport(khly);
}
}
......@@ -6,12 +6,15 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.business.BasePerformanceCompleteInfo;
import com.ruoyi.system.domain.business.vo.PerformanceCompleteVo;
import com.ruoyi.system.domain.business.vo.PerformanceReportVo;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.business.BaseContractInfoMapper;
import com.ruoyi.system.mapper.business.BasePerformanceCompleteInfoMapper;
import com.ruoyi.system.service.business.IBasePerformanceCompleteInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -32,6 +35,9 @@ public class BasePerformanceCompleteInfoServiceImpl implements IBasePerformanceC
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private BaseContractInfoMapper baseContractInfoMapper;
/**
* 查询业绩目标
*
......@@ -145,4 +151,16 @@ public class BasePerformanceCompleteInfoServiceImpl implements IBasePerformanceC
public List<BasePerformanceCompleteInfo> selectBasePerformanceCompleteInfos(BasePerformanceCompleteInfo basePerformanceCompleteInfo) {
return basePerformanceCompleteInfoMapper.selectBasePerformanceCompleteInfoList(basePerformanceCompleteInfo);
}
@Override
public List<PerformanceReportVo> performanceReport(Integer periodType) {
List<PerformanceReportVo> performanceReportVos = basePerformanceCompleteInfoMapper.performanceReport(periodType);
if (ObjectUtil.isNotEmpty(performanceReportVos)) {
for (PerformanceReportVo performanceReportVo : performanceReportVos) {
BigDecimal signMoney = baseContractInfoMapper.querySignMoney(periodType,performanceReportVo.getUserId());
performanceReportVo.setComplete(signMoney);
}
}
return performanceReportVos;
}
}
......@@ -23,7 +23,7 @@ import com.ruoyi.system.service.ISysDeptService;
/**
* 部门管理 服务实现
*
*
* @author ruoyi
*/
@Service
......@@ -37,7 +37,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
......@@ -50,7 +50,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门树结构信息
*
*
* @param dept 部门信息
* @return 部门树信息集合
*/
......@@ -63,7 +63,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
......@@ -90,7 +90,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
......@@ -103,7 +103,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
......@@ -116,7 +116,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
......@@ -128,7 +128,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据ID查询所有子部门(正常状态)
*
*
* @param deptId 部门ID
* @return 子部门数
*/
......@@ -140,7 +140,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
......@@ -153,7 +153,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
......@@ -166,7 +166,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -184,7 +184,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 校验部门是否有数据权限
*
*
* @param deptId 部门id
*/
@Override
......@@ -204,7 +204,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -223,7 +223,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
......@@ -251,7 +251,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改该部门的父级部门状态
*
*
* @param dept 当前部门
*/
private void updateParentDeptStatusNormal(SysDept dept)
......@@ -263,7 +263,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改子元素关系
*
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
......@@ -283,7 +283,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
......
......@@ -128,6 +128,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and id = #{contractId}
</if>
</select>
<select id="totalReport" resultType="com.ruoyi.system.domain.business.vo.TotalReportVo">
SELECT
-- 计算合同总额
IFNULL(SUM(htze), 0) AS contractAmount,
-- 计算已回款金额
IFNULL(SUM(hkje),0) AS returnAmount,
-- 计算尾款金额(合同总额-已回款金额)
IFNULL(SUM(htze) - SUM(hkje),0) AS finalAmount
FROM
base_contract_info
<where>
<if test="subjectId != null">
subject_id = #{subjectId}
</if>
<choose>
<when test="periodType == 1">and YEARWEEK(create_time, 1) = YEARWEEK(CURDATE(), 1)</when>
<when test="periodType == 2"> and YEAR(create_time) = YEAR(CURRENT_DATE) AND MONTH(create_time) = MONTH(CURRENT_DATE)</when>
<when test="periodType == 3"> and YEAR(create_time) = YEAR(CURRENT_DATE)</when>
</choose>
</where>
</select>
<select id="signAmountReport" resultType="com.ruoyi.system.domain.business.vo.SignAmountReportVo">
SELECT
DATE_FORMAT(m.month_start, '%Y-%m') AS monthYm,
CONCAT(MONTH(m.month_start), '月') AS monthM,
IFNULL(SUM(htze),0) signAmount,
IFNULL(SUM(hkje),0) returnAmount
FROM
months_series m
LEFT JOIN
base_contract_info t ON DATE_FORMAT(t.create_time, '%Y-%m') = DATE_FORMAT(m.month_start, '%Y-%m')
<if test="subjectId != null">
and t.subject_id = #{subjectId}
</if>
<if test="userId != null">
and t.ywy_id = #{userId}
</if>
WHERE
YEAR(m.month_start) = #{year}
GROUP BY
m.month_start
ORDER BY
m.month_start;
</select>
<select id="querySignMoney" resultType="java.math.BigDecimal">
SELECT
IFNULL(SUM( htze ),0) as signMoney
FROM
base_contract_info
where ywy_id = #{userId}
<choose>
<when test="periodType == 1">and MONTH(qysj) = MONTH(NOW()) </when>
<when test="periodType == 2"> and YEAR(qysj) = YEAR(now())</when>
</choose>
</select>
<insert id="insertBaseContractInfo" parameterType="BaseContractInfo" useGeneratedKeys="true" keyProperty="id">
insert into base_contract_info
......
......@@ -99,6 +99,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBaseCustomInfoVo"/>
where id = #{id}
</select>
<select id="threadReport" resultType="com.ruoyi.system.domain.business.vo.ThreadReportVo">
SELECT
temp.khly AS khly,
temp.highCount AS highCount,
temp.noCount AS noCount,
temp.lowCount AS lowCount,
temp.invalidCount AS invalidCount
FROM
(
SELECT
khly,
SUM( CASE WHEN yxdj = 3 THEN 1 ELSE 0 END ) AS highCount,
SUM( CASE WHEN yxdj = 1 THEN 1 ELSE 0 END ) AS noCount,
SUM( CASE WHEN yxdj = 2 THEN 1 ELSE 0 END ) AS lowCount,
SUM( CASE WHEN khzt = 7 THEN 1 ELSE 0 END ) AS invalidCount
FROM
base_custom_info
WHERE 1= 1
<if test="khly != null">
and khly = #{khly}
</if>
<choose>
<when test="periodType == 1">and DATE(create_time) = CURDATE()</when>
<when test="periodType == 2">and YEARWEEK(create_time, 1) = YEARWEEK(CURDATE(), 1)</when>
<when test="periodType == 3"> and YEAR(create_time) = YEAR(CURRENT_DATE) AND MONTH(create_time) = MONTH(CURRENT_DATE)</when>
<when test="periodType == 4"> and YEAR(create_time) = YEAR(CURRENT_DATE)</when>
</choose>
GROUP BY
khly
) temp
</select>
<select id="customReport" resultType="com.ruoyi.system.domain.business.vo.CustomReportVo">
SELECT
DATE_FORMAT( create_time, '%Y-%m' ) AS MONTH,
SUM( CASE WHEN khzt = 6 THEN 1 ELSE 0 END ) AS signCount,
SUM( CASE WHEN yxdj = 3 THEN 1 ELSE 0 END ) AS highCount,
SUM( CASE WHEN yxdj = 2 THEN 1 ELSE 0 END ) AS lowCount,
SUM( CASE WHEN yxdj = 1 THEN 1 ELSE 0 END ) AS noCount
FROM
base_custom_info
<where>
<if test="khly != null">
and khly = #{khly}
</if>
</where>
GROUP BY
DATE_FORMAT(
create_time,
'%Y-%m')
ORDER BY
month;
</select>
<insert id="insertBaseCustomInfo" parameterType="BaseCustomInfo" useGeneratedKeys="true" keyProperty="id">
insert into base_custom_info
......
......@@ -42,6 +42,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBasePerformanceCompleteInfoVo"/>
where id = #{id}
</select>
<select id="performanceReport" resultType="com.ruoyi.system.domain.business.vo.PerformanceReportVo">
SELECT
user_id AS userId,
user_name AS userName,
SUM( target ) AS target
FROM
base_performance_complete_info
<where>
<choose>
<when test="periodType == 1">and month = MONTH(NOW()) </when>
<when test="periodType == 2"> and year = YEAR(now())</when>
</choose>
</where>
GROUP BY
user_name
</select>
<insert id="insertBasePerformanceCompleteInfo" parameterType="BasePerformanceCompleteInfo" useGeneratedKeys="true" keyProperty="id">
insert into base_performance_complete_info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment