|
@@ -1,8 +1,12 @@
|
|
|
package com.mokamrp.privates.controller.pangu;
|
|
package com.mokamrp.privates.controller.pangu;
|
|
|
|
|
|
|
|
|
|
+import com.mokamrp.privates.constant.HttpMsg;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
|
|
+import com.mokamrp.privates.help.Analysis;
|
|
|
|
|
+import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
|
|
+import com.mokamrp.privates.mapper.pojo.User;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -13,9 +17,13 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -48,7 +56,30 @@ public class FosterwxStationBindBoxController extends BaseController<FosterwxSta
|
|
|
return AjaxResult.success(res);
|
|
return AjaxResult.success(res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导入
|
|
|
|
|
+ * @param file
|
|
|
|
|
+ * @param authUser
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/import")
|
|
|
|
|
+ public Object uploadFile(@RequestBody MultipartFile file, @AuthUser User authUser) {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>(16);
|
|
|
|
|
+ Map<Integer, String> feild = new HashMap<>(5);
|
|
|
|
|
+ feild.put(0, "stationId");
|
|
|
|
|
+ feild.put(1, "type");
|
|
|
|
|
+ feild.put(2, "ghId");
|
|
|
|
|
+ feild.put(3, "boxName");
|
|
|
|
|
+ feild.put(4, "scope");
|
|
|
|
|
+ List<Map<String, String>> row = new ArrayList<>();
|
|
|
|
|
+ try {
|
|
|
|
|
+ row = Analysis.analysis(file, feild);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ Boolean res = fosterwxStationBindBoxService.importData(row,authUser);
|
|
|
|
|
+ return AjaxResult.success(HttpMsg.importSuccess);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|