Browse Source

修复缺陷

master
zhouhaibin 5 months ago
parent
commit
bc9fe478ef
  1. 105
      pom.xml
  2. 20
      src/main/java/com/example/guoyan/config/RedisConfig.java
  3. 67
      src/main/java/com/example/guoyan/config/RestTemplateConfig.java
  4. 78
      src/main/java/com/example/guoyan/config/WebMvcConfig.java
  5. 32
      src/main/java/com/example/guoyan/controller/YunpingtaiController.java
  6. 9
      src/main/java/com/example/guoyan/entity/ContractInfo.java
  7. 2
      src/main/java/com/example/guoyan/entity/KpssProcessNode6IdInfo.java
  8. 164
      src/main/java/com/example/guoyan/entity/ScXmkp1.java
  9. 3
      src/main/java/com/example/guoyan/entity/SendHt.java
  10. 4
      src/main/java/com/example/guoyan/entity/SendKpxx.java
  11. 9
      src/main/java/com/example/guoyan/mapper/OtherMapper.java
  12. 10
      src/main/java/com/example/guoyan/mapper/ScXmkp1Mapper.java
  13. 2
      src/main/java/com/example/guoyan/mapper/SendXmMapper.java
  14. 433
      src/main/java/com/example/guoyan/scheduled/ProcessScheduled.java
  15. 1
      src/main/resources/application-dev.yml
  16. 12
      src/main/resources/application-prod.yml
  17. 4
      src/main/resources/application.yml
  18. 12
      src/main/resources/mapper/OtherMapper.xml
  19. 31
      src/main/resources/mapper/SendHtMapper.xml
  20. 55
      src/main/resources/mapper/SendKpxxMapper.xml
  21. 60
      src/main/resources/mapper/SendXmMapper.xml
  22. 13
      src/test/java/com/example/guoyan/GuoYanApplicationTests.java
  23. 81
      src/test/java/com/example/guoyan/TestController.java

105
pom.xml

@ -14,47 +14,12 @@
<name>GuoYan</name>
<description>GuoYan</description>
<properties>
<java.version>17</java.version>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<!--mybatis-plus依赖-->
<dependency>
@ -62,49 +27,27 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
</dependency>
<!--简略get、set方法-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<!-- <version>1.18.26</version>-->
</dependency>
<!-- 德鲁伊 连接池 https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- druid -->
<!-- &lt;!&ndash;Druid&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.alibaba</groupId>-->
<!-- <artifactId>druid</artifactId>-->
<!-- <version>1.2.2</version>-->
<!-- </dependency>-->
<!-- Druid Spring Boot 组件-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.8</version>
<version>1.2.8</version>
</dependency>
<!--knife4j接口管理-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@ -114,10 +57,32 @@
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version> <!-- 或者是你希望使用的版本 -->
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version> <!-- 请检查最新版本 -->
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes> </resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>

20
src/main/java/com/example/guoyan/config/RedisConfig.java

@ -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<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
//默认的Key序列化器为:JdkSerializationRedisSerializer
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setConnectionFactory(connectionFactory);
return redisTemplate;
}
}

67
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);
// }
// }
}
}

78
src/main/java/com/example/guoyan/config/WebMvcConfig.java

@ -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<HttpMessageConverter<?>> 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();
}
}

32
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<String> 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<String, String> 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<Object> request = new HttpEntity<>(null, headers);
ResponseEntity<ResponseBeanForBeiJing> exchange = restTemplate.exchange(deleteUrl+"/"+yptid, HttpMethod.DELETE, request, ResponseBeanForBeiJing.class);
log.info(exchange.getBody().getMessage().toString());
}
@GetMapping("/sendxm")
public Result<String> 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);
}
}

9
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;
}

2
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;
}

164
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;
}

3
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;
}

4
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;
}

9
src/main/java/com/example/guoyan/mapper/OtherMapper.java

@ -38,5 +38,12 @@ public interface OtherMapper extends BaseMapper<Object> {
void updateSchtqx_Byid(@Param("id") String id);
void updateRequeststatusBack(HashMap<String,String> map);
void delPermissionuserBack(HashMap<String,String> map);
List<HashMap<String,String>> selectHtProcess(@Param("reqid") String id,@Param("setpid") String setpid);
List<HashMap<String,String>> selctscxmkp1by (@Param("project_no") String id,@Param("sslx") String setpid);
// List<HashMap<String,String>> selectstaffbyid(@Param("number") String id);
// List<HashMap<String,String>> selectsc_hh1byname(@Param("qymc") String id);
// List<HashMap<String,String>> selectsc_lxr1byid (@Param("lxr") String id,@Param("qymc") String setpid);
// List<HashMap<String,String>> selectsc_htlcbyid(@Param("xmbh") String xmbh);
// List<HashMap<String,String>> selectcatalogdatabyid(@Param("htid") String htid);
// int updatebyid(@Param("yptbh") String yptbh,@Param("xmbh") String xmbh);
}

10
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<ScXmkp1> {
}

2
src/main/java/com/example/guoyan/mapper/SendXmMapper.java

@ -15,5 +15,5 @@ public interface SendXmMapper extends BaseMapper<SendXm> {
*/
List<SendXm> querySendXmByNoDel();
List<SendXm> querySendXmByProjectId(@Param("projectId") String id);
List<SendXm> getscxmkp1ByProjectId(@Param("projectId") String id);
}

433
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<SendXm> sendXmList = sendXmMapper.querySendXmByNoDel();
sendXmToYunPingtai(sendXmList, headers);
List<SendHt> sendHtList = sendHtMapper.querySendHtByNoDel();
sendHtToYunPingtai(sendHtList,headers);
//处理开票信息
//
List<SendKpxx> 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<SendKpxx> 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<SendXm> sendXmList, HttpHeaders headers) {
//把查到的数据按次序更新或新增到北京
sendXmList.forEach(iteam -> {
iteam.setProjectDescription(null);//项目描述非必填项
List<String> 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<String, String> 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<SendXm> 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<SendXm> 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<SendHt> sendHtList, HttpHeaders headers) {
sendHtList.forEach(item -> {
String winningBidWay = item.getWinningBidWay();
if("邀请招标".equals(winningBidWay)){
item.setWinningBidWay("内部邀请");
}
//用项目id 查询项目金额
HashMap<String,String> hashMap = new HashMap<>();
String requestid = item.getRequestid();
if(item.getZxm()!=null){
LambdaUpdateWrapper<SendHt> sendHtLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sendHtLambdaUpdateWrapper.eq(SendHt::getId, item.getId());//更新条件
sendHtLambdaUpdateWrapper.set(SendHt::getErrormessage,"是子合同不做处理");//更新的值
sendHtMapper.update(null, sendHtLambdaUpdateWrapper);
return;
}
String contraProcessnode05 = kpssProcessNode6IdInfo.getContraProcessnode05();
List<HashMap<String, String>> 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<String, String> getdata = otherMapper.selectScHTLC_yptbh_ByPjid(item.getContractId());
String yptbh = getdata.get("yptbh").toString();//云平台编号
if(getdata ==null){
//记录失败原因
LambdaUpdateWrapper<SendHt> 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<SendHt> 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<SendKpxx> 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<SendKpxx> sendKpxxes1 = sendKpxxMapper.selectList(sendKpxxLambdaQueryWrapper1);
if(sendKpxxes1.size()>0&&sendKpxx.getIsReturn()==0){
log.info("新增开票信息失败,已开票,projectId是" + sendKpxx.getProjectNo() + " id是" + sendKpxx.getId());
//记录错误信息
LambdaUpdateWrapper<SendKpxx> 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){
if(sendKpxx.getOperatetype()==0||sendKpxx.getOperatetype()==1){
if(sendKpxx.getIsReturn()==0){
sendKpxx.setInvoiceNo(null);
}
HashMap<String, String> 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<SendXm> sendXms = sendXmMapper.getscxmkp1ByProjectId(projectid);
if(sendXms.size()>0){
SendXm iteam = sendXms.get(0);
iteam.setProjectDescription(null);//项目描述非必填项
List<String> list = Arrays.asList(industry);
String projectIndustry = iteam.getProjectIndustry();
if(!list.contains(projectIndustry)){
iteam.setProjectIndustry("科研技术");
}
HashMap<String, String> 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<SendXm> 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<SendKpxx> 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<SendKpxx> request = new HttpEntity<>(sendKpxx, headers);
ResponseBeanForBeiJing responseData = restTemplate.postForObject(invoiceUrl,request, ResponseBeanForBeiJing.class);
if ("200".equals(responseData.getCode())) {
LambdaUpdateWrapper<SendKpxx> 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<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, responseData.getMessage().toString());//更新的值
sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
}
return;
}
HttpEntity<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<String, String> paramMap = new HashMap<>();
// paramMap.put("yptbh", invoiceNo);
// paramMap.put("id", sendKpxx.getRequestid());
// otherMapper.updateScKpsqsp_yptbh_Byid(paramMap);//把返回的项目编号存入Sc_kssqsp
LambdaUpdateWrapper<SendKpxx> 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<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
sendKpxxLambdaUpdateWrapper.set(SendKpxx::getStatus, responseData.getMessage().toString());//更新的值
sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
}
}
// LambdaUpdateWrapper<SendKpxx> 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<SendKpxx> 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<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "发票发票编号不能为空");//更新的值
sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
return;
}
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
//HttpEntity<HashMap<String,String>> StringrequestEntity = ;
HttpEntity<Object> request = new HttpEntity<>(null, headers);
ResponseEntity<ResponseBeanForBeiJing> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<String, String> stringStringHashMap = otherMapper.selectScKpsqsp_yptbh_Byreqid(sendKpxx.getWfrequest());
if(stringStringHashMap==null){
LambdaUpdateWrapper<SendKpxx> 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<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值
// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
// return;
// }
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
HttpEntity<Object> request = new HttpEntity<>(null, headers);
ResponseEntity<ResponseBeanForBeiJing> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> request1 = new HttpEntity<>(sendKpxx, headers);
ResponseBeanForBeiJing responseData = restTemplate.postForObject(incomeUrl,request1, ResponseBeanForBeiJing.class);
//删除成功后在新增
if ("200".equals(responseData.getCode())){
LambdaUpdateWrapper<SendKpxx> 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<SendKpxx> 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<String, String> stringStringHashMap = otherMapper.selectScKpsqsp_yptbh_ByPjid(sendKpxx.getRequestid());
if(sendKpxx.getOpUserCode()==null){
sendKpxx.setOpUserCode(sendKpxx.getApplyUserCode());
if(stringStringHashMap==null){
return;
}
String invoiceNo = stringStringHashMap.get("yptbh");
if(StringUtils.isBlank(invoiceNo)){
if(stringStringHashMap.get("yptbh")==null){
LambdaUpdateWrapper<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值
sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
return;
}
// MultiValueMap<String, String> par ams = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
String invoiceNo = stringStringHashMap.get("yptbh");
// if(StringUtils.isBlank(invoiceNo)){
// LambdaUpdateWrapper<SendKpxx> sendKpxxLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// sendKpxxLambdaUpdateWrapper.eq(SendKpxx::getId, sendKpxx.getId());//更新条件
// sendKpxxLambdaUpdateWrapper.set(SendKpxx::getErrormessage, "invoiceNo发票发票编号不能为空");//更新的值
// sendKpxxMapper.update(null, sendKpxxLambdaUpdateWrapper);
// return;
// }
HttpEntity<Object> request = new HttpEntity<>(null, headers);
ResponseEntity<ResponseBeanForBeiJing> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> 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<SendKpxx> sendKpxxToYPTList = sendKpxxMapper.querySendToYPT();
sendKpxxToYPTList.forEach(item->{
String invoiceNo = item.getInvoiceNo();
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// params.add("invoiceNo",invoiceNo);
// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
HttpEntity<Object> request = new HttpEntity<>(null, headers);
ResponseEntity<ResponseBeanForBeiJing> 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<SendKpxx> 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<String, String> 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<String, Object> body = new LinkedMultiValueMap<>();
body.add("file", new FileSystemResource(new File(filePath)));
body.add("file", new FileSystemResource(new File(newfilepath)));
HttpEntity<MultiValueMap<String, Object>> 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<ScKpsqsp> scKpsqspLambdaQueryWrapper = new LambdaQueryWrapper<>();
scKpsqspLambdaQueryWrapper.eq(ScKpsqsp::getId, requestid);
List<ScKpsqsp> 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<ScKpsqsp> 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<SendKpxx> 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());
}
}
}

1
src/main/resources/application-dev.yml

@ -39,5 +39,6 @@ kpssProcessNode6IdInfo:
nextStepOperid: "2c9adae4797fd663017982c00bf301e3"
friststepid: "2c9adae478fdbe15017906f93ec90262"
processControlid: "2c9adae478e9195d0178f3300fcc0432"
contraProcessnode05: "2c9a59b680e0190f01817ffba9530e1c"

12
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"

4
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

12
src/main/resources/mapper/OtherMapper.xml

@ -5,7 +5,7 @@
update sc_xmkp1 set yptbh = #{yptbh} where id = #{id}
</update>
<select id="selectScXMkp1_yptbh_ByPjid" resultType="Map">
select yptbh from sc_xmkp1 where id = #{projectID}
select yptbh,id from sc_xmkp1 where id = #{projectID}
</select>
<update id="updateScHTLC_yptbh_ByPjid" parameterType="Map">
update sc_htlc set yptbh = #{yptbh} where id = #{id}
@ -19,13 +19,13 @@
else htje end as htje from sc_xmkp1 where id = #{id};
</select>
<select id="selectFileById" resultType="Map">
select filename,filepath,filetype from attach where id = #{id}
select filename,filepath,filetype,originalName from attach where id = #{id}
</select>
<update id="updateScKpsqsp_yptbh_Byid" parameterType="Map">
update sc_kpsqsp set yptbh = #{yptbh} where id = #{id}
</update>
<select id="selectScKpsqsp_yptbh_ByPjid" resultType="Map">
select yptbh from sc_kpsqsp where id = #{id}
select a.yptbh,(select s.fplx from sc_fplx s where s.id = a.fplx) fplx,a.khx,a.dz,a.dh,a.zh,a.fpzl from sc_kpsqsp a where a.id = #{id}
</select>
<select id="selectScKpsqsp_yptbh_Byreqid" resultType="Map">
select yptbh from sc_kpsqsp where requestid = #{requestid}
@ -45,6 +45,9 @@
<select id="selectProcessNo5IsSubmit" resultType="Map">
SELECT * FROM requestoperator WHERE requestid=(select DISTINCT requestid from sc_kpsqsp where id =#{reqid}) and stepid =#{setpid} and isSubmit =1
</select>
<select id="selectHtProcess" resultType="Map">
SELECT * FROM requestoperator WHERE requestid=#{reqid} and stepid =#{setpid}
</select>
<select id="selectSchtqxByflag" resultType="Map">
select
a.id,
@ -65,4 +68,7 @@
<delete id="delPermissionuserBack" parameterType="Map">
DELETE from permissionruleuser where resid = #{resid} and typeid != #{staffid}
</delete>
<select id="selctscxmkp1by" resultType="Map">
select * from sc_xmkp1 where xmbh = #{project_no} and sslx=#{sslx}
</select>
</mapper>

31
src/main/resources/mapper/SendHtMapper.xml

@ -17,6 +17,9 @@
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="operatetype" column="operatetype" jdbcType="VARCHAR"/>
<result property="contractId" column="contract_id" jdbcType="VARCHAR"/>
<result property="requestid" column="requestid" jdbcType="VARCHAR"/>
<result property="zxm" column="zxm" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
@ -28,10 +31,21 @@
(select yptbh from sc_xmkp1 where id =project_no ) project_no,
project_no as project_id,
high_tech,
(select
case when name = '询比采购' then '公开招标'
(CASE
WHEN winning_bid_way IS NULL OR COALESCE(winning_bid_way, '') = '' THEN
(SELECT name
FROM selectitem e
WHERE e.id = (SELECT zbfs
FROM sc_htlc
WHERE id = contract_id) )
ELSE
(select case
when name = '询比采购' then '公开招标'
when name = '分散市场签署' then '公开招标'
else name end as name from selectitem e WHERE e.id =winning_bid_way) winning_bid_way,
else name end as name
from selectitem e
WHERE e.id = winning_bid_way)
END) as winning_bid_way,
contract_amount,
sign_out,
sign_in,
@ -39,9 +53,14 @@
addtime,
status,
operatetype,
contract_id
from send_ht
where status is null AND ssgs = 'ZJ' and errormessage is null
contract_id,
requestid,
(select zxm from sc_xmkp1 where id =project_no) as zxm
from send_ht a
where status is null
AND (SELECT SSGS FROM sc_htlc WHERE ID=contract_id) = 'ZJ'
and errormessage is null
and contract_type = '2c9a59b680e0190f01813bc01fad0519'
order by addtime
</select>

55
src/main/resources/mapper/SendKpxxMapper.xml

@ -37,6 +37,53 @@
</resultMap>
<!--查询单个-->
<select id="querySendKpxxByNoDel" resultMap="SendKpxxMap">
WITH RankedKpxx AS (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY requestid ORDER BY createtime DESC) AS RowNum
FROM send_kpxx
WHERE status is null and errormessage is null
ORDER BY createtime
)
SELECT id,
requestid,
(select yptbh from sc_kpsqsp where id = A.requestid) invoice_no,
invoice_date,
project_no,
(select zftk from sc_zfmx where id =receipt_schedule_name ) receipt_schedule_name,
(select kpdwmc from sc_fp1 where id =payer_name ) payer_name,
payer_number,
case when invoice_amount >0 then invoice_amount
else ABS(invoice_amount) end as invoice_amount,
(SELECT kpnr FROM sc_kpnr e WHERE e.id =invoice_content) invoice_content,
"非现金" as payment_mode,
(SELECT name FROM selectitem e WHERE e.id =(SELECT fplx FROM sc_fplx e WHERE e.id =invoice_type)) invoice_type,
remark_info,
special_info,
evidence_id,
(SELECT number0 from staff b WHERE b.id = apply_user_code) as apply_user_code,
confirm_date,
(SELECT number0 from staff b WHERE b.id = confirm_user_code) confirm_user_code,
income_date,
income_amount,
account_date,
account_amount,
case when income_user_code is null THEN (SELECT number0 from staff b WHERE b.id = account_user_code)
else (SELECT number0 from staff b WHERE b.id = income_user_code) end as opUserCode,
createtime,
status,
interface_type,
operatetype,
wfrequest,
qy,
case when invoice_amount >0 then 0
else 1 end as isReturn,
CASE WHEN invoice_amount > 0 THEN ""
ELSE (select yptbh from sc_kpsqsp CC where CC.id = A.ykpid)
END AS returnInvoiceNo
FROM RankedKpxx A
WHERE RowNum = 1 and interface_type = 0
union all
select
id,
requestid,
@ -54,7 +101,7 @@
remark_info,
special_info,
evidence_id,
(SELECT number0 from staff b WHERE b.id = apply_user_code) apply_user_code,
(SELECT number0 from staff b WHERE b.id = apply_user_code) as apply_user_code,
confirm_date,
(SELECT number0 from staff b WHERE b.id = confirm_user_code) confirm_user_code,
income_date,
@ -72,10 +119,10 @@
case when invoice_amount >0 then 0
else 1 end as isReturn,
CASE WHEN invoice_amount > 0 THEN ""
ELSE (select yptbh from sc_kpsqsp CC where CC.xmmc =A.project_no and CC.kpje = ABS(A.invoice_amount))
ELSE (select yptbh from sc_kpsqsp CC where CC.id = A.ykpid)
END AS returnInvoiceNo
from send_kpxx A
where status is null and errormessage is null
where status is null and errormessage is null and interface_type != 0
order by createtime
</select>
<select id="querySendToYPT" resultMap="SendKpxxMap">
@ -89,7 +136,7 @@
operatetype,
wfrequest
from send_kpxx a
where status =1 and operatetype = 0 and interface_type = 0
where status =1 and operatetype = 0 and interface_type = 0 and errormessage is null
order by createtime
</select>
<select id="selectProcessId" resultType="String">

60
src/main/resources/mapper/SendXmMapper.xml

@ -62,14 +62,18 @@
project_end_date,
(SELECT name FROM selectitem e WHERE e.id =project_industry) project_industry,
(SELECT name FROM selectitem e WHERE e.id =project_case_type) project_case_type,
(SELECT name FROM selectitem e WHERE e.id =project_user_property) project_user_property,
case when project_user_property='2c9adae4786c46540178e8cd376f0068' then '企业'
when project_user_property='2c9adae4786c46540178e8cd56630069' then '企业'
when project_user_property='2c9adae4786c46540178e8cd7c27006a' then '企业'
when (SELECT name FROM selectitem e WHERE e.id =project_user_property) is null then '企业'
else (SELECT name FROM selectitem e WHERE e.id =project_user_property) end as project_user_property,
project_description,
remarks,
createtime,
status,
operatetype
from send_xm
where status is null and area_code ='ZJ' and errormessage is null
where status is null and (SELECT SSGS FROM SC_XMKP1 WHERE id=project_id) ='ZJ' and errormessage is null
order by createtime
</select>
<select id="querySendXmByProjectId" resultMap="SendXmMap">
@ -106,7 +110,11 @@
project_end_date,
(SELECT name FROM selectitem e WHERE e.id =project_industry) project_industry,
(SELECT name FROM selectitem e WHERE e.id =project_case_type) project_case_type,
(SELECT name FROM selectitem e WHERE e.id =project_user_property) project_user_property,
case when project_user_property='2c9adae4786c46540178e8cd376f0068' then '企业'
when project_user_property='2c9adae4786c46540178e8cd56630069' then '企业'
when project_user_property='2c9adae4786c46540178e8cd7c27006a' then '企业'
when (SELECT name FROM selectitem e WHERE e.id =project_user_property) is null then '企业'
else (SELECT name FROM selectitem e WHERE e.id =project_user_property) end as project_user_property,
project_description,
remarks,
createtime,
@ -116,6 +124,52 @@
where status = 1 and project_id = #{projectId}
order by createtime desc
</select>
<select id="getscxmkp1ByProjectId" resultMap="SendXmMap">
select
id project_id,
xmbh project_no,
xmmc project_name,
(select
CASE
WHEN name ='监理' THEN
'supervision'
WHEN name = '咨询' THEN
'advisory'
WHEN name ='监理加咨询' THEN
'supervision_advisory'
else 'supervision'
END AS name
from selectitem a where a.id=xmlx) project_type,
ssgs area_code,
CASE
WHEN SUBSTRING(xmmc, 1, 1) REGEXP '^[a-zA-Z]' THEN 2
ELSE 1
END AS project_secret,
(SELECT number0 from staff b WHERE b.id = xsfzr) sales_leader_code,
(SELECT number0 from staff c WHERE c.id = myzj) nominal_director_code,
"051999" as dept_code,
(SELECT number0 from staff d WHERE d.id = xmfzr) project_manager_code,
case when htje is null or htje =0.00 THEN fyys
else htje end as contract_amount,
jsgm project_construction_scale,
(select qymc from sc_hh1 f where f.id=wtdw ) project_company,
xmkssj project_start_date,
xmjzsj project_end_date,
(SELECT name FROM selectitem e WHERE e.id =ssxy) project_industry,
(SELECT name FROM selectitem e WHERE e.id =sslx) project_case_type,
case when khxz='2c9adae4786c46540178e8cd376f0068' then '企业'
when khxz='2c9adae4786c46540178e8cd56630069' then '企业'
when khxz='2c9adae4786c46540178e8cd7c27006a' then '企业'
when (SELECT name FROM selectitem e WHERE e.id =khxz) is null then '企业'
else (SELECT name FROM selectitem e WHERE e.id =khxz) end as project_user_property,
xmms project_description,
bz remarks,
now() createtime,
'0' status,
'1' operatetype
from sc_xmkp1
where id = #{projectId}
</select>
</mapper>

13
src/test/java/com/example/guoyan/GuoYanApplicationTests.java

@ -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() {
}
}

81
src/test/java/com/example/guoyan/TestController.java

@ -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<String> upLoadFile(){
String url = "http://123.57.82.48:13310/api/auth/login";
//提交参数设置
HashMap<String, String> 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<ContractInfo> 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<String> test(){
LambdaQueryWrapper<Readlog> readlogLambdaQueryWrapper = new LambdaQueryWrapper();
readlogLambdaQueryWrapper.eq(Readlog::getId,"0008e8b65fd7e3c55354664279ed7b9b");
List<Readlog> readlogs = readlogMapper.selectList(readlogLambdaQueryWrapper);
log.info(readlogs.toString());
log.info("测试成功");
return Result.success("成功");
}
}
Loading…
Cancel
Save