15 Commits

Author SHA1 Message Date
king
a2efb5ad5f 添加提示 2026-05-12 09:14:25 +08:00
shih
90bdd2b8e5 故障保修 保养管理修改相关 2026-05-11 19:09:29 +08:00
shih
3cd1dfdbca 登录后前端获取登陆人信息加入手机号码字段 2026-05-09 17:54:39 +08:00
king
82cb7ef34d Merge branch 'dev_js_20260420' 2026-05-09 17:48:12 +08:00
king
f5b61d1b4b 日志文件名调整 2026-05-09 16:16:36 +08:00
king
c745ed3117 Merge branch 'dev_js_20260420' 2026-05-09 16:16:01 +08:00
king
58410dd824 重点客户收入与占比情况 添加插件 2026-05-08 17:50:31 +08:00
king
c257abe9a4 Merge branch 'dev_js_20260420' 2026-05-08 11:02:49 +08:00
king
ffdcfd605e 主要产品前10销售收入与占比 添加默认时间跨度 2026-05-08 11:00:20 +08:00
king
9e72adf9d1 综合销售情况表,标准品名、客户名称、业务员、区域添加排序 2026-05-08 10:51:40 +08:00
king
35c66d27af 主要产品前10销售收入与占比 调整,新增插件 2026-05-07 17:10:23 +08:00
shih
3db326d34c 保养双重验收成功后再生成记录 2026-05-06 13:30:33 +08:00
king
4596642603 增加含税金额字段,修改销售日报中计算字段为含税字段
修改同步数据,增加同步含税字段
修改同步逻辑.优化同步时间
2026-04-28 15:57:48 +08:00
king
fbb6b4f976 Merge branch 'master' into dev_js_20260420 2026-04-28 11:36:24 +08:00
king
b14b28fbee 综合销售汇总, 数据排序调整 2026-04-28 11:30:48 +08:00
20 changed files with 843 additions and 199 deletions

View File

@@ -14,11 +14,11 @@
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/lideeyunji-info.log</file>
<file>${log.path}/gr_report-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/lideeyunji-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>${log.path}/gr_report-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
@@ -36,11 +36,11 @@
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/lideeyunji-error.log</file>
<file>${log.path}/gr_report-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/lideeyunji-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>${log.path}/gr_report-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>

View File

@@ -156,64 +156,64 @@ public class ByglBygdBjPlugin implements AroundAdvicePlugin {
byManagementGdMapper.updateById(gd);
String planId = gd.getPlanId();
//查询当前计划的工单
LambdaQueryWrapper<ByManagementGd> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ByManagementGd::getPlanId, planId);
wrapper.eq(ByManagementGd::getOrderState, ByglConstant.BY_STATE_YWC);
List<ByManagementGd> byManagementGds = byManagementGdMapper.selectList(wrapper);
if(planId !=null){
//查询当前计划的工单
LambdaQueryWrapper<ByManagementGd> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ByManagementGd::getPlanId, planId);
wrapper.eq(ByManagementGd::getOrderState, ByglConstant.BY_STATE_YWC);
List<ByManagementGd> byManagementGds = byManagementGdMapper.selectList(wrapper);
//当前计划
ByManagementPlan plan = byManagementPlanMapper.selectById(planId);
//当前计划
ByManagementPlan plan = byManagementPlanMapper.selectById(planId);
//保养周期
String interval = plan.getScheduledInterval();
if("1".equals(interval)) {//周期为180天
//如果有两条已完成的工单,则将计划状态修改为已完成
if(byManagementGds.size() >= 2) {
plan.setPlanState(ByglConstant.JH_STATE_YWC);
byManagementPlanMapper.updateById(plan);
}else{
String planUpkeepTime = gd.getPlanUpkeepTime();
// 解析完成时间只有日期部分需要转换为LocalDateTime
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate completeLocalDate = LocalDate.parse(planUpkeepTime, formatter);
LocalDateTime completeDate = completeLocalDate.atStartOfDay();
// 往后推180天
LocalDateTime nextMaintenanceDate = adjustToNextMonthFirstDayIfNeeded(completeDate.plusDays(180));
// 判断是否超过本年
int completeYear = completeDate.getYear();
int nextMaintenanceYear = nextMaintenanceDate.getYear();
boolean isCrossYear = nextMaintenanceYear > completeYear;
if(isCrossYear){
//保养周期
String interval = plan.getScheduledInterval();
if("1".equals(interval)) {//周期为180天
//如果有两条已完成的工单,则将计划状态修改为已完成
if(byManagementGds.size() >= 2) {
plan.setPlanState(ByglConstant.JH_STATE_YWC);
byManagementPlanMapper.updateById(plan);
}else{
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nextMaintenanceDateStr = nextMaintenanceDate.format(dateFormatter);
plan.setNextUpkeepTime(nextMaintenanceDateStr);
byManagementPlanMapper.updateById(plan);
String planUpkeepTime = gd.getPlanUpkeepTime();
// 解析完成时间只有日期部分需要转换为LocalDateTime
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate completeLocalDate = LocalDate.parse(planUpkeepTime, formatter);
LocalDateTime completeDate = completeLocalDate.atStartOfDay();
// 往后推180天
LocalDateTime nextMaintenanceDate = adjustToNextMonthFirstDayIfNeeded(completeDate.plusDays(180));
// 判断是否超过本年
int completeYear = completeDate.getYear();
int nextMaintenanceYear = nextMaintenanceDate.getYear();
boolean isCrossYear = nextMaintenanceYear > completeYear;
if(isCrossYear){
plan.setPlanState(ByglConstant.JH_STATE_YWC);
byManagementPlanMapper.updateById(plan);
}else{
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nextMaintenanceDateStr = nextMaintenanceDate.format(dateFormatter);
plan.setNextUpkeepTime(nextMaintenanceDateStr);
byManagementPlanMapper.updateById(plan);
}
}
}else if("2".equals(interval)) {//周期为360天
plan.setPlanState(ByglConstant.JH_STATE_YWC);
byManagementPlanMapper.updateById(plan);
}
}else if("2".equals(interval)) {//周期为360天
plan.setPlanState(ByglConstant.JH_STATE_YWC);
byManagementPlanMapper.updateById(plan);
}
}
//都验收成功 生成记录
ByManagementJl jl = BeanUtils.toBean(ys, ByManagementJl.class);
jl.setId(null);
if(jl == null){
throw new RuntimeException("对象转换失败");
}
byManagementJlMapper.insert(jl);
}
byManagementYsMapper.updateById(ys);
ByManagementJl jl = BeanUtils.toBean(ys, ByManagementJl.class);
jl.setId(null);
if(jl == null){
throw new RuntimeException("对象转换失败");
}
byManagementJlMapper.insert(jl);
log.info("工单验收成功ID: {}", id);
}

View File

@@ -60,6 +60,17 @@ public class ZhxsqkPlugin implements ReportAroundAdvicePlugin {
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
if(!groupFieldList.contains("useMonth") && !groupFieldList.contains("useYear")){
setMonthOrderBy(params, page);
if(!params.containsKey("column")){
page.setUnsafeOrderBy(params.get("Group by").toString()
.replace("useYear", "use_year desc")
.replace("useMonth", "use_month desc")
.replace("stdGoodsName", "std_goods_name")
.replace("customName", "custom_name")
.replace("zoneName", "zone_name")
.replace("salerName", "saler_name")
.replace("dosageName", "dosage_name")
.replace("saleTypeName", "sale_type_name"));
}
if(params.get("useYearStart").toString() .equals(params.get("useYearEnd").toString())){
params.put("isOneYear", true);
}else{
@@ -72,6 +83,17 @@ public class ZhxsqkPlugin implements ReportAroundAdvicePlugin {
}
if(groupFieldList.contains("useMonth") || params.containsKey("useMonth")){
setMonthOrderBy(params, page);
if(!params.containsKey("column")){
page.setUnsafeOrderBy(params.get("Group by").toString()
.replace("useYear", "use_year desc")
.replace("useMonth", "use_month desc")
.replace("stdGoodsName", "std_goods_name")
.replace("customName", "custom_name")
.replace("zoneName", "zone_name")
.replace("salerName", "saler_name")
.replace("dosageName", "dosage_name")
.replace("saleTypeName", "sale_type_name"));
}
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.selectNewGrBiSaAggGroupMonthList(params, groupFieldList);
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
@@ -109,16 +131,17 @@ public class ZhxsqkPlugin implements ReportAroundAdvicePlugin {
if ("thisYearSaMoneyGrowth".equals(params.get("column"))) {
orderBy = "CAST(TRIM(REGEXP_SUBSTR(this_year_sa_money_growth, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
}
if("stdGoodsName".equals(params.get("column"))){
orderBy = "std_goods_name " + params.get("order").toString();
}
if("customName".equals(params.get("column"))){
orderBy = "custom_name " + params.get("order").toString();
}
if("salerName".equals(params.get("column"))){
orderBy = "saler_name " + params.get("order").toString();
}
page.setUnsafeOrderBy(orderBy);
commonOrder(params, page, orderBy);
}else{
page.setUnsafeOrderBy(params.get("Group by").toString()
.replace("useYear", "use_year desc")
.replace("useMonth", "use_month desc")
.replace("stdGoodsName", "std_goods_name")
.replace("customName", "custom_name")
.replace("zoneName", "zone_name")
.replace("salerName", "saler_name")
.replace("dosageName", "dosage_name")
.replace("saleTypeName", "sale_type_name"));
}
List<NewGrBiSaAggYearCount> newGrBiSaAggList = newGrBiSaAggYearCountService.selectNewGrBiSaAggGroupYearList(params, groupFieldList);
PageInfo<NewGrBiSaAggYearCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
@@ -169,16 +192,45 @@ public class ZhxsqkPlugin implements ReportAroundAdvicePlugin {
if ("lastMonthSaMoney_yoy".equals(params.get("column"))) {
orderBy = "CAST(TRIM(REGEXP_SUBSTR(lastMonthSaMoney_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
}
if("stdGoodsName".equals(params.get("column"))){
orderBy = "std_goods_name " + params.get("order").toString();
}
if("customName".equals(params.get("column"))){
orderBy = "custom_name " + params.get("order").toString();
}
if("salerName".equals(params.get("column"))){
orderBy = "saler_name " + params.get("order").toString();
}
page.setUnsafeOrderBy(orderBy);
commonOrder(params, page, orderBy);
}
}
private static void commonOrder(Map<String, Object> params, Page<Object> page, String orderBy) {
if("stdGoodsName".equals(params.get("column"))){
orderBy = "std_goods_name " + params.get("order").toString();
}
if("customName".equals(params.get("column"))){
orderBy = "custom_name " + params.get("order").toString();
}
if("salerName".equals(params.get("column"))){
orderBy = "saler_name " + params.get("order").toString();
}
if("useYear".equals(params.get("column"))){
orderBy = "use_year " + params.get("order").toString();
}
if("useMonth".equals(params.get("column"))){
orderBy = "use_month " + params.get("order").toString();
}
if("stdGoodsName".equals(params.get("column"))){
orderBy = "std_goods_name " + params.get("order").toString();
}
if("customName".equals(params.get("column"))){
orderBy = "custom_name " + params.get("order").toString();
}
if("zoneName".equals(params.get("column"))){
orderBy = "zone_name " + params.get("order").toString();
}
if("salerName".equals(params.get("column"))){
orderBy = "saler_name " + params.get("order").toString();
}
if("dosageName".equals(params.get("column"))){
orderBy = "dosage_name " + params.get("order").toString();
}
if("saleTypeName".equals(params.get("column"))){
orderBy = "sale_type_name " + params.get("order").toString();
}
page.setUnsafeOrderBy(orderBy);
}
}

View File

@@ -0,0 +1,73 @@
package com.lideeyunji.core.framework.enhance.example.report.xtsy;
import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lideeyunji.core.framework.config.aspect.enhancereport.model.EnhanceReportContext;
import com.lideeyunji.core.framework.config.aspect.enhancereport.plugin.ReportAroundAdvicePlugin;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
import com.lideeyunji.tool.framework.exception.lideeYunJiException;
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 报表-主要产品前10销售收入与占比-插件
*/
@Slf4j
@Component("stgoodTop10Plugin")
public class stgoodTop10Plugin implements ReportAroundAdvicePlugin {
@Resource
INewGrBiSaAggMonthCountService newGrBiSaAggMonthCountService;
@Override
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
log.info("进入=======>stgoodTop10Plugin=======>execute");
Map<String, Object> params = enhanceContext.getParam().getParams();
// 获取一个月前的时间和年月
LocalDateTime lastNow = LocalDateTime.now().minusMonths(1);
int lastYear = lastNow.getYear();
int lastMonth = lastNow.getMonthValue();
if(!params.containsKey("useYearStart")){
params.put("useYearStart", lastYear);
params.put("useMonthStart", "1");
}
if(!params.containsKey("useYearEnd")){
params.put("useYearEnd", lastYear);
params.put("useMonthEnd", lastMonth);
}
if(!params.get("useYearStart").toString().equals(params.get("useYearEnd").toString())){
throw new lideeYunJiException("不能跨年查询!");
}
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
if (params.containsKey("column")) {
String orderBy = params.get("column") + " " + params.get("order");
// if ("thisYearSaQty".equals(params.get("column"))) {
// orderBy = "this_year_sa_qty " + params.get("order").toString();
// }
// if ("saqty_yoy".equals(params.get("column"))) {
// orderBy = "CAST(TRIM(REGEXP_SUBSTR(saqty_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
// }
// if ("thisYearSaMoney".equals(params.get("column"))) {
// orderBy = "this_year_sa_money " + params.get("order").toString();
// }
page.setUnsafeOrderBy(orderBy);
}
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.stgoodTop10(params);
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
return ResultDataModel.fomat(pageInfo.getTotal(), list);
}
}

View File

@@ -0,0 +1,70 @@
package com.lideeyunji.core.framework.enhance.example.report.xtsy;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lideeyunji.core.framework.config.aspect.enhancereport.model.EnhanceReportContext;
import com.lideeyunji.core.framework.config.aspect.enhancereport.plugin.ReportAroundAdvicePlugin;
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
import com.lideeyunji.tool.framework.exception.lideeYunJiException;
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 报表-重点客户收入与占比情况-插件
*/
@Slf4j
@Component("zdCustomerPlugin")
public class zdCustomerPlugin implements ReportAroundAdvicePlugin {
@Resource
INewGrBiSaAggMonthCountService newGrBiSaAggMonthCountService;
@Override
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
log.info("进入=======>zdCustomerPlugin=======>execute");
Map<String, Object> params = enhanceContext.getParam().getParams();
// 获取一个月前的时间和年月
LocalDateTime lastNow = LocalDateTime.now().minusMonths(1);
int lastYear = lastNow.getYear();
int lastMonth = lastNow.getMonthValue();
if(!params.containsKey("useYearStart")){
params.put("useYearStart", lastYear);
params.put("useMonthStart", "1");
}
if(!params.containsKey("useYearEnd")){
params.put("useYearEnd", lastYear);
params.put("useMonthEnd", lastMonth);
}
if(!params.get("useYearStart").toString().equals(params.get("useYearEnd").toString())){
throw new lideeYunJiException("不能跨年查询!");
}
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
// if (params.containsKey("column")) {
// String orderBy = params.get("column") + " " + params.get("order");
//// if ("thisYearSaQty".equals(params.get("column"))) {
//// orderBy = "this_year_sa_qty " + params.get("order").toString();
//// }
//// if ("saqty_yoy".equals(params.get("column"))) {
//// orderBy = "CAST(TRIM(REGEXP_SUBSTR(saqty_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
//// }
//// if ("thisYearSaMoney".equals(params.get("column"))) {
//// orderBy = "this_year_sa_money " + params.get("order").toString();
//// }
// page.setUnsafeOrderBy(orderBy);
// }
List<Map<String, Object>> newGrBiSaAggList = newGrBiSaAggMonthCountService.zdCustomer(params);
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(newGrBiSaAggList);
// List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
return ResultDataModel.fomat(pageInfo.getTotal(), newGrBiSaAggList);
}
}

View File

@@ -103,6 +103,9 @@ public class NewGrBiSaAgg implements Serializable
@TableField(value = "this_month_sa_money")
private String thisMonthSaMoney;
@TableField(value = "this_month_sa_money_tx")
private String thisMonthSaMoneyTx;
@TableField(value = "this_month_cost")
private String thisMonthCost;

View File

@@ -85,6 +85,9 @@ public class NewGrBiSaAggMonthCount implements Serializable
@TableField(value = "std_goods_name")
private String stdGoodsName;
@TableField(value = "goods_id")
private String goodsId;
@TableField(value = "province_id")
private String provinceId;
@@ -190,4 +193,13 @@ public class NewGrBiSaAggMonthCount implements Serializable
@TableField(value = "monthprofit_yoy")
private String monthprofit_yoy;
@TableField(value = "yoy_money_sub")
private String yoyMoneySub;
@TableField(value = "money")
private String money;
@TableField(value = "money_share")
private String moneyShare;
}

View File

@@ -111,4 +111,7 @@ public interface NewGrBiSaAggMapper extends BaseMapper<NewGrBiSaAgg>
* @return 结果
*/
public int deleteNewGrBiSaAggByIds(Long[] ids);
int insertSalesReport(@Param("pastYearMonth") Integer pastYearMonth,@Param("currentYearMonth") Integer currentYearMonth);
}

View File

@@ -1,16 +1,15 @@
package com.lideeyunji.core.framework.mapper;
import java.util.List;
import java.util.Map;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.params.SaAggParam;
import com.lideeyunji.tool.framework.permission.core.annotation.DataPermission;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 综合销售情况月维度Mapper接口
*
@@ -100,4 +99,24 @@ public interface NewGrBiSaAggMonthCountMapper extends BaseMapper<NewGrBiSaAggMon
@DS(value = "#dataSourceType")
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggGroupNoMonthNoYearList(@Param("dataSourceType") String dataSourceType, @Param("saAggParam") SaAggParam saAggParam, @Param("params") Map<String, Object> params, @Param("groupFieldList")List<String> groupFieldList);
/**
* 主要产品前10销售收入与占比 -月度
*
* @param params 综合销售情况明细参数
* @return 综合销售情况明细集合
*/
@DataPermission(enable = false)
@DS(value = "#dataSourceType")
public List<NewGrBiSaAggMonthCount> stgoodTop10(@Param("dataSourceType") String dataSourceType, @Param("params") Map<String, Object> params);
/**
* 重点客户收入与占比情况 -月度
*
* @param params 综合销售情况明细参数
* @return 综合销售情况明细集合
*/
@DataPermission(enable = false)
@DS(value = "#dataSourceType")
public List<Map<String, Object>> zdCustomer(@Param("dataSourceType") String dataSourceType, @Param("params") Map<String, Object> params);
}

View File

@@ -1,12 +1,11 @@
package com.lideeyunji.core.framework.service;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.params.SaAggParam;
import java.util.List;
import java.util.Map;
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.params.SaAggParam;
/**
* 综合销售情况月维度Service接口
*
@@ -72,4 +71,7 @@ public interface INewGrBiSaAggMonthCountService
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggGroupNoMonthNoYearList(Map<String, Object> params, List<String> groupFieldList);
List<NewGrBiSaAggMonthCount> stgoodTop10(Map<String, Object> params);
List<Map<String, Object>> zdCustomer(Map<String, Object> params);
}

View File

@@ -1,17 +1,15 @@
package com.lideeyunji.core.framework.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.mapper.NewGrBiSaAggMonthCountMapper;
import com.lideeyunji.core.framework.params.SaAggParam;
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import org.springframework.stereotype.Service;
import com.lideeyunji.core.framework.mapper.NewGrBiSaAggMonthCountMapper;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
import java.util.List;
import java.util.Map;
/**
* 综合销售情况月维度Service业务层处理
@@ -116,4 +114,13 @@ public class NewGrBiSaAggMonthCountServiceImpl extends ServiceImpl<NewGrBiSaAggM
SaAggParam saAggParam = NewGrBiSaAggServiceImpl.createParam(params);
return this.baseMapper.selectNewGrBiSaAggGroupNoMonthNoYearList(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam,params, groupFieldList);
}
@Override
public List<NewGrBiSaAggMonthCount> stgoodTop10(Map<String, Object> params) {
return this.baseMapper.stgoodTop10(lideeYunJiBaseConstant.DS_ERP_BI_DATA, params);
}
@Override
public List<Map<String, Object>> zdCustomer(Map<String, Object> params) {
return this.baseMapper.zdCustomer(lideeYunJiBaseConstant.DS_ERP_BI_DATA, params);
}
}

View File

@@ -99,32 +99,35 @@ public class NewGrBiSaAggServiceImpl extends ServiceImpl<NewGrBiSaAggMapper, New
int reNum = this.baseMapper.deleteSalesReport(pastYear * 100 + pastMonth, currentYear * 100 + currentMonth);
log.info("删除数量:{}", reNum);
int result = 0;
for (NewGrBiSaAgg grBiSaSetdtl : grBiSaSetdtlList) {
if(StrUtil.isBlank(grBiSaSetdtl.getStdGoodsName())){
grBiSaSetdtl.setStdGoodsName("其他");
}
if(StrUtil.isBlank(grBiSaSetdtl.getCustomName())){
grBiSaSetdtl.setCustomName("-");
}
if(StrUtil.isBlank(grBiSaSetdtl.getSalerName())){
grBiSaSetdtl.setSalerName("-");
}
if(StrUtil.isBlank(grBiSaSetdtl.getZoneName())){
grBiSaSetdtl.setZoneName("-");
}
if(StrUtil.isBlank(grBiSaSetdtl.getDosageName())){
grBiSaSetdtl.setDosageName("-");
}
if(StrUtil.isBlank(grBiSaSetdtl.getSaleTypeName())){
grBiSaSetdtl.setSaleTypeName("-");
}
int re = this.baseMapper.insert(grBiSaSetdtl);
if (re < 1) {
throw new RuntimeException("批量新增异常");
}
result += re;
}
reNum = this.baseMapper.insertSalesReport(pastYear * 100 + pastMonth, currentYear * 100 + currentMonth);
log.info("保存数量:{}", reNum);
// int result = 0;
// for (NewGrBiSaAgg grBiSaSetdtl : grBiSaSetdtlList) {
// if(StrUtil.isBlank(grBiSaSetdtl.getStdGoodsName())){
// grBiSaSetdtl.setStdGoodsName("其他");
// }
// if(StrUtil.isBlank(grBiSaSetdtl.getCustomName())){
// grBiSaSetdtl.setCustomName("-");
// }
// if(StrUtil.isBlank(grBiSaSetdtl.getSalerName())){
// grBiSaSetdtl.setSalerName("-");
// }
// if(StrUtil.isBlank(grBiSaSetdtl.getZoneName())){
// grBiSaSetdtl.setZoneName("-");
// }
// if(StrUtil.isBlank(grBiSaSetdtl.getDosageName())){
// grBiSaSetdtl.setDosageName("-");
// }
// if(StrUtil.isBlank(grBiSaSetdtl.getSaleTypeName())){
// grBiSaSetdtl.setSaleTypeName("-");
// }
// int re = this.baseMapper.insert(grBiSaSetdtl);
// if (re < 1) {
// throw new RuntimeException("批量新增异常");
// }
// result += re;
// }
reNum = this.baseMapper.deleteSalesReportMonth(pastYear * 100 + pastMonth, currentYear * 100 + currentMonth);
log.info("批量新增数量-month{}", reNum);

View File

@@ -154,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saler.SALERNAME AS saler_name,
sum(SAQTY) AS this_month_sa_qty,
round(sum(SAMONEY), 2) AS this_month_sa_money, -- 除税销售额
round(sum(SAMONEYTX), 2) AS this_month_sa_money_tx, -- 含税销售额
round(sum(COST), 2) AS this_month_cost,
round(sum(PROFIT), 2) AS this_month_profit
-- sum(SAQTY) as 本月销量,
@@ -195,7 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom.CUSTOMNAME,
saler.SALERID,
saler.SALERNAME
order by a.USEYEAR, a.USEMONTH
order by a.USEYEAR, a.USEMONTH limit 100
</select>
<delete id="deleteSalesReport">
@@ -232,6 +233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saler_name,
this_month_sa_qty,
this_month_sa_money,
this_month_sa_money_tx,
this_month_cost,
this_month_profit
) SELECT
@@ -254,6 +256,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saler_name,
SUM(this_month_sa_qty) AS this_month_sa_qty, -- 本月销量
SUM(this_month_sa_money) AS this_month_sa_money, -- 本月销售金额
SUM(this_month_sa_money_tx) AS this_month_sa_money_tx, -- 本月销售金额(含税)
SUM(this_month_cost) AS this_month_cost, -- 本月销售成本
SUM(this_month_profit) AS this_month_profit -- 本月毛利额
FROM
@@ -300,6 +303,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saler_name,
this_year_sa_qty,
this_year_sa_money,
this_year_sa_money_tx,
this_year_profit,
this_year_cost
) SELECT
@@ -321,6 +325,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
saler_name,
SUM(this_month_sa_qty) AS this_year_sa_qty, -- 本年销量
SUM(this_month_sa_money) AS this_year_sa_money, -- 本年销售金额
SUM(this_month_sa_money_tx) AS this_year_sa_money_tx, -- 本月销售金额(含税)
SUM(this_month_cost) AS this_year_cost, -- 本年销售成本
SUM(this_month_profit) AS this_year_profit -- 本年毛利额
FROM
@@ -909,6 +914,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="thisMonthProfit != null">#{thisMonthProfit},</if>
</trim>
</insert>
<insert id="insertSalesReport">
insert into new_gr_bi_sa_agg(use_year,use_month,goods_id,goods_name,effect_id,effect_name,std_goods_name,zone_id,zone_name,province_id,province_name,sale_type_id
,sale_type_name,dosage_id,dosage_name,custom_id,custom_name,saler_id,saler_name,this_month_sa_qty,this_month_sa_money,this_month_sa_money_tx,this_month_cost,this_month_profit)
SELECT
a.USEYEAR AS use_year,
a.USEMONTH AS use_month,
goods.GOODSID AS goods_id,
ifnull(goods.GOODSNAME,'-') AS goods_name,
a.EFFECTID AS effect_id,
ifnull(a.EFFECTNAME,'-') AS effect_name,
ifnull(goods.STDGOODSNAME,'其他') AS std_goods_name,
sales.SALEZONEID AS zone_id,
ifnull(sales.SALEZONENAME,'-') AS zone_name,
province.PROVINCEID AS province_id,
ifnull(province.PROVINCENAME,'-') AS province_name,
salestype.SALETYPEID AS sale_type_id,
ifnull(salestype.SALETYPENAME,'-') AS sale_type_name,
dosage.DOSAGEID AS dosage_id,
ifnull(dosage.DOSAGENAME,'-') AS dosage_name,
custom.CUSTOMID AS custom_id,
ifnull(custom.CUSTOMNAME,'-') AS custom_name,
saler.SALERID AS saler_id,
ifnull(saler.SALERNAME,'-') AS saler_name,
sum(SAQTY) AS this_month_sa_qty,
round(sum(SAMONEY), 2) AS this_month_sa_money, -- 除税销售额
round(sum(SAMONEYTX), 2) AS this_month_sa_money_tx, -- 含税销售额
round(sum(COST), 2) AS this_month_cost,
round(sum(PROFIT), 2) AS this_month_profit
FROM
GR_BI_SA_SETDTL AS a
LEFT JOIN erp_bi_data.GR_BI_PUB_GOODS AS goods ON a.goodsid = goods.goodsid
LEFT JOIN erp_bi_data.GR_BI_PUB_SALEZONE AS sales ON a.SALEZONEID = sales.SALEZONEID
LEFT JOIN erp_bi_data.GR_BI_PUB_PROVINCE AS province ON a.PROVINCEID = province.PROVINCEID
LEFT JOIN erp_bi_data.GR_BI_PUB_SALETYPE AS salestype ON salestype.SALETYPEID = a.SALETYPE
LEFT JOIN erp_bi_data.GR_BI_PUB_DOSAGE AS dosage ON dosage.DOSAGEID = a.DOSAGEID
LEFT JOIN erp_bi_data.GR_BI_PUB_CUSTOM AS custom ON custom.CUSTOMID = a.CUSTOMID
LEFT JOIN erp_bi_data.GR_BI_PUB_SALER AS saler ON saler.SALERID = a.SALERID
<where>
USESTATUS = 2
AND a.USEYEAR IS NOT NULL
and (a.USEYEAR * 100 + a.USEMONTH) BETWEEN #{pastYearMonth} AND #{currentYearMonth}
</where>
GROUP BY
a.USEYEAR,
a.USEMONTH,
goods.GOODSID,
goods.GOODSNAME,
a.EFFECTID,
a.EFFECTNAME,
goods.STDGOODSNAME,
sales.SALEZONEID,
sales.SALEZONENAME,
province.PROVINCEID,
province.PROVINCENAME,
salestype.SALETYPEID,
salestype.SALETYPENAME,
dosage.DOSAGEID,
dosage.DOSAGENAME,
custom.CUSTOMID,
custom.CUSTOMNAME,
saler.SALERID,
saler.SALERNAME
order by a.USEYEAR, a.USEMONTH
</insert>
<update id="updateNewGrBiSaAgg" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAgg">
update new_gr_bi_sa_agg

View File

@@ -1161,38 +1161,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectNewGrBiSaAggGroupHZList" resultType="java.util.Map">
SELECT
'自营品种' as bk,
IF(GROUPING (saler_name, zone_name) = 2, CONCAT(zone_name, "总计"), IFNULL(zone_name, '省区合计')) AS zone_name,
c.position,
saler_name,
-- GROUPING (saler_name, zone_name, c.position),
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money) / 10000, 2) AS year_sa_money
FROM
new_gr_bi_sa_agg_month_count a
LEFT JOIN gr_report.gr_contacts c ON a.saler_name = c.`name`
AND a.zone_name = c.zone
WHERE
use_year = YEAR(CURDATE())
AND sale_type_name = '自营品种'
GROUP BY
zone_name,
saler_name,
c.position WITH ROLLUP
select t.* from (
SELECT
'自营品种' as bk,
IF(GROUPING (saler_name, zone_name) = 2, CONCAT(zone_name, "总计"), IFNULL(zone_name, '省区合计')) AS zone_name,
c.position,
saler_name,
-- GROUPING (saler_name, zone_name, c.position),
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money_tx) / 10000, 2) AS year_sa_money
FROM
new_gr_bi_sa_agg_month_count a
LEFT JOIN gr_report.gr_contacts c ON a.saler_name = c.`name`
AND a.zone_name = c.zone
WHERE
use_year = YEAR(CURDATE())
AND sale_type_name = '自营品种'
GROUP BY
zone_name,
saler_name,
c.position WITH ROLLUP
HAVING GROUPING (saler_name, zone_name, c.position) != 1
HAVING GROUPING (saler_name, zone_name, c.position) != 1 ORDER BY a.zone_name DESC, zone_name ASC, c.position IS NULL , c.position DESC
) t
UNION ALL
SELECT
@@ -1208,19 +1210,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) proxy_name,
'',
ROUND(SUM(IF(use_month = MONTH(CURDATE()), this_month_sa_qty, null)), 2) AS this_month_sa_qty,
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money) / 10000, 2) AS year_sa_money
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money_tx) / 10000, 2) AS year_sa_money
FROM
new_gr_bi_sa_agg a
LEFT JOIN gr_report.gr_googs_proxy p ON a.goods_id = p.goods_id
@@ -1243,19 +1245,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IF(GROUPING (sale_type_name) = 1, IFNULL(sale_type_name, '业务拓展合计'),sale_type_name) sale_type_name,
'' ,
'',
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money) / 10000, 2) AS year_sa_money
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money_tx) / 10000, 2) AS year_sa_money
FROM
new_gr_bi_sa_agg_month_count a
WHERE
@@ -1271,19 +1273,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'其他收入',
'' ,
'' ,
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money) / 10000, 2) AS year_sa_money
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money_tx) / 10000, 2) AS year_sa_money
FROM
new_gr_bi_sa_agg_month_count a
WHERE
@@ -1298,23 +1300,198 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'总计',
'' ,
'',
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money) / 10000, 2) AS year_sa_money
ROUND(SUM(IF(`use_month` = '1', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_1,
ROUND(SUM(IF(`use_month` = '2', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_2,
ROUND(SUM(IF(`use_month` = '3', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_3,
ROUND(SUM(IF(`use_month` = '4', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_4,
ROUND(SUM(IF(`use_month` = '5', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_5,
ROUND(SUM(IF(`use_month` = '6', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_6,
ROUND(SUM(IF(`use_month` = '7', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_7,
ROUND(SUM(IF(`use_month` = '8', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_8,
ROUND(SUM(IF(`use_month` = '9', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_9,
ROUND(SUM(IF(`use_month` = '10', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_10,
ROUND(SUM(IF(`use_month` = '11', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_11,
ROUND(SUM(IF(`use_month` = '12', this_month_sa_money_tx, null)) / 10000, 2) AS month_sa_money_12,
ROUND(SUM(this_month_sa_money_tx) / 10000, 2) AS year_sa_money
FROM
new_gr_bi_sa_agg_month_count a
WHERE
use_year = YEAR(CURDATE()) and sale_type_name in ( '代理品种','其他收入','自营品种','公司出口','委托加工','外贸品种')
</select>
<select id="stgoodTop10" resultType="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount">
WITH
total_year_data(use_year,this_month_sa_money_total) AS (
SELECT
use_year,
SUM(this_month_sa_money) AS this_month_sa_money_total
FROM
erp_bi_data.new_gr_bi_sa_agg_month_count
<where>
<if test="params.useYearStart != null">
AND (use_year * 100 + use_month) &gt;= (#{params.useYearStart} * 100 + #{params.useMonthStart})
</if>
<if test="params.useYearEnd != null">
AND (use_year * 100 + use_month) &lt;= (#{params.useYearEnd} * 100 + #{params.useMonthEnd})
</if>
</where>
GROUP BY use_year
)
SELECT
CONCAT(#{params.useYearStart}, '-', #{params.useMonthStart}, ' ~ ' , #{params.useYearEnd}, '-', #{params.useMonthEnd}) as ny,
top10.use_year,
CONCAT(#{params.useMonthStart},'~', #{params.useMonthEnd}) use_month,
CONCAT(top10.std_goods_name,',',top10.goods_id) as std_goods_name,
ROUND(top10.money/10000, 2) as money,
ROUND((top10.money - yoy_data.money)/10000, 2) as yoy_money_sub,
COALESCE(ROUND(top10.money / total_year_data.this_month_sa_money_total * 100, 2), 0) AS money_share
FROM
(SELECT
use_year,
std_goods_name,
GROUP_CONCAT(DISTINCT goods_id ORDER BY goods_id SEPARATOR ',') AS goods_id,
sum(this_month_sa_money) AS money
FROM new_gr_bi_sa_agg
<where>
<if test="params.useYearStart != null">
AND (use_year * 100 + use_month) &gt;= (#{params.useYearStart} * 100 + #{params.useMonthStart})
</if>
<if test="params.useYearEnd != null">
AND (use_year * 100 + use_month) &lt;= (#{params.useYearEnd} * 100 + #{params.useMonthEnd})
</if>
</where>
GROUP BY use_year,std_goods_name
ORDER BY money DESC
LIMIT 10
) AS top10
left join
(SELECT
use_year,
std_goods_name,
sum(this_month_sa_money) AS money
FROM new_gr_bi_sa_agg_month_count
<where>
<if test="params.useYearStart != null">
((use_year+1) * 100 + use_month) &gt;= (#{params.useYearStart} * 100 + #{params.useMonthStart})
</if>
<if test="params.useYearEnd != null">
AND ((use_year+1) * 100 + use_month) &lt;= (#{params.useYearEnd} * 100 + #{params.useMonthEnd})
</if>
</where>
GROUP BY use_year,std_goods_name
) AS yoy_data on top10.std_goods_name = yoy_data.std_goods_name
,total_year_data
ORDER BY
money DESC
</select>
<select id="zdCustomer" resultType="java.util.Map">
WITH TopAllCustomers AS (
SELECT
CONCAT(#{params.useYearStart}, '-', #{params.useMonthStart}, ' ~ ' , #{params.useYearEnd}, '-', #{params.useMonthEnd}) as ny,
a.CUSTOMNAME,
a.THISSAMONEY,
a.THISCOST,
a.THISPROFIT,
a.LASTSAMONEY,
a.LASTPROFIT,
a.THISPROFITRATE,
a.LASTPROFITRATE,
ROW_NUMBER() OVER (ORDER BY a.THISSAMONEY DESC) AS rn
FROM
(
SELECT
`CUSTOMNAME`,
IFNULL(SUM(MONTHSAMONEY),0) AS THISSAMONEY,
SUM(MONTHCOST) AS THISCOST,
SUM(MONTHPROFIT) AS THISPROFIT,
MAX(`LASTSAMONEY`) AS LASTSAMONEY,
MAX(`LASTPROFIT`) AS LASTPROFIT,
MAX(`THISPROFIT`) / MAX(`THISSAMONEY`) AS `THISPROFITRATE`,
MAX(`LASTPROFIT`) / MAX(`LASTSAMONEY`) AS `LASTPROFITRATE`
FROM
`GR_BI_SA_CUSTOMER`
<where>
<if test="params.useYearStart != null">
AND (USEYEAR * 100 + USEMONTH) &gt;= (#{params.useYearStart} * 100 + #{params.useMonthStart})
</if>
<if test="params.useYearEnd != null">
AND (USEYEAR * 100 + USEMONTH) &lt;= (#{params.useYearEnd} * 100 + #{params.useMonthEnd})
</if>
</where>
GROUP BY
`CUSTOMNAME`
) AS a
),
OtherCustomers AS (
SELECT
max(ny) ny,
SUM(`THISSAMONEY`) AS THISSAMONEY,
SUM(`THISCOST`) AS THISCOST,
SUM(`THISPROFIT`) AS THISPROFIT,
SUM(`LASTPROFIT`) AS LASTPROFIT,
SUM(`LASTSAMONEY`) AS LASTSAMONEY,
SUM(`THISPROFIT`) / SUM(`THISSAMONEY`) AS `THISPROFITRATE`,
SUM(`LASTPROFIT`) / SUM(`LASTSAMONEY`) AS `LASTPROFITRATE`
FROM TopAllCustomers
WHERE rn > 10
),
TotalCustomers AS (
SELECT
max(ny) ny,
SUM(`THISSAMONEY`) AS THISSAMONEY,
SUM(`THISCOST`) AS THISCOST,
SUM(`THISPROFIT`) AS THISPROFIT,
SUM(`LASTPROFIT`) AS LASTPROFIT,
SUM(`LASTSAMONEY`) AS LASTSAMONEY,
SUM(`THISPROFIT`) / SUM(`THISSAMONEY`) AS `THISPROFITRATE`,
SUM(`LASTPROFIT`) / SUM(`LASTSAMONEY`) AS `LASTPROFITRATE`
FROM TopAllCustomers
)
SELECT
`CUSTOMNAME` AS `customname`,
ny,
ROUND(`THISSAMONEY`, 2) AS `thissamoney`,
ROUND(`THISCOST`, 2) AS `thiscost`,
ROUND(`THISPROFITRATE`, 2) AS `thisprofitrate`,
ROUND(`LASTPROFITRATE`, 2) AS `lastprofitrate`,
ROUND(`THISPROFIT`, 2) AS `thisprofit`,
ROUND(`LASTPROFIT`, 2) AS `lastprofit`,
ROUND(`THISPROFITRATE`, 2) AS `thisprofitrate1`,
ROUND(`LASTPROFITRATE`, 2) AS `lastprofitrate1`,
1 AS sort_order
FROM TopAllCustomers
WHERE rn &lt;= 10
UNION ALL
SELECT
'其他' AS `CUSTOMNAME`,
ny,
ROUND(`THISSAMONEY`, 2),
ROUND(`THISCOST`, 2),
ROUND(`THISPROFITRATE`, 2),
ROUND(`LASTPROFITRATE`, 2),
ROUND(`THISPROFIT`, 2),
ROUND(`LASTPROFIT`, 2),
ROUND(`THISPROFITRATE`, 2),
ROUND(`LASTPROFITRATE`, 2),
2 AS sort_order
FROM OtherCustomers
UNION ALL
SELECT
'合计' AS `CUSTOMNAME`,
ny,
ROUND(`THISSAMONEY`, 2),
ROUND(`THISCOST`, 2),
ROUND(`THISPROFITRATE`, 2),
ROUND(`LASTPROFITRATE`, 2),
ROUND(`THISPROFIT`, 2),
ROUND(`LASTPROFIT`, 2),
ROUND(`THISPROFITRATE`, 2),
ROUND(`LASTPROFITRATE`, 2),
3 AS sort_order
FROM TotalCustomers
ORDER BY sort_order, `THISSAMONEY` DESC
</select>
</mapper>

View File

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
@@ -50,4 +51,26 @@ public class DevGzbxController {
return BaseWebResult.success("审批成功");
}
@PostMapping("/process")
public BaseWebResult process(@RequestBody Map<String,Object> model) {
Long id = lideeYunJiUtils.getMap2Long(model, "faultId");
if(id == null){
return BaseWebResult.error(FrameErrorCodeConstants.FRAME_OP_ERROR);
}
List<Map<String,Object>> data = devGzbxService.process(id);
return BaseWebResult.success(data);
}
@PostMapping("/processGd")
public BaseWebResult processGd(@RequestBody Map<String,Object> model) {
Long id = lideeYunJiUtils.getMap2Long(model, "faultId");
if(id == null){
return BaseWebResult.error(FrameErrorCodeConstants.FRAME_OP_ERROR);
}
List<Map<String,Object>> data = devGzbxService.processGd(id);
return BaseWebResult.success(data);
}
}

View File

@@ -68,7 +68,7 @@ public class AddFaultReportingFunctionRecord implements AroundAdvicePlugin {
devGzbxDO.setFaultNumber(faultNumber);
devGzbxDO.setLeaderUserId(leaderUserId);
devGzbxDO.setReporter(userId);
devGzbxDO.setCreateUserName(adapterMapper.getNickname(userId));
// devGzbxDO.setCreateUserName(adapterMapper.getNickname(userId));
devGzbxMapper.updateById(devGzbxDO);
}

View File

@@ -1,5 +1,8 @@
package com.lideeyunji.module.biz.service;
import java.util.List;
import java.util.Map;
/**
* 故障报修 Service 接口
*
@@ -11,4 +14,8 @@ public interface DevGzbxService {
void auditNotPass(Long id);
void orderAuditNotPass(Long id);
List<Map<String, Object>> process(Long id);
List<Map<String, Object>> processGd(Long id);
}

View File

@@ -5,12 +5,18 @@ import com.lideeyunji.module.biz.entity.DevGzbxWxgdDO;
import com.lideeyunji.module.biz.mapper.DevGzbxMapper;
import com.lideeyunji.module.biz.mapper.DevGzbxWxgdMapper;
import com.lideeyunji.module.biz.service.DevGzbxService;
import com.lideeyunji.service.system.api.IApiAdminUserApi;
import com.lideeyunji.tool.framework.yunji.enums.AcceptanceStatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 参数配置 Service 实现类
*/
@@ -24,6 +30,8 @@ public class DevGzbxServiceImpl implements DevGzbxService {
@Resource
private DevGzbxWxgdMapper devGzbxWxgdMapper;
@Resource
private IApiAdminUserApi userApi;
@Override
public void auditNotPass(Long id) {
@@ -41,4 +49,115 @@ public class DevGzbxServiceImpl implements DevGzbxService {
devGzbxWxgdMapper.updateById(wxgd);
}
@Override
public List<Map<String, Object>> process(Long id) {
List<Map<String, Object>> result = new ArrayList<>();
DevGzbxDO devGzbxDO = devGzbxMapper.selectById(id);
DevGzbxWxgdDO gd = devGzbxWxgdMapper.selectOne("gzbx_id", id);
Map<String, Object> model = new HashMap<>();
model.put("nodeName", "车间主任审批");
model.put("spr",userApi.getUser(devGzbxDO.getLeaderUserId()));
model.put("status", "current");
model.put("comment", "-");
if(devGzbxDO.getLeaderUserZt() == 1){
model.put("status", "approved");
model.put("comment", devGzbxDO.getLeaderUserYj());
}
result.add(model);
Map<String, Object> model1 = new HashMap<>();
model1.put("nodeName", "指定部门审批");
model1.put("spr",userApi.getUser(devGzbxDO.getAssignDeptLeader()));
model1.put("status", "current");
model1.put("comment", "-");
if(devGzbxDO.getAssignUserZt() == 1){
model1.put("status", "approved");
model1.put("comment", devGzbxDO.getAssignUserYj());
}
result.add(model1);
Map<String, Object> model4 = new HashMap<>();
model4.put("nodeName", "车间主任验收");
model4.put("status", "current");
model4.put("comment", "-");
Map<String, Object> model5 = new HashMap<>();
model5.put("nodeName", "指定部门验收");
model5.put("status", "current");
model5.put("comment", "-");
if (gd != null){
model4.put("spr",userApi.getUser(gd.getLeaderUserId()));
if(gd.getLeaderYsZt() == 1){
model4.put("status", "approved");
model4.put("comment", gd.getLeaderYsYj());
}
model5.put("spr",userApi.getUser(gd.getAssignDeptLeader()));
if(gd.getAssignYsZt() == 1){
model5.put("status", "approved");
model5.put("comment", gd.getAssignYsYj());
}
}
result.add(model4);
result.add(model5);
return result;
}
@Override
public List<Map<String, Object>> processGd(Long id) {
List<Map<String, Object>> result = new ArrayList<>();
DevGzbxWxgdDO devGzbxWxgdDO = devGzbxWxgdMapper.selectById(id);
Long gzbxId = devGzbxWxgdDO.getGzbxId();
Map<String, Object> model = new HashMap<>();
model.put("nodeName", "车间主任审批");
model.put("status", "approved");
model.put("comment", "-");
Map<String, Object> model1 = new HashMap<>();
model1.put("nodeName", "指定部门审批");
model1.put("status", "approved");
model1.put("comment", "-");
Map<String, Object> model4 = new HashMap<>();
model4.put("nodeName", "车间主任验收");
model4.put("status", "current");
model4.put("comment", "-");
model4.put("spr",userApi.getUser(devGzbxWxgdDO.getLeaderUserId()));
if(devGzbxWxgdDO.getLeaderYsZt() == 1){
model4.put("status", "approved");
model4.put("comment", devGzbxWxgdDO.getLeaderYsYj());
}
Map<String, Object> model5 = new HashMap<>();
model5.put("nodeName", "指定部门验收");
model5.put("status", "current");
model5.put("comment", "-");
model5.put("spr",userApi.getUser(devGzbxWxgdDO.getAssignDeptLeader()));
if(devGzbxWxgdDO.getAssignYsZt() == 1){
model5.put("status", "approved");
model5.put("comment", devGzbxWxgdDO.getAssignYsYj());
}
if (gzbxId != null) {
DevGzbxDO devGzbxDO = devGzbxMapper.selectById(gzbxId);
model.put("comment", devGzbxDO.getLeaderUserYj());
model.put("spr",userApi.getUser(devGzbxDO.getLeaderUserId()));
model1.put("comment", devGzbxDO.getAssignUserYj());
model1.put("spr",userApi.getUser(devGzbxDO.getAssignDeptLeader()));
}else {
model.put("comment", devGzbxWxgdDO.getLeaderYsYj());
model.put("spr",userApi.getUser(devGzbxWxgdDO.getLeaderUserId()));
model1.put("comment", devGzbxWxgdDO.getAssignYsYj());
model1.put("spr",userApi.getUser(devGzbxWxgdDO.getAssignDeptLeader()));
}
result.add(model);
result.add(model1);
result.add(model4);
result.add(model5);
return result;
}
}

View File

@@ -245,6 +245,7 @@ public class AuthController {
userVo.setSupAdmin(supAdminFlag);//是否是超级管理员
userVo.setTenantAdmin(tenantAdminFlag);//是否是租户管理员
userVo.setSupAdminToken(isSupAdmin());
userVo.setMobile(user.getMobile());
return success(vo);
}

View File

@@ -54,6 +54,9 @@ public class AuthPermissionInfoRespVO {
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
private Set<Long> deptId;
@Schema(description = "手机号码", example = "15601691300")
private String mobile;
private Long loginDeptId;
private Long loginRoleId;