|
@@ -9,6 +9,7 @@ import org.jeecg.modules.okki.site.entity.OkkiSite;
|
|
import org.jeecg.modules.okki.site.entity.OkkiSiteStatusChangeLog;
|
|
import org.jeecg.modules.okki.site.entity.OkkiSiteStatusChangeLog;
|
|
import org.jeecg.modules.okki.site.mapper.OkkiSiteMapper;
|
|
import org.jeecg.modules.okki.site.mapper.OkkiSiteMapper;
|
|
import org.jeecg.modules.okki.site.param.ChangeSiteStatusParam;
|
|
import org.jeecg.modules.okki.site.param.ChangeSiteStatusParam;
|
|
|
|
+import org.jeecg.modules.okki.site.param.OkkiSiteParam;
|
|
import org.jeecg.modules.okki.site.service.IOkkiSiteService;
|
|
import org.jeecg.modules.okki.site.service.IOkkiSiteService;
|
|
import org.jeecg.modules.okki.site.service.IOkkiSiteStatusChangeLogService;
|
|
import org.jeecg.modules.okki.site.service.IOkkiSiteStatusChangeLogService;
|
|
import org.jeecg.modules.okki.utils.HttpClientUtils;
|
|
import org.jeecg.modules.okki.utils.HttpClientUtils;
|
|
@@ -43,12 +44,21 @@ public class OkkiSiteServiceImpl extends ServiceImpl<OkkiSiteMapper, OkkiSite> i
|
|
private IOkkiSiteStatusChangeLogService okkiSiteStatusChangeLogService;
|
|
private IOkkiSiteStatusChangeLogService okkiSiteStatusChangeLogService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean updateBySiteId(OkkiSite okkiSite) {
|
|
|
|
|
|
+ public boolean updateBySiteId(OkkiSiteParam okkiSiteParam) {
|
|
QueryWrapper<OkkiSite> okkiSiteQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<OkkiSite> okkiSiteQueryWrapper = new QueryWrapper<>();
|
|
- okkiSiteQueryWrapper.eq("site_id", okkiSite.getSite_id());
|
|
|
|
|
|
+ okkiSiteQueryWrapper.eq("site_id", okkiSiteParam.getSite_id());
|
|
okkiSiteQueryWrapper.last("limit 1");
|
|
okkiSiteQueryWrapper.last("limit 1");
|
|
- OkkiSite okkiSite1 = okkiSiteMapper.selectOne(okkiSiteQueryWrapper);
|
|
|
|
- okkiSite.setId(okkiSite1.getId());
|
|
|
|
|
|
+ OkkiSite okkiSite = okkiSiteMapper.selectOne(okkiSiteQueryWrapper);
|
|
|
|
+ okkiSite.setCompanyName(okkiSiteParam.getCompany_name());
|
|
|
|
+ okkiSite.setDomain(okkiSiteParam.getDomain());
|
|
|
|
+ okkiSite.setTel(okkiSiteParam.getTel());
|
|
|
|
+ okkiSite.setContact(okkiSiteParam.getContact());
|
|
|
|
+ okkiSite.setEmail(okkiSiteParam.getEmail());
|
|
|
|
+ okkiSite.setEnname(okkiSiteParam.getEnname());
|
|
|
|
+ okkiSite.setTcName(okkiSiteParam.getTc_name());
|
|
|
|
+ okkiSite.setTcPeriod(okkiSiteParam.getTc_period());
|
|
|
|
+ okkiSite.setTcLanguage(okkiSiteParam.getTc_language());
|
|
|
|
+ okkiSite.setRemark(okkiSiteParam.getRemark());
|
|
int result = okkiSiteMapper.updateById(okkiSite);
|
|
int result = okkiSiteMapper.updateById(okkiSite);
|
|
if (result == 0) {
|
|
if (result == 0) {
|
|
return false;
|
|
return false;
|
|
@@ -59,21 +69,18 @@ public class OkkiSiteServiceImpl extends ServiceImpl<OkkiSiteMapper, OkkiSite> i
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean changeStatus(OkkiSite okkiSite) {
|
|
public boolean changeStatus(OkkiSite okkiSite) {
|
|
|
|
+ OkkiSite okkiSite1 = okkiSiteMapper.selectById(okkiSite.getId());
|
|
// 请求okki平台接口
|
|
// 请求okki平台接口
|
|
Map<String, String> query = new TreeMap<>();
|
|
Map<String, String> query = new TreeMap<>();
|
|
query.put("sign_method", "hmac-md5");
|
|
query.put("sign_method", "hmac-md5");
|
|
query.put("timestamp", String.valueOf(System.currentTimeMillis()));
|
|
query.put("timestamp", String.valueOf(System.currentTimeMillis()));
|
|
- query.put("site_id", String.valueOf(okkiSite.getSite_id()));
|
|
|
|
|
|
+ query.put("site_id", String.valueOf(okkiSite1.getSiteId()));
|
|
query.put("method", "update_service_node");
|
|
query.put("method", "update_service_node");
|
|
// 通过site_id获取当前站点数据status的值 +1
|
|
// 通过site_id获取当前站点数据status的值 +1
|
|
- QueryWrapper<OkkiSite> okkiSiteQueryWrapper = new QueryWrapper<>();
|
|
|
|
- okkiSiteQueryWrapper.eq("site_id", okkiSite.getSite_id());
|
|
|
|
- okkiSiteQueryWrapper.last("limit 1");
|
|
|
|
- OkkiSite okkiSite1 = okkiSiteMapper.selectOne(okkiSiteQueryWrapper);
|
|
|
|
- okkiSite.setId(okkiSite1.getId());
|
|
|
|
- okkiSite.setStatus(okkiSite1.getStatus()+1);
|
|
|
|
|
|
+
|
|
|
|
+ okkiSite1.setStatus(okkiSite1.getStatus()+1);
|
|
Map<String, Object> postData = new HashMap<>();
|
|
Map<String, Object> postData = new HashMap<>();
|
|
- postData.put("status", okkiSite1.getStatus()+1);
|
|
|
|
|
|
+ postData.put("status", okkiSite1.getStatus());
|
|
try {
|
|
try {
|
|
String queryStr = HttpClientUtils.buildQueryString(query);
|
|
String queryStr = HttpClientUtils.buildQueryString(query);
|
|
String body = HttpClientUtils.toJsonString(postData);
|
|
String body = HttpClientUtils.toJsonString(postData);
|
|
@@ -86,14 +93,14 @@ public class OkkiSiteServiceImpl extends ServiceImpl<OkkiSiteMapper, OkkiSite> i
|
|
// {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
|
|
// {"code":0,"msg":"success","now":"2024-05-06 15:34:54","data":[]}
|
|
JSONObject jsonObject= JSONObject.parseObject(res);
|
|
JSONObject jsonObject= JSONObject.parseObject(res);
|
|
if (jsonObject.get("code").equals(0)) {
|
|
if (jsonObject.get("code").equals(0)) {
|
|
- int result = okkiSiteMapper.updateById(okkiSite);
|
|
|
|
|
|
+ int result = okkiSiteMapper.updateById(okkiSite1);
|
|
if (result == 0) {
|
|
if (result == 0) {
|
|
return false;
|
|
return false;
|
|
}else {
|
|
}else {
|
|
OkkiSiteStatusChangeLog okkiSiteStatusChangeLog = new OkkiSiteStatusChangeLog();
|
|
OkkiSiteStatusChangeLog okkiSiteStatusChangeLog = new OkkiSiteStatusChangeLog();
|
|
- okkiSiteStatusChangeLog.setOkkiSiteId(okkiSite.getSite_id());
|
|
|
|
- okkiSiteStatusChangeLog.setOldStatus(okkiSite1.getStatus());
|
|
|
|
- okkiSiteStatusChangeLog.setNewStatus(okkiSite.getStatus());
|
|
|
|
|
|
+ okkiSiteStatusChangeLog.setOkkiSiteId(okkiSite.getSiteId());
|
|
|
|
+ okkiSiteStatusChangeLog.setOldStatus(okkiSite1.getStatus() - 1);
|
|
|
|
+ okkiSiteStatusChangeLog.setNewStatus(okkiSite1.getStatus());
|
|
okkiSiteStatusChangeLogService.save(okkiSiteStatusChangeLog);
|
|
okkiSiteStatusChangeLogService.save(okkiSiteStatusChangeLog);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -128,11 +135,23 @@ public class OkkiSiteServiceImpl extends ServiceImpl<OkkiSiteMapper, OkkiSite> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean insertSite(OkkiSite okkiSite) {
|
|
|
|
- OkkiSite okkiSite1 = okkiSiteMapper.selectOne(new LambdaQueryWrapper<OkkiSite>().eq(OkkiSite::getSite_id, okkiSite.getSite_id()));
|
|
|
|
|
|
+ public boolean insertSite(OkkiSiteParam okkiSiteParam) {
|
|
|
|
+ OkkiSite okkiSite1 = okkiSiteMapper.selectOne(new LambdaQueryWrapper<OkkiSite>().eq(OkkiSite::getSiteId, okkiSiteParam.getSite_id()));
|
|
if (okkiSite1 != null) {
|
|
if (okkiSite1 != null) {
|
|
throw new RuntimeException("site_id already exist");
|
|
throw new RuntimeException("site_id already exist");
|
|
}else {
|
|
}else {
|
|
|
|
+ OkkiSite okkiSite = new OkkiSite();
|
|
|
|
+ okkiSite.setSiteId(okkiSiteParam.getSite_id());
|
|
|
|
+ okkiSite.setCompanyName(okkiSiteParam.getCompany_name());
|
|
|
|
+ okkiSite.setDomain(okkiSiteParam.getDomain());
|
|
|
|
+ okkiSite.setTel(okkiSiteParam.getTel());
|
|
|
|
+ okkiSite.setContact(okkiSiteParam.getContact());
|
|
|
|
+ okkiSite.setEmail(okkiSiteParam.getEmail());
|
|
|
|
+ okkiSite.setEnname(okkiSiteParam.getEnname());
|
|
|
|
+ okkiSite.setTcName(okkiSiteParam.getTc_name());
|
|
|
|
+ okkiSite.setTcPeriod(okkiSiteParam.getTc_period());
|
|
|
|
+ okkiSite.setTcLanguage(okkiSiteParam.getTc_language());
|
|
|
|
+ okkiSite.setRemark(okkiSiteParam.getRemark());
|
|
return super.save(okkiSite);
|
|
return super.save(okkiSite);
|
|
}
|
|
}
|
|
}
|
|
}
|