Commit 14ea6406 authored by 以墨为白's avatar 以墨为白 🎧

Merge branch 'master' of http://192.168.168.218/wcyuee/szpt

parents 72f05dd5 03cb2164
...@@ -21,6 +21,7 @@ import org.springframework.web.servlet.NoHandlerFoundException; ...@@ -21,6 +21,7 @@ import org.springframework.web.servlet.NoHandlerFoundException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -133,6 +134,17 @@ public class GlobalExceptionHandler { ...@@ -133,6 +134,17 @@ public class GlobalExceptionHandler {
state.setMessage(e.getCause().getMessage()); state.setMessage(e.getCause().getMessage());
return new HttpResult<>(state); return new HttpResult<>(state);
} }
//违反唯一约束
@ResponseBody
@ExceptionHandler({SQLIntegrityConstraintViolationException.class})
public HttpResult<HttpResultState> DuplicateKeyExceptionHandler(SQLIntegrityConstraintViolationException e) {
logger.warn(e.getMessage());
HttpResultState state = HttpResultState.DUPLICATED_KEY;
state.setMessage(e.getCause().getMessage());
return new HttpResult<>(state);
}
//endregion //endregion
...@@ -143,4 +155,6 @@ public class GlobalExceptionHandler { ...@@ -143,4 +155,6 @@ public class GlobalExceptionHandler {
state.setMessage(e.getMessage()); state.setMessage(e.getMessage());
return new HttpResult<>(state); return new HttpResult<>(state);
} }
} }
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.*;
import com.zksy.szpt.domain.dto.XxShxxyDTO;
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.XxShxxyService; import com.zksy.szpt.service.XxShxxyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -36,9 +32,9 @@ public class XxShxxyController { ...@@ -36,9 +32,9 @@ public class XxShxxyController {
return service.update(dto); return service.update(dto);
} }
@ApiOperation(value = "删除社会信息员数据") @ApiOperation(value = "根据社会信息员ID删除社会信息员数据")
@PostMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestBody @Validated CommonDelDTO dto) { public Integer delete(@RequestBody @Validated CommonDelParamDTO dto) {
return service.delete(dto); return service.delete(dto);
} }
......
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxShxxyDwDTO; import com.zksy.szpt.domain.dto.XxShxxyDwDTO;
import com.zksy.szpt.service.XxShxxyDwService; import com.zksy.szpt.service.XxShxxyDwService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -32,9 +32,9 @@ public class XxShxxyDwController { ...@@ -32,9 +32,9 @@ public class XxShxxyDwController {
return service.update(dto); return service.update(dto);
} }
@ApiOperation(value = "删除社会信息员队伍数据") @ApiOperation(value = "根据信息员队伍ID删除社会信息员队伍数据")
@PostMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestBody @Validated CommonDelDTO dto) { public Integer delete(@RequestBody @Validated CommonDelParamDTO dto) {
return service.delete(dto); return service.delete(dto);
} }
......
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxYjdwdmDTO; import com.zksy.szpt.domain.dto.XxYjdwdmDTO;
import com.zksy.szpt.service.XxYjdwdmService; import com.zksy.szpt.service.XxYjdwdmService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -31,9 +31,9 @@ public class XxYjdwdmController { ...@@ -31,9 +31,9 @@ public class XxYjdwdmController {
return service.update(dto); return service.update(dto);
} }
@ApiOperation(value = "删除义警队伍数据") @ApiOperation(value = "根据义警队伍代码ID删除义警队伍数据")
@PostMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestBody @Validated CommonDelDTO dto) { public Integer delete(@RequestBody @Validated CommonDelParamDTO dto) {
return service.delete(dto); return service.delete(dto);
} }
......
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxYjrwDTO; import com.zksy.szpt.domain.dto.XxYjrwDTO;
import com.zksy.szpt.service.XxYjrwService; import com.zksy.szpt.service.XxYjrwService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -31,9 +31,9 @@ public class XxYjrwController { ...@@ -31,9 +31,9 @@ public class XxYjrwController {
return service.update(dto); return service.update(dto);
} }
@ApiOperation(value = "删除义警任务信息数据") @ApiOperation(value = "根据任务ID删除义警任务信息数据")
@PostMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestBody @Validated CommonDelDTO dto) { public Integer delete(@RequestBody @Validated CommonDelParamDTO dto) {
return service.delete(dto); return service.delete(dto);
} }
......
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxZhjfbgDTO; import com.zksy.szpt.domain.dto.XxZhjfbgDTO;
import com.zksy.szpt.service.XxZhjfbgService; import com.zksy.szpt.service.XxZhjfbgService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -32,9 +32,9 @@ public class XxZhjfbgController { ...@@ -32,9 +32,9 @@ public class XxZhjfbgController {
} }
@ApiOperation(value = "删除账户积分变更数据") @ApiOperation(value = "根据兑换ID删除账户积分变更数据")
@PostMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestBody @Validated CommonDelDTO dto) { public Integer delete(@RequestBody @Validated CommonDelParamDTO dto) {
return service.delete(dto); return service.delete(dto);
} }
......
...@@ -31,9 +31,9 @@ public class XxZhxxController { ...@@ -31,9 +31,9 @@ public class XxZhxxController {
} }
@ApiOperation(value = "删除账号信息数据") @ApiOperation(value = "根据账户ID删除账号信息数据")
@PostMapping("/delete") @PostMapping("/delete")
public Integer delete(@RequestBody @Validated CommonDelDTO dto) { public Integer delete(@RequestBody @Validated CommonDelParamDTO dto) {
return service.delete(dto); return service.delete(dto);
} }
......
package com.zksy.szpt.domain.dto;
import javax.validation.constraints.NotEmpty;
import java.util.List;
public class CommonDelParamDTO {
/**
* 账户ID
*/
@NotEmpty(message = "ID不能为空")
private List<String> ids;
public @NotEmpty(message = "ID不能为空") List<String> getIds() {
return ids;
}
public void setIds(@NotEmpty(message = "ID不能为空") List<String> ids) {
this.ids = ids;
}
}
\ No newline at end of file
...@@ -148,7 +148,7 @@ public class XxYjrw { ...@@ -148,7 +148,7 @@ public class XxYjrw {
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.UPDATE)
private Date gxsj; private Date gxsj;
/** /**
...@@ -379,4 +379,6 @@ public class XxYjrw { ...@@ -379,4 +379,6 @@ public class XxYjrw {
public void setPictureUrls(String pictureUrls) { public void setPictureUrls(String pictureUrls) {
this.pictureUrls = pictureUrls == null ? null : pictureUrls.trim(); this.pictureUrls = pictureUrls == null ? null : pictureUrls.trim();
} }
} }
\ No newline at end of file
...@@ -68,7 +68,7 @@ public class SzptMetaObjectHandler implements MetaObjectHandler { ...@@ -68,7 +68,7 @@ public class SzptMetaObjectHandler implements MetaObjectHandler {
StrictFill.of("update_ip", String.class, currentUserInfo.getIp()) StrictFill.of("update_ip", String.class, currentUserInfo.getIp())
// StrictFill.of("del_flag", Integer.class,0) // StrictFill.of("del_flag", Integer.class,0)
); );
this.strictInsertFill(findTableInfo(metaObject), metaObject, fields); this.strictUpdateFill(findTableInfo(metaObject), metaObject, fields);
// this.strictInsertFill(metaObject, "updateTime", Date.class, new Date()); // this.strictInsertFill(metaObject, "updateTime", Date.class, new Date());
} }
} }
...@@ -2,7 +2,7 @@ package com.zksy.szpt.service; ...@@ -2,7 +2,7 @@ package com.zksy.szpt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxShxxyDwDTO; import com.zksy.szpt.domain.dto.XxShxxyDwDTO;
import com.zksy.szpt.domain.po.XxShxxyDw; import com.zksy.szpt.domain.po.XxShxxyDw;
import com.zksy.szpt.mapper.XxShxxyDwMapper; import com.zksy.szpt.mapper.XxShxxyDwMapper;
...@@ -31,7 +31,7 @@ public class XxShxxyDwService { ...@@ -31,7 +31,7 @@ public class XxShxxyDwService {
} }
public Integer delete(CommonDelDTO dto) { public Integer delete(CommonDelParamDTO dto) {
LambdaQueryWrapper<XxShxxyDw> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxShxxyDw> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxShxxyDw::getId, dto.getIds()); wrapper.in(XxShxxyDw::getId, dto.getIds());
return xxShxxyDwMapper.delete(wrapper); return xxShxxyDwMapper.delete(wrapper);
......
...@@ -2,7 +2,7 @@ package com.zksy.szpt.service; ...@@ -2,7 +2,7 @@ package com.zksy.szpt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxShxxyDTO; import com.zksy.szpt.domain.dto.XxShxxyDTO;
import com.zksy.szpt.domain.po.XxShxxy; import com.zksy.szpt.domain.po.XxShxxy;
import com.zksy.szpt.mapper.XxShxxyMapper; import com.zksy.szpt.mapper.XxShxxyMapper;
...@@ -31,7 +31,7 @@ public class XxShxxyService { ...@@ -31,7 +31,7 @@ public class XxShxxyService {
} }
public Integer delete(CommonDelDTO dto ) { public Integer delete(CommonDelParamDTO dto ) {
LambdaQueryWrapper<XxShxxy> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxShxxy> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxShxxy::getXxyid, dto.getIds()); wrapper.in(XxShxxy::getXxyid, dto.getIds());
return xxShxxyMapper.delete(wrapper); return xxShxxyMapper.delete(wrapper);
......
...@@ -2,7 +2,7 @@ package com.zksy.szpt.service; ...@@ -2,7 +2,7 @@ package com.zksy.szpt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxYjdwdmDTO; import com.zksy.szpt.domain.dto.XxYjdwdmDTO;
import com.zksy.szpt.domain.po.XxYjdwdm; import com.zksy.szpt.domain.po.XxYjdwdm;
import com.zksy.szpt.mapper.XxYjdwdmMapper; import com.zksy.szpt.mapper.XxYjdwdmMapper;
...@@ -30,7 +30,7 @@ public class XxYjdwdmService { ...@@ -30,7 +30,7 @@ public class XxYjdwdmService {
} }
public Integer delete(CommonDelDTO dto) { public Integer delete(CommonDelParamDTO dto) {
LambdaQueryWrapper<XxYjdwdm> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxYjdwdm> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxYjdwdm::getId, dto.getIds()); wrapper.in(XxYjdwdm::getId, dto.getIds());
return xxYjdwdmMapper.delete(wrapper); return xxYjdwdmMapper.delete(wrapper);
......
...@@ -3,6 +3,7 @@ package com.zksy.szpt.service; ...@@ -3,6 +3,7 @@ package com.zksy.szpt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelDTO;
import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxYjrwDTO; import com.zksy.szpt.domain.dto.XxYjrwDTO;
import com.zksy.szpt.domain.po.XxYjrw; import com.zksy.szpt.domain.po.XxYjrw;
import com.zksy.szpt.mapper.XxYjrwMapper; import com.zksy.szpt.mapper.XxYjrwMapper;
...@@ -30,7 +31,7 @@ public class XxYjrwService { ...@@ -30,7 +31,7 @@ public class XxYjrwService {
} }
public Integer delete(CommonDelDTO dto) { public Integer delete(CommonDelParamDTO dto) {
LambdaQueryWrapper<XxYjrw> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxYjrw> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxYjrw::getRwid, dto.getIds()); wrapper.in(XxYjrw::getRwid, dto.getIds());
return xxYjrwMapper.delete(wrapper); return xxYjrwMapper.delete(wrapper);
......
...@@ -2,13 +2,12 @@ package com.zksy.szpt.service; ...@@ -2,13 +2,12 @@ package com.zksy.szpt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelParamDTO;
import com.zksy.szpt.domain.dto.XxZhjfbgDTO; import com.zksy.szpt.domain.dto.XxZhjfbgDTO;
import com.zksy.szpt.domain.po.XxZhjfbg; import com.zksy.szpt.domain.po.XxZhjfbg;
import com.zksy.szpt.mapper.XxZhjfbgMapper; import com.zksy.szpt.mapper.XxZhjfbgMapper;
import com.zksy.szpt.util.BeanMapperUtil; import com.zksy.szpt.util.BeanMapperUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -31,7 +30,7 @@ public class XxZhjfbgService { ...@@ -31,7 +30,7 @@ public class XxZhjfbgService {
} }
public Integer delete(CommonDelDTO dto) { public Integer delete(CommonDelParamDTO dto) {
LambdaQueryWrapper<XxZhjfbg> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxZhjfbg> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxZhjfbg::getDhid, dto.getIds()); wrapper.in(XxZhjfbg::getDhid, dto.getIds());
return xxZhjfbgMapper.delete(wrapper); return xxZhjfbgMapper.delete(wrapper);
......
...@@ -28,7 +28,7 @@ public class XxZhxxService { ...@@ -28,7 +28,7 @@ public class XxZhxxService {
} }
public Integer delete(CommonDelDTO dto) { public Integer delete(CommonDelParamDTO dto) {
LambdaQueryWrapper<XxZhxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxZhxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxZhxx::getZhid, dto.getIds()); wrapper.in(XxZhxx::getZhid, dto.getIds());
return xxZhxxMapper.delete(wrapper); return xxZhxxMapper.delete(wrapper);
......
...@@ -41,19 +41,19 @@ public class MainTest { ...@@ -41,19 +41,19 @@ public class MainTest {
/** /**
* 任务完成情况 * 任务完成情况
*/ */
@Test // @Test
@DisplayName("任务完成情况") @DisplayName("任务完成情况")
public void xxRwwcqkTest() { public void xxRwwcqkTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
// String secretKey = this.appStoreService.getAppSecretByAppKey(appId); // String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
appSecret = DigestUtil.md5Hex(appSecret); appSecret = DigestUtil.md5Hex(appSecret);
Assertions.assertNotNull(appId, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(appId, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数 //请求参数
XxRwwcqkDTO xxRwwcqkDTO = new XxRwwcqkDTO(); XxRwwcqkDTO xxRwwcqkDTO = new XxRwwcqkDTO();
xxRwwcqkDTO.setRwid("123456"); xxRwwcqkDTO.setRwid("1234");
xxRwwcqkDTO.setXxyid("123456"); xxRwwcqkDTO.setXxyid("12345");
xxRwwcqkDTO.setShrid("123456"); xxRwwcqkDTO.setShrid("12345");
xxRwwcqkDTO.setWczt("1"); xxRwwcqkDTO.setWczt("1");
xxRwwcqkDTO.setBmzt("1"); xxRwwcqkDTO.setBmzt("1");
String json = null; String json = null;
...@@ -91,13 +91,13 @@ public class MainTest { ...@@ -91,13 +91,13 @@ public class MainTest {
@DisplayName("账户信息") @DisplayName("账户信息")
public void zhxxtest() { public void zhxxtest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey); // Assertions.fail(secretKey);
//请求参数 //请求参数
XxZhxxDTO dto = new XxZhxxDTO(); XxZhxxDTO dto = new XxZhxxDTO();
dto.setZhid("123456"); dto.setZhid("1234");
dto.setXxyid("11"); dto.setXxyid("11");
dto.setZt("2"); dto.setZt("2");
dto.setClbz("2"); dto.setClbz("2");
...@@ -117,7 +117,7 @@ public class MainTest { ...@@ -117,7 +117,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/xxZhxx/update") String response = webClient.post().uri("/rest/xxZhxx/add")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -136,14 +136,14 @@ public class MainTest { ...@@ -136,14 +136,14 @@ public class MainTest {
@DisplayName("账户积分变更") @DisplayName("账户积分变更")
public void test1() { public void test1() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey); // Assertions.fail(secretKey);
//请求参数 //请求参数
XxZhjfbgDTO dto = new XxZhjfbgDTO(); XxZhjfbgDTO dto = new XxZhjfbgDTO();
// dto.setZhid("123456"); // dto.setZhid("1234");
dto.setDhid("123456"); dto.setDhid("1234");
dto.setQbid("2"); dto.setQbid("2");
dto.setBgsj(new Date()); dto.setBgsj(new Date());
String json = null; String json = null;
...@@ -162,7 +162,7 @@ public class MainTest { ...@@ -162,7 +162,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/xxZhjfbg/update") String response = webClient.post().uri("/rest/xxZhjfbg/add")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -225,13 +225,13 @@ public class MainTest { ...@@ -225,13 +225,13 @@ public class MainTest {
@DisplayName("义警任务") @DisplayName("义警任务")
public void test4() { public void test4() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey); // Assertions.fail(secretKey);
//请求参数 //请求参数
XxYjrwDTO dto = new XxYjrwDTO(); XxYjrwDTO dto = new XxYjrwDTO();
// dto.setZhid("123456"); // dto.setZhid("1234");
dto.setRwid("123456"); dto.setRwid("123456");
dto.setRwbt("1"); dto.setRwbt("1");
dto.setRwnr("11111"); dto.setRwnr("11111");
...@@ -273,15 +273,15 @@ public class MainTest { ...@@ -273,15 +273,15 @@ public class MainTest {
@DisplayName("义警队伍代码") @DisplayName("义警队伍代码")
public void test5() { public void test5() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
// Assertions.fail(secretKey); // Assertions.fail(secretKey);
//请求参数 //请求参数
XxYjdwdmDTO dto = new XxYjdwdmDTO(); XxYjdwdmDTO dto = new XxYjdwdmDTO();
// dto.setZhid("123456"); // dto.setZhid("1234");
dto.setDwlx(Integer.valueOf(1)); dto.setDwlx(Integer.valueOf(1));
dto.setId("1"); dto.setId("1234");
dto.setMchid("11111"); dto.setMchid("11111");
dto.setZt("1"); dto.setZt("1");
dto.setYjdwmc("test"); dto.setYjdwmc("test");
...@@ -301,7 +301,7 @@ public class MainTest { ...@@ -301,7 +301,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/xxYjdwdm/update") String response = webClient.post().uri("/rest/xxYjdwdm/add")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -317,14 +317,14 @@ public class MainTest { ...@@ -317,14 +317,14 @@ public class MainTest {
@DisplayName("社会信息员队伍") @DisplayName("社会信息员队伍")
public void test6() { public void test6() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数 //请求参数
XxShxxyDwDTO dto = new XxShxxyDwDTO(); XxShxxyDwDTO dto = new XxShxxyDwDTO();
dto.setId("123456"); dto.setId("1234");
dto.setDwdm("123456"); dto.setDwdm("1234");
dto.setShxxyid("123456"); dto.setShxxyid("1234");
String json = null; String json = null;
try { try {
json = objectMapper.writeValueAsString(dto); json = objectMapper.writeValueAsString(dto);
...@@ -341,7 +341,7 @@ public class MainTest { ...@@ -341,7 +341,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/xxShxxyDw/update") String response = webClient.post().uri("/rest/xxShxxyDw/add")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -357,12 +357,12 @@ public class MainTest { ...@@ -357,12 +357,12 @@ public class MainTest {
@DisplayName("社会信息员") @DisplayName("社会信息员")
public void test7() { public void test7() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数 //请求参数
XxShxxyDTO dto = new XxShxxyDTO(); XxShxxyDTO dto = new XxShxxyDTO();
dto.setXxyid("123456"); dto.setXxyid("1234");
dto.setZt("1"); dto.setZt("1");
dto.setSbfszt("1"); dto.setSbfszt("1");
dto.setShrid("1"); dto.setShrid("1");
...@@ -382,7 +382,7 @@ public class MainTest { ...@@ -382,7 +382,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/xxShxxy/update") String response = webClient.post().uri("/rest/xxShxxy/add")
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce) .header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr) .header(SignatureUtil.TIMESTAMP, timestampStr)
...@@ -399,15 +399,15 @@ public class MainTest { ...@@ -399,15 +399,15 @@ public class MainTest {
@DisplayName("删除服务") @DisplayName("删除服务")
public void testdelete() { public void testdelete() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = UUID.randomUUID().toString();
String secretKey = this.appStoreService.getAppSecretByAppKey(appId); String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数 //请求参数
String json = null; String json = null;
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
ids.add("1"); ids.add("1234");
ids.add("12345");
CommonDelDTO dto=new CommonDelDTO(); CommonDelParamDTO dto=new CommonDelParamDTO();
dto.setIds(ids); dto.setIds(ids);
try { try {
...@@ -430,10 +430,10 @@ public class MainTest { ...@@ -430,10 +430,10 @@ public class MainTest {
// String url="xxYjdwdm/delete"; // String url="xxYjdwdm/delete";
// String url="xxYjrw/delete"; // String url="xxYjrw/delete";
// //
String url="xxZhjfbg/delete"; // String url="xxZhjfbg/delete";
// //
// String url = "xxZhxx/delete"; String url = "xxZhxx/delete";
String response = webClient.post().uri("/rest/" + url) String response = webClient.post().uri("/rest/" + url)
.header(SignatureUtil.APPID, appId) .header(SignatureUtil.APPID, appId)
......
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