Commit 0f90d6fb authored by wangjinjing's avatar wangjinjing

bug修复

parent 6b3bc97b
...@@ -36,7 +36,7 @@ public class XxShxxyController { ...@@ -36,7 +36,7 @@ public class XxShxxyController {
} }
@ApiOperation(value = "删除社会信息员数据") @ApiOperation(value = "删除社会信息员数据")
@GetMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestParam(name = "xxyid") String xxyid) { public Integer delete(@RequestParam(name = "xxyid") String xxyid) {
return service.delete(xxyid); return service.delete(xxyid);
} }
......
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.XxShxxyDwDTO; import com.zksy.szpt.domain.dto.XxShxxyDwDTO;
import com.zksy.szpt.domain.dto.XxYjrwDTO;
import com.zksy.szpt.service.XxShxxyDwService; import com.zksy.szpt.service.XxShxxyDwService;
import com.zksy.szpt.service.XxYjrwService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@Api(tags = "社会信息员队伍服务") @Api(tags = "社会信息员队伍服务")
@RequestMapping("/rest/xxShxxydw") @RequestMapping("/rest/xxShxxyDw")
@RestController @RestController
@Validated @Validated
public class XxShxxyDwController { public class XxShxxyDwController {
...@@ -34,7 +32,7 @@ public class XxShxxyDwController { ...@@ -34,7 +32,7 @@ public class XxShxxyDwController {
} }
@ApiOperation(value = "删除社会信息员队伍数据") @ApiOperation(value = "删除社会信息员队伍数据")
@GetMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestParam(name = "id") String id) { public Integer delete(@RequestParam(name = "id") String id) {
return service.delete(id); return service.delete(id);
} }
......
...@@ -8,7 +8,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -8,7 +8,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@Api(tags = "义警队伍代码服务") @Api(tags = "义警队伍代码服务")
@RequestMapping("/rest/xxYjrdwdm") @RequestMapping("/rest/xxYjdwdm")
@RestController @RestController
@Validated @Validated
public class XxYjdwdmController { public class XxYjdwdmController {
...@@ -31,7 +31,7 @@ public class XxYjdwdmController { ...@@ -31,7 +31,7 @@ public class XxYjdwdmController {
} }
@ApiOperation(value = "删除义警队伍数据") @ApiOperation(value = "删除义警队伍数据")
@GetMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestParam(name = "id") String id) { public Integer delete(@RequestParam(name = "id") String id) {
return service.delete(id); return service.delete(id);
} }
......
...@@ -31,7 +31,7 @@ public class XxYjrwController { ...@@ -31,7 +31,7 @@ public class XxYjrwController {
} }
@ApiOperation(value = "删除义警任务信息数据") @ApiOperation(value = "删除义警任务信息数据")
@GetMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestParam(name = "rwid") String rwid) { public Integer delete(@RequestParam(name = "rwid") String rwid) {
return service.delete(rwid); return service.delete(rwid);
} }
......
...@@ -32,7 +32,7 @@ public class XxZhjfbgController { ...@@ -32,7 +32,7 @@ public class XxZhjfbgController {
@ApiOperation(value = "删除账户积分变更数据") @ApiOperation(value = "删除账户积分变更数据")
@GetMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestParam(name = "dhid") String dhid) { public Integer delete(@RequestParam(name = "dhid") String dhid) {
return service.delete(dhid); return service.delete(dhid);
} }
......
...@@ -32,7 +32,7 @@ public class XxZhxxController { ...@@ -32,7 +32,7 @@ public class XxZhxxController {
@ApiOperation(value = "删除账号信息数据") @ApiOperation(value = "删除账号信息数据")
@GetMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestParam(name = "zhid") String zhid) { public Integer delete(@RequestParam(name = "zhid") String zhid) {
return service.delete(zhid); return service.delete(zhid);
} }
......
...@@ -14,6 +14,7 @@ import org.junit.jupiter.api.Assertions; ...@@ -14,6 +14,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
...@@ -252,7 +253,7 @@ public class MainTest { ...@@ -252,7 +253,7 @@ public class MainTest {
.baseUrl("http://localhost:8086") .baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json") .defaultHeader("Content-Type", "application/json")
.build(); .build();
String response = webClient.post().uri("/rest/index/addXxYjrw") String response = webClient.post().uri("/rest/xxYjrw/update")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -280,8 +281,8 @@ public class MainTest { ...@@ -280,8 +281,8 @@ public class MainTest {
dto.setDwlx(Integer.valueOf(1)); dto.setDwlx(Integer.valueOf(1));
dto.setId("1"); dto.setId("1");
dto.setMchid("11111"); dto.setMchid("11111");
// dto.setZt("1"); dto.setZt("1");
// dto.setYjdwmc("test"); dto.setYjdwmc("test");
String json = null; String json = null;
try { try {
json = objectMapper.writeValueAsString(dto); json = objectMapper.writeValueAsString(dto);
...@@ -298,7 +299,7 @@ public class MainTest { ...@@ -298,7 +299,7 @@ public class MainTest {
.baseUrl("http://localhost:8086") .baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json") .defaultHeader("Content-Type", "application/json")
.build(); .build();
String response = webClient.post().uri("/rest/index/addXxYjdwdm") String response = webClient.post().uri("/rest/xxYjdwdm/update")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -338,7 +339,7 @@ public class MainTest { ...@@ -338,7 +339,7 @@ public class MainTest {
.baseUrl("http://localhost:8086") .baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json") .defaultHeader("Content-Type", "application/json")
.build(); .build();
String response = webClient.post().uri("/rest/index/addXxShxxyDw") String response = webClient.post().uri("/rest/xxShxxyDw/update")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -379,7 +380,7 @@ public class MainTest { ...@@ -379,7 +380,7 @@ public class MainTest {
.baseUrl("http://localhost:8086") .baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json") .defaultHeader("Content-Type", "application/json")
.build(); .build();
String response = webClient.post().uri("/rest/index/addXxShxxy") String response = webClient.post().uri("/rest/xxShxxy/update")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -390,4 +391,46 @@ public class MainTest { ...@@ -390,4 +391,46 @@ public class MainTest {
.block(); .block();
System.out.println(response); System.out.println(response);
} }
@Test
@DisplayName("任务完成情况")
public void testdelete() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce=String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
String json = "";
//请求体加密
json = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String url="xxShxxyDw/delete?id=1";
// String url="xxShxxy/delete?xxyid=1";
// String url="xxYjdwdm/delete?xxyid=1";
// String url="xxYjrw/delete?rwid=1";
//
// String url="xxZhjfbg/delete?dhid=1";
//
// String url="xxZhxx/delete?zhid=1";
String response = webClient.post().uri("/rest/"+url)
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(BodyInserters.empty())
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment