|
@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -35,8 +34,8 @@ public class MsTripController {
|
|
@PostMapping("/home/addRibaoTrip")
|
|
@PostMapping("/home/addRibaoTrip")
|
|
public MsReport saveUser(JsonWapper jsonWapper) throws UnsupportedEncodingException {
|
|
public MsReport saveUser(JsonWapper jsonWapper) throws UnsupportedEncodingException {
|
|
//初始化今日日报
|
|
//初始化今日日报
|
|
- Long suspectedId = jsonWapper.asObject(Long.class, "suspectedId");
|
|
|
|
- Long userCreate = jsonWapper.asObject(Long.class, "userCreate");
|
|
|
|
|
|
+ Long suspectedId = jsonWapper.asObject(Long.class, "suspectedId") == null ? 0L : jsonWapper.asObject(Long.class, "suspectedId");
|
|
|
|
+ Long userCreate = jsonWapper.asObject(Long.class, "userCreate")== null ? 0L : jsonWapper.asObject(Long.class, "userCreate");
|
|
String userName = jsonWapper.asObject(String.class, "userName");
|
|
String userName = jsonWapper.asObject(String.class, "userName");
|
|
byte[] utf8Bytes = userName.getBytes("UTF-8");
|
|
byte[] utf8Bytes = userName.getBytes("UTF-8");
|
|
userName = new String(utf8Bytes, "UTF-8");
|
|
userName = new String(utf8Bytes, "UTF-8");
|
|
@@ -44,19 +43,19 @@ public class MsTripController {
|
|
Integer age = jsonWapper.asObject(Integer.class, "age");
|
|
Integer age = jsonWapper.asObject(Integer.class, "age");
|
|
String familyStatus = jsonWapper.asObject(String.class, "familyStatus");
|
|
String familyStatus = jsonWapper.asObject(String.class, "familyStatus");
|
|
String statusDesp = jsonWapper.asObject(String.class, "statusDesp");
|
|
String statusDesp = jsonWapper.asObject(String.class, "statusDesp");
|
|
- Integer medical = jsonWapper.asObject(Integer.class, "medical");
|
|
|
|
|
|
+ Integer medical = jsonWapper.asObject(Integer.class, "medical")== null ? 0: jsonWapper.asObject(Integer.class, "medical");
|
|
BigDecimal temperature = jsonWapper.asObject(BigDecimal.class, "temperature");
|
|
BigDecimal temperature = jsonWapper.asObject(BigDecimal.class, "temperature");
|
|
- Integer cough = jsonWapper.asObject(Integer.class, "cough");
|
|
|
|
- Integer muscle = jsonWapper.asObject(Integer.class, "muscle");
|
|
|
|
- Integer dyspnea = jsonWapper.asObject(Integer.class, "dyspnea");
|
|
|
|
- Integer fatigue = jsonWapper.asObject(Integer.class, "fatigue");
|
|
|
|
- Integer diarrhea = jsonWapper.asObject(Integer.class, "diarrhea");
|
|
|
|
- Integer singleRoom = jsonWapper.asObject(Integer.class, "singleRoom");
|
|
|
|
|
|
+ Integer cough = jsonWapper.asObject(Integer.class, "cough")== null ? 0: jsonWapper.asObject(Integer.class, "cough");
|
|
|
|
+ Integer muscle = jsonWapper.asObject(Integer.class, "muscle")== null ? 0: jsonWapper.asObject(Integer.class, "muscle");
|
|
|
|
+ Integer dyspnea = jsonWapper.asObject(Integer.class, "dyspnea")== null ? 0: jsonWapper.asObject(Integer.class, "dyspnea");
|
|
|
|
+ Integer fatigue = jsonWapper.asObject(Integer.class, "fatigue")== null ? 0: jsonWapper.asObject(Integer.class, "fatigue");
|
|
|
|
+ Integer diarrhea = jsonWapper.asObject(Integer.class, "diarrhea")== null ? 0: jsonWapper.asObject(Integer.class, "diarrhea");
|
|
|
|
+ Integer singleRoom = jsonWapper.asObject(Integer.class, "singleRoom")== null ? 0: jsonWapper.asObject(Integer.class, "singleRoom");
|
|
String others = jsonWapper.asObject(String.class, "others");
|
|
String others = jsonWapper.asObject(String.class, "others");
|
|
- Integer scoreRezult = jsonWapper.asObject(Integer.class, "scoreRezult");
|
|
|
|
- Integer temperatureScore = jsonWapper.asObject(Integer.class, "temperatureScore");
|
|
|
|
- Integer scoreHistroy = jsonWapper.asObject(Integer.class, "scoreHistroy");
|
|
|
|
- Integer score = jsonWapper.asObject(Integer.class, "score");
|
|
|
|
|
|
+ Integer scoreRezult = jsonWapper.asObject(Integer.class, "scoreRezult")== null ? 0: jsonWapper.asObject(Integer.class, "scoreRezult");
|
|
|
|
+ Integer temperatureScore = jsonWapper.asObject(Integer.class, "temperatureScore")== null ? 0: jsonWapper.asObject(Integer.class, "temperatureScore");
|
|
|
|
+ Integer scoreHistroy = jsonWapper.asObject(Integer.class, "scoreHistroy")== null ? 0: jsonWapper.asObject(Integer.class, "scoreHistroy");
|
|
|
|
+ Integer score = jsonWapper.asObject(Integer.class, "score")== null ? 0: jsonWapper.asObject(Integer.class, "score");
|
|
//添加出行
|
|
//添加出行
|
|
Integer workLocal = jsonWapper.asObject(Integer.class, "workLocal");
|
|
Integer workLocal = jsonWapper.asObject(Integer.class, "workLocal");
|
|
String workLocalOther = jsonWapper.asObject(String.class, "workLocalOther");
|
|
String workLocalOther = jsonWapper.asObject(String.class, "workLocalOther");
|
|
@@ -65,17 +64,19 @@ public class MsTripController {
|
|
Integer isTrip = jsonWapper.asObject(Integer.class, "isTrip");
|
|
Integer isTrip = jsonWapper.asObject(Integer.class, "isTrip");
|
|
List<MsTripDet> listTripDet = new ArrayList<>();
|
|
List<MsTripDet> listTripDet = new ArrayList<>();
|
|
MsTripDet msTripDet;
|
|
MsTripDet msTripDet;
|
|
- for (int i = 0; i < jsonWapper.asList("tripDet").size(); i++) {
|
|
|
|
- Map<String, Object> mm = (Map) jsonWapper.asList("tripDet").get(i);
|
|
|
|
- msTripDet = new MsTripDet();
|
|
|
|
- msTripDet.setSort(i);
|
|
|
|
- msTripDet.setStartLocal(Integer.parseInt(mm.get("startLocal").toString()));
|
|
|
|
- msTripDet.setStartLocalOther(mm.get("startLocalOther").toString());
|
|
|
|
- msTripDet.setEndLocal(Integer.parseInt(mm.get("endLocal").toString()));
|
|
|
|
- msTripDet.setEndLocalOther(mm.get("endLocalOther").toString());
|
|
|
|
- msTripDet.setTripType(Integer.parseInt(mm.get("tripType").toString()));
|
|
|
|
- msTripDet.setTripTypeDesp(mm.get("tripTypeOther").toString());
|
|
|
|
- listTripDet.add(msTripDet);
|
|
|
|
|
|
+ if(jsonWapper.asList("tripDet").size()>0){
|
|
|
|
+ for (int i = 0; i < jsonWapper.asList("tripDet").size(); i++) {
|
|
|
|
+ Map<String, Object> mm = (Map) jsonWapper.asList("tripDet").get(i);
|
|
|
|
+ msTripDet = new MsTripDet();
|
|
|
|
+ msTripDet.setSort(i);
|
|
|
|
+ msTripDet.setStartLocal(Integer.parseInt(mm.get("startLocal").toString()));
|
|
|
|
+ msTripDet.setStartLocalOther(mm.get("startLocalOther").toString());
|
|
|
|
+ msTripDet.setEndLocal(Integer.parseInt(mm.get("endLocal").toString()));
|
|
|
|
+ msTripDet.setEndLocalOther(mm.get("endLocalOther").toString());
|
|
|
|
+ msTripDet.setTripType(Integer.parseInt(mm.get("tripType").toString()));
|
|
|
|
+ msTripDet.setTripTypeDesp(mm.get("tripTypeDesp").toString());
|
|
|
|
+ listTripDet.add(msTripDet);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
MsReport msReport = new MsReport();
|
|
MsReport msReport = new MsReport();
|
|
Long reportId = msTripService.addSuspectedTrip(suspectedId, userName, grender, age, familyStatus, statusDesp, medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea, singleRoom, others, userCreate, scoreRezult, temperatureScore, scoreHistroy, score, workLocal, workLocalOther, todayLocal, todayLocalOther, isTrip, listTripDet);
|
|
Long reportId = msTripService.addSuspectedTrip(suspectedId, userName, grender, age, familyStatus, statusDesp, medical, temperature, cough, muscle, dyspnea, fatigue, diarrhea, singleRoom, others, userCreate, scoreRezult, temperatureScore, scoreHistroy, score, workLocal, workLocalOther, todayLocal, todayLocalOther, isTrip, listTripDet);
|