Commit 15a14144 authored by wangjinjing's avatar wangjinjing

bug

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