|
@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.service.impl;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.rongwei.bscommon.sys.service.CommonInterfaceService;
|
|
@@ -16,12 +17,15 @@ import com.rongwei.bsentity.dto.InterfaceCommonSqlPropertyDto;
|
|
|
import com.rongwei.bsentity.dto.InterfaceWriteParamDto;
|
|
|
import com.rongwei.commonservice.service.dao.CommonSqlDao;
|
|
|
import com.rongwei.rwadmincommon.system.dao.SysGeneralCRUDDao;
|
|
|
+import com.rongwei.rwadmincommon.system.service.SysGeneralCRUDService;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.rwcommon.vo.ColumnQueryType;
|
|
|
import com.rongwei.rwcommon.vo.CriteriaBuilder;
|
|
|
+import com.rongwei.rwcommon.vo.generalsql.MasterSlaveInsertVo;
|
|
|
+import com.rongwei.rwcommon.vo.generalsql.MasterSlaveUpdateVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -30,6 +34,8 @@ import org.springframework.transaction.TransactionDefinition;
|
|
|
import org.springframework.transaction.TransactionStatus;
|
|
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@@ -48,6 +54,8 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService {
|
|
|
private CommonSqlDao commonSqlDao;
|
|
|
@Autowired
|
|
|
private ZhcxCommon zhcxCommon;
|
|
|
+ @Autowired
|
|
|
+ private SysGeneralCRUDService generalCRUDService;
|
|
|
|
|
|
/**
|
|
|
* 基础查询
|
|
@@ -78,6 +86,60 @@ public class CommonInterfaceServiceImpl implements CommonInterfaceService {
|
|
|
executeBaseWrite(json, interfaceInfo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存通用接口
|
|
|
+ *
|
|
|
+ * @param saveData
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void insertSave(String saveData) {
|
|
|
+ //解码
|
|
|
+ String decodeStr = decoderByBase64(saveData);
|
|
|
+ MasterSlaveInsertVo insertVo = JSONUtil.toBean(decodeStr, MasterSlaveInsertVo.class);
|
|
|
+ try {
|
|
|
+ generalCRUDService.generalMsInsert(insertVo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("保存失败, {}", e);
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新通用接口
|
|
|
+ *
|
|
|
+ * @param saveData
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void updateSave(String saveData) {
|
|
|
+ //解码
|
|
|
+ String decodeStr = decoderByBase64(saveData);
|
|
|
+ MasterSlaveUpdateVo updateVo = JSONUtil.toBean(decodeStr, MasterSlaveUpdateVo.class);
|
|
|
+ try {
|
|
|
+ generalCRUDService.generalMsUpdate(updateVo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("保存失败, {}", e);
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * base64解码
|
|
|
+ *
|
|
|
+ * @param encoderData
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String decoderByBase64(String encoderData) {
|
|
|
+ Base64.Decoder decoder = Base64.getDecoder();
|
|
|
+ try {
|
|
|
+ String decode = new String(decoder.decode(encoderData), "UTF-8");
|
|
|
+ return URLDecoder.decode(decode, "utf-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ log.error("解析失败, {}", e);
|
|
|
+ throw new CustomException("解析失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 验签
|
|
|
*
|