init
This commit is contained in:
29
jeelowcode-module/jeelowcode-module-api/pom.xml
Normal file
29
jeelowcode-module/jeelowcode-module-api/pom.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-module</artifactId>
|
||||
<version>${jeelowcode.version}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-module-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>${project.artifactId}</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-utils</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<version>${jeelowcode.version}</version>
|
||||
<description> 个人业务模块API </description>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
package com.jeelowcode.module.api;
|
||||
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 低代码 API 接口
|
||||
*/
|
||||
public interface JeeLowCodeApi {
|
||||
|
||||
//获取表单设置的授权类型
|
||||
String getDbformAuthType(Long dbFormid);
|
||||
|
||||
String getReportAuthType(String reportCode);
|
||||
|
||||
//同步数据
|
||||
void syncData(String reportCode, Map<String, Object> req, ResultDataModel pages );
|
||||
}
|
||||
53
jeelowcode-module/jeelowcode-module-biz/pom.xml
Normal file
53
jeelowcode-module/jeelowcode-module-biz/pom.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-module</artifactId>
|
||||
<version>${jeelowcode.version}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-module-biz</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>${jeelowcode.version}</version>
|
||||
<description> 个人业务模块 </description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-module-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-service-infra-biz</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-engine</artifactId>
|
||||
<version>6.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-service-bpm-biz</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-service-system-biz</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
package com.jeelowcode.module.api;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.entity.ReportEntity;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.core.framework.service.IReportService;
|
||||
import com.jeelowcode.framework.utils.enums.AuthTypeEnum;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.CollectionUtil;
|
||||
import com.jeelowcode.framework.utils.utils.FuncBase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 低代码 API 接口
|
||||
*/
|
||||
@Service
|
||||
public class JeeLowCodeApiImpl extends BaseController implements JeeLowCodeApi {
|
||||
|
||||
@Autowired
|
||||
private IFormService formService;
|
||||
|
||||
@Autowired
|
||||
private IReportService reportService;
|
||||
|
||||
|
||||
//获取表单设置的授权类型
|
||||
@Override
|
||||
public String getDbformAuthType(Long dbFormid) {
|
||||
AuthTypeEnum authType = formService.getAuthType(dbFormid);
|
||||
return authType.getType();
|
||||
|
||||
}
|
||||
|
||||
//获取表单设置的授权类型
|
||||
@Override
|
||||
public String getReportAuthType(String reportCode) {
|
||||
AuthTypeEnum authType = reportService.getAuthType(reportCode);
|
||||
return authType.getType();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncData(String reportCode, Map<String, Object> req, ResultDataModel pages) {
|
||||
//1.根据reportCode 获取报表数据
|
||||
ReportEntity reportEntity = reportService.getReportEntityByCode(reportCode);
|
||||
String tableConfig = reportEntity.getTableConfig();
|
||||
if (FuncBase.isEmpty(tableConfig)) {
|
||||
return;
|
||||
}
|
||||
List<String> dataConfigList = FuncBase.toStrList(tableConfig);
|
||||
if(!dataConfigList.isEmpty()&&dataConfigList.contains("sync")){
|
||||
//报表设置同步才同步
|
||||
//构建同步主体
|
||||
String syncTableName="lc_report_data_sync";
|
||||
String syncDetailTableName="lc_report_data_sync_detail";
|
||||
|
||||
Long dbFormId = formService.getDbFormIdByTableName(syncTableName);
|
||||
Long detailFormId = formService.getDbFormIdByTableName(syncDetailTableName);
|
||||
HashMap<String, Object> newRecord = new HashMap<>();
|
||||
|
||||
newRecord.put("reportCode", reportEntity.getReportCode());
|
||||
newRecord.put("reportParam", JSONUtil.toJsonStr(req));
|
||||
newRecord.put("isSync", 0);
|
||||
if(CollectionUtil.isNotEmpty(pages.getRecords()))
|
||||
{
|
||||
newRecord.put("resultCount", (long) pages.getRecords().size());
|
||||
List<HashMap<String, Object>> detail = new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> map : pages.getRecords()) {
|
||||
HashMap<String, Object> newDetail = new HashMap<>();
|
||||
newDetail.put("isSync", 0);
|
||||
newDetail.put("resultData", JSONUtil.toJsonStr(map));
|
||||
newDetail.put("sort", pages.getRecords().indexOf(map));
|
||||
detail.add(newDetail);
|
||||
}
|
||||
newRecord.put(syncDetailTableName, detail);
|
||||
}else
|
||||
{
|
||||
newRecord.put("resultCount",0);
|
||||
}
|
||||
|
||||
super.addJsonData(dbFormId, JSONUtil.parseObj(newRecord));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
package com.jeelowcode.module.biz.component.btncommand;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.btncommand.definable.DefinableButtonPlugin;
|
||||
import com.jeelowcode.core.framework.config.btncommand.param.ButtonParamAdd;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
|
||||
/**
|
||||
* A自定义方法
|
||||
*/
|
||||
public class ADefinableButtonPlugin implements DefinableButtonPlugin<String, ButtonParamAdd> {
|
||||
|
||||
|
||||
@Override
|
||||
public String execute(ButtonParamAdd param) {
|
||||
System.out.println("param========"+ Func.json2Str(param));
|
||||
|
||||
System.out.println("执行A方法");
|
||||
return "成功";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package com.jeelowcode.module.biz.component.btncommand;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.btncommand.definable.DefinableButtonPlugin;
|
||||
import com.jeelowcode.core.framework.config.btncommand.param.ButtonParamEdit;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
|
||||
/**
|
||||
* B自定义方法
|
||||
*/
|
||||
public class BDefinableButtonPlugin implements DefinableButtonPlugin<Integer, ButtonParamEdit> {
|
||||
@Override
|
||||
public Integer execute(ButtonParamEdit param) {
|
||||
System.out.println("param=========="+ Func.json2Str(param));
|
||||
System.out.println("执行B方法");
|
||||
return 123;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
package com.jeelowcode.module.biz.component.virtualization;
|
||||
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.virtualization.VirtualizationFieldPlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component("aVirtualizationPlugin")
|
||||
public class AVirtualizationPlugin implements VirtualizationFieldPlugin {
|
||||
|
||||
@Override
|
||||
public String execute(Map<String, Object> dataMap) {
|
||||
System.out.println(Func.json2Str(dataMap));
|
||||
return "执行A插件返回的结果";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
package com.jeelowcode.module.biz.component.virtualization;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.virtualization.VirtualizationFieldPlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component("bVirtualizationPlugin")
|
||||
public class BVirtualizationPlugin implements VirtualizationFieldPlugin {
|
||||
|
||||
@Override
|
||||
public String execute(Map<String, Object> dataMap) {
|
||||
System.out.println(Func.json2Str(dataMap));
|
||||
return "执行B插件返回的结果";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
|
||||
package com.jeelowcode.module.biz.controller;
|
||||
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.core.framework.utils.FuncWeb;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.tenant.annotation.JeeLowCodeTenantIgnore;
|
||||
import com.jeelowcode.module.biz.dto.RequestDTO;
|
||||
import com.jeelowcode.module.biz.service.IDemoService;
|
||||
import com.jeelowcode.framework.utils.model.global.BaseWebResult;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.service.infra.entity.ConfigDO;
|
||||
import com.jeelowcode.service.infra.service.IConfigService;
|
||||
import com.jeelowcode.tool.framework.common.model.ContentModel;
|
||||
import com.jeelowcode.tool.framework.common.model.PartModel;
|
||||
import com.jeelowcode.tool.framework.common.pojo.CommonResult;
|
||||
import com.jeelowcode.tool.framework.common.util.http.HttpUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.error;
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-02-26 14:59
|
||||
* @dedescription:
|
||||
*/
|
||||
@JeeLowCodeTenantIgnore
|
||||
@Tag(name = "低代码框架 - 个性化接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START +"/demo")
|
||||
public class DemoController {
|
||||
|
||||
private final IDemoService demoService;
|
||||
|
||||
@Autowired
|
||||
private IConfigService configService;
|
||||
|
||||
|
||||
@GetMapping({"/getData"})
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取demo数据")
|
||||
public BaseWebResult getData() {
|
||||
List<Map<String, Object>> dataMapList = demoService.getDemoData();
|
||||
return BaseWebResult.success(dataMapList);
|
||||
}
|
||||
|
||||
@GetMapping({"/getAliToken"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "取阿里平台Token")
|
||||
public CommonResult<String> getAliToken() {
|
||||
try{
|
||||
ConfigDO configUrl = configService.getConfigByKey("aliUrl");
|
||||
ConfigDO configKey = configService.getConfigByKey("aliAppkey");
|
||||
ConfigDO configSecret = configService.getConfigByKey("aliAppSecret");
|
||||
if(Objects.isNull(configUrl) || Objects.isNull(configKey) || Objects.isNull(configSecret)
|
||||
|| StringUtils.isEmpty(configUrl.getValue()) || StringUtils.isEmpty(configKey.getValue()) || StringUtils.isEmpty(configSecret.getValue())){
|
||||
throw new JeeLowCodeException("缺少阿里平台必要参数配置");
|
||||
}
|
||||
String token = HttpUtils.getToken(configUrl.getValue()+"/_campus/open/accessToken.json",configKey.getValue(),configSecret.getValue());
|
||||
return success(token);
|
||||
}catch (Exception e){
|
||||
return error(500,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping({"/getAliData"})
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "取阿里平台园区数据")
|
||||
public CommonResult<List<PartModel>> getAliData(String token) {
|
||||
ConfigDO configUrl = configService.getConfigByKey("aliUrl");
|
||||
String bodyString = "{\n" +
|
||||
" \"api\": \"/space/campus/list\",\n" +
|
||||
" \"params\": [\n" +
|
||||
" {\n" +
|
||||
" \"pageSize\": \"10000\",\n" +
|
||||
" \"page\": 1\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
"}";
|
||||
List<PartModel> contentModels = HttpUtils.getTokenDate(configUrl.getValue()+"/_campus/open/api/invoked.json?access_token="+token,bodyString);
|
||||
return success(contentModels);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping({"/getCustomerInterface"})
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "取阿里平台通用接口取数")
|
||||
public CommonResult<String> getCustomerInterface(@RequestBody RequestDTO params) {
|
||||
try{
|
||||
String result = HttpUtils.getInterfaceData(params.getUrl(),params.getParams(),params.getBody(),params.getMethod(),params.getAuthorization());
|
||||
return success(result);
|
||||
}catch (Exception e){
|
||||
return error(500,e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
|
||||
package com.jeelowcode.module.biz.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.tenant.annotation.JeeLowCodeTenantIgnore;
|
||||
import com.jeelowcode.framework.utils.adapter.IJeeLowCodeAdapter;
|
||||
import com.jeelowcode.framework.utils.model.JeeLowCodeUser;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.CollectionUtil;
|
||||
import com.jeelowcode.module.biz.service.IExamPlanService;
|
||||
import com.jeelowcode.tool.framework.common.pojo.CommonResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @author LIFY
|
||||
* @create 2025-09-13
|
||||
* @dedescription:
|
||||
*/
|
||||
@JeeLowCodeTenantIgnore
|
||||
@Tag(name = "低代码框架 - 个性化接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START +"/examIssus")
|
||||
public class ExamIssusController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IExamPlanService iExamPlanService;
|
||||
|
||||
private final IJeeLowCodeAdapter jeeLowCodeAdapter;
|
||||
|
||||
@Autowired
|
||||
private IFormService dbFormService;
|
||||
|
||||
@GetMapping({"/addRecord"})
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "下发考试记录数据")
|
||||
public CommonResult<String> savePlanIssus(String tableId, String ids, String userIds) {
|
||||
String[] idArr = ids.split(",");
|
||||
String[] userIdArr = userIds.split(",");
|
||||
if (Objects.isNull(idArr) || idArr.length == 0 || Objects.isNull(userIdArr) || userIdArr.length == 0) {
|
||||
throw new JeeLowCodeException("缺少必要参数");
|
||||
}
|
||||
|
||||
String tableName="lc_exam_record";
|
||||
Long dbFormId = dbFormService.getDbFormIdByTableName(tableName);
|
||||
List<Long> userIdList = Arrays.stream(userIdArr).map(Long::parseLong).collect(Collectors.toList());
|
||||
IPage<JeeLowCodeUser> userPage = (IPage<JeeLowCodeUser>) jeeLowCodeAdapter.getUserPageByUserIds(1, 10000, userIdList);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(userPage.getRecords())) {
|
||||
for (int i = 0; i < idArr.length; i++) {
|
||||
ResultDataModel resultDataModel = super.getDataDetail(Long.parseLong(tableId), Long.valueOf(idArr[i]), new HashMap<String, Object>());
|
||||
if (CollectionUtil.isNotEmpty(resultDataModel.getRecords())) {
|
||||
if (resultDataModel.getRecords().get(0).containsKey("jeelowcode_subtable_data")) {
|
||||
HashMap<String, Object> details = (HashMap<String, Object>) resultDataModel.getRecords().get(0).get("jeelowcode_subtable_data");
|
||||
if (details.containsKey("lc_exam_plan_issus")) {
|
||||
List<HashMap<String, Object>> detail = (List<HashMap<String, Object>>) details.get("lc_exam_plan_issus");
|
||||
|
||||
List<JSONObject> tasks = new ArrayList<JSONObject>();
|
||||
if(Objects.isNull(detail)) {
|
||||
detail = new ArrayList<HashMap<String, Object>>();
|
||||
}
|
||||
for (JeeLowCodeUser dbuser : userPage.getRecords()) {
|
||||
HashMap<String, Object> user = CollectionUtil.isEmpty(detail) ? null : detail.stream().filter(t -> t.containsKey("userId") && t.get("userId").toString().equals(dbuser.getUserId())).findFirst().orElse(null);
|
||||
if (Objects.isNull(user)) {
|
||||
HashMap<String, Object> newUser = new HashMap<>();
|
||||
newUser.put("chargeId", dbuser.getUserId());
|
||||
newUser.put("chargeName", dbuser.getNickName());
|
||||
newUser.put("deptId", dbuser.getDeptId());
|
||||
newUser.put("deptName", dbuser.getDeptName());
|
||||
newUser.put("examId", Long.valueOf(idArr[i]));
|
||||
detail.add(newUser);
|
||||
|
||||
// 组装任务
|
||||
//查询待分发单据 examId 从 lc_exam_plan 根据Id查询数据
|
||||
Map<String, Object> examPlan = iExamPlanService.getExamPlanById(Long.valueOf(idArr[i]));
|
||||
|
||||
HashMap<String, Object> newRecord = new HashMap<>();
|
||||
|
||||
newRecord.put("chargeId", dbuser.getUserId());
|
||||
newRecord.put("chargeName", dbuser.getNickName());
|
||||
newRecord.put("IssusDeptName", dbuser.getDeptName());
|
||||
newRecord.put("IssueDeptId", dbuser.getDeptId());
|
||||
|
||||
newRecord.put("examName", examPlan.get("examname"));
|
||||
newRecord.put("examId", examPlan.get("id"));
|
||||
newRecord.put("examRecordStatus", 1);
|
||||
|
||||
newRecord.put("billNo", "KSJL" + System.currentTimeMillis());
|
||||
tasks.add(JSONUtil.parseObj(newRecord));
|
||||
}
|
||||
}
|
||||
resultDataModel.getRecords().get(0).put("lc_exam_plan_issus", detail);
|
||||
resultDataModel.getRecords().get(0).put("examStatus", 2);//跟新状态为待执行
|
||||
super.editJsonData(Long.valueOf(tableId), JSONUtil.parseObj(resultDataModel.getRecords().get(0)));
|
||||
|
||||
super.addJsonData(dbFormId, tasks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("下发成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
|
||||
package com.jeelowcode.module.biz.controller;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.enums.ApproveStatusEnum;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.tenant.annotation.JeeLowCodeTenantIgnore;
|
||||
import com.jeelowcode.framework.utils.adapter.IJeeLowCodeAdapter;
|
||||
import com.jeelowcode.framework.utils.model.JeeLowCodeUser;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.CollectionUtil;
|
||||
import com.jeelowcode.module.biz.service.IDrillPlanService;
|
||||
import com.jeelowcode.tool.framework.common.pojo.CommonResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @author LIFY
|
||||
* @create 2025-09-13
|
||||
* @dedescription:
|
||||
*/
|
||||
@JeeLowCodeTenantIgnore
|
||||
@Tag(name = "低代码框架 - 个性化接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START +"/planIssus")
|
||||
public class PlanIssusController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IDrillPlanService iDrillPlanService;
|
||||
|
||||
private final IJeeLowCodeAdapter jeeLowCodeAdapter;
|
||||
|
||||
@Autowired
|
||||
private IFormService dbFormService;
|
||||
|
||||
@GetMapping({"/addTask"})
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "分发任务数据")
|
||||
public CommonResult<String> savePlanIssus(String tableId, String ids, String userIds) {
|
||||
String[] idArr = ids.split(",");
|
||||
String[] userIdArr = userIds.split(",");
|
||||
if (Objects.isNull(idArr) || idArr.length == 0 || Objects.isNull(userIdArr) || userIdArr.length == 0) {
|
||||
throw new JeeLowCodeException("缺少必要参数");
|
||||
}
|
||||
|
||||
String tableName="lc_drill_task";
|
||||
Long dbFormId = dbFormService.getDbFormIdByTableName(tableName);
|
||||
List<Long> userIdList = Arrays.stream(userIdArr).map(Long::parseLong).collect(Collectors.toList());
|
||||
IPage<JeeLowCodeUser> userPage = (IPage<JeeLowCodeUser>) jeeLowCodeAdapter.getUserPageByUserIds(1, 10000, userIdList);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(userPage.getRecords())) {
|
||||
for (int i = 0; i < idArr.length; i++) {
|
||||
ResultDataModel resultDataModel = super.getDataDetail(Long.parseLong(tableId), Long.valueOf(idArr[i]), new HashMap<String, Object>());
|
||||
if (CollectionUtil.isNotEmpty(resultDataModel.getRecords())) {
|
||||
if (resultDataModel.getRecords().get(0).containsKey("jeelowcode_subtable_data")) {
|
||||
HashMap<String, Object> details = (HashMap<String, Object>) resultDataModel.getRecords().get(0).get("jeelowcode_subtable_data");
|
||||
if (details.containsKey("lc_drill_plan_issus")) {
|
||||
List<HashMap<String, Object>> detail = (List<HashMap<String, Object>>) details.get("lc_drill_plan_issus");
|
||||
|
||||
List<JSONObject> tasks = new ArrayList<JSONObject>();
|
||||
if(Objects.isNull(detail)) {
|
||||
detail = new ArrayList<HashMap<String, Object>>();
|
||||
}
|
||||
for (JeeLowCodeUser dbuser : userPage.getRecords()) {
|
||||
HashMap<String, Object> user = CollectionUtil.isEmpty(detail) ? null
|
||||
: detail.stream().filter(t ->
|
||||
t.containsKey("dept_id") && t.get("dept_id").toString().equals(dbuser.getDeptId())).
|
||||
findFirst().orElse(null);
|
||||
if (Objects.isNull(user)) {
|
||||
HashMap<String, Object> newUser = new HashMap<>();
|
||||
newUser.put("charge_id", dbuser.getUserId());
|
||||
newUser.put("charge_name", dbuser.getNickName());
|
||||
newUser.put("dept_id", dbuser.getDeptId());
|
||||
newUser.put("dept_name", dbuser.getDeptName());
|
||||
newUser.put("drill_plan_id", Long.valueOf(idArr[i]));
|
||||
detail.add(newUser);
|
||||
|
||||
// 组装任务
|
||||
//查询待分发单据 根据planId 从 lc_drill_plan 根据planId查询数据
|
||||
Map<String, Object> drillPlan = iDrillPlanService.getDrillPlanById(Long.valueOf(idArr[i]));
|
||||
// 根据planId 从 lc_drill_plan_cycle 查询数据 list<LcDrillPlanCycle>
|
||||
|
||||
List<Map<String, Object>> drillPlanCycles = iDrillPlanService.getDrillPlanCycles(Long.valueOf(idArr[i]));
|
||||
|
||||
// 遍历lcDrillPlanCycles
|
||||
for (Map<String, Object> planCycle : drillPlanCycles) {
|
||||
HashMap<String, Object> newTask = new HashMap<>();
|
||||
|
||||
newTask.put("charge_id", dbuser.getUserId());
|
||||
newTask.put("charge_name", dbuser.getNickName());
|
||||
newTask.put("dept_id", dbuser.getDeptId());
|
||||
newTask.put("dept_name", dbuser.getDeptName());
|
||||
|
||||
newTask.put("emergency_plan_name", drillPlan.get("emergency_plan_name"));
|
||||
newTask.put("emergency_plan_id", drillPlan.get("emergency_plan_id"));
|
||||
|
||||
newTask.put("drill_plan_name", drillPlan.get("drill_plan_name"));
|
||||
newTask.put("drill_plan_id", drillPlan.get("id"));
|
||||
newTask.put("sDate", planCycle.get("sdate"));
|
||||
newTask.put("eDate", planCycle.get("edate"));
|
||||
|
||||
newTask.put("task_status", 1);
|
||||
|
||||
newTask.put("billNo", "RW" + System.currentTimeMillis());
|
||||
|
||||
tasks.add(JSONUtil.parseObj(newTask));
|
||||
}
|
||||
}
|
||||
}
|
||||
resultDataModel.getRecords().get(0).put("lc_drill_plan_issus", detail);
|
||||
resultDataModel.getRecords().get(0).put("drill_plan_status_type", 3);//跟新状态为执行中
|
||||
super.editJsonData(Long.valueOf(tableId), JSONUtil.parseObj(resultDataModel.getRecords().get(0)));
|
||||
|
||||
super.addJsonData(dbFormId, tasks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("下发成功");
|
||||
}
|
||||
|
||||
@GetMapping({"/getEmergencyPlanDict"})
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取应急预案字典数据")
|
||||
public CommonResult<List<Map<String, Object>>> getEmergencyPlanDict()
|
||||
{
|
||||
String tableName="lc_emergency_plan";
|
||||
Long dbFormId = dbFormService.getDbFormIdByTableName(tableName);
|
||||
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put(ApproveStatusEnum.codeField, ApproveStatusEnum.APPROVED.getCode());
|
||||
ResultDataModel resultDataModel = super.getDataPage(dbFormId, param);
|
||||
|
||||
return success(resultDataModel.getRecords());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.jeelowcode.module.biz.controller;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.tenant.annotation.JeeLowCodeTenantIgnore;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.CollectionUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author LIFY
|
||||
* @create 2025-09-126
|
||||
* @dedescription:
|
||||
*/
|
||||
@JeeLowCodeTenantIgnore
|
||||
@Tag(name = "低代码框架 - 个性化接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START +"/riskHazard")
|
||||
public class RiskHazardController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFormService formService;
|
||||
|
||||
@GetMapping({"/syncData2RiskHazard"})
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "同步数据")
|
||||
public void SyncData2RiskHazard()
|
||||
{
|
||||
// 报表 code
|
||||
String reportCode="ali_risk_data";
|
||||
String syncTableName="lc_report_data_sync";
|
||||
String syncDetailTableName="lc_report_data_sync_detail";
|
||||
String riskTableName="lc_risk_hazard_manage";
|
||||
String campusTableName="campus_info";
|
||||
Long dbFormId = formService.getDbFormIdByTableName(syncTableName);
|
||||
Long detailFormId = formService.getDbFormIdByTableName(syncDetailTableName);
|
||||
Long riskFormId = formService.getDbFormIdByTableName(riskTableName);
|
||||
Long campusFormId = formService.getDbFormIdByTableName(campusTableName);
|
||||
|
||||
// 根据 报表code获取所有未同步的主表List
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("reportCode", reportCode);
|
||||
param.put("isSync", 0);
|
||||
ResultDataModel unSyncs = super.getDataPage(dbFormId, param);
|
||||
|
||||
// 获取所有园区信息
|
||||
Map<String, Object> param3 = new HashMap<>();
|
||||
ResultDataModel allCampus = super.getDataPage(campusFormId, param3);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(unSyncs.getRecords()))
|
||||
{
|
||||
List<JSONObject> syncList = new ArrayList<>();
|
||||
List<JSONObject> syncDetailList = new ArrayList<>();
|
||||
for (Map<String, Object> unSync : unSyncs.getRecords()) {
|
||||
// 根据 同步表主表Id 获取所有未同步的明细表数据
|
||||
Map<String, Object> param2 = new HashMap<>();
|
||||
param2.put("syncId", unSync.get("id"));
|
||||
param2.put("isSync", 0);
|
||||
ResultDataModel unSyncDetails = super.getDataPage(detailFormId, param2);
|
||||
if(CollectionUtil.isNotEmpty(unSyncDetails.getRecords())) {
|
||||
List<JSONObject> newRisks=new ArrayList<>();
|
||||
for (Map<String, Object> data : unSyncDetails.getRecords()) {
|
||||
Object result = data.get("resultData");
|
||||
JSONObject sourceData = result instanceof JSONObject
|
||||
? (JSONObject) result
|
||||
: JSONUtil.parseObj(String.valueOf(result));
|
||||
// 生成 风险隐患表数据
|
||||
HashMap<String, Object> newRisk = new HashMap<>();
|
||||
newRisk.put("sync_Id", data.get("id"));
|
||||
newRisk.put("source_Id", sourceData.get("sourceid"));
|
||||
newRisk.put("billNo", sourceData.get("work_order_id"));
|
||||
newRisk.put("source", 2); //来源 默认线上
|
||||
newRisk.put("company_name", sourceData.get("company_name"));
|
||||
newRisk.put("company_id", sourceData.get("company_id"));
|
||||
|
||||
|
||||
newRisk.put("parkId", sourceData.get("campus_id"));
|
||||
// 设置 园区名称
|
||||
if(sourceData.containsKey("campus_id")) {
|
||||
String campusId = Func.getMap2Str(sourceData, "campus_id");
|
||||
// 根据name查找id
|
||||
Map<String, Object> depMap = allCampus.getRecords().stream()
|
||||
.filter(t -> t.get("campus_id").toString()
|
||||
.equals(campusId)).findFirst().orElse(null);
|
||||
if (Objects.nonNull(depMap)) {
|
||||
newRisk.put("parkName", depMap.get("campus_name"));
|
||||
}
|
||||
}
|
||||
//newRisk.put("check_area", sourceData.get("check_area"));
|
||||
//newRisk.put("check_item", sourceData.get("check_item"));
|
||||
newRisk.put("check_content", sourceData.get("item_name"));
|
||||
newRisk.put("check_date", sourceData.get("creator_time"));
|
||||
newRisk.put("check_people", sourceData.get("creator_name"));
|
||||
newRisk.put("check_problem", sourceData.get("question_name"));
|
||||
newRisk.put("corrective_action", sourceData.get("operate_content"));
|
||||
newRisk.put("corrective_charge_people", sourceData.get("person_name"));
|
||||
newRisk.put("risk_level", sourceData.get("level_name"));
|
||||
newRisk.put("corrective_period", sourceData.get("confirm_time"));
|
||||
newRisk.put("corrective_confirm_people", sourceData.get("confirm_person_name"));
|
||||
newRisk.put("remarks", sourceData.get("remark"));
|
||||
|
||||
newRisks.add(JSONUtil.parseObj(newRisk));
|
||||
// 更新明细表为已同步
|
||||
data.put("isSync", 1);
|
||||
syncDetailList.add(JSONUtil.parseObj(data));
|
||||
}
|
||||
// 插入新的 风险隐患数据
|
||||
super.addJsonData(riskFormId,newRisks);
|
||||
}
|
||||
// 更新主表为已同步
|
||||
unSync.put("isSync", 1);
|
||||
syncList.add(JSONUtil.parseObj(unSync));
|
||||
|
||||
// 更新同步数据表和同步数据明细表
|
||||
super.editJsonData(detailFormId, syncDetailList);
|
||||
}
|
||||
// 更新同步数据表和同步数据明细表
|
||||
super.editJsonData(dbFormId, syncList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.jeelowcode.module.biz.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.tenant.annotation.JeeLowCodeTenantIgnore;
|
||||
import com.jeelowcode.framework.utils.adapter.IJeeLowCodeAdapter;
|
||||
import com.jeelowcode.framework.utils.model.JeeLowCodeUser;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.CollectionUtil;
|
||||
import com.jeelowcode.module.biz.dto.RequestDTO;
|
||||
import com.jeelowcode.tool.framework.common.pojo.CommonResult;
|
||||
import com.jeelowcode.tool.framework.common.util.http.HttpUtils;
|
||||
import com.jeelowcode.tool.framework.common.util.json.JsonUtils;
|
||||
import com.mchange.lang.LongUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jodd.util.ArraysUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.error;
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@JeeLowCodeTenantIgnore
|
||||
@Tag(name = "低代码框架 - 自定义教育培训接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START + "/training")
|
||||
public class TrainingController extends BaseController {
|
||||
|
||||
private final IJeeLowCodeAdapter jeeLowCodeAdapter;
|
||||
|
||||
@GetMapping({"/sendDept"})
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "下发计划给使用部门")
|
||||
public CommonResult<String> sendDept(String tableId, String ids, String userIds) {
|
||||
String[] idArr = ids.split(",");
|
||||
String[] userIdArr = userIds.split(",");
|
||||
if (Objects.isNull(idArr) || idArr.length == 0 || Objects.isNull(userIdArr) || userIdArr.length == 0) {
|
||||
throw new JeeLowCodeException("缺少必要参数");
|
||||
}
|
||||
|
||||
List<Long> userIdList = Arrays.stream(userIdArr).map(Long::parseLong).collect(Collectors.toList());
|
||||
IPage<JeeLowCodeUser> userPage = (IPage<JeeLowCodeUser>) jeeLowCodeAdapter.getUserPageByUserIds(1, 10000, userIdList);
|
||||
if (CollectionUtil.isNotEmpty(userPage.getRecords())) {
|
||||
for (int i = 0; i < idArr.length; i++) {
|
||||
ResultDataModel resultDataModel = super.getDataDetail(Long.parseLong(tableId), Long.valueOf(idArr[i]), new HashMap<String, Object>());
|
||||
if (CollectionUtil.isNotEmpty(resultDataModel.getRecords())) {
|
||||
// resultDataModel.getRecords().get(0).get("jeelowcode_subtable_data") lc_training_plan_area
|
||||
if (resultDataModel.getRecords().get(0).containsKey("jeelowcode_subtable_data")) {
|
||||
HashMap<String, Object> details = (HashMap<String, Object>) resultDataModel.getRecords().get(0).get("jeelowcode_subtable_data");
|
||||
if (details.containsKey("lc_training_plan_area")) {
|
||||
List<HashMap<String, Object>> detail = (List<HashMap<String, Object>>) details.get("lc_training_plan_area");
|
||||
if(Objects.isNull(detail)) {
|
||||
detail = new ArrayList<HashMap<String, Object>>();
|
||||
}
|
||||
for (JeeLowCodeUser dbuser : userPage.getRecords()) {
|
||||
HashMap<String, Object> user = CollectionUtil.isEmpty(detail) ? null : detail.stream().filter(t -> t.containsKey("userId") && t.get("userId").toString().equals(dbuser.getUserId())).findFirst().orElse(null);
|
||||
if (Objects.isNull(user)) {
|
||||
HashMap<String, Object> newUser = new HashMap<>();
|
||||
newUser.put("userId", dbuser.getUserId());
|
||||
newUser.put("userName", dbuser.getNickName());
|
||||
newUser.put("deptId", dbuser.getDeptId());
|
||||
newUser.put("deptName", dbuser.getDeptName());
|
||||
newUser.put("planId", Long.valueOf(idArr[i]));
|
||||
detail.add(newUser);
|
||||
}
|
||||
}
|
||||
resultDataModel.getRecords().get(0).put("lc_training_plan_area", detail);
|
||||
super.editJsonData(Long.valueOf(tableId), JSONUtil.parseObj(resultDataModel.getRecords().get(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("下发成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-19 9:35
|
||||
* @dedescription:
|
||||
*/
|
||||
@Component("demoAfterAdvicePlugin")
|
||||
public class DemoAfterAdvicePlugin implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
List<Map<String, Object>> list = enhanceContext.getParam().getList();
|
||||
list.forEach(
|
||||
map -> map.replace("name", map.get("name") + "01"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-20 14:32
|
||||
* @dedescription:
|
||||
*/
|
||||
@Component("demoAfterAdvicePlugin02")
|
||||
public class DemoAfterAdvicePlugin02 implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
List<Map<String, Object>> list = enhanceContext.getParam().getList();
|
||||
list.forEach(
|
||||
map -> map.replace("name", map.get("name") + "02"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-21 9:34
|
||||
* @dedescription:
|
||||
*/
|
||||
@Component("demoAfterAdvicePlugin03")
|
||||
public class DemoAfterAdvicePlugin03 implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
List<Map<String, Object>> list = enhanceContext.getParam().getList();
|
||||
list.forEach(
|
||||
map -> map.replace("name", map.get("name") + "_合集"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AroundAdvicePlugin;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-13 11:42
|
||||
* @dedescription: 环绕增强测试
|
||||
*/
|
||||
|
||||
@Component("demoAroundAdvicePlugin")
|
||||
public class DemoAroundAdvicePlugin implements AroundAdvicePlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeExecute(EnhanceContext enhanceContext) {
|
||||
//
|
||||
// System.out.println("----------------------------------------------------------beforeExecute----------------------------------------------------------");
|
||||
// EnhanceResult result = new EnhanceResult();
|
||||
// result.setExitFlag(false);
|
||||
// enhanceContext.setResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterExecute(EnhanceContext enhanceContext) {
|
||||
// System.out.println("----------------------------------------------------------afterExecute----------------------------------------------------------");
|
||||
// List<Map<String, Object>> records = enhanceContext.getResult().getRecords();
|
||||
// records.forEach(record -> {
|
||||
// record.replace("name", FuncBase.getMap2Str(record, "name")+"_after_enhance");
|
||||
// });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceParam;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceResult;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.BeforeAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.utils.utils.FuncBase;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-15 11:31
|
||||
* @dedescription: 前置增强测试
|
||||
*/
|
||||
public class DemoBeforeAdvicePlugin implements BeforeAdvicePlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
EnhanceParam param = enhanceContext.getParam();
|
||||
Map<String, Object> params = param.getParams();
|
||||
String name = FuncBase.getMap2Str(params, "name");
|
||||
if (Func.equals(name, "jeelowcode")) {
|
||||
throw new JeeLowCodeException("不允许使用jeelowcode");
|
||||
}
|
||||
params.replace("name",FuncBase.getMap2Str(params,"name")+"before_enhance");
|
||||
|
||||
EnhanceResult result = new EnhanceResult();
|
||||
result.setExitFlag(false);
|
||||
enhanceContext.setResult(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceResult;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-19 15:05
|
||||
* @dedescription:
|
||||
*/
|
||||
public class TestAfterAdvicePlugin01 implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
EnhanceResult result = enhanceContext.getResult();
|
||||
List<Map<String, Object>> records = result.getRecords();
|
||||
records.forEach(record -> {
|
||||
record.replace("name","test01");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceResult;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.framework.utils.utils.FuncBase;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-19 15:06
|
||||
* @dedescription:
|
||||
*/
|
||||
public class TestAfterAdvicePlugin02 implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
EnhanceResult result = enhanceContext.getResult();
|
||||
List<Map<String, Object>> records = result.getRecords();
|
||||
records.forEach(
|
||||
record -> {
|
||||
if (FuncBase.getMap2Int(record,"id") >5){
|
||||
record.replace("name", "test02");
|
||||
}else {
|
||||
record.replace("name", "test01");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.criteria.DifferenceCriteriaFilterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.criteria.IntersectionCriteriaFilterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.criteria.OrCriteriaFilterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.criteria.UnionCriteriaFilterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.framework.utils.utils.FuncBase;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-19 15:03
|
||||
* @dedescription:
|
||||
*/
|
||||
public class TestCriterFilter {
|
||||
|
||||
|
||||
|
||||
|
||||
//合集
|
||||
@Test
|
||||
public void testCriterFilter(){
|
||||
EnhanceContext context = new EnhanceContext();
|
||||
context.setParam(01L,new HashMap<>(),new ArrayList<>());
|
||||
context.setResult(false, "01",10L,initRecords());
|
||||
TestAfterAdvicePlugin01 plugin01 = new TestAfterAdvicePlugin01();
|
||||
TestAfterAdvicePlugin02 plugin02 = new TestAfterAdvicePlugin02();
|
||||
//合集
|
||||
OrCriteriaFilterAdvicePlugin orPlugin = new OrCriteriaFilterAdvicePlugin(plugin01, plugin02);
|
||||
orPlugin.execute(context);
|
||||
System.out.println("合集:"+FuncBase.json2Str(context.getResult().getRecords()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//差集
|
||||
@Test
|
||||
public void testCriterFilter02(){
|
||||
EnhanceContext context = new EnhanceContext();
|
||||
context.setParam(01L,new HashMap<>(),new ArrayList<>());
|
||||
context.setResult(false, "01",10L,initRecords());
|
||||
TestAfterAdvicePlugin01 plugin01 = new TestAfterAdvicePlugin01();
|
||||
TestAfterAdvicePlugin02 plugin02 = new TestAfterAdvicePlugin02();
|
||||
//差集
|
||||
DifferenceCriteriaFilterAdvicePlugin differPlugin = new DifferenceCriteriaFilterAdvicePlugin(plugin01, plugin02);
|
||||
differPlugin.execute(context);
|
||||
System.out.println("差集:"+FuncBase.json2Str(context.getResult().getRecords()));
|
||||
}
|
||||
|
||||
//并集
|
||||
@Test
|
||||
public void testCriterFilter03(){
|
||||
EnhanceContext context = new EnhanceContext();
|
||||
context.setParam(01L,new HashMap<>(),new ArrayList<>());
|
||||
context.setResult(false, "01",10L,initRecords());
|
||||
TestAfterAdvicePlugin01 plugin01 = new TestAfterAdvicePlugin01();
|
||||
TestAfterAdvicePlugin02 plugin02 = new TestAfterAdvicePlugin02();
|
||||
//并集
|
||||
UnionCriteriaFilterAdvicePlugin unionPlugin = new UnionCriteriaFilterAdvicePlugin(plugin01, plugin02);
|
||||
unionPlugin.execute(context);
|
||||
System.out.println("并集:"+FuncBase.json2Str(context.getResult().getRecords()));
|
||||
}
|
||||
|
||||
//交集
|
||||
@Test
|
||||
public void testCriterFilter04(){
|
||||
EnhanceContext context = new EnhanceContext();
|
||||
context.setParam(01L,new HashMap<>(),new ArrayList<>());
|
||||
context.setResult(false, "01",10L,initRecords());
|
||||
TestAfterAdvicePlugin01 plugin01 = new TestAfterAdvicePlugin01();
|
||||
TestAfterAdvicePlugin02 plugin02 = new TestAfterAdvicePlugin02();
|
||||
//交集
|
||||
IntersectionCriteriaFilterAdvicePlugin intersection = new IntersectionCriteriaFilterAdvicePlugin(plugin01, plugin02);
|
||||
intersection.execute(context);
|
||||
System.out.println("交集:"+FuncBase.json2Str(context.getResult().getRecords()));
|
||||
}
|
||||
|
||||
|
||||
public static List<Map<String,Object>> initRecords(){
|
||||
List<Map<String,Object>> records = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Map<String,Object> record = new HashMap<>();
|
||||
record.put("id",i);
|
||||
record.put("name","name--"+i);
|
||||
records.add(record);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-09-09 14:51
|
||||
* @dedescription:
|
||||
*/
|
||||
|
||||
@Component("testListAndPageEnhance")
|
||||
public class TestListAndPageEnhance implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
List<Map<String, Object>> list = enhanceContext.getParam().getList();
|
||||
list.forEach(map -> {
|
||||
map.replace("name", Func.getMap2Str(map,"name")+"_list");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-09-09 14:54
|
||||
* @dedescription:
|
||||
*/
|
||||
@Component("testPageEnhance")
|
||||
public class TestPageEnhance implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
List<Map<String, Object>> list = enhanceContext.getParam().getList();
|
||||
list.forEach(map -> {
|
||||
map.replace("name", Func.getMap2Str(map,"name")+"_page");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
package com.jeelowcode.module.biz.demo.test;
|
||||
|
||||
import com.jeelowcode.tool.framework.common.util.json.JsonUtils;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceParam;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-09-12 9:50
|
||||
* @dedescription:
|
||||
*/
|
||||
@Slf4j
|
||||
public class TestUpdateEnhance implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
EnhanceParam param = enhanceContext.getParam();
|
||||
Map<String, Object> params = param.getParams();
|
||||
log.error("TestUpdateEnhance execute params:{}", JsonUtils.toJsonString(params));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.jeelowcode.module.biz.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IssusUserDto {
|
||||
private int charge_id;
|
||||
private String charge_name;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.jeelowcode.module.biz.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RequestBodyDTO {
|
||||
|
||||
private String api;
|
||||
private List<RequestParamsDTO> params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.jeelowcode.module.biz.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RequestDTO {
|
||||
|
||||
private String url;
|
||||
private String method;
|
||||
private String params;
|
||||
private String body;
|
||||
private String authorization;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.jeelowcode.module.biz.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RequestParamsDTO {
|
||||
private String pageSize="10";
|
||||
private String page="1";
|
||||
private String key;
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeelowcode.module.biz.dto;
|
||||
|
||||
import jdk.internal.dynalink.linker.LinkerServices;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SavePlanIssusRequestDTO {
|
||||
|
||||
private List<IssusUserDto> users;
|
||||
|
||||
private List<Long> planIds;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.CollectionUtil;
|
||||
import com.jeelowcode.framework.utils.tool.NumberUtil;
|
||||
import com.jeelowcode.framework.utils.utils.FuncBase;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 删除前校验
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("afterDrillPlanListEnhance")
|
||||
public class AfterDrillPlanListEnhance extends BaseController implements AfterAdvicePlugin {
|
||||
|
||||
@Autowired
|
||||
private IFormService dbFormService;
|
||||
|
||||
private static AfterDrillPlanListEnhance ADTE;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ADTE = this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
log.info("进入=======>studentAfterEnhancePage=======>execute");
|
||||
List<Map<String, Object>> records = enhanceContext.getResult().getRecords();
|
||||
if (FuncBase.isEmpty(records)) {
|
||||
return;
|
||||
}
|
||||
String taskTableName="lc_drill_task";
|
||||
Long taskFormId = ADTE.dbFormService.getDbFormIdByTableName(taskTableName);
|
||||
// 获取当前日期
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
records.forEach(record -> {
|
||||
// 已下发待执行 和 执行中 的计划才进行逾期判断
|
||||
if(record.get("drill_plan_status_type").equals("2")
|
||||
||record.get("drill_plan_status_type").equals("3")){
|
||||
// 获取参数 计划ID
|
||||
Long planId = NumberUtil.toLong(record.get("id").toString());
|
||||
|
||||
boolean isAfter = false;
|
||||
// 获取该计划下的所有任务
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("drill_plan_id", planId);
|
||||
ResultDataModel allTask = super.getDataPage(taskFormId, params);
|
||||
|
||||
// 遍历allTask 如果有一个逾期,设置计划为逾期状态
|
||||
if (CollectionUtil.isNotEmpty(allTask.getRecords())) {
|
||||
for (Map<String, Object> task : allTask.getRecords()) {
|
||||
if (!task.get("task_status").equals("3")) {
|
||||
// 对比当前日期和任务日期
|
||||
LocalDate eDate = LocalDate.parse(task.get("eDate").toString(), formatter);
|
||||
// 比较日期并更新状态
|
||||
if (currentDate.isAfter(eDate)) {
|
||||
isAfter = true;
|
||||
break; // 找到逾期任务,立即跳出循环
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isAfter) {
|
||||
// 设置计划为逾期状态
|
||||
record.put("drill_plan_status_type", "4"); // 设置为已经逾期
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.utils.tool.NumberUtil;
|
||||
import com.jeelowcode.module.biz.listener.ApproveStatusListener;
|
||||
import com.jeelowcode.module.biz.service.IDrillPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 删除前校验
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("afterDrillTaskEditEnhance")
|
||||
public class AfterDrillTaskEditEnhance extends BaseController implements AfterAdvicePlugin {
|
||||
|
||||
@Autowired
|
||||
private IDrillPlanService iDrillPlanService;
|
||||
|
||||
@Autowired
|
||||
IFormService dbFormService;
|
||||
|
||||
private static AfterDrillTaskEditEnhance ADTE;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ADTE = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
if(!params.containsKey("id")){
|
||||
return;
|
||||
}
|
||||
|
||||
Long id = NumberUtil.toLong(params.get("id").toString());
|
||||
String taskTableName="lc_drill_task";
|
||||
String planTableName="lc_drill_plan";
|
||||
Long taskFormId = ADTE.dbFormService.getDbFormIdByTableName(taskTableName);
|
||||
Long planFormId = ADTE.dbFormService.getDbFormIdByTableName(planTableName);
|
||||
|
||||
// 获取当前任务
|
||||
Map<String, Object> currentTask=ADTE.iDrillPlanService.getDrillTaskById(id);
|
||||
|
||||
if(!Objects.isNull(currentTask)){
|
||||
// 根据当前任务 drill_plan_id 获取当前计划下所有任务
|
||||
Long planId = NumberUtil.toLong(currentTask.get("drill_plan_id").toString());
|
||||
List<Map<String, Object>> allTasks=ADTE.iDrillPlanService.getDrillTaskByPlanId(planId);
|
||||
// 根据所以任务状态 设置 计划状态
|
||||
if(!allTasks.isEmpty()){
|
||||
Integer allTaskNum=allTasks.size();
|
||||
Integer doneTaskNum=0;
|
||||
Integer planStatus=2;
|
||||
for(Map<String, Object> task:allTasks){
|
||||
if (!Objects.isNull(task))
|
||||
{
|
||||
if(task.get("task_status").equals("3")){
|
||||
doneTaskNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(doneTaskNum.equals(allTaskNum))
|
||||
{
|
||||
planStatus=5; //已完成
|
||||
}else if(doneTaskNum>0){
|
||||
planStatus=3; //执行中
|
||||
}
|
||||
|
||||
// 更新 计划状态
|
||||
Map<String, Object> currentPlan=ADTE.iDrillPlanService.getDrillPlanById(planId);
|
||||
currentPlan.put("drill_plan_status_type", planStatus);
|
||||
super.editJsonData(planFormId, JSONUtil.parseObj(currentPlan));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.utils.tool.NumberUtil;
|
||||
import com.jeelowcode.module.biz.service.IExamPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 删除前校验
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("afterExamRecordEditEnhance")
|
||||
public class AfterExamRecordEditEnhance extends BaseController implements AfterAdvicePlugin {
|
||||
|
||||
@Autowired
|
||||
private IExamPlanService iExamPlanService;
|
||||
|
||||
@Autowired
|
||||
private IFormService dbFormService;
|
||||
|
||||
private static AfterExamRecordEditEnhance ADTE;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ADTE = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
if(!params.containsKey("id")){
|
||||
return;
|
||||
}
|
||||
|
||||
Long id = NumberUtil.toLong(params.get("id").toString());
|
||||
String taskTableName="lc_exam_record";
|
||||
String planTableName="lc_exam_plan";
|
||||
Long taskFormId = ADTE.dbFormService.getDbFormIdByTableName(taskTableName);
|
||||
Long planFormId = ADTE.dbFormService.getDbFormIdByTableName(planTableName);
|
||||
|
||||
// 获取当前任务
|
||||
Map<String, Object> currentTask=ADTE.iExamPlanService.getExamTaskById(id);
|
||||
|
||||
if(!Objects.isNull(currentTask)){
|
||||
// 根据当前任务 examId 获取当前计划下所有任务
|
||||
Long examId = NumberUtil.toLong(currentTask.get("examid").toString());
|
||||
List<Map<String, Object>> allTasks=ADTE.iExamPlanService.getExamTaskByPlanId(examId);
|
||||
// 根据所以任务状态 设置 计划状态
|
||||
if(!allTasks.isEmpty()){
|
||||
Integer allTaskNum=allTasks.size();
|
||||
Integer doneTaskNum=0;
|
||||
Integer planStatus=1;
|
||||
for(Map<String, Object> task:allTasks){
|
||||
if (!Objects.isNull(task))
|
||||
{
|
||||
if(task.get("examrecordstatus").equals("2")){
|
||||
doneTaskNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(doneTaskNum.equals(allTaskNum))
|
||||
{
|
||||
planStatus=4; //已完成
|
||||
}else if(doneTaskNum>0){
|
||||
planStatus=3; //执行中
|
||||
}
|
||||
|
||||
// 更新 计划状态
|
||||
Map<String, Object> currentPlan=ADTE.iExamPlanService.getExamPlanById(examId);
|
||||
currentPlan.put("examStatus", planStatus);
|
||||
super.editJsonData(planFormId, JSONUtil.parseObj(currentPlan));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.utils.tool.NumberUtil;
|
||||
import com.jeelowcode.module.biz.service.IDrillPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 删除前校验
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("afterRiskAddEnhance")
|
||||
public class AfterRiskAddEnhance extends BaseController implements AfterAdvicePlugin {
|
||||
|
||||
@Autowired
|
||||
private IDrillPlanService iDrillPlanService;
|
||||
|
||||
@Autowired
|
||||
IFormService dbFormService;
|
||||
|
||||
private static AfterRiskAddEnhance ADTE;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ADTE = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
if(!params.containsKey("id")){
|
||||
return;
|
||||
}
|
||||
|
||||
Long id = NumberUtil.toLong(params.get("id").toString());
|
||||
String taskTableName="lc_drill_task";
|
||||
String planTableName="lc_drill_plan";
|
||||
Long taskFormId = ADTE.dbFormService.getDbFormIdByTableName(taskTableName);
|
||||
Long planFormId = ADTE.dbFormService.getDbFormIdByTableName(planTableName);
|
||||
|
||||
// 获取当前任务
|
||||
Map<String, Object> currentTask=ADTE.iDrillPlanService.getDrillTaskById(id);
|
||||
|
||||
if(!Objects.isNull(currentTask)){
|
||||
// 根据当前任务 drill_plan_id 获取当前计划下所有任务
|
||||
Long planId = NumberUtil.toLong(currentTask.get("drill_plan_id").toString());
|
||||
List<Map<String, Object>> allTasks=ADTE.iDrillPlanService.getDrillTaskByPlanId(planId);
|
||||
// 根据所以任务状态 设置 计划状态
|
||||
if(!allTasks.isEmpty()){
|
||||
Integer allTaskNum=allTasks.size();
|
||||
Integer doneTaskNum=0;
|
||||
Integer planStatus=2;
|
||||
for(Map<String, Object> task:allTasks){
|
||||
if (!Objects.isNull(task))
|
||||
{
|
||||
if(task.get("task_status").equals("3")){
|
||||
doneTaskNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(doneTaskNum.equals(allTaskNum))
|
||||
{
|
||||
planStatus=5; //已完成
|
||||
}else if(doneTaskNum>0){
|
||||
planStatus=3; //执行中
|
||||
}
|
||||
|
||||
// 更新 计划状态
|
||||
Map<String, Object> currentPlan=ADTE.iDrillPlanService.getDrillPlanById(planId);
|
||||
currentPlan.put("drill_plan_status_type", planStatus);
|
||||
super.editJsonData(planFormId, JSONUtil.parseObj(currentPlan));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhancereport.model.EnhanceReportContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhancereport.plugin.ReportAfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.core.framework.utils.FuncWeb;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeMoreException;
|
||||
import com.jeelowcode.framework.utils.component.redis.JeeLowCodeRedisUtils;
|
||||
import com.jeelowcode.service.infra.entity.ConfigDO;
|
||||
import com.jeelowcode.service.infra.service.IConfigService;
|
||||
import com.jeelowcode.tool.framework.common.model.ContentModel;
|
||||
import com.jeelowcode.tool.framework.common.model.PartModel;
|
||||
import com.jeelowcode.tool.framework.common.util.http.HttpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 取阿里平台数据
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("aliDataGetEnhance")
|
||||
public class AliDataGetEnhance implements ReportAfterAdvicePlugin {
|
||||
|
||||
@Autowired
|
||||
private JeeLowCodeRedisUtils redisUtils;
|
||||
|
||||
@Autowired
|
||||
private IConfigService configService;
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceReportContext enhanceContext) {
|
||||
//传入取值代码及参数
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
ConfigDO configUrl = configService.getConfigByKey("aliUrl");
|
||||
ConfigDO configKey = configService.getConfigByKey("aliAppkey");
|
||||
ConfigDO configSecret = configService.getConfigByKey("aliAppSecret");
|
||||
|
||||
if(Objects.isNull(configUrl) || Objects.isNull(configKey) || Objects.isNull(configSecret)
|
||||
|| StringUtils.isEmpty(configUrl.getValue()) || StringUtils.isEmpty(configKey.getValue()) || StringUtils.isEmpty(configSecret.getValue())){
|
||||
throw new JeeLowCodeException("缺少阿里平台必要参数配置");
|
||||
}
|
||||
// String token = HttpUtils.getToken("http://10.0.160.55","campusT0Yoh1U6tXD3ZVXy","3d4d89b5-8a14-4b83-a9aa-715bdc8264a1");
|
||||
String token = "";
|
||||
if(!redisUtils.hasKey("aliToken")){
|
||||
token = HttpUtils.getToken(configUrl.getValue(),configKey.getValue(),configSecret.getValue());
|
||||
redisUtils.set("aliToken",token,7000);
|
||||
}
|
||||
log.info("token:"+token);
|
||||
if(!StringUtils.isEmpty(token)){
|
||||
String bodyString = "{\n" +
|
||||
" \"api\": \"/space/campus/list\",\n" +
|
||||
" \"params\": [\n" +
|
||||
" {\n" +
|
||||
" \"pageSize\": \"10000\",\n" +
|
||||
" \"page\": 1\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
"}";
|
||||
List<PartModel> contentModels = HttpUtils.getTokenDate(configUrl.getValue()+"/_campus/open/api/invoked.json?access_token="+token,bodyString);
|
||||
log.info("returnMsg:" + contentModels.toString());
|
||||
if (Func.isNotEmpty(contentModels)) {
|
||||
resultList = contentModels.stream()
|
||||
.map(contentModel -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(contentModel.getCumpusId(), contentModel);
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
FuncWeb.setReportResult(enhanceContext, resultList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.BeforeAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.btncommand.ButtonInvoker;
|
||||
import com.jeelowcode.core.framework.config.btncommand.button.DetailsButtonCommand;
|
||||
import com.jeelowcode.core.framework.config.btncommand.param.ButtonParamDetail;
|
||||
import com.jeelowcode.core.framework.config.btncommand.receiver.ButtonReceiverDetail;
|
||||
import com.jeelowcode.core.framework.config.btncommand.receiver.IButtonCommandReceiver;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.plus.core.toolkit.CollectionUtils;
|
||||
import com.jeelowcode.framework.plus.core.toolkit.StringUtils;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 删除前校验
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("beforeDeleteEnhance")
|
||||
public class BeforeDeleteEnhance implements BeforeAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
Long id = ((List<Long>) params.get("dataIdList")).get(0);
|
||||
|
||||
params.put("id", id);//把id放到参数集合里面
|
||||
|
||||
ButtonParamDetail buttonParam = new ButtonParamDetail();
|
||||
buttonParam.setDbFormId(enhanceContext.getParam().getDbFormId());
|
||||
buttonParam.setDataId(id);
|
||||
buttonParam.setParams(params);
|
||||
|
||||
//执行者绑定参数
|
||||
IButtonCommandReceiver receiver = new ButtonReceiverDetail(buttonParam);
|
||||
|
||||
//执行者和命令绑定
|
||||
DetailsButtonCommand command = new DetailsButtonCommand(receiver);
|
||||
|
||||
//创建调用者
|
||||
ButtonInvoker<ResultDataModel> invoker = new ButtonInvoker();
|
||||
invoker.setButtonCommand(command);//调用者设置命令
|
||||
ResultDataModel resultDataModel = invoker.executeCommand();//调用者下发命令
|
||||
|
||||
if (!CollectionUtils.isEmpty(resultDataModel.getRecords())) {
|
||||
if(Objects.isNull(resultDataModel.getRecords().get(0).get("approveStatus"))){
|
||||
return;
|
||||
}
|
||||
String status = resultDataModel.getRecords().get(0).get("approveStatus").toString();
|
||||
if (StringUtils.isNotEmpty(status) && !status.equals("0")) {
|
||||
throw new JeeLowCodeException("当前单据存在审批流程,不允许删除");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.BeforeAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.config.btncommand.ButtonInvoker;
|
||||
import com.jeelowcode.core.framework.config.btncommand.button.DetailsButtonCommand;
|
||||
import com.jeelowcode.core.framework.config.btncommand.param.ButtonParamDetail;
|
||||
import com.jeelowcode.core.framework.config.btncommand.receiver.ButtonReceiverDetail;
|
||||
import com.jeelowcode.core.framework.config.btncommand.receiver.IButtonCommandReceiver;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.plus.core.toolkit.CollectionUtils;
|
||||
import com.jeelowcode.framework.plus.core.toolkit.StringUtils;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.framework.utils.tool.NumberUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 删除前校验
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("beforeEditEnhance")
|
||||
public class BeforeEditEnhance implements BeforeAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
if(!params.containsKey("id")){
|
||||
return;
|
||||
}
|
||||
|
||||
Long id = NumberUtil.toLong(params.get("id").toString());
|
||||
|
||||
Map<String, Object> inParams = new HashMap<>();
|
||||
inParams.put("id", id);//把id放到参数集合里面
|
||||
|
||||
ButtonParamDetail buttonParam = new ButtonParamDetail();
|
||||
buttonParam.setDbFormId(enhanceContext.getParam().getDbFormId());
|
||||
buttonParam.setDataId(id);
|
||||
buttonParam.setParams(inParams);
|
||||
|
||||
//执行者绑定参数
|
||||
IButtonCommandReceiver receiver = new ButtonReceiverDetail(buttonParam);
|
||||
|
||||
//执行者和命令绑定
|
||||
DetailsButtonCommand command = new DetailsButtonCommand(receiver);
|
||||
|
||||
//创建调用者
|
||||
ButtonInvoker<ResultDataModel> invoker = new ButtonInvoker();
|
||||
invoker.setButtonCommand(command);//调用者设置命令
|
||||
ResultDataModel resultDataModel = invoker.executeCommand();//调用者下发命令
|
||||
|
||||
if (!CollectionUtils.isEmpty(resultDataModel.getRecords())) {
|
||||
if(Objects.isNull(resultDataModel.getRecords().get(0).get("approveStatus"))){
|
||||
return;
|
||||
}
|
||||
String status = resultDataModel.getRecords().get(0).get("approveStatus").toString();
|
||||
if (StringUtils.isNotEmpty(status) && !status.equals("0") && !status.equals("3")) {
|
||||
throw new RuntimeException("当前单据存在审批流程,不允许修改");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.BeforeAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.service.system.entity.AdminUserDO;
|
||||
import com.jeelowcode.service.system.service.IAdminUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 风险隐患数据导入前
|
||||
* 检查园区 Name 反向给 检查园区 ID 赋值
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("beforeRiskAssessmentExportEnhance")
|
||||
public class BeforeRiskAssessmentExportEnhance extends BaseController implements BeforeAdvicePlugin {
|
||||
@Autowired
|
||||
private IFormService dbFormService;
|
||||
|
||||
@Autowired
|
||||
private IAdminUserService userService;
|
||||
|
||||
private static BeforeRiskAssessmentExportEnhance ADTE;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ADTE = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
|
||||
params.put("billNo","FX" + System.currentTimeMillis());
|
||||
|
||||
//评估人
|
||||
if(params.containsKey("assessorName")) {
|
||||
String assessorName = Func.getMap2Str(params, "assessorName");
|
||||
AdminUserDO user = ADTE.userService.selectByNickname(assessorName);
|
||||
if (user != null) {
|
||||
params.put("assessorId", user.getId());
|
||||
}
|
||||
}
|
||||
|
||||
//部门负责人
|
||||
if(params.containsKey("deptChargerName")) {
|
||||
String deptChargerName = Func.getMap2Str(params, "deptChargerName");
|
||||
AdminUserDO user = ADTE.userService.selectByNickname(deptChargerName);
|
||||
if (user != null) {
|
||||
params.put("deptChargerId", user.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceResult;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.BeforeAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.controller.BaseController;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.utils.model.ResultDataModel;
|
||||
import com.jeelowcode.service.system.controller.vo.auth.AuthPermissionInfoRespVO;
|
||||
import com.jeelowcode.service.system.entity.AdminUserDO;
|
||||
import com.jeelowcode.service.system.service.IAdminUserService;
|
||||
import com.jeelowcode.tool.framework.common.pojo.CommonResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 风险隐患数据导入前
|
||||
* 检查园区 Name 反向给 检查园区 ID 赋值
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("beforeRiskExportEnhance")
|
||||
public class BeforeRiskExportEnhance extends BaseController implements BeforeAdvicePlugin {
|
||||
@Autowired
|
||||
private IFormService dbFormService;
|
||||
|
||||
@Autowired
|
||||
private IAdminUserService userService;
|
||||
|
||||
private static BeforeRiskExportEnhance ADTE;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ADTE = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
Map<String, Object> params = enhanceContext.getParam().getParams();
|
||||
|
||||
// 获取所有园区信息
|
||||
String campusTableName="campus_info";
|
||||
Long campusFormId = ADTE.dbFormService.getDbFormIdByTableName(campusTableName);
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
ResultDataModel allCampus = super.getDataPage(campusFormId, param);
|
||||
|
||||
// 隐患来源 固定为 1
|
||||
params.put("source", "1");
|
||||
params.put("billNo","FX" + System.currentTimeMillis());
|
||||
|
||||
if(params.containsKey("parkName")) {
|
||||
String name = Func.getMap2Str(params, "parkName");
|
||||
|
||||
// 根据name查找id
|
||||
Map<String, Object> depMap = allCampus.getRecords().stream()
|
||||
.filter(t -> t.get("campus_name")
|
||||
.equals(name)).findFirst().orElse(null);
|
||||
if (Objects.nonNull(depMap)) {
|
||||
params.put("parkId", depMap.get("campus_id"));
|
||||
}
|
||||
}
|
||||
|
||||
//检查人员
|
||||
if(params.containsKey("check_people")) {
|
||||
String check_people = Func.getMap2Str(params, "check_people");
|
||||
AdminUserDO user = ADTE.userService.selectByNickname(check_people);
|
||||
if (user != null) {
|
||||
params.put("check_people_id", user.getId());
|
||||
}
|
||||
}
|
||||
|
||||
//整改责任人
|
||||
if(params.containsKey("corrective_charge_people")) {
|
||||
String corrective_charge_people = Func.getMap2Str(params, "corrective_charge_people");
|
||||
AdminUserDO user = ADTE.userService.selectByNickname(corrective_charge_people);
|
||||
if (user != null) {
|
||||
params.put("corrective_charge_people_id", user.getId());
|
||||
}
|
||||
}
|
||||
|
||||
//整改确认人
|
||||
if(params.containsKey("corrective_confirm_people")) {
|
||||
String corrective_confirm_people = Func.getMap2Str(params, "corrective_confirm_people");
|
||||
AdminUserDO user = ADTE.userService.selectByNickname(corrective_confirm_people);
|
||||
if (user != null) {
|
||||
params.put("corrective_confirm_people_id", user.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceResult;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-19 15:05
|
||||
* @dedescription:
|
||||
*/
|
||||
public class LinClassEnhance implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
EnhanceResult result = enhanceContext.getResult();
|
||||
List<Map<String, Object>> records = result.getRecords();
|
||||
records.forEach(record -> {
|
||||
String njName = Func.getMap2Str(record, "nj_name");
|
||||
record.put("nj_name","class-24界"+njName);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package com.jeelowcode.module.biz.enhance;
|
||||
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceContext;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.model.EnhanceResult;
|
||||
import com.jeelowcode.core.framework.config.aspect.enhance.plugin.AfterAdvicePlugin;
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author JX
|
||||
* @create 2024-08-19 15:05
|
||||
* @dedescription:
|
||||
*/
|
||||
@Component
|
||||
public class LinTestEnhance implements AfterAdvicePlugin {
|
||||
@Override
|
||||
public void execute(EnhanceContext enhanceContext) {
|
||||
EnhanceResult result = enhanceContext.getResult();
|
||||
List<Map<String, Object>> records = result.getRecords();
|
||||
records.forEach(record -> {
|
||||
String name = Func.getMap2Str(record, "name");
|
||||
record.put("name",name+"先生");
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.jeelowcode.module.biz.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 演练计划
|
||||
*
|
||||
*/
|
||||
@TableName("lc_drill_plan")
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public class DrillPlanEntity {
|
||||
@JsonSerialize(
|
||||
using = ToStringSerializer.class
|
||||
)
|
||||
|
||||
@TableId(
|
||||
value = "id",
|
||||
type = IdType.ASSIGN_ID
|
||||
)
|
||||
private Long id;
|
||||
|
||||
private String drill_plan_name;
|
||||
|
||||
private String drill_goals;
|
||||
|
||||
private String drill_content;
|
||||
|
||||
private String emergency_plan_name;
|
||||
|
||||
private long emergency_plan_id;
|
||||
|
||||
private String drill_plan_cycle_type;
|
||||
|
||||
private String issus_depts;
|
||||
|
||||
private String issus_dept_ids;
|
||||
|
||||
private String drill_plan_status_type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.jeelowcode.module.biz.listener;
|
||||
|
||||
import com.jeelowcode.core.framework.entity.FormEntity;
|
||||
import com.jeelowcode.core.framework.mapper.FormMapper;
|
||||
import com.jeelowcode.core.framework.service.IDbformDataService;
|
||||
import com.jeelowcode.core.framework.service.IFormService;
|
||||
import com.jeelowcode.framework.utils.tool.spring.SpringUtils;
|
||||
import com.jeelowcode.core.framework.enums.ApproveStatusEnum;
|
||||
import com.jeelowcode.service.bpm.controller.vo.instance.BpmProcessInstanceRespVO;
|
||||
import com.jeelowcode.service.bpm.service.IBpmProcessInstanceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.delegate.ExecutionListener;
|
||||
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Order(value = 999)
|
||||
@Component
|
||||
@ComponentScan("com.jeelowcode.module.biz.listener")
|
||||
public class ApproveStatusListener implements ExecutionListener{
|
||||
|
||||
@Autowired
|
||||
private IBpmProcessInstanceService processInstanceService;
|
||||
|
||||
@Autowired
|
||||
private IDbformDataService dbformDataService;
|
||||
|
||||
@Autowired
|
||||
private IFormService iFormService;
|
||||
|
||||
private static ApproveStatusListener AU;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
AU = this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution execution) {
|
||||
// Map<String,Object> map = new HashMap<>();
|
||||
// //流程实例id
|
||||
// String processInstanceId = execution.getProcessInstanceId();
|
||||
// BpmProcessInstanceRespVO vo = AU.processInstanceService.getProcessInstanceVO(processInstanceId);
|
||||
// //获取到的自定义表单数据id
|
||||
// String id = vo.getFormVariables().get("id").toString();
|
||||
// //数据表id
|
||||
// Long formId = vo.getProcessDefinition().getFormId();
|
||||
// FormEntity formEntity = SpringUtils.getBean(FormMapper.class).getByWebId(formId);
|
||||
//
|
||||
//
|
||||
// //实例状态 (1:审批中, 2:审批通过, 3:审批不通过, 4:已取消)
|
||||
// Integer status = vo.getStatus();
|
||||
//
|
||||
// if(((ExecutionEntityImpl) execution).getActivityName().equals("开始")){
|
||||
// Map<String,Object> json = new HashMap<>();
|
||||
// json.put(ApproveStatusEnum.codeField, ApproveStatusEnum.APPROVING.getCode());
|
||||
// json.put(ApproveStatusEnum.nameField, ApproveStatusEnum.APPROVING.getDesc());
|
||||
// AU.dbformDataService.update(formEntity.getTableName(),id,json);
|
||||
// }else if(((ExecutionEntityImpl) execution).getActivityName().equals("结束")){
|
||||
// Map<String,Object> json = new HashMap<>();
|
||||
// json.put(ApproveStatusEnum.codeField, ApproveStatusEnum.APPROVED.getCode());
|
||||
// json.put(ApproveStatusEnum.nameField, ApproveStatusEnum.APPROVED.getDesc());
|
||||
// AU.dbformDataService.update(formEntity.getTableName(),id,json);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.jeelowcode.module.biz.listener;
|
||||
|
||||
|
||||
import com.jeelowcode.core.framework.service.IDbformDataService;
|
||||
import com.jeelowcode.service.bpm.controller.vo.instance.BpmProcessInstanceRespVO;
|
||||
import com.jeelowcode.service.bpm.service.IBpmProcessInstanceService;
|
||||
import org.flowable.engine.delegate.TaskListener;
|
||||
import org.flowable.task.service.delegate.DelegateTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
//任务监听器
|
||||
@Component
|
||||
public class DemoDelegateClassTaskListener implements TaskListener {
|
||||
|
||||
@Autowired
|
||||
private IBpmProcessInstanceService processInstanceService;
|
||||
|
||||
@Autowired
|
||||
private IDbformDataService dbformDataService;
|
||||
|
||||
private static DemoDelegateClassTaskListener AU;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
AU = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
//流程实例id
|
||||
String processInstanceId = delegateTask.getProcessInstanceId();
|
||||
BpmProcessInstanceRespVO vo = AU.processInstanceService.getProcessInstanceVO(processInstanceId);
|
||||
//获取到的自定义表单数据id
|
||||
String id = vo.getFormVariables().get("id").toString();
|
||||
//数据表id
|
||||
Long formId = vo.getProcessDefinition().getFormId();
|
||||
//实例状态 (1:审批中, 2:审批通过, 3:审批不通过, 4:已取消)
|
||||
Integer status = vo.getStatus();
|
||||
// Map<String,Object> json = new HashMap<>();
|
||||
// json.put("status", status);
|
||||
// AU.dbformDataService.editJsonData(formId, new JSONObject(json));
|
||||
// AU.dbformDataService.update("sc_zuoye",id,json);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
package com.jeelowcode.module.biz.mapper;
|
||||
|
||||
|
||||
/**
|
||||
* demo相关
|
||||
*/
|
||||
public interface DemoMapper {
|
||||
|
||||
void getDemoData(Long id);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
package com.jeelowcode.module.biz.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jeelowcode.module.biz.entity.DrillPlanEntity;
|
||||
|
||||
/**
|
||||
* demo相关
|
||||
*/
|
||||
public interface DrillPlanMapper extends BaseMapper<DrillPlanEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Demo相关
|
||||
*/
|
||||
public interface IDemoService {
|
||||
|
||||
List<Map<String, Object>> getDemoData();
|
||||
|
||||
void testAsync();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Demo相关
|
||||
*/
|
||||
public interface IDrillPlanService {
|
||||
|
||||
Map<String, Object> getDrillPlanById(long id);
|
||||
|
||||
List<Map<String, Object>> getDrillPlanCycles(Long drillPlanId);
|
||||
|
||||
Map<String, Object> getDrillTaskById(long id);
|
||||
|
||||
List<Map<String, Object>> getDrillTaskByPlanId(Long drillPlanId);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Demo相关
|
||||
*/
|
||||
public interface IExamPlanService {
|
||||
|
||||
Map<String, Object> getExamPlanById(long id);
|
||||
|
||||
Map<String, Object> getExamTaskById(long id);
|
||||
|
||||
List<Map<String, Object>> getExamTaskByPlanId(Long ExamPlanId);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Demo相关
|
||||
*/
|
||||
public interface IPlanIssusService {
|
||||
|
||||
void savePlanIssus(String tableName,Map<String,Object> addDataMap);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 风险隐患相关
|
||||
*/
|
||||
public interface IRiskService {
|
||||
|
||||
/**
|
||||
* 发生消息给整改人
|
||||
*/
|
||||
void sendNotify2Corrective(Long id);
|
||||
|
||||
/**
|
||||
* 发送消息给检查人
|
||||
*/
|
||||
void sendNotify2Check(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID获取当前数据
|
||||
*/
|
||||
Map<String, Object> getRiskById(long id);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service.impl;
|
||||
|
||||
import com.jeelowcode.core.framework.service.IFrameSqlService;
|
||||
import com.jeelowcode.framework.plus.SqlHelper;
|
||||
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
|
||||
import com.jeelowcode.module.biz.mapper.DemoMapper;
|
||||
import com.jeelowcode.module.biz.service.IDemoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* demo
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DemoServiceImpl implements IDemoService {
|
||||
|
||||
@Autowired
|
||||
private DemoMapper demoMapper;
|
||||
|
||||
@Autowired
|
||||
private IFrameSqlService sqlService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDemoData(){
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("tbl_lin_class");
|
||||
List<Map<String, Object>> dataMapList = sqlService.getDataListByPlus(wrapper);
|
||||
return dataMapList;
|
||||
}
|
||||
|
||||
@Async("asyncPoolTaskExecutor")
|
||||
@Override
|
||||
public void testAsync(){
|
||||
log.info("哈哈哈");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service.impl;
|
||||
|
||||
import com.jeelowcode.core.framework.service.IFrameSqlService;
|
||||
import com.jeelowcode.framework.plus.SqlHelper;
|
||||
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
|
||||
import com.jeelowcode.module.biz.mapper.DrillPlanMapper;
|
||||
import com.jeelowcode.module.biz.service.IDrillPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* demo
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DrillPlanServiceImpl implements IDrillPlanService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IFrameSqlService sqlService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDrillPlanById(long id) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_drill_plan");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("id",id);
|
||||
});
|
||||
Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDrillPlanCycles(Long drillPlanId) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_drill_plan_cycle");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("drill_plan_id",drillPlanId);
|
||||
});
|
||||
List<Map<String, Object>> dataMapList = sqlService.getDataListByPlus(wrapper);
|
||||
return dataMapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDrillTaskById(long id) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_drill_task");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("id",id);
|
||||
});
|
||||
Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDrillTaskByPlanId(Long drillPlanId) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_drill_task");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("drill_plan_id",drillPlanId);
|
||||
});
|
||||
List<Map<String, Object>> dataMapList = sqlService.getDataListByPlus(wrapper);
|
||||
return dataMapList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service.impl;
|
||||
|
||||
import com.jeelowcode.core.framework.service.IFrameSqlService;
|
||||
import com.jeelowcode.framework.plus.SqlHelper;
|
||||
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
|
||||
import com.jeelowcode.module.biz.service.IDrillPlanService;
|
||||
import com.jeelowcode.module.biz.service.IExamPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* demo
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExamPlanServiceImpl implements IExamPlanService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IFrameSqlService sqlService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExamPlanById(long id) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_exam_plan");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("id",id);
|
||||
});
|
||||
Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExamTaskById(long id) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_exam_record");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("id",id);
|
||||
});
|
||||
Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getExamTaskByPlanId(Long examPlanId) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_exam_record");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("examId",examPlanId);
|
||||
});
|
||||
List<Map<String, Object>> dataMapList = sqlService.getDataListByPlus(wrapper);
|
||||
return dataMapList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service.impl;
|
||||
|
||||
import com.jeelowcode.core.framework.mapper.JeeLowCodeSqlMapper;
|
||||
import com.jeelowcode.core.framework.service.IFrameSqlService;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.plus.SqlHelper;
|
||||
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
|
||||
import com.jeelowcode.framework.plus.core.model.SqlFormatModel;
|
||||
import com.jeelowcode.module.biz.mapper.DemoMapper;
|
||||
import com.jeelowcode.module.biz.service.IDemoService;
|
||||
import com.jeelowcode.module.biz.service.IPlanIssusService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* demo
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PlanIssusServiceImpl implements IPlanIssusService {
|
||||
|
||||
@Autowired
|
||||
private JeeLowCodeSqlMapper sqlMapper;
|
||||
|
||||
@Override
|
||||
public void savePlanIssus(String tableName, Map<String, Object> addDataMap) {
|
||||
SqlFormatModel sqlFormatModel = SqlHelper.getInsertWrapper()
|
||||
.setTableName(tableName)
|
||||
.setMap(addDataMap)
|
||||
.buildSql();
|
||||
String sql = sqlFormatModel.getEwSql();
|
||||
sqlMapper.insertData(JeeLowCodeBaseConstant.DS_MASTER,sql, sqlFormatModel.getDataMap());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
|
||||
package com.jeelowcode.module.biz.service.impl;
|
||||
|
||||
import com.jeelowcode.core.framework.mapper.JeeLowCodeSqlMapper;
|
||||
import com.jeelowcode.core.framework.service.IFrameSqlService;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.plus.SqlHelper;
|
||||
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
|
||||
import com.jeelowcode.framework.plus.core.model.SqlFormatModel;
|
||||
import com.jeelowcode.module.biz.service.IPlanIssusService;
|
||||
import com.jeelowcode.module.biz.service.IRiskService;
|
||||
import com.jeelowcode.service.system.controller.vo.notify.template.NotifyTemplateSendReqVO;
|
||||
import com.jeelowcode.service.system.service.INotifySendService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* demo
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class RiskServiceImpl implements IRiskService {
|
||||
|
||||
@Autowired
|
||||
private IFrameSqlService sqlService;
|
||||
|
||||
@Resource
|
||||
private INotifySendService notifySendService;
|
||||
|
||||
/**
|
||||
* 发生消息给整改人
|
||||
*/
|
||||
@Override
|
||||
public void sendNotify2Corrective(Long id) {
|
||||
// 根据ID查找风险隐患数据
|
||||
Map<String, Object> risk = getRiskById(id);
|
||||
NotifyTemplateSendReqVO sendReqVO=new NotifyTemplateSendReqVO();
|
||||
// 构建消息参数
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
Map<String, Object> templateParams=new HashMap<>();
|
||||
userIdList.add( Long.valueOf(risk.get("corrective_charge_people_id").toString()));
|
||||
userIdList.add( Long.valueOf(risk.get("corrective_confirm_people_id").toString()));
|
||||
sendReqVO.setUserIdList(userIdList);
|
||||
|
||||
templateParams.put("check_date",risk.get("check_date"));
|
||||
templateParams.put("parkName",risk.get("parkName"));
|
||||
templateParams.put("check_area",risk.get("check_area"));
|
||||
templateParams.put("check_content",risk.get("check_content"));
|
||||
templateParams.put("check_problem",risk.get("check_problem"));
|
||||
templateParams.put("check_people",risk.get("check_people"));
|
||||
sendReqVO.setTemplateCode("risk_corrective_notice");
|
||||
|
||||
sendReqVO.setTemplateParams(templateParams);
|
||||
// 发送消息
|
||||
notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserIdList(),
|
||||
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息给检查人
|
||||
*/
|
||||
@Override
|
||||
public void sendNotify2Check(Long id) {
|
||||
// 根据ID查找风险隐患数据
|
||||
Map<String, Object> risk = getRiskById(id);
|
||||
NotifyTemplateSendReqVO sendReqVO=new NotifyTemplateSendReqVO();
|
||||
// 构建消息参数
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
Map<String, Object> templateParams=new HashMap<>();
|
||||
userIdList.add( Long.valueOf(risk.get("check_people_id").toString()));
|
||||
sendReqVO.setUserIdList(userIdList);
|
||||
|
||||
templateParams.put("billNo",risk.get("billNo"));
|
||||
templateParams.put("check_date",risk.get("check_date"));
|
||||
templateParams.put("parkName",risk.get("parkName"));
|
||||
templateParams.put("check_area",risk.get("check_area"));
|
||||
templateParams.put("check_content",risk.get("check_content"));
|
||||
templateParams.put("check_problem",risk.get("check_problem"));
|
||||
sendReqVO.setTemplateCode("risk_check_notify");
|
||||
|
||||
sendReqVO.setTemplateParams(templateParams);
|
||||
// 发送消息
|
||||
notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserIdList(),
|
||||
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRiskById(long id) {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("lc_risk_hazard_manage");
|
||||
wrapper.setWhere(where->{
|
||||
where.eq("id",id);
|
||||
});
|
||||
Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
|
||||
return dataMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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.jeelowcode.module.biz.mapper.DemoMapper">
|
||||
|
||||
<update id="getDemoData" >
|
||||
update test_lin set name=1 where id=#{id}
|
||||
</update>
|
||||
</mapper>
|
||||
23
jeelowcode-module/pom.xml
Normal file
23
jeelowcode-module/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode</artifactId>
|
||||
<version>${jeelowcode.version}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.jeelowcode</groupId>
|
||||
<artifactId>jeelowcode-module</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<description> JeelowCode低代码(个人业务模块) </description>
|
||||
|
||||
<modules>
|
||||
<module>jeelowcode-module-api</module>
|
||||
<module>jeelowcode-module-biz</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user