Compare commits
16 Commits
52ccd2a272
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b600436243 | ||
|
|
2108e2a1e2 | ||
|
|
b3c8423239 | ||
|
|
8b53722f90 | ||
|
|
564e119bc3 | ||
|
|
5c998db1ed | ||
|
|
c761cb43a9 | ||
|
|
3b3ccfd730 | ||
|
|
bf879bd75f | ||
|
|
3a70647af2 | ||
|
|
eac8a6f042 | ||
|
|
806b921bb2 | ||
|
|
cb282506b1 | ||
|
|
f3a7771d2e | ||
|
|
977c93423f | ||
|
|
4c05ebcc28 |
@@ -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
|
||||
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;
|
||||
fieldList.set(ind,deptormatSql);//子查询
|
||||
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<Long> userIdList = labelParam.getUserIdList();//用户id
|
||||
List<Long> deptIdList = labelParam.getDeptIdList();//部门id
|
||||
List<Long> sblxIdList = labelParam.getSblxIdList();//设备类型id
|
||||
|
||||
if (Func.isNotEmpty(dbformId)) { //自定义表
|
||||
String mapKey = dbformId + "&" + label;
|
||||
@@ -341,6 +346,10 @@ public class DbFormController extends BaseController {
|
||||
List<Map<String, Object>> deptViewList = lideeYunJiAdapter.getDeptViewList(deptIdList);
|
||||
resultMap.put("deptList", deptViewList);
|
||||
}
|
||||
if (Func.isNotEmpty(sblxIdList)) {//部门表回显
|
||||
List<Map<String, Object>> sblxViewList = lideeYunJiAdapter.getSblxViewList(sblxIdList);
|
||||
resultMap.put("sblxList", sblxViewList);
|
||||
}
|
||||
})).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ByglByjhLbPlugin implements AroundAdvicePlugin {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
record.put("plan_count",lideeYunJiUtils.getMap2Long(countByPlanId,"jhs"));
|
||||
record.put("completed_count",lideeYunJiUtils.getMap2Long(countByPlanId,"wcs"));
|
||||
|
||||
@@ -48,12 +48,15 @@ public class zhxsqkPlugin implements ReportAroundAdvicePlugin {
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
|
||||
if (params.containsKey("Group by")) {
|
||||
if (params.containsKey("goodsname")) {
|
||||
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("维度“年” 和 查询条件“年” 不能同时为空!");
|
||||
}
|
||||
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")){
|
||||
List<NewGrBiSaAggMonthCount> newGrBiSaAggList = newGrBiSaAggMonthCountService.selectNewGrBiSaAggGroupMonthList(params, groupFieldList);
|
||||
PageInfo<NewGrBiSaAggMonthCount> pageInfo = new PageInfo<>(newGrBiSaAggList);
|
||||
List<Map<String, Object>> list = newGrBiSaAggList.stream().map(BeanUtil::beanToMap).collect(Collectors.toList());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ public class NewGrBiSaAgg implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "zone_id")
|
||||
private Long zoneId;
|
||||
private String zoneId;
|
||||
|
||||
|
||||
@TableField(value = "zone_name")
|
||||
@@ -39,7 +39,7 @@ public class NewGrBiSaAgg implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "sale_type_id")
|
||||
private Long saleTypeId;
|
||||
private String saleTypeId;
|
||||
|
||||
|
||||
@TableField(value = "sale_type_name")
|
||||
@@ -47,7 +47,7 @@ public class NewGrBiSaAgg implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "custom_id")
|
||||
private Long customId;
|
||||
private String customId;
|
||||
|
||||
|
||||
@TableField(value = "custom_name")
|
||||
@@ -55,7 +55,7 @@ public class NewGrBiSaAgg implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "dosage_id")
|
||||
private Long dosageId;
|
||||
private String dosageId;
|
||||
|
||||
|
||||
@TableField(value = "dosage_name")
|
||||
@@ -82,7 +82,7 @@ public class NewGrBiSaAgg implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "saler_id")
|
||||
private Long salerId;
|
||||
private String salerId;
|
||||
|
||||
|
||||
@TableField(value = "saler_name")
|
||||
@@ -90,19 +90,19 @@ public class NewGrBiSaAgg implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "this_month_sa_qty")
|
||||
private BigDecimal thisMonthSaQty;
|
||||
private String thisMonthSaQty;
|
||||
|
||||
|
||||
@TableField(value = "this_month_sa_money")
|
||||
private BigDecimal thisMonthSaMoney;
|
||||
private String thisMonthSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "this_month_cost")
|
||||
private BigDecimal thisMonthCost;
|
||||
private String thisMonthCost;
|
||||
|
||||
|
||||
@TableField(value = "this_month_profit")
|
||||
private BigDecimal thisMonthProfit;
|
||||
private String thisMonthProfit;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -32,11 +31,11 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "use_month")
|
||||
private Long useMonth;
|
||||
private String useMonth;
|
||||
|
||||
|
||||
@TableField(value = "zone_id")
|
||||
private Long zoneId;
|
||||
private String zoneId;
|
||||
|
||||
|
||||
@TableField(value = "zone_name")
|
||||
@@ -44,7 +43,7 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "sale_type_id")
|
||||
private Long saleTypeId;
|
||||
private String saleTypeId;
|
||||
|
||||
|
||||
@TableField(value = "sale_type_name")
|
||||
@@ -60,7 +59,7 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "dosage_id")
|
||||
private Long dosageId;
|
||||
private String dosageId;
|
||||
|
||||
|
||||
@TableField(value = "dosage_name")
|
||||
@@ -87,78 +86,78 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "this_month_sa_qty")
|
||||
private Long thisMonthSaQty;
|
||||
private String thisMonthSaQty;
|
||||
|
||||
|
||||
@TableField(value = "last_month_sa_qty")
|
||||
private Long lastMonthSaQty;
|
||||
private String lastMonthSaQty;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_sa_qty")
|
||||
private Long yoyMonthSaQty;
|
||||
private String yoyMonthSaQty;
|
||||
|
||||
|
||||
@TableField(value = "this_month_sa_money")
|
||||
private BigDecimal thisMonthSaMoney;
|
||||
private String thisMonthSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "last_month_sa_money")
|
||||
private BigDecimal lastMonthSaMoney;
|
||||
private String lastMonthSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_sa_money")
|
||||
private BigDecimal yoyMonthSaMoney;
|
||||
private String yoyMonthSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "this_month_profit")
|
||||
private BigDecimal thisMonthProfit;
|
||||
private String thisMonthProfit;
|
||||
|
||||
|
||||
@TableField(value = "last_month_profit")
|
||||
private BigDecimal lastMonthProfit;
|
||||
private String lastMonthProfit;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_profit")
|
||||
private BigDecimal yoyMonthProfit;
|
||||
private String yoyMonthProfit;
|
||||
|
||||
|
||||
@TableField(value = "this_month_cost")
|
||||
private BigDecimal thisMonthCost;
|
||||
private String thisMonthCost;
|
||||
|
||||
|
||||
@TableField(value = "last_month_cost")
|
||||
private BigDecimal lastMonthCost;
|
||||
private String lastMonthCost;
|
||||
|
||||
|
||||
@TableField(value = "yoy_month_cost")
|
||||
private BigDecimal yoyMonthCost;
|
||||
private String yoyMonthCost;
|
||||
|
||||
|
||||
@TableField(value = "this_month_profit_rate")
|
||||
private BigDecimal thisMonthProfitRate;
|
||||
private String thisMonthProfitRate;
|
||||
|
||||
|
||||
@TableField(value = "last_month_profit_rate")
|
||||
private BigDecimal lastMonthProfitRate;
|
||||
private String lastMonthProfitRate;
|
||||
|
||||
|
||||
@TableField(value = "last_month_profit_share")
|
||||
private BigDecimal lastMonthProfitShare;
|
||||
private String lastMonthProfitShare;
|
||||
|
||||
|
||||
@TableField(value = "this_month_sa_money_share")
|
||||
private BigDecimal thisMonthSaMoneyShare;
|
||||
private String thisMonthSaMoneyShare;
|
||||
|
||||
|
||||
@TableField(value = "this_month_profit_share")
|
||||
private BigDecimal thisMonthProfitShare;
|
||||
private String thisMonthProfitShare;
|
||||
|
||||
|
||||
@TableField(value = "thissamoney_s")
|
||||
private BigDecimal thisMonthSaMoney_s;
|
||||
private String thisMonthSaMoney_s;
|
||||
|
||||
@TableField(value = "thisprofit_s")
|
||||
private BigDecimal thisMonthProfit_s;
|
||||
private String thisMonthProfit_s;
|
||||
|
||||
@TableField(value = "monthsaqty_yoy")
|
||||
private String monthsaqty_yoy;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.lideeyunji.core.framework.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
private String ny;
|
||||
|
||||
@TableField(value = "zone_id")
|
||||
private Long zoneId;
|
||||
private String zoneId;
|
||||
|
||||
|
||||
@TableField(value = "zone_name")
|
||||
@@ -37,7 +37,7 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "sale_type_id")
|
||||
private Long saleTypeId;
|
||||
private String saleTypeId;
|
||||
|
||||
|
||||
@TableField(value = "sale_type_name")
|
||||
@@ -45,7 +45,7 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "custom_id")
|
||||
private Long customId;
|
||||
private String customId;
|
||||
|
||||
|
||||
@TableField(value = "custom_name")
|
||||
@@ -65,7 +65,7 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "province_id")
|
||||
private Long provinceId;
|
||||
private String provinceId;
|
||||
|
||||
|
||||
@TableField(value = "province_name")
|
||||
@@ -73,7 +73,7 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "saler_id")
|
||||
private Long salerId;
|
||||
private String salerId;
|
||||
|
||||
|
||||
@TableField(value = "saler_name")
|
||||
@@ -81,59 +81,59 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
|
||||
|
||||
@TableField(value = "this_year_sa_qty")
|
||||
private Long thisYearSaQty;
|
||||
private String thisYearSaQty;
|
||||
|
||||
|
||||
@TableField(value = "last_year_sa_qty")
|
||||
private Long lastYearSaQty;
|
||||
private String lastYearSaQty;
|
||||
|
||||
|
||||
@TableField(value = "this_year_sa_money")
|
||||
private BigDecimal thisYearSaMoney;
|
||||
private String thisYearSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "last_year_sa_money")
|
||||
private BigDecimal lastYearSaMoney;
|
||||
private String lastYearSaMoney;
|
||||
|
||||
|
||||
@TableField(value = "this_year_profit")
|
||||
private BigDecimal thisYearProfit;
|
||||
private String thisYearProfit;
|
||||
|
||||
|
||||
@TableField(value = "last_year_profit")
|
||||
private BigDecimal lastYearProfit;
|
||||
private String lastYearProfit;
|
||||
|
||||
|
||||
@TableField(value = "this_year_cost")
|
||||
private BigDecimal thisYearCost;
|
||||
private String thisYearCost;
|
||||
|
||||
|
||||
@TableField(value = "last_year_cost")
|
||||
private BigDecimal lastYearCost;
|
||||
private String lastYearCost;
|
||||
|
||||
|
||||
@TableField(value = "this_year_profit_rate")
|
||||
private BigDecimal thisYearProfitRate;
|
||||
private String thisYearProfitRate;
|
||||
|
||||
|
||||
@TableField(value = "last_year_profit_rate")
|
||||
private BigDecimal lastYearProfitRate;
|
||||
private String lastYearProfitRate;
|
||||
|
||||
|
||||
@TableField(value = "this_year_profit_share")
|
||||
private BigDecimal thisYearProfitShare;
|
||||
private String thisYearProfitShare;
|
||||
|
||||
|
||||
@TableField(value = "last_year_profit_share")
|
||||
private BigDecimal lastYearProfitShare;
|
||||
private String lastYearProfitShare;
|
||||
|
||||
|
||||
@TableField(value = "this_year_sa_money_share")
|
||||
private BigDecimal thisYearSaMoneyShare;
|
||||
private String thisYearSaMoneyShare;
|
||||
|
||||
|
||||
@TableField(value = "last_year_sa_money_share")
|
||||
private BigDecimal lastYearSaMoneyShare;
|
||||
private String lastYearSaMoneyShare;
|
||||
|
||||
|
||||
@TableField(value = "this_year_sa_money_growth")
|
||||
@@ -148,10 +148,10 @@ public class NewGrBiSaAggYearCount implements Serializable
|
||||
private String thisYearProfitChange;
|
||||
|
||||
@TableField(value = "this_year_sa_money_s")
|
||||
private BigDecimal thissamoney_s;
|
||||
private String thisYearSaMoney_s;
|
||||
|
||||
@TableField(value = "this_year_profit_s")
|
||||
private BigDecimal thisprofit_s;
|
||||
private String thisYearProfit_s;
|
||||
|
||||
|
||||
@TableField(value = "saqty_yoy")
|
||||
|
||||
@@ -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列表")
|
||||
private List<Long> deptIdList;
|
||||
|
||||
@Schema(description = "设备类型id列表")
|
||||
private List<Long> sblxIdList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -68,6 +68,12 @@ public class GrBiFsBusinessRealServiceImpl extends ServiceImpl<GrBiFsBusinessRea
|
||||
int reNum = this.baseMapper.deleteOldBusinessReal(lideeYunJiBaseConstant.DS_ERP_BI_DATA,pastYear * 100 + pastMonth, currentYear * 100 + currentMonth);
|
||||
log.info("删除数量:{}", reNum);
|
||||
for (GrBiFsBusinessReal grBiSaSetdtl : grBiSaSetdtlList) {
|
||||
if(grBiSaSetdtl.getItemName().contains("销售毛利")){
|
||||
grBiSaSetdtl.setItemOrder((Integer.parseInt(grBiSaSetdtl.getItemOrder()) + 1) + "");
|
||||
}
|
||||
if(grBiSaSetdtl.getItemName().contains("净利润")){
|
||||
grBiSaSetdtl.setItemOrder("2");
|
||||
}
|
||||
int re = this.baseMapper.insert(grBiSaSetdtl);
|
||||
if (re < 1) {
|
||||
throw new RuntimeException("批量新增异常");
|
||||
|
||||
@@ -39,8 +39,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="thisMonthSaMoney_s" column="this_month_sa_money_s" />
|
||||
<result property="thisMonthProfit_s" column="this_month_profit_s" />
|
||||
<result property="monthsaqty_yoy" column="monthsaqty_yoy" />
|
||||
<result property="monthsamoney_yoy" column="monthsamoney_yoy" />
|
||||
<result property="lastMonthSaMoney_yoy" column="lastMonthSaMoney_yoy" />
|
||||
@@ -54,8 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="getTotalDetail" parameterType="com.lideeyunji.core.framework.params.SaAggParam" resultMap="NewGrBiSaAggMonthCountResult">
|
||||
SELECT
|
||||
ROUND(SUM(this_month_sa_money) / 10000, 2) AS thissamoney_s,
|
||||
ROUND(SUM(this_month_profit) / 10000, 2) AS thisprofit_s
|
||||
ROUND(SUM(this_month_sa_money) / 10000, 2) AS this_month_sa_money_s,
|
||||
ROUND(SUM(this_month_profit) / 10000, 2) AS this_month_profit_s
|
||||
FROM new_gr_bi_sa_agg_month_count
|
||||
<where>
|
||||
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear}</if>
|
||||
|
||||
@@ -38,8 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="thisYearSaMoneyGrowth" column="this_year_sa_money_growth" />
|
||||
<result property="thisYearProfitGrowth" column="this_year_profit_growth" />
|
||||
<result property="thisYearProfitChange" column="this_year_profit_change" />
|
||||
<result property="thissamoney_s" column="this_year_sa_money_s" />
|
||||
<result property="thisprofit_s" column="this_year_profit_s" />
|
||||
<result property="thisYearSaMoney_s" column="this_year_sa_money_s" />
|
||||
<result property="thisYearProfit_s" column="this_year_profit_s" />
|
||||
<result property="saqty_yoy" column="saqty_yoy" />
|
||||
<result property="samoney_yoy" column="samoney_yoy" />
|
||||
<result property="profit_yoy" column="profit_yoy" />
|
||||
|
||||
@@ -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>
|
||||
@@ -198,4 +198,13 @@ public interface ErrorCodeConstants {
|
||||
// ========== 站内信发送 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)) {
|
||||
Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds);
|
||||
//修改 若无clientIds时直接返回空
|
||||
if(CollUtil.isEmpty(clientIds)){
|
||||
return new PageResult<>();
|
||||
}
|
||||
pageReqVO.setIds(clientIds);
|
||||
}
|
||||
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>> getSblxViewList(List<Long> sblxIdList);
|
||||
|
||||
//获取用户分页列表
|
||||
Object getUserPage(Integer pageNo, Integer pageSize, lideeYunJiUserParam param);
|
||||
|
||||
Reference in New Issue
Block a user