Kaynağa Gözat

增加项目存储文件根路径

tags/24080901
WendyYang 10 ay önce
ebeveyn
işleme
8214ee2c7d
6 değiştirilmiş dosya ile 30 ekleme ve 27 silme
  1. +26
    -23
      hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java
  2. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java
  3. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sms/task/YxtPollingTask.java
  4. +1
    -0
      hz-pm-api/src/main/resources/application-dev.yml
  5. +2
    -2
      hz-pm-api/src/main/resources/application-prod.yml
  6. +0
    -0
      resources/sql/SchemaChange.sql

+ 26
- 23
hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java Dosyayı Görüntüle

@@ -1,9 +1,7 @@
package com.hz.pm.api.ding.controller;

import com.alibaba.fastjson.JSON;
import com.ningdatech.irs.service.IRefreshTokenService;
import com.hz.pm.api.common.util.CryptUtils;
import com.hz.pm.api.common.util.RefreshKeyUtil;
import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
import com.hz.pm.api.ding.task.GovBusinessStripsTask;
import com.hz.pm.api.ding.task.OrganizationBatchGetTask;
@@ -14,6 +12,7 @@ import com.hz.pm.api.projectdeclared.manage.IrsManage;
import com.hz.pm.api.projectlib.model.dto.ProjectDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.ningdatech.irs.service.IRefreshTokenService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -29,9 +28,13 @@ import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;

@@ -116,7 +119,7 @@ public class DingInfoPullController {

@GetMapping("/getToken")
public String getToken() {
return employeeBatchGetTask.getToken();
return employeeBatchGetTask.getToken();
}

@GetMapping("/getAuthToken")
@@ -141,11 +144,11 @@ public class DingInfoPullController {
public String pushProject() throws Exception {
File f = new File("/temp/遂昌归集项目信息(需补).xlsx");
// File f = new File("C:\\Users\\PoffyZhang\\Desktop\\遂昌归集项目信息(需补).xlsx");
Workbook wb = readExcel(new FileInputStream(f),f.getName());
Assert.notNull(wb,"文件流为空");
Workbook wb = readExcel(new FileInputStream(f), f.getName());
Assert.notNull(wb, "文件流为空");
Row row;
Integer sucessNum = 0;
if(wb != null){
if (wb != null) {
//获取第一个sheet
Sheet sheet = wb.getSheetAt(0);
//获取最大行数
@@ -153,9 +156,9 @@ public class DingInfoPullController {
//获取第一行
row = sheet.getRow(0);
//获取最大列数
for (int i = 1; i<rownum; i++) {
for (int i = 1; i < rownum; i++) {
row = sheet.getRow(i);
if(Objects.isNull(row) || Objects.isNull(row.getCell(0))){
if (Objects.isNull(row) || Objects.isNull(row.getCell(0))) {
//取不到数据了 停止
log.info("数据取完");
break;
@@ -167,7 +170,7 @@ public class DingInfoPullController {
projectDto.setArea(row.getCell(2).toString());
projectDto.setAreaCode("331123000");
String baseProjType = String.valueOf(row.getCell(4));
if(StringUtils.isNotBlank(baseProjType) && baseProjType.contains(".")){
if (StringUtils.isNotBlank(baseProjType) && baseProjType.contains(".")) {
baseProjType = baseProjType.substring(0,
baseProjType.indexOf("."));
}
@@ -179,7 +182,7 @@ public class DingInfoPullController {
projectDto.setBaseProjBasis(String.valueOf(row.getCell(9)));
projectDto.setBuildBasis(String.valueOf(row.getCell(10)));
String baseProjSerProg = String.valueOf(row.getCell(12));
if(StringUtils.isNotBlank(baseProjSerProg) && baseProjSerProg.contains(".")){
if (StringUtils.isNotBlank(baseProjSerProg) && baseProjSerProg.contains(".")) {
baseProjSerProg = baseProjSerProg.substring(0,
baseProjSerProg.indexOf("."));
}
@@ -195,10 +198,10 @@ public class DingInfoPullController {
projectDto.setHigherSuperOrg(String.valueOf(row.getCell(24)));
projectDto.setHigherSuperOrgCode(String.valueOf(row.getCell(25)));

log.info("projectDto :{}",JSON.toJSONString(projectDto));
log.info("projectDto :{}", JSON.toJSONString(projectDto));

if(StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))){
sucessNum ++;
if (StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))) {
sucessNum++;
}
}
}
@@ -218,15 +221,15 @@ public class DingInfoPullController {
String baseProjName = "遂昌县-nsl-项目测试004";
String baseProjId = "331123230130123412186";
String requestSecret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name());
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b");
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&isEffective=1&baseProjSysCode=" + baseProjSysCode;
RestTemplate restTemplate = new RestTemplate();
log.info("url :{}",url);
log.info("url :{}", url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info(JSON.toJSONString(forEntity));
@@ -263,9 +266,9 @@ public class DingInfoPullController {
projectDto.setHigherSuperOrg(project.getHigherSuperOrg());
projectDto.setHigherSuperOrgCode(project.getHigherSuperOrgCode());

log.info("projectDto :{}",JSON.toJSONString(projectDto));
log.info("projectDto :{}", JSON.toJSONString(projectDto));

if(StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))){
if (StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))) {
return "推送成功";
}
return "推送失败";
@@ -283,16 +286,16 @@ public class DingInfoPullController {
return irsManage.forward(dto);
}

public static Workbook readExcel(InputStream is, String extString){
public static Workbook readExcel(InputStream is, String extString) {
Workbook wb = null;

extString = extString.substring(extString.lastIndexOf("."));
try {
if(".xls".equals(extString)){
if (".xls".equals(extString)) {
return wb = new HSSFWorkbook(is);
}else if(".xlsx".equals(extString)){
} else if (".xlsx".equals(extString)) {
return wb = new XSSFWorkbook(is);
}else {
} else {
return wb = null;
}
} catch (IOException e) {


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java Dosyayı Görüntüle

@@ -69,7 +69,7 @@ public class EmployeeBatchGetTask {
private IUserInfoService iUserInfoService;

@Transactional(rollbackFor = Exception.class)
// @Scheduled(cron = "0 0 1 * * ?")
// @Scheduled(cron = "0 0 1 * * ?")
public void batchGetEmployeeTask() {
// 获取所有的组织列表用户获取组织下的 用户信息(暂时 只查 单位的类型)
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/sms/task/YxtPollingTask.java Dosyayı Görüntüle

@@ -22,7 +22,6 @@ public class YxtPollingTask {
* 每5分钟执行一次
*/
@Scheduled(cron = "0 */1 * * * ?")
// @Scheduled(cron = "${cron-expression.sms-msg-result-check-cron}")
public void smsMsgResultCheck() {
yxtContext.smsMsgResultCheck();
}


+ 1
- 0
hz-pm-api/src/main/resources/application-dev.yml Dosyayı Görüntüle

@@ -103,6 +103,7 @@ nd:
endpoint: oss-cn-hangzhou.aliyuncs.com
accessKeyId: LTAI4GL7uypycnBjiRn55rMG
accessKeySecret: qwYC7bW9bkStsko7qkLVnToAzj0Y98
rootPath: hzpm
# 日志文件配置
log:
path: ./logs


+ 2
- 2
hz-pm-api/src/main/resources/application-prod.yml Dosyayı Görüntüle

@@ -105,7 +105,7 @@ nd:
endpoint: oss-cn-hangzhou-hzltzwy-d01-a.ops.hzegcxc.cn
accessKeyId: LNoIzKV82OvTJrKI
accessKeySecret: QI9y9jGqAbPXGn3oz1JHlbvsJQEnUo
rootPath: hzpm
# 日志文件配置
log:
path: ./logs
@@ -165,7 +165,7 @@ organization:
yxt:
wsdl-url: classpath:wsdl-prod.xml
#账号
user-code: Lssdsjj
user-code: Lssdsjj121
#密码
password: Lssdsjj@2021
#音信通开关


+ 0
- 0
resources/sql/SchemaChange.sql Dosyayı Görüntüle


Yükleniyor…
İptal
Kaydet