数据对接,先判断港股是否存在,存在拿港股数据过来,不存在则给港股推送过去

0927cmt
songwenxuan 2024-04-02 17:53:43 +08:00
parent 265cb308a9
commit 09cd29a97a
4 changed files with 83 additions and 42 deletions

View File

@ -10,6 +10,7 @@ import com.zcloud.util.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -27,6 +28,8 @@ import java.util.*;
@RequestMapping("/personnelmanagement")
public class PersonnelManagementController extends BaseController {
@Value("${tongbu.api.url}")
private String tongBuUrl;
@Autowired
private PersonnelManagementService personnelmanagementService;
@ -44,16 +47,26 @@ public class PersonnelManagementController extends BaseController {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("PERSONNELMANAGEMENT_ID", this.get32UUID()); //主键
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", "0"); //是否删除
pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("PHONENUM"), Const.DEFAULT_PASSWORD).toString());
personnelmanagementService.save(pd);
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
Map result = HttpClientService.doPost(tongBuUrl + "/api/personnelmanagement/findByName", pd);
if (result.get("pd")==null){
pd.put("PERSONNELMANAGEMENT_ID", this.get32UUID()); //主键
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", "0"); //是否删除
pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("PHONENUM"), Const.DEFAULT_PASSWORD).toString());
personnelmanagementService.save(pd);
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
}else {
HashMap hashMap = (HashMap)result.get("pd");
PageData pageData = new PageData();
pageData.putAll(hashMap);
pd = pageData;
personnelmanagementService.save(pd);
map.put("result", errInfo);
}
return map;
}

View File

@ -10,6 +10,7 @@ import com.zcloud.service.system.DictionariesService;
import com.zcloud.util.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -28,7 +29,8 @@ import java.util.*;
@Controller
@RequestMapping("/units")
public class UnitsController extends BaseController {
@Value("${tongbu.api.url}")
private String tongBuUrl;
@Autowired
private UnitsService unitsService;
@Autowired
@ -55,25 +57,35 @@ public class UnitsController extends BaseController {
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", "0"); //是否删除
if (null != file && !file.isEmpty()) {
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail";
map.put("result", errInfo);
map.put("msg", "文件格式不正确!");
return map;
}
String ffile = DateUtil.getDays();
Map result = HttpClientService.doPost(tongBuUrl + "/api/units/findByName", pd);
if (result.get("pd")==null) {
if (null != file && !file.isEmpty()) {
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail";
map.put("result", errInfo);
map.put("msg", "文件格式不正确!");
return map;
}
String ffile = DateUtil.getDays();
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
// String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile);
pd.put("FILEPATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName);
}
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile);
pd.put("FILEPATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName);
}
// List<PageData> list = unitsService.listAll(pd);
unitsService.save(pd);
map.put("dockData", JSON.toJSONString(pd));
map.put("result", errInfo);
unitsService.save(pd);
map.put("dockData", JSON.toJSONString(pd));
map.put("result", errInfo);
}else {
HashMap hashMap = (HashMap)result.get("pd");
PageData pageData = new PageData();
pageData.putAll(hashMap);
pd = pageData;
unitsService.save(pd);
map.put("result", errInfo);
}
return map;
}

View File

@ -7,10 +7,12 @@ import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.keyProjects.VideoResourcesService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.HttpClientService;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -30,6 +32,8 @@ import java.util.Map;
@RequestMapping("/videoResources")
public class VideoResourcesController extends BaseController {
@Value("${tongbu.api.url}")
private String tongBuUrl;
@Autowired
private VideoResourcesService videoResourcesService;
@ -47,16 +51,27 @@ public class VideoResourcesController extends BaseController {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("VIDEO_RESOURCES_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //操作日期
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //操作日期
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //操作人
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //操作人
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //操作人
pd.put("ISDELETE", "0"); //是否删除
videoResourcesService.save(pd);
map.put("dockData", JSON.toJSONString(pd));
map.put("result", errInfo);
Map result = HttpClientService.doPost(tongBuUrl + "/api/videoResources/findByCode", pd);
if (result.get("pd")==null){
pd.put("VIDEO_RESOURCES_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //操作日期
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //操作日期
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //操作人
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //操作人
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //操作人
pd.put("ISDELETE", "0"); //是否删除
videoResourcesService.save(pd);
map.put("dockData", JSON.toJSONString(pd));
map.put("result", errInfo);
}else {
HashMap hashMap = (HashMap)result.get("pd");
PageData pageData = new PageData();
pageData.putAll(hashMap);
pd = pageData;
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
videoResourcesService.save(pd);
map.put("result", errInfo);
}
return map;
}

View File

@ -1,13 +1,12 @@
datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no1.url=jdbc:mysql://192.168.0.18:3306/qa-cmt-prevention1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no1.url=jdbc:mysql://39.101.130.96:33068/qa-cmt-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no1.username=root
datasource.no1.password=root
datasource.no1.password=Mysql@zcloud88888
datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no2.url=jdbc:mysql://192.168.0.18:3306/qa-cmt-regulatory1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no2.url=jdbc:mysql://39.101.130.96:33068/qa-cmt-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no2.username=root
datasource.no2.password=root
datasource.no2.password=Mysql@zcloud88888
datasource.no3.driver-class-name: oracle.jdbc.driver.OracleDriver
datasource.no3.url=jdbc:oracle:thin:@172.16.11.75:1521:orcl
@ -60,6 +59,8 @@ spring.main.banner-mode=off
preventionxgf.api.url=http://192.168.0.31:8992/qa-prevention-xgf/
# \u6E2F\u52A1\u5C40\u76D1\u7BA1\u7AEF
qa-regulatory-gwj.api.url=http://192.168.0.31:8992/qa-regulatory-gwj/
# tongbu????
tongbu.api.url=http://192.168.0.247:8094/
#preventionxgf.api.url=https://qgxgf.qhdsafety.com/qa-prevention-xgf/
#qa-regulatory-gwj.api.url=https://qgjg.qhdsafety.com/qa-regulatory-gwj/