Commit dc3bf79a authored by suichenguang's avatar suichenguang

测试接口

parent 0c25abd9
...@@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -30,41 +32,50 @@ public class SelectApi { ...@@ -30,41 +32,50 @@ public class SelectApi {
@RequestMapping(value = "selectByCard") @RequestMapping(value = "selectByCard")
public String selectByCard(@RequestParam("id") String id, HttpServletResponse resp){ public String selectByCard(@RequestParam("id") String id, HttpServletResponse resp){
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
List<String> list = new ArrayList<>();
Map<String, Object> map = new HashMap<>(); 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(); YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
......
package com.yxproject.start.api.fakeApi; package com.yxproject.start.api.fakeApi;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("PackageInformation") @RequestMapping("PackageInformation")
public class PackageInformationApi { public class PackageInformationApi {
...@@ -14,66 +20,81 @@ public class PackageInformationApi { ...@@ -14,66 +20,81 @@ public class PackageInformationApi {
* @return * @return
*/ */
@RequestMapping("selectInformation") @RequestMapping("selectInformation")
public String selectInformation(@RequestBody String requestStr){ public Map<String, Object> selectInformation(@RequestBody String requestStr){
String result = Map<String,Object> map = new HashMap<>();
" {\n" + List<JSONObject> list = new ArrayList();
" commonCardCount: 2300,\n" +
" postCardCount: 1200,\n" + JSONObject jsonStr1 = new JSONObject();
" forbiddenCount: 2,\n" + jsonStr1.put("uploadNo","411032546565445");
" countyList: [\n" + jsonStr1.put("name","张三");
" {\n" + jsonStr1.put("cardId","130133195608240013");
" uploadNo: '411032546565445',\n" + jsonStr1.put("oldPackageNo ","1321454113");
" name: '张三',\n" + jsonStr1.put("newPackageNo","1213134556");
" cardId: '130133195608240013',\n" + jsonStr1.put("cardType ","普通证");
" oldPackageNo: '1321454113',\n" + list.add(jsonStr1);
" newPackageNo:'1213134556'\n" +
" cardType:'普通证'\n" + JSONObject jsonStr2 = new JSONObject();
" },\n" + jsonStr2.put("uploadNo","411032546565445");
" {\n" + jsonStr2.put("name","里斯");
" uploadNo: '411032546565445',\n" + jsonStr2.put("cardId","130133195608240013");
" name: '里斯',\n" + jsonStr2.put("oldPackageNo ","1321454113");
" cardId: '130133195608240013',\n" + jsonStr2.put("newPackageNo","1213134556");
" oldPackageNo: '1321454113',\n" + jsonStr2.put("cardType ","普通证");
" newPackageNo:'1213134556'\n" + list.add(jsonStr2);
" cardType:'普通证'\n" +
" },\n" + JSONObject jsonStr3 = new JSONObject();
" {\n" + jsonStr3.put("uploadNo","411032546565445");
" uploadNo: '411032546565445',\n" + jsonStr3.put("name","王五");
" name: '王五',\n" + jsonStr3.put("cardId","130133195608240013");
" cardId: '130133195608240013',\n" + jsonStr3.put("oldPackageNo ","1321454113");
" oldPackageNo: '1321454113',\n" + jsonStr3.put("newPackageNo","1213134556");
" newPackageNo:'1213134556'\n" + jsonStr3.put("cardType ","普通证");
" cardType:'普通证'\n" + list.add(jsonStr3);
" }\n" +
" {\n" + JSONObject jsonStr4 = new JSONObject();
" uploadNo: '411032546565445',\n" + jsonStr4.put("uploadNo","411032546565445");
" name: '张三',\n" + jsonStr4.put("name","张三");
" cardId: '130133195608240013',\n" + jsonStr4.put("cardId","130133195608240013");
" oldPackageNo: '1321454113',\n" + jsonStr4.put("oldPackageNo ","1321454113");
" newPackageNo:'1213134556'\n" + jsonStr4.put("newPackageNo","1213134556");
" cardType:'普通证'\n" + jsonStr4.put("cardType ","普通证");
" },\n" + list.add(jsonStr4);
" {\n" +
" uploadNo: '411032546565445',\n" + JSONObject jsonStr5 = new JSONObject();
" name: '里斯',\n" + jsonStr5.put("uploadNo","411032546565445");
" cardId: '130133195608240013',\n" + jsonStr5.put("name","张三");
" oldPackageNo: '1321454113',\n" + jsonStr5.put("cardId","130133195608240013");
" newPackageNo:'1213134556'\n" + jsonStr5.put("oldPackageNo ","1321454113");
" cardType:'普通证'\n" + jsonStr5.put("newPackageNo","1213134556");
" },\n" + jsonStr5.put("cardType ","普通证");
" {\n" + list.add(jsonStr5);
" uploadNo: '411032546565445',\n" +
" name: '李四',\n" + JSONObject jsonStr6 = new JSONObject();
" cardId: '130133195608240013',\n" + jsonStr6.put("uploadNo","411032546565445");
" oldPackageNo: '1321454113',\n" + jsonStr6.put("name","里斯");
" newPackageNo:'1213134556'\n" + jsonStr6.put("cardId","130133195608240013");
" cardType:'普通证'\n" + jsonStr6.put("oldPackageNo ","1321454113");
" },\n" + jsonStr6.put("newPackageNo","1213134556");
" ]\n" + jsonStr6.put("cardType ","普通证");
" },\n"; list.add(jsonStr6);
return result; 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; ...@@ -7,7 +7,8 @@ import com.yxproject.start.entity.resp.SelectByWorkOrderEntity;
public interface SelectSerialNumberService { public interface SelectSerialNumberService {
SelectByGroupNumEntity selectByGroupNumber(String id); SelectByGroupNumEntity selectByGroupNumberFromYX(String id);
SelectByGroupNumEntity selectByGroupNumberFromACC(String id);
SelectByAcceptedEntity selectByAccepted(String id); SelectByAcceptedEntity selectByAccepted(String id);
SelectByIdcardEntity selectByIdCard(String id); SelectByIdcardEntity selectByIdCard(String id);
SelectByWorkOrderEntity selectByWorkOrderNumber(String id); SelectByWorkOrderEntity selectByWorkOrderNumber(String id);
......
...@@ -21,7 +21,7 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService ...@@ -21,7 +21,7 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService
@Override @Override
public SelectByGroupNumEntity selectByGroupNumber(String id){ public SelectByGroupNumEntity selectByGroupNumberFromYX(String id){
Map<String, Object> map = selectSerialNumberMapper.selectByGroupNumber(id); Map<String, Object> map = selectSerialNumberMapper.selectByGroupNumber(id);
SelectByGroupNumEntity selectByGroupNumEntity = new SelectByGroupNumEntity(); SelectByGroupNumEntity selectByGroupNumEntity = new SelectByGroupNumEntity();
...@@ -33,7 +33,6 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService ...@@ -33,7 +33,6 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService
selectByGroupNumEntity.setTaskId(String.valueOf(map.get("TASK_ID"))); selectByGroupNumEntity.setTaskId(String.valueOf(map.get("TASK_ID")));
selectByGroupNumEntity.setGroup_No(String.valueOf(map.get("GROUP_NO"))); selectByGroupNumEntity.setGroup_No(String.valueOf(map.get("GROUP_NO")));
selectByGroupNumEntity.setSubmit_Date((Date) map.get("SUBMIT_DATE")); 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.setPosition_Date((Date) map.get("POSITION_DATE"));
selectByGroupNumEntity.setQuality_People_Name((String) map.get("QUALITY_PEOPLE_NAME")); selectByGroupNumEntity.setQuality_People_Name((String) map.get("QUALITY_PEOPLE_NAME"));
selectByGroupNumEntity.setOut_Storage_Date((Date) map.get("OUT_STORAGE_DATE")); selectByGroupNumEntity.setOut_Storage_Date((Date) map.get("OUT_STORAGE_DATE"));
...@@ -45,6 +44,31 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService ...@@ -45,6 +44,31 @@ public class SelectSerialNumberServiceImpl implements SelectSerialNumberService
return selectByGroupNumEntity; 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 @Override
public SelectByAcceptedEntity selectByAccepted(String id){ 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