Merge branch 'master' of http://git.hchbox.com/yuyou/client into master
commit
4812aaa121
@ -0,0 +1,23 @@
|
||||
package com.yuyou.openapi.openapi.model.pojo;
|
||||
|
||||
import com.yuyou.openapi.openapi.model.dto.ABZMMessageDTO;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ABZMLocalDTO {
|
||||
|
||||
/**
|
||||
* 记录Id
|
||||
*/
|
||||
private String recordId;
|
||||
|
||||
/**
|
||||
* 数据集合
|
||||
*/
|
||||
private ABZMMessageDTO.Datas data;
|
||||
|
||||
/**
|
||||
* 标记集合
|
||||
*/
|
||||
private ABZMMessageDTO.Tag tag;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.yuyou.openapi.openapi.model.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResultBean {
|
||||
|
||||
|
||||
private List<E> data;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class E{
|
||||
|
||||
private Long start_time;
|
||||
|
||||
private Long client_type;
|
||||
|
||||
private String act_name;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private Long rec_id;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.yuyou.openapi.openapi.model.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class YiZaoLocalDTO {
|
||||
|
||||
|
||||
private List<D> data;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class D{
|
||||
|
||||
private String start_time;
|
||||
|
||||
private String client_type;
|
||||
|
||||
private String act_name;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String rec_id;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.yuyou.openapi.openapi;
|
||||
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
|
||||
/**
|
||||
* SpringBoot测试基类
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class OpenapiApplicationTest {
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.yuyou.openapi.openapi;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class OpenapiApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.yuyou.openapi.openapi;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yuyou.openapi.openapi.model.pojo.ResultBean;
|
||||
import com.yuyou.openapi.openapi.model.pojo.YiZaoLocalDTO;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SimpleTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testYZ() throws IOException {
|
||||
List<String> list = Files.readAllLines(Paths.get("C:\\Users\\Administrator\\Desktop\\2.json"));
|
||||
list.forEach(
|
||||
each ->{
|
||||
YiZaoLocalDTO yiZaoLocalDTO = JSON.parseObject(each, YiZaoLocalDTO.class);
|
||||
if (yiZaoLocalDTO != null){
|
||||
ResultBean resultBean = new ResultBean();
|
||||
List<YiZaoLocalDTO.D> data = yiZaoLocalDTO.getData();
|
||||
ArrayList<ResultBean.E> objects = new ArrayList<>();
|
||||
data.forEach(
|
||||
one ->{
|
||||
ResultBean.E e = new ResultBean.E();
|
||||
e.setAct_name(one.getAct_name());
|
||||
e.setClient_type(Long.valueOf(one.getClient_type()));
|
||||
e.setMobile(one.getMobile());
|
||||
e.setRec_id(Long.valueOf(one.getRec_id()));
|
||||
e.setStart_time(Long.valueOf(one.getStart_time()));
|
||||
objects.add(e);
|
||||
}
|
||||
);
|
||||
resultBean.setData(objects);
|
||||
try {
|
||||
Path write = Files.write(Paths.get("C:\\Users\\Administrator\\Desktop\\2-1.json"), JSON.toJSONString(resultBean).getBytes(), StandardOpenOption.CREATE_NEW);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.yuyou.openapi.openapi;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yuyou.openapi.openapi.model.dto.ABZMMessageDTO;
|
||||
import com.yuyou.openapi.openapi.model.pojo.ABZMLocalDTO;
|
||||
import com.yuyou.openapi.openapi.model.pojo.ResultBean;
|
||||
import com.yuyou.openapi.openapi.model.pojo.YiZaoLocalDTO;
|
||||
import com.yuyou.openapi.openapi.service.ABClientService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 掌门数据临时处理类
|
||||
*/
|
||||
@Slf4j
|
||||
public class ZMSortTest extends OpenapiApplicationTest{
|
||||
|
||||
@Autowired
|
||||
@Qualifier("ABClientServiceProxy")
|
||||
private ABClientService abClientService;
|
||||
|
||||
/**
|
||||
* 测试本地进行补推ZM质检单
|
||||
*/
|
||||
@Test
|
||||
public void testZM() throws IOException {
|
||||
List<String> list = Files.readAllLines(Paths.get("C:\\Users\\Administrator\\Desktop\\1.json"));
|
||||
list.forEach(
|
||||
each->{
|
||||
ABZMLocalDTO abzmLocalDTO = JSON.parseObject(each.trim(), ABZMLocalDTO.class);
|
||||
if (abzmLocalDTO == null) {
|
||||
log.error("Param dtos is empty");
|
||||
}
|
||||
ABZMMessageDTO abzmMessageDTO = new ABZMMessageDTO();
|
||||
if (abzmLocalDTO !=null){
|
||||
BeanUtils.copyProperties(abzmLocalDTO, abzmMessageDTO);
|
||||
abzmMessageDTO.setAppId("5aSn5Z2d56eR5oqA");
|
||||
abzmMessageDTO.setTimestamp(new Date().getTime());
|
||||
}
|
||||
if (StringUtils.isNotBlank(abzmMessageDTO.getData().getMobile())
|
||||
&& StringUtils.isNotBlank(abzmMessageDTO.getData().getName())
|
||||
&& StringUtils.isNotBlank(abzmMessageDTO.getData().getGrade())
|
||||
&& StringUtils.isNotBlank(abzmMessageDTO.getData().getCourse())
|
||||
){
|
||||
// System.out.println(abzmMessageDTO);
|
||||
boolean insert = abClientService.recordZMClientMsg(abzmMessageDTO);
|
||||
if (insert){
|
||||
log.info("success");
|
||||
}else {
|
||||
log.info("error");
|
||||
}
|
||||
}else{
|
||||
log.error("========== [insert into DB fail, this msg content is {} ] ==========",abzmMessageDTO.toString());
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue