From bc9fe478efa1443e1cda7d55f847da942384f011 Mon Sep 17 00:00:00 2001 From: zhouhaibin Date: Mon, 6 May 2024 16:33:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 105 ++--- .../example/guoyan/config/RedisConfig.java | 20 - .../guoyan/config/RestTemplateConfig.java | 67 --- .../example/guoyan/config/WebMvcConfig.java | 78 ---- .../controller/YunpingtaiController.java | 32 ++ .../example/guoyan/entity/ContractInfo.java | 9 - .../guoyan/entity/KpssProcessNode6IdInfo.java | 2 + .../com/example/guoyan/entity/ScXmkp1.java | 164 +++++++ .../com/example/guoyan/entity/SendHt.java | 3 +- .../com/example/guoyan/entity/SendKpxx.java | 4 + .../example/guoyan/mapper/OtherMapper.java | 9 +- .../example/guoyan/mapper/ScXmkp1Mapper.java | 10 + .../example/guoyan/mapper/SendXmMapper.java | 2 +- .../guoyan/scheduled/ProcessScheduled.java | 437 ++++++++++++++---- src/main/resources/application-dev.yml | 1 + src/main/resources/application-prod.yml | 12 +- src/main/resources/application.yml | 4 +- src/main/resources/mapper/OtherMapper.xml | 12 +- src/main/resources/mapper/SendHtMapper.xml | 59 ++- src/main/resources/mapper/SendKpxxMapper.xml | 129 ++++-- src/main/resources/mapper/SendXmMapper.xml | 60 ++- .../guoyan/GuoYanApplicationTests.java | 13 - .../com/example/guoyan/TestController.java | 81 ---- 23 files changed, 815 insertions(+), 498 deletions(-) delete mode 100644 src/main/java/com/example/guoyan/config/RedisConfig.java delete mode 100644 src/main/java/com/example/guoyan/config/WebMvcConfig.java create mode 100644 src/main/java/com/example/guoyan/entity/ScXmkp1.java create mode 100644 src/main/java/com/example/guoyan/mapper/ScXmkp1Mapper.java delete mode 100644 src/test/java/com/example/guoyan/GuoYanApplicationTests.java delete mode 100644 src/test/java/com/example/guoyan/TestController.java diff --git a/pom.xml b/pom.xml index 98f3fb6..fd7cb79 100644 --- a/pom.xml +++ b/pom.xml @@ -14,47 +14,12 @@ GuoYan GuoYan - 17 + 11 - - org.springframework.boot - - - spring-boot-starter-thymeleaf - - - - org.springframework.boot - spring-boot-starter-data-redis - - - - org.springframework.boot - spring-boot-starter-cache - - - - org.springframework.boot - spring-boot-starter-mail - 2.2.6.RELEASE - - - - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-test - test - - org.springframework.boot spring-boot-starter-web - compile @@ -62,49 +27,27 @@ mybatis-plus-boot-starter 3.4.0 - - com.alibaba - fastjson - 1.2.76 - - - - org.projectlombok - lombok - - - - - com.alibaba - druid-spring-boot-starter - 1.2.5 - + mysql mysql-connector-java runtime - + + + + + + + + com.alibaba druid-spring-boot-starter - 1.2.5 - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.apache.httpcomponents - httpmime - 4.5.8 + 1.2.8 + - - com.github.xiaoymin - knife4j-spring-boot-starter - 3.0.2 - org.projectlombok lombok @@ -114,10 +57,32 @@ httpclient 4.5.13 - + + com.jcraft + jsch + 0.1.55 + + + commons-io + commons-io + 2.8.0 + + + + src/main/resources + + **/*.* + + + src/main/java + + **/*.* + + + org.springframework.boot diff --git a/src/main/java/com/example/guoyan/config/RedisConfig.java b/src/main/java/com/example/guoyan/config/RedisConfig.java deleted file mode 100644 index 4d88f36..0000000 --- a/src/main/java/com/example/guoyan/config/RedisConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.guoyan.config; - -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.serializer.StringRedisSerializer; - -@Configuration -public class RedisConfig extends CachingConfigurerSupport { - @Bean - public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) { - RedisTemplate redisTemplate = new RedisTemplate<>(); - //默认的Key序列化器为:JdkSerializationRedisSerializer - redisTemplate.setKeySerializer(new StringRedisSerializer()); - redisTemplate.setConnectionFactory(connectionFactory); - return redisTemplate; - } -} diff --git a/src/main/java/com/example/guoyan/config/RestTemplateConfig.java b/src/main/java/com/example/guoyan/config/RestTemplateConfig.java index dc233ad..9e3d91f 100644 --- a/src/main/java/com/example/guoyan/config/RestTemplateConfig.java +++ b/src/main/java/com/example/guoyan/config/RestTemplateConfig.java @@ -111,73 +111,6 @@ public class RestTemplateConfig { .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) .build(); } - @Bean - public RestTemplate restTemplate(RestTemplateBuilder builder) { - RestTemplate restTemplate = new RestTemplate(); - restTemplate.setInterceptors(Collections.singletonList(new LoggingClientHttpRequestInterceptor())); - //restTemplate.getInterceptors().add(); - return restTemplate; - } - @Slf4j - class LoggingClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { - - @Override - public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { - traceRequest(request, body); - ClientHttpResponse response = execution.execute(request, body); -// response = (ClientHttpResponse) Proxy.newProxyInstance(response.getClass().getClassLoader(), new Class[]{ClientHttpResponse.class}, new ClientHttpResponseHandler(response)); - traceResponse(response); - return response; - } - - private void traceRequest(HttpRequest request, byte[] body) throws IOException { - log.info("===========================request begin================================================"); - log.info("URI : {}", request.getURI()); - log.info("Method : {}", request.getMethod()); - log.info("Headers : {}", request.getHeaders()); - log.info("Request body: {}", new String(body, "UTF-8")); - log.info("==========================request end================================================"); - } - - private void traceResponse(ClientHttpResponse response) throws IOException { - StringBuilder inputStringBuilder = new StringBuilder(); - try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), StandardCharsets.UTF_8))) { - String line = bufferedReader.readLine(); - while (line != null) { - inputStringBuilder.append(line); - inputStringBuilder.append('\n'); - line = bufferedReader.readLine(); - } - } - log.info("============================response begin=========================================="); - log.info("Status code : {}", response.getStatusCode()); - log.info("Status text : {}", response.getStatusText()); - log.info("Headers : {}", response.getHeaders()); - log.info("Response body: {}", inputStringBuilder.toString());//WARNING: comment out in production to improve performance - log.info("=======================response end================================================="); - } - -// private static class ClientHttpResponseHandler implements InvocationHandler { -// private static final String methodName = "getBody"; -// private ClientHttpResponse clientHttpResponse; -// private byte[] body; -// -// ClientHttpResponseHandler(ClientHttpResponse clientHttpResponse) { -// this.clientHttpResponse = clientHttpResponse; -// } -// -// @Override -// public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { -// if (StrUtil.equals(methodName, method.getName())) { -// if (Objects.isNull(this.body)) { -// this.body = StreamUtils.copyToByteArray(this.clientHttpResponse.getBody()); -// } -// return new ByteArrayInputStream(this.body == null ? new byte[0] : this.body); -// } -// return method.invoke(this.clientHttpResponse, args); -// } -// } - } } diff --git a/src/main/java/com/example/guoyan/config/WebMvcConfig.java b/src/main/java/com/example/guoyan/config/WebMvcConfig.java deleted file mode 100644 index b125d3b..0000000 --- a/src/main/java/com/example/guoyan/config/WebMvcConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.example.guoyan.config; - -import com.example.guoyan.common.JacksonObjectMapper; -import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; -import lombok.extern.slf4j.Slf4j; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -import java.util.List; - - -/** - * 前端资源放行配置类 - * */ -@Configuration -@Slf4j -@EnableSwagger2 -@EnableKnife4j -public class WebMvcConfig extends WebMvcConfigurationSupport { - /** - * 设置静态资源映射 - * */ - @Override - protected void addResourceHandlers(ResourceHandlerRegistry registry) { - //添加映射 - log.info("映射资源开始"); - registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/"); - registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/"); - } - - /** - * 扩展mvc框架的消息转换器 - * @param converters - */ - @Override - protected void extendMessageConverters(List> converters) { - log.info("扩展消息转换器..........."); - //创建消息转换器对象 - MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter(); - //设置对象转换器,底层使用我们定义的对象转换器通过JackJson将java对象转换为json - messageConverter.setObjectMapper(new JacksonObjectMapper()); - //将上面的消息转换器对象追加到mvc框架的转换器集合中 - converters.add(0,messageConverter); //0表示最先执行我们的追加的转换器 - } - - @Bean - public Docket createRestApi() { - // 文档类型 - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("com.cc.controller")) - .paths(PathSelectors.any()) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("接口文档") - .version("1.0") - .description("接口文档") - .build(); - } -} diff --git a/src/main/java/com/example/guoyan/controller/YunpingtaiController.java b/src/main/java/com/example/guoyan/controller/YunpingtaiController.java index d855ed6..445e874 100644 --- a/src/main/java/com/example/guoyan/controller/YunpingtaiController.java +++ b/src/main/java/com/example/guoyan/controller/YunpingtaiController.java @@ -10,13 +10,17 @@ import com.example.guoyan.entity.SendXm; import com.example.guoyan.mapper.*; import com.example.guoyan.response.ResponseBeanForBeiJing; import com.example.guoyan.scheduled.ProcessScheduled; + import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -50,10 +54,14 @@ public class YunpingtaiController { private ProcessScheduled processScheduled; @Value("${ypt.username}") private String username; + @Value("${ypt.xmhtusername}") + private String xmhtusername; @Value("${ypt.password}") private String password; @Value("${ypt.loginUrl}") private String loginUrl; + @Value("${ypt.deleteUrl}") + private String deleteUrl; @GetMapping() public Result upLoadFile() { String url = loginUrl; @@ -107,6 +115,24 @@ public class YunpingtaiController { return Result.success("成功"); } + @GetMapping("/delete") + public void delete(String yptid){ + String url = loginUrl; + //提交参数设置 + HashMap map = new HashMap<>(); + map.put("username", username); + map.put("password", password); + + //发起请求 + ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url, map, ResponseBeanForBeiJing.class); + System.out.println(responseBean.toString()); + String data = responseBean.getData().toString(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", data); + HttpEntity request = new HttpEntity<>(null, headers); + ResponseEntity exchange = restTemplate.exchange(deleteUrl+"/"+yptid, HttpMethod.DELETE, request, ResponseBeanForBeiJing.class); + log.info(exchange.getBody().getMessage().toString()); + } @GetMapping("/sendxm") public Result test1(){ String url = loginUrl; @@ -227,4 +253,10 @@ public class YunpingtaiController { processScheduled.queryInvoicingApprovalStatus(headers); return Result.success("成功"); } + @GetMapping("/down") + public void downloadFileFromSshServer() { + HttpHeaders headers = new HttpHeaders(); + String[] s = {"2c9a59b68d401eb1018e5f47201e5d84", "2c9a59b68d401eb1018e5f4720205d85"}; + processScheduled.sendfpfielUpdown(headers, s); + } } diff --git a/src/main/java/com/example/guoyan/entity/ContractInfo.java b/src/main/java/com/example/guoyan/entity/ContractInfo.java index 98f0f7d..7cb5b07 100644 --- a/src/main/java/com/example/guoyan/entity/ContractInfo.java +++ b/src/main/java/com/example/guoyan/entity/ContractInfo.java @@ -2,7 +2,6 @@ package com.example.guoyan.entity; import lombok.Data; -import javax.validation.constraints.NotNull; @Data public class ContractInfo { @@ -10,27 +9,22 @@ public class ContractInfo { /** *合同编号 */ - @NotNull(message = "contractCode 必填") private String contractCode; /** * 合同名称 */ - @NotNull(message = "contractName 必填") private String contractName; /** * 项目编号 */ - @NotNull(message = "projectNo 必填") private String projectNo; /** * 高新 1 是 0 否 */ - @NotNull(message = "highTech 必填") private Integer highTech; /** * 中标方式 字典-中标方式 */ - @NotNull(message = "winningBidWay 必填") private String winningBidWay; /** @@ -41,16 +35,13 @@ public class ContractInfo { /** * 签出 */ - @NotNull(message ="signOut 必填" ) private Integer signOut; /** * 签回 */ - @NotNull(message = "signIn 必填 ") private Integer signIn; /** * 确认日期 */ - @NotNull(message = "confirmDate 必填") private String confirmDate; } diff --git a/src/main/java/com/example/guoyan/entity/KpssProcessNode6IdInfo.java b/src/main/java/com/example/guoyan/entity/KpssProcessNode6IdInfo.java index f1e6007..019933b 100644 --- a/src/main/java/com/example/guoyan/entity/KpssProcessNode6IdInfo.java +++ b/src/main/java/com/example/guoyan/entity/KpssProcessNode6IdInfo.java @@ -25,5 +25,7 @@ public class KpssProcessNode6IdInfo { private String friststepid; @Value("${kpssProcessNode6IdInfo.processControlid}") private String processControlid; + @Value("${kpssProcessNode6IdInfo.contraProcessnode05}") + private String contraProcessnode05; } diff --git a/src/main/java/com/example/guoyan/entity/ScXmkp1.java b/src/main/java/com/example/guoyan/entity/ScXmkp1.java new file mode 100644 index 0000000..600d2db --- /dev/null +++ b/src/main/java/com/example/guoyan/entity/ScXmkp1.java @@ -0,0 +1,164 @@ +package com.example.guoyan.entity; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 项目卡片(ScXmkp1)实体类 + * + * @author makejava + * @since 2024-01-26 09:59:05 + */ +@Data +public class ScXmkp1 implements Serializable { + private static final long serialVersionUID = 385904376085591491L; + + private String requestid; + + private String id; + + private String ywfw; + + private String xmxz; + + private String wtdw; + + private String lxrjlxdh; + + private String xmly; + + private String htbh; + + private String cjr; + + private String ssbm; + + private String xmkssj; + + private String xmfzr; + + private String cbbm; + + private String xmcy; + + private String gxry; + + private String zxm; + + private String htsfyq; + + private String tzlx; + + private String gcsyzd; + + private String xmjd; + + private String bz; + + private String xmzt; + + private String xmgm; + + private Integer roworder000; + + private String lxdh; + + private String gcszq; + + private String cjrq; + + private String htxx; + + private Double htje; + + private Double ysk; + + private String bbxmmc; + + private String xmbh; + + private String ssgs; + + private String khxz; + + private String khdz; + + private String xsfzr; + + private String myzj; + + private String xmjzsj; + + private String yjyssj; + + private String sfyysbg; + + private String sfykhzmx; + + private String sfyhtsmj; + + private String sfzjss; + + private String sfyzbtzs; + + private String skbl; + + private Double xmml; + + private Double ssje; + + private String xmysbdgs; + + private String gshj; + + private String rgcbhj; + + private String xmms; + + private String xgfj; + + private Double jsfwysje; + + private String sfyjsfwxq; + + private String xqnr; + + private String fyys; + + private Double jsgm; + + private String sslx; + + private String ssxy; + + private String xszl; + + private String xmzt1; + + private String gw; + + private String xmzq; + + private String xmlx; + + private String xmmc; + + private String xzlcb; + + private String zjfwxq; + + private Double fwysje; + + private String sfqh; + + private String khlx; + /** + * 云平台编号 + */ + private String yptbh; + + + +} + diff --git a/src/main/java/com/example/guoyan/entity/SendHt.java b/src/main/java/com/example/guoyan/entity/SendHt.java index 5fdf700..85b291d 100644 --- a/src/main/java/com/example/guoyan/entity/SendHt.java +++ b/src/main/java/com/example/guoyan/entity/SendHt.java @@ -73,6 +73,7 @@ public class SendHt implements Serializable { */ private String contractId; private String errormessage; - + private String requestid; + private String zxm; } diff --git a/src/main/java/com/example/guoyan/entity/SendKpxx.java b/src/main/java/com/example/guoyan/entity/SendKpxx.java index eaf32c1..d37ea77 100644 --- a/src/main/java/com/example/guoyan/entity/SendKpxx.java +++ b/src/main/java/com/example/guoyan/entity/SendKpxx.java @@ -145,5 +145,9 @@ public class SendKpxx implements Serializable { */ private String returnInvoiceNo; private String errormessage; + /** + * 原开票id 退票时使用 + */ + private String ykpid; } diff --git a/src/main/java/com/example/guoyan/mapper/OtherMapper.java b/src/main/java/com/example/guoyan/mapper/OtherMapper.java index 0e7cded..15c7230 100644 --- a/src/main/java/com/example/guoyan/mapper/OtherMapper.java +++ b/src/main/java/com/example/guoyan/mapper/OtherMapper.java @@ -38,5 +38,12 @@ public interface OtherMapper extends BaseMapper { void updateSchtqx_Byid(@Param("id") String id); void updateRequeststatusBack(HashMap map); void delPermissionuserBack(HashMap map); - + List> selectHtProcess(@Param("reqid") String id,@Param("setpid") String setpid); + List> selctscxmkp1by (@Param("project_no") String id,@Param("sslx") String setpid); +// List> selectstaffbyid(@Param("number") String id); +// List> selectsc_hh1byname(@Param("qymc") String id); +// List> selectsc_lxr1byid (@Param("lxr") String id,@Param("qymc") String setpid); +// List> selectsc_htlcbyid(@Param("xmbh") String xmbh); +// List> selectcatalogdatabyid(@Param("htid") String htid); +// int updatebyid(@Param("yptbh") String yptbh,@Param("xmbh") String xmbh); } diff --git a/src/main/java/com/example/guoyan/mapper/ScXmkp1Mapper.java b/src/main/java/com/example/guoyan/mapper/ScXmkp1Mapper.java new file mode 100644 index 0000000..4a591b9 --- /dev/null +++ b/src/main/java/com/example/guoyan/mapper/ScXmkp1Mapper.java @@ -0,0 +1,10 @@ +package com.example.guoyan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.example.guoyan.entity.ScXmkp1; +import org.apache.ibatis.annotations.Mapper; + +@Mapper + +public interface ScXmkp1Mapper extends BaseMapper { +} diff --git a/src/main/java/com/example/guoyan/mapper/SendXmMapper.java b/src/main/java/com/example/guoyan/mapper/SendXmMapper.java index 170cf07..770f30a 100644 --- a/src/main/java/com/example/guoyan/mapper/SendXmMapper.java +++ b/src/main/java/com/example/guoyan/mapper/SendXmMapper.java @@ -15,5 +15,5 @@ public interface SendXmMapper extends BaseMapper { */ List querySendXmByNoDel(); List querySendXmByProjectId(@Param("projectId") String id); - + List getscxmkp1ByProjectId(@Param("projectId") String id); } diff --git a/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java b/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java index e634b56..913bcad 100644 --- a/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java +++ b/src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java @@ -2,12 +2,15 @@ package com.example.guoyan.scheduled; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.example.guoyan.entity.*; import com.example.guoyan.mapper.*; import com.example.guoyan.response.ResponseBeanForBeiJing; +import com.jcraft.jsch.ChannelSftp; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.Session; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.FileSystemResource; @@ -21,6 +24,7 @@ import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; import java.io.File; +import java.io.FileOutputStream; import java.text.SimpleDateFormat; import java.util.*; @@ -57,6 +61,8 @@ public class ProcessScheduled { private PermissionrulegroupMapper permissionrulegroupMapper; @Value("${ypt.username}") private String username; + @Value("${ypt.xmhtusername}") + private String xmhtusername; @Value("${ypt.password}") private String password; @Value("${ypt.loginUrl}") @@ -85,6 +91,8 @@ public class ProcessScheduled { private KpssProcessNode6IdInfo kpssProcessNode6IdInfo; @Value("${ypt.htqxid}") private String htqxid; + private String[] industry = {"政党机关","公检法司","交通运输","医疗卫生","文体教育","农林牧渔", + "通信电信","水利水电","航空航天","石油化工","环保绿化","海洋气象","金融保险","科研技术","商业服务","军队"}; /** * 定时任务跑合同和项目信息的变化发给北京,五分钟一次 */ @@ -100,16 +108,18 @@ public class ProcessScheduled { //发起请求 获取权限token log.info(map.toString()); ResponseBeanForBeiJing responseBean = restTemplate.postForObject(loginUrl, map, ResponseBeanForBeiJing.class); - log.info("登录返回的信息:"+responseBean.toString()); + log.info("xmht登录返回的信息:"+responseBean.toString()); if("200".equals(responseBean.getCode())){ String data = responseBean.getData().toString(); HttpHeaders headers = new HttpHeaders(); - headers.set("Authorization", data); + headers.set("Authorization",data); List sendXmList = sendXmMapper.querySendXmByNoDel(); sendXmToYunPingtai(sendXmList, headers); List sendHtList = sendHtMapper.querySendHtByNoDel(); sendHtToYunPingtai(sendHtList,headers); //处理开票信息 + // + List sendKpxxList = sendKpxxMapper.querySendKpxxByNoDel(); sendKpxxList.forEach(item->{ Integer interfaceType = item.getInterfaceType();//类型字段 @@ -124,7 +134,7 @@ public class ProcessScheduled { } //开票确认 }else if (interfaceType==1&& "ZJ".equals(item.getQy())){ - sendKpqrToYunPingtai(item,headers); +// sendKpqrToYunPingtai(item,headers); //开票确认收入 }else if(interfaceType==2){ String wfrequest = item.getWfrequest(); @@ -140,14 +150,15 @@ public class ProcessScheduled { }else if (interfaceType==3&& "ZJ".equals(item.getQy())){ sendKpqrdzToYunPingtai(item,headers); }else { - log.info("未知编号:"+interfaceType); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, item.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "不是ZJ+0-3的类型");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } }); //处理云平台开票信息更新流程 queryInvoicingApprovalStatus(headers); sendKpCancelToYPT(headers);//开票取消 - // - }else { log.info("登录失败!"); } @@ -164,8 +175,16 @@ public class ProcessScheduled { public void sendXmToYunPingtai(List sendXmList, HttpHeaders headers) { //把查到的数据按次序更新或新增到北京 sendXmList.forEach(iteam -> { + iteam.setProjectDescription(null);//项目描述非必填项 + List list = Arrays.asList(industry); + String projectIndustry = iteam.getProjectIndustry(); + if(!list.contains(projectIndustry)){ + iteam.setProjectIndustry("科研技术"); + } //0表示新增,要传到北京 if (iteam.getOperatetype() == 0) { + String name = iteam.getProjectNo()+"*"+iteam.getProjectName(); + iteam.setProjectName(name); iteam.setProjectNo(null); //传到北京的接口 // 组装请求体 @@ -199,7 +218,19 @@ public class ProcessScheduled { if (iteam.getOperatetype() == 1) { // 组装请求体 HashMap getdata = otherMapper.selectScXMkp1_yptbh_ByPjid(iteam.getProjectId()); - String yptbh = getdata.get("yptbh").toString();//云平台编号 + String yptbh = getdata.get("yptbh"); + if(yptbh ==null){ + log.info("更新失败,projectId是" + iteam.getProjectId() + " id是" + iteam.getId()); + log.info("云平台编号为空" ); + //记录失败原因 + LambdaUpdateWrapper sendXmLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendXmLambdaUpdateWrapper.eq(SendXm::getId,iteam.getId()); + sendXmLambdaUpdateWrapper.set(SendXm::getErrormessage,"云平台编号为空"); + sendXmMapper.update(null, sendXmLambdaUpdateWrapper); + return; + } + String name = iteam.getProjectNo()+"*"+iteam.getProjectName(); + iteam.setProjectName(name); iteam.setProjectNo(yptbh); HttpEntity request = new HttpEntity<>(iteam, headers); ResponseBeanForBeiJing responseData = restTemplate.postForObject(projectUrl, request, ResponseBeanForBeiJing.class); @@ -227,7 +258,27 @@ public class ProcessScheduled { @Transactional() public void sendHtToYunPingtai(List sendHtList, HttpHeaders headers) { sendHtList.forEach(item -> { + String winningBidWay = item.getWinningBidWay(); + if("邀请招标".equals(winningBidWay)){ + item.setWinningBidWay("内部邀请"); + } //用项目id 查询项目金额 + HashMap hashMap = new HashMap<>(); + String requestid = item.getRequestid(); + if(item.getZxm()!=null){ + LambdaUpdateWrapper sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendHtLambdaUpdateWrapper.eq(SendHt::getId, item.getId());//更新条件 + sendHtLambdaUpdateWrapper.set(SendHt::getErrormessage,"是子合同不做处理");//更新的值 + sendHtMapper.update(null, sendHtLambdaUpdateWrapper); + return; + } + String contraProcessnode05 = kpssProcessNode6IdInfo.getContraProcessnode05(); + List> selectProcessNo5 = otherMapper.selectHtProcess(requestid, contraProcessnode05); + if(selectProcessNo5.size()==0){ + //未到审批节点,不忘北京发送 + log.info(item.getId()+"未到审批节点,不忘北京发送"); + return; + } String xmAmount = otherMapper.selectXmAmount(item.getProjectId()); Double contractAmount = item.getContractAmount(); Double amt = Double.valueOf(xmAmount); @@ -284,7 +335,16 @@ public class ProcessScheduled { if ("1".equals(item.getOperatetype())) { // 组装请求体 HashMap getdata = otherMapper.selectScHTLC_yptbh_ByPjid(item.getContractId()); - String yptbh = getdata.get("yptbh").toString();//云平台编号 + if(getdata ==null){ + //记录失败原因 + LambdaUpdateWrapper sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendHtLambdaUpdateWrapper.eq(SendHt::getId, item.getId());//更新条件 + sendHtLambdaUpdateWrapper.set(SendHt::getErrormessage,"云平台编号为空");//更新的值 + sendHtMapper.update(null, sendHtLambdaUpdateWrapper); + return; + } + String yptbh = getdata.get("yptbh");//云平台编号 + item.setContractCode(yptbh); HttpEntity request = new HttpEntity<>(item, headers); log.info(item.toString()); @@ -311,6 +371,30 @@ public class ProcessScheduled { } @Transactional() public void senKpxxToYunPingtai(SendKpxx sendKpxx, HttpHeaders headers){ + LambdaQueryWrapper sendKpxxLambdaQueryWrapper1 = new LambdaQueryWrapper<>(); + sendKpxxLambdaQueryWrapper1.select(SendKpxx::getId,SendKpxx::getRequestid); + sendKpxxLambdaQueryWrapper1.eq(SendKpxx::getRequestid,sendKpxx.getRequestid()); + sendKpxxLambdaQueryWrapper1.eq(SendKpxx::getInterfaceType,"0"); + sendKpxxLambdaQueryWrapper1.isNotNull(SendKpxx::getStatus); + sendKpxxLambdaQueryWrapper1.ne(SendKpxx::getStatus,"3"); + List sendKpxxes1 = sendKpxxMapper.selectList(sendKpxxLambdaQueryWrapper1); + + if(sendKpxxes1.size()>0&&sendKpxx.getIsReturn()==0){ + log.info("新增开票信息失败,已开票,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); + //记录错误信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "错误信息:已开票");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + return; + } + if("信息技术咨询监理服务费".equals(sendKpxx.getInvoiceContent())){ + sendKpxx.setInvoiceContent("监理咨询服务费"); + } + if(StringUtils.isBlank(sendKpxx.getPayerNumber())){ + sendKpxx.setPayerNumber("/"); + } + sendKpxx.setReceiptScheduleName(null); //新增 String[] evidenceIds = sendKpxx.getEvidenceId().split(",");//获取文件id组 String evidenceid= sendfpfielUpdown(headers,evidenceIds);//上传文件信息 @@ -345,13 +429,92 @@ public class ProcessScheduled { } } } - if(sendKpxx.getOperatetype()==0){ - sendKpxx.setInvoiceNo(null); + if(sendKpxx.getOperatetype()==0||sendKpxx.getOperatetype()==1){ + if(sendKpxx.getIsReturn()==0){ + sendKpxx.setInvoiceNo(null); + } + HashMap hashMapScKpsqsp = otherMapper.selectScKpsqsp_yptbh_ByPjid(sendKpxx.getRequestid()); + String fplx = hashMapScKpsqsp.get("fplx"); + String fpzl = hashMapScKpsqsp.get("fpzl"); + //发票种类如果是电子发票 + if("2c9a59b680e0190f0181224a7a76045a".equals(fpzl)){ + sendKpxx.setInvoiceType("增值税电子普通发票"); + } + if("2c9adae478fdbe15017906eca5710259".equals(fplx)){ + String dz = hashMapScKpsqsp.get("dz"); + String dh = hashMapScKpsqsp.get("dh"); + String zh = hashMapScKpsqsp.get("zh"); + String khx = hashMapScKpsqsp.get("khx"); + String specialInfo= "开户行:"+khx+" ,账号:"+zh+" ,地址及电话:"+dz+dh; + sendKpxx.setSpecialInfo(specialInfo); + } headers.setContentType(MediaType.APPLICATION_JSON); sendKpxx.setEvidenceId(evidenceid); + String xsfzr =""; //退票要先删掉原来的到账信息 + String projectid = sendKpxx.getProjectNo();//项目编号,其他的是云平台编号 + List sendXms = sendXmMapper.getscxmkp1ByProjectId(projectid); + if(sendXms.size()>0){ + SendXm iteam = sendXms.get(0); + iteam.setProjectDescription(null);//项目描述非必填项 + List list = Arrays.asList(industry); + String projectIndustry = iteam.getProjectIndustry(); + if(!list.contains(projectIndustry)){ + iteam.setProjectIndustry("科研技术"); + } + HashMap getdata = otherMapper.selectScXMkp1_yptbh_ByPjid(iteam.getProjectId()); + String yptbh = getdata.get("yptbh"); + sendKpxx.setProjectNo(yptbh); + if(yptbh ==null){ + log.info("开票申请更新项目西悉尼更新失败,projectId是" + iteam.getProjectId()); + log.info("云平台编号为空" ); + return; + } + String name = iteam.getProjectNo()+"*"+iteam.getProjectName(); + iteam.setProjectName(name); + iteam.setProjectNo(yptbh); + HttpEntity request = new HttpEntity<>(iteam, headers); + ResponseBeanForBeiJing responseData = restTemplate.postForObject(projectUrl, request, ResponseBeanForBeiJing.class); + if ("200".equals(responseData.getCode())) { + xsfzr = iteam.getSalesLeaderCode(); + sendKpxx.setApplyUserCode(xsfzr); + log.info("开票申请更新项目西悉尼更新成功"); + }else { + log.info(responseData.getMessage().toString()); + } + + } if(sendKpxx.getIsReturn()==1){ deleteFpdzrq(headers,sendKpxx); + if(sendKpxx.getInvoiceNo()==null){ + log.info("退票发票发票编号不能为空"); + log.info("新增退票开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "退票发票发票编号不能为空");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + } + headers.setContentType(MediaType.APPLICATION_JSON); + sendKpxx.setEvidenceId(evidenceid); + sendKpxx.setReturnInvoiceNo(sendKpxx.getInvoiceNo()); + HttpEntity request = new HttpEntity<>(sendKpxx, headers); + ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class); + if ("200".equals(responseData.getCode())) { + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, 1);//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + log.info("新增退票开票信息到云平台成功"); + log.info(responseData.toString()); + } else { + log.info("新增退票开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); + log.error("返回的信息是" + responseData.toString()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + } + return; } HttpEntity request = new HttpEntity<>(sendKpxx, headers); ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class); @@ -363,7 +526,7 @@ public class ProcessScheduled { paramMap.put("id", sendKpxx.getRequestid()); otherMapper.updateScKpsqsp_yptbh_Byid(paramMap);//把返回的项目编号存入Sc_kssqsp LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid, sendKpxx.getRequestid());//更新条件 sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, 1);//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); log.info("新增开票信息到云平台成功"); @@ -380,67 +543,91 @@ public class ProcessScheduled { log.error("返回的信息是" + responseData.toString()); //记录错误信息 LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid, sendKpxx.getRequestid());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } - //修改 - if (sendKpxx.getOperatetype()==1){ - if(sendKpxx.getInvoiceNo()==null){ - log.info("修改发票发票编号不能为空"); - } - headers.setContentType(MediaType.APPLICATION_JSON); - sendKpxx.setEvidenceId(evidenceid); - HttpEntity request = new HttpEntity<>(sendKpxx, headers); - ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class); - if ("200".equals(responseData.getCode())) { +// //修改 +// if (sendKpxx.getOperatetype()==1){ +// sendKpxx.setInvoiceNo(null); +// headers.setContentType(MediaType.APPLICATION_JSON); +// sendKpxx.setEvidenceId(evidenceid); +// //退票要先删掉原来的到账信息 +// if(sendKpxx.getIsReturn()==1){ +// deleteFpdzrq(headers,sendKpxx); +// } +// HttpEntity request = new HttpEntity<>(sendKpxx, headers); +// ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class); +// if ("200".equals(responseData.getCode())) { // Map dataMap = (Map) responseData.getData(); // String invoiceNo = dataMap.get("invoiceNo").toString(); // HashMap paramMap = new HashMap<>(); // paramMap.put("yptbh", invoiceNo); // paramMap.put("id", sendKpxx.getRequestid()); // otherMapper.updateScKpsqsp_yptbh_Byid(paramMap);//把返回的项目编号存入Sc_kssqsp - LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, 1);//更新的值 - sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); - log.info("新增开票信息到云平台成功"); - log.info(responseData.toString()); - } else { - log.info("新增开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); - log.error("返回的信息是" + responseData.toString()); - //记录错误信息 - LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 - sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); - } - } +// LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); +// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid, sendKpxx.getRequestid());//更新条件 +// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, 1);//更新的值 +// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); +// log.info("修改开票信息后新增开票信息到云平台成功"); +// log.info(responseData.toString()); +// //因为更新云平台编号,会导致多一个无用的更新数据,所以要删除 +// //要删除他 +// sendKpxxLambdaUpdateWrapper.clear(); +// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid,sendKpxx.getRequestid()); +// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getOperatetype,1); +// sendKpxxLambdaUpdateWrapper.isNull(SendKpxx::getStatus); +// sendKpxxMapper.delete(sendKpxxLambdaUpdateWrapper); +// } else { +// log.info("修改开票信息后新增开票信息失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); +// log.error("修改开票信息后返回的信息是" + responseData.toString()); +// //记录错误信息 +// LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); +// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getRequestid, sendKpxx.getRequestid());//更新条件 +// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 +// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); +// +// } +// } } @Transactional() public void sendKpqrToYunPingtai(SendKpxx sendKpxx, HttpHeaders headers){ String invoiceNo = sendKpxx.getInvoiceNo(); if(StringUtils.isBlank(invoiceNo)){ + //记录错误信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "发票发票编号不能为空");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } -// MultiValueMap params = new LinkedMultiValueMap<>(); -// params.add("invoiceNo",invoiceNo); - //HttpEntity> StringrequestEntity = ; - HttpEntity request = new HttpEntity<>(null, headers); ResponseEntity exchange = restTemplate.exchange(InvoicingApprovalStatusUrl+"/"+invoiceNo, HttpMethod.GET, request, ResponseBeanForBeiJing.class); ResponseBeanForBeiJing beanForBeiJing = exchange.getBody(); if (!"200".equals(beanForBeiJing.getCode())){ - log.info("返回信息错误!"+beanForBeiJing.toString()); + //记录错误信息 + log.info("返回信息错误!"+beanForBeiJing.getMessage().toString()+sendKpxx.getId()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, beanForBeiJing.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } Map dataMap = (Map) beanForBeiJing.getData(); Integer status = (Integer) dataMap.get("status"); + if(status==4){ + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "开票已确认");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + log.info(sendKpxx.getId()+"开票已确认,不能进行开票确认"); + return; + } if (status!=2){ - log.info("开票申请未通过,不能进行开票确认"); + log.info(sendKpxx.getId()+"开票申请未通过,不能进行开票确认"); return; } //新增 @@ -462,7 +649,7 @@ public class ProcessScheduled { //记录失败信息 LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } @@ -475,27 +662,36 @@ public class ProcessScheduled { public void sendKpqrsrToYunPingtai(SendKpxx sendKpxx, HttpHeaders headers){ HashMap stringStringHashMap = otherMapper.selectScKpsqsp_yptbh_Byreqid(sendKpxx.getWfrequest()); if(stringStringHashMap==null){ + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } String invoiceNo = stringStringHashMap.get("yptbh"); - if(StringUtils.isBlank(invoiceNo)){ - return; - } +// if(StringUtils.isBlank(invoiceNo)){ +// LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); +// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 +// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值 +// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); +// return; +// } -// MultiValueMap params = new LinkedMultiValueMap<>(); -// params.add("invoiceNo",invoiceNo); -// HttpEntity> request = new HttpEntity<>(params, headers); HttpEntity request = new HttpEntity<>(null, headers); ResponseEntity exchange = restTemplate.exchange(InvoicingApprovalStatusUrl+"/"+invoiceNo, HttpMethod.GET, request, ResponseBeanForBeiJing.class); ResponseBeanForBeiJing beanForBeiJing = exchange.getBody(); if (!"200".equals(beanForBeiJing.getCode())){ - log.info("返回信息错误!"+beanForBeiJing.toString()); + log.info("返回信息错误!"+beanForBeiJing.getMessage().toString()+sendKpxx.getId()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, beanForBeiJing.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } Map dataMap = (Map) beanForBeiJing.getData(); Integer status = (Integer) dataMap.get("status"); if (status!=4){ - log.info("开票申请未通过,不能进行开票确认"); + log.info(sendKpxx.getId()+"开票申请未通过,不能进行开票确认"); return; } //新增 @@ -524,12 +720,12 @@ public class ProcessScheduled { //记录失败信息 LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } //修改 - if (sendKpxx.getOperatetype()==1){ + else if (sendKpxx.getOperatetype()==1){ invoiceNo = otherMapper.selectScKpsqsp_yptbh_Byreqid(sendKpxx.getWfrequest()).get("yptbh"); sendKpxx.setInvoiceNo(invoiceNo); sendKpxx.setOpFlag(1); @@ -564,33 +760,70 @@ public class ProcessScheduled { sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + }else if (sendKpxx.getOperatetype()==2){ + invoiceNo = otherMapper.selectScKpsqsp_yptbh_Byreqid(sendKpxx.getWfrequest()).get("yptbh"); + sendKpxx.setInvoiceNo(invoiceNo); + sendKpxx.setOpFlag(1); + String incomeId = otherMapper.selectScKpcwqrsr_incomeId_Bylcid(sendKpxx.getWfrequest()).get("incomeId"); + sendKpxx.setIncomeId(incomeId); + HttpEntity request1 = new HttpEntity<>(sendKpxx, headers); + ResponseBeanForBeiJing responseData = restTemplate.postForObject(incomeUrl,request1, ResponseBeanForBeiJing.class); + //删除成功后在新增 + if ("200".equals(responseData.getCode())){ + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, 1);//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + log.info("删除后新增开票确认收入"); + log.info(responseData.toString()); + }else { + log.info("删除开票确认收入失败,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId()); + log.info("返回的信息是" + responseData.toString()); + //记录失败信息 + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); + } } } @Transactional() public void sendKpqrdzToYunPingtai(SendKpxx sendKpxx, HttpHeaders headers){ HashMap stringStringHashMap = otherMapper.selectScKpsqsp_yptbh_ByPjid(sendKpxx.getRequestid()); - sendKpxx.setOpUserCode(sendKpxx.getApplyUserCode()); - if(stringStringHashMap==null){ - return; + if(sendKpxx.getOpUserCode()==null){ + sendKpxx.setOpUserCode(sendKpxx.getApplyUserCode()); } - String invoiceNo = stringStringHashMap.get("yptbh"); - if(StringUtils.isBlank(invoiceNo)){ + if(stringStringHashMap.get("yptbh")==null){ + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } -// MultiValueMap par ams = new LinkedMultiValueMap<>(); -// params.add("invoiceNo",invoiceNo); -// HttpEntity> request = new HttpEntity<>(params, headers); + String invoiceNo = stringStringHashMap.get("yptbh"); +// if(StringUtils.isBlank(invoiceNo)){ +// LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); +// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 +// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值 +// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); +// return; +// } + HttpEntity request = new HttpEntity<>(null, headers); ResponseEntity exchange = restTemplate.exchange(InvoicingApprovalStatusUrl+"/"+invoiceNo, HttpMethod.GET, request, ResponseBeanForBeiJing.class); ResponseBeanForBeiJing beanForBeiJing = exchange.getBody(); if (!"200".equals(beanForBeiJing.getCode())){ - log.info("返回信息错误!"+beanForBeiJing.toString()); + log.info("返回信息错误!"+beanForBeiJing.getMessage().toString()+sendKpxx.getId()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, beanForBeiJing.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } Map dataMap = (Map) beanForBeiJing.getData(); Integer status = (Integer) dataMap.get("status"); if (status!=4){ - log.info("开票申请未确认,不能进行开票确认"); + log.info(sendKpxx.getId()+"开票申请未确认,不能进行开票确认"); return; } //新增 @@ -619,7 +852,7 @@ public class ProcessScheduled { log.info("返回的信息是" + responseData.toString()); LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } } @@ -656,7 +889,7 @@ public class ProcessScheduled { } LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 - sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); } @@ -666,15 +899,15 @@ public class ProcessScheduled { List sendKpxxToYPTList = sendKpxxMapper.querySendToYPT(); sendKpxxToYPTList.forEach(item->{ String invoiceNo = item.getInvoiceNo(); - -// MultiValueMap params = new LinkedMultiValueMap<>(); -// params.add("invoiceNo",invoiceNo); -// HttpEntity> request = new HttpEntity<>(params, headers); HttpEntity request = new HttpEntity<>(null, headers); ResponseEntity exchange = restTemplate.exchange(InvoicingApprovalStatusUrl+"/"+invoiceNo, HttpMethod.GET, request, ResponseBeanForBeiJing.class); ResponseBeanForBeiJing beanForBeiJing = exchange.getBody(); if (!"200".equals(beanForBeiJing.getCode())){ - log.info("返回信息错误!"+beanForBeiJing.toString()); + log.info("返回信息错误!"+beanForBeiJing.getMessage().toString()+item.getId()); + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, item.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, beanForBeiJing.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); return; } Map dataMap = (Map) beanForBeiJing.getData(); @@ -867,20 +1100,26 @@ public class ProcessScheduled { }); } //发送发票文件 - private String sendfpfielUpdown(HttpHeaders headers,String[] evidenceIds){ + public String sendfpfielUpdown(HttpHeaders headers,String[] evidenceIds){ String evidenceid=""; for (String id:evidenceIds) { //查询 HashMap fileMap = otherMapper.selectFileById(id); String filePath = fileMap.get("filepath"); - String filetype = fileMap.get("filetype"); - //String filePath = "E:\\adad.txt"; + String originalName = fileMap.get("originalName"); filePath =fileDownPre+filePath; - File file = new File(filePath); + File file1 = new File(filePath); + //文件不存在 创建文件夹 + if(!file1.exists()){ + file1.mkdirs(); + } + String newfilepath = filePath+File.separator+originalName; + downloadFileFromSshServer(filePath,newfilepath); + File file = new File(newfilepath); if(file.exists()){ headers.setContentType(MediaType.MULTIPART_FORM_DATA); MultiValueMap body = new LinkedMultiValueMap<>(); - body.add("file", new FileSystemResource(new File(filePath))); + body.add("file", new FileSystemResource(new File(newfilepath))); HttpEntity> request = new HttpEntity<>(body, headers); ResponseBeanForBeiJing responseData = restTemplate.postForObject(uploadFileUrl ,request, ResponseBeanForBeiJing.class); //文件处理 @@ -905,6 +1144,7 @@ public class ProcessScheduled { ResponseBeanForBeiJing beanForBeiJing = exchange.getBody(); if (!"200".equals(beanForBeiJing.getCode())){ log.info("合同取消到北京云平台失败返回信息错误!"+beanForBeiJing.toString()); + return; } if ("200".equals(beanForBeiJing.getCode()) && (Boolean) beanForBeiJing.getData()==true) { @@ -924,12 +1164,7 @@ public class ProcessScheduled { sendKpxx.setOpUserCode(sendKpxx.getApplyUserCode()); Double invoiceAmount = sendKpxx.getInvoiceAmount(); LambdaQueryWrapper scKpsqspLambdaQueryWrapper = new LambdaQueryWrapper<>(); - scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getId, requestid); - List queryxxmclist = scKpsqspMapper.selectList(scKpsqspLambdaQueryWrapper); - String xmmc = queryxxmclist.get(0).getXmmc(); - scKpsqspLambdaQueryWrapper.clear(); - scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getXmmc,xmmc); - scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getKpje, invoiceAmount); + scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getId, sendKpxx.getYkpid()); List scKpsqspList = scKpsqspMapper.selectList(scKpsqspLambdaQueryWrapper); if (scKpsqspList.size() > 0) { ScKpsqsp scKpsqsp = scKpsqspList.get(0); @@ -941,9 +1176,41 @@ public class ProcessScheduled { if ("200".equals(responseData.getCode())) { return true; } + LambdaUpdateWrapper sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件 + sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值 + sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper); log.info("删除到账信息失败"+responseData.toString()); } return false; } + public void downloadFileFromSshServer(String remoteFilePath, String localFilePath) { + + String host = "116.62.210.190"; + String username = "root"; + String password = "Guoyan83086775"; + int port = 22; + JSch jsch = new JSch(); + Session session = null; + try { + session = jsch.getSession(username, host, port); + session.setConfig("StrictHostKeyChecking", "no"); + session.setPassword(password); + session.connect(); + + ChannelSftp channelSftp = (ChannelSftp) session.openChannel("sftp"); + channelSftp.connect(); + channelSftp.get(remoteFilePath, new FileOutputStream(localFilePath)); + channelSftp.exit(); + + + session.disconnect(); + } catch (Exception e) { + if (session != null && session.isConnected()) { + session.disconnect(); + } + System.out.println("文件获取失败:" + e.getMessage()); + } + } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 6928aa4..e300965 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -39,5 +39,6 @@ kpssProcessNode6IdInfo: nextStepOperid: "2c9adae4797fd663017982c00bf301e3" friststepid: "2c9adae478fdbe15017906f93ec90262" processControlid: "2c9adae478e9195d0178f3300fcc0432" + contraProcessnode05: "2c9a59b680e0190f01817ffba9530e1c" diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 645441c..20273e2 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,18 +1,21 @@ spring: datasource: - druid: driver-class-name: com.mysql.cj.jdbc.Driver # #serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true - url: jdbc:mysql://116.62.210.190:3306/guoyan?autoReconnect=true&useUnicode=true&characterEncoding=UTF8&mysqlEncoding=utf8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://116.62.210.190:3306/guoyan?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone =Asia/Shanghai username: root password: Guoyan83086775 + type: com.alibaba.druid.pool.DruidDataSource + # 数据源其他配置 + logging: # 配置日志文件存储位置 file: path: /opt/log ypt: username: '0519999' + xmhtusername: '0510002' password: 'gy123456' loginUrl: http://123.57.82.48:8080/api/auth/login projectUrl: http://123.57.82.48:8080/api/nb/project @@ -23,8 +26,9 @@ ypt: incomeUrl: http://123.57.82.48:8080/api/nb/invoice/income accountUrl: http://123.57.82.48:8080/api/nb/invoice/account InvoicingApprovalStatusUrl: http://123.57.82.48:8080/api/nb/invoice/status + deleteUrl: http://123.57.82.48:8080/api/nb/invoice cancelPrjetcUrl: http://123.57.82.48:8080/api/nb/project - fileDownPre: '/opt/eresource_test/attachFiles/' + fileDownPre: '/opt/eresource/attachFiles/' htqxid: 2c9a59b68b9fd54b018d0c4679bd7ec9 kpssProcessNode6IdInfo: perStepid: "2c9adae478fdbe15017906f93ec90265" @@ -36,3 +40,5 @@ kpssProcessNode6IdInfo: nextStepOperid: "2c9adae4797fd663017982c00bf301e3" friststepid: "2c9adae478fdbe15017906f93ec90262" processControlid: "2c9adae478e9195d0178f3300fcc0432" + contraProcessnode05: "2c9a59b680e0190f01817ffba9530e1c" + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fc02212..8e2b926 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,11 +1,11 @@ server: - port: 9001 + port: 9002 spring: application: name: yunpingtai profiles: - active: dev + active: prod # 是否允许定义重名的bean对象覆盖原有的bean (spring boot默认是false) # main: # allow-bean-definition-overriding: true diff --git a/src/main/resources/mapper/OtherMapper.xml b/src/main/resources/mapper/OtherMapper.xml index 5f62922..ba4c4c7 100644 --- a/src/main/resources/mapper/OtherMapper.xml +++ b/src/main/resources/mapper/OtherMapper.xml @@ -5,7 +5,7 @@ update sc_xmkp1 set yptbh = #{yptbh} where id = #{id} update sc_htlc set yptbh = #{yptbh} where id = #{id} @@ -19,13 +19,13 @@ else htje end as htje from sc_xmkp1 where id = #{id}; update sc_kpsqsp set yptbh = #{yptbh} where id = #{id} SELECT * FROM requestoperator WHERE requestid=(select DISTINCT requestid from sc_kpsqsp where id =#{reqid}) and stepid =#{setpid} and isSubmit =1 + + select * from sc_xmkp1 where xmbh = #{project_no} and sslx=#{sslx} + \ No newline at end of file diff --git a/src/main/resources/mapper/SendHtMapper.xml b/src/main/resources/mapper/SendHtMapper.xml index d34f17d..aad41b2 100644 --- a/src/main/resources/mapper/SendHtMapper.xml +++ b/src/main/resources/mapper/SendHtMapper.xml @@ -17,31 +17,50 @@ + + + diff --git a/src/main/resources/mapper/SendKpxxMapper.xml b/src/main/resources/mapper/SendKpxxMapper.xml index 0ccfe45..b46286e 100644 --- a/src/main/resources/mapper/SendKpxxMapper.xml +++ b/src/main/resources/mapper/SendKpxxMapper.xml @@ -37,46 +37,93 @@ + diff --git a/src/test/java/com/example/guoyan/GuoYanApplicationTests.java b/src/test/java/com/example/guoyan/GuoYanApplicationTests.java deleted file mode 100644 index f552944..0000000 --- a/src/test/java/com/example/guoyan/GuoYanApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.guoyan; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class GuoYanApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/src/test/java/com/example/guoyan/TestController.java b/src/test/java/com/example/guoyan/TestController.java deleted file mode 100644 index 4b8c18b..0000000 --- a/src/test/java/com/example/guoyan/TestController.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.example.guoyan; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.example.guoyan.common.Result; -import com.example.guoyan.entity.ContractInfo; -import com.example.guoyan.entity.Readlog; -import com.example.guoyan.mapper.ReadlogMapper; -import com.example.guoyan.response.ResponseBeanForBeiJing; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.client.RestTemplate; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; - -@RestController -@RequestMapping("/test") -@Slf4j -public class TestController { - @Resource - private RestTemplate restTemplate; - @Autowired - private ReadlogMapper readlogMapper; - - @GetMapping() - public Result upLoadFile(){ - String url = "http://123.57.82.48:13310/api/auth/login"; - - - //提交参数设置 - HashMap map = new HashMap<>(); - map.put("username", "0519999"); - map.put("password", "123456"); - - //发起请求 - ResponseBeanForBeiJing responseBean = restTemplate.postForObject(url,map, ResponseBeanForBeiJing.class); - System.out.println(responseBean.toString()); - String data = responseBean.getData().toString(); - - HttpHeaders headers = new HttpHeaders(); - //headers.setBearerAuth(data); - headers.set("Authorization",data); - // headers.setContentType(MediaType.APPLICATION_JSON); - ContractInfo contractInfo = new ContractInfo(); - contractInfo.setContractCode("83086775"); - contractInfo.setContractName("测试合同"); - contractInfo.setConfirmDate("2023-01-02"); - contractInfo.setProjectNo("83086775"); - contractInfo.setHighTech(1); - contractInfo.setSignIn(1); - contractInfo.setSignOut(1); - contractInfo.setWinningBidWay("公开招标"); - // 组装请求体 - HttpEntity request = new HttpEntity<>(contractInfo, headers); - try{ - Object object = restTemplate.exchange("http://123.57.82.48:13310/api/nb/contract", HttpMethod.POST, request, Object.class); - System.out.println(object.toString()); - }catch (Exception E){ - log.info(E.getMessage()); - } - log.info("测试成功"); - return Result.success("成功"); - } - - @GetMapping("/t") - public Result test(){ - LambdaQueryWrapper readlogLambdaQueryWrapper = new LambdaQueryWrapper(); - readlogLambdaQueryWrapper.eq(Readlog::getId,"0008e8b65fd7e3c55354664279ed7b9b"); - List readlogs = readlogMapper.selectList(readlogLambdaQueryWrapper); - log.info(readlogs.toString()); - log.info("测试成功"); - return Result.success("成功"); - } -}