|
@@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.ozs.common.constant.UserConstants;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.bean.BeanUtils;
|
|
|
+import com.ozs.common.utils.stateSecrets.SM4Utils;
|
|
|
import com.ozs.entity.MonitorSystem;
|
|
|
import com.ozs.entity.SvcAddress;
|
|
|
import com.ozs.entity.vo.MonitorSystemVo;
|
|
@@ -34,6 +35,7 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
|
|
|
private MonitorSystemMapper monitorSystemMapper;
|
|
|
@Autowired
|
|
|
private SvcAddressMapper svcAddressMapper;
|
|
|
+ public static final String KEY = "58792429c08c43e9";
|
|
|
|
|
|
@Override
|
|
|
public int insertMonitorSystem(MonitorSystem monitorSystem) {
|
|
@@ -42,13 +44,13 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
|
|
|
|
|
|
SvcAddress svc = new SvcAddress();
|
|
|
svc.setClientId(monitorSystem.getClientId());
|
|
|
- svc.setClientSecret(monitorSystem.getClientSecret());//正式环境
|
|
|
+ svc.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getClientSecret(), KEY));//正式环境
|
|
|
svc.setGrantType(grantType);
|
|
|
svc.setEnv(2);
|
|
|
int row1 = svcAddressMapper.insert(svc);
|
|
|
SvcAddress svc1 = new SvcAddress();
|
|
|
svc1.setClientId(monitorSystem.getClientId());
|
|
|
- svc1.setClientSecret(monitorSystem.getTestSecret());//测试环境
|
|
|
+ svc1.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getTestSecret(), KEY));//测试环境
|
|
|
svc1.setGrantType(grantType);
|
|
|
svc1.setEnv(1);
|
|
|
int row2 = svcAddressMapper.insert(svc1);
|
|
@@ -74,9 +76,9 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
|
|
|
if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
list.forEach(l -> {
|
|
|
if (l.getEnv().equals(1)) {//测试环境
|
|
|
- monitor.setTestSecret(l.getClientSecret());
|
|
|
+ monitor.setTestSecret(SM4Utils.decryptData_ECB(l.getClientSecret(),KEY));
|
|
|
} else if (l.getEnv().equals(2)) {//正式环境
|
|
|
- monitor.setClientSecret(l.getClientSecret());
|
|
|
+ monitor.setClientSecret(SM4Utils.decryptData_ECB(l.getClientSecret(),KEY));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -91,13 +93,13 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
|
|
|
|
|
|
SvcAddress svc = new SvcAddress();
|
|
|
svc.setClientId(monitorSystem.getClientId());
|
|
|
- svc.setClientSecret(monitorSystem.getClientSecret());//正式环境
|
|
|
+ svc.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getClientSecret(),KEY));//正式环境
|
|
|
svc.setGrantType(grantType);
|
|
|
svc.setEnv(2);
|
|
|
row1 = svcAddressMapper.insert(svc);
|
|
|
SvcAddress svc1 = new SvcAddress();
|
|
|
svc1.setClientId(monitorSystem.getClientId());
|
|
|
- svc1.setClientSecret(monitorSystem.getTestSecret());//测试环境
|
|
|
+ svc1.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getTestSecret(),KEY));//测试环境
|
|
|
svc1.setGrantType(grantType);
|
|
|
svc1.setEnv(1);
|
|
|
row2 = svcAddressMapper.insert(svc1);
|