Compare commits
8 Commits
c761cb43a9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
471ce4c28f | ||
|
|
77e334728c | ||
|
|
b600436243 | ||
|
|
2108e2a1e2 | ||
|
|
b3c8423239 | ||
|
|
8b53722f90 | ||
|
|
564e119bc3 | ||
|
|
5c998db1ed |
@@ -338,6 +338,21 @@ public class FrameWorkAdapter implements IlideeYunjiAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//回显设备类型
|
||||||
|
@TenantIgnore
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getSblxViewList(List<Long> sblxIdList) {
|
||||||
|
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper()
|
||||||
|
.select("id", "industry_name AS industryName")
|
||||||
|
.setTableName("dev_sblx")
|
||||||
|
.setWhere(where -> {
|
||||||
|
where.in("id", sblxIdList);
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
List<Map<String, Object>> dataList = sqlService.getDataListByPlus(wrapper);
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
//获取用户分页列表
|
//获取用户分页列表
|
||||||
@Override
|
@Override
|
||||||
public Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param) {
|
public Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param) {
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.lideeyunji.core.framework.config.job;
|
||||||
|
|
||||||
|
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.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Oracle 存储过程调用定时任务
|
||||||
|
* 用于定时调用 Oracle 存储过程进行数据处理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component("oracleProcedureJob")
|
||||||
|
public class OracleProcedureJob implements JobHandler {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OracleProcedureMapper oracleProcedureMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(String param) throws Exception {
|
||||||
|
log.info("========== 开始执行 Oracle 存储过程定时任务,参数:{} ==========", param);
|
||||||
|
|
||||||
|
try {
|
||||||
|
callAllProcedure();
|
||||||
|
log.info("========== Oracle 存储过程定时任务执行成功 ==========");
|
||||||
|
return "Oracle 存储过程定时任务执行成功";
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("========== Oracle 存储过程定时任务执行失败 ==========", e);
|
||||||
|
throw new RuntimeException("Oracle 存储过程调用失败:" + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用简单存储过程
|
||||||
|
*/
|
||||||
|
private void callAllProcedure() {
|
||||||
|
log.info("开始调用存储过程...");
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("result", new Object()); // 用于接收输出参数
|
||||||
|
|
||||||
|
oracleProcedureMapper.callAllProcedure(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
|
||||||
|
|
||||||
|
// 获取输出参数值
|
||||||
|
Object result = params.get("result");
|
||||||
|
log.info("存储过程执行结果:{}", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.lideeyunji.core.framework.config.job;
|
||||||
|
|
||||||
|
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.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Oracle 存储过程调用定时任务 ,用于更新核心、高频的数据
|
||||||
|
* 用于定时调用 Oracle 存储过程进行数据处理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component("oracleProcedureUpdateCoreJob")
|
||||||
|
public class OracleProcedureUpdateCoreJob implements JobHandler {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OracleProcedureMapper oracleProcedureMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(String param) throws Exception {
|
||||||
|
log.info("========== 开始执行 Oracle 存储过程定时任务 ,用于更新核心、高频的数据,参数:{} ==========", param);
|
||||||
|
|
||||||
|
try {
|
||||||
|
callUpdateCore();
|
||||||
|
log.info("========== Oracle 存储过程定时任务,用于更新核心、高频的数据 执行成功 ==========");
|
||||||
|
return "Oracle 存储过程定时任务,用于更新核心、高频的数据 执行成功";
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("========== Oracle 存储过程定时任务,用于更新核心、高频的数据 执行失败 ==========", e);
|
||||||
|
throw new RuntimeException("Oracle 存储过程,用于更新核心、高频的数据 调用失败:" + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用简单存储过程
|
||||||
|
*/
|
||||||
|
private void callUpdateCore() {
|
||||||
|
log.info("开始调用存储过程...");
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("result", new Object()); // 用于接收输出参数
|
||||||
|
|
||||||
|
oracleProcedureMapper.callUpdateCore(lideeYunJiBaseConstant.DS_ORACLE_GRYYBI);
|
||||||
|
|
||||||
|
// 获取输出参数值
|
||||||
|
Object result = params.get("result");
|
||||||
|
log.info("存储过程执行结果:{}", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -285,6 +285,10 @@ public class DbFormController extends BaseController {
|
|||||||
String deptormatSql="(select name from system_dept where id ="+label+") as "+label;
|
String deptormatSql="(select name from system_dept where id ="+label+") as "+label;
|
||||||
fieldList.set(ind,deptormatSql);//子查询
|
fieldList.set(ind,deptormatSql);//子查询
|
||||||
break;
|
break;
|
||||||
|
case "sblxSelect":
|
||||||
|
String sblxormatSql="(select industry_name from dev_sblx where id ="+label+") as "+label;
|
||||||
|
fieldList.set(ind,sblxormatSql);//子查询
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,6 +310,7 @@ public class DbFormController extends BaseController {
|
|||||||
List<String> dataList = labelParam.getDataList();
|
List<String> dataList = labelParam.getDataList();
|
||||||
List<Long> userIdList = labelParam.getUserIdList();//用户id
|
List<Long> userIdList = labelParam.getUserIdList();//用户id
|
||||||
List<Long> deptIdList = labelParam.getDeptIdList();//部门id
|
List<Long> deptIdList = labelParam.getDeptIdList();//部门id
|
||||||
|
List<Long> sblxIdList = labelParam.getSblxIdList();//设备类型id
|
||||||
|
|
||||||
if (Func.isNotEmpty(dbformId)) { //自定义表
|
if (Func.isNotEmpty(dbformId)) { //自定义表
|
||||||
String mapKey = dbformId + "&" + label;
|
String mapKey = dbformId + "&" + label;
|
||||||
@@ -341,6 +346,10 @@ public class DbFormController extends BaseController {
|
|||||||
List<Map<String, Object>> deptViewList = lideeYunJiAdapter.getDeptViewList(deptIdList);
|
List<Map<String, Object>> deptViewList = lideeYunJiAdapter.getDeptViewList(deptIdList);
|
||||||
resultMap.put("deptList", deptViewList);
|
resultMap.put("deptList", deptViewList);
|
||||||
}
|
}
|
||||||
|
if (Func.isNotEmpty(sblxIdList)) {//部门表回显
|
||||||
|
List<Map<String, Object>> sblxViewList = lideeYunJiAdapter.getSblxViewList(sblxIdList);
|
||||||
|
resultMap.put("sblxList", sblxViewList);
|
||||||
|
}
|
||||||
})).get();
|
})).get();
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
throw new RuntimeException(e.getMessage());
|
throw new RuntimeException(e.getMessage());
|
||||||
|
|||||||
@@ -45,16 +45,23 @@ public class NewGrBiSaAggMonthCountController extends BaseController
|
|||||||
public BaseWebResult getTotalDetail(HttpServletRequest req)
|
public BaseWebResult getTotalDetail(HttpServletRequest req)
|
||||||
{
|
{
|
||||||
Map<String, Object> params = FuncWeb.getParameterBodyMap(req);
|
Map<String, Object> params = FuncWeb.getParameterBodyMap(req);
|
||||||
String groupField = params.containsKey("Group by") ? params.get("Group by").toString() : "useMonth";
|
String groupField = params.containsKey("Group by") ? params.get("Group by").toString() : "";
|
||||||
SaAggParam saAggParam = new SaAggParam();
|
SaAggParam saAggParam = new SaAggParam();
|
||||||
if (params.containsKey("useMonth")){
|
if(groupField.contains("useMonth")){
|
||||||
saAggParam.setUseMonth(params.get("useMonth").toString());
|
if (params.containsKey("useMonthStart")){
|
||||||
|
saAggParam.setUseMonthStart(params.get("useMonthStart").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("useMonthEnd")){
|
||||||
|
saAggParam.setUseMonthEnd(params.get("useMonthEnd").toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(params.containsKey("useYear")){
|
if(params.containsKey("useYearStart")){
|
||||||
saAggParam.setUseYear(params.get("useYear").toString());
|
saAggParam.setUseYearStart(params.get("useYearStart").toString());
|
||||||
}else{
|
|
||||||
saAggParam.setUseYear(new SimpleDateFormat("yyyy").format(new Date()));
|
|
||||||
}
|
}
|
||||||
|
if(params.containsKey("useYearEnd")){
|
||||||
|
saAggParam.setUseYearEnd(params.get("useYearEnd").toString());
|
||||||
|
}
|
||||||
|
|
||||||
if(params.containsKey("customName")){
|
if(params.containsKey("customName")){
|
||||||
saAggParam.setCustomName(Arrays.asList(params.get("customName").toString().split(",")));
|
saAggParam.setCustomName(Arrays.asList(params.get("customName").toString().split(",")));
|
||||||
}
|
}
|
||||||
@@ -80,7 +87,7 @@ public class NewGrBiSaAggMonthCountController extends BaseController
|
|||||||
if (params.containsKey("provinceName")){
|
if (params.containsKey("provinceName")){
|
||||||
saAggParam.setProvinceName(Arrays.asList(params.get("provinceName").toString().split( ",")));
|
saAggParam.setProvinceName(Arrays.asList(params.get("provinceName").toString().split( ",")));
|
||||||
}
|
}
|
||||||
if (params.containsKey("useMonth") || groupField.contains("useMonth")){
|
if (groupField.contains("useMonth")){
|
||||||
List<NewGrBiSaAggMonthCount> list = newGrBiSaAggMonthCountService.getTotalDetail(saAggParam);
|
List<NewGrBiSaAggMonthCount> list = newGrBiSaAggMonthCountService.getTotalDetail(saAggParam);
|
||||||
return BaseWebResult.success(list);
|
return BaseWebResult.success(list);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ByglByjhLbPlugin implements AroundAdvicePlugin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Map<String, Object> record : records) {
|
for (Map<String, Object> record : records) {
|
||||||
String plan_id = lideeYunJiUtils.getMap2Str(record, "plan_id");
|
String plan_id = lideeYunJiUtils.getMap2Str(record, "id");
|
||||||
Map<String, Object> countByPlanId = byglByjhMapper.getCountByPlanId(plan_id);
|
Map<String, Object> countByPlanId = byglByjhMapper.getCountByPlanId(plan_id);
|
||||||
record.put("plan_count",lideeYunJiUtils.getMap2Long(countByPlanId,"jhs"));
|
record.put("plan_count",lideeYunJiUtils.getMap2Long(countByPlanId,"jhs"));
|
||||||
record.put("completed_count",lideeYunJiUtils.getMap2Long(countByPlanId,"wcs"));
|
record.put("completed_count",lideeYunJiUtils.getMap2Long(countByPlanId,"wcs"));
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
package com.lideeyunji.core.framework.enhance.example.report.record;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.lideeyunji.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||||
|
import com.lideeyunji.core.framework.config.aspect.enhance.plugin.AroundAdvicePlugin;
|
||||||
|
import com.lideeyunji.core.framework.mapper.BusinessRealRecordMapper;
|
||||||
|
import com.lideeyunji.tool.framework.common.constant.ByglConstant;
|
||||||
|
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
|
||||||
|
import com.lideeyunji.tool.framework.yunji.utils.lideeYunJiUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保养管理-保养工单
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component("businessRealRecordPlugin")
|
||||||
|
public class BusinessRealRecordPlugin implements AroundAdvicePlugin {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||||
|
|
||||||
|
private static final String ORDER_ID_PREFIX = "GD";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BusinessRealRecordMapper businessRealRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeExecute(EnhanceContext enhanceContext) {
|
||||||
|
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||||
|
//新增方法默认状态字段
|
||||||
|
params.put("order_state",ByglConstant.GD_STATE_DKS);
|
||||||
|
String useyear = lideeYunJiUtils.getMap2Str(params, "useyear");
|
||||||
|
String revenueYearplan = lideeYunJiUtils.getMap2Str(params, "revenue_yearplan");
|
||||||
|
String revenueYearrate = lideeYunJiUtils.getMap2Str(params, "revenue_yearrate");
|
||||||
|
String profitYearplan = lideeYunJiUtils.getMap2Str(params, "profit_yearplan");
|
||||||
|
String profitYearrate = lideeYunJiUtils.getMap2Str(params, "profit_yearrate");
|
||||||
|
List<Map<String, Object>> record = businessRealRecordMapper.getLastMonth(lideeYunJiBaseConstant.DS_ERP_BI_DATA,useyear);
|
||||||
|
if (CollUtil.isEmpty(record)) {
|
||||||
|
throw new RuntimeException("请选择正确的年,当前年月没有指标");
|
||||||
|
}
|
||||||
|
String last_month = (String) record.get(0).get("last_month");
|
||||||
|
businessRealRecordMapper.updateByRecord(lideeYunJiBaseConstant.DS_ERP_BI_DATA, useyear, last_month, "1", revenueYearplan, revenueYearrate);
|
||||||
|
businessRealRecordMapper.updateByRecord(lideeYunJiBaseConstant.DS_ERP_BI_DATA, useyear, last_month, "4", profitYearplan, profitYearrate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecute(EnhanceContext enhanceContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
package com.lideeyunji.core.framework.enhance.example.report.xtsy;
|
package com.lideeyunji.core.framework.enhance.example.report.xtsy;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.lideeyunji.core.framework.config.aspect.enhancereport.model.EnhanceReportContext;
|
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.config.aspect.enhancereport.plugin.ReportAroundAdvicePlugin;
|
||||||
import com.lideeyunji.core.framework.config.aspect.enhancereport.plugin.ReportBeforeAdvicePlugin;
|
|
||||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAgg;
|
|
||||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
|
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
|
||||||
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
|
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
|
||||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
|
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
|
||||||
@@ -15,9 +14,7 @@ import com.lideeyunji.core.framework.service.INewGrBiSaAggService;
|
|||||||
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
|
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
|
||||||
import com.lideeyunji.tool.framework.exception.lideeYunJiException;
|
import com.lideeyunji.tool.framework.exception.lideeYunJiException;
|
||||||
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
|
||||||
import com.lideeyunji.tool.framework.yunji.model.global.BaseWebResult;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -44,7 +41,7 @@ public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
|
public ResultDataModel executeAround(EnhanceReportContext enhanceContext) {
|
||||||
log.info("进入=======>zhxsqkLineReportEnhance=======>execute");
|
log.info("进入=======>zhxsqkPlugin=======>execute");
|
||||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||||
|
|
||||||
if (params.containsKey("Group by")) {
|
if (params.containsKey("Group by")) {
|
||||||
@@ -55,13 +52,48 @@ public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
|||||||
if(!groupFieldList.contains("useYear") && !params.containsKey("useYear")){
|
if(!groupFieldList.contains("useYear") && !params.containsKey("useYear")){
|
||||||
throw new lideeYunJiException("维度“年” 和 查询条件“年” 不能同时为空!");
|
throw new lideeYunJiException("维度“年” 和 查询条件“年” 不能同时为空!");
|
||||||
}
|
}
|
||||||
PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
|
Page<Object> page = PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
|
||||||
if(groupFieldList.contains("useMonth") || params.containsKey("useMonth")){
|
if(groupFieldList.contains("useMonth") || params.containsKey("useMonth")){
|
||||||
|
setMonthOrderBy(params, page);
|
||||||
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.selectNewGrBiSaAggGroupMonthList(params, groupFieldList);
|
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.selectNewGrBiSaAggGroupMonthList(params, groupFieldList);
|
||||||
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||||
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
||||||
}else{
|
}else{
|
||||||
|
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);
|
List<NewGrBiSaAggYearCount> newGrBiSaAggList = newGrBiSaAggYearCountService.selectNewGrBiSaAggGroupYearList(params, groupFieldList);
|
||||||
PageInfo<NewGrBiSaAggYearCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
PageInfo<NewGrBiSaAggYearCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||||
@@ -69,11 +101,49 @@ public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
PageHelper.startPage(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()));
|
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);
|
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggService.selectNewGrBiSaAggList(params);
|
||||||
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||||
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
return ResultDataModel.fomat(pageInfo.getTotal(),list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setMonthOrderBy(Map<String, Object> params, Page<Object> page) {
|
||||||
|
if(params.containsKey("column")){
|
||||||
|
String orderBy = "";
|
||||||
|
if ("thisMonthSaQty".equals(params.get("column"))) {
|
||||||
|
orderBy = "this_month_sa_qty " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("monthsaqty_yoy".equals(params.get("column"))) {
|
||||||
|
orderBy = "CAST(TRIM(REGEXP_SUBSTR(monthsaqty_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("thisMonthSaMoney".equals(params.get("column"))) {
|
||||||
|
orderBy = "this_month_sa_money " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("monthsamoney_yoy".equals(params.get("column"))) {
|
||||||
|
orderBy = "CAST(TRIM(REGEXP_SUBSTR(monthsamoney_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("thisMonthProfit".equals(params.get("column"))) {
|
||||||
|
orderBy = "this_month_profit " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("monthprofit_yoy".equals(params.get("column"))) {
|
||||||
|
orderBy = "CAST(TRIM(REGEXP_SUBSTR(monthprofit_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("thisMonthCost".equals(params.get("column"))) {
|
||||||
|
orderBy = "this_month_cost " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("thisMonthSaMoneyShare".equals(params.get("column"))) {
|
||||||
|
orderBy = "this_month_sa_money_share " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("thisMonthProfitShare".equals(params.get("column"))) {
|
||||||
|
orderBy = "this_month_profit_share " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
if ("lastMonthSaMoney_yoy".equals(params.get("column"))) {
|
||||||
|
orderBy = "CAST(TRIM(REGEXP_SUBSTR(lastMonthSaMoney_yoy, '-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)')) AS DECIMAL(10,2)) " + params.get("order").toString();
|
||||||
|
}
|
||||||
|
page.setUnsafeOrderBy(orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
package com.lideeyunji.core.framework.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.Master;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Master
|
||||||
|
public interface BusinessRealRecordMapper {
|
||||||
|
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
List<Map<String,Object>> getRecord(@Param("dataSourceType") String dataSourceType, String year);
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
List<Map<String,Object>> getLastMonth(@Param("dataSourceType") String dataSourceType, String year);
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
int updateByRecord(@Param("dataSourceType") String dataSourceType, String year, String month, String itemid, String yearplan, String yearrate);
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public interface NewGrBiSaAggMapper extends BaseMapper<NewGrBiSaAgg>
|
|||||||
*/
|
*/
|
||||||
@DataPermission(enable = false)
|
@DataPermission(enable = false)
|
||||||
@DS(value = "#dataSourceType")
|
@DS(value = "#dataSourceType")
|
||||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(@Param("dataSourceType") String dataSourceType, @Param("saAggParam")SaAggParam saAggParam);
|
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(@Param("dataSourceType") String dataSourceType, @Param("saAggParam")SaAggParam saAggParam, @Param("params") Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增综合销售情况明细
|
* 新增综合销售情况明细
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.lideeyunji.core.framework.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
|
import com.lideeyunji.tool.framework.permission.core.annotation.DataPermission;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Oracle 存储过程调用 Mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OracleProcedureMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用 Oracle 存储过程 - 示例
|
||||||
|
*
|
||||||
|
* @param dataSourceType 存储过程参数
|
||||||
|
* @return 执行结果
|
||||||
|
*/
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
@DataPermission(enable = false)
|
||||||
|
void callAllProcedure(@Param("dataSourceType") String dataSourceType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用 Oracle 存储过程 - 示例
|
||||||
|
*
|
||||||
|
* @param dataSourceType 存储过程参数
|
||||||
|
* @return 执行结果
|
||||||
|
*/
|
||||||
|
@DS(value = "#dataSourceType")
|
||||||
|
@DataPermission(enable = false)
|
||||||
|
void callUpdateCore(@Param("dataSourceType") String dataSourceType);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,5 +33,8 @@ public class DictLabelParam {
|
|||||||
@Schema(description = "部门id列表")
|
@Schema(description = "部门id列表")
|
||||||
private List<Long> deptIdList;
|
private List<Long> deptIdList;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型id列表")
|
||||||
|
private List<Long> sblxIdList;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import java.util.List;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SaAggParam {
|
public class SaAggParam {
|
||||||
private String useYear;
|
private String useYearStart;
|
||||||
private String useMonth;
|
private String useYearEnd;
|
||||||
|
private String useMonthStart;
|
||||||
|
private String useMonthEnd;
|
||||||
private List<String> customName;
|
private List<String> customName;
|
||||||
private List<String> zoneName;
|
private List<String> zoneName;
|
||||||
private List<String> saleTypeName;
|
private List<String> saleTypeName;
|
||||||
|
|||||||
@@ -142,17 +142,23 @@ public class NewGrBiSaAggServiceImpl extends ServiceImpl<NewGrBiSaAggMapper, New
|
|||||||
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(Map<String, Object> params)
|
public List<NewGrBiSaAggMonthCount> selectNewGrBiSaAggList(Map<String, Object> params)
|
||||||
{
|
{
|
||||||
SaAggParam saAggParam = createParam(params);
|
SaAggParam saAggParam = createParam(params);
|
||||||
return this.baseMapper.selectNewGrBiSaAggList(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam);
|
return this.baseMapper.selectNewGrBiSaAggList(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static SaAggParam createParam(Map<String, Object> params) {
|
public static SaAggParam createParam(Map<String, Object> params) {
|
||||||
SaAggParam saAggParam = new SaAggParam();
|
SaAggParam saAggParam = new SaAggParam();
|
||||||
if (params.containsKey("useYear")) {
|
if (params.containsKey("useYearStart")) {
|
||||||
saAggParam.setUseYear(params.get("useYear").toString());
|
saAggParam.setUseYearStart(params.get("useYearStart").toString());
|
||||||
}
|
}
|
||||||
if (params.containsKey("useMonth")) {
|
if (params.containsKey("useYearEnd")) {
|
||||||
saAggParam.setUseMonth(params.get("useMonth").toString());
|
saAggParam.setUseYearEnd(params.get("useYearEnd").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("useMonthStart")) {
|
||||||
|
saAggParam.setUseMonthStart(params.get("useMonthStart").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("useMonthEnd")) {
|
||||||
|
saAggParam.setUseMonthEnd(params.get("useMonthEnd").toString());
|
||||||
}
|
}
|
||||||
if (params.containsKey("customName")) {
|
if (params.containsKey("customName")) {
|
||||||
saAggParam.setCustomName(Arrays.asList(params.get("customName").toString().split( ",")));
|
saAggParam.setCustomName(Arrays.asList(params.get("customName").toString().split( ",")));
|
||||||
|
|||||||
@@ -645,8 +645,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
FROM
|
FROM
|
||||||
new_gr_bi_sa_agg tbl_lgbsa
|
new_gr_bi_sa_agg tbl_lgbsa
|
||||||
<where>
|
<where>
|
||||||
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear}</if>
|
<!-- 使用 (use_year * 100 + use_month) 组合成年月数值进行比较 -->
|
||||||
<if test="saAggParam.useMonth != null "> and use_month = #{saAggParam.useMonth}</if>
|
<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="zoneId != null "> and zone_id = #{zoneId}</if>-->
|
||||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
|
|||||||
@@ -58,8 +58,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ROUND(SUM(this_month_profit) / 10000, 2) AS this_month_profit_s
|
ROUND(SUM(this_month_profit) / 10000, 2) AS this_month_profit_s
|
||||||
FROM new_gr_bi_sa_agg_month_count
|
FROM new_gr_bi_sa_agg_month_count
|
||||||
<where>
|
<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.useMonth != null and saAggParam.useMonth != ''"> and use_month = #{saAggParam.useMonth}</if>
|
<if test="saAggParam.useMonth != null and saAggParam.useMonth != ''"> and use_month = #{saAggParam.useMonth}</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.useMonthStart != null and saAggParam.useMonthStart != ''"> and use_month > #{saAggParam.useMonthStart}</if>-->
|
||||||
|
<!-- <if test="saAggParam.useMonthEnd != null and saAggParam.useMonthEnd != ''"> and use_month < #{saAggParam.useMonthEnd}</if>-->
|
||||||
|
|
||||||
|
<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="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
||||||
<foreach collection="saAggParam.customName" item="field" separator="," open="(" close=")">#{field}</foreach>
|
<foreach collection="saAggParam.customName" item="field" separator="," open="(" close=")">#{field}</foreach>
|
||||||
</if>
|
</if>
|
||||||
@@ -248,18 +259,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectNewGrBiSaAggGroupMonthList" resultMap="NewGrBiSaAggMonthCountResult">
|
<select id="selectNewGrBiSaAggGroupMonthList" resultMap="NewGrBiSaAggMonthCountResult">
|
||||||
select
|
select
|
||||||
<if test="groupFieldList.contains('useMonth') || params.containsKey('useMonth')">
|
current_month.use_month ,
|
||||||
current_month.use_month ,
|
<choose>
|
||||||
<choose>
|
<when test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
<when test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
current_month.use_year,
|
||||||
current_month.use_year,
|
current_month.ny as ny,
|
||||||
current_month.ny as ny,
|
</when>
|
||||||
</when>
|
<otherwise>
|
||||||
<otherwise>
|
LPAD(current_month.use_month, 2, '0') as ny,
|
||||||
LPAD(current_month.use_month, 2, '0') as ny,
|
</otherwise>
|
||||||
</otherwise>
|
</choose>
|
||||||
</choose>
|
|
||||||
</if>
|
|
||||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||||
current_month.custom_id,
|
current_month.custom_id,
|
||||||
current_month.custom_name,
|
current_month.custom_name,
|
||||||
@@ -352,7 +361,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
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_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
|
COALESCE (ROUND( current_month.this_month_profit/total_month_data.this_month_profit_sum * 100, 2), 0 ) as this_month_profit_share
|
||||||
FROM ( SELECT
|
FROM ( SELECT
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
use_year,
|
use_year,
|
||||||
</if>
|
</if>
|
||||||
use_month,
|
use_month,
|
||||||
@@ -390,8 +399,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
FROM
|
FROM
|
||||||
new_gr_bi_sa_agg_month_count
|
new_gr_bi_sa_agg_month_count
|
||||||
<where>
|
<where>
|
||||||
<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.useMonth != null and saAggParam.useMonth != ''"> and use_month = #{saAggParam.useMonth}</if>
|
<!-- <if test="saAggParam.useYearEnd != null and saAggParam.useYearEnd != ''"> and use_year < #{saAggParam.useYearEnd}</if>-->
|
||||||
|
<!-- <if test="saAggParam.useMonthStart != null and saAggParam.useMonthStart != ''"> and use_month > #{saAggParam.useMonthStart}</if>-->
|
||||||
|
<!-- <if test="saAggParam.useMonthEnd != null and saAggParam.useMonthEnd != ''"> and use_month < #{saAggParam.useMonthEnd}</if>-->
|
||||||
|
<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="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
@@ -436,7 +453,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
<trim suffixOverrides=",">
|
<trim suffixOverrides=",">
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
use_year,
|
use_year,
|
||||||
</if>
|
</if>
|
||||||
use_month,
|
use_month,
|
||||||
@@ -467,7 +484,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
) AS current_month
|
) AS current_month
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
use_year,
|
use_year,
|
||||||
</if>
|
</if>
|
||||||
use_month,
|
use_month,
|
||||||
@@ -496,7 +513,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
FROM new_gr_bi_sa_agg_month_count
|
FROM new_gr_bi_sa_agg_month_count
|
||||||
GROUP BY
|
GROUP BY
|
||||||
<trim suffixOverrides=",">
|
<trim suffixOverrides=",">
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
use_year,
|
use_year,
|
||||||
</if>
|
</if>
|
||||||
use_month,
|
use_month,
|
||||||
@@ -521,7 +538,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</trim>
|
</trim>
|
||||||
) AS last_month_data
|
) AS last_month_data
|
||||||
ON last_month_data.use_month = IF(current_month.use_month = 1, 12, current_month.use_month - 1)
|
ON last_month_data.use_month = IF(current_month.use_month = 1, 12, current_month.use_month - 1)
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
AND last_month_data.use_year = current_month.use_year - (current_month.use_month = 1)
|
AND last_month_data.use_year = current_month.use_year - (current_month.use_month = 1)
|
||||||
</if>
|
</if>
|
||||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||||
@@ -544,7 +561,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
use_year,
|
use_year,
|
||||||
</if>
|
</if>
|
||||||
use_month,
|
use_month,
|
||||||
@@ -572,8 +589,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
SUM(this_month_profit) AS yoy_month_profit
|
SUM(this_month_profit) AS yoy_month_profit
|
||||||
FROM new_gr_bi_sa_agg_month_count
|
FROM new_gr_bi_sa_agg_month_count
|
||||||
<where>
|
<where>
|
||||||
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear }- 1</if>
|
<!-- <if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear }- 1</if>-->
|
||||||
<if test="saAggParam.useMonth != null and saAggParam.useMonth != ''"> and use_month = #{saAggParam.useMonth}</if>
|
<!-- <if test="saAggParam.useMonth != null and saAggParam.useMonth != ''"> and use_month = #{saAggParam.useMonth}</if>-->
|
||||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
@@ -618,7 +635,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
<trim suffixOverrides=",">
|
<trim suffixOverrides=",">
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
use_year,
|
use_year,
|
||||||
</if>
|
</if>
|
||||||
use_month,
|
use_month,
|
||||||
@@ -644,7 +661,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
) yoy_month ON
|
) yoy_month ON
|
||||||
<trim prefixOverrides="and">
|
<trim prefixOverrides="and">
|
||||||
|
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart')|| params.containsKey('useYearEnd')">
|
||||||
and yoy_month.use_year = current_month.use_year - 1
|
and yoy_month.use_year = current_month.use_year - 1
|
||||||
</if>
|
</if>
|
||||||
and yoy_month.use_month = current_month.use_month
|
and yoy_month.use_month = current_month.use_month
|
||||||
@@ -678,8 +695,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
use_year
|
use_year
|
||||||
) total_month_data ON total_month_data.use_year = current_month.use_year
|
) total_month_data ON total_month_data.use_year = current_month.use_year
|
||||||
<where>
|
<where>
|
||||||
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and current_month.use_year = #{saAggParam.useYear}</if>
|
<if test="saAggParam.useYearStart != null and saAggParam.useYearStart != '' and saAggParam.useMonthStart != null and saAggParam.useMonthStart != ''">
|
||||||
<if test="saAggParam.useMonth != null and saAggParam.useMonth != ''"> and current_month.use_month = #{saAggParam.useMonth}</if>
|
AND (current_month.use_year * 100 + current_month.use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
||||||
|
</if>
|
||||||
|
<if test="saAggParam.useYearEnd != null and saAggParam.useYearEnd != '' and saAggParam.useMonthEnd != null and saAggParam.useMonthEnd != ''">
|
||||||
|
AND (current_month.use_year * 100 + current_month.use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
||||||
|
</if>
|
||||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and current_month.zone_name in
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and current_month.zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.lideeyunji.core.framework.mapper.NewGrBiSaAggYearCountMapper">
|
<mapper namespace="com.lideeyunji.core.framework.mapper.NewGrBiSaAggYearCountMapper">
|
||||||
|
|
||||||
<resultMap type="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" id="NewGrBiSaAggYearCountResult">
|
<resultMap type="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" id="NewGrBiSaAggYearCountResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="useYear" column="use_year" />
|
<result property="useYear" column="use_year" />
|
||||||
@@ -56,7 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ROUND(SUM(this_year_profit) / 10000, 2) AS this_year_profit_s
|
ROUND(SUM(this_year_profit) / 10000, 2) AS this_year_profit_s
|
||||||
FROM new_gr_bi_sa_agg_year_count
|
FROM new_gr_bi_sa_agg_year_count
|
||||||
<where>
|
<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.customName != null and saAggParam.customName != ''"> and custom_name in
|
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
||||||
<foreach collection="saAggParam.customName" item="field" separator="," open="(" close=")">#{field}</foreach>
|
<foreach collection="saAggParam.customName" item="field" separator="," open="(" close=")">#{field}</foreach>
|
||||||
</if>
|
</if>
|
||||||
@@ -80,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectNewGrBiSaAggYearCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" resultMap="NewGrBiSaAggYearCountResult">
|
<select id="selectNewGrBiSaAggYearCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" resultMap="NewGrBiSaAggYearCountResult">
|
||||||
<include refid="selectNewGrBiSaAggYearCountVo"/>
|
<include refid="selectNewGrBiSaAggYearCountVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="useYear != null and useYear != ''"> and use_year = #{useYear}</if>
|
<if test="useYear != null and useYear != ''"> and use_year = #{useYear}</if>
|
||||||
<if test="zoneId != null "> and zone_id = #{zoneId}</if>
|
<if test="zoneId != null "> and zone_id = #{zoneId}</if>
|
||||||
<if test="zoneName != null and zoneName != ''"> and zone_name like concat('%', #{zoneName}, '%')</if>
|
<if test="zoneName != null and zoneName != ''"> and zone_name like concat('%', #{zoneName}, '%')</if>
|
||||||
@@ -114,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="thisYearProfitChange != null "> and this_year_profit_change = #{thisYearProfitChange}</if>
|
<if test="thisYearProfitChange != null "> and this_year_profit_change = #{thisYearProfitChange}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectNewGrBiSaAggYearCountById" parameterType="Long" resultMap="NewGrBiSaAggYearCountResult">
|
<select id="selectNewGrBiSaAggYearCountById" parameterType="Long" resultMap="NewGrBiSaAggYearCountResult">
|
||||||
<include refid="selectNewGrBiSaAggYearCountVo"/>
|
<include refid="selectNewGrBiSaAggYearCountVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
@@ -234,16 +237,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteNewGrBiSaAggYearCountByIds" parameterType="String">
|
<delete id="deleteNewGrBiSaAggYearCountByIds" parameterType="String">
|
||||||
delete from new_gr_bi_sa_agg_year_count where id in
|
delete from new_gr_bi_sa_agg_year_count where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectNewGrBiSaAggGroupYearList" resultMap="NewGrBiSaAggYearCountResult">
|
<select id="selectNewGrBiSaAggGroupYearList" resultMap="NewGrBiSaAggYearCountResult">
|
||||||
SELECT
|
SELECT
|
||||||
current_year_data.use_year,
|
current_year_data.use_year,
|
||||||
<if test="groupFieldList.contains('useYear') || params.containsKey('useYear')">
|
<if test="groupFieldList.contains('useYear') || params.containsKey('useYearStart') || params.containsKey('useYearEnd')">
|
||||||
current_year_data.ny as ny,
|
current_year_data.ny as ny,
|
||||||
</if>
|
</if>
|
||||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||||
@@ -359,7 +362,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
sum(this_year_profit) AS this_year_profit
|
sum(this_year_profit) AS this_year_profit
|
||||||
FROM new_gr_bi_sa_agg_year_count
|
FROM new_gr_bi_sa_agg_year_count
|
||||||
<where>
|
<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
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
@@ -450,14 +456,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||||
saler_id,
|
saler_id,
|
||||||
</if>
|
</if>
|
||||||
SUM(this_year_sa_qty) AS last_year_sa_qty,
|
SUM(this_year_sa_qty) AS last_year_sa_qty,
|
||||||
SUM(this_year_sa_money) AS last_year_sa_money,
|
SUM(this_year_sa_money) AS last_year_sa_money,
|
||||||
SUM(this_year_cost) AS last_year_cost,
|
SUM(this_year_cost) AS last_year_cost,
|
||||||
SUM(this_year_profit) AS last_year_profit
|
SUM(this_year_profit) AS last_year_profit
|
||||||
FROM new_gr_bi_sa_agg_year_count
|
FROM new_gr_bi_sa_agg_year_count
|
||||||
|
|
||||||
<where>
|
<where>
|
||||||
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear} -1</if>
|
<!--<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear} -1</if>-->
|
||||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
@@ -523,8 +529,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
|
||||||
) AS last_year_data
|
) AS last_year_data
|
||||||
ON last_year_data.use_year = current_year_data.use_year - 1
|
ON last_year_data.use_year = current_year_data.use_year - 1
|
||||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||||
AND current_year_data.custom_id = last_year_data.custom_id
|
AND current_year_data.custom_id = last_year_data.custom_id
|
||||||
</if>
|
</if>
|
||||||
@@ -543,11 +549,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
<if test="groupFieldList.contains('salerName') || params.containsKey('salerName')">
|
||||||
AND current_year_data.saler_id = last_year_data.saler_id
|
AND current_year_data.saler_id = last_year_data.saler_id
|
||||||
</if>
|
</if>
|
||||||
LEFT JOIN (SELECT use_year,
|
LEFT JOIN (SELECT use_year,
|
||||||
SUM(this_year_sa_money) AS this_year_sa_money_sum,
|
SUM(this_year_sa_money) AS this_year_sa_money_sum,
|
||||||
SUM(this_year_profit) AS this_year_profit_sum
|
SUM(this_year_profit) AS this_year_profit_sum
|
||||||
FROM new_gr_bi_sa_agg_year_count
|
FROM new_gr_bi_sa_agg_year_count
|
||||||
GROUP BY use_year) as total_year_data
|
GROUP BY use_year) as total_year_data
|
||||||
ON total_year_data.use_year = current_year_data.use_year
|
ON total_year_data.use_year = current_year_data.use_year
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?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.OracleProcedureMapper">
|
||||||
|
|
||||||
|
<!-- 调用示例存储过程 -->
|
||||||
|
<select id="callAllProcedure" statementType="CALLABLE" >
|
||||||
|
{call P_ERP_DATA_NEW()}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 调用示例存储过程 -->
|
||||||
|
<select id="callUpdateCore" statementType="CALLABLE" >
|
||||||
|
{call P_ERP_DATA_FAST()}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?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.BusinessRealRecordMapper">
|
||||||
|
|
||||||
|
<select id="getRecord" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
USEYEAR,
|
||||||
|
USEMONTH AS last_month,
|
||||||
|
ITEMID,
|
||||||
|
YEAR_PLAN,
|
||||||
|
YEAR_RATE,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY USEYEAR, ITEMID ORDER BY USEYEAR DESC, CAST(USEMONTH AS UNSIGNED) DESC) AS rn
|
||||||
|
FROM
|
||||||
|
GR_BI_FS_BUSINESS_REAL_RATE
|
||||||
|
where
|
||||||
|
USEYEAR = #{year}
|
||||||
|
) tn
|
||||||
|
WHERE
|
||||||
|
tn.rn = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getLastMonth" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
USEMONTH AS last_month
|
||||||
|
FROM
|
||||||
|
GR_BI_FS_BUSINESS_REAL
|
||||||
|
where
|
||||||
|
USEYEAR = #{year}
|
||||||
|
ORDER BY
|
||||||
|
CAST(USEMONTH AS UNSIGNED) DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="updateByRecord">
|
||||||
|
INSERT INTO gr_bi_fs_business_real_rate (YEAR_PLAN, YEAR_RATE, USEYEAR,USEMONTH,ITEMID)
|
||||||
|
VALUES (#{yearplan}, #{yearrate}, #{year}, #{month}, #{itemid})
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
YEAR_PLAN = #{yearplan},
|
||||||
|
YEAR_RATE = #{yearrate}
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -198,4 +198,13 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 站内信发送 1-002-028-000 ==========
|
// ========== 站内信发送 1-002-028-000 ==========
|
||||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
||||||
|
|
||||||
|
|
||||||
|
// ========== 设备类型维护 1_002_029_000 ==========
|
||||||
|
ErrorCode SBLX_NAME_DUPLICATE = new ErrorCode(1_002_029_000, "已经存在该名字的设备类型");
|
||||||
|
ErrorCode SBLX_EXITS_CHILDREN = new ErrorCode(1_002_029_001, "存在子设备类型,无法删除");
|
||||||
|
ErrorCode SBLX_NOT_FOUND = new ErrorCode(1_002_029_002, "当前设备类型不存在");
|
||||||
|
ErrorCode SBLX_PARENT_ERROR = new ErrorCode(1_002_029_003, "不能设置自己为父设备类型");
|
||||||
|
ErrorCode SBLX_PARENT_NOT_EXITS = new ErrorCode(1_002_029_004,"父级设备类型不存在");
|
||||||
|
ErrorCode SBLX_PARENT_IS_CHILD = new ErrorCode(1_002_029_005, "不能设置自己的子设备类型为父设备类型");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
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;
|
||||||
|
import com.lideeyunji.service.system.controller.vo.sblx.SblxSimpleRespVO;
|
||||||
|
import com.lideeyunji.service.system.entity.SblxDO;
|
||||||
|
import com.lideeyunji.service.system.service.ISblxService;
|
||||||
|
import com.lideeyunji.tool.framework.common.pojo.CommonResult;
|
||||||
|
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.lideeyunji.tool.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 设备类型")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sblx")
|
||||||
|
@Validated
|
||||||
|
public class SblxController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISblxService sblxService;
|
||||||
|
|
||||||
|
@PostMapping("create")
|
||||||
|
@Operation(tags = "设备类型管理",summary = "创建设备类型")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sblx:create')")
|
||||||
|
public CommonResult<Long> createSblx(@Valid @RequestBody SblxSaveReqVO createReqVO) {
|
||||||
|
Long deptId = sblxService.createSblx(createReqVO);
|
||||||
|
return success(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("update")
|
||||||
|
@Operation(tags = "设备类型管理",summary = "更新设备类型")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sblx:update')")
|
||||||
|
public CommonResult<Boolean> updateSblx(@Valid @RequestBody SblxSaveReqVO updateReqVO) {
|
||||||
|
sblxService.updateSblx(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("delete")
|
||||||
|
@Operation(tags = "设备类型管理",summary = "删除设备类型")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sblx:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSblx(@RequestParam("id") Long id) {
|
||||||
|
sblxService.deleteSblx(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(tags = "设备类型管理",summary = "获取设备类型列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sblx:query')")
|
||||||
|
public CommonResult<List<SblxRespVO>> getSblxList(SblxListReqVO reqVO) {
|
||||||
|
List<SblxDO> list = sblxService.getSblxList(reqVO);
|
||||||
|
return success(BeanUtils.toBean(list, SblxRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = {"/list-all-simple", "/simple-list"})
|
||||||
|
@Operation(tags = "设备类型管理",summary = "获取设备类型精简信息列表", description = "主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<SblxSimpleRespVO>> getSimpleDeptList() {
|
||||||
|
List<SblxDO> list = sblxService.getSblxList(
|
||||||
|
new SblxListReqVO());
|
||||||
|
return success(BeanUtils.toBean(list, SblxSimpleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@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) {
|
||||||
|
SblxDO sblx = sblxService.getSblx(id);
|
||||||
|
return success(BeanUtils.toBean(sblx, DeptRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.lideeyunji.service.system.controller.vo.sblx;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备类型列表 Request VO")
|
||||||
|
@Data
|
||||||
|
public class SblxListReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "设备类型名称,模糊匹配" )
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.lideeyunji.service.system.controller.vo.sblx;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备类型信息 Response VO")
|
||||||
|
@Data
|
||||||
|
public class SblxRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "设备类型编号", example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String industryCode;
|
||||||
|
|
||||||
|
@Schema(description = "父设备类型 ID", example = "1024")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.lideeyunji.service.system.controller.vo.sblx;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备类型创建/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class SblxSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "设备类型id", example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "设备类型名称不能为空")
|
||||||
|
@Size(max = 30, message = "设备类型名称长度不能超过 30 个字符")
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "设备类型编码不能为空")
|
||||||
|
@Size(max = 30, message = "设备类型编码长度不能超过 30 个字符")
|
||||||
|
private String industryCode;
|
||||||
|
|
||||||
|
@Schema(description = "父设备类型 ID", example = "1024")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotNull(message = "显示顺序不能为空")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.lideeyunji.service.system.controller.vo.sblx;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备类型精简信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SblxSimpleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "设备类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "设备类型名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
@Schema(description = "父设备类型 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.lideeyunji.service.system.entity;
|
||||||
|
|
||||||
|
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 lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableName("dev_sblx")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SblxDO extends BaseDO {
|
||||||
|
|
||||||
|
public static final Long PARENT_ID_ROOT = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
private String industryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
*/
|
||||||
|
private String industryCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父设备类型ID
|
||||||
|
*
|
||||||
|
* 关联 {@link #id}
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.lideeyunji.service.system.mapper;
|
||||||
|
|
||||||
|
import com.lideeyunji.service.system.controller.vo.sblx.SblxListReqVO;
|
||||||
|
import com.lideeyunji.service.system.entity.SblxDO;
|
||||||
|
import com.lideeyunji.tool.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.lideeyunji.tool.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SblxMapper extends BaseMapperX<SblxDO> {
|
||||||
|
|
||||||
|
default List<SblxDO> selectList(SblxListReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<SblxDO>()
|
||||||
|
.likeIfPresent(SblxDO::getIndustryName, reqVO.getIndustryName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
default SblxDO selectByParentIdAndName(Long parentId, String name) {
|
||||||
|
return selectOne(SblxDO::getParentId, parentId, SblxDO::getIndustryName, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Long selectCountByParentId(Long parentId) {
|
||||||
|
return selectCount(SblxDO::getParentId, parentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<SblxDO> selectListByParentId(Collection<Long> parentIds) {
|
||||||
|
return selectList(SblxDO::getParentId, parentIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.lideeyunji.service.system.service;
|
||||||
|
|
||||||
|
import com.lideeyunji.service.system.controller.vo.sblx.SblxListReqVO;
|
||||||
|
import com.lideeyunji.service.system.controller.vo.sblx.SblxSaveReqVO;
|
||||||
|
import com.lideeyunji.service.system.entity.SblxDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型 Service 接口
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ISblxService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建设备类型
|
||||||
|
*
|
||||||
|
* @param createReqVO 设备类型信息
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
Long createSblx(SblxSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备类型信息
|
||||||
|
*
|
||||||
|
* @param updateReqVO 设备类型信息
|
||||||
|
*/
|
||||||
|
void updateSblx(SblxSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备类型信息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void deleteSblx(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备类型信息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return 设备类型信息
|
||||||
|
*/
|
||||||
|
SblxDO getSblx(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选设备类型列表
|
||||||
|
*
|
||||||
|
* @param reqVO 筛选条件请求 VO
|
||||||
|
* @return 设备类型信息列表
|
||||||
|
*/
|
||||||
|
List<SblxDO> getSblxList(SblxListReqVO reqVO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -161,6 +161,10 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
|
|||||||
}
|
}
|
||||||
if (!CollUtil.isEmpty(roleIds)) {
|
if (!CollUtil.isEmpty(roleIds)) {
|
||||||
Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds);
|
Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds);
|
||||||
|
//修改 若无clientIds时直接返回空
|
||||||
|
if(CollUtil.isEmpty(clientIds)){
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
pageReqVO.setIds(clientIds);
|
pageReqVO.setIds(clientIds);
|
||||||
}
|
}
|
||||||
return oAuth2ClientJoinMapper.selectPage(pageReqVO);
|
return oAuth2ClientJoinMapper.selectPage(pageReqVO);
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package com.lideeyunji.service.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.lideeyunji.service.system.controller.vo.sblx.SblxListReqVO;
|
||||||
|
import com.lideeyunji.service.system.controller.vo.sblx.SblxSaveReqVO;
|
||||||
|
import com.lideeyunji.service.system.entity.SblxDO;
|
||||||
|
import com.lideeyunji.service.system.mapper.SblxMapper;
|
||||||
|
import com.lideeyunji.service.system.service.ISblxService;
|
||||||
|
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.lideeyunji.service.system.constant.ErrorCodeConstants.*;
|
||||||
|
import static com.lideeyunji.tool.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型 Service 实现类
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class SblxServiceImpl implements ISblxService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SblxMapper sblxMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createSblx(SblxSaveReqVO createReqVO) {
|
||||||
|
if (createReqVO.getParentId() == null) {
|
||||||
|
createReqVO.setParentId(SblxDO.PARENT_ID_ROOT);
|
||||||
|
}
|
||||||
|
// 校验父部门的有效性
|
||||||
|
validateParentDept(null, createReqVO.getParentId());
|
||||||
|
// 校验部门名的唯一性
|
||||||
|
validateDeptNameUnique(null, createReqVO.getParentId(), createReqVO.getIndustryName());
|
||||||
|
|
||||||
|
// 插入
|
||||||
|
SblxDO sblx = BeanUtils.toBean(createReqVO, SblxDO.class);
|
||||||
|
sblxMapper.insert(sblx);
|
||||||
|
return sblx.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSblx(SblxSaveReqVO updateReqVO) {
|
||||||
|
if (updateReqVO.getParentId() == null) {
|
||||||
|
updateReqVO.setParentId(SblxDO.PARENT_ID_ROOT);
|
||||||
|
}
|
||||||
|
// 校验自己存在
|
||||||
|
validateDeptExists(updateReqVO.getId());
|
||||||
|
// 校验父部门的有效性
|
||||||
|
validateParentDept(updateReqVO.getId(), updateReqVO.getParentId());
|
||||||
|
// 校验部门名的唯一性
|
||||||
|
validateDeptNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getIndustryName());
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
SblxDO updateObj = BeanUtils.toBean(updateReqVO, SblxDO.class);
|
||||||
|
sblxMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteSblx(Long id) {
|
||||||
|
// 校验是否存在
|
||||||
|
validateDeptExists(id);
|
||||||
|
// 校验是否有子部门
|
||||||
|
if (sblxMapper.selectCountByParentId(id) > 0) {
|
||||||
|
throw exception(SBLX_EXITS_CHILDREN);
|
||||||
|
}
|
||||||
|
// 删除部门
|
||||||
|
sblxMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void validateDeptExists(Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SblxDO sblx = sblxMapper.selectById(id);
|
||||||
|
if (sblx == null) {
|
||||||
|
throw exception(SBLX_NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void validateParentDept(Long id, Long parentId) {
|
||||||
|
if (parentId == null || SblxDO.PARENT_ID_ROOT.equals(parentId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 1. 不能设置自己为父部门
|
||||||
|
if (Objects.equals(id, parentId)) {
|
||||||
|
throw exception(SBLX_PARENT_ERROR);
|
||||||
|
}
|
||||||
|
// 2. 父部门不存在
|
||||||
|
SblxDO parentSblx = sblxMapper.selectById(parentId);
|
||||||
|
if (parentSblx == null) {
|
||||||
|
throw exception(SBLX_PARENT_NOT_EXITS);
|
||||||
|
}
|
||||||
|
// 3. 递归校验父部门,如果父部门是自己的子部门,则报错,避免形成环路
|
||||||
|
if (id == null) { // id 为空,说明新增,不需要考虑环路
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < Short.MAX_VALUE; i++) {
|
||||||
|
// 3.1 校验环路
|
||||||
|
parentId = parentSblx.getParentId();
|
||||||
|
if (Objects.equals(id, parentId)) {
|
||||||
|
throw exception(SBLX_PARENT_IS_CHILD);
|
||||||
|
}
|
||||||
|
// 3.2 继续递归下一级父部门
|
||||||
|
if (parentId == null || SblxDO.PARENT_ID_ROOT.equals(parentId)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parentSblx = sblxMapper.selectById(parentId);
|
||||||
|
if (parentSblx == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void validateDeptNameUnique(Long id, Long parentId, String name) {
|
||||||
|
SblxDO sblx = sblxMapper.selectByParentIdAndName(parentId, name);
|
||||||
|
if (sblx == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 id 为空,说明不用比较是否为相同 id 的部门
|
||||||
|
if (id == null) {
|
||||||
|
throw exception(SBLX_NAME_DUPLICATE);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.notEqual(sblx.getId(), id)) {
|
||||||
|
throw exception(SBLX_NAME_DUPLICATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SblxDO getSblx(Long id) {
|
||||||
|
return sblxMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SblxDO> getSblxList(SblxListReqVO reqVO) {
|
||||||
|
List<SblxDO> list = sblxMapper.selectList(reqVO);
|
||||||
|
list.sort(Comparator.comparing(SblxDO::getSort));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -60,6 +60,8 @@ public interface IlideeYunjiAdapter {
|
|||||||
//回显部门
|
//回显部门
|
||||||
List<Map<String,Object>> getDeptViewList(List<Long> deptIdList);
|
List<Map<String,Object>> getDeptViewList(List<Long> deptIdList);
|
||||||
|
|
||||||
|
//设备类型
|
||||||
|
List<Map<String,Object>> getSblxViewList(List<Long> sblxIdList);
|
||||||
|
|
||||||
//获取用户分页列表
|
//获取用户分页列表
|
||||||
Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param);
|
Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param);
|
||||||
|
|||||||
Reference in New Issue
Block a user