代码说明
This commit is contained in:
5
pom.xml
5
pom.xml
@ -54,6 +54,11 @@
|
|||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.45</version>
|
<version>1.2.45</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.example.sso.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.example.sso.util.V5utils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class ZhiAnTePiLiuCheng {
|
||||||
|
//治安特批申请
|
||||||
|
@PostMapping("/zhiantepi")
|
||||||
|
public String tuisong(@RequestBody JSONObject datass) {
|
||||||
|
|
||||||
|
log.info("数据 " + datass.toJSONString());
|
||||||
|
|
||||||
|
JSONObject jsonObject = datass.getJSONObject("data");
|
||||||
|
|
||||||
|
log.info("治安特批申请" + jsonObject.toJSONString());
|
||||||
|
String zxscjg = jsonObject.getString("zxscjg");
|
||||||
|
|
||||||
|
String id = jsonObject.getString("_id");
|
||||||
|
if (zxscjg.equals("通过") || zxscjg.equals("慎用")) {
|
||||||
|
log.info("我要推送啦 " + id);
|
||||||
|
JSONObject jsonObject4 = new JSONObject();
|
||||||
|
jsonObject4.put("instance_id", id);
|
||||||
|
jsonObject4.put("tasks_type", 1);
|
||||||
|
String jsonString1 = jsonObject4.toJSONString();
|
||||||
|
|
||||||
|
log.info("擦金好像 " + jsonString1);
|
||||||
|
String selectliucheng = V5utils.selectliucheng(jsonString1);
|
||||||
|
JSONObject jsonObject5 = JSON.parseObject(selectliucheng);
|
||||||
|
JSONArray jsonArray1 = jsonObject5.getJSONArray("tasks");
|
||||||
|
log.info("数组 " + jsonArray1);
|
||||||
|
|
||||||
|
for (Object o1 : jsonArray1) {
|
||||||
|
JSONObject jsonObject6 = (JSONObject) o1;
|
||||||
|
String title = jsonObject6.getString("title");
|
||||||
|
|
||||||
|
String task_id = jsonObject6.getString("task_id");
|
||||||
|
Integer status = jsonObject6.getInteger("status");
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject object = jsonObject6.getJSONObject("assignee");
|
||||||
|
log.info("我是username " + object);
|
||||||
|
String username = object.getString("username");
|
||||||
|
|
||||||
|
JSONObject jsonObject7 = new JSONObject();
|
||||||
|
jsonObject7.put("username", username);
|
||||||
|
jsonObject7.put("instance_id", id);
|
||||||
|
jsonObject7.put("task_id", task_id);
|
||||||
|
|
||||||
|
String jsonString2 = jsonObject7.toJSONString();
|
||||||
|
|
||||||
|
|
||||||
|
if(title.equals("分司确认")) {
|
||||||
|
log.info("提交 " + jsonString2);
|
||||||
|
String comment = V5utils.comment(jsonString2);
|
||||||
|
log.info(" 结果 " + comment);
|
||||||
|
}
|
||||||
|
// break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
39
src/main/resources/logback-spring.xml
Normal file
39
src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<property name="LOG_PATH" value="./logs" />
|
||||||
|
<property name="LOG_FILE" value="app" />
|
||||||
|
<property name="MAX_HISTORY" value="30" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 按天滚动的文件输出 -->
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<!-- 当前日志文件 -->
|
||||||
|
<file>${LOG_PATH}/${LOG_FILE}.log</file>
|
||||||
|
|
||||||
|
<!-- 滚动策略 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 每天0点生成新文件 -->
|
||||||
|
<fileNamePattern>${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 保留30天 -->
|
||||||
|
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
|
||||||
|
<!-- 关键:立即刷新,确保启动时有日志就立即创建文件 -->
|
||||||
|
<immediateFlush>true</immediateFlush>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
<appender-ref ref="FILE" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user