|
@@ -12,13 +12,19 @@ import com.chuanghai.repair.service.RepairsStudentService;
|
|
|
import com.chuanghai.repair.service.RepairsWorkService;
|
|
import com.chuanghai.repair.service.RepairsWorkService;
|
|
|
import com.chuanghai.repair.utils.CreateTokenUtil;
|
|
import com.chuanghai.repair.utils.CreateTokenUtil;
|
|
|
import com.chuanghai.repair.utils.DateUtils;
|
|
import com.chuanghai.repair.utils.DateUtils;
|
|
|
|
|
+import com.chuanghai.repair.utils.MyPageInfo;
|
|
|
import com.chuanghai.repair.utils.ReturnValueUtil;
|
|
import com.chuanghai.repair.utils.ReturnValueUtil;
|
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.JsonSyntaxException;
|
|
import com.google.gson.JsonSyntaxException;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.ibatis.annotations.Delete;
|
|
|
|
|
+import org.apache.ibatis.annotations.Update;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
@@ -82,10 +88,12 @@ public class OrderController {
|
|
|
//通过传入的时间参数 获取当天-明天 时间
|
|
//通过传入的时间参数 获取当天-明天 时间
|
|
|
DateUtils dateUtils = new DateUtils();
|
|
DateUtils dateUtils = new DateUtils();
|
|
|
dateUtils.addOneDay(time);
|
|
dateUtils.addOneDay(time);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (orderStatus.equals("0") || orderStatus.equals("4")) { //查询新订单
|
|
if (orderStatus.equals("0") || orderStatus.equals("4")) { //查询新订单
|
|
|
pageInfoOrder = repairsOrderService.queryAllNewBackOrder(pageNum, pageSize, dateUtils.getTody(), dateUtils.getTomorrow(), orderStatus);
|
|
pageInfoOrder = repairsOrderService.queryAllNewBackOrder(pageNum, pageSize, dateUtils.getTody(), dateUtils.getTomorrow(), orderStatus);
|
|
|
|
|
|
|
|
- } else { //查询 1 2 3 4 状态的订单
|
|
|
|
|
|
|
+ } else { //查询 1 2 3 状态的订单
|
|
|
pageInfoOrder = repairsOrderService.queryAllOrderByDate(pageNum, pageSize, dateUtils.getTody(), dateUtils.getTomorrow(), orderStatus);
|
|
pageInfoOrder = repairsOrderService.queryAllOrderByDate(pageNum, pageSize, dateUtils.getTody(), dateUtils.getTomorrow(), orderStatus);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -153,7 +161,8 @@ public class OrderController {
|
|
|
@PostMapping(value = "/queryAllOrderByAdvice")
|
|
@PostMapping(value = "/queryAllOrderByAdvice")
|
|
|
public ReturnValueUtil queryAllOrderByAdvice(@ApiParam(name = "查询日期") String time,
|
|
public ReturnValueUtil queryAllOrderByAdvice(@ApiParam(name = "查询日期") String time,
|
|
|
@ApiParam(name = "当前页码") Integer pageNum,
|
|
@ApiParam(name = "当前页码") Integer pageNum,
|
|
|
- @ApiParam(name = "每页记录数") Integer pageSize) {
|
|
|
|
|
|
|
+ @ApiParam(name = "每页记录数") Integer pageSize,
|
|
|
|
|
+ @ApiParam(name = "维修工ID") String workId) {
|
|
|
pageNum = pageNum == null ? 1 : pageNum;
|
|
pageNum = pageNum == null ? 1 : pageNum;
|
|
|
pageSize = pageSize == null ? 5 : pageSize;
|
|
pageSize = pageSize == null ? 5 : pageSize;
|
|
|
PageInfo<RepairsOrder> pageInfoOrder = null;
|
|
PageInfo<RepairsOrder> pageInfoOrder = null;
|
|
@@ -161,7 +170,11 @@ public class OrderController {
|
|
|
//通过传入的时间参数 获取当天-明天 时间
|
|
//通过传入的时间参数 获取当天-明天 时间
|
|
|
DateUtils dateUtils = new DateUtils();
|
|
DateUtils dateUtils = new DateUtils();
|
|
|
dateUtils.addOneDay(time);
|
|
dateUtils.addOneDay(time);
|
|
|
- pageInfoOrder = repairsOrderService.queryAllOrderByAdvice(dateUtils.getTody(), dateUtils.getTomorrow(), null, pageNum, pageSize);
|
|
|
|
|
|
|
+ if (workId != null){
|
|
|
|
|
+ pageInfoOrder = repairsOrderService.queryAllOrderByAdvice(dateUtils.getTody(), dateUtils.getTomorrow(), workId, pageNum, pageSize);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ pageInfoOrder = repairsOrderService.queryAllOrderByAdvice(dateUtils.getTody(), dateUtils.getTomorrow(), null, pageNum, pageSize);
|
|
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
@@ -261,15 +274,14 @@ public class OrderController {
|
|
|
public ReturnValueUtil queryAllOrderByStudentId(HttpServletRequest request,
|
|
public ReturnValueUtil queryAllOrderByStudentId(HttpServletRequest request,
|
|
|
@ApiParam(name = "当前页码") Integer pageNum,
|
|
@ApiParam(name = "当前页码") Integer pageNum,
|
|
|
@ApiParam(name = "每页记录数") Integer pageSize) {
|
|
@ApiParam(name = "每页记录数") Integer pageSize) {
|
|
|
- PageInfo<RepairsOrder> pageInfoOrder = null;
|
|
|
|
|
|
|
+ MyPageInfo<RepairsOrder> pageInfoOrder = null;
|
|
|
pageNum = pageNum == null ? 1 : pageNum;
|
|
pageNum = pageNum == null ? 1 : pageNum;
|
|
|
pageSize = pageSize == null ? 5 : pageSize;
|
|
pageSize = pageSize == null ? 5 : pageSize;
|
|
|
try {
|
|
try {
|
|
|
String studentId = CreateTokenUtil.getHeadersInfo(request); //从请求头中获取 studentId
|
|
String studentId = CreateTokenUtil.getHeadersInfo(request); //从请求头中获取 studentId
|
|
|
- RepairsStudent repairsStudent = repairsStudentService.queryByStudentId(studentId);
|
|
|
|
|
- String campus = repairsStudent.getStudentCampus();
|
|
|
|
|
- pageInfoOrder = repairsOrderService.queryAllOrderById(pageNum, pageSize, studentId, null, campus);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // RepairsStudent repairsStudent = repairsStudentService.queryByStudentId(studentId);
|
|
|
|
|
+ // String campus = repairsStudent.getStudentCampus();
|
|
|
|
|
+ pageInfoOrder = repairsOrderService.queryAllOrderByIdMyPageInfo(pageNum, pageSize, studentId, null, null);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
@@ -291,9 +303,9 @@ public class OrderController {
|
|
|
pageSize = pageSize == null ? 5 : pageSize;
|
|
pageSize = pageSize == null ? 5 : pageSize;
|
|
|
try {
|
|
try {
|
|
|
String workId = CreateTokenUtil.getHeadersInfo(request);
|
|
String workId = CreateTokenUtil.getHeadersInfo(request);
|
|
|
- RepairsWork repairsWork = repairsWorkService.queryByWorkId(workId);
|
|
|
|
|
- String campus = repairsWork.getWorkCampus();
|
|
|
|
|
- pageInfoOrder = repairsOrderService.queryAllOrderById(pageNum, pageSize, null, workId, campus);
|
|
|
|
|
|
|
+ // RepairsWork repairsWork = repairsWorkService.queryByWorkId(workId);
|
|
|
|
|
+ // String campus = repairsWork.getWorkCampus();
|
|
|
|
|
+ pageInfoOrder = repairsOrderService.queryAllOrderByWorkId(pageNum, pageSize, null, workId, null);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -315,7 +327,6 @@ public class OrderController {
|
|
|
@ApiParam(name = "订单评价", required = true) String orderAdvice) {
|
|
@ApiParam(name = "订单评价", required = true) String orderAdvice) {
|
|
|
|
|
|
|
|
Boolean flag = Boolean.FALSE;
|
|
Boolean flag = Boolean.FALSE;
|
|
|
- System.out.println(orderId + " " + orderAdvice);
|
|
|
|
|
try {
|
|
try {
|
|
|
if (!orderAdvice.equals("")) {
|
|
if (!orderAdvice.equals("")) {
|
|
|
repairsOrderService.updateOrderAdvice(orderId, orderAdvice);
|
|
repairsOrderService.updateOrderAdvice(orderId, orderAdvice);
|
|
@@ -338,20 +349,8 @@ public class OrderController {
|
|
|
public ReturnValueUtil queryByOrderId(@ApiParam(name = "订单ID", required = true) String orderId) {
|
|
public ReturnValueUtil queryByOrderId(@ApiParam(name = "订单ID", required = true) String orderId) {
|
|
|
RepairsOrder repairsOrder = null;
|
|
RepairsOrder repairsOrder = null;
|
|
|
try {
|
|
try {
|
|
|
- if (!orderId.equals("")) {
|
|
|
|
|
|
|
+ if (!orderId.equals("") && orderId != null) {
|
|
|
repairsOrder = repairsOrderService.queryByOrderId(orderId);
|
|
repairsOrder = repairsOrderService.queryByOrderId(orderId);
|
|
|
- if (repairsOrder.getOrderImages() != null) {
|
|
|
|
|
- String imageName = repairsOrder.getOrderImages();
|
|
|
|
|
- String imageUrl = "";
|
|
|
|
|
- if (StringUtils.hasText(imageName)) {
|
|
|
|
|
- String[] imageUrls = imageName.split(";");
|
|
|
|
|
- for (String s : imageUrls) {
|
|
|
|
|
- imageUrl += imgConfig.getShowHost() + s + ";";
|
|
|
|
|
- }
|
|
|
|
|
- repairsOrder.setOrderImages(imageUrl.substring(0, imageUrl.lastIndexOf(";")));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -373,71 +372,109 @@ public class OrderController {
|
|
|
try {
|
|
try {
|
|
|
if (!orderId.equals("")) {
|
|
if (!orderId.equals("")) {
|
|
|
repairsOrder = repairsOrderService.queryByOrderIdNotWork(orderId);
|
|
repairsOrder = repairsOrderService.queryByOrderIdNotWork(orderId);
|
|
|
- if (repairsOrder.getOrderImages() != null) {
|
|
|
|
|
- String imageName = repairsOrder.getOrderImages();
|
|
|
|
|
- String imageUrl = "";
|
|
|
|
|
- if (StringUtils.hasText(imageName)) {
|
|
|
|
|
- String[] imageUrls = imageName.split(";");
|
|
|
|
|
- for (String s : imageUrls) {
|
|
|
|
|
- imageUrl += imgConfig.getShowHost() + s + ";";
|
|
|
|
|
- }
|
|
|
|
|
- repairsOrder.setOrderImages(imageUrl.substring(0, imageUrl.lastIndexOf(";")));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
return ReturnValueUtil.returnObject(repairsOrder);
|
|
return ReturnValueUtil.returnObject(repairsOrder);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation("学生:删除报修订单")
|
|
|
|
|
+ @PostMapping("/deleteOrderById")
|
|
|
|
|
+ public ReturnValueUtil deleteOrderById(HttpServletRequest request, String orderId) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String cardNumber = CreateTokenUtil.getHeadersInfo(request);
|
|
|
|
|
+ RepairsOrder repairsOrder = new RepairsOrder();
|
|
|
|
|
+ repairsOrder.setOrderId(orderId);
|
|
|
|
|
+ //orderStatus = 5 表示该订单为删除状态
|
|
|
|
|
+ repairsOrder.setOrderStatus("5");
|
|
|
|
|
+ repairsOrderService.updateOrderdetail(repairsOrder);
|
|
|
|
|
+ return ReturnValueUtil.ok();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ return ReturnValueUtil.fail("订单删除失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 已经接单之后无法修改订单
|
|
|
|
|
+ * @param request
|
|
|
|
|
+ * @param jsonObject
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("学生:修改报修订单")
|
|
|
|
|
+ @PostMapping("/updateOrderById")
|
|
|
|
|
+ public ReturnValueUtil updateOrderById(HttpServletRequest request, @RequestBody JSONObject jsonObject) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String cardNumber = CreateTokenUtil.getHeadersInfo(request);
|
|
|
|
|
+ RepairsOrder repairsOrder = JSONObject.toJavaObject(jsonObject, RepairsOrder.class);
|
|
|
|
|
+ RepairsOrder repairsOrderBase = repairsOrderService.queryByOrderId(cardNumber);
|
|
|
|
|
+ repairsOrder.setOrderId(cardNumber);
|
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
+ Map<String, Object> jsonMap = mapper.readValue(jsonObject.toString(), new TypeReference<Map<String, Object>>() {});
|
|
|
|
|
+ String faultId = "";
|
|
|
|
|
+ if (jsonMap.get("faultId") != null ){
|
|
|
|
|
+ faultId = jsonMap.get("faultId").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ RepairsFault repairsFault = new RepairsFault();
|
|
|
|
|
+ repairsFault.setFaultId(Integer.parseInt(faultId));
|
|
|
|
|
+ repairsOrder.setRepairsFault(repairsFault);
|
|
|
|
|
+ repairsOrderService.updateOrderdetail(repairsOrder);
|
|
|
|
|
+ return ReturnValueUtil.ok();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ return ReturnValueUtil.fail("订单更新失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@ApiOperation("学生:订单填报")
|
|
@ApiOperation("学生:订单填报")
|
|
|
@PostMapping(value = "/insertOrder")
|
|
@PostMapping(value = "/insertOrder")
|
|
|
public ReturnValueUtil insertOrder(HttpServletRequest request, @RequestBody JSONObject jsonParam) {
|
|
public ReturnValueUtil insertOrder(HttpServletRequest request, @RequestBody JSONObject jsonParam) {
|
|
|
|
|
+
|
|
|
String cardNumber = CreateTokenUtil.getHeadersInfo(request);
|
|
String cardNumber = CreateTokenUtil.getHeadersInfo(request);
|
|
|
RepairsStudent repairsStudent = new RepairsStudent();
|
|
RepairsStudent repairsStudent = new RepairsStudent();
|
|
|
String faultId = "";
|
|
String faultId = "";
|
|
|
String orderNote = "";
|
|
String orderNote = "";
|
|
|
String orderExpectedTime = "";
|
|
String orderExpectedTime = "";
|
|
|
- List<String> images = new ArrayList<>();
|
|
|
|
|
|
|
+ String orderImages = "";
|
|
|
Boolean flag = Boolean.FALSE;
|
|
Boolean flag = Boolean.FALSE;
|
|
|
- FileOutputStream fos = null;
|
|
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
//开始转换
|
|
//开始转换
|
|
|
Iterator it = jsonParam.entrySet().iterator();
|
|
Iterator it = jsonParam.entrySet().iterator();
|
|
|
while (it.hasNext()) {
|
|
while (it.hasNext()) {
|
|
|
- Map.Entry<String, Object> entry = (Map.Entry<String, Object>) it.next();
|
|
|
|
|
|
|
+ Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
|
|
|
repairsStudent.setStudentId(cardNumber);
|
|
repairsStudent.setStudentId(cardNumber);
|
|
|
if (entry.getKey().equals("dormNumber")) {
|
|
if (entry.getKey().equals("dormNumber")) {
|
|
|
- repairsStudent.setDormNumber((String) entry.getValue());
|
|
|
|
|
|
|
+ repairsStudent.setDormNumber(entry.getValue());
|
|
|
}
|
|
}
|
|
|
if (entry.getKey().equals("studentDormitory")) {
|
|
if (entry.getKey().equals("studentDormitory")) {
|
|
|
- repairsStudent.setDormNumber((String) entry.getValue());
|
|
|
|
|
|
|
+ repairsStudent.setStudentDormitory(entry.getValue());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (entry.getKey().equals("studentPhone")) {
|
|
|
|
|
+ repairsStudent.setStudentPhone(entry.getValue());
|
|
|
}
|
|
}
|
|
|
if (entry.getKey().equals("otherPhone")) {
|
|
if (entry.getKey().equals("otherPhone")) {
|
|
|
- repairsStudent.setDormNumber((String) entry.getValue());
|
|
|
|
|
|
|
+ repairsStudent.setStudentOtherPhone(entry.getValue());
|
|
|
}
|
|
}
|
|
|
if (entry.getKey().equals("faultId")) {
|
|
if (entry.getKey().equals("faultId")) {
|
|
|
- faultId = (String) entry.getValue();
|
|
|
|
|
|
|
+ faultId = entry.getValue();
|
|
|
}
|
|
}
|
|
|
if (entry.getKey().equals("orderNote")) {
|
|
if (entry.getKey().equals("orderNote")) {
|
|
|
- orderNote = (String) entry.getValue();
|
|
|
|
|
|
|
+ orderNote = entry.getValue();
|
|
|
}
|
|
}
|
|
|
if (entry.getKey().equals("orderExpectedTime")) {
|
|
if (entry.getKey().equals("orderExpectedTime")) {
|
|
|
- orderExpectedTime = (String) entry.getValue();
|
|
|
|
|
|
|
+ orderExpectedTime = entry.getValue();
|
|
|
}
|
|
}
|
|
|
- if (entry.getKey().equals("imageFiles")) {
|
|
|
|
|
- images = (List<String>) entry.getValue();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- ArrayList<RepairsStudent> repairsStudentList = new ArrayList<>();
|
|
|
|
|
- repairsStudentList.add(repairsStudent);
|
|
|
|
|
- repairsStudentService.updateStudent(repairsStudentList);
|
|
|
|
|
|
|
|
|
|
|
|
+ if (entry.getKey().equals("orderImages")) {
|
|
|
|
|
+ orderImages = entry.getValue();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ ArrayList<RepairsStudent> repairsStudentList = new ArrayList<>();
|
|
|
|
|
+ repairsStudentList.add(repairsStudent);
|
|
|
|
|
+ // repairsStudentService.updateStudent(repairsStudentList);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
//处理当前时间为时间戳格式
|
|
//处理当前时间为时间戳格式
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
Calendar calendar = Calendar.getInstance();
|
|
@@ -447,137 +484,62 @@ public class OrderController {
|
|
|
String orderId = "D";
|
|
String orderId = "D";
|
|
|
orderId += String.valueOf(ts);
|
|
orderId += String.valueOf(ts);
|
|
|
RepairsWork repairsWork = null;
|
|
RepairsWork repairsWork = null;
|
|
|
- RepairsFault repairsFault = new RepairsFault(Integer.parseInt(faultId), null, null, null, null);
|
|
|
|
|
- //获取原始图片的拓展名
|
|
|
|
|
- String fileNameSaveUrl = "";
|
|
|
|
|
- String base64Data = "";
|
|
|
|
|
- for (String image:images) {
|
|
|
|
|
- base64Data = image.split(",")[1];
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 2.解码成字节数组
|
|
|
|
|
- */
|
|
|
|
|
- Base64.Decoder decoder = Base64.getDecoder();
|
|
|
|
|
- byte[] bytes = decoder.decode(base64Data);
|
|
|
|
|
- /**
|
|
|
|
|
- * 3.字节流转文件
|
|
|
|
|
- */
|
|
|
|
|
- String fileNameUrl = UUID.randomUUID().toString().replaceAll("-", "")+ ".jpg";
|
|
|
|
|
- fileNameSaveUrl +=fileNameUrl+";";
|
|
|
|
|
-
|
|
|
|
|
- fos = new FileOutputStream(imgConfig.getSaveLocation() + fileNameUrl);
|
|
|
|
|
- fos.write(bytes);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- fileNameSaveUrl = fileNameSaveUrl.substring(0, fileNameSaveUrl.lastIndexOf(";"));
|
|
|
|
|
- RepairsOrder repairsOrder = new RepairsOrder(orderId, fileNameSaveUrl, orderNote, orderExpectedTime,
|
|
|
|
|
- null, date,null, null, "0", null, "0",
|
|
|
|
|
|
|
+ RepairsFault repairsFault = new RepairsFault(Integer.parseInt(faultId), null, null, null, null);
|
|
|
|
|
+ RepairsOrder repairsOrder = new RepairsOrder(orderId, orderImages, orderNote, orderExpectedTime,
|
|
|
|
|
+ null, date, null, null, "0", null, "0",
|
|
|
null, repairsStudent, repairsWork, repairsFault);
|
|
null, repairsStudent, repairsWork, repairsFault);
|
|
|
repairsOrderService.insertOrder(repairsOrder);
|
|
repairsOrderService.insertOrder(repairsOrder);
|
|
|
flag = Boolean.TRUE;
|
|
flag = Boolean.TRUE;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
- } finally {
|
|
|
|
|
- if (fos != null) {
|
|
|
|
|
- try {
|
|
|
|
|
- fos.close();
|
|
|
|
|
- } catch (IOException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ return ReturnValueUtil.returnBoolean(flag);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param
|
|
|
|
|
+ * @param orderImages
|
|
|
|
|
+ * @return ReturnValueUtil
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("学生:故障图片上传")
|
|
|
|
|
+ @PostMapping(value = "/uploadImage")
|
|
|
|
|
+ public ReturnValueUtil uploadImage(@ApiParam(name = "故障图片 ") List<MultipartFile> orderImages) {
|
|
|
|
|
+ String fileNameSaveUrl = "";
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (orderImages != null) {
|
|
|
|
|
+ for (MultipartFile orderImage : orderImages) {
|
|
|
|
|
+ if (!orderImage.isEmpty()) {
|
|
|
|
|
+ String originalFilename = orderImage.getOriginalFilename();
|
|
|
|
|
+ int index = originalFilename.lastIndexOf('.') + 1;//获取地址.的前面的数字,从0开始
|
|
|
|
|
+ //图片的文件名称
|
|
|
|
|
+ String fileNameUrl = UUID.randomUUID().toString().replaceAll("-", "") + originalFilename + ";";
|
|
|
|
|
+ //图片在数据库保存的名称
|
|
|
|
|
+ fileNameSaveUrl += imgConfig.getShowHost() + fileNameUrl;
|
|
|
|
|
+ fileNameUrl = fileNameUrl.substring(0, fileNameUrl.lastIndexOf(";"));
|
|
|
|
|
+ //保存图片的路径(这是存在我项目中的images下了,你们可以设置路径)
|
|
|
|
|
+ String filePath = imgConfig.getSaveLocation();
|
|
|
|
|
+ //生成新文件名字 封装上传文件位置的全路径
|
|
|
|
|
+ File targetFile = new File(filePath, fileNameUrl);
|
|
|
|
|
+ //把本地文件上传到封装上传文件位置的全路径
|
|
|
|
|
+ orderImage.transferTo(targetFile);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ fileNameSaveUrl = fileNameSaveUrl.substring(0, fileNameSaveUrl.lastIndexOf(";"));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ReturnValueUtil.ok("用户没有提交图片");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return ReturnValueUtil.fail("图片上传失败");
|
|
|
}
|
|
}
|
|
|
- return ReturnValueUtil.returnBoolean(flag);
|
|
|
|
|
|
|
+ return ReturnValueUtil.ok(fileNameSaveUrl);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 获取请求头中的access_token解码的到card_number学生ID,将获取的订单信息新增到订单表中
|
|
|
|
|
-// *
|
|
|
|
|
-// * @param request
|
|
|
|
|
-// * @param orderExpectedTime
|
|
|
|
|
-// * @param faultId
|
|
|
|
|
-// * @param otherPhone
|
|
|
|
|
-// * @param dormNumber
|
|
|
|
|
-// * @param orderNote
|
|
|
|
|
-// * @param file
|
|
|
|
|
-// * @return ReturnValueUtil
|
|
|
|
|
-// */
|
|
|
|
|
-// @ApiOperation("学生:订单填报")
|
|
|
|
|
-// @PostMapping(value = "/insertOrder")
|
|
|
|
|
-// public ReturnValueUtil insertOrder(HttpServletRequest request,
|
|
|
|
|
-// @ApiParam(name = "维修期望时间", required = true) String orderExpectedTime,
|
|
|
|
|
-// @ApiParam(name = "故障类型ID", required = true) Integer faultId,
|
|
|
|
|
-// @ApiParam(name = "备选电话", required = true) String otherPhone,
|
|
|
|
|
-// @ApiParam(name = "学生宿舍", required = true) String dormNumber,
|
|
|
|
|
-// @ApiParam(name = "楼栋楼层房间ID拼接1-2-10(1栋2层205)", required = true) String studentDormitory,
|
|
|
|
|
-// @ApiParam(name = "订单备注") String orderNote,
|
|
|
|
|
-// @ApiParam(name = "故障图片 ") List<MultipartFile> file) {
|
|
|
|
|
-// Boolean flag = Boolean.FALSE;
|
|
|
|
|
-// try {
|
|
|
|
|
-// String cardNumber = CreateTokenUtil.getHeadersInfo(request);
|
|
|
|
|
-// RepairsStudent repairsStudent = new RepairsStudent();
|
|
|
|
|
-// repairsStudent.setStudentId(cardNumber);
|
|
|
|
|
-// repairsStudent.setDormNumber(dormNumber);
|
|
|
|
|
-// repairsStudent.setStudentDormitory(studentDormitory);
|
|
|
|
|
-// repairsStudent.setStudentOtherPhone(otherPhone);
|
|
|
|
|
-// ArrayList<RepairsStudent> repairsStudentList = new ArrayList<>();
|
|
|
|
|
-// repairsStudentList.add(repairsStudent);
|
|
|
|
|
-// repairsStudentService.updateStudent(repairsStudentList);
|
|
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
-// //处理当前时间为时间戳格式
|
|
|
|
|
-// Calendar calendar = Calendar.getInstance();
|
|
|
|
|
-// String orderTime = sdf.format(calendar.getTime());
|
|
|
|
|
-// Date date = sdf.parse(orderTime);
|
|
|
|
|
-// long ts = date.getTime();
|
|
|
|
|
-// String orderId = "D";
|
|
|
|
|
-// orderId += String.valueOf(ts);
|
|
|
|
|
-// RepairsWork repairsWork = null;
|
|
|
|
|
-// RepairsFault repairsFault = new RepairsFault(faultId, null, null, null, null);
|
|
|
|
|
-// //获取原始图片的拓展名
|
|
|
|
|
-// String fileNameSaveUrl = "";
|
|
|
|
|
-// String type = "";
|
|
|
|
|
-// RepairsOrder repairsOrder = new RepairsOrder(orderId, null, orderNote, orderExpectedTime,
|
|
|
|
|
-// null, date, null, "0", null, "0",
|
|
|
|
|
-// null, repairsStudent, repairsWork, repairsFault);
|
|
|
|
|
-// if (file == null) {
|
|
|
|
|
-// repairsOrderService.insertOrder(repairsOrder);
|
|
|
|
|
-// flag = Boolean.TRUE;
|
|
|
|
|
-// } else {
|
|
|
|
|
-// for (MultipartFile imageFile : file) {
|
|
|
|
|
-// String originalFilename = imageFile.getOriginalFilename();
|
|
|
|
|
-// int index = originalFilename.lastIndexOf('.') + 1;//获取地址.的前面的数字,从0开始
|
|
|
|
|
-// type = originalFilename.substring(index);//从地址.开始截取后缀
|
|
|
|
|
-// //图片的文件名称
|
|
|
|
|
-// String fileNameUrl = UUID.randomUUID().toString().replaceAll("-", "") + originalFilename + ";";
|
|
|
|
|
-// //图片在数据库保存的名称
|
|
|
|
|
-// fileNameSaveUrl += fileNameUrl;
|
|
|
|
|
-// fileNameUrl = fileNameUrl.substring(0, fileNameUrl.lastIndexOf(";"));
|
|
|
|
|
-// //保存图片的路径(这是存在我项目中的images下了,你们可以设置路径)
|
|
|
|
|
-// String filePath = imgConfig.getSaveLocation();
|
|
|
|
|
-// //生成新文件名字 封装上传文件位置的全路径
|
|
|
|
|
-// File targetFile = new File(filePath, fileNameUrl);
|
|
|
|
|
-// //把本地文件上传到封装上传文件位置的全路径
|
|
|
|
|
-// imageFile.transferTo(targetFile);
|
|
|
|
|
-// }
|
|
|
|
|
-// fileNameSaveUrl = fileNameSaveUrl.substring(0, fileNameSaveUrl.lastIndexOf(";"));
|
|
|
|
|
-// repairsOrder.setOrderImages(fileNameSaveUrl);
|
|
|
|
|
-// if (type.equals("jpg") || type.equals("jpeg") || type.equals("png")
|
|
|
|
|
-// || type.equals("JPG") || type.equals("JPEG") || type.equals("PNG")) {
|
|
|
|
|
-// if (!fileNameSaveUrl.equals("")) {
|
|
|
|
|
-// repairsOrder.setOrderImages(fileNameSaveUrl);
|
|
|
|
|
-// repairsOrderService.insertOrder(repairsOrder);
|
|
|
|
|
-// flag = Boolean.TRUE;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
|
-// e.printStackTrace();
|
|
|
|
|
-// }
|
|
|
|
|
-// return ReturnValueUtil.returnBoolean(flag);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 修改订单状态 已完成 orderStatus = 3
|
|
* 修改订单状态 已完成 orderStatus = 3
|
|
@@ -594,9 +556,16 @@ public class OrderController {
|
|
|
//当workId不为null时 数据库不会执行更新workId的sql
|
|
//当workId不为null时 数据库不会执行更新workId的sql
|
|
|
RepairsWork repairsWork = new RepairsWork();
|
|
RepairsWork repairsWork = new RepairsWork();
|
|
|
repairsWork.setWorkId(1);
|
|
repairsWork.setWorkId(1);
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ //处理当前时间
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
|
+ String orderTime = sdf.format(calendar.getTime());
|
|
|
|
|
+ //传入时间就设置为当天时间
|
|
|
|
|
+ Date timeDate = sdf.parse(orderTime);
|
|
|
|
|
+
|
|
|
if (!orderId.equals("")) {
|
|
if (!orderId.equals("")) {
|
|
|
RepairsOrder repairsOrder = new RepairsOrder(orderId, null, null, null,
|
|
RepairsOrder repairsOrder = new RepairsOrder(orderId, null, null, null,
|
|
|
- null,null, null, null, "3", null,
|
|
|
|
|
|
|
+ timeDate, null, null, null, "3", null,
|
|
|
null, null, null, repairsWork, null);
|
|
null, null, null, repairsWork, null);
|
|
|
ArrayList<RepairsOrder> orderArrayList = new ArrayList<>();
|
|
ArrayList<RepairsOrder> orderArrayList = new ArrayList<>();
|
|
|
orderArrayList.add(repairsOrder);
|
|
orderArrayList.add(repairsOrder);
|
|
@@ -623,11 +592,10 @@ public class OrderController {
|
|
|
public ReturnValueUtil updateOrderRefused(@ApiParam(name = "订单ID", required = true) String orderId) {
|
|
public ReturnValueUtil updateOrderRefused(@ApiParam(name = "订单ID", required = true) String orderId) {
|
|
|
Boolean flag = Boolean.FALSE;
|
|
Boolean flag = Boolean.FALSE;
|
|
|
try {
|
|
try {
|
|
|
- System.out.println(orderId);
|
|
|
|
|
if (!orderId.equals("")) {
|
|
if (!orderId.equals("")) {
|
|
|
RepairsWork repairsWork = new RepairsWork();
|
|
RepairsWork repairsWork = new RepairsWork();
|
|
|
RepairsOrder repairsOrder = new RepairsOrder(orderId, null, null, null,
|
|
RepairsOrder repairsOrder = new RepairsOrder(orderId, null, null, null,
|
|
|
- null,null, null, null, "0", null,
|
|
|
|
|
|
|
+ null, null, null, null, "0", null,
|
|
|
null, null, null, repairsWork, null);
|
|
null, null, null, repairsWork, null);
|
|
|
ArrayList<RepairsOrder> orderArrayList = new ArrayList<>();
|
|
ArrayList<RepairsOrder> orderArrayList = new ArrayList<>();
|
|
|
orderArrayList.add(repairsOrder);
|
|
orderArrayList.add(repairsOrder);
|
|
@@ -664,7 +632,7 @@ public class OrderController {
|
|
|
Date timeDate = sdf.parse(completeTime);
|
|
Date timeDate = sdf.parse(completeTime);
|
|
|
String time = sdf.format(timeDate);
|
|
String time = sdf.format(timeDate);
|
|
|
RepairsOrder repairsOrder = new RepairsOrder(orderId, null, null, null,
|
|
RepairsOrder repairsOrder = new RepairsOrder(orderId, null, null, null,
|
|
|
- timeDate, null, null,null, "2", null,
|
|
|
|
|
|
|
+ timeDate, null, null, null, "2", null,
|
|
|
null, null, null, repairsWork, null);
|
|
null, null, null, repairsWork, null);
|
|
|
ArrayList<RepairsOrder> orderArrayList = new ArrayList<>();
|
|
ArrayList<RepairsOrder> orderArrayList = new ArrayList<>();
|
|
|
orderArrayList.add(repairsOrder);
|
|
orderArrayList.add(repairsOrder);
|