Commit 92a11966 authored by 夏敏伟's avatar 夏敏伟

编写测试 解决bug

parent 744dd937
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelDTO;
import com.zksy.szpt.domain.dto.CommonDelIntDTO;
import com.zksy.szpt.domain.dto.SzptClockInDTO; import com.zksy.szpt.domain.dto.SzptClockInDTO;
import com.zksy.szpt.service.SzptClockInService; import com.zksy.szpt.service.SzptClockInService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -33,8 +34,8 @@ public class SzptClockInController { ...@@ -33,8 +34,8 @@ public class SzptClockInController {
@ApiOperation(value = "删除szpt_clock_in数据") @ApiOperation(value = "删除szpt_clock_in数据")
@PostMapping("/deleteSzptClockIn") @PostMapping("/deleteSzptClockIn")
public Integer deleteSzptClockIn(@RequestBody CommonDelDTO commonDelDTO) { public Integer deleteSzptClockIn(@RequestBody CommonDelIntDTO commonDelIntDTO) {
return szptClockInService.deleteSzptClockIn(commonDelDTO); return szptClockInService.deleteSzptClockIn(commonDelIntDTO);
} }
......
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelDTO;
import com.zksy.szpt.domain.dto.CommonDelIntDTO;
import com.zksy.szpt.domain.dto.SzptClockInRulesDTO; import com.zksy.szpt.domain.dto.SzptClockInRulesDTO;
import com.zksy.szpt.service.SzptClockInRulesService; import com.zksy.szpt.service.SzptClockInRulesService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -33,7 +34,7 @@ public class SzptClockInRulesController { ...@@ -33,7 +34,7 @@ public class SzptClockInRulesController {
@ApiOperation(value = "删除SzptClockInRules数据") @ApiOperation(value = "删除SzptClockInRules数据")
@PostMapping("/deleteSzptClockInRules") @PostMapping("/deleteSzptClockInRules")
public Integer deleteSzptClockInRules(@RequestBody @Validated CommonDelDTO commonDelDTO) { public Integer deleteSzptClockInRules(@RequestBody @Validated CommonDelIntDTO commonDelIntDTO) {
return szptClockInRulesService.deleteSzptClockInRules(commonDelDTO); return szptClockInRulesService.deleteSzptClockInRules(commonDelIntDTO);
} }
} }
package com.zksy.szpt.controller; package com.zksy.szpt.controller;
import com.zksy.szpt.domain.dto.CommonDelDTO; import com.zksy.szpt.domain.dto.CommonDelDTO;
import com.zksy.szpt.domain.dto.CommonDelIntDTO;
import com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO; import com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO;
import com.zksy.szpt.service.SzptXyzhXyxxService; import com.zksy.szpt.service.SzptXyzhXyxxService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -35,7 +36,7 @@ public class SzptXyzhXyxxController { ...@@ -35,7 +36,7 @@ public class SzptXyzhXyxxController {
@ApiOperation(value = "删除校园信息") @ApiOperation(value = "删除校园信息")
@PostMapping("/deleteSzptXyzhXyxx") @PostMapping("/deleteSzptXyzhXyxx")
public Integer deleteSzptXyzhXyxx(@RequestBody @Validated CommonDelDTO commonDelDTO) { public Integer deleteSzptXyzhXyxx(@RequestBody @Validated CommonDelIntDTO commonDelIntDTO) {
return szptXyzhXyxxService.deleteSzptXyzhXyxx(commonDelDTO); return szptXyzhXyxxService.deleteSzptXyzhXyxx(commonDelIntDTO);
} }
} }
package com.zksy.szpt.domain.dto;
import javax.validation.constraints.NotEmpty;
import java.util.List;
public class CommonDelIntDTO {
/**
* 账户ID
*/
@NotEmpty(message = "账户ID不能为空")
private List<Integer> ids;
/**
* 数据所属单位
*/
@NotEmpty(message = "数据归属单位不能为空")
private String sjgsdwdm;
public List<Integer> getIds() {
return ids;
}
public void setIds(List<Integer> ids) {
this.ids = ids;
}
public String getSjgsdwdm() {
return sjgsdwdm;
}
public void setSjgsdwdm(String sjgsdwdm) {
this.sjgsdwdm = sjgsdwdm;
}
}
package com.zksy.szpt.domain.dto; package com.zksy.szpt.domain.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -7,6 +9,12 @@ import javax.validation.constraints.NotEmpty; ...@@ -7,6 +9,12 @@ import javax.validation.constraints.NotEmpty;
import java.util.Date; import java.util.Date;
public class SzptGdYjDTO { public class SzptGdYjDTO {
/**
* 预警ID
*/
@NotBlank(message = "预警ID不能为空")
private String id;
/** /**
* 工地ID * 工地ID
*/ */
...@@ -73,6 +81,14 @@ public class SzptGdYjDTO { ...@@ -73,6 +81,14 @@ public class SzptGdYjDTO {
private String clrxm; private String clrxm;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCsid() { public String getCsid() {
return csid; return csid;
} }
......
...@@ -30,7 +30,7 @@ public class IndexService { ...@@ -30,7 +30,7 @@ public class IndexService {
public Integer deleteXxRwwcqk(CommonDelDTO commonDelDTO) { public Integer deleteXxRwwcqk(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<XxRwwcqk> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<XxRwwcqk> wrapper = new LambdaQueryWrapper<>();
wrapper.in(XxRwwcqk::getRwid, commonDelDTO); wrapper.in(XxRwwcqk::getRwid, commonDelDTO.getIds());
return xxRwwcqkMapper.delete(wrapper); return xxRwwcqkMapper.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.CommonDelIntDTO;
import com.zksy.szpt.domain.dto.SzptClockInRulesDTO; import com.zksy.szpt.domain.dto.SzptClockInRulesDTO;
import com.zksy.szpt.domain.po.SzptClockInRules; import com.zksy.szpt.domain.po.SzptClockInRules;
import com.zksy.szpt.mapper.SzptClockInRulesMapper; import com.zksy.szpt.mapper.SzptClockInRulesMapper;
...@@ -28,9 +29,9 @@ public class SzptClockInRulesService { ...@@ -28,9 +29,9 @@ public class SzptClockInRulesService {
return szptClockInRulesMapper.update(szptClockInRules,wrapper); return szptClockInRulesMapper.update(szptClockInRules,wrapper);
} }
public Integer deleteSzptClockInRules(CommonDelDTO commonDelDTO) { public Integer deleteSzptClockInRules(CommonDelIntDTO commonDelIntDTO) {
LambdaQueryWrapper<SzptClockInRules> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptClockInRules> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptClockInRules::getId, commonDelDTO); wrapper.in(SzptClockInRules::getId, commonDelIntDTO.getIds());
return szptClockInRulesMapper.delete(wrapper); return szptClockInRulesMapper.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.CommonDelIntDTO;
import com.zksy.szpt.domain.dto.SzptClockInDTO; import com.zksy.szpt.domain.dto.SzptClockInDTO;
import com.zksy.szpt.domain.po.SzptClockIn; import com.zksy.szpt.domain.po.SzptClockIn;
import com.zksy.szpt.mapper.SzptClockInMapper; import com.zksy.szpt.mapper.SzptClockInMapper;
...@@ -28,9 +29,9 @@ public class SzptClockInService { ...@@ -28,9 +29,9 @@ public class SzptClockInService {
return szptClockInMapper.update(szptClockIn,wrapper); return szptClockInMapper.update(szptClockIn,wrapper);
} }
public Integer deleteSzptClockIn(CommonDelDTO commonDelDTO) { public Integer deleteSzptClockIn(CommonDelIntDTO commonDelIntDTO) {
LambdaQueryWrapper<SzptClockIn> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptClockIn> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptClockIn::getId, commonDelDTO); wrapper.in(SzptClockIn::getId, commonDelIntDTO.getIds());
return szptClockInMapper.delete(wrapper); return szptClockInMapper.delete(wrapper);
} }
} }
...@@ -32,7 +32,8 @@ public class SzptFwxxService { ...@@ -32,7 +32,8 @@ public class SzptFwxxService {
public Integer deleteSzptFwxx(CommonDelDTO commonDelDTO) { public Integer deleteSzptFwxx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptFwxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptFwxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptFwxx::getQyid, commonDelDTO); wrapper.in(SzptFwxx::getQyid, commonDelDTO.getIds());
wrapper.eq(SzptFwxx::getSjgsdwdm, commonDelDTO.getSjgsdwdm());
return szptFwxxMapper.delete(wrapper); return szptFwxxMapper.delete(wrapper);
} }
} }
...@@ -30,7 +30,7 @@ public class SzptGdCsyjhldxService { ...@@ -30,7 +30,7 @@ public class SzptGdCsyjhldxService {
public Integer deleteSzptGdCsyjhldx(CommonDelDTO commonDelDTO) { public Integer deleteSzptGdCsyjhldx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptGdCsyjhldx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptGdCsyjhldx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptGdCsyjhldx::getId, commonDelDTO); wrapper.in(SzptGdCsyjhldx::getId, commonDelDTO.getIds());
return szptGdCsyjhldxMapper.delete(wrapper); return szptGdCsyjhldxMapper.delete(wrapper);
} }
} }
...@@ -30,7 +30,7 @@ public class SzptGdRyxxService { ...@@ -30,7 +30,7 @@ public class SzptGdRyxxService {
public Integer deleteSzptGdRyxx(CommonDelDTO commonDelDTO) { public Integer deleteSzptGdRyxx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptGdRyxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptGdRyxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptGdRyxx::getRkbm, commonDelDTO); wrapper.in(SzptGdRyxx::getRkbm, commonDelDTO.getIds());
return szptGdRyxxMapper.delete(wrapper); return szptGdRyxxMapper.delete(wrapper);
} }
} }
...@@ -24,14 +24,15 @@ public class SzptGdSbxxService { ...@@ -24,14 +24,15 @@ public class SzptGdSbxxService {
public Integer updateSzptGdSbxx(SzptGdSbxxDTO szptGdSbxxDTO) { public Integer updateSzptGdSbxx(SzptGdSbxxDTO szptGdSbxxDTO) {
SzptGdSbxx szptGdSbxx = BeanMapperUtil.map(szptGdSbxxDTO, SzptGdSbxx.class); SzptGdSbxx szptGdSbxx = BeanMapperUtil.map(szptGdSbxxDTO, SzptGdSbxx.class);
LambdaUpdateWrapper<SzptGdSbxx> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SzptGdSbxx> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SzptGdSbxx::getId, szptGdSbxx.getId()); wrapper.eq(SzptGdSbxx::getSbbh, szptGdSbxx.getSbbh());
wrapper.eq(SzptGdSbxx::getSjgsdwdm, szptGdSbxx.getSjgsdwdm()); wrapper.eq(SzptGdSbxx::getSjgsdwdm, szptGdSbxx.getSjgsdwdm());
return szptGdSbxxMapper.update(szptGdSbxx,wrapper); return szptGdSbxxMapper.update(szptGdSbxx,wrapper);
} }
public Integer deleteSzptGdSbxx(CommonDelDTO commonDelDTO) { public Integer deleteSzptGdSbxx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptGdSbxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptGdSbxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptGdSbxx::getId, commonDelDTO); wrapper.in(SzptGdSbxx::getSbbh, commonDelDTO.getIds());
wrapper.eq(SzptGdSbxx::getSjgsdwdm, commonDelDTO.getSjgsdwdm());
return szptGdSbxxMapper.delete(wrapper); return szptGdSbxxMapper.delete(wrapper);
} }
} }
...@@ -31,7 +31,8 @@ public class SzptGdXxService { ...@@ -31,7 +31,8 @@ public class SzptGdXxService {
public Integer deleteSzptGdXx(CommonDelDTO commonDelDTO) { public Integer deleteSzptGdXx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptGdXx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptGdXx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptGdXx::getId, commonDelDTO); wrapper.in(SzptGdXx::getId, commonDelDTO.getIds());
wrapper.eq(SzptGdXx::getSjgsdwdm, commonDelDTO.getSjgsdwdm());
return szptGdXxMapper.delete(wrapper); return szptGdXxMapper.delete(wrapper);
} }
} }
...@@ -29,7 +29,7 @@ public class SzptGdYjService { ...@@ -29,7 +29,7 @@ public class SzptGdYjService {
public Integer deleteSzptGdYj(CommonDelDTO commonDelDTO) { public Integer deleteSzptGdYj(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptGdYj> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptGdYj> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptGdYj::getId, commonDelDTO); wrapper.in(SzptGdYj::getId, commonDelDTO.getIds());
return szptGdYjMapper.delete(wrapper); return szptGdYjMapper.delete(wrapper);
} }
} }
...@@ -30,7 +30,7 @@ public class SzptQyxxService { ...@@ -30,7 +30,7 @@ public class SzptQyxxService {
public Integer deleteSzptQyxx(CommonDelDTO commonDelDTO) { public Integer deleteSzptQyxx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptQyxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptQyxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptQyxx::getId, commonDelDTO); wrapper.in(SzptQyxx::getId, commonDelDTO.getIds());
return szptQyxxMapper.delete(wrapper); return szptQyxxMapper.delete(wrapper);
} }
} }
...@@ -30,7 +30,7 @@ public class SzptXyzhDkxxService { ...@@ -30,7 +30,7 @@ public class SzptXyzhDkxxService {
public Integer deleteSzptXyzhDkxx(CommonDelDTO commonDelDTO) { public Integer deleteSzptXyzhDkxx(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptXyzhDkxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptXyzhDkxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptXyzhDkxx::getDklsid, commonDelDTO); wrapper.in(SzptXyzhDkxx::getDklsid, commonDelDTO.getIds());
return szptXyzhDkxxMapper.delete(wrapper); return szptXyzhDkxxMapper.delete(wrapper);
} }
} }
...@@ -32,7 +32,7 @@ public class SzptXyzhKqmbService { ...@@ -32,7 +32,7 @@ public class SzptXyzhKqmbService {
public Integer deleteSzptXyzhKqmb(CommonDelDTO commonDelDTO) { public Integer deleteSzptXyzhKqmb(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptXyzhKqmb> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptXyzhKqmb> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptXyzhKqmb::getId, commonDelDTO); wrapper.in(SzptXyzhKqmb::getId, commonDelDTO.getIds());
return szptXyzhKqmbMapper.delete(wrapper); return szptXyzhKqmbMapper.delete(wrapper);
} }
} }
...@@ -32,7 +32,7 @@ public class SzptXyzhMbdhService { ...@@ -32,7 +32,7 @@ public class SzptXyzhMbdhService {
public Integer deleteSzptXyzhMbdh(CommonDelDTO commonDelDTO) { public Integer deleteSzptXyzhMbdh(CommonDelDTO commonDelDTO) {
LambdaQueryWrapper<SzptXyzhMbdh> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptXyzhMbdh> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptXyzhMbdh::getId, commonDelDTO); wrapper.in(SzptXyzhMbdh::getId, commonDelDTO.getIds());
return szptXyzhMbdhMapper.delete(wrapper); return szptXyzhMbdhMapper.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.CommonDelIntDTO;
import com.zksy.szpt.domain.dto.SzptXyzhMbdhDTO; import com.zksy.szpt.domain.dto.SzptXyzhMbdhDTO;
import com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO; import com.zksy.szpt.domain.dto.SzptXyzhXyxxDTO;
import com.zksy.szpt.domain.po.SzptXyzhMbdh; import com.zksy.szpt.domain.po.SzptXyzhMbdh;
...@@ -30,9 +31,9 @@ public class SzptXyzhXyxxService { ...@@ -30,9 +31,9 @@ public class SzptXyzhXyxxService {
return szptXyzhXyxxMapper.update(szptXyzhXyxx,wrapper); return szptXyzhXyxxMapper.update(szptXyzhXyxx,wrapper);
} }
public Integer deleteSzptXyzhXyxx(CommonDelDTO commonDelDTO) { public Integer deleteSzptXyzhXyxx(CommonDelIntDTO commonDelIntDTO) {
LambdaQueryWrapper<SzptXyzhXyxx> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SzptXyzhXyxx> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SzptXyzhXyxx::getId, commonDelDTO); wrapper.in(SzptXyzhXyxx::getId, commonDelIntDTO.getIds());
return szptXyzhXyxxMapper.delete(wrapper); return szptXyzhXyxxMapper.delete(wrapper);
} }
} }
...@@ -3,8 +3,7 @@ package com.zksy.szpt; ...@@ -3,8 +3,7 @@ package com.zksy.szpt;
import cn.hutool.crypto.digest.DigestUtil; import cn.hutool.crypto.digest.DigestUtil;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.zksy.szpt.domain.dto.SzptClockInDTO; import com.zksy.szpt.domain.dto.*;
import com.zksy.szpt.domain.dto.SzptFwxxDTO;
import com.zksy.szpt.service.AppStoreService; import com.zksy.szpt.service.AppStoreService;
import com.zksy.szpt.util.EncryptUtil; import com.zksy.szpt.util.EncryptUtil;
import com.zksy.szpt.util.SignatureUtil; import com.zksy.szpt.util.SignatureUtil;
...@@ -16,7 +15,9 @@ import org.springframework.web.reactive.function.client.WebClient; ...@@ -16,7 +15,9 @@ import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
@SpringBootTest() @SpringBootTest()
public class MainTestX { public class MainTestX {
...@@ -32,10 +33,10 @@ public class MainTestX { ...@@ -32,10 +33,10 @@ public class MainTestX {
private AppStoreService appStoreService; private AppStoreService appStoreService;
/** /**
* 任务完成情况 * ===================================================考勤===================================================
*/ */
@Test @Test
@DisplayName("考勤") @DisplayName("考勤--新增、更新")
public void szptClockInTest() { public void szptClockInTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = String.valueOf(System.currentTimeMillis() / 1000);
...@@ -49,13 +50,11 @@ public class MainTestX { ...@@ -49,13 +50,11 @@ public class MainTestX {
szptClockInDTO.setXbqt("123456"); szptClockInDTO.setXbqt("123456");
szptClockInDTO.setXcqk("1"); szptClockInDTO.setXcqk("1");
szptClockInDTO.setSbsj("1"); szptClockInDTO.setSbsj("1");
szptClockInDTO.setSbr("123456"); szptClockInDTO.setSbr("123456");
szptClockInDTO.setQdr("123456"); szptClockInDTO.setQdr("123456");
szptClockInDTO.setQdrlxdh("123456"); szptClockInDTO.setQdrlxdh("123456");
szptClockInDTO.setQddkdd("1"); szptClockInDTO.setQddkdd("1");
szptClockInDTO.setQddkzp("1"); szptClockInDTO.setQddkzp("1");
szptClockInDTO.setQtdkdd("1"); szptClockInDTO.setQtdkdd("1");
szptClockInDTO.setQtdkzp("1"); szptClockInDTO.setQtdkzp("1");
szptClockInDTO.setGkdj("1"); szptClockInDTO.setGkdj("1");
...@@ -87,9 +86,144 @@ public class MainTestX { ...@@ -87,9 +86,144 @@ public class MainTestX {
System.out.println(response); System.out.println(response);
} }
@Test
@DisplayName("考勤--删除")
public void deleteClockInTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<Integer> ids = new ArrayList<>();
ids.add(14);
ids.add(15);
CommonDelIntDTO commonDelIntDTO = new CommonDelIntDTO();
commonDelIntDTO.setIds(ids);
commonDelIntDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelIntDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/deleteSzptClockIn")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelIntDTO), CommonDelIntDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================考勤规则===================================================
*/
@Test
@DisplayName("考勤规则--新增、更新")
public void szptClockInRulesTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptClockInRulesDTO szptClockInRulesDTO = new SzptClockInRulesDTO();
szptClockInRulesDTO.setId(100);
szptClockInRulesDTO.setName("123456");
szptClockInRulesDTO.setCsid("123456");
szptClockInRulesDTO.setChockInTime("123456");
szptClockInRulesDTO.setClockInScope("1");
szptClockInRulesDTO.setQrCode("1");
szptClockInRulesDTO.setCslx("123456");
szptClockInRulesDTO.setBz("123456");
String json = null;
try {
json = objectMapper.writeValueAsString(szptClockInRulesDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/addSzptClockInRules")
String response = webClient.post().uri("/rest/index/updateSzptClockInRules")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(szptClockInRulesDTO), SzptClockInRulesDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
@Test
@DisplayName("考勤规则--删除")
public void deleteClockInRulesTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<Integer> ids = new ArrayList<>();
ids.add(4);
ids.add(100);
CommonDelIntDTO commonDelIntDTO = new CommonDelIntDTO();
commonDelIntDTO.setIds(ids);
commonDelIntDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelIntDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/deleteSzptClockInRules")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelIntDTO), CommonDelIntDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================房屋信息===================================================
*/
@Test @Test
@DisplayName("房屋信息") @DisplayName("房屋信息--新增、更新")
public void szptFwxxTest() { public void szptFwxxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000); timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000); nonce = String.valueOf(System.currentTimeMillis() / 1000);
...@@ -97,7 +231,7 @@ public class MainTestX { ...@@ -97,7 +231,7 @@ public class MainTestX {
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率 Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数 //请求参数
SzptFwxxDTO szptFwxxDTO = new SzptFwxxDTO(); SzptFwxxDTO szptFwxxDTO = new SzptFwxxDTO();
szptFwxxDTO.setQyid("2"); szptFwxxDTO.setQyid("5");
szptFwxxDTO.setCsid("123456"); szptFwxxDTO.setCsid("123456");
szptFwxxDTO.setFwjc("123456"); szptFwxxDTO.setFwjc("123456");
szptFwxxDTO.setJzqk("1"); szptFwxxDTO.setJzqk("1");
...@@ -132,7 +266,7 @@ public class MainTestX { ...@@ -132,7 +266,7 @@ public class MainTestX {
szptFwxxDTO.setFkdjzdsh("1"); szptFwxxDTO.setFkdjzdsh("1");
szptFwxxDTO.setQtfwyt("1"); szptFwxxDTO.setQtfwyt("1");
szptFwxxDTO.setJkmhysj(new Date()); szptFwxxDTO.setJkmhysj(new Date());
szptFwxxDTO.setSjgsdwdm("340102"); szptFwxxDTO.setSjgsdwdm("330102");
szptFwxxDTO.setSjgsdwmc("1"); szptFwxxDTO.setSjgsdwmc("1");
szptFwxxDTO.setFzzjzp("1"); szptFwxxDTO.setFzzjzp("1");
String json = null; String json = null;
...@@ -162,4 +296,599 @@ public class MainTestX { ...@@ -162,4 +296,599 @@ public class MainTestX {
.block(); .block();
System.out.println(response); System.out.println(response);
} }
@Test
@DisplayName("房屋信息--删除")
public void deleteSzptFwxxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<String> ids = new ArrayList<>();
ids.add("5");
CommonDelDTO commonDelDTO = new CommonDelDTO();
commonDelDTO.setIds(ids);
commonDelDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelDTO);
} catch (JsonProcessingException e) {
Assertions.fail("json序列化失败");
}
//请求体加密
String json1 = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json1);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String response = webClient.post().uri("/rest/index/deleteSzptFwxx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelDTO), CommonDelDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================场所预警忽略对象===================================================
*/
@Test
@DisplayName("场所预警忽略对象--新增、更新")
public void szptGdCsyjhldxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdCsyjhldxDTO szptGdCsyjhldxDTO = new SzptGdCsyjhldxDTO();
szptGdCsyjhldxDTO.setId("5");
szptGdCsyjhldxDTO.setCsid("123456123456");
szptGdCsyjhldxDTO.setYjlx("1");
szptGdCsyjhldxDTO.setYjzlx("1");
szptGdCsyjhldxDTO.setYwid("1");
szptGdCsyjhldxDTO.setYwms("1");
szptGdCsyjhldxDTO.setBz("123456");
szptGdCsyjhldxDTO.setZt("1");
String json = null;
try {
json = objectMapper.writeValueAsString(szptGdCsyjhldxDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/addSzptGdCsyjhldx")
String response = webClient.post().uri("/rest/index/updateSzptGdCsyjhldx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(szptGdCsyjhldxDTO), SzptGdCsyjhldxDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
@Test
@DisplayName("场所预警忽略对象--删除")
public void deleteSzptGdCsyjhldxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<String> ids = new ArrayList<>();
ids.add("5");
CommonDelDTO commonDelDTO = new CommonDelDTO();
commonDelDTO.setIds(ids);
commonDelDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelDTO);
} catch (JsonProcessingException e) {
Assertions.fail("json序列化失败");
}
//请求体加密
String json1 = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json1);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String response = webClient.post().uri("/rest/index/deleteSzptGdCsyjhldx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelDTO), CommonDelDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================工地人员信息===================================================
*/
@Test
@DisplayName("工地人员信息--新增、更新")
public void szptGdRyxxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdRyxxDTO szptGdRyxxDTO = new SzptGdRyxxDTO();
szptGdRyxxDTO.setId("7");
szptGdRyxxDTO.setRkbm("1234561234561");
szptGdRyxxDTO.setCsid("1123111111111111");
szptGdRyxxDTO.setCjrlid("1");
szptGdRyxxDTO.setXm("1");
szptGdRyxxDTO.setXb("1");
szptGdRyxxDTO.setLxdh("123456");
szptGdRyxxDTO.setCyzjdm("1");
szptGdRyxxDTO.setZjhm("5");
szptGdRyxxDTO.setNl("1");
szptGdRyxxDTO.setUrl("1");
szptGdRyxxDTO.setMd5("1");
szptGdRyxxDTO.setZjcxts(1);
szptGdRyxxDTO.setZcxts(1);
szptGdRyxxDTO.setYsrczjts(1);
szptGdRyxxDTO.setYsrcbz("1");
szptGdRyxxDTO.setYsrczts(5);
szptGdRyxxDTO.setCkbz("1");
szptGdRyxxDTO.setLkbz("1");
szptGdRyxxDTO.setHjdzDzmc("1");
szptGdRyxxDTO.setHjdzXzqhdm("1");
szptGdRyxxDTO.setHjdzPcsmc("1");
szptGdRyxxDTO.setHjdzPcsdm("123456");
szptGdRyxxDTO.setXzdDzmc("1");
szptGdRyxxDTO.setXzdXzqhdm("5");
szptGdRyxxDTO.setXzdPcsmc("123456123456");
szptGdRyxxDTO.setXzdPcsdm("1");
szptGdRyxxDTO.setZt("1");
szptGdRyxxDTO.setJcsj(new Date());
szptGdRyxxDTO.setTcsj(new Date());
szptGdRyxxDTO.setYjtcsj(new Date());
szptGdRyxxDTO.setZjzpsj(new Date());
szptGdRyxxDTO.setSfglry("5");
szptGdRyxxDTO.setDjzt(1);
szptGdRyxxDTO.setQyid("1");
szptGdRyxxDTO.setQymc("1");
szptGdRyxxDTO.setRylb("1");
szptGdRyxxDTO.setRylx("1");
szptGdRyxxDTO.setLkbdsj(new Date());
szptGdRyxxDTO.setCkbdsj(new Date());
szptGdRyxxDTO.setDatasource("1");
szptGdRyxxDTO.setOrderid("1");
szptGdRyxxDTO.setSjrzrs("123456");
String json = null;
try {
json = objectMapper.writeValueAsString(szptGdRyxxDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/addSzptGdRyxx")
String response = webClient.post().uri("/rest/index/updateSzptGdRyxx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(szptGdRyxxDTO), SzptGdRyxxDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
@Test
@DisplayName("工地人员信息--删除")
public void deleteSzptGdRyxxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<String> ids = new ArrayList<>();
ids.add("1234561234561");
CommonDelDTO commonDelDTO = new CommonDelDTO();
commonDelDTO.setIds(ids);
commonDelDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelDTO);
} catch (JsonProcessingException e) {
Assertions.fail("json序列化失败");
}
//请求体加密
String json1 = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json1);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String response = webClient.post().uri("/rest/index/deleteSzptGdRyxx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelDTO), CommonDelDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================设备信息===================================================
*/
@Test
@DisplayName("设备信息--新增、更新")
public void szptGdSbxxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdSbxxDTO szptGdSbxxDTO = new SzptGdSbxxDTO();
szptGdSbxxDTO.setId("7");
szptGdSbxxDTO.setSbsn("1");
szptGdSbxxDTO.setSbmc("1");
szptGdSbxxDTO.setSbbh("1");
szptGdSbxxDTO.setSbms("1");
szptGdSbxxDTO.setMac("1");
szptGdSbxxDTO.setIp("123456");
szptGdSbxxDTO.setNetmask("1");
szptGdSbxxDTO.setGw("5");
szptGdSbxxDTO.setCsid("1");
szptGdSbxxDTO.setYxzt("1");
szptGdSbxxDTO.setZtgxsj(new Date());
szptGdSbxxDTO.setCj("1");
szptGdSbxxDTO.setXh("1");
szptGdSbxxDTO.setQyid("1");
szptGdSbxxDTO.setQymc("1");
szptGdSbxxDTO.setSbcs("1");
szptGdSbxxDTO.setSblb("1");
szptGdSbxxDTO.setZt("1");
szptGdSbxxDTO.setSjgsdwdm("330102");
szptGdSbxxDTO.setSjgsdwmc("1");
szptGdSbxxDTO.setCreateGajgjgdm("123");
szptGdSbxxDTO.setCreateGajgmc("123");
String json = null;
try {
json = objectMapper.writeValueAsString(szptGdSbxxDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/addSzptGdSbxx")
String response = webClient.post().uri("/rest/index/updateSzptGdSbxx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(szptGdSbxxDTO), SzptGdSbxxDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
@Test
@DisplayName("设备信息--删除")
public void deleteSzptGdSbxxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<String> ids = new ArrayList<>();
ids.add("4");
ids.add("5");
ids.add("6");
CommonDelDTO commonDelDTO = new CommonDelDTO();
commonDelDTO.setIds(ids);
commonDelDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelDTO);
} catch (JsonProcessingException e) {
Assertions.fail("json序列化失败");
}
//请求体加密
String json1 = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json1);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String response = webClient.post().uri("/rest/index/deleteSzptGdSbxx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelDTO), CommonDelDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================工地信息===================================================
*/
@Test
@DisplayName("工地信息--新增、更新")
public void szptGdXxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdXxDTO szptGdXxDTO = new SzptGdXxDTO();
szptGdXxDTO.setId("7");
szptGdXxDTO.setCslx("1");
szptGdXxDTO.setCsmc("1111111111111111111");
szptGdXxDTO.setCsms("1");
szptGdXxDTO.setLxdz("1");
szptGdXxDTO.setLxr("1");
szptGdXxDTO.setLxdh("123456");
szptGdXxDTO.setSgdw("1");
szptGdXxDTO.setSgxkz("5");
szptGdXxDTO.setKgrq(new Date());
szptGdXxDTO.setYjjgrq(new Date());
szptGdXxDTO.setLng("120.3");
szptGdXxDTO.setLat("30");
szptGdXxDTO.setCustomlng("1");
szptGdXxDTO.setCustomlat("1");
szptGdXxDTO.setZrrxm("1");
szptGdXxDTO.setZrrlxdh("1");
szptGdXxDTO.setFrxm("1");
szptGdXxDTO.setFrlxdh("1");
szptGdXxDTO.setShxydm("330102");
szptGdXxDTO.setZcdz("1");
szptGdXxDTO.setAdminzh("123");
szptGdXxDTO.setSfzcs("1");
szptGdXxDTO.setFcsid("1");
szptGdXxDTO.setBz("1");
szptGdXxDTO.setCjsj(new Date());
szptGdXxDTO.setZt("1");
szptGdXxDTO.setJhsj(new Date());
szptGdXxDTO.setLocation("1");
szptGdXxDTO.setSjlyXtmc("340102");
szptGdXxDTO.setZxsj(new Date());
szptGdXxDTO.setSqdm("123");
szptGdXxDTO.setSqmc("123");
szptGdXxDTO.setMdlx("1");
szptGdXxDTO.setMdjyzt("1");
szptGdXxDTO.setSjgsdwdm("330102");
szptGdXxDTO.setSjgsdwmc("1");
szptGdXxDTO.setCreateGajgjgdm("1");
szptGdXxDTO.setCreateGajgmc("1");
String json = null;
try {
json = objectMapper.writeValueAsString(szptGdXxDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/addSzptGdXx")
String response = webClient.post().uri("/rest/index/updateSzptGdXx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(szptGdXxDTO), SzptGdXxDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
@Test
@DisplayName("工地信息--删除")
public void deleteSzptGdXxTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<String> ids = new ArrayList<>();
ids.add("1872956891413839873");
ids.add("1872957357501657089");
ids.add("1874652891924905986");
CommonDelDTO commonDelDTO = new CommonDelDTO();
commonDelDTO.setIds(ids);
commonDelDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelDTO);
} catch (JsonProcessingException e) {
Assertions.fail("json序列化失败");
}
//请求体加密
String json1 = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json1);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String response = webClient.post().uri("/rest/index/deleteSzptGdXx")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelDTO), CommonDelDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
/**
* ===================================================工地预警流水表===================================================
*/
@Test
@DisplayName("工地预警流水表--新增、更新")
public void szptGdYjTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
SzptGdYjDTO szptGdYjDTO = new SzptGdYjDTO();
szptGdYjDTO.setId("1");
szptGdYjDTO.setCsid("1");
szptGdYjDTO.setYjrq("1");
szptGdYjDTO.setYjlx("1");
szptGdYjDTO.setYjzlx("1");
szptGdYjDTO.setYjnr("1");
szptGdYjDTO.setYwid("123456");
szptGdYjDTO.setYwcs("1");
szptGdYjDTO.setYjzt("5");
szptGdYjDTO.setClsj(new Date());
szptGdYjDTO.setCljg("123");
szptGdYjDTO.setClrid("120.3");
szptGdYjDTO.setClrxm("30");
String json = null;
try {
json = objectMapper.writeValueAsString(szptGdYjDTO);
} catch (JsonProcessingException e) {
Assertions.fail("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 response = webClient.post().uri("/rest/index/addSzptGdYj")
String response = webClient.post().uri("/rest/index/updateSzptGdYj")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(szptGdYjDTO), SzptGdYjDTO.class)
.retrieve()
.bodyToMono(String.class)
.block();
System.out.println(response);
}
@Test
@DisplayName("工地预警流水表--删除")
public void deleteSzptGdYjTest() {
timestampStr = String.valueOf(System.currentTimeMillis() / 1000);
nonce = String.valueOf(System.currentTimeMillis() / 1000);
String secretKey = this.appStoreService.getAppSecretByAppKey(appId);
Assertions.assertNotNull(secretKey, "appId不存在");//断言appId存在,为空直接抛出异常不进行下一步测试,提高测试效率
//请求参数
List<String> ids = new ArrayList<>();
ids.add("1874653022954954754");
ids.add("1876882297523142657");
ids.add("1876882403576119297");
ids.add("1876882723429670913");
ids.add("1876883035569774594");
ids.add("1876887147652833281");
CommonDelDTO commonDelDTO = new CommonDelDTO();
commonDelDTO.setIds(ids);
commonDelDTO.setSjgsdwdm("330102");
String json = null;
try {
json = objectMapper.writeValueAsString(commonDelDTO);
} catch (JsonProcessingException e) {
Assertions.fail("json序列化失败");
}
//请求体加密
String json1 = EncryptUtil.getInstance().AESEncode(json, secretKey);
//签名appId+nonce+timestampStr+aes(body)
String data = String.format("%s%s%s%s", appId, nonce, timestampStr, json1);
String generatedSignature = DigestUtil.md5Hex(data);
//请求
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8086")
.defaultHeader("Content-Type", "application/json")
.build();
String response = webClient.post().uri("/rest/index/deleteSzptGdYj")
.header(SignatureUtil.APPID, appId)
.header(SignatureUtil.NONCE, nonce)
.header(SignatureUtil.TIMESTAMP, timestampStr)
.header(SignatureUtil.SIGNATURE, generatedSignature)
.body(Mono.just(commonDelDTO), CommonDelDTO.class)
.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