Commit 0c7f85da authored by lisong's avatar lisong

修改巡检点导入bug

parent e85a16da
......@@ -13,7 +13,6 @@ import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointItemDao;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.service.impl.PointServiceImpl;
import com.yeejoin.amos.patrol.business.vo.*;
import com.yeejoin.amos.patrol.dao.entity.*;
import org.apache.commons.collections.CollectionUtils;
......@@ -26,7 +25,6 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -36,7 +34,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
......@@ -61,7 +58,6 @@ import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.response.PointResponse;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
......@@ -785,9 +781,10 @@ public class PointController extends AbstractBaseController {
* @param file
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "上传巡检点", notes = "上传巡检点")
@RequestMapping(value = "/import", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse importPoint(@ApiParam(value="导入数据文件", required=true)@RequestBody(required=true) MultipartFile file) {
@PostMapping(value = "/import", produces = "application/json;charset=UTF-8")
public CommonResponse importPoint(@ApiParam(value="导入数据文件", required=true) MultipartFile file) {
String fileName = file.getOriginalFilename();
if (!fileName.endsWith(".xls")) {
......
......@@ -5,11 +5,13 @@ import java.util.Date;
import javax.persistence.Column;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
public class PointImportParam {
@ExcelIgnore
private Date createDate;
......@@ -23,19 +25,23 @@ public class PointImportParam {
/**
* 分类编号
*/
@ExcelIgnore
private Long catalogId;
@Excel(name = "所属分类目录", orderNum = "12")
@ExcelIgnore
//@Excel(name = "所属分类目录", orderNum = "12")
private String catalogName;
/**
* 3维坐标(x,y,z)
*/
@Excel(name = "3维地图坐标", orderNum = "6")
@ExcelIgnore
//@Excel(name = "3维地图坐标", orderNum = "6")
private String coordinates;
/**
* 创建用户id
*/
@ExcelIgnore
@Column(name="creator_id")
private String creatorId;
......@@ -44,7 +50,8 @@ public class PointImportParam {
/**
* 楼层
*/
@Excel(name = "3维地图楼层", orderNum = "7")
@ExcelIgnore
//@Excel(name = "3维地图楼层", orderNum = "7")
private Integer floor = 1;
// /**
......@@ -56,6 +63,7 @@ public class PointImportParam {
/**
* 定点拍照数
*/
@ExcelIgnore
private Integer fixedShot;
/**
......@@ -73,6 +81,7 @@ public class PointImportParam {
/**
* 最新更新时间
*/
@ExcelIgnore
private Date lastUpdateTime;
// /**
......@@ -84,7 +93,7 @@ public class PointImportParam {
/**
* 风险等级(1:一级,2:二级,3:三级,4:四级,5:五级)
*/
@Excel(name = "风险等级", replace={"一级_1", "二级_2", "三级_3", "四级_4", "五级_5"}, orderNum = "10")
@Excel(name = "风险等级", replace={"一级_1", "二级_2", "三级_3", "四级_4", "五级_5"}, orderNum = "8")
private String level = "1";
......@@ -110,6 +119,7 @@ public class PointImportParam {
/**
* 权限系统org code
*/
@ExcelIgnore
private String orgCode;
/**
......@@ -121,18 +131,20 @@ public class PointImportParam {
/**
* 备注说明
*/
@Excel(name = "备注说明", orderNum = "11")
@Excel(name = "备注说明", orderNum = "9")
private String remark;
/**
* 路线id
*/
@ExcelIgnore
private String routeId;
/**
* 路线名称
*/
@ExcelIgnore
private String routeName;
// /**
......@@ -145,14 +157,14 @@ public class PointImportParam {
/**
* 最大拍照数
*/
@Excel(name = "最多拍照数量", orderNum = "9")
private Integer shotMaxNumber;
@Excel(name = "最多拍照数量", orderNum = "7")
private String shotMaxNumber;
/**
* 最小拍照数
*/
@Excel(name = "最少拍照数量", orderNum = "8")
private Integer shotMinNumber;
@Excel(name = "最少拍照数量", orderNum = "6")
private String shotMinNumber;
// /**
// * 是否允许普通拍照(1:允许,0:不允许)
......@@ -162,19 +174,78 @@ public class PointImportParam {
/**
* 是否删除:0表示未删除,1表示已删除
*/
@ExcelIgnore
private boolean isDelete;
/**
* 负责人id
*/
@Excel(name = "责任人", orderNum = "13")
private String chargePersonId;
@Excel(name = "检查项目", orderNum = "13")
@Excel(name = "检查项目", orderNum = "10")
private String inputItems;
@Excel(name = "是否室内",replace={"是_1", "否_0"}, orderNum = "14")
@Excel(name = "是否室内",replace={"是_1", "否_0"}, orderNum = "11")
private String isIndoor = "0";
/**
* 归属区域/部门id
*/
@Excel(name = "归属单位/部门", orderNum = "12")
private String chargeDeptId ;
/**
* 负责人名称
*/
@ExcelIgnore
private String chargePersonName ;
/**
* 物理区域id(数据来源于装备wl_area)
*/
@Excel(name = "所在建筑", orderNum = "14")
private String areaId;
/**
* 物理区域名称(数据来源于装备wl_area)
*/
@ExcelIgnore
private String areaName;
public String getChargeDeptId() {
return chargeDeptId;
}
public void setChargeDeptId(String chargeDeptId) {
this.chargeDeptId = chargeDeptId;
}
public String getChargePersonName() {
return chargePersonName;
}
public void setChargePersonName(String chargePersonName) {
this.chargePersonName = chargePersonName;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getIsIndoor() {
return isIndoor;
}
......@@ -366,19 +437,19 @@ public class PointImportParam {
// this.saveGps = saveGps;
// }
public Integer getShotMaxNumber() {
public String getShotMaxNumber() {
return this.shotMaxNumber;
}
public void setShotMaxNumber(Integer shotMaxNumber) {
public void setShotMaxNumber(String shotMaxNumber) {
this.shotMaxNumber = shotMaxNumber;
}
public Integer getShotMinNumber() {
public String getShotMinNumber() {
return this.shotMinNumber;
}
public void setShotMinNumber(Integer shotMinNumber) {
public void setShotMinNumber(String shotMinNumber) {
this.shotMinNumber = shotMinNumber;
}
......@@ -426,6 +497,6 @@ public class PointImportParam {
this.isDelete = isDelete;
}
}
......@@ -18,6 +18,7 @@ import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PushTargetBo;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
import com.yeejoin.amos.patrol.business.util.DaoCriteria;
......@@ -47,6 +48,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -106,6 +108,10 @@ public class PointServiceImpl implements IPointService {
private IInputItemDao inputItemDao;
@Autowired
private EquipFeign equipFeign;
@Autowired
private JcsFeignClient jcsFeignClient;
@Override
@Transactional
public Point addPoint(PointParam pointParam) {
......@@ -188,11 +194,42 @@ public class PointServiceImpl implements IPointService {
}
point.setAddress(param.getAddress());
point.setCatalogId(param.getCatalogId() == null ? 0 : param.getCatalogId());
point.setChargePersonId(param.getChargePersonId());
// 负责人
if (!ObjectUtils.isEmpty(param.getChargePersonId())) {
String[] principal = param.getChargePersonId().split("@");
point.setChargePersonId(principal[1]);
point.setChargePersonName(principal[0]);
}
// 归属部门
if (!ObjectUtils.isEmpty(param.getChargeDeptId())) {
String[] dept = param.getChargeDeptId().split("@");
point.setChargeDeptId(dept[1]);
point.setBizOrgName(dept[0]);
ResponseModel<Object> companyInfo = jcsFeignClient.getCompanyInfo(dept[1]);
if ("200".equals(String.valueOf(companyInfo.getStatus()))) {
Object obj = companyInfo.getResult();
if (!ObjectUtils.isEmpty(obj)) {
String bizOrgCode = ((Map<String, Object>) obj).get("bizOrgCode").toString();
point.setBizOrgCode(bizOrgCode);
}
}
}
// 所在建筑
if (!ObjectUtils.isEmpty(param.getAreaId())) {
String[] area = param.getAreaId().split("@");
point.setAreaId(Long.valueOf(area[1]));
point.setAreaName(area[0]);
}
//point.setChargePersonId(param.getChargePersonId());
// point.setDistance(param.getDistance() == null ? 0 :
// param.getDistance());
// point.setExtendJson(param.getExtendJson());
point.setFixedShot(param.getFixedShot() == null ? 0 : param.getFixedShot());
//point.setFixedShot(param.getFixedShot() == null ? 0 : param.getFixedShot());
point.setIsFixed(param.getIsFixed());
point.setIsScore(param.getIsScore());
// point.setLatitude(param.getLatitude());
......@@ -205,20 +242,20 @@ public class PointServiceImpl implements IPointService {
// point.setRouteId(param.getRouteId());
// point.setRouteName(param.getRouteName());
// point.setSaveGps(param.getSaveGps());
point.setShotMaxNumber(param.getShotMaxNumber() == null ? 0 : param.getShotMaxNumber());
point.setShotMinNumber(param.getShotMinNumber() == null ? 0 : param.getShotMinNumber());
point.setShotMaxNumber(param.getShotMaxNumber() == null ? 0 : Integer.parseInt(param.getShotMaxNumber()));
point.setShotMinNumber(param.getShotMinNumber() == null ? 0 : Integer.parseInt(param.getShotMinNumber()));
// point.setUsuallyShot(param.getUsuallyShot());
point.setCoordinates(param.getCoordinates());
point.setFloor(param.getFloor());
//point.setCoordinates(param.getCoordinates());
//point.setFloor(param.getFloor());
point.setIsDelete(false);
point.setOrgCode(orgCode);
point.setCreateDate(new Date());
point.setCreatorId(userId);
point.setIsIndoor(param.getIsIndoor().equals("1") ? true : false);
CatalogTree catalog = catalogTreeDao.findOneByNameAndOrgCode(param.getCatalogName(),
orgCode);
point.setCatalogId(catalog.getId());
// CatalogTree catalog = catalogTreeDao.findOneByNameAndOrgCode(param.getCatalogName(),
// orgCode);
//
// point.setCatalogId(catalog.getId());
if(!org.springframework.util.StringUtils.isEmpty(param.getAddress())){
for (int i = 0; i < structList.size(); i++) {
if(structList.getJSONObject(i).get("name").equals(param.getAddress())){
......
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