Commit dc3bf79a authored by suichenguang's avatar suichenguang

测试接口

parent 0c25abd9
......@@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -30,41 +32,50 @@ public class SelectApi {
@RequestMapping(value = "selectByCard")
public String selectByCard(@RequestParam("id") String id, HttpServletResponse resp){
resp.setCharacterEncoding("UTF-8");
List<String> list = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
switch (id.length()){
case 8:
try {
SelectByGroupNumEntity specialCardInfo = selectSerialNumberService.selectByGroupNumber(id);
map.put("searchResult", specialCardInfo);
}catch (Exception e){
e.printStackTrace();
}
break;
case 10:
try {
SelectByAcceptedEntity specialCardInfo2 = selectSerialNumberService.selectByAccepted(id);
map.put("searchResult", specialCardInfo2);
}catch (Exception e){
e.printStackTrace();
}
break;
case 18:
try {
SelectByIdcardEntity specialCardInfo3 = selectSerialNumberService.selectByIdCard(id);
map.put("searchResult",specialCardInfo3);
}catch (Exception e){
e.printStackTrace();
}
break;
case 11:
try {
SelectByWorkOrderEntity specialCardInfo4 = selectSerialNumberService.selectByWorkOrderNumber(id);
map.put("searchResult",specialCardInfo4);
}catch (Exception e){
e.printStackTrace();
}
break;
if (id.length() ==11){
try {
SelectByWorkOrderEntity specialCardInfo4 = selectSerialNumberService.selectByWorkOrderNumber(id);
map.put("searchResult",specialCardInfo4);
}catch (Exception e){
e.printStackTrace();
}
}else {
switch (id.length()) {
case 8:
try {
SelectByGroupNumEntity specialCardInfo = selectSerialNumberService.selectByGroupNumberFromACC(id);
if (specialCardInfo.getGroup_No()!=null&specialCardInfo.getGroup_No()!=""){
map.put("searchResult", specialCardInfo);
}else {
SelectByGroupNumEntity selectResulr = selectSerialNumberService.selectByGroupNumberFromYX(id);
}
} catch (Exception e) {
e.printStackTrace();
}
break;
case 10:
try {
SelectByAcceptedEntity specialCardInfo2 = selectSerialNumberService.selectByAccepted(id);
map.put("searchResult", specialCardInfo2);
} catch (Exception e) {
e.printStackTrace();
}
break;
case 18:
try {
SelectByIdcardEntity specialCardInfo3 = selectSerialNumberService.selectByIdCard(id);
map.put("searchResult", specialCardInfo3);
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
......
package com.yxproject.start.api.fakeApi;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("PackageInformation")
public class PackageInformationApi {
......@@ -14,66 +20,81 @@ public class PackageInformationApi {
* @return
*/
@RequestMapping("selectInformation")
public String selectInformation(@RequestBody String requestStr){
String result =
" {\n" +
" commonCardCount: 2300,\n" +
" postCardCount: 1200,\n" +
" forbiddenCount: 2,\n" +
" countyList: [\n" +
" {\n" +
" uploadNo: '411032546565445',\n" +
" name: '张三',\n" +
" cardId: '130133195608240013',\n" +
" oldPackageNo: '1321454113',\n" +
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" +
" },\n" +
" {\n" +
" uploadNo: '411032546565445',\n" +
" name: '里斯',\n" +
" cardId: '130133195608240013',\n" +
" oldPackageNo: '1321454113',\n" +
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" +
" },\n" +
" {\n" +
" uploadNo: '411032546565445',\n" +
" name: '王五',\n" +
" cardId: '130133195608240013',\n" +
" oldPackageNo: '1321454113',\n" +
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" +
" }\n" +
" {\n" +
" uploadNo: '411032546565445',\n" +
" name: '张三',\n" +
" cardId: '130133195608240013',\n" +
" oldPackageNo: '1321454113',\n" +
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" +
" },\n" +
" {\n" +
" uploadNo: '411032546565445',\n" +
" name: '里斯',\n" +
" cardId: '130133195608240013',\n" +
" oldPackageNo: '1321454113',\n" +
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" +
" },\n" +
" {\n" +
" uploadNo: '411032546565445',\n" +
" name: '李四',\n" +
" cardId: '130133195608240013',\n" +
" oldPackageNo: '1321454113',\n" +
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" +
" },\n" +
" ]\n" +
" },\n";
return result;
public Map<String, Object> selectInformation(@RequestBody String requestStr){
Map<String,Object> map = new HashMap<>();
List<JSONObject> list = new ArrayList();
JSONObject jsonStr1 = new JSONObject();
jsonStr1.put("uploadNo","411032546565445");
jsonStr1.put("name","张三");
jsonStr1.put("cardId","130133195608240013");
jsonStr1.put("oldPackageNo ","1321454113");
jsonStr1.put("newPackageNo","1213134556");
jsonStr1.put("cardType ","普通证");
list.add(jsonStr1);
JSONObject jsonStr2 = new JSONObject();
jsonStr2.put("uploadNo","411032546565445");
jsonStr2.put("name","里斯");
jsonStr2.put("cardId","130133195608240013");
jsonStr2.put("oldPackageNo ","1321454113");
jsonStr2.put("newPackageNo","1213134556");
jsonStr2.put("cardType ","普通证");
list.add(jsonStr2);
JSONObject jsonStr3 = new JSONObject();
jsonStr3.put("uploadNo","411032546565445");
jsonStr3.put("name","王五");
jsonStr3.put("cardId","130133195608240013");
jsonStr3.put("oldPackageNo ","1321454113");
jsonStr3.put("newPackageNo","1213134556");
jsonStr3.put("cardType ","普通证");
list.add(jsonStr3);
JSONObject jsonStr4 = new JSONObject();
jsonStr4.put("uploadNo","411032546565445");
jsonStr4.put("name","张三");
jsonStr4.put("cardId","130133195608240013");
jsonStr4.put("oldPackageNo ","1321454113");
jsonStr4.put("newPackageNo","1213134556");
jsonStr4.put("cardType ","普通证");
list.add(jsonStr4);
JSONObject jsonStr5 = new JSONObject();
jsonStr5.put("uploadNo","411032546565445");
jsonStr5.put("name","张三");
jsonStr5.put("cardId","130133195608240013");
jsonStr5.put("oldPackageNo ","1321454113");
jsonStr5.put("newPackageNo","1213134556");
jsonStr5.put("cardType ","普通证");
list.add(jsonStr5);
JSONObject jsonStr6 = new JSONObject();
jsonStr6.put("uploadNo","411032546565445");
jsonStr6.put("name","里斯");
jsonStr6.put("cardId","130133195608240013");
jsonStr6.put("oldPackageNo ","1321454113");
jsonStr6.put("newPackageNo","1213134556");
jsonStr6.put("cardType ","普通证");
list.add(jsonStr6);
JSONObject jsonStr7 = new JSONObject();
jsonStr7.put("uploadNo","411032546565445");
jsonStr7.put("name","李四");
jsonStr7.put("cardId","130133195608240013");
jsonStr7.put("oldPackageNo ","1321454113");
jsonStr7.put("newPackageNo","1213134556");
jsonStr7.put("cardType ","普通证");
list.add(jsonStr7);
map.put("commonCardCount",2300);
map.put("postCardCount",1200);
map.put("forbiddenCount",2);
map.put("list",list);
return map;
}
}
......@@ -7,7 +7,8 @@ import com.yxproject.start.entity.resp.SelectByWorkOrderEntity;
public interface SelectSerialNumberService {
SelectByGroupNumEntity selectByGroupNumber(String id);
SelectByGroupNumEntity selectByGroupNumberFromYX(String id);
SelectByGroupNumEntity selectByGroupNumberFromACC(String id);
SelectByAcceptedEntity selectByAccepted(String id);
SelectByIdcardEntity selectByIdCard(String id);
SelectByWorkOrderEntity selectByWorkOrderNumber(String id);
......
......@@ -21,7 +21,7 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService
@Override
public SelectByGroupNumEntity selectByGroupNumber(String id){
public SelectByGroupNumEntity selectByGroupNumberFromYX(String id){
Map<String, Object> map = selectSerialNumberMapper.selectByGroupNumber(id);
SelectByGroupNumEntity selectByGroupNumEntity = new SelectByGroupNumEntity();
......@@ -33,7 +33,6 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService
selectByGroupNumEntity.setTaskId(String.valueOf(map.get("TASK_ID")));
selectByGroupNumEntity.setGroup_No(String.valueOf(map.get("GROUP_NO")));
selectByGroupNumEntity.setSubmit_Date((Date) map.get("SUBMIT_DATE"));
System.out.println("Date:"+selectByGroupNumEntity.getSubmit_Date().toString());
selectByGroupNumEntity.setPosition_Date((Date) map.get("POSITION_DATE"));
selectByGroupNumEntity.setQuality_People_Name((String) map.get("QUALITY_PEOPLE_NAME"));
selectByGroupNumEntity.setOut_Storage_Date((Date) map.get("OUT_STORAGE_DATE"));
......@@ -45,6 +44,31 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService
return selectByGroupNumEntity;
}
@Override
public SelectByGroupNumEntity selectByGroupNumberFromACC(String id){
Map<String, Object> map = selectSerialNumberMapper.selectByGroupNumber(id);
SelectByGroupNumEntity selectByGroupNumEntity = new SelectByGroupNumEntity();
try {
selectByGroupNumEntity.setLibrary("受理库");
selectByGroupNumEntity.setCityName(String.valueOf(map.get("CITYNAME")));
selectByGroupNumEntity.setCardType((String) map.get("CARD_TYPE"));
selectByGroupNumEntity.setPainterName((String) map.get("PRINTER_NAME"));
selectByGroupNumEntity.setTaskId(String.valueOf(map.get("TASK_ID")));
selectByGroupNumEntity.setGroup_No(String.valueOf(map.get("GROUP_NO")));
selectByGroupNumEntity.setSubmit_Date((Date) map.get("SUBMIT_DATE"));
selectByGroupNumEntity.setPosition_Date((Date) map.get("POSITION_DATE"));
selectByGroupNumEntity.setQuality_People_Name((String) map.get("QUALITY_PEOPLE_NAME"));
selectByGroupNumEntity.setOut_Storage_Date((Date) map.get("OUT_STORAGE_DATE"));
selectByGroupNumEntity.setIn_Storage_Date((Date) map.get("IN_STORAGE_DATE"));
selectByGroupNumEntity.setException_Information((String) map.get("EXCEPTION_INFORMATION"));
}catch (NullPointerException e){
e.printStackTrace();
}
return selectByGroupNumEntity;
}
@Override
public SelectByAcceptedEntity selectByAccepted(String id){
......
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