Compare commits
15 Commits
erp_to_pus
...
fd85567f30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd85567f30 | ||
|
|
74c6e749f2 | ||
|
|
cf3cf6cdeb | ||
|
|
153ac6545d | ||
|
|
7d7e296e23 | ||
|
|
2cf72b270e | ||
|
|
0134dd5ee7 | ||
|
|
0b49f8c99c | ||
|
|
b76ca502d2 | ||
|
|
89d144e10c | ||
|
|
c8c67d3f90 | ||
|
|
fe73160479 | ||
|
|
1f37b77c90 | ||
|
|
fc05eea975 | ||
|
|
81c7c96ba2 |
@@ -353,6 +353,13 @@ public class FrameWorkAdapter implements IlideeYunjiAdapter {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
//获取所有设备类型名称列表
|
||||
@TenantIgnore
|
||||
@Override
|
||||
public List<Map<String, Object>> getAllSblxNameList() {
|
||||
return adapterMapper.getAllSblxNameList();
|
||||
}
|
||||
|
||||
//获取用户分页列表
|
||||
@Override
|
||||
public Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param) {
|
||||
|
||||
@@ -37,6 +37,7 @@ public class FormatCriteriaList implements CriteriaList{
|
||||
List<String> userKeyList = fieldWebMapper.getUserControlTypeFieldCodeList(dbformId);//那些字段是用户控件
|
||||
List<String> deptKeyList = fieldWebMapper.getDeptControlTypeFieldCodeList(dbformId);//那些字段是部门控件
|
||||
List<String> areaKeyList = fieldWebMapper.getAreaControlTypeFieldCodeList(dbformId);//那些字段是区域控件
|
||||
List<String> sblxKeyList = fieldWebMapper.getSblxControlTypeFieldCodeList(dbformId);//那些字段是设备类型控件
|
||||
|
||||
//用户
|
||||
Map<Long, String> nickNameMap = new HashMap<>();
|
||||
@@ -58,6 +59,16 @@ public class FormatCriteriaList implements CriteriaList{
|
||||
map -> Func.getMap2Str(map, "name"),
|
||||
(existing, replacement) -> existing)); // 处理重复key的情况,保留第一个值
|
||||
}
|
||||
//设备类型
|
||||
Map<Long, String> sblxNameMap = new HashMap<>();
|
||||
if (FuncBase.isNotEmpty(sblxKeyList)) {
|
||||
List<Map<String, Object>> sblxNameMapList = adapterMapper.getAllSblxNameList();
|
||||
sblxNameMap = sblxNameMapList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
map -> Func.getMap2Long(map, "id"),
|
||||
map -> Func.getMap2Str(map, "industry_name"),
|
||||
(existing, replacement) -> existing)); // 处理重复key的情况,保留第一个值
|
||||
}
|
||||
|
||||
|
||||
//字典集合
|
||||
@@ -75,6 +86,7 @@ public class FormatCriteriaList implements CriteriaList{
|
||||
//数据里面会存在id,或者字典等,如:1=男,需要转为文字
|
||||
Map<Long, String> finalNickNameMap = nickNameMap;
|
||||
Map<Long, String> finalDeptNameMap = deptNameMap;
|
||||
Map<Long, String> finalSblxNameMap = sblxNameMap;
|
||||
dataMapList.forEach(dataMap -> {
|
||||
//处理字典
|
||||
for (String key : dictKeyList) {
|
||||
@@ -161,6 +173,34 @@ public class FormatCriteriaList implements CriteriaList{
|
||||
}
|
||||
dataMap.put(key, deptnames);
|
||||
}
|
||||
//处理设备类型
|
||||
for(String key : sblxKeyList){
|
||||
String valStr = lideeYunJiUtils.getMap2Str(dataMap, key);
|
||||
if (FuncBase.isEmpty(valStr)) {
|
||||
continue;
|
||||
}
|
||||
String sblxnames="";
|
||||
//有可能是多选
|
||||
List<String> sblxIdList = Func.toStrList(valStr);
|
||||
for (String sblxId : sblxIdList) {//有可能是多选的情况下111,222,333
|
||||
//获取名称
|
||||
String sblxName = finalSblxNameMap.get(Func.toLong(sblxId));
|
||||
|
||||
if (Func.isEmpty(sblxName)) {
|
||||
continue;
|
||||
}
|
||||
if (Func.isEmpty(sblxnames)) {
|
||||
sblxnames = sblxName;
|
||||
} else {
|
||||
sblxnames += "、" + sblxName;
|
||||
}
|
||||
}
|
||||
|
||||
if (FuncBase.isEmpty(sblxnames)) {
|
||||
continue;
|
||||
}
|
||||
dataMap.put(key, sblxnames);
|
||||
}
|
||||
//处理区域
|
||||
for(String key : areaKeyList){
|
||||
String valStr = lideeYunJiUtils.getMap2Str(dataMap, key);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.lideeyunji.core.framework.config.job;
|
||||
|
||||
import com.lideeyunji.core.framework.service.IGrBiStStatsService;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 库存全品种统计表
|
||||
* oracle gr_bi_st_stats -> mysql gr_bi_st_stats
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("generateStStatsJob")
|
||||
public class GenerateStStatsJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private IGrBiStStatsService iGrBiStStatsService;
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
log.info("*********** 开始生成库存全品种统计表 ************");
|
||||
iGrBiStStatsService.generateStStats(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("*********** 生成库存全品种统计表完成 ************");
|
||||
return "*********** 生成库存全品种统计表完成 ************";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.lideeyunji.core.framework.config.job;
|
||||
|
||||
import com.lideeyunji.core.framework.entity.GrBiSaSetdtl;
|
||||
import com.lideeyunji.core.framework.mapper.GrBiSaSetdtlMapper;
|
||||
import com.lideeyunji.core.framework.mapper.OracleProcedureMapper;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Oracle 存储过程调用定时任务 ,RP中间库
|
||||
* 用于定时调用 Oracle 存储过程进行数据处理
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("oracleProcedureUpdateErpDataJob")
|
||||
public class OracleProcedureUpdateErpDataJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private OracleProcedureMapper oracleProcedureMapper;
|
||||
@Resource
|
||||
private GrBiSaSetdtlMapper grBiSaSetdtlMapper;
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
log.info("========== 开始执行 Oracle 存储过程定时任务 ,ERP中间库,参数:{} ==========", param);
|
||||
|
||||
try {
|
||||
callErpDataCore();
|
||||
log.info("========== Oracle 存储过程定时任务,ERP中间库 执行成功 ==========");
|
||||
return "Oracle 存储过程定时任务,ERP中间库 执行成功";
|
||||
} catch (Exception e) {
|
||||
log.error("========== Oracle E存储过程定时任务,ERP中间库 执行失败 ==========", e);
|
||||
throw new RuntimeException("Oracle 存储过程,ERP中间库 调用失败:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用简单存储过程
|
||||
*/
|
||||
private void callErpDataCore() {
|
||||
log.info("开始调用存储过程...");
|
||||
//获取本地mysql数据库中表中UPDATE_TIME最新的数据
|
||||
GrBiSaSetdtl grBiSaAgg = grBiSaSetdtlMapper.selectLastOne(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
int lastUserYear = 2022;
|
||||
int lastUserMonth = 1;
|
||||
if(grBiSaAgg != null){
|
||||
lastUserYear = grBiSaAgg.getUSEYEAR();
|
||||
lastUserMonth = grBiSaAgg.getUSEMONTH();
|
||||
}
|
||||
// 获取当前时间的年和月
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int currentYear = now.getYear();
|
||||
int currentMonth = now.getMonthValue();
|
||||
|
||||
// 获取上个月前的时间和年月
|
||||
LocalDateTime threeMonthsAgo = now.minusMonths(1);
|
||||
int pastYear = threeMonthsAgo.getYear();
|
||||
int pastMonth = threeMonthsAgo.getMonthValue();
|
||||
|
||||
log.info("最后更新的年月:{}年{}月", lastUserYear, lastUserMonth);
|
||||
log.info("当前:{}年{}月", currentYear, currentMonth);
|
||||
log.info("上个月前:{}年{}月", pastYear, pastMonth);
|
||||
if (lastUserYear < pastYear || (lastUserYear == pastYear && lastUserMonth < pastMonth)) {
|
||||
pastYear = lastUserYear;
|
||||
pastMonth = lastUserMonth;
|
||||
|
||||
}
|
||||
log.info("开始时间:{}年{}月, 结束时间:{}年{}月", pastYear, pastMonth, currentYear, currentMonth);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("result", new Object()); // 用于接收输出参数
|
||||
|
||||
oracleProcedureMapper.callErpDataCore(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI, pastYear, pastMonth, currentYear, currentMonth);
|
||||
|
||||
// 获取输出参数值
|
||||
Object result = params.get("result");
|
||||
log.info("存储过程执行结果:{}", result);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.lideeyunji.core.framework.controller;
|
||||
|
||||
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.enhance.example.report.xtsy.zhxsqkPlugin;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
|
||||
import com.lideeyunji.core.framework.params.SaAggParam;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggService;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
|
||||
import com.lideeyunji.core.framework.utils.FuncWeb;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import com.lideeyunji.tool.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
||||
import com.lideeyunji.tool.framework.yunji.model.global.BaseWebResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -15,9 +23,11 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 综合销售情况月维度Controller
|
||||
@@ -36,6 +46,9 @@ public class NewGrBiSaAggMonthCountController extends BaseController
|
||||
@Autowired
|
||||
private INewGrBiSaAggYearCountService newGrBiSaAggYearCountService;
|
||||
|
||||
@Resource
|
||||
INewGrBiSaAggService newGrBiSaAggService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询综合销售情况月维度-总计
|
||||
@@ -47,7 +60,20 @@ public class NewGrBiSaAggMonthCountController extends BaseController
|
||||
Map<String, Object> params = FuncWeb.getParameterBodyMap(req);
|
||||
String groupField = params.containsKey("Group by") ? params.get("Group by").toString() : "";
|
||||
SaAggParam saAggParam = new SaAggParam();
|
||||
if(groupField.contains("useMonth")){
|
||||
if(groupField.contains("useYear") && !groupField.contains("useMonth")){
|
||||
if(params.containsKey("useYearStart")){
|
||||
saAggParam.setUseYearStart(params.get("useYearStart").toString());
|
||||
}
|
||||
if(params.containsKey("useYearEnd")){
|
||||
saAggParam.setUseYearEnd(params.get("useYearEnd").toString());
|
||||
}
|
||||
}else{
|
||||
if(params.containsKey("useYearStart")){
|
||||
saAggParam.setUseYearStart(params.get("useYearStart").toString());
|
||||
}
|
||||
if(params.containsKey("useYearEnd")){
|
||||
saAggParam.setUseYearEnd(params.get("useYearEnd").toString());
|
||||
}
|
||||
if (params.containsKey("useMonthStart")){
|
||||
saAggParam.setUseMonthStart(params.get("useMonthStart").toString());
|
||||
}
|
||||
@@ -55,12 +81,7 @@ public class NewGrBiSaAggMonthCountController extends BaseController
|
||||
saAggParam.setUseMonthEnd(params.get("useMonthEnd").toString());
|
||||
}
|
||||
}
|
||||
if(params.containsKey("useYearStart")){
|
||||
saAggParam.setUseYearStart(params.get("useYearStart").toString());
|
||||
}
|
||||
if(params.containsKey("useYearEnd")){
|
||||
saAggParam.setUseYearEnd(params.get("useYearEnd").toString());
|
||||
}
|
||||
|
||||
|
||||
if(params.containsKey("customName")){
|
||||
saAggParam.setCustomName(Arrays.asList(params.get("customName").toString().split(",")));
|
||||
@@ -87,14 +108,26 @@ public class NewGrBiSaAggMonthCountController extends BaseController
|
||||
if (params.containsKey("provinceName")){
|
||||
saAggParam.setProvinceName(Arrays.asList(params.get("provinceName").toString().split( ",")));
|
||||
}
|
||||
if (groupField.contains("useMonth")){
|
||||
List<NewGrBiSaAggMonthCount> list = newGrBiSaAggMonthCountService.getTotalDetail(saAggParam);
|
||||
if (groupField.contains("useYear") && !groupField.contains("useMonth")){
|
||||
List<NewGrBiSaAggYearCount> list = newGrBiSaAggYearCountService.getTotalDetail(saAggParam);
|
||||
return BaseWebResult.success(list);
|
||||
}else{
|
||||
List<NewGrBiSaAggYearCount> list = newGrBiSaAggYearCountService.getTotalDetail(saAggParam);
|
||||
List<NewGrBiSaAggMonthCount> list = newGrBiSaAggMonthCountService.getTotalDetail(saAggParam);
|
||||
return BaseWebResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/record")
|
||||
public ResultDataModel getRecord(HttpServletRequest req)
|
||||
{
|
||||
Map<String, Object> params = FuncWeb.getParameterBodyMap(req);
|
||||
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
|
||||
zhxsqkPlugin.setMonthOrderBy(params, page);
|
||||
List<NewGrBiSaAgg> newGrBiSaAggList = newGrBiSaAggService.selectNewGrBiSaAggList(params);
|
||||
PageInfo<NewGrBiSaAgg> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("zhxsqkLineReportEnhance")
|
||||
public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
|
||||
public class ZhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceReportContext enhanceContext) {
|
||||
@@ -26,7 +26,7 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
if (params.containsKey("Group by")) {
|
||||
if(params.containsKey("goodsname")){
|
||||
throw new lideeYunJiException("在选择维度时,“货品名称”不能有值!");
|
||||
throw new lideeYunJiException("在选择维度时,“产品名称”不能有值!");
|
||||
}
|
||||
List<String> groupFieldList = Arrays.asList(params.get("Group by").toString().split(","));
|
||||
String sql;
|
||||
@@ -7,6 +7,7 @@ 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.NewGrBiSaAgg;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
|
||||
@@ -28,7 +29,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("zhxsqkPlugin")
|
||||
public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
||||
public class ZhxsqkPlugin implements ReportAroundAdvicePlugin {
|
||||
|
||||
@Resource
|
||||
INewGrBiSaAggService newGrBiSaAggService;
|
||||
@@ -43,16 +44,27 @@ public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
||||
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
|
||||
log.info("进入=======>zhxsqkPlugin=======>execute");
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
|
||||
if (params.containsKey("Group by")) {
|
||||
if (params.containsKey("goodsName")) {
|
||||
throw new lideeYunJiException("在选择维度时,“货品名称”不能有值!");
|
||||
}
|
||||
List<String> groupFieldList = Arrays.asList(params.get("Group by").toString().split(","));
|
||||
if(!groupFieldList.contains("useYear") && !params.containsKey("useYear")){
|
||||
throw new lideeYunJiException("维度“年” 和 查询条件“年” 不能同时为空!");
|
||||
if(!groupFieldList.contains("useYearMonthStart") && !params.containsKey("useYearMonthEnd")){
|
||||
throw new lideeYunJiException("年月范围 不能为空!");
|
||||
}
|
||||
if (params.containsKey("goodsName")) {
|
||||
throw new lideeYunJiException("在选择维度时,“产品名称”不能有值!");
|
||||
}
|
||||
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.get("useYearStart").toString() .equals(params.get("useYearEnd").toString())){
|
||||
params.put("isOneYear", true);
|
||||
}else{
|
||||
params.put("isOneYear", false);
|
||||
}
|
||||
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.selectNewGrBiSaAggGroupNoMonthNoYearList(params, groupFieldList);
|
||||
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);
|
||||
}
|
||||
if(groupFieldList.contains("useMonth") || params.containsKey("useMonth")){
|
||||
setMonthOrderBy(params, page);
|
||||
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.selectNewGrBiSaAggGroupMonthList(params, groupFieldList);
|
||||
@@ -103,14 +115,14 @@ public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
||||
}else {
|
||||
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
|
||||
setMonthOrderBy(params, page);
|
||||
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggService.selectNewGrBiSaAggList(params);
|
||||
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||
List<NewGrBiSaAgg> newGrBiSaAggList = newGrBiSaAggService.selectNewGrBiSaAggList(params);
|
||||
PageInfo<NewGrBiSaAgg> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMonthOrderBy(Map<String, Object> params, Page<Object> page) {
|
||||
public static void setMonthOrderBy(Map<String, Object> params, Page<Object> page) {
|
||||
if(params.containsKey("column")){
|
||||
String orderBy = "";
|
||||
if ("thisMonthSaQty".equals(params.get("column"))) {
|
||||
@@ -0,0 +1,83 @@
|
||||
|
||||
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.NewGrBiSaAggYearCount;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
|
||||
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 报表-综合销售表_剂型-插件
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("zhxsqkPluginJx")
|
||||
public class ZhxsqkPluginJx implements ReportAroundAdvicePlugin {
|
||||
|
||||
@Resource
|
||||
INewGrBiSaAggYearCountService newGrBiSaAggYearCountService;
|
||||
|
||||
@Override
|
||||
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
|
||||
log.info("进入=======>zhxsqkPluginJx=======>execute");
|
||||
List<String> groupFieldList = Arrays.asList("useYear","dosageName");
|
||||
return zhxsqkFun(enhanceContext, groupFieldList, newGrBiSaAggYearCountService);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static ResultDataModel zhxsqkFun(EnhanceReportContext enhanceContext, List<String> groupFieldList, INewGrBiSaAggYearCountService newGrBiSaAggYearCountService) {
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
|
||||
if(params.containsKey("column")){
|
||||
String orderBy = "";
|
||||
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();
|
||||
}
|
||||
if ("samoney_yoy".equals(params.get("column"))) {
|
||||
orderBy = "CAST(TRIM(REGEXP_SUBSTR(samoney_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
|
||||
}
|
||||
if ("thisYearProfit".equals(params.get("column"))) {
|
||||
orderBy = "this_year_profit " + params.get("order").toString();
|
||||
}
|
||||
if ("profit_yoy".equals(params.get("column"))) {
|
||||
orderBy = "CAST(TRIM(REGEXP_SUBSTR(profit_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
|
||||
}
|
||||
if ("thisYearCost".equals(params.get("column"))) {
|
||||
orderBy = "this_year_cost " + params.get("order").toString();
|
||||
}
|
||||
if ("thisYearSaMoneyShare".equals(params.get("column"))) {
|
||||
orderBy = "this_year_sa_money_share " + params.get("order").toString();
|
||||
}
|
||||
if ("thisprofitshare".equals(params.get("column"))) {
|
||||
orderBy = "thisprofitshare " + params.get("order").toString();
|
||||
}
|
||||
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();
|
||||
}
|
||||
page.setUnsafeOrderBy(orderBy);
|
||||
}
|
||||
List<NewGrBiSaAggYearCount> newGrBiSaAggList = newGrBiSaAggYearCountService.selectNewGrBiSaAggGroupYearList(params, groupFieldList);
|
||||
PageInfo<NewGrBiSaAggYearCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
package com.lideeyunji.core.framework.enhance.example.report.xtsy;
|
||||
|
||||
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.INewGrBiSaAggYearCountService;
|
||||
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.lideeyunji.core.framework.enhance.example.report.xtsy.ZhxsqkPluginJx.zhxsqkFun;
|
||||
|
||||
/**
|
||||
* 报表-综合销售表_剂型-插件
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("zhxsqkPluginLxfl")
|
||||
public class ZhxsqkPluginLxfl implements ReportAroundAdvicePlugin {
|
||||
|
||||
@Resource
|
||||
INewGrBiSaAggYearCountService newGrBiSaAggYearCountService;
|
||||
|
||||
@Override
|
||||
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
|
||||
log.info("进入=======>zhxsqkPluginLxfl=======>execute");
|
||||
List<String> groupFieldList = Arrays.asList("useYear","effectName");
|
||||
return zhxsqkFun(enhanceContext, groupFieldList, newGrBiSaAggYearCountService);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
package com.lideeyunji.core.framework.enhance.example.report.xtsy;
|
||||
|
||||
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.INewGrBiSaAggYearCountService;
|
||||
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.lideeyunji.core.framework.enhance.example.report.xtsy.ZhxsqkPluginJx.zhxsqkFun;
|
||||
|
||||
/**
|
||||
* 报表-综合销售表_剂型-插件
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("zhxsqkPluginXslx")
|
||||
public class ZhxsqkPluginXslx implements ReportAroundAdvicePlugin {
|
||||
|
||||
@Resource
|
||||
INewGrBiSaAggYearCountService newGrBiSaAggYearCountService;
|
||||
|
||||
@Override
|
||||
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
|
||||
log.info("进入=======>zhxsqkPluginXslx=======>execute");
|
||||
List<String> groupFieldList = Arrays.asList("useYear","saleTypeName");
|
||||
return zhxsqkFun(enhanceContext, groupFieldList, newGrBiSaAggYearCountService);
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,10 @@ public class GrBiSaSetdtl implements Serializable {
|
||||
private Integer DOSAGEID;
|
||||
@TableField(value = "DOSAGENAME")
|
||||
private String DOSAGENAME;
|
||||
@TableField(value = "EFFECTID")
|
||||
private Integer EFFECTID;
|
||||
@TableField(value = "EFFECTNAME")
|
||||
private String EFFECTNAME;
|
||||
@TableField(value = "STDGOODSNAME")
|
||||
private String STDGOODSNAME;
|
||||
@TableField(value = "GOODSID")
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 库存全品种统计表
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-04-14
|
||||
*/
|
||||
@TableName("gr_bi_st_stats")
|
||||
@Data
|
||||
public class GrBiStStats implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "GOODSID")
|
||||
private String goodsId;
|
||||
@TableField(value = "GOODSNAME")
|
||||
private String goodsName;
|
||||
@TableField(value = "GOODSTYPE")
|
||||
private String goodsType;
|
||||
@TableField(value = "GOODSUNIT")
|
||||
private String goodsUnit;
|
||||
@TableField(value = "REMQTY")
|
||||
private String remQty;
|
||||
@TableField(value = "REMMONEY")
|
||||
private String remMoney;
|
||||
@TableField(value = "MONTHSAMONEY")
|
||||
private String monthSaMoney;
|
||||
@TableField(value = "SKSA")
|
||||
private String skSa;
|
||||
@TableField(value = "THISSAMONEY")
|
||||
private String thisSaMoney;
|
||||
@TableField(value = "THISPROFIT")
|
||||
private String thisProfit;
|
||||
@TableField(value = "THISPROFITRATE")
|
||||
private String thisProfitRate;
|
||||
@TableField(value = "MAXAGE")
|
||||
private String maxAge;
|
||||
}
|
||||
@@ -29,6 +29,8 @@ public class NewGrBiSaAgg implements Serializable
|
||||
@TableField(value = "use_month")
|
||||
private int useMonth;
|
||||
|
||||
@TableField(value = "ny", exist = false)
|
||||
private String ny;
|
||||
|
||||
@TableField(value = "zone_id")
|
||||
private String zoneId;
|
||||
@@ -61,6 +63,11 @@ public class NewGrBiSaAgg implements Serializable
|
||||
@TableField(value = "dosage_name")
|
||||
private String dosageName;
|
||||
|
||||
@TableField(value = "effect_id")
|
||||
private Integer effectId;
|
||||
|
||||
@TableField(value = "effect_name")
|
||||
private String effectName;
|
||||
|
||||
@TableField(value = "goods_id")
|
||||
private Long goodsId;
|
||||
@@ -105,6 +112,82 @@ public class NewGrBiSaAgg implements Serializable
|
||||
private String thisMonthProfit;
|
||||
|
||||
|
||||
@TableField(value = "last_month_sa_qty")
|
||||
private String lastMonthSaQty;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_sa_qty")
|
||||
private String yoyMonthSaQty;
|
||||
|
||||
|
||||
@TableField(value = "last_month_sa_money")
|
||||
private String lastMonthSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_sa_money")
|
||||
private String yoyMonthSaMoney;
|
||||
|
||||
|
||||
|
||||
|
||||
@TableField(value = "last_month_profit")
|
||||
private String lastMonthProfit;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_profit")
|
||||
private String yoyMonthProfit;
|
||||
|
||||
|
||||
@TableField(value = "last_month_cost")
|
||||
private String lastMonthCost;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_cost")
|
||||
private String yoyMonthCost;
|
||||
|
||||
|
||||
@TableField(value = "this_month_profit_rate")
|
||||
private String thisMonthProfitRate;
|
||||
|
||||
|
||||
@TableField(value = "last_month_profit_rate")
|
||||
private String lastMonthProfitRate;
|
||||
|
||||
|
||||
@TableField(value = "last_month_profit_share")
|
||||
private String lastMonthProfitShare;
|
||||
|
||||
|
||||
@TableField(value = "this_month_sa_money_share")
|
||||
private String thisMonthSaMoneyShare;
|
||||
|
||||
|
||||
@TableField(value = "this_month_profit_share")
|
||||
private String thisMonthProfitShare;
|
||||
|
||||
|
||||
@TableField(value = "thissamoney_s", exist = false)
|
||||
private String thisMonthSaMoney_s;
|
||||
|
||||
@TableField(value = "thisprofit_s", exist = false)
|
||||
private String thisMonthProfit_s;
|
||||
|
||||
@TableField(value = "monthsaqty_yoy", exist = false)
|
||||
private String monthsaqty_yoy;
|
||||
|
||||
@TableField(value = "monthsamoney_yoy", exist = false)
|
||||
private String monthsamoney_yoy;
|
||||
|
||||
@TableField(value = "lastMonthSaMoney_yoy", exist = false)
|
||||
private String lastMonthSaMoney_yoy;
|
||||
|
||||
@TableField(value = "this_month_cost_yoy", exist = false)
|
||||
private String this_month_cost_yoy;
|
||||
|
||||
@TableField(value = "monthprofit_yoy", exist = false)
|
||||
private String monthprofit_yoy;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,17 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
||||
@TableField(value = "ny")
|
||||
private String ny;
|
||||
|
||||
@TableField(value = "useYearStart")
|
||||
private String useYearStart;
|
||||
|
||||
@TableField(value = "useYearEnd")
|
||||
private String useYearEnd;
|
||||
|
||||
@TableField(value = "useMonthStart")
|
||||
private String useMonthStart;
|
||||
|
||||
@TableField(value = "useMonthEnd")
|
||||
private String useMonthEnd;
|
||||
|
||||
@TableField(value = "use_month")
|
||||
private String useMonth;
|
||||
@@ -65,10 +76,15 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
||||
@TableField(value = "dosage_name")
|
||||
private String dosageName;
|
||||
|
||||
@TableField(value = "effect_id")
|
||||
private Integer effectId;
|
||||
|
||||
@TableField(value = "effect_name")
|
||||
private String effectName;
|
||||
|
||||
@TableField(value = "std_goods_name")
|
||||
private String stdGoodsName;
|
||||
|
||||
|
||||
@TableField(value = "province_id")
|
||||
private String provinceId;
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
@TableField(value = "dosage_name")
|
||||
private String dosageName;
|
||||
|
||||
@TableField(value = "effect_id")
|
||||
private Integer effectId;
|
||||
|
||||
@TableField(value = "effect_name")
|
||||
private String effectName;
|
||||
|
||||
@TableField(value = "std_goods_name")
|
||||
private String stdGoodsName;
|
||||
|
||||
@@ -36,6 +36,10 @@ public interface AdapterMapper {
|
||||
//获取所有部门名称
|
||||
List<Map<String,Object>> getAllDeptNameList();
|
||||
|
||||
//获取所有设备类型名称列表
|
||||
@TenantIgnore
|
||||
List<Map<String, Object>> getAllSblxNameList();
|
||||
|
||||
@TenantIgnore
|
||||
@lideeYunjiCache(cacheNames = "'"+ lideeRedisConstants.REDIS_ADAPTER+":getUserIdByNikeName:' + #tenantId+'_' + #nikeName", reflexClass = Long.class)
|
||||
List<Long> getUserIdByNikeName(Long tenantId,String nikeName);
|
||||
@@ -70,8 +74,8 @@ public interface AdapterMapper {
|
||||
IPage<lideeYunJiUser> getUserPageByRoleId(Long tenantId, IPage page, Long roleId, List<Long> deptIdList, @Param("params") Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 根据表单id获取表单的字段对应的字典
|
||||
* @param dbFormId
|
||||
* 根据字典编码获取字典数据
|
||||
* @param dictCode 字典编码
|
||||
* @return
|
||||
*/
|
||||
@lideeYunjiCache(cacheNames = "'"+ lideeRedisConstants.REDIS_ADAPTER+":getDictMap:' + #dictCode", reflexClass = Map.class,nullIsSave = true)
|
||||
|
||||
@@ -96,4 +96,18 @@ public interface FormFieldWebMapper extends BaseMapper<FormFieldWebEntity> {
|
||||
return this.selectList(webWrapper);
|
||||
}
|
||||
|
||||
//获取设备类型控件字段
|
||||
default List<String> getSblxControlTypeFieldCodeList(Long dbFormId){
|
||||
LambdaQueryWrapper<FormFieldWebEntity> webWrapper=new LambdaQueryWrapper<>();
|
||||
webWrapper.eq(FormFieldWebEntity::getDbformId,dbFormId);
|
||||
webWrapper.eq(FormFieldWebEntity::getControlType,"sblxSelect");
|
||||
webWrapper.select(FormFieldWebEntity::getFieldCode);
|
||||
List<FormFieldWebEntity> webEntityList = this.selectList(webWrapper);
|
||||
//遍历返回list<String>
|
||||
List<String> fieldCodeList = webEntityList.stream()
|
||||
.map(FormFieldWebEntity::getFieldCode)
|
||||
.collect(Collectors.toList());
|
||||
return fieldCodeList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lideeyunji.core.framework.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiSaSetdtl;
|
||||
@@ -26,10 +27,12 @@ public interface GrBiSaSetdtlMapper extends BaseMapper<GrBiSaSetdtl> {
|
||||
default List<GrBiSaSetdtl> getByUpdateTime(@Param("dataSourceType") String dataSourceType, String updateTime) {
|
||||
try {
|
||||
// 假设 updateTime 格式为 "yyyy-MM-dd HH:mm:ss"
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date startTime = sdf.parse(updateTime);
|
||||
QueryWrapper<GrBiSaSetdtl> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.gt("UPDATE_TIME", startTime);
|
||||
if(updateTime != null){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date startTime = sdf.parse(updateTime);
|
||||
queryWrapper.gt("UPDATE_TIME", startTime);
|
||||
}
|
||||
return this.selectList(queryWrapper);
|
||||
} catch (Exception e) {
|
||||
// 处理异常
|
||||
@@ -52,4 +55,11 @@ public interface GrBiSaSetdtlMapper extends BaseMapper<GrBiSaSetdtl> {
|
||||
return this.updateById(grBiSaSetdtl);
|
||||
}
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
default GrBiSaSetdtl selectLastOne(@Param("dataSourceType") String dataSourceType) {
|
||||
LambdaQueryWrapper<GrBiSaSetdtl> queryWrapper = new LambdaQueryWrapper<GrBiSaSetdtl>().orderByDesc(GrBiSaSetdtl::getUSEYEAR, GrBiSaSetdtl::getUSEMONTH).last("LIMIT 1");
|
||||
return this.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.lideeyunji.core.framework.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStStats;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存全品种统计表Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
public interface GrBiStStatsMapper extends BaseMapper<GrBiStStats>
|
||||
{
|
||||
/**
|
||||
* 查询库存全品种统计表
|
||||
*
|
||||
* @param ID 库存全品种统计表主键
|
||||
* @return 库存全品种统计表
|
||||
*/
|
||||
public GrBiStStats selectGrBiStStatsByID(String ID);
|
||||
|
||||
/**
|
||||
* 查询库存全品种统计表列表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 库存全品种统计表集合
|
||||
*/
|
||||
public List<GrBiStStats> selectGrBiStStatsList(GrBiStStats GrBiStStats);
|
||||
|
||||
/**
|
||||
* 新增库存全品种统计表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGrBiStStats(GrBiStStats GrBiStStats);
|
||||
|
||||
/**
|
||||
* 修改库存全品种统计表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGrBiStStats(GrBiStStats GrBiStStats);
|
||||
|
||||
/**
|
||||
* 删除库存全品种统计表
|
||||
*
|
||||
* @param ID 库存全品种统计表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStStatsByID(String ID);
|
||||
|
||||
/**
|
||||
* 批量删除库存全品种统计表
|
||||
*
|
||||
* @param IDs 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStStatsByIDs(String[] IDs);
|
||||
|
||||
@DS(value = "#dataSourceType")
|
||||
List<GrBiStStats> getBusinessRealList(@Param("dataSourceType") String dataSourceType);
|
||||
@DS(value = "#dataSourceType")
|
||||
int deleteOldBusinessReal(@Param("dataSourceType") String dataSourceType);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public interface NewGrBiSaAggMapper extends BaseMapper<NewGrBiSaAgg>
|
||||
*/
|
||||
@DataPermission(enable = false)
|
||||
@DS(value = "#dataSourceType")
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(@Param("dataSourceType") String dataSourceType, @Param("saAggParam")SaAggParam saAggParam, @Param("params") Map<String, Object> params);
|
||||
public List<NewGrBiSaAgg> selectNewGrBiSaAggList(@Param("dataSourceType") String dataSourceType, @Param("saAggParam")SaAggParam saAggParam, @Param("params") Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 新增综合销售情况明细
|
||||
|
||||
@@ -80,4 +80,14 @@ public interface NewGrBiSaAggMonthCountMapper extends BaseMapper<NewGrBiSaAggMon
|
||||
@DS(value = "#dataSourceType")
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggGroupMonthList(@Param("dataSourceType") String dataSourceType, @Param("saAggParam") SaAggParam saAggParam, @Param("params") Map<String, Object> params, @Param("groupFieldList")List<String> groupFieldList);
|
||||
|
||||
/**
|
||||
* 批量查询综合销售情况明细列表 -月度
|
||||
*
|
||||
* @param saAggParam 综合销售情况明细参数
|
||||
* @return 综合销售情况明细集合
|
||||
*/
|
||||
@DataPermission(enable = false)
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@@ -34,4 +34,14 @@ public interface OracleProcedureMapper {
|
||||
@DataPermission(enable = false)
|
||||
void callUpdateCore(@Param("dataSourceType") String dataSourceType);
|
||||
|
||||
/**
|
||||
* 调用 Oracle 存储过程 - 示例
|
||||
*
|
||||
* @param dataSourceType 存储过程参数
|
||||
* @return 执行结果
|
||||
*/
|
||||
@DS(value = "#dataSourceType")
|
||||
@DataPermission(enable = false)
|
||||
void callErpDataCore(@Param("dataSourceType") String dataSourceType, @Param("pastYear") Integer pastYear, @Param("pastMonth") Integer pastMonth,@Param("currentYear") Integer currentYear, @Param("currentMonth") Integer currentMonth);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SaAggParam {
|
||||
private String useYear;
|
||||
private String useMonth;
|
||||
private String useYearStart;
|
||||
private String useYearEnd;
|
||||
private String useMonthStart;
|
||||
@@ -13,6 +15,7 @@ public class SaAggParam {
|
||||
private List<String> customName;
|
||||
private List<String> zoneName;
|
||||
private List<String> saleTypeName;
|
||||
private List<String> effectName;
|
||||
private List<String> salerName;
|
||||
private List<String> dosageName;
|
||||
private List<String> stdGoodsName;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.lideeyunji.core.framework.service;
|
||||
|
||||
import com.lideeyunji.core.framework.entity.GrBiStStats;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存全品种统计表Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
public interface IGrBiStStatsService
|
||||
{
|
||||
/**
|
||||
* 查询库存全品种统计表
|
||||
*
|
||||
* @param ID 库存全品种统计表主键
|
||||
* @return 库存全品种统计表
|
||||
*/
|
||||
public GrBiStStats selectGrBiStStatsByID(String ID);
|
||||
|
||||
/**
|
||||
* 查询库存全品种统计表列表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 库存全品种统计表集合
|
||||
*/
|
||||
public List<GrBiStStats> selectGrBiStStatsList(GrBiStStats GrBiStStats);
|
||||
|
||||
/**
|
||||
* 新增库存全品种统计表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGrBiStStats(GrBiStStats GrBiStStats);
|
||||
|
||||
/**
|
||||
* 修改库存全品种统计表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGrBiStStats(GrBiStStats GrBiStStats);
|
||||
|
||||
/**
|
||||
* 批量删除库存全品种统计表
|
||||
*
|
||||
* @param IDs 需要删除的库存全品种统计表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStStatsByIDs(String[] IDs);
|
||||
|
||||
/**
|
||||
* 删除库存全品种统计表信息
|
||||
*
|
||||
* @param ID 库存全品种统计表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGrBiStStatsByID(String ID);
|
||||
|
||||
void generateStStats(String dataSourceType);
|
||||
}
|
||||
@@ -68,4 +68,6 @@ public interface INewGrBiSaAggMonthCountService
|
||||
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggGroupMonthList(Map<String, Object> params, List<String> groupFieldList);
|
||||
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggGroupNoMonthNoYearList(Map<String, Object> params, List<String> groupFieldList);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.lideeyunji.core.framework.service;
|
||||
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 综合销售情况明细Service接口
|
||||
*
|
||||
@@ -31,7 +30,7 @@ public interface INewGrBiSaAggService
|
||||
* @param params 综合销售情况明细
|
||||
* @return 综合销售情况明细集合
|
||||
*/
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(Map<String, Object> params);
|
||||
public List<NewGrBiSaAgg> selectNewGrBiSaAggList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 新增综合销售情况明细
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GrBiSaSetdtlServiceImpl extends ServiceImpl<GrBiSaSetdtlMapper, GrB
|
||||
|
||||
//本地不存在空的情况 之前会手动导入的情况
|
||||
//查询大于本地最大更新时间的oracle里的数据
|
||||
List<GrBiSaSetdtl> grBiSaSetdtlList = this.baseMapper.getByUpdateTime(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI, grBiSaSetdtl.getUPDATETIME());
|
||||
List<GrBiSaSetdtl> grBiSaSetdtlList = this.baseMapper.getByUpdateTime(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI, grBiSaSetdtl== null ? null : grBiSaSetdtl.getUPDATETIME());
|
||||
|
||||
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.lideeyunji.core.framework.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lideeyunji.core.framework.entity.GrBiStStats;
|
||||
import com.lideeyunji.core.framework.mapper.GrBiStStatsMapper;
|
||||
import com.lideeyunji.core.framework.service.IGrBiStStatsService;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存全品种统计表Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GrBiStStatsServiceImpl extends ServiceImpl<GrBiStStatsMapper, GrBiStStats> implements IGrBiStStatsService
|
||||
{
|
||||
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
@DS(value = "#dataSourceType")
|
||||
public void generateStStats(String dataSourceType) {
|
||||
// 获取数据
|
||||
List<GrBiStStats> grBiSaSetdtlList = this.baseMapper.getBusinessRealList(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
|
||||
if (CollUtil.isEmpty(grBiSaSetdtlList)) {
|
||||
return;
|
||||
}
|
||||
//保存数据
|
||||
int reNum = this.baseMapper.deleteOldBusinessReal(lideeYunJiBaseConstant.DS_ERP_BI_DATA);
|
||||
log.info("删除数量:{}", reNum);
|
||||
for (GrBiStStats grBiSaSetdtl : grBiSaSetdtlList) {
|
||||
int re = this.baseMapper.insert(grBiSaSetdtl);
|
||||
if (re < 1) {
|
||||
throw new RuntimeException("批量新增异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询库存全品种统计表
|
||||
*
|
||||
* @param ID 库存全品种统计表主键
|
||||
* @return 库存全品种统计表
|
||||
*/
|
||||
@Override
|
||||
public GrBiStStats selectGrBiStStatsByID(String ID)
|
||||
{
|
||||
return this.baseMapper.selectGrBiStStatsByID(ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存全品种统计表列表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 库存全品种统计表
|
||||
*/
|
||||
@Override
|
||||
public List<GrBiStStats> selectGrBiStStatsList(GrBiStStats GrBiStStats)
|
||||
{
|
||||
return this.baseMapper.selectGrBiStStatsList(GrBiStStats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存全品种统计表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGrBiStStats(GrBiStStats GrBiStStats)
|
||||
{
|
||||
return this.baseMapper.insertGrBiStStats(GrBiStStats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存全品种统计表
|
||||
*
|
||||
* @param GrBiStStats 库存全品种统计表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateGrBiStStats(GrBiStStats GrBiStStats)
|
||||
{
|
||||
return this.baseMapper.updateGrBiStStats(GrBiStStats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除库存全品种统计表
|
||||
*
|
||||
* @param IDs 需要删除的库存全品种统计表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGrBiStStatsByIDs(String[] IDs)
|
||||
{
|
||||
return this.baseMapper.deleteGrBiStStatsByIDs(IDs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存全品种统计表信息
|
||||
*
|
||||
* @param ID 库存全品种统计表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGrBiStStatsByID(String ID)
|
||||
{
|
||||
return this.baseMapper.deleteGrBiStStatsByID(ID);
|
||||
}
|
||||
}
|
||||
@@ -104,4 +104,9 @@ public class NewGrBiSaAggMonthCountServiceImpl extends ServiceImpl<NewGrBiSaAggM
|
||||
SaAggParam saAggParam = NewGrBiSaAggServiceImpl.createParam(params);
|
||||
return this.baseMapper.selectNewGrBiSaAggGroupMonthList(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam,params, groupFieldList);
|
||||
}
|
||||
@Override
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggGroupNoMonthNoYearList(Map<String, Object> params, List<String> groupFieldList){
|
||||
SaAggParam saAggParam = NewGrBiSaAggServiceImpl.createParam(params);
|
||||
return this.baseMapper.selectNewGrBiSaAggGroupNoMonthNoYearList(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam,params, groupFieldList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,26 @@
|
||||
package com.lideeyunji.core.framework.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
|
||||
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lideeyunji.core.framework.entity.GrBiSaAgg;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
|
||||
import com.lideeyunji.core.framework.mapper.NewGrBiSaAggMapper;
|
||||
import com.lideeyunji.core.framework.params.SaAggParam;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggService;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
|
||||
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.lideeyunji.core.framework.mapper.NewGrBiSaAggMapper;
|
||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
|
||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 综合销售情况明细Service业务层处理
|
||||
@@ -139,7 +134,7 @@ public class NewGrBiSaAggServiceImpl extends ServiceImpl<NewGrBiSaAggMapper, New
|
||||
* @return 综合销售情况明细
|
||||
*/
|
||||
@Override
|
||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(Map<String, Object> params)
|
||||
public List<NewGrBiSaAgg> selectNewGrBiSaAggList(Map<String, Object> params)
|
||||
{
|
||||
SaAggParam saAggParam = createParam(params);
|
||||
return this.baseMapper.selectNewGrBiSaAggList(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam, params);
|
||||
@@ -148,6 +143,12 @@ public class NewGrBiSaAggServiceImpl extends ServiceImpl<NewGrBiSaAggMapper, New
|
||||
|
||||
public static SaAggParam createParam(Map<String, Object> params) {
|
||||
SaAggParam saAggParam = new SaAggParam();
|
||||
if(params.containsKey("useYear")){
|
||||
saAggParam.setUseYear(params.get("useYear").toString());
|
||||
}
|
||||
if(params.containsKey("useMonth")){
|
||||
saAggParam.setUseMonth(params.get("useMonth").toString());
|
||||
}
|
||||
if (params.containsKey("useYearStart")) {
|
||||
saAggParam.setUseYearStart(params.get("useYearStart").toString());
|
||||
}
|
||||
@@ -166,11 +167,17 @@ public class NewGrBiSaAggServiceImpl extends ServiceImpl<NewGrBiSaAggMapper, New
|
||||
if (params.containsKey("stdGoodsName")) {
|
||||
saAggParam.setStdGoodsName(Arrays.asList(params.get("stdGoodsName").toString().split( ",")));
|
||||
}
|
||||
if (params.containsKey("goodsName")) {
|
||||
saAggParam.setGoodsName(Arrays.asList(params.get("goodsName").toString().split( ",")));
|
||||
}
|
||||
if (params.containsKey("zoneName")) {
|
||||
saAggParam.setZoneName(Arrays.asList(params.get("zoneName").toString().split( ",")));
|
||||
}
|
||||
if (params.containsKey("saletypeName")) {
|
||||
saAggParam.setSaleTypeName(Arrays.asList(params.get("saletypeName").toString().split( ",")));
|
||||
if (params.containsKey("saleTypeName")) {
|
||||
saAggParam.setSaleTypeName(Arrays.asList(params.get("saleTypeName").toString().split( ",")));
|
||||
}
|
||||
if (params.containsKey("effectName")) {
|
||||
saAggParam.setEffectName(Arrays.asList(params.get("effectName").toString().split( ",")));
|
||||
}
|
||||
if (params.containsKey("dosageName")) {
|
||||
saAggParam.setDosageName(Arrays.asList(params.get("dosageName").toString().split( ",")));
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
select id,name from system_dept
|
||||
</select>
|
||||
|
||||
<select id="getAllSblxNameList" resultType="map">
|
||||
select id,industry_name from dev_sblx where is_deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getUserIdByNikeName" resultType="long">
|
||||
@@ -180,4 +184,15 @@
|
||||
where sup.is_deleted=0 and sp.is_deleted=0
|
||||
and sp.tenant_id =#{tenantId}
|
||||
</select>
|
||||
|
||||
<!--获取所有设备类型名称列表-->
|
||||
<select id="getAllSblxNameList" resultType="java.util.Map">
|
||||
SELECT
|
||||
id,
|
||||
industry_name
|
||||
FROM
|
||||
dev_sblx
|
||||
WHERE
|
||||
is_deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.lideeyunji.core.framework.mapper.GrBiStStatsMapper">
|
||||
|
||||
<resultMap type="com.lideeyunji.core.framework.entity.GrBiStStats" id="GrBiStStatsResult">
|
||||
<result property="id" column="ID"/>
|
||||
<result property="goodsId" column="GOODSID"/>
|
||||
<result property="goodsName" column="GOODSNAME"/>
|
||||
<result property="goodsType" column="GOODSTYPE"/>
|
||||
<result property="goodsUnit" column="GOODSUNIT"/>
|
||||
<result property="remQty" column="REMQTY"/>
|
||||
<result property="remMoney" column="REMMONEY"/>
|
||||
<result property="monthSaMoney" column="MONTHSAMONEY"/>
|
||||
<result property="skSa" column="SKSA"/>
|
||||
<result property="thisSaMoney" column="THISSAMONEY"/>
|
||||
<result property="thisProfit" column="THISPROFIT"/>
|
||||
<result property="thisProfitRate" column="THISPROFITRATE"/>
|
||||
<result property="maxAge" column="MAXAGE"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGrBiStStatsVo">
|
||||
select ID, GOODSID, GOODSNAME, GOODSTYPE, GOODSUNIT, REMQTY, REMMONEY, MONTHSAMONEY, SKSA, THISSAMONEY, THISPROFIT, THISPROFITRATE,MAXAGE from gr_bi_st_stats
|
||||
</sql>
|
||||
<select id="getBusinessRealList" resultMap="GrBiStStatsResult">
|
||||
<include refid="selectGrBiStStatsVo"/>
|
||||
</select>
|
||||
<delete id="deleteOldBusinessReal">
|
||||
delete from gr_bi_st_stats
|
||||
</delete>
|
||||
<select id="selectGrBiStStatsList" parameterType="com.lideeyunji.core.framework.entity.GrBiStStats" resultMap="GrBiStStatsResult">
|
||||
<include refid="selectGrBiStStatsVo"/>
|
||||
<where>
|
||||
<if test="id != null and id != ''"> and ID = #{id}</if>
|
||||
<if test="goodsId != null and goodsId != ''"> and GOODSID = #{goodsId}</if>
|
||||
<if test="goodsName != null and goodsName != ''"> and GOODSNAME = #{goodsName}</if>
|
||||
<if test="goodsType != null and goodsType != ''"> and GOODSTYPE = #{goodsType}</if>
|
||||
<if test="goodsUnit != null and goodsUnit != ''"> and GOODSUNIT = #{goodsUnit}</if>
|
||||
<if test="remQty != null and remQty != ''"> and REMQTY = #{remQty}</if>
|
||||
<if test="remMoney != null and remMoney != ''"> and REMMONEY = #{remMoney}</if>
|
||||
<if test="monthSaMoney != null and monthSaMoney != ''"> and MONTHSAMONEY = #{monthSaMoney}</if>
|
||||
<if test="skSa != null and skSa != ''"> and SKSA = #{skSa}</if>
|
||||
<if test="thisSaMoney != null and thisSaMoney != ''"> and THISSAMONEY = #{thisSaMoney}</if>
|
||||
<if test="thisProfit != null and thisProfit != ''"> and THISPROFIT = #{thisProfit}</if>
|
||||
<if test="thisProfitRate != null and thisProfitRate != ''"> and THISPROFITRATE = #{thisProfitRate}</if>
|
||||
<if test="maxAge != null and maxAge != ''"> and MAXAGE = #{maxAge}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectGrBiStStatsByID" parameterType="String" resultMap="GrBiStStatsResult">
|
||||
<include refid="selectGrBiStStatsVo"/>
|
||||
where ID = #{ID}
|
||||
</select>
|
||||
|
||||
<insert id="insertGrBiStStats" parameterType="com.lideeyunji.core.framework.entity.GrBiStStats">
|
||||
insert into gr_bi_st_stats
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">ID,</if>
|
||||
<if test="goodsId != null">GOODSID,</if>
|
||||
<if test="goodsName != null">GOODSNAME,</if>
|
||||
<if test="goodsType != null">GOODSTYPE,</if>
|
||||
<if test="goodsUnit != null">GOODSUNIT,</if>
|
||||
<if test="remQty != null">REMQTY,</if>
|
||||
<if test="remMoney != null">REMMONEY,</if>
|
||||
<if test="monthSaMoney != null">MONTHSAMONEY,</if>
|
||||
<if test="skSa != null">SKSA,</if>
|
||||
<if test="thisSaMoney != null">THISSAMONEY,</if>
|
||||
<if test="thisProfit != null">THISPROFIT,</if>
|
||||
<if test="thisProfitRate != null">THISPROFITRATE,</if>
|
||||
<if test="maxAge != null">MAXAGE,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id!= null">#{id},</if>
|
||||
<if test="goodsId != null">#{goodsId},</if>
|
||||
<if test="goodsName != null">#{goodsName},</if>
|
||||
<if test="goodsType != null">#{goodsType},</if>
|
||||
<if test="goodsUnit != null">#{goodsUnit},</if>
|
||||
<if test="remQty != null">#{remQty},</if>
|
||||
<if test="remMoney != null">#{remMoney},</if>
|
||||
<if test="monthSaMoney != null">#{monthSaMoney},</if>
|
||||
<if test="skSa != null">#{skSa},</if>
|
||||
<if test="thisSaMoney != null">#{thisSaMoney},</if>
|
||||
<if test="thisProfit != null">#{thisProfit},</if>
|
||||
<if test="thisProfitRate != null">#{thisProfitRate},</if>
|
||||
<if test="maxAge != null">#{maxAge},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateGrBiStStats" parameterType="com.lideeyunji.core.framework.entity.GrBiStStats">
|
||||
update gr_bi_st_stats
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="goodsId!= null">GOODSID = #{goodsId},</if>
|
||||
<if test="goodsName!= null">GOODSNAME = #{goodsName},</if>
|
||||
<if test="goodsType!= null">GOODSTYPE = #{goodsType},</if>
|
||||
<if test="goodsUnit!= null">GOODSUNIT = #{goodsUnit},</if>
|
||||
<if test="remQty!= null">REMQTY = #{remQty},</if>
|
||||
<if test="remMoney!= null">REMMONEY = #{remMoney},</if>
|
||||
<if test="monthSaMoney!= null">MONTHSAMONEY = #{monthSaMoney},</if>
|
||||
<if test="skSa!= null">SKSA = #{skSa},</if>
|
||||
<if test="thisSaMoney != null">THISSAMONEY = #{thisSaMoney},</if>
|
||||
<if test="thisProfit != null">THISPROFIT = #{thisProfit},</if>
|
||||
<if test="thisProfitRate != null">THISPROFITRATE = #{thisProfitRate},</if>
|
||||
<if test="maxAge != null">MAXAGE = #{maxAge},</if>
|
||||
</trim>
|
||||
where ID = #{ID}
|
||||
</update>
|
||||
|
||||
<delete id="deleteGrBiStStatsByID" parameterType="String">
|
||||
delete from gr_bi_st_stats where ID = #{ID}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGrBiStStatsByIDs" parameterType="String">
|
||||
delete from gr_bi_st_stats where ID in
|
||||
<foreach item="ID" collection="IDs" open="(" separator="," close=")">
|
||||
#{ID}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -16,6 +16,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="customName" column="custom_name" />
|
||||
<result property="dosageId" column="dosage_id" />
|
||||
<result property="dosageName" column="dosage_name" />
|
||||
<result property="effectId" column="effect_id" />
|
||||
<result property="effectName" column="effect_name" />
|
||||
<result property="goodsId" column="goods_id" />
|
||||
<result property="goodsName" column="goods_name" />
|
||||
<result property="provinceId" column="province_id" />
|
||||
@@ -41,6 +43,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="customName" column="custom_name" />
|
||||
<result property="dosageId" column="dosage_id" />
|
||||
<result property="dosageName" column="dosage_name" />
|
||||
<result property="effectId" column="effect_id" />
|
||||
<result property="effectName" column="effect_name" />
|
||||
<result property="stdGoodsName" column="std_goods_name" />
|
||||
<result property="stdGoodsName" column="std_goods_name" />
|
||||
<result property="provinceId" column="province_id" />
|
||||
<result property="provinceName" column="province_name" />
|
||||
<result property="salerId" column="saler_id" />
|
||||
<result property="salerName" column="saler_name" />
|
||||
<result property="thisMonthSaQty" column="this_month_sa_qty" />
|
||||
<result property="lastMonthSaQty" column="last_month_sa_qty" />
|
||||
<result property="yoyMonthSaQty" column="yoy_month_sa_qty" />
|
||||
<result property="thisMonthSaMoney" column="this_month_sa_money" />
|
||||
<result property="lastMonthSaMoney" column="last_month_sa_money" />
|
||||
<result property="yoyMonthSaMoney" column="yoy_month_sa_money" />
|
||||
<result property="thisMonthProfit" column="this_month_profit" />
|
||||
<result property="lastMonthProfit" column="last_month_profit" />
|
||||
<result property="yoyMonthProfit" column="yoy_month_profit" />
|
||||
<result property="thisMonthCost" column="this_month_cost" />
|
||||
<result property="lastMonthCost" column="last_month_cost" />
|
||||
<result property="yoyMonthCost" column="yoy_month_cost" />
|
||||
<result property="thisMonthProfitRate" column="this_month_profit_rate" />
|
||||
<result property="lastMonthProfitRate" column="last_month_profit_rate" />
|
||||
<result property="lastMonthProfitShare" column="last_month_profit_share" />
|
||||
<result property="thisMonthSaMoneyShare" column="this_month_sa_money_share" />
|
||||
<result property="thisMonthProfitShare" column="this_month_profit_share" />
|
||||
<result property="thisMonthSaMoney_s" column="thissamoney_s" />
|
||||
<result property="thisMonthProfit_s" column="thisprofit_s" />
|
||||
<result property="monthsaqty_yoy" column="monthsaqty_yoy" />
|
||||
<result property="monthsamoney_yoy" column="monthsamoney_yoy" />
|
||||
<result property="lastMonthSaMoney_yoy" column="lastMonthSaMoney_yoy" />
|
||||
<result property="this_month_cost_yoy" column="this_month_cost_yoy" />
|
||||
<result property="monthprofit_yoy" column="monthprofit_yoy" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.lideeyunji.core.framework.entity.NewGrBiSaAgg" id="NewGrBiSaAggCountResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ny" column="ny" />
|
||||
<result property="useYear" column="use_year" />
|
||||
<result property="useMonth" column="use_month" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="zoneName" column="zone_name" />
|
||||
<result property="saleTypeId" column="sale_type_id" />
|
||||
<result property="saleTypeName" column="sale_type_name" />
|
||||
<result property="customId" column="custom_id" />
|
||||
<result property="customName" column="custom_name" />
|
||||
<result property="dosageId" column="dosage_id" />
|
||||
<result property="dosageName" column="dosage_name" />
|
||||
<result property="effectId" column="effect_id" />
|
||||
<result property="effectName" column="effect_name" />
|
||||
<result property="stdGoodsName" column="std_goods_name" />
|
||||
<result property="goodsName" column="goods_name" />
|
||||
<result property="goodsId" column="goods_id" />
|
||||
<result property="stdGoodsName" column="std_goods_name" />
|
||||
<result property="provinceId" column="province_id" />
|
||||
<result property="provinceName" column="province_name" />
|
||||
@@ -73,74 +127,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNewGrBiSaAggVo">
|
||||
select id, use_year, use_month, zone_id, zone_name, sale_type_id, sale_type_name, custom_id, custom_name, dosage_id, dosage_name, goods_id, goods_name, province_id, province_name, saler_id, saler_name, this_month_sa_qty, this_month_sa_money, this_month_cost, this_month_profit from new_gr_bi_sa_agg
|
||||
select id, use_year, use_month, zone_id, zone_name, sale_type_id, sale_type_name, custom_id, custom_name, dosage_id, dosage_name, effect_id, effect_name, goods_id, goods_name, province_id, province_name, saler_id, saler_name, this_month_sa_qty, this_month_sa_money, this_month_cost, this_month_profit from new_gr_bi_sa_agg
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="generateSalesReport" resultType="com.lideeyunji.core.framework.entity.NewGrBiSaAgg">
|
||||
select a.USEYEAR as use_year,
|
||||
a.USEMONTH as use_month,
|
||||
goods.goodsid as goods_id,
|
||||
goods.GOODSNAME as goods_name,
|
||||
goods.STDGOODSNAME as std_goods_name,
|
||||
sales.SALEZONEID as zone_id,
|
||||
sales.SALEZONENAME as zone_name,
|
||||
province.PROVINCEID as province_id,
|
||||
province.PROVINCENAME as province_name,
|
||||
salestype.SALETYPEID as sale_type_id,
|
||||
salestype.SALETYPENAME as sale_type_name,
|
||||
dosage.DOSAGEID as dosage_id,
|
||||
dosage.DOSAGENAME as dosage_name,
|
||||
custom.CUSTOMID as custom_id,
|
||||
custom.CUSTOMNAME as custom_name,
|
||||
saler.SALERID as saler_id,
|
||||
saler.SALERNAME as saler_name,
|
||||
a.`本月销量` as this_month_sa_qty,
|
||||
a.`含税销售额` as this_month_sa_money,
|
||||
a.`销售成本` as this_month_cost,
|
||||
a.`毛利额` as this_month_profit
|
||||
from erp_bi_data.GR_BI_PUB_GOODS as goods
|
||||
inner join erp_bi_data.GR_BI_PUB_SALEZONE as sales
|
||||
inner join erp_bi_data.GR_BI_PUB_PROVINCE as province
|
||||
inner join erp_bi_data.GR_BI_PUB_SALETYPE as salestype
|
||||
inner join erp_bi_data.GR_BI_PUB_DOSAGE as dosage
|
||||
inner join erp_bi_data.GR_BI_PUB_CUSTOM as custom
|
||||
INNER join erp_bi_data.GR_BI_PUB_SALER as saler
|
||||
left join
|
||||
(SELECT USEYEAR,
|
||||
USEMONTH,
|
||||
SALEZONEID,
|
||||
SALEZONENAME,
|
||||
PROVINCEID,
|
||||
PROVINCENAME,
|
||||
SALETYPE,
|
||||
SALETYPENAME,
|
||||
CUSTOMNAME,
|
||||
SALERNAME,
|
||||
DOSAGENAME,
|
||||
goodsid,
|
||||
GOODSNAME,
|
||||
GOODSTYPE,
|
||||
sum(SAQTY) as 本月销量,
|
||||
DOSAGEID,
|
||||
CUSTOMID,
|
||||
SALERID,
|
||||
round(SUM(SAMONEY), 2) 除税销售额,
|
||||
round(sum(SAMONEYTX), 2) 含税销售额,
|
||||
round(sum(COST), 2) 销售成本,
|
||||
round(sum(PROFIT), 2) 毛利额
|
||||
FROM GR_BI_SA_SETDTL
|
||||
where USESTATUS = 2
|
||||
GROUP BY SALETYPE, SALEZONEID, SALEZONENAME, PROVINCEID, PROVINCENAME, SALETYPE, SALETYPENAME, CUSTOMID,
|
||||
CUSTOMNAME, SALERID, SALERNAME, DOSAGEID, DOSAGENAME, GOODSID, GOODSNAME, GOODSTYPE, USEYEAR,
|
||||
USEMONTH) a
|
||||
on a.goodsid = goods.goodsid and a.SALEZONEID = sales.SALEZONEID and a.PROVINCEID = province.PROVINCEID
|
||||
and salestype.SALETYPEID = a.SALETYPE and dosage.DOSAGEID = a.DOSAGEID and
|
||||
custom.CUSTOMID = a.CUSTOMID and saler.SALERID = a.SALERID
|
||||
SELECT
|
||||
a.USEYEAR AS use_year,
|
||||
a.USEMONTH AS use_month,
|
||||
goods.GOODSID AS goods_id,
|
||||
goods.GOODSNAME AS goods_name,
|
||||
a.EFFECTID AS effect_id,
|
||||
a.EFFECTNAME AS effect_name,
|
||||
goods.STDGOODSNAME AS std_goods_name,
|
||||
sales.SALEZONEID AS zone_id,
|
||||
sales.SALEZONENAME AS zone_name,
|
||||
province.PROVINCEID AS province_id,
|
||||
province.PROVINCENAME AS province_name,
|
||||
salestype.SALETYPEID AS sale_type_id,
|
||||
salestype.SALETYPENAME AS sale_type_name,
|
||||
dosage.DOSAGEID AS dosage_id,
|
||||
dosage.DOSAGENAME AS dosage_name,
|
||||
custom.CUSTOMID AS custom_id,
|
||||
custom.CUSTOMNAME AS custom_name,
|
||||
saler.SALERID AS saler_id,
|
||||
saler.SALERNAME AS saler_name,
|
||||
sum(SAQTY) AS this_month_sa_qty,
|
||||
round(sum(SAMONEY), 2) AS this_month_sa_money, --除税销售额
|
||||
round(sum(COST), 2) AS this_month_cost,
|
||||
round(sum(PROFIT), 2) AS this_month_profit
|
||||
-- sum(SAQTY) as 本月销量,
|
||||
-- round(SUM(SAMONEY), 2) 除税销售额,
|
||||
-- round(sum(SAMONEYTX), 2) 含税销售额,
|
||||
-- round(sum(COST), 2) 销售成本,
|
||||
-- round(sum(PROFIT), 2) 毛利额
|
||||
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>
|
||||
a.USEYEAR is not NULL
|
||||
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
|
||||
</select>
|
||||
|
||||
@@ -169,6 +223,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
custom_name,
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
effect_id,
|
||||
effect_name,
|
||||
std_goods_name,
|
||||
province_id,
|
||||
province_name,
|
||||
@@ -189,6 +245,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
custom_name,
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
effect_id,
|
||||
effect_name,
|
||||
std_goods_name,
|
||||
province_id,
|
||||
province_name,
|
||||
@@ -212,6 +270,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
custom_name,
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
effect_id,
|
||||
effect_name,
|
||||
std_goods_name,
|
||||
province_id,
|
||||
province_name,
|
||||
@@ -231,6 +291,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
custom_name,
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
effect_id,
|
||||
effect_name,
|
||||
std_goods_name,
|
||||
province_id,
|
||||
province_name,
|
||||
@@ -250,6 +312,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
custom_name,
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
effect_id,
|
||||
effect_name,
|
||||
std_goods_name,
|
||||
province_id,
|
||||
province_name,
|
||||
@@ -270,6 +334,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sale_type_name,
|
||||
custom_id,
|
||||
custom_name,
|
||||
effect_id,
|
||||
effect_name,
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
std_goods_name,
|
||||
@@ -330,6 +396,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
province_id,
|
||||
sale_type_id,
|
||||
dosage_id,
|
||||
effect_id,
|
||||
custom_id,
|
||||
saler_id,
|
||||
SUM( this_month_sa_qty ) AS yoy_month_sa_qty, -- 同比月销量
|
||||
@@ -346,6 +413,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
province_id,
|
||||
sale_type_id,
|
||||
dosage_id,
|
||||
effect_id,
|
||||
custom_id,
|
||||
saler_id
|
||||
) b ON b.use_year = a.use_year-1
|
||||
@@ -355,6 +423,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND b.province_id = a.province_id
|
||||
AND b.sale_type_id = a.sale_type_id
|
||||
AND b.dosage_id = a.dosage_id
|
||||
AND b.effect_id = a.effect_id
|
||||
AND b.custom_id = a.custom_id
|
||||
AND b.saler_id = a.saler_id
|
||||
SET a.yoy_month_sa_qty = COALESCE ( b.yoy_month_sa_qty, 0 ),
|
||||
@@ -376,6 +445,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
province_id,
|
||||
sale_type_id,
|
||||
dosage_id,
|
||||
effect_id,
|
||||
custom_id,
|
||||
saler_id,
|
||||
-- 计算上个月的年月
|
||||
@@ -395,6 +465,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
province_id,
|
||||
sale_type_id,
|
||||
dosage_id,
|
||||
effect_id,
|
||||
custom_id,
|
||||
saler_id
|
||||
) AS last_month_data
|
||||
@@ -403,6 +474,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND current_month.province_id = last_month_data.province_id
|
||||
AND current_month.sale_type_id = last_month_data.sale_type_id
|
||||
AND current_month.dosage_id = last_month_data.dosage_id
|
||||
AND current_month.effect_id = last_month_data.effect_id
|
||||
AND current_month.custom_id = last_month_data.custom_id
|
||||
AND current_month.saler_id = last_month_data.saler_id
|
||||
AND last_month_data.use_year = current_month.use_year - (current_month.use_month = 1)
|
||||
@@ -423,6 +495,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
province_id,
|
||||
sale_type_id,
|
||||
dosage_id,
|
||||
effect_id,
|
||||
custom_id,
|
||||
saler_id,
|
||||
SUM( this_month_sa_qty ) AS last_year_sa_qty,
|
||||
@@ -438,6 +511,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
province_id,
|
||||
sale_type_id,
|
||||
dosage_id,
|
||||
effect_id,
|
||||
custom_id,
|
||||
saler_id
|
||||
) b ON b.use_year = a.use_year-1
|
||||
@@ -446,6 +520,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND b.province_id = a.province_id
|
||||
AND b.sale_type_id = a.sale_type_id
|
||||
AND b.dosage_id = a.dosage_id
|
||||
AND b.effect_id = a.effect_id
|
||||
AND b.custom_id = a.custom_id
|
||||
AND b.saler_id = a.saler_id
|
||||
SET a.last_year_sa_qty = COALESCE ( b.last_year_sa_qty, 0 ),
|
||||
@@ -555,7 +630,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
END,
|
||||
this_year_profit_change = ( this_year_profit - last_year_profit);
|
||||
</update>
|
||||
<select id="selectNewGrBiSaAggList" resultMap="NewGrBiSaAggMonthCountResult">
|
||||
<select id="selectNewGrBiSaAggList" resultMap="NewGrBiSaAggCountResult">
|
||||
SELECT
|
||||
ANY_VALUE (tbl_lgbsa.id) id,
|
||||
tbl_lgbsa.use_year,
|
||||
@@ -569,6 +644,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
tbl_lgbsa.custom_name,
|
||||
tbl_lgbsa.dosage_id,
|
||||
tbl_lgbsa.dosage_name,
|
||||
tbl_lgbsa.effect_id,
|
||||
tbl_lgbsa.effect_name,
|
||||
tbl_lgbsa.goods_id,
|
||||
tbl_lgbsa.goods_name,
|
||||
tbl_lgbsa.std_goods_name,
|
||||
@@ -577,7 +654,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
tbl_lgbsa.saler_id,
|
||||
tbl_lgbsa.saler_name,
|
||||
tbl_lgbsa.this_month_sa_qty AS this_month_sa_qty,
|
||||
ROUND(tbl_lgbsa.this_month_sa_money / 10000, 2) AS this_month_sa_money, -- 本月销售金额(元)
|
||||
ROUND(tbl_lgbsa.this_month_sa_money / 10000, 2) AS this_month_sa_money,
|
||||
ROUND(tbl_lgbsa.this_month_cost / 10000, 2) AS this_month_cost,
|
||||
ROUND(tbl_lgbsa.this_month_profit / 10000, 2) AS this_month_profit,
|
||||
tbl_lgbsa.last_month_sa_qty as last_month_sa_qty,
|
||||
@@ -588,13 +665,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ROUND(tbl_lgbsa.yoy_month_sa_money / 10000, 2) as yoy_month_sa_money,
|
||||
ROUND(tbl_lgbsa.yoy_month_profit / 10000, 2) as yoy_month_profit,
|
||||
ROUND(tbl_lgbsa.yoy_month_cost / 10000, 2) as yoy_month_cost,
|
||||
# CONCAT(ROUND((SELECT SUM(MONTHSAQTY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS monthsaqty_s,
|
||||
# CONCAT(ROUND((SELECT SUM(THISSAQTY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS thissaqty_s,
|
||||
# CONCAT(ROUND((SELECT SUM(LASTSAQTY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS lastsaqty_s,
|
||||
# -- 原本带CAST的字段,简化写法(CONCAT会自动转为字符串)
|
||||
# CONCAT(ROUND((SELECT SUM(MONTHSAMONEY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS monthsamoney_s,
|
||||
# CONCAT(ROUND((SELECT SUM(THISSAMONEY) FROM yunji_gr_bi_sa_agg)/100000000,2), '亿') AS thissamoney_s,
|
||||
# CONCAT(ROUND((SELECT SUM(LASTSAMONEY) FROM yunji_gr_bi_sa_agg)/100000000,2), '亿') AS lastsamoney_s,
|
||||
CASE
|
||||
WHEN (CASE WHEN tbl_lgbsa.yoy_month_sa_qty = 0 THEN IF(tbl_lgbsa.this_month_sa_qty > 0, 100, 0)
|
||||
ELSE (tbl_lgbsa.this_month_sa_qty - tbl_lgbsa.yoy_month_sa_qty) / tbl_lgbsa.yoy_month_sa_qty * 100 END) > 0 THEN
|
||||
@@ -606,8 +676,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ELSE (tbl_lgbsa.this_month_sa_qty - tbl_lgbsa.yoy_month_sa_qty) / tbl_lgbsa.yoy_month_sa_qty * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS monthsaqty_yoy,
|
||||
|
||||
-- 数量同比(原有)
|
||||
CASE
|
||||
WHEN (CASE WHEN tbl_lgbsa.yoy_month_sa_money = 0 THEN IF(tbl_lgbsa.this_month_sa_money > 0, 100, 0)
|
||||
ELSE (tbl_lgbsa.this_month_sa_money - tbl_lgbsa.yoy_month_sa_money) / tbl_lgbsa.yoy_month_sa_money * 100 END) > 0 THEN
|
||||
@@ -639,56 +707,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
CONCAT('🔴 ', ROUND((CASE WHEN tbl_lgbsa.last_month_sa_money = 0 THEN IF(tbl_lgbsa.this_month_sa_money > 0, 100, 0)
|
||||
ELSE (tbl_lgbsa.this_month_sa_money - tbl_lgbsa.last_month_sa_money) / tbl_lgbsa.last_month_sa_money * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS lastMonthSaMoney_yoy, -- 本月销售金额增长率
|
||||
END AS lastMonthSaMoney_yoy,
|
||||
ROUND(tbl_lgbsa.this_month_profit_rate * 100, 2) AS this_month_sa_money_share,
|
||||
ROUND(tbl_lgbsa.this_month_sa_money_share * 100, 2) AS this_month_profit_share
|
||||
FROM
|
||||
new_gr_bi_sa_agg tbl_lgbsa
|
||||
<where>
|
||||
<!-- 使用 (use_year * 100 + use_month) 组合成年月数值进行比较 -->
|
||||
<if test="saAggParam.useYearStart != null and saAggParam.useYearStart != '' and saAggParam.useMonthStart != null and saAggParam.useMonthStart != ''">
|
||||
AND (use_year * 100 + use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
||||
</if>
|
||||
<if test="saAggParam.useYearEnd != null and saAggParam.useYearEnd != '' and saAggParam.useMonthEnd != null and saAggParam.useMonthEnd != ''">
|
||||
AND (use_year * 100 + use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
||||
</if>
|
||||
<!--<if test="zoneId != null "> and zone_id = #{zoneId}</if>-->
|
||||
<if test="saAggParam.useYear != null and saAggParam.useYear != '' and saAggParam.useMonth != null and saAggParam.useMonth != ''">
|
||||
AND (use_year * 100 + use_month) = (#{saAggParam.useYear} * 100 + #{saAggParam.useMonth})
|
||||
</if>
|
||||
<if test="saAggParam.useYear != null and saAggParam.useYear != '' and (saAggParam.useMonth == null or saAggParam.useMonth == '' )">
|
||||
AND use_year = #{saAggParam.useYear}
|
||||
</if>
|
||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- <if test="saleTypeId != null "> and sale_type_id = #{saleTypeId}</if>-->
|
||||
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
|
||||
<foreach collection="saAggParam.saleTypeName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--<if test="customId != null "> and custom_id = #{customId}</if>-->
|
||||
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
||||
<foreach collection="saAggParam.customName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--<if test="dosageId != null "> and dosage_id = #{dosageId}</if>-->
|
||||
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
|
||||
<foreach collection="saAggParam.dosageName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--<if test="goodsId != null "> and goods_id = #{goodsId}</if>-->
|
||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--<if test="provinceId != null "> and province_id = #{provinceId}</if>-->
|
||||
<if test="saAggParam.provinceName != null and saAggParam.provinceName != ''"> and province_name in
|
||||
<foreach collection="saAggParam.provinceName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--<if test="salerId != null "> and saler_id = #{salerId}</if>-->
|
||||
<if test="saAggParam.salerName != null and saAggParam.salerName != ''"> and saler_name in
|
||||
<foreach collection="saAggParam.salerName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
|
||||
@@ -7,6 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount" id="NewGrBiSaAggMonthCountResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ny" column="ny" />
|
||||
<result property="useYearStart" column="useYearStart" />
|
||||
<result property="useYearEnd" column="useYearEnd" />
|
||||
<result property="useMonthStart" column="useMonthStart" />
|
||||
<result property="useMonthEnd" column="useMonthEnd" />
|
||||
<result property="useYear" column="use_year" />
|
||||
<result property="useMonth" column="use_month" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
@@ -257,6 +261,371 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectNewGrBiSaAggGroupNoMonthNoYearList" resultMap="NewGrBiSaAggMonthCountResult">
|
||||
select
|
||||
<trim suffixOverrides=",">
|
||||
CONCAT (#{params.useYearMonthStart} , '~' , #{params.useYearMonthEnd}) as ny,
|
||||
#{saAggParam.useYearStart} as useYearStart,
|
||||
#{saAggParam.useYearEnd} as useYearEnd,
|
||||
#{saAggParam.useMonthStart} as useMonthStart,
|
||||
#{saAggParam.useMonthEnd} as useMonthEnd,
|
||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||
current_month.custom_id,
|
||||
current_month.custom_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('zoneName') || params.containsKey('zoneName')">
|
||||
current_month.zone_id,
|
||||
current_month.zone_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('saleTypeName') || params.containsKey('saleTypeName')">
|
||||
current_month.sale_type_id,
|
||||
current_month.sale_type_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
current_month.saler_id,
|
||||
current_month.saler_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
current_month.dosage_id,
|
||||
current_month.dosage_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
current_month.std_goods_name,
|
||||
</if>
|
||||
current_month.this_month_sa_qty AS this_month_sa_qty,
|
||||
ROUND(current_month.this_month_sa_money / 10000, 2) AS this_month_sa_money,
|
||||
ROUND(current_month.this_month_profit / 10000, 2) AS this_month_profit,
|
||||
ROUND(current_month.this_month_cost / 10000, 2) AS this_month_cost,
|
||||
COALESCE (ROUND( current_month.this_month_sa_money/total_month_data.this_month_sa_money_sum * 100, 2), 0 ) as this_month_sa_money_share,
|
||||
COALESCE (ROUND( current_month.this_month_profit/total_month_data.this_month_profit_sum * 100, 2), 0 ) as this_month_profit_share,
|
||||
|
||||
<if test="params.isOneYear" >
|
||||
ROUND(yoy_month.yoy_month_sa_qty / 10000, 2) AS yoy_month_sa_qty,
|
||||
ROUND(yoy_month.yoy_month_sa_money / 10000, 2) AS yoy_month_sa_money,
|
||||
ROUND(yoy_month.yoy_month_profit / 10000, 2) AS yoy_month_profit,
|
||||
ROUND(yoy_month.yoy_month_cost / 10000, 2) AS yoy_month_cost,
|
||||
CASE WHEN (CASE WHEN yoy_month.yoy_month_sa_qty = 0 THEN IF(current_month.this_month_sa_qty > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_qty - yoy_month.yoy_month_sa_qty) / yoy_month.yoy_month_sa_qty * 100 END) > 0 THEN
|
||||
CONCAT('🟢 ', ROUND((CASE WHEN yoy_month.yoy_month_sa_qty = 0 THEN IF(current_month.this_month_sa_qty > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_qty - yoy_month.yoy_month_sa_qty) / yoy_month.yoy_month_sa_qty * 100 END), 2))
|
||||
WHEN (CASE WHEN yoy_month.yoy_month_sa_qty = 0 THEN IF(current_month.this_month_sa_qty > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_qty - yoy_month.yoy_month_sa_qty) / yoy_month.yoy_month_sa_qty * 100 END)<0 THEN
|
||||
CONCAT('🔴 ', ROUND((CASE WHEN yoy_month.yoy_month_sa_qty = 0 THEN IF(current_month.this_month_sa_qty > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_qty - yoy_month.yoy_month_sa_qty) / yoy_month.yoy_month_sa_qty * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS monthsaqty_yoy,
|
||||
|
||||
CASE WHEN (CASE WHEN yoy_month.yoy_month_sa_money = 0 THEN IF(current_month.this_month_sa_money > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_money - yoy_month.yoy_month_sa_money) / yoy_month.yoy_month_sa_money * 100 END) > 0 THEN
|
||||
CONCAT('🟢 ', ROUND((CASE WHEN yoy_month.yoy_month_sa_money = 0 THEN IF(current_month.this_month_sa_money > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_money - yoy_month.yoy_month_sa_money) / yoy_month.yoy_month_sa_money * 100 END), 2))
|
||||
WHEN (CASE WHEN yoy_month.yoy_month_sa_money = 0 THEN IF(current_month.this_month_sa_money > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_money - yoy_month.yoy_month_sa_money) / yoy_month.yoy_month_sa_money * 100 END)<0 THEN
|
||||
CONCAT('🔴 ', ROUND((CASE WHEN yoy_month.yoy_month_sa_money = 0 THEN IF(current_month.this_month_sa_money > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_money - yoy_month.yoy_month_sa_money) / yoy_month.yoy_month_sa_money * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS monthsamoney_yoy,
|
||||
|
||||
CASE WHEN (CASE WHEN yoy_month.yoy_month_cost = 0 THEN IF(current_month.this_month_cost > 0, 100, 0)
|
||||
ELSE (current_month.this_month_cost - yoy_month.yoy_month_cost) / yoy_month.yoy_month_cost * 100 END) > 0 THEN
|
||||
CONCAT('🟢 ', ROUND((CASE WHEN yoy_month.yoy_month_cost = 0 THEN IF(current_month.this_month_cost > 0, 100, 0)
|
||||
ELSE (current_month.this_month_cost - yoy_month.yoy_month_cost) / yoy_month.yoy_month_cost * 100 END), 2))
|
||||
WHEN (CASE WHEN yoy_month.yoy_month_cost = 0 THEN IF(current_month.this_month_cost > 0, 100, 0)
|
||||
ELSE (current_month.this_month_cost - yoy_month.yoy_month_cost) / yoy_month.yoy_month_cost * 100 END)<0 THEN
|
||||
CONCAT('🔴 ', ROUND((CASE WHEN yoy_month.yoy_month_cost = 0 THEN IF(current_month.this_month_cost > 0, 100, 0)
|
||||
ELSE (current_month.this_month_cost - yoy_month.yoy_month_cost) / yoy_month.yoy_month_cost * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS this_month_cost_yoy,
|
||||
|
||||
CASE WHEN (CASE WHEN yoy_month.yoy_month_profit = 0 THEN IF(current_month.this_month_profit > 0, 100, 0)
|
||||
ELSE (current_month.this_month_profit - yoy_month.yoy_month_profit) / yoy_month.yoy_month_profit * 100 END) > 0 THEN
|
||||
CONCAT('🟢 ', ROUND((CASE WHEN yoy_month.yoy_month_profit = 0 THEN IF(current_month.this_month_profit > 0, 100, 0)
|
||||
ELSE (current_month.this_month_profit - yoy_month.yoy_month_profit) / yoy_month.yoy_month_profit * 100 END), 2))
|
||||
WHEN (CASE WHEN yoy_month.yoy_month_profit = 0 THEN IF(current_month.this_month_profit > 0, 100, 0)
|
||||
ELSE (current_month.this_month_profit - yoy_month.yoy_month_profit) / yoy_month.yoy_month_profit * 100 END)<0 THEN
|
||||
CONCAT('🔴 ', ROUND((CASE WHEN yoy_month.yoy_month_profit = 0 THEN IF(current_month.this_month_profit > 0, 100, 0)
|
||||
ELSE (current_month.this_month_profit - yoy_month.yoy_month_profit) / yoy_month.yoy_month_profit * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS monthprofit_yoy,
|
||||
</if>
|
||||
</trim>
|
||||
FROM ( SELECT
|
||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||
custom_id,
|
||||
custom_name ,
|
||||
</if>
|
||||
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
std_goods_name,
|
||||
</if>
|
||||
|
||||
<if test="groupFieldList.contains('zoneName') || params.containsKey('zoneName')">
|
||||
zone_id,
|
||||
zone_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('saleTypeName') || params.containsKey('saleTypeName')">
|
||||
sale_type_id,
|
||||
sale_type_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
</if>
|
||||
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
saler_name,
|
||||
</if>
|
||||
ifnull(sum(this_month_sa_qty), 0) AS this_month_sa_qty,
|
||||
ifnull(sum(this_month_sa_money), 0) AS this_month_sa_money,
|
||||
ifnull(sum(this_month_cost), 0) AS this_month_cost,
|
||||
ifnull(sum(this_month_profit), 0) AS this_month_profit
|
||||
FROM
|
||||
new_gr_bi_sa_agg_month_count
|
||||
<where>
|
||||
(use_year * 100 + use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
||||
AND (use_year * 100 + use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
|
||||
<foreach collection="saAggParam.saleTypeName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
||||
<foreach collection="saAggParam.customName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
|
||||
<foreach collection="saAggParam.dosageName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.provinceName != null and saAggParam.provinceName != ''"> and province_name in
|
||||
<foreach collection="saAggParam.provinceName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.salerName != null and saAggParam.salerName != ''"> and saler_name in
|
||||
<foreach collection="saAggParam.salerName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="saAggParam.stdGoodsName != null and saAggParam.stdGoodsName != ''"> and std_goods_name in
|
||||
<foreach collection="saAggParam.stdGoodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
<trim suffixOverrides=",">
|
||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||
custom_id,
|
||||
custom_name ,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
std_goods_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('zoneName') || params.containsKey('zoneName')">
|
||||
zone_id,
|
||||
zone_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('saleTypeName') || params.containsKey('saleTypeName')">
|
||||
sale_type_id,
|
||||
sale_type_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
saler_name,
|
||||
</if>
|
||||
</trim>
|
||||
) AS current_month
|
||||
<if test="params.isOneYear" >
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||
custom_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
std_goods_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('zoneName') || params.containsKey('zoneName')">
|
||||
zone_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('saleTypeName') || params.containsKey('saleTypeName')">
|
||||
sale_type_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
dosage_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
</if>
|
||||
ifnull(SUM(this_month_sa_qty), 0) AS yoy_month_sa_qty,
|
||||
ifnull(SUM(this_month_sa_money), 0) AS yoy_month_sa_money,
|
||||
ifnull(SUM(this_month_cost), 0) as yoy_month_cost,
|
||||
ifnull(SUM(this_month_profit), 0) AS yoy_month_profit
|
||||
FROM new_gr_bi_sa_agg_month_count
|
||||
<where>
|
||||
((use_year+1) * 100 + use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
||||
AND ((use_year+1) * 100 + use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
|
||||
<foreach collection="saAggParam.saleTypeName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
||||
<foreach collection="saAggParam.customName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
|
||||
<foreach collection="saAggParam.dosageName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.provinceName != null and saAggParam.provinceName != ''"> and province_name in
|
||||
<foreach collection="saAggParam.provinceName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.salerName != null and saAggParam.salerName != ''"> and saler_name in
|
||||
<foreach collection="saAggParam.salerName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="saAggParam.stdGoodsName != null and saAggParam.stdGoodsName != ''"> and std_goods_name in
|
||||
<foreach collection="saAggParam.stdGoodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
<trim suffixOverrides=",">
|
||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||
custom_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
std_goods_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('zoneName') || params.containsKey('zoneName')">
|
||||
zone_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('saleTypeName') || params.containsKey('saleTypeName')">
|
||||
sale_type_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
dosage_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
</if>
|
||||
</trim>
|
||||
) yoy_month ON
|
||||
<trim prefixOverrides="and">
|
||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||
AND yoy_month.custom_id = current_month.custom_id
|
||||
</if>
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
AND yoy_month.std_goods_name = current_month.std_goods_name
|
||||
</if>
|
||||
<if test="groupFieldList.contains('zoneName') || params.containsKey('zoneName')">
|
||||
AND yoy_month.zone_id = current_month.zone_id
|
||||
</if>
|
||||
<if test="groupFieldList.contains('saleTypeName') || params.containsKey('saleTypeName')">
|
||||
AND yoy_month.sale_type_id = current_month.sale_type_id
|
||||
</if>
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
AND yoy_month.dosage_id = current_month.dosage_id
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
AND yoy_month.saler_id = current_month.saler_id
|
||||
</if>
|
||||
</trim>
|
||||
|
||||
</if>
|
||||
|
||||
, (
|
||||
SELECT
|
||||
SUM( this_month_sa_money ) AS this_month_sa_money_sum,
|
||||
SUM(this_month_profit) AS this_month_profit_sum
|
||||
FROM new_gr_bi_sa_agg
|
||||
WHERE
|
||||
(use_year * 100 + use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
||||
AND (use_year * 100 + use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
||||
) total_month_data
|
||||
<where>
|
||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and current_month.zone_name in
|
||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and current_month.sale_type_name in
|
||||
<foreach collection="saAggParam.saleTypeName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and current_month.custom_name in
|
||||
<foreach collection="saAggParam.customName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and current_month.dosage_name in
|
||||
<foreach collection="saAggParam.dosageName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and current_month.goods_name in
|
||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.provinceName != null and saAggParam.provinceName != ''"> and current_month.province_name in
|
||||
<foreach collection="saAggParam.provinceName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.salerName != null and saAggParam.salerName != ''"> and current_month.saler_name in
|
||||
<foreach collection="saAggParam.salerName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="saAggParam.stdGoodsName != null and saAggParam.stdGoodsName != ''"> and current_month.std_goods_name in
|
||||
<foreach collection="saAggParam.stdGoodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectNewGrBiSaAggGroupMonthList" resultMap="NewGrBiSaAggMonthCountResult">
|
||||
select
|
||||
current_month.use_month ,
|
||||
@@ -312,6 +681,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ELSE (current_month.this_month_sa_qty - yoy_month.yoy_month_sa_qty) / yoy_month.yoy_month_sa_qty * 100 END)<0 THEN
|
||||
CONCAT('🔴 ', ROUND((CASE WHEN yoy_month.yoy_month_sa_qty = 0 THEN IF(current_month.this_month_sa_qty > 0, 100, 0)
|
||||
ELSE (current_month.this_month_sa_qty - yoy_month.yoy_month_sa_qty) / yoy_month.yoy_month_sa_qty * 100 END), 2))
|
||||
ELSE '0.00'
|
||||
END AS monthsaqty_yoy,
|
||||
|
||||
CASE WHEN (CASE WHEN yoy_month.yoy_month_sa_money = 0 THEN IF(current_month.this_month_sa_money > 0, 100, 0)
|
||||
@@ -392,10 +762,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
saler_name,
|
||||
</if>
|
||||
CONCAT(MAX(use_year), LPAD(MAX(use_month), 2, '0')) AS ny,
|
||||
sum(this_month_sa_qty) AS this_month_sa_qty,
|
||||
sum(this_month_sa_money) AS this_month_sa_money,
|
||||
sum(this_month_cost) AS this_month_cost,
|
||||
sum(this_month_profit) AS this_month_profit
|
||||
ifnull(sum(this_month_sa_qty), 0) AS this_month_sa_qty,
|
||||
ifnull(sum(this_month_sa_money), 0) AS this_month_sa_money,
|
||||
ifnull(sum(this_month_cost), 0) AS this_month_cost,
|
||||
ifnull(sum(this_month_profit), 0) AS this_month_profit
|
||||
FROM
|
||||
new_gr_bi_sa_agg_month_count
|
||||
<where>
|
||||
@@ -506,10 +876,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
</if>
|
||||
SUM(this_month_sa_qty) AS last_month_sa_qty,
|
||||
SUM(this_month_sa_money) AS last_month_sa_money,
|
||||
SUM(this_month_cost) AS last_month_cost,
|
||||
SUM(this_month_profit) AS last_month_profit
|
||||
ifnull(SUM(this_month_sa_qty), 0) AS last_month_sa_qty,
|
||||
ifnull(SUM(this_month_sa_money), 0) AS last_month_sa_money,
|
||||
ifnull(SUM(this_month_cost), 0) AS last_month_cost,
|
||||
ifnull(SUM(this_month_profit), 0) AS last_month_profit
|
||||
FROM new_gr_bi_sa_agg_month_count
|
||||
GROUP BY
|
||||
<trim suffixOverrides=",">
|
||||
@@ -583,10 +953,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
</if>
|
||||
SUM(this_month_sa_qty) AS yoy_month_sa_qty,
|
||||
SUM(this_month_sa_money) AS yoy_month_sa_money,
|
||||
SUM(this_month_cost) as yoy_month_cost,
|
||||
SUM(this_month_profit) AS yoy_month_profit
|
||||
ifnull(SUM(this_month_sa_qty), 0) AS yoy_month_sa_qty,
|
||||
ifnull(SUM(this_month_sa_money), 0) AS yoy_month_sa_money,
|
||||
ifnull(SUM(this_month_cost), 0) as yoy_month_cost,
|
||||
ifnull(SUM(this_month_profit), 0) AS yoy_month_profit
|
||||
FROM new_gr_bi_sa_agg_month_count
|
||||
<where>
|
||||
<!-- <if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear }- 1</if>-->
|
||||
@@ -688,8 +1058,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
use_year,
|
||||
SUM( this_month_sa_money ) AS this_month_sa_money_sum,
|
||||
SUM(this_month_profit) AS this_month_profit_sum
|
||||
ifnull(SUM( this_month_sa_money ), 0) AS this_month_sa_money_sum,
|
||||
ifnull(SUM(this_month_profit), 0) AS this_month_profit_sum
|
||||
FROM new_gr_bi_sa_agg
|
||||
GROUP BY
|
||||
use_year
|
||||
|
||||
@@ -269,6 +269,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
current_year_data.dosage_id,
|
||||
current_year_data.dosage_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('effectName') || params.containsKey('effectName')">
|
||||
current_year_data.effect_id,
|
||||
current_year_data.effect_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('stdGoodsName') || params.containsKey('stdGoodsName')">
|
||||
current_year_data.std_goods_name,
|
||||
</if>
|
||||
@@ -350,20 +354,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('effectName') || params.containsKey('effectName')">
|
||||
effect_id,
|
||||
effect_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
saler_name,
|
||||
</if>
|
||||
GROUP_CONCAT(DISTINCT province_id ORDER BY province_id SEPARATOR ',') AS province_id,
|
||||
GROUP_CONCAT(DISTINCT province_name ORDER BY province_name SEPARATOR ',') AS province_name,
|
||||
sum(this_year_sa_qty) AS this_year_sa_qty,
|
||||
sum(this_year_sa_money) AS this_year_sa_money,
|
||||
sum(this_year_cost) AS this_year_cost,
|
||||
sum(this_year_profit) AS this_year_profit
|
||||
ifnull(sum(this_year_sa_qty), 0) AS this_year_sa_qty,
|
||||
ifnull(sum(this_year_sa_money), 0) AS this_year_sa_money,
|
||||
ifnull(sum(this_year_cost), 0) AS this_year_cost,
|
||||
ifnull(sum(this_year_profit), 0) AS this_year_profit
|
||||
FROM new_gr_bi_sa_agg_year_count
|
||||
<where>
|
||||
<!--<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear}</if>-->
|
||||
|
||||
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear}</if>
|
||||
<if test="saAggParam.useYearStart != null and saAggParam.useYearStart != ''"> and use_year >= #{saAggParam.useYearStart}</if>
|
||||
<if test="saAggParam.useYearEnd != null and saAggParam.useYearEnd != ''"> and use_year <= #{saAggParam.useYearEnd}</if>
|
||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||
@@ -386,6 +393,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.effectName != null and saAggParam.effectName != ''"> and effect_name in
|
||||
<foreach collection="saAggParam.effectName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
@@ -430,6 +442,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
dosage_id,
|
||||
dosage_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('effectName') || params.containsKey('effectName')">
|
||||
effect_id,
|
||||
effect_name,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
saler_name,
|
||||
@@ -453,13 +469,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
dosage_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('effectName') || params.containsKey('effectName')">
|
||||
effect_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
</if>
|
||||
SUM(this_year_sa_qty) AS last_year_sa_qty,
|
||||
SUM(this_year_sa_money) AS last_year_sa_money,
|
||||
SUM(this_year_cost) AS last_year_cost,
|
||||
SUM(this_year_profit) AS last_year_profit
|
||||
ifnull(SUM(this_year_sa_qty), 0) AS last_year_sa_qty,
|
||||
ifnull(SUM(this_year_sa_money), 0) AS last_year_sa_money,
|
||||
ifnull(SUM(this_year_cost), 0) AS last_year_cost,
|
||||
ifnull(SUM(this_year_profit), 0) AS last_year_profit
|
||||
FROM new_gr_bi_sa_agg_year_count
|
||||
|
||||
<where>
|
||||
@@ -484,6 +503,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.effectName != null and saAggParam.effectName != ''"> and effect_name in
|
||||
<foreach collection="saAggParam.effectName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
@@ -524,6 +548,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
dosage_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('effectName') || params.containsKey('effectName')">
|
||||
effect_id,
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
saler_id,
|
||||
</if>
|
||||
@@ -546,12 +573,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="groupFieldList.contains('dosageName') || params.containsKey('dosageName')">
|
||||
AND current_year_data.dosage_id = last_year_data.dosage_id
|
||||
</if>
|
||||
<if test="groupFieldList.contains('effectName') || params.containsKey('effectName')">
|
||||
AND current_year_data.effect_id = last_year_data.effect_id
|
||||
</if>
|
||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||
AND current_year_data.saler_id = last_year_data.saler_id
|
||||
</if>
|
||||
LEFT JOIN (SELECT use_year,
|
||||
SUM(this_year_sa_money) AS this_year_sa_money_sum,
|
||||
SUM(this_year_profit) AS this_year_profit_sum
|
||||
ifnull(SUM(this_year_sa_money), 0) AS this_year_sa_money_sum,
|
||||
ifnull(SUM(this_year_profit), 0) AS this_year_profit_sum
|
||||
FROM new_gr_bi_sa_agg_year_count
|
||||
GROUP BY use_year) as total_year_data
|
||||
ON total_year_data.use_year = current_year_data.use_year
|
||||
|
||||
@@ -11,4 +11,8 @@
|
||||
<select id="callUpdateCore" statementType="CALLABLE" >
|
||||
{call P_ERP_DATA_FAST()}
|
||||
</select>
|
||||
<!-- 调用示例存储过程 -->
|
||||
<select id="callErpDataCore" statementType="CALLABLE" >
|
||||
{call p_erp_data(#{pastYear},#{pastMonth},#{currentYear},#{currentMonth})}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.lideeyunji.service.system.controller;
|
||||
|
||||
import com.lideeyunji.service.system.controller.vo.dept.dept.DeptRespVO;
|
||||
import com.lideeyunji.service.system.controller.vo.dept.dept.DeptSimpleRespVO;
|
||||
import com.lideeyunji.service.system.controller.vo.sblx.SblxListReqVO;
|
||||
import com.lideeyunji.service.system.controller.vo.sblx.SblxRespVO;
|
||||
import com.lideeyunji.service.system.controller.vo.sblx.SblxSaveReqVO;
|
||||
@@ -77,9 +75,9 @@ public class SblxController {
|
||||
@Operation(tags = "设备类型管理",summary = "获得设备类型信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:sblx:query')")
|
||||
public CommonResult<DeptRespVO> getDept(@RequestParam("id") Long id) {
|
||||
public CommonResult<SblxRespVO> getDept(@RequestParam("id") Long id) {
|
||||
SblxDO sblx = sblxService.getSblx(id);
|
||||
return success(BeanUtils.toBean(sblx, DeptRespVO.class));
|
||||
return success(BeanUtils.toBean(sblx, SblxRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ public class SblxRespVO {
|
||||
@Schema(description = "设备类型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String industryCode;
|
||||
|
||||
@Schema(description = "所属部门", example = "1024")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "父设备类型 ID", example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ public class SblxSaveReqVO {
|
||||
@Schema(description = "父设备类型 ID", example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "所属部门", example = "1024")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
|
||||
import com.lideeyunji.tool.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.lideeyunji.tool.framework.tenant.core.db.TenantBaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 设备类型表
|
||||
*
|
||||
@@ -41,6 +44,11 @@ public class SblxDO extends BaseDO {
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,9 @@ public interface IlideeYunjiAdapter {
|
||||
//设备类型
|
||||
List<Map<String,Object>> getSblxViewList(List<Long> sblxIdList);
|
||||
|
||||
//获取所有设备类型名称列表
|
||||
List<Map<String, Object>> getAllSblxNameList();
|
||||
|
||||
//获取用户分页列表
|
||||
Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user