Commit fd276d2b by HlQ

[add] Controller 返回类型为 String 时,类型设置为 JSON

1 parent aa428362
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<wx-mp.version>4.6.2.B</wx-mp.version> <wx-mp.version>4.6.2.B</wx-mp.version>
<sa-token.verion>1.38.0</sa-token.verion> <sa-token.verion>1.38.0</sa-token.verion>
<myexcel.version>4.5.2</myexcel.version> <myexcel.version>4.5.2</myexcel.version>
<maxmind.version>4.2.0</maxmind.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -96,7 +97,7 @@ ...@@ -96,7 +97,7 @@
<dependency> <dependency>
<groupId>com.maxmind.geoip2</groupId> <groupId>com.maxmind.geoip2</groupId>
<artifactId>geoip2</artifactId> <artifactId>geoip2</artifactId>
<version>4.2.0</version> <version>${maxmind.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -44,8 +44,10 @@ public class ResBodyAdvice implements ResponseBodyAdvice<Object> { ...@@ -44,8 +44,10 @@ public class ResBodyAdvice implements ResponseBodyAdvice<Object> {
if (returnType.getParameterType().isAssignableFrom(String.class)) { if (returnType.getParameterType().isAssignableFrom(String.class)) {
// 字符串类型特殊处理 // 字符串类型特殊处理
try { try {
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
return new ObjectMapper().writeValueAsString(resultVO); return new ObjectMapper().writeValueAsString(resultVO);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
log.error("Json 序列化失败");
} }
} }
return resultVO; return resultVO;
......
...@@ -35,7 +35,6 @@ public class TaskRunner { ...@@ -35,7 +35,6 @@ public class TaskRunner {
void pushUndoneTask() { void pushUndoneTask() {
log.info("开始推送未完成工单"); log.info("开始推送未完成工单");
var taskList = taskService.list(Wrappers.<Task>lambdaQuery().notIn(Task::getStatus, 3, 5)); var taskList = taskService.list(Wrappers.<Task>lambdaQuery().notIn(Task::getStatus, 3, 5));
// todo 需要异步发送吗?
Opt.ofEmptyAble(taskList) Opt.ofEmptyAble(taskList)
.map(l -> l.stream().map(Task::getActiveUser).collect(Collectors.toSet())) .map(l -> l.stream().map(Task::getActiveUser).collect(Collectors.toSet()))
.ifPresent(userIds -> { .ifPresent(userIds -> {
......
...@@ -871,6 +871,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -871,6 +871,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
* */ * */
@Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 8 * * ?")
public void verifyNum() { public void verifyNum() {
log.info("合同比对开始");
var contractNoList = this.listObjs(Wrappers.<Contract>lambdaQuery().select(Contract::getContractNo), var contractNoList = this.listObjs(Wrappers.<Contract>lambdaQuery().select(Contract::getContractNo),
Object::toString); Object::toString);
...@@ -931,6 +932,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -931,6 +932,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
var sameList = CollUtil.intersectionDistinct(dataIdSet, contractNoList); var sameList = CollUtil.intersectionDistinct(dataIdSet, contractNoList);
// 只比对合同编号SC开头的合同 // 只比对合同编号SC开头的合同
contractDiff(sameList.stream().filter(no -> StrUtil.startWith(no, "SC")).collect(Collectors.toSet())); contractDiff(sameList.stream().filter(no -> StrUtil.startWith(no, "SC")).collect(Collectors.toSet()));
log.info("合同比对结束");
} }
/** /**
...@@ -988,7 +990,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -988,7 +990,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
Contract::getReceivableAmount, Contract::getOutstandingAmount, Contract::getSubject, Contract::getReceivableAmount, Contract::getOutstandingAmount, Contract::getSubject,
Contract::getRemark, Contract::getCreateUser, Contract::getModifyUser, Contract::getCreateTime, Contract::getRemark, Contract::getCreateUser, Contract::getModifyUser, Contract::getCreateTime,
Contract::getModifyTime, Contract::getFinalDate, Contract::getInvoiceAmount, Contract::getModifyTime, Contract::getFinalDate, Contract::getInvoiceAmount,
Contract::getFinancialStatus, Contract::getOriginalModTime) Contract::getFinancialStatus, Contract::getOriginalModTime, Contract::getBackInfo)
.ignoreNullValue(); .ignoreNullValue();
var platMap = BeanUtil.beanToMap(platContract, new HashMap<>(), copyOptions); var platMap = BeanUtil.beanToMap(platContract, new HashMap<>(), copyOptions);
...@@ -1008,6 +1010,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -1008,6 +1010,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.retrieve() .retrieve()
// fixme GOAWAY received
.body(JSONObject.class); .body(JSONObject.class);
if (jobO.getInt("code") != 1) { if (jobO.getInt("code") != 1) {
log.error("获取合同列表失败,错误原因:{}", jobO); log.error("获取合同列表失败,错误原因:{}", jobO);
...@@ -1118,6 +1121,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -1118,6 +1121,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
V value = entry.getValue(); V value = entry.getValue();
if (!map2.containsKey(key) || ObjUtil.notEquals(value, map2.get(key))) { if (!map2.containsKey(key) || ObjUtil.notEquals(value, map2.get(key))) {
log.info("不一致内容项:{}", key);
return false; return false;
} }
} }
......
server: server:
port: 8011 port: 8011
shutdown: graceful
spring: spring:
profiles: profiles:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!