From 777fc8d95ec2e66bbbf16827beb4b699669a2b7d Mon Sep 17 00:00:00 2001 From: zhangqinlin <983410zql> Date: Sat, 2 Apr 2022 18:01:10 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=AC=AC=E4=B8=89=E6=96=B9=E5=90=88?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jero/contract/entity/ThereContract.java | 19 +++ .../PayResearchProjectController.java | 47 +++++++ .../service/IPayResearchProjectService.java | 7 + .../impl/PayResearchProjectServiceImpl.java | 130 ++++++++++++++++++ 4 files changed, 203 insertions(+) create mode 100644 jero-boot-incoming-payment/src/main/java/com/jero/contract/entity/ThereContract.java diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/contract/entity/ThereContract.java b/jero-boot-incoming-payment/src/main/java/com/jero/contract/entity/ThereContract.java new file mode 100644 index 00000000..a4cae7f4 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/contract/entity/ThereContract.java @@ -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; + +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayResearchProjectController.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayResearchProjectController.java index 54b46501..7db14c2c 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayResearchProjectController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayResearchProjectController.java @@ -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 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); + } + /** * 第三方在研项目-下载 * diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayResearchProjectService.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayResearchProjectService.java index 46b0cd6b..20b55a48 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayResearchProjectService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayResearchProjectService.java @@ -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 void deleteFile(String id); + JSONObject pageForThreeContract(ThereContract thereContract); + + JSONObject listForThreeContract(ThereContract thereContract); + + JSONObject oneForThreeContract(String id); + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayResearchProjectServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayResearchProjectServiceImpl.java index 244a9c12..712db4f2 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayResearchProjectServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayResearchProjectServiceImpl.java @@ -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 map2 = new HashMap<>(); + map2.put("Authorization",access_token); + map2.put("Content-Type","application/json"); + post.addHeaders(map2); + HashMap 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 map2 = new HashMap<>(); + map2.put("Authorization",access_token); + map2.put("Content-Type","application/json"); + post.addHeaders(map2); + HashMap 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 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 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"); + } + }