add:第三方合同
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.jero.contract.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ThereContract {
|
||||
private String applycomno;
|
||||
private String applydeptnos;
|
||||
private String contAmountType;
|
||||
private String contSignOurcompName;
|
||||
private String contSignPartnerAName;
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private String pageNo;
|
||||
private String pageSize;
|
||||
|
||||
}
|
||||
+47
@@ -10,6 +10,7 @@ import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.contract.entity.ThereContract;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.project.entity.PayResearchProject;
|
||||
import com.jero.project.service.IPayResearchProjectService;
|
||||
@@ -91,6 +92,52 @@ public class PayResearchProjectController extends JeroController<PayResearchProj
|
||||
JSONObject pageList = payResearchProjectService.listForThree(pageNo,pageSize,abbreviation,projectName);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
/**
|
||||
* 第三方合同
|
||||
*
|
||||
* @param thereContract
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "第三方合同-分页列表查询")
|
||||
@ApiOperation(value="第三方合同-分页列表查询", notes="第三方合同-分页列表查询")
|
||||
@PostMapping(value = "/pageForThreeContractPage")
|
||||
public Result<?> pageForThreeContractPage(@RequestBody ThereContract thereContract
|
||||
) {
|
||||
JSONObject pageList = payResearchProjectService.pageForThreeContract(thereContract);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
/**
|
||||
* 第三方合同
|
||||
*
|
||||
* @param thereContract
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "第三方合同-全部")
|
||||
@ApiOperation(value="第三方合同-全部", notes="第三方合同-全部")
|
||||
@PostMapping(value = "/listForThreeContract")
|
||||
public Result<?> listForThreeContract(@RequestBody ThereContract thereContract
|
||||
) {
|
||||
JSONObject pageList = payResearchProjectService.listForThreeContract(thereContract);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
/**
|
||||
* 第三方合同
|
||||
*
|
||||
* @param id
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "第三方合同-分页列表查询")
|
||||
@ApiOperation(value="第三方合同-详情", notes="第三方合同-详情")
|
||||
@GetMapping(value = "/oneForThreeContract")
|
||||
public Result<?> oneForThreeContract(@RequestParam(name="id",required = true) String id
|
||||
) {
|
||||
JSONObject pageList = payResearchProjectService.oneForThreeContract(id);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方在研项目-下载
|
||||
*
|
||||
|
||||
+7
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.contract.entity.ThereContract;
|
||||
import com.jero.project.entity.PayResearchProject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -28,4 +29,10 @@ public interface IPayResearchProjectService extends IService<PayResearchProject>
|
||||
|
||||
void deleteFile(String id);
|
||||
|
||||
JSONObject pageForThreeContract(ThereContract thereContract);
|
||||
|
||||
JSONObject listForThreeContract(ThereContract thereContract);
|
||||
|
||||
JSONObject oneForThreeContract(String id);
|
||||
|
||||
}
|
||||
|
||||
+130
@@ -1,16 +1,22 @@
|
||||
package com.jero.project.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.contract.entity.ThereContract;
|
||||
import com.jero.project.entity.PayResearchProject;
|
||||
import com.jero.project.mapper.PayResearchProjectMapper;
|
||||
import com.jero.project.service.IPayResearchProjectService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.io.Charsets;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.checkerframework.checker.units.qual.K;
|
||||
import org.mybatis.logging.Logger;
|
||||
import org.mybatis.logging.LoggerFactory;
|
||||
@@ -50,6 +56,11 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
|
||||
|
||||
private final static String PREFIXF ="appId=QC_APP01&fid=";//文件下载参数
|
||||
|
||||
private final static String URL_TOKEN ="https://openapi.catarc.ac.cn/login";
|
||||
private final static String URL_CONTRACT_PAGE ="https://openapi.catarc.ac.cn/data/contract/page";
|
||||
private final static String URL_CONTRACT_LIST ="https://openapi.catarc.ac.cn/data/contract/list";
|
||||
private final static String URL_CONTRACT_ID ="https://openapi.catarc.ac.cn/data/contract/";
|
||||
|
||||
private final static String URL ="http://www.catarc.org.cn:8088/zxd/serviceInterface/getProjectInfoPage";//列表地址
|
||||
|
||||
private final static String URLF ="http://www.catarc.org.cn:8088/zxd/serviceInterface/downloadProjectFile";//文件下载地址
|
||||
@@ -158,4 +169,123 @@ public class PayResearchProjectServiceImpl extends ServiceImpl<PayResearchProjec
|
||||
payResearchProjectMapper.deleteFile(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject pageForThreeContract(ThereContract thereContract) {
|
||||
String access_token = getToken();
|
||||
HttpRequest post = HttpUtil.createPost(URL_CONTRACT_PAGE);
|
||||
|
||||
HashMap<String, String> map2 = new HashMap<>();
|
||||
map2.put("Authorization",access_token);
|
||||
map2.put("Content-Type","application/json");
|
||||
post.addHeaders(map2);
|
||||
HashMap<String, Object> map3 = new HashMap<>();
|
||||
if(StringUtils.isNotBlank(thereContract.getPageSize())){
|
||||
map3.put("pageSize",thereContract.getPageSize());
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getPageNo())){
|
||||
map3.put("pageNo",thereContract.getPageNo());
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getApplycomno())){
|
||||
map3.put("applycomno",thereContract.getApplycomno());
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getContAmountType())){
|
||||
map3.put("contAmountType",thereContract.getContAmountType());
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getApplydeptnos())){
|
||||
String[] split = thereContract.getApplydeptnos().split(",");
|
||||
map3.put("applydeptnos",split);
|
||||
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getContSignOurcompName())){
|
||||
map3.put("contSignOurcompName",thereContract.getContSignOurcompName());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(thereContract.getContSignPartnerAName())){
|
||||
map3.put("contSignPartnerAName",thereContract.getContSignPartnerAName());
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if(ObjectUtils.isNotEmpty(thereContract.getEndDate())){
|
||||
String endDate = simpleDateFormat.format(thereContract.getEndDate());
|
||||
map3.put("endDate",endDate);
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(thereContract.getStartDate())){
|
||||
String startDate = simpleDateFormat.format(thereContract.getStartDate());
|
||||
map3.put("startDate",startDate);
|
||||
}
|
||||
post.body(JSONObject.toJSONString(map3),"application/json");
|
||||
HttpResponse execute = post.execute();
|
||||
String body = execute.body();
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(body);
|
||||
return jsonObject1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject listForThreeContract(ThereContract thereContract) {
|
||||
String access_token = getToken();
|
||||
HttpRequest post = HttpUtil.createPost(URL_CONTRACT_LIST);
|
||||
HashMap<String, String> map2 = new HashMap<>();
|
||||
map2.put("Authorization",access_token);
|
||||
map2.put("Content-Type","application/json");
|
||||
post.addHeaders(map2);
|
||||
HashMap<String, Object> map3 = new HashMap<>();
|
||||
|
||||
if(StringUtils.isNotBlank(thereContract.getApplycomno())){
|
||||
map3.put("applycomno",thereContract.getApplycomno());
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getApplydeptnos())){
|
||||
String[] split = thereContract.getApplydeptnos().split(",");
|
||||
map3.put("applydeptnos",split);
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getContSignOurcompName())){
|
||||
map3.put("contSignOurcompName",thereContract.getContSignOurcompName());
|
||||
}
|
||||
if(StringUtils.isNotBlank(thereContract.getContAmountType())){
|
||||
map3.put("contAmountType",thereContract.getContAmountType());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(thereContract.getContSignPartnerAName())){
|
||||
map3.put("contSignPartnerAName",thereContract.getContSignPartnerAName());
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if(ObjectUtils.isNotEmpty(thereContract.getEndDate())){
|
||||
String endDate = simpleDateFormat.format(thereContract.getEndDate());
|
||||
map3.put("endDate",endDate);
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(thereContract.getStartDate())){
|
||||
String startDate = simpleDateFormat.format(thereContract.getStartDate());
|
||||
map3.put("startDate",startDate);
|
||||
}
|
||||
post.body(JSONObject.toJSONString(map3),"application/json");
|
||||
HttpResponse execute = post.execute();
|
||||
String body = execute.body();
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(body);
|
||||
return jsonObject1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject oneForThreeContract(String id) {
|
||||
String access_token = getToken();
|
||||
HttpRequest get = HttpUtil.createGet(URL_CONTRACT_ID+id);
|
||||
HashMap<String, String> map2 = new HashMap<>();
|
||||
map2.put("Authorization",access_token);
|
||||
map2.put("Content-Type","application/json");
|
||||
get.addHeaders(map2);
|
||||
HttpResponse execute = get.execute();
|
||||
String body = execute.body();
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(body);
|
||||
return jsonObject1;
|
||||
}
|
||||
|
||||
private String getToken() {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("appid", "asri");
|
||||
map.put("secret", "QyYjBQ5LyJkxktvMoKqdUOUtYgkk2VW4DgaKjgVIjCoVz7R5bgNoS");
|
||||
String s = JSONObject.toJSONString(map);
|
||||
String s1 = HttpUtil.post(URL_TOKEN, s);
|
||||
JSONObject jsonObject = JSONObject.parseObject(s1);
|
||||
return jsonObject.getJSONObject("data").getString("access_token");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user