|
|
@@ -11,6 +11,9 @@ import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.context.AnalysisContext;
|
|
|
import com.alibaba.excel.read.listener.ReadListener;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.bstek.ureport.parser.impl.searchform.DatetimeInputParser;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -20,15 +23,23 @@ import org.springblade.common.cache.DictBizCache;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.launch.constant.AppConstant;
|
|
|
import org.springblade.core.log.annotation.ApiLog;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.ConcurrentDateFormat;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.modules.baseinfo.stbase.entity.MvAttStBaseEntity;
|
|
|
+import org.springblade.modules.baseinfo.stbase.service.IMvAttStBaseService;
|
|
|
+import org.springblade.modules.business.data.manage.entity.RtuImportRecordEntity;
|
|
|
import org.springblade.modules.business.data.manage.entity.RtuInfoTableDataEntity;
|
|
|
+import org.springblade.modules.business.data.manage.service.IRtuImportRecordService;
|
|
|
import org.springblade.modules.business.project.base.entity.ProjectInfoEntity;
|
|
|
import org.springblade.modules.business.project.base.service.IProjectBaseInfoService;
|
|
|
import org.springblade.modules.business.rtu.base.entity.RtuInfoEntity;
|
|
|
import org.springblade.modules.business.rtu.base.service.IRtuBaseInfoService;
|
|
|
+import org.springblade.modules.system.entity.Dept;
|
|
|
import org.springblade.modules.system.entity.DictBiz;
|
|
|
+import org.springblade.modules.system.service.IDeptService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -46,7 +57,7 @@ import java.util.*;
|
|
|
* Remark:认为有必要的其他信息
|
|
|
*/
|
|
|
@RestController
|
|
|
-@RequestMapping(AppConstant.APPLICATION_TEST_NAME + "/data/manage")
|
|
|
+@RequestMapping("galaxy-business/data/manage")
|
|
|
@AllArgsConstructor
|
|
|
@Api(value = "数据管理模块", tags = "数据管理模块")
|
|
|
public class DataManageController extends BladeController {
|
|
|
@@ -55,6 +66,11 @@ public class DataManageController extends BladeController {
|
|
|
|
|
|
final IRtuBaseInfoService rtuBaseInfoService;
|
|
|
|
|
|
+ final IRtuImportRecordService rtuImportRecordService;
|
|
|
+ final IDeptService deptService;
|
|
|
+
|
|
|
+ final IMvAttStBaseService mvAttStBaseService;
|
|
|
+
|
|
|
private Double tranformPos(String lng) {
|
|
|
lng = lng
|
|
|
.trim()
|
|
|
@@ -193,6 +209,15 @@ public class DataManageController extends BladeController {
|
|
|
return str.matches(regex);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页")
|
|
|
+ public R<IPage<RtuImportRecordEntity>> list(Query query) {
|
|
|
+ LambdaQueryWrapper<RtuImportRecordEntity> wrapper = Wrappers.<RtuImportRecordEntity>query().lambda();
|
|
|
+ wrapper.orderByDesc(RtuImportRecordEntity::getImportTime);
|
|
|
+ return R.data(rtuImportRecordService.page(Condition.getPage(query),wrapper));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@ApiLog("测站信息-导入")
|
|
|
@GetMapping(value = "/import/rtu/test")
|
|
|
@@ -259,10 +284,10 @@ public class DataManageController extends BladeController {
|
|
|
|
|
|
|
|
|
@ApiLog("测站信息-导入")
|
|
|
- @PostMapping(value = "/import/rtu")
|
|
|
+ @PostMapping(value = "/import/rtu2")
|
|
|
@ApiOperationSupport(order = 6)
|
|
|
@ApiOperation(value = "导入测站信息", notes = "")
|
|
|
- public R<Map<String, String>> importRtuTable(MultipartFile file, @RequestParam Map<String, Object> postData) {
|
|
|
+ public R<Map<String, String>> importRtuTable2(MultipartFile file, @RequestParam Map<String, Object> postData) {
|
|
|
try {
|
|
|
if (file.isEmpty() || !postData.containsKey("projectId")) {
|
|
|
return R.fail("上传文件为空");
|
|
|
@@ -371,20 +396,20 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < location.length(); l++) {
|
|
|
String subtext = location.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
- if (tmp.size() >=4 ) {
|
|
|
+ if (tmp.size() >= 4) {
|
|
|
//度分秒,秒有小数点
|
|
|
String v = tmp.get(2) + "." + tmp.get(3);
|
|
|
double lat = Double.parseDouble(v);
|
|
|
@@ -421,20 +446,20 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < location.length(); l++) {
|
|
|
String subtext = location.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
- if (tmp.size() >=4 ) {
|
|
|
+ if (tmp.size() >= 4) {
|
|
|
//度分秒,秒有小数点
|
|
|
String v = tmp.get(2) + "." + tmp.get(3);
|
|
|
double lat = Double.parseDouble(v);
|
|
|
@@ -483,16 +508,16 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
String subtext = replaceDate.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
@@ -554,16 +579,16 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
String subtext = replaceDate.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
@@ -606,16 +631,16 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
String subtext = replaceDate.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
@@ -658,16 +683,16 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
String subtext = replaceDate.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
@@ -696,16 +721,16 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
String subtext = replaceDate.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
@@ -742,16 +767,16 @@ public class DataManageController extends BladeController {
|
|
|
for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
String subtext = replaceDate.substring(l, l + 1);
|
|
|
if (Func.isNumeric(subtext)) {
|
|
|
- String str = textArr.get(textArr.size()-1);
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
str += subtext;
|
|
|
- textArr.set(textArr.size()-1,str);
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
} else {
|
|
|
textArr.add("");
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> tmp = new ArrayList<>();
|
|
|
- for(String text:textArr){
|
|
|
- if (text.length()>0){
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
tmp.add(text);
|
|
|
}
|
|
|
}
|
|
|
@@ -807,7 +832,611 @@ public class DataManageController extends BladeController {
|
|
|
|
|
|
System.out.println("save record********************");
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
+ System.out.println(" record is null ********************");
|
|
|
+ System.out.println(JSON.toJSON(dataEntity).toString());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ System.out.println(" record is null ********************");
|
|
|
+ System.out.println(JSON.toJSON(dataEntity).toString());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ System.out.println(" record is null ********************");
|
|
|
+ System.out.println(JSON.toJSON(dataEntity).toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新导入时间
|
|
|
+ projectBaseInfoService.updateImportTime(projectId, new Date());
|
|
|
+ }
|
|
|
+ }).sheet().doRead();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return R.fail("上传文件格式错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.success("导入成功");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return R.fail("导入错误 " + e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return R.fail("导入错误 " + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiLog("测站信息-导入")
|
|
|
+ @PostMapping(value = "/import/rtu")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "导入测站信息", notes = "")
|
|
|
+ public R<Map<String, String>> importRtuTable(MultipartFile file, @RequestParam Map<String, Object> postData) {
|
|
|
+ try {
|
|
|
+ if (file.isEmpty() || !postData.containsKey("orgId")) {
|
|
|
+ return R.fail("上传文件为空");
|
|
|
+ }
|
|
|
+ if (!postData.containsKey("orgId")) {
|
|
|
+ return R.fail("参数为空");
|
|
|
+ }
|
|
|
+ String orgIdText = (String) postData.get("orgId");
|
|
|
+ Long orgId = Long.parseLong(orgIdText);
|
|
|
+
|
|
|
+ Dept dept=deptService.getById(orgId);
|
|
|
+
|
|
|
+ RtuImportRecordEntity recordEntity=new RtuImportRecordEntity();
|
|
|
+ recordEntity.setImportStatus(0L);
|
|
|
+ recordEntity.setOrgName(dept.getDeptName());
|
|
|
+ recordEntity.setOrgId(orgId);
|
|
|
+ recordEntity.setImportTime(Func.formatDateTime(new Date()));
|
|
|
+ this.rtuImportRecordService.save(recordEntity);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // ProjectInfoEntity projectInfoEntity = projectBaseInfoService.getById(projectId);
|
|
|
+ // Long orgId = projectInfoEntity.getOrgId();
|
|
|
+
|
|
|
+ InputStream inputStream = file.getInputStream();
|
|
|
+ String fileName = file.getOriginalFilename();
|
|
|
+ List<RtuInfoTableDataEntity> list = new LinkedList<>();
|
|
|
+ if (fileName.endsWith("xlsx")) {
|
|
|
+ EasyExcel.read(inputStream, RtuInfoTableDataEntity.class, new ReadListener() {
|
|
|
+ @Override
|
|
|
+ public void invoke(Object o, AnalysisContext analysisContext) {
|
|
|
+ RtuInfoTableDataEntity dataEntity = (RtuInfoTableDataEntity) o;
|
|
|
+ list.add(dataEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
|
|
+ for (int i = 2; i < list.size(); i++) {
|
|
|
+ RtuInfoTableDataEntity dataEntity = list.get(i);
|
|
|
+ if (null != dataEntity.getRtuCode()) {
|
|
|
+ String rtuCode = dataEntity.getRtuCode().trim();
|
|
|
+ if (rtuCode.length() > 0) {
|
|
|
+ if (isLetterDigit(rtuCode)) {
|
|
|
+ RtuInfoEntity rtuInfoEntity = new RtuInfoEntity();
|
|
|
+ rtuInfoEntity.setRtuCode(rtuCode);
|
|
|
+ if (null != dataEntity.getCity()) {
|
|
|
+ rtuInfoEntity.setAdCity(dataEntity.getCity().trim());
|
|
|
+ }
|
|
|
+ if (null != dataEntity.getDist()) {
|
|
|
+ rtuInfoEntity.setAdDist(dataEntity.getDist().trim());
|
|
|
+ }
|
|
|
+ if (null != dataEntity.getRtuName()) {
|
|
|
+ rtuInfoEntity.setRtuName(dataEntity.getRtuName().trim());
|
|
|
+ }
|
|
|
+ if (null != dataEntity.getRtuKind()) {
|
|
|
+ rtuInfoEntity.setIsRain(0);
|
|
|
+ rtuInfoEntity.setIsRiver(0);
|
|
|
+ rtuInfoEntity.setIsRes(0);
|
|
|
+ rtuInfoEntity.setIsGround(0);
|
|
|
+ String kinds = dataEntity.getRtuKind().trim();
|
|
|
+ if (kinds.length() > 0) {
|
|
|
+ List<DictBiz> bizs = DictBizCache.getList("rtu_kind");
|
|
|
+ String kindList = "";
|
|
|
+ if (kinds.contains("水位")) {
|
|
|
+ rtuInfoEntity.setIsRes(1);
|
|
|
+ rtuInfoEntity.setIsRiver(1);
|
|
|
+ for (DictBiz biz : bizs) {
|
|
|
+ if (biz.getDictKey().equals("river")) {
|
|
|
+ if (kindList.length() > 0) {
|
|
|
+ kindList += ",";
|
|
|
+ }
|
|
|
+ kindList += Long.toString(biz.getId());
|
|
|
+ } else if (biz.getDictKey().equals("rsvr")) {
|
|
|
+ if (kindList.length() > 0) {
|
|
|
+ kindList += ",";
|
|
|
+ }
|
|
|
+ kindList += Long.toString(biz.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rtuInfoEntity.setRtuKinds(kindList);
|
|
|
+ }
|
|
|
+ if (kinds.contains("雨量")) {
|
|
|
+ rtuInfoEntity.setIsRain(1);
|
|
|
+ for (DictBiz biz : bizs) {
|
|
|
+ if (biz.getDictKey().equals("rain")) {
|
|
|
+ if (kindList.length() > 0) {
|
|
|
+ kindList += ",";
|
|
|
+ }
|
|
|
+ kindList += Long.toString(biz.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (kinds.contains("墒情")) {
|
|
|
+ rtuInfoEntity.setIsGround(1);
|
|
|
+ for (DictBiz biz : bizs) {
|
|
|
+ if (biz.getDictKey().equals("ground")) {
|
|
|
+ if (kindList.length() > 0) {
|
|
|
+ kindList += ",";
|
|
|
+ }
|
|
|
+ kindList += Long.toString(biz.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rtuInfoEntity.setRtuKinds(kindList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getLocationDesc()) {
|
|
|
+ rtuInfoEntity.setLocationDesc(dataEntity.getLocationDesc().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getLng()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String location = dataEntity.getLng().trim();
|
|
|
+ for (int l = 0; l < location.length(); l++) {
|
|
|
+ String subtext = location.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tmp.size() >= 4) {
|
|
|
+ //度分秒,秒有小数点
|
|
|
+ String v = tmp.get(2) + "." + tmp.get(3);
|
|
|
+ double lat = Double.parseDouble(v);
|
|
|
+ lat = lat / 60.0;
|
|
|
+ v = tmp.get(1);
|
|
|
+ lat = (Double.parseDouble(v) + lat) / 60.0;
|
|
|
+ v = tmp.get(0);
|
|
|
+ lat = Double.parseDouble(v) + lat;
|
|
|
+ rtuInfoEntity.setLng(String.format("%.06f", lat));
|
|
|
+ } else if (tmp.size() == 3) {
|
|
|
+ //度分秒
|
|
|
+ String v = tmp.get(2);
|
|
|
+ double lat = Double.parseDouble(v);
|
|
|
+ lat = lat / 60.0;
|
|
|
+ v = tmp.get(1);
|
|
|
+ lat = (Double.parseDouble(v) + lat) / 60.0;
|
|
|
+ v = tmp.get(0);
|
|
|
+ lat = Double.parseDouble(v) + lat;
|
|
|
+ rtuInfoEntity.setLng(String.format("%.06f", lat));
|
|
|
+
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ //度
|
|
|
+ String v = tmp.get(0) + "." + tmp.get(1);
|
|
|
+ double lat = Double.parseDouble(v);
|
|
|
+ rtuInfoEntity.setLng(String.format("%.06f", lat));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getLat()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String location = dataEntity.getLat().trim();
|
|
|
+ for (int l = 0; l < location.length(); l++) {
|
|
|
+ String subtext = location.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tmp.size() >= 4) {
|
|
|
+ //度分秒,秒有小数点
|
|
|
+ String v = tmp.get(2) + "." + tmp.get(3);
|
|
|
+ double lat = Double.parseDouble(v);
|
|
|
+ lat = lat / 60.0;
|
|
|
+ v = tmp.get(1);
|
|
|
+ lat = (Double.parseDouble(v) + lat) / 60.0;
|
|
|
+ v = tmp.get(0);
|
|
|
+ lat = Double.parseDouble(v) + lat;
|
|
|
+ rtuInfoEntity.setLat(String.format("%.06f", lat));
|
|
|
+ } else if (tmp.size() == 3) {
|
|
|
+ //度分秒
|
|
|
+ String v = tmp.get(2);
|
|
|
+ double lat = Double.parseDouble(v);
|
|
|
+ lat = lat / 60.0;
|
|
|
+ v = tmp.get(1);
|
|
|
+ lat = (Double.parseDouble(v) + lat) / 60.0;
|
|
|
+ v = tmp.get(0);
|
|
|
+ lat = Double.parseDouble(v) + lat;
|
|
|
+ rtuInfoEntity.setLat(String.format("%.06f", lat));
|
|
|
+
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ //度
|
|
|
+ String v = tmp.get(0) + "." + tmp.get(1);
|
|
|
+ double lat = Double.parseDouble(v);
|
|
|
+ rtuInfoEntity.setLat(String.format("%.06f", lat));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (null != dataEntity.getManageCompany()) {
|
|
|
+ rtuInfoEntity.setManageCompany(dataEntity.getManageCompany().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (null != dataEntity.getRtuBrand()) {
|
|
|
+ rtuInfoEntity.setRtuBrand(dataEntity.getRtuBrand().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getRtuModel()) {
|
|
|
+ rtuInfoEntity.setRtuModel(dataEntity.getRtuModel().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getRtuReplaceDate()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String replaceDate = dataEntity.getRtuReplaceDate().trim();
|
|
|
+ for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
+ String subtext = replaceDate.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tmp.size() >= 3) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-" + tmp.get(2);
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setRtuReplaceDate(dt);
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-01";
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setRtuReplaceDate(dt);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (null != dataEntity.getToSheng()) {
|
|
|
+ if (dataEntity.getToSheng().trim().equals("是")) {
|
|
|
+ rtuInfoEntity.setDatagramToSheng(1);
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setDatagramToSheng(0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setDatagramToSheng(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getToShi()) {
|
|
|
+ if (dataEntity.getToShi().trim().equals("是")) {
|
|
|
+ rtuInfoEntity.setDatagramToShi(1);
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setDatagramToShi(0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setDatagramToShi(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getToQu()) {
|
|
|
+ if (dataEntity.getToQu().trim().equals("是")) {
|
|
|
+ rtuInfoEntity.setDatagramToQu(1);
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setDatagramToQu(0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setDatagramToQu(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getRainSensorBrand()) {
|
|
|
+ rtuInfoEntity.setRainSensorBrand(dataEntity.getRainSensorBrand().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getRainSensorModel()) {
|
|
|
+ rtuInfoEntity.setRainSensorModel(dataEntity.getRainSensorModel().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getRainSensorReplaceDate()) {
|
|
|
+
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String replaceDate = dataEntity.getRainSensorReplaceDate().trim();
|
|
|
+ for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
+ String subtext = replaceDate.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tmp.size() >= 3) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-" + tmp.get(2);
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setRainSensorReplaceDate(dt);
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-01";
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setRainSensorReplaceDate(dt);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getWaterSensorType()) {
|
|
|
+ List<DictBiz> bizs = DictBizCache.getList("water_level_sensor_type");
|
|
|
+ for (DictBiz biz : bizs) {
|
|
|
+ if (dataEntity.getWaterSensorType().trim().contains(biz.getDictValue())) {
|
|
|
+ rtuInfoEntity.setWaterSensorType(biz.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getWaterSensorBrand()) {
|
|
|
+ rtuInfoEntity.setWaterSensorBrand(dataEntity.getWaterSensorBrand().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getWaterSensorModel()) {
|
|
|
+ rtuInfoEntity.setWaterSensorModel(dataEntity.getWaterSensorModel().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getWaterSensorReplaceDate()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String replaceDate = dataEntity.getWaterSensorReplaceDate().trim();
|
|
|
+ for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
+ String subtext = replaceDate.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tmp.size() >= 3) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-" + tmp.get(2);
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setWaterSensorReplaceDate(dt);
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-01";
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setWaterSensorReplaceDate(dt);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getGroundSensorType()) {
|
|
|
+ List<DictBiz> bizs = DictBizCache.getList("ground_water_sensor_type");
|
|
|
+ for (DictBiz biz : bizs) {
|
|
|
+ if (dataEntity.getGroundSensorType().trim().contains(biz.getDictValue())) {
|
|
|
+ rtuInfoEntity.setGroundSensorType(biz.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getGroundSensorBrand()) {
|
|
|
+ rtuInfoEntity.setGroundSensorBrand(dataEntity.getGroundSensorBrand().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getGroundSensorModel()) {
|
|
|
+ rtuInfoEntity.setGroundSensorModel(dataEntity.getGroundSensorModel().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getGroundSensorReplaceDate()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String replaceDate = dataEntity.getGroundSensorReplaceDate().trim();
|
|
|
+ for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
+ String subtext = replaceDate.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tmp.size() >= 3) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-" + tmp.get(2);
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setGroundSensorReplaceDate(dt);
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-01";
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setGroundSensorReplaceDate(dt);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getBatteryModel()) {
|
|
|
+ rtuInfoEntity.setBatteryModel(dataEntity.getBatteryModel().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getBatteryReplaceDate()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String replaceDate = dataEntity.getBatteryReplaceDate().trim();
|
|
|
+ for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
+ String subtext = replaceDate.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tmp.size() >= 3) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-" + tmp.get(2);
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setBatteryReplaceDate(dt);
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-01";
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setBatteryReplaceDate(dt);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getSunModel()) {
|
|
|
+ rtuInfoEntity.setSunPowerModel(dataEntity.getSunModel().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getSimId()) {
|
|
|
+ rtuInfoEntity.setNetworkSimId(dataEntity.getSimId().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getSimPay()) {
|
|
|
+ rtuInfoEntity.setNetworkPayer(dataEntity.getSimPay().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getSimOverdate()) {
|
|
|
+ ArrayList<String> textArr = new ArrayList<>();
|
|
|
+ textArr.add("");
|
|
|
+ String replaceDate = dataEntity.getSimOverdate().trim();
|
|
|
+ for (int l = 0; l < replaceDate.length(); l++) {
|
|
|
+ String subtext = replaceDate.substring(l, l + 1);
|
|
|
+ if (Func.isNumeric(subtext)) {
|
|
|
+ String str = textArr.get(textArr.size() - 1);
|
|
|
+ str += subtext;
|
|
|
+ textArr.set(textArr.size() - 1, str);
|
|
|
+ } else {
|
|
|
+ textArr.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ArrayList<String> tmp = new ArrayList<>();
|
|
|
+ for (String text : textArr) {
|
|
|
+ if (text.length() > 0) {
|
|
|
+ tmp.add(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tmp.size() >= 3) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-" + tmp.get(2);
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setNetworkPayEndDate(dt);
|
|
|
+ } else if (tmp.size() == 2) {
|
|
|
+ String v = tmp.get(0) + "-" + tmp.get(1) + "-01";
|
|
|
+ Date dt = Func.parse(v, ConcurrentDateFormat.of("yyyy-MM-dd"));
|
|
|
+ rtuInfoEntity.setNetworkPayEndDate(dt);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getSatellite()) {
|
|
|
+ if (dataEntity.getSatellite().trim().equals("是")) {
|
|
|
+ rtuInfoEntity.setIsSatellite(1);
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setIsSatellite(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ rtuInfoEntity.setIsSatellite(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getSatelliteModel()) {
|
|
|
+ List<DictBiz> bizs = DictBizCache.getList("satellite_model");
|
|
|
+ for (DictBiz biz : bizs) {
|
|
|
+ if (dataEntity.getSatelliteModel().trim().contains(biz.getDictValue())) {
|
|
|
+ rtuInfoEntity.setSatelliteModel(biz.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != dataEntity.getRemark()) {
|
|
|
+ rtuInfoEntity.setRemark(dataEntity.getRemark().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ //rtuInfoEntity.setProjectId(projectId);
|
|
|
+ rtuInfoEntity.setOrgId(orgId);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<MvAttStBaseEntity> wrapper = Wrappers.<MvAttStBaseEntity>query().lambda();
|
|
|
+ wrapper.eq(MvAttStBaseEntity::getIsDeleted,0);
|
|
|
+ wrapper.eq(MvAttStBaseEntity::getStCode,rtuInfoEntity.getRtuCode());
|
|
|
+
|
|
|
+
|
|
|
+// MvAttStBaseEntity mvAttStBaseEntity=mvAttStBaseService.getOne(wrapper);
|
|
|
+// if (null != mvAttStBaseEntity){
|
|
|
+// rtuInfoEntity.
|
|
|
+// }
|
|
|
+
|
|
|
+ RtuInfoEntity entity = rtuBaseInfoService.rtuInfoByRtuCode(rtuInfoEntity.getRtuCode());
|
|
|
+ if (null != entity) {
|
|
|
+ rtuInfoEntity.setId(entity.getId());
|
|
|
+ }
|
|
|
+ rtuBaseInfoService.saveOrUpdate(rtuInfoEntity);
|
|
|
+
|
|
|
+ System.out.println("save record********************");
|
|
|
+
|
|
|
+ } else {
|
|
|
System.out.println(" record is null ********************");
|
|
|
System.out.println(JSON.toJSON(dataEntity).toString());
|
|
|
}
|
|
|
@@ -822,12 +1451,16 @@ public class DataManageController extends BladeController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ recordEntity.setImportStatus(1L);
|
|
|
+ rtuImportRecordService.saveOrUpdate(recordEntity);
|
|
|
//更新导入时间
|
|
|
- projectBaseInfoService.updateImportTime(projectId,new Date());
|
|
|
+ //projectBaseInfoService.updateImportTime(orgId, new Date());
|
|
|
}
|
|
|
}).sheet().doRead();
|
|
|
|
|
|
} else {
|
|
|
+ recordEntity.setImportStatus(2L);
|
|
|
+ rtuImportRecordService.saveOrUpdate(recordEntity);
|
|
|
return R.fail("上传文件格式错误");
|
|
|
}
|
|
|
|