Merge branch 'dev' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into lvleigang
This commit is contained in:
commit
2adb827e0d
28
pom.xml
28
pom.xml
|
@ -244,12 +244,12 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 添加dm8 jdbc jar 包依赖-->
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>Dm8JdbcDriver18</artifactId>
|
||||
<version>8.1.1.49</version>
|
||||
</dependency>
|
||||
<!-- <!– 添加dm8 jdbc jar 包依赖–>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dameng</groupId>-->
|
||||
<!-- <artifactId>Dm8JdbcDriver18</artifactId>-->
|
||||
<!-- <version>8.1.1.49</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<dependency>
|
||||
|
@ -338,21 +338,7 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JimuReport 积木报表 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-spring-boot-starter</artifactId>
|
||||
<version>${jimureport.version}</version>
|
||||
</dependency>
|
||||
<!-- minio oss-->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>${minio.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- postgresql驱动 -->
|
||||
<!-- postgresql驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
|
|
|
@ -3,21 +3,15 @@ package com.hzya.frame.report.reportManage.service.impl;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.report.reportManage.dao.IReportManageDao;
|
||||
import com.hzya.frame.report.reportManage.entity.JimuReportEntity;
|
||||
import com.hzya.frame.report.reportManage.entity.ReportManageEntity;
|
||||
import com.hzya.frame.report.reportManage.dao.IReportManageDao;
|
||||
import com.hzya.frame.report.reportManage.service.IReportManageService;
|
||||
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
|
||||
import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity;
|
||||
import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
|
||||
import com.hzya.frame.util.AESUtil;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import dm.jdbc.d.U;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -29,272 +23,269 @@ import java.util.List;
|
|||
*/
|
||||
@Service(value = "reportManageService")
|
||||
public class ReportManageServiceImpl extends BaseService<ReportManageEntity, String> implements IReportManageService {
|
||||
|
||||
|
||||
private IReportManageDao reportManageDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
public void setReportManageDao(IReportManageDao dao) {
|
||||
this.reportManageDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
public void setReportManageDao(IReportManageDao dao) {
|
||||
this.reportManageDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表列表分页
|
||||
* @Date 11:52 上午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryEntityPage(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
//判断分页
|
||||
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
|
||||
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
|
||||
}
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<ReportManageEntity> list = reportManageDao.queryByLikeClassify(entity);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表列表分页
|
||||
* @Date 11:52 上午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryEntityPage(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
//判断分页
|
||||
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
|
||||
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
|
||||
}
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<ReportManageEntity> list = reportManageDao.queryByLikeClassify(entity);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表列表
|
||||
* @Date 11:52 上午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
entity = new ReportManageEntity();
|
||||
}
|
||||
List<ReportManageEntity> list = reportManageDao.queryByLike(entity);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表列表
|
||||
* @Date 11:52 上午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
entity = new ReportManageEntity();
|
||||
}
|
||||
List<ReportManageEntity> list = reportManageDao.queryByLike(entity);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 保存报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity saveEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getReportId() == null || "".equals(entity.getReportId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择报表");
|
||||
}
|
||||
if (entity.getReportName() == null || "".equals(entity.getReportName())) {
|
||||
return BaseResult.getFailureMessageEntity("请先输入报表名称");
|
||||
}
|
||||
if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择分类");
|
||||
}
|
||||
if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setState("0");
|
||||
if (!checkIsUse(entity)) {
|
||||
return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置");
|
||||
}
|
||||
entity.setCreate();
|
||||
//保存
|
||||
reportManageDao.save(entity);
|
||||
return BaseResult.getSuccessMessageEntity("保存报表成功", entity);
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 保存报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity saveEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getReportId() == null || "".equals(entity.getReportId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择报表");
|
||||
}
|
||||
if (entity.getReportName() == null || "".equals(entity.getReportName())) {
|
||||
return BaseResult.getFailureMessageEntity("请先输入报表名称");
|
||||
}
|
||||
if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择分类");
|
||||
}
|
||||
if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setState("0");
|
||||
if (!checkIsUse(entity)) {
|
||||
return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置");
|
||||
}
|
||||
entity.setCreate();
|
||||
//保存
|
||||
reportManageDao.save(entity);
|
||||
return BaseResult.getSuccessMessageEntity("保存报表成功", entity);
|
||||
}
|
||||
|
||||
|
||||
private boolean checkIsUse(ReportManageEntity entity) {
|
||||
ReportManageEntity checkUse = new ReportManageEntity();
|
||||
checkUse.setReportId(entity.getReportId());
|
||||
return reportManageDao.getCount(checkUse) <= 0;
|
||||
}
|
||||
|
||||
private boolean checkIsUse(ReportManageEntity entity) {
|
||||
ReportManageEntity checkUse = new ReportManageEntity();
|
||||
checkUse.setReportId(entity.getReportId());
|
||||
if (reportManageDao.getCount(checkUse) > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 获取报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity getEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity = reportManageDao.get(entity.getId());
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("获取报表失败");
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("获取报表成功", entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 获取报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity getEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity = reportManageDao.get(entity.getId());
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("获取报表失败");
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("获取报表成功", entity);
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 修改报表
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity updateEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if (entity.getReportId() == null || "".equals(entity.getReportId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择报表");
|
||||
}
|
||||
if (entity.getReportName() == null || "".equals(entity.getReportName())) {
|
||||
return BaseResult.getFailureMessageEntity("请先输入报表名称");
|
||||
}
|
||||
if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择分类");
|
||||
}
|
||||
if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setUpdate();
|
||||
//保存
|
||||
reportManageDao.update(entity);
|
||||
return BaseResult.getSuccessMessageEntity("修改报表成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 修改报表
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity updateEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if (entity.getReportId() == null || "".equals(entity.getReportId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择报表");
|
||||
}
|
||||
if (entity.getReportName() == null || "".equals(entity.getReportName())) {
|
||||
return BaseResult.getFailureMessageEntity("请先输入报表名称");
|
||||
}
|
||||
if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) {
|
||||
return BaseResult.getFailureMessageEntity("请先选择分类");
|
||||
}
|
||||
if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setUpdate();
|
||||
//保存
|
||||
reportManageDao.update(entity);
|
||||
return BaseResult.getSuccessMessageEntity("修改报表成功");
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 删除报表
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setUpdate();
|
||||
reportManageDao.logicRemove(entity);
|
||||
return BaseResult.getSuccessMessageEntity("删除报表成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 删除报表
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity deleteEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setUpdate();
|
||||
reportManageDao.logicRemove(entity);
|
||||
return BaseResult.getSuccessMessageEntity("删除报表成功");
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 启用停用报表
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity enableDisableEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if (entity.getState() == null || "".equals(entity.getState())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setUpdate();
|
||||
reportManageDao.update(entity);
|
||||
//0启用 1 停用
|
||||
if ("0".equals(entity.getState())) {
|
||||
return BaseResult.getSuccessMessageEntity("启用用户成功");
|
||||
} else {
|
||||
return BaseResult.getSuccessMessageEntity("停用用户成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 启用停用报表
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity enableDisableEntity(JSONObject jsonObject) {
|
||||
ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if (entity.getState() == null || "".equals(entity.getState())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity.setUpdate();
|
||||
reportManageDao.update(entity);
|
||||
//0启用 1 停用
|
||||
if ("0".equals(entity.getState())) {
|
||||
return BaseResult.getSuccessMessageEntity("启用用户成功");
|
||||
} else {
|
||||
return BaseResult.getSuccessMessageEntity("停用用户成功");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryReport(JSONObject jsonObject) {
|
||||
JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class);
|
||||
//判断分页
|
||||
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
|
||||
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
|
||||
}
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<JimuReportEntity> list = reportManageDao.queryReportNotUse(entity);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryReport(JSONObject jsonObject) {
|
||||
JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class);
|
||||
//判断分页
|
||||
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
|
||||
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
|
||||
}
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<JimuReportEntity> list = reportManageDao.queryReportNotUse(entity);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryReportEntity(JSONObject jsonObject) {
|
||||
JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity = reportManageDao.queryReportEntity(entity);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("获取报表失败");
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("获取报表成功", entity);
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 查询报表
|
||||
* @Date 2:36 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity queryReportEntity(JSONObject jsonObject) {
|
||||
JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
entity = reportManageDao.queryReportEntity(entity);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("获取报表失败");
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("获取报表成功", entity);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 权限查询
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity jurisdiction(JSONObject jsonObject) {
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 权限查询
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity jurisdiction(JSONObject jsonObject) {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 保存权限查询
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity saveJurisdiction(JSONObject jsonObject) {
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 保存权限查询
|
||||
* @Date 2:37 下午 2024/3/27
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity saveJurisdiction(JSONObject jsonObject) {
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,9 @@ public class SysApplicationDatabaseEntity extends BaseEntity {
|
|||
case "3": //mysql
|
||||
sourceTypeName = "mysql";
|
||||
break;
|
||||
case "4": //dm
|
||||
sourceTypeName = "dm";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ public class SysExtensionApiEntity {
|
|||
private String querys;
|
||||
/** body */
|
||||
private String bodys;
|
||||
//byteBodys
|
||||
private byte[] byteBodys;
|
||||
/** 发送方应用 */
|
||||
private SysApplicationEntity sendApp;
|
||||
/** 接收方应用 */
|
||||
|
@ -67,5 +69,13 @@ public class SysExtensionApiEntity {
|
|||
public void setReceiveApi(SysApplicationApiEntity receiveApi) {
|
||||
this.receiveApi = receiveApi;
|
||||
}
|
||||
|
||||
public byte[] getByteBodys() {
|
||||
return byteBodys;
|
||||
}
|
||||
|
||||
public void setByteBodys(byte[] byteBodys) {
|
||||
this.byteBodys = byteBodys;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -417,4 +417,14 @@ public interface ISysApplicationService extends IBaseService<SysApplicationEntit
|
|||
* @return
|
||||
**/
|
||||
JsonResultEntity enableOrDisableAppScript(JSONObject jsonObject);
|
||||
|
||||
/****
|
||||
* ESB请求转发重载方法,临时处理传入请求对象
|
||||
* @content:
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2024-06-19 9:34
|
||||
* @param
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.hzya.frame.sysnew.application.service.impl;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
@ -11,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.serviceUtil.DsDataSourceUtil;
|
||||
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiDto;
|
||||
|
@ -25,14 +25,10 @@ import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao;
|
|||
import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity;
|
||||
import com.hzya.frame.sysnew.application.apiType.dao.ISysApplicationApiTypeDao;
|
||||
import com.hzya.frame.sysnew.application.apiType.entity.SysApplicationApiTypeEntity;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationDto;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationVo;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.*;
|
||||
import com.hzya.frame.sysnew.application.plugin.dao.ISysApplicationPluginDao;
|
||||
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginDto;
|
||||
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity;
|
||||
|
@ -47,17 +43,12 @@ import com.hzya.frame.sysnew.messageManageDetail.entity.SysMessageManageDetailEn
|
|||
import com.hzya.frame.sysnew.messageManageLog.dao.ISysMessageManageLogDao;
|
||||
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
|
||||
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogPageVo;
|
||||
import com.hzya.frame.sysnew.popedomInterface.entity.SysPopedomInterfaceEntity;
|
||||
import com.hzya.frame.sysnew.sysInterface.entity.SysInterfaceEntity;
|
||||
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
|
||||
import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
|
||||
import com.hzya.frame.util.AESUtil;
|
||||
import com.hzya.frame.util.IPHelper;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.action.ApplicationContextUtil;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
@ -67,27 +58,17 @@ import org.apache.http.entity.ByteArrayEntity;
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 应用表(SysApplication)表服务实现类
|
||||
|
@ -2438,4 +2419,368 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
return BaseResult.getSuccessMessageEntity("停用成功");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse) {
|
||||
|
||||
//例如:A应用发送数据到中台,中台转发到B应用
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
String oldbodys = ServletUtil.getBody(servletRequest);
|
||||
Map<String, String> oldheaderMap = ServletUtil.getHeaderMap(request);
|
||||
String oldquerys = request.getQueryString();
|
||||
//应用key
|
||||
String publicKey = request.getHeader("publicKey");
|
||||
//应用密钥
|
||||
String secretKey = request.getHeader("secretKey");
|
||||
//appId
|
||||
String appId = request.getHeader("appId");
|
||||
//apiCode
|
||||
String apiCode = request.getHeader("apiCode");
|
||||
|
||||
String ip = IPHelper.getIpAddr(request);
|
||||
if (publicKey == null || "".equals(publicKey)) {
|
||||
return BaseResult.getFailureMessageEntity("请先传递公钥");
|
||||
}
|
||||
if (secretKey == null || "".equals(secretKey)) {
|
||||
return BaseResult.getFailureMessageEntity("请先传递密钥");
|
||||
}
|
||||
if (appId == null || "".equals(appId)) {
|
||||
return BaseResult.getFailureMessageEntity("请先传递接收方应用");
|
||||
}
|
||||
if (apiCode == null || "".equals(apiCode)) {
|
||||
return BaseResult.getFailureMessageEntity("请先传递发送接口");
|
||||
}
|
||||
|
||||
logger.info("请求参数:publicKey:【" + publicKey + "】secretKey:【" + secretKey + "】appId:【" + appId + "】apiCode:【" + apiCode);
|
||||
//根据请求a应用的公钥、密钥是否能查找到一条数据
|
||||
|
||||
SysApplicationEntity sendApp = getAppByPublicKeySecretKey(publicKey, secretKey);
|
||||
if (sendApp == null) {
|
||||
//saveLog(new SysApplicationEntity(), new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"公钥、密钥错误");
|
||||
return BaseResult.getFailureMessageEntity("公钥、密钥错误,请联系管理员");
|
||||
}
|
||||
//判断应用是否启用
|
||||
if (sendApp.getAppStatus() == null || !"1".equals(sendApp.getAppStatus())) {
|
||||
saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,sendApp.getName() + "应用未启用");
|
||||
return BaseResult.getFailureMessageEntity(sendApp.getName() + "应用未启用,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
SysApplicationEntity receiveApp = getAppByAppId(appId);
|
||||
if (receiveApp == null) {
|
||||
saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"根据appId:" + appId + "未匹配到应用");
|
||||
return BaseResult.getFailureMessageEntity("根据appId:" + appId + "未匹配到应用,请联系管理员");
|
||||
}
|
||||
//判断应用是否启用
|
||||
if (receiveApp.getAppStatus() == null || !"1".equals(receiveApp.getAppStatus())) {
|
||||
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用未启用" );
|
||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用未启用,请联系管理员");
|
||||
}
|
||||
//判断应用接口是否启用
|
||||
if (receiveApp.getInterfaceStatus() == null || !"1".equals(receiveApp.getInterfaceStatus())) {
|
||||
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用接口环境未启用" );
|
||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用接口环境未启用,请联系管理员");
|
||||
}
|
||||
|
||||
SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode);
|
||||
if (receiveApi == null) {
|
||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" );
|
||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建");
|
||||
}
|
||||
|
||||
SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(), receiveApp.getId());
|
||||
if (sysApplicationApiAuthEntity == null) {
|
||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用权限配置错误" );
|
||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用权限配置错误");
|
||||
}
|
||||
if (sysApplicationApiAuthEntity.getSystemAddress() != null && !"".equals(sysApplicationApiAuthEntity.getSystemAddress())
|
||||
&& !sysApplicationApiAuthEntity.getSystemAddress().contains(ip)) {
|
||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误" );
|
||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误");
|
||||
}
|
||||
|
||||
SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(), receiveApi.getId(), sysApplicationApiAuthEntity.getId());
|
||||
if (sysApplicationApiAuthDetailEntity == null) {
|
||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApi.getApiName() + "未授权给" + sendApp.getName() );
|
||||
return BaseResult.getFailureMessageEntity(receiveApi.getApiName() + "未授权给" + sendApp.getName() + ",请联系管理员");
|
||||
}
|
||||
SysExtensionApiEntity sysExtensionApiEntity = new SysExtensionApiEntity();
|
||||
|
||||
|
||||
List<String> a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"});
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn());
|
||||
if (jsonArray != null && jsonArray.size() > 0) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject object1 = jsonArray.getJSONObject(i);
|
||||
headers.put(object1.getString("parameterName"), object1.getString("example"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oldheaderMap != null && oldheaderMap.size() > 0) {
|
||||
for (Map.Entry<String, String> entry : oldheaderMap.entrySet()) {
|
||||
if (!a.contains(entry.getKey())) {
|
||||
headers.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sysExtensionApiEntity.setSendApp(sendApp);
|
||||
sysExtensionApiEntity.setReceiveApp(receiveApp);
|
||||
sysExtensionApiEntity.setReceiveApi(receiveApi);
|
||||
sysExtensionApiEntity.setHeaders(headers);
|
||||
sysExtensionApiEntity.setQuerys(oldquerys);
|
||||
sysExtensionApiEntity.setBodys(oldbodys);
|
||||
Method[] methods = null;
|
||||
Object object = null;
|
||||
|
||||
|
||||
|
||||
|
||||
// 判断是否有内部api 是否扩展api 1、启用 2、停用
|
||||
if (receiveApi.getExtensionApi() != null && "1".equals(receiveApi.getExtensionApi())
|
||||
&& receiveApi.getBeanName() != null && !"".equals(receiveApi.getBeanName())
|
||||
&& receiveApi.getFunName() != null && !"".equals(receiveApi.getFunName())
|
||||
) {
|
||||
//获取类
|
||||
try {
|
||||
object = ApplicationContextUtil.getBeanByName(receiveApi.getBeanName());
|
||||
} catch (SecurityException e) {
|
||||
|
||||
}
|
||||
//获取类下面的方法
|
||||
methods = object.getClass().getMethods();
|
||||
if (methods == null || methods.length == 0) {
|
||||
return BaseResult.getFailureMessageEntity("未找到内部方法,请联系管理员");
|
||||
}
|
||||
for (Method m : methods) {
|
||||
if (null != m) {
|
||||
if (m.getName().equals(receiveApi.getFunName().trim())) {
|
||||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
sysExtensionApiEntity = (SysExtensionApiEntity) m.invoke(object, sysExtensionApiEntity);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
} catch (Exception e) {
|
||||
logger.error("invokeException{}", e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("内部方法执行错误,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
headers = sysExtensionApiEntity.getHeaders();
|
||||
String querys = sysExtensionApiEntity.getQuerys();
|
||||
|
||||
byte[] byteBodys = sysExtensionApiEntity.getByteBodys();
|
||||
//设置参数获取参数
|
||||
StringBuffer url = new StringBuffer();
|
||||
if(!receiveApi.getDestinationAddress().toLowerCase().startsWith("http")){
|
||||
url.append(receiveApp.getInterfaceAddress());
|
||||
}
|
||||
url.append(receiveApi.getDestinationAddress());
|
||||
if (querys != null) {
|
||||
url.append("?");
|
||||
url.append(querys);
|
||||
}
|
||||
Integer outTime = 6000;
|
||||
if (receiveApi.getTimeoutPeriod() != null && !"".equals(receiveApi.getTimeoutPeriod())) {
|
||||
outTime = Integer.valueOf(receiveApi.getTimeoutPeriod());
|
||||
}
|
||||
//1、POST 2、GET
|
||||
String method = "POST";
|
||||
if ("2".equals(receiveApi.getRequestMethod())) {
|
||||
method = "GET";
|
||||
}
|
||||
//List<String> a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"});
|
||||
//Map<String, String> headers = new HashMap<>();
|
||||
//if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) {
|
||||
// JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn());
|
||||
// if (jsonArray != null && jsonArray.size() > 0) {
|
||||
// for (int i = 0; i < jsonArray.size(); i++) {
|
||||
// JSONObject object1 = jsonArray.getJSONObject(i);
|
||||
// headers.put(object1.getString("parameterName"), object1.getString("example"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if (headerMap != null && headerMap.size() > 0) {
|
||||
// for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
// if (!a.contains(entry.getKey())) {
|
||||
// headers.put(entry.getKey(), entry.getValue());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
if ("POST".equals(method)) {
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
// HttpClient
|
||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
|
||||
HttpPost post = new HttpPost(url.toString());
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build();
|
||||
post.setConfig(requestConfig);//设置请求参数【超时时间】
|
||||
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (String key : headers.keySet()) {
|
||||
post.setHeader(key, headers.get(key));
|
||||
}
|
||||
}
|
||||
byte[] body = null;
|
||||
boolean flag = true;
|
||||
try {
|
||||
if (byteBodys != null && !"".equals(byteBodys)) {
|
||||
ByteArrayEntity entity = new ByteArrayEntity(byteBodys);
|
||||
entity.setContentType("application/json");
|
||||
post.setEntity(entity);
|
||||
}
|
||||
response = closeableHttpClient.execute(post);
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
synchronized (lock) {
|
||||
body = EntityUtils.toByteArray(entity);
|
||||
}
|
||||
flag = true;
|
||||
logger.info("返回结果:" +Base64.getEncoder().encodeToString(body));
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
flag = false;
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
logger.info("保存日志开始");
|
||||
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null);
|
||||
if (methods != null && methods.length > 0) {
|
||||
for (Method m : methods) {
|
||||
if (null != m) {
|
||||
if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) {
|
||||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
m.invoke(object, sysMessageManageLogEntity);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
} catch (Exception e) {
|
||||
logger.error("invokeException{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("保存日志结束");
|
||||
if (flag) {
|
||||
if (JSONUtil.isTypeJSON(body.toString())) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(body.toString());
|
||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||
return BaseResult.getSuccessMessageEntity("转发成功", jsonObject);
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", jsonObject);
|
||||
}
|
||||
} else {
|
||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
|
||||
} else {//GET
|
||||
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
// HttpClient
|
||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
|
||||
HttpGet get = new HttpGet(url.toString());
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build();
|
||||
get.setConfig(requestConfig);//设置请求参数【超时时间】
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (String key : headers.keySet()) {
|
||||
get.setHeader(key, headers.get(key));
|
||||
}
|
||||
}
|
||||
StringBuilder body = new StringBuilder();
|
||||
|
||||
boolean flag = true;
|
||||
try {
|
||||
response = closeableHttpClient.execute(get);
|
||||
HttpEntity entity = response.getEntity();
|
||||
synchronized (lock) {
|
||||
body.append(EntityUtils.toString(entity,"UTF-8"));
|
||||
}
|
||||
flag = true;
|
||||
logger.info("返回结果:" + body);
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
body.append(e.getMessage());
|
||||
flag = false;
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
logger.info("保存日志开始");
|
||||
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(), true,null);
|
||||
if (methods != null && methods.length > 0) {
|
||||
for (Method m : methods) {
|
||||
if (null != m) {
|
||||
if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) {
|
||||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
m.invoke(object, sysMessageManageLogEntity);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
} catch (Exception e) {
|
||||
logger.error("invokeException{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("保存日志结束");
|
||||
if (flag) {
|
||||
if (JSONUtil.isTypeJSON(body.toString())) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(body.toString());
|
||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||
return BaseResult.getSuccessMessageEntity("转发成功", jsonObject);
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", jsonObject);
|
||||
}
|
||||
} else {
|
||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
||||
}else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
|
|||
import com.hzya.frame.util.GroovyUtil;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import groovy.lang.GroovyClassLoader;
|
||||
import groovy.lang.GroovyObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -25,28 +23,41 @@ import org.springframework.stereotype.Service;
|
|||
public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GroovyIntegrationServiceImpl.class);
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// HelloWorld helloWorld = new HelloWorld();
|
||||
// System.out.println(helloWorld.sayHello());
|
||||
// }
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException, InstantiationException {
|
||||
GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
|
||||
|
||||
// 动态编译和加载Groovy脚本
|
||||
Class<?> groovyClass = groovyClassLoader.parseClass("println(\"1231231\")");
|
||||
|
||||
// 创建Groovy类的实例
|
||||
GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance();
|
||||
// 执行Groovy脚本
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("name", "张三");
|
||||
Object returnObj = groovyObject.invokeMethod("run", jsonObject.toJSONString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject) {
|
||||
Object object = GroovyUtil.execute(jsonObject);
|
||||
return new SysExtensionApiEntity();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
java.lang.String str = "{\"project_org\":\"\",\"modify_time\":\"2024-06-17 16:52:34\",\"project_duty_dept\":null,\"project_name\":\"凯伍德组织档案\",\"document_rule_num\":1,\"add_status\":\"0\",\"delete_status\":\"1\",\"project_dutier\":\"\",\"id\":\"fb12734c8267488b96833633e68a7abc\",\"data_status\":\"F\",\"modify_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"sorts\":1,\"project_memo\":\"\",\"document_rule\":\"XM-2024-06-17-00001\",\"create_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"create_time\":\"2024-06-17 16:42:18\",\"company_id\":null,\"project_sh_name\":\"\",\"project_code\":\"01004\",\"project_currtype\":\"\",\"update_status\":\"0\",\"sts\":\"Y\",\"org_id\":\"0\",\"project_parentpro\":\"\",\"project_bill_type\":\"\"}";
|
||||
|
||||
A88772 s = new A88772();
|
||||
s .execute(str);
|
||||
}
|
||||
static class A88772 {
|
||||
String execute(String jsonStr) {
|
||||
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
||||
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
||||
com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();
|
||||
ufinterfaceObject.put("billtype", "supplier"); ufinterfaceObject.put("isexchange", "Y");
|
||||
ufinterfaceObject.put("replace", "Y"); ufinterfaceObject.put("sender", "OA");
|
||||
ufinterfaceObject.put("account", "01"); ufinterfaceObject.put("groupcode", "00");
|
||||
com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();
|
||||
com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();
|
||||
billheadObject.put("code", reqData.get("project_code")); billheadObject.put("supprop", "0");
|
||||
billheadObject.put("custstate", "1"); billheadObject.put("pk_supplierclass", "S01");
|
||||
billheadObject.put("pk_country", "CN"); billheadObject.put("pk_timezone", "P0800");
|
||||
billheadObject.put("pk_format", "ZH-CN"); billheadObject.put("enablestate", "2");
|
||||
billheadObject.put("name", reqData.get("project_sh_name")); billheadObject.put("pk_group", "00");
|
||||
billheadObject.put("pk_org", "003"); billheadObject.put("taxpayerid", "087981489021135119");
|
||||
returnObject.put("ufinterface",ufinterfaceObject); billObject.put("billhead", billheadObject); returnObject.put("bill",billObject);
|
||||
System.out.println( returnObject.toJSONString());
|
||||
return returnObject.toJSONString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
package com.hzya.frame.u8c.ax.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.u8c.ax.dao.IAxDao;
|
||||
import com.hzya.frame.u8c.ax.entity.ArchivesEntity;
|
||||
import com.hzya.frame.u8c.ax.entity.Ass;
|
||||
import com.hzya.frame.u8c.ax.entity.Voucher;
|
||||
import com.hzya.frame.u8c.ax.entity.VoucherDetails;
|
||||
import com.hzya.frame.u8c.ax.entity.VoucherRoot;
|
||||
import com.hzya.frame.u8c.ax.entity.*;
|
||||
import com.hzya.frame.u8c.ax.service.IAxService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
@ -22,14 +16,11 @@ import org.apache.http.entity.ByteArrayEntity;
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -218,6 +209,7 @@ public class AxServiceImpl extends BaseService<ArchivesEntity, String> implement
|
|||
post.setHeader("publicKey", publicKey);
|
||||
post.setHeader("secretKey", secretKey);
|
||||
post.setHeader("appId", appId);
|
||||
post.setHeader("needStackTrace", jsonObject.getString("needStackTrace"));
|
||||
switch (jsonObject.getString("voucherType")){
|
||||
case "add"://新增
|
||||
post.setHeader("apiCode", pzApiCodexz);
|
||||
|
|
|
@ -164,5 +164,9 @@ public class EntranceController {
|
|||
public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
return sysApplicationService.externalCallInterface(servletRequest,servletResponse);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/externalCallInterfaceToESB")
|
||||
@ResponseBody
|
||||
public JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
return sysApplicationService.externalCallInterfaceToESB(servletRequest,servletResponse);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,9 +116,9 @@ public class AopDynamicRoutingDataSourceInit {
|
|||
} else if ("sqlServer".equalsIgnoreCase(source_type)) {
|
||||
driveClass = DataSourceUtilProperties.SQL2005DRIVER;
|
||||
}
|
||||
// else if ("dm".equalsIgnoreCase(source_type)) {
|
||||
// driveClass = DataSourceUtilProperties.dm;
|
||||
// }
|
||||
else if ("dm".equalsIgnoreCase(source_type)) {
|
||||
driveClass = DataSourceUtilProperties.dm;
|
||||
}
|
||||
try {
|
||||
//测试连接
|
||||
Class.forName(driveClass);
|
||||
|
|
Loading…
Reference in New Issue