1、controller
geoserver.jar
package com.jeeplus.common.utils;
import java.io.File;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jeeplus.common.config.Global;
import ev.springboot.gsserver.RasterPublish;
/**
}
/**
*
*/
package com.jeeplus.common.utils;
/**
-
@Description
-
A因子计算因子类型常量
*/
public enum AFactorTypeEnum{
水土流失模数(“土壤侵蚀模数”,1,“a.tif”,“aFactorStyle”), //土壤侵蚀模数
降雨侵蚀因子(“降雨侵蚀因子”,2,“r.tif”,“rFactorStyle”),
植被覆盖与生物措施因子(“植被覆盖与生物措施因子”,3,“b.tif”,“bFactorStyle”),
工程措施因子(“工程措施因子”,4,“e.tif”,“eFactorStyle”),
土壤可蚀性因子(“土壤可蚀性因子”,5,“k.tif”,“kFactorStyle”),
坡长因子(“坡长因子”,6,“l.tif”,“lFactorStyle”),
坡度因子(“坡度因子”,7,“s.tif”,“sFactorStyle”),
耕作措施因子(“耕作措施因子”,8,“t.tif”,“tFactorStyle”);
/**
- 根据 因子类型获取因子
- @param factorType
- @return
/
public static String getTifNameByType(Integer factorType){
String tifName = null;
for(AFactorTypeEnum platformFree:AFactorTypeEnum.values()){
if(factorType.equals(platformFree.getFactorType())){
tifName = platformFree.getTifName();
break;
}
}
return tifName;
}
/*
- 根据 因子类型获取因子样式名
- @param factorType
- @return
*/
public static String getStyleNameByType(Integer factorType){
String styleName = null;
for(AFactorTypeEnum platformFree:AFactorTypeEnum.values()){
if(factorType.equals(platformFree.getFactorType())){
styleName = platformFree.getStyleName();
break;
}
}
return styleName;
}
/**
- 因子描述
/
private String factorDescribe;
/*
- 类型值
*/
private Integer factorType;
/**
- tiff文件名
/
private String tifName;
/*
- 样式名
*/
private String styleName;
AFactorTypeEnum(String factorDescribe, Integer factorType, String tifName, String styleName) {
this.factorDescribe = factorDescribe;
this.factorType = factorType;
this.tifName = tifName;
this.setStyleName(styleName);
}
public String getFactorDescribe() {
return factorDescribe;
}
public void setFactorDescribe(String factorDescribe) {
this.factorDescribe = factorDescribe;
}
public Integer getFactorType() {
return factorType;
}
public void setFactorType(Integer factorType) {
this.factorType = factorType;
}
public String getTifName() {
return tifName;
}
public void setTifName(String tifName) {
this.tifName = tifName;
}
public String getStyleName() {
return styleName;
}
public void setStyleName(String styleName) {
this.styleName = styleName;
}
}
package com.jeeplus.modules.analysis.web;
import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.common.utils.AfactorPlanTypeEnum;
import com.jeeplus.common.utils.CommonContants;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.modules.analysis.dto.GeoPublishEntity;
import com.jeeplus.modules.analysis.entity.AFactorPlan;
import com.jeeplus.modules.analysis.entity.AFactorPlanGeo;
import com.jeeplus.modules.analysis.entity.Basininfo;
import com.jeeplus.modules.analysis.service.AFactorPlanGeoService;
import com.jeeplus.modules.analysis.service.AFactorPlanService;
import com.jeeplus.modules.analysis.service.BasininfoService;
import com.jeeplus.modules.sys.entity.Area;
import com.jeeplus.modules.sys.service.AreaService;
import com.jeeplus.modules.sys.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
/**
-
A因子计算 侵蚀模数
-
@author zb
-
@date 创建时间:2019年10月14日 下午3:06:26
*/
@Controller
@RequestMapping(value = “${adminPath}/analysis/aFactorMap”)
public class AFactorMapController extends BaseController {
@Autowired
private AreaService areaService;
@Autowired
private AFactorPlanService aFactorPlanService;
@Autowired
private AFactorPlanGeoService aFactorPlanGeoService;
@Autowired
private BasininfoService basininfoService;
@RequestMapping(value = { “index”, “” })
public String index(HttpServletRequest request) {
request.setAttribute(“userLevel”, UserUtils.getUserLevel());
request.setAttribute(“userAreaCode”, UserUtils.getUserAreaCode());
request.setAttribute(“userAreaName”, UserUtils.getUserAreaName());
return “modules/analysis/aFactorMap”;
}
@ResponseBody
@RequestMapping(“getData”)
public Map getData(AFactorPlan aFactorPlan, HttpServletRequest request, HttpServletResponse response, Model model) {
Integer userLevel = UserUtils.getUserLevel();
String userAreaCode = UserUtils.getUserAreaCode();
aFactorPlan.setUserLevel(userLevel);
aFactorPlan.setUserAreaCode(userAreaCode);
//省级不做过滤
// if(!userLevel.equals(1)) {
// List areaCodes = areaService.getChildAndCodesByCode(userAreaCode);
// List basincodes = basininfoService.getBasincodesByAreaCode(areaCodes);
// if(areaCodes != null && areaCodes.size()>0) {
// aFactorPlan.setSearchAreaCodes(String.join(",",areaCodes));
// }
// if(basincodes != null && basincodes.size()>0) {
// aFactorPlan.setSearchBasincodes(String.join(",",basincodes));
// }
// }
Page page = aFactorPlanService.findPage(new Page(request, response), aFactorPlan);
List list = page.getList();
this.setZonalName(list);
return getBootstrapData(page);
}
/**
- 设置区域名称
- @param list
*/
public void setZonalName(List list){
for (AFactorPlan aFactorPlan2 : list) {
String scope = aFactorPlan2.getScope();
//取小流域名称
if(CommonContants.SCOPE_XIAOLIUYU.equals(scope)) {
Basininfo basininfo = new Basininfo();
basininfo.setBasincodes(aFactorPlan2.getZonalCode().split(","));
List basininfoList = basininfoService.findList(basininfo);
aFactorPlan2.setBasincode(aFactorPlan2.getZonalCode());
if(basininfoList != null && basininfoList.size()>0) {
String basinname = “”;
String zonalName = “”;
for (Basininfo basininfo2 : basininfoList) {
basinname +=("".equals(basinname)?basininfo2.getBasinname():","+basininfo2.getBasinname());
zonalName +=("".equals(zonalName)?basininfo2.getCounty()+ “/” +basininfo2.getBasinname():","+basininfo2.getCounty()+ “/” +basininfo2.getBasinname());
}
aFactorPlan2.setBasinname(basinname);
aFactorPlan2.setZonalName(zonalName);
}
else {
aFactorPlan2.setBasincode(aFactorPlan2.getZonalCode());
aFactorPlan2.setZonalName(aFactorPlan2.getZonalCode());
}
}
//取区域名称
else {
if(aFactorPlan2.getZonalCode() != null && “42”.equals(aFactorPlan2.getZonalCode())) {
aFactorPlan2.setZonalName(“湖北省”);
}
else {
List areas = areaService.getAreaByCodes(aFactorPlan2.getZonalCode().split(","));
String zonalName = “”;
if(areas != null && areas.size()>0) {
for (Area area:areas) {
zonalName +=("".equals(zonalName)?area.getName():","+area.getName());
}
}
aFactorPlan2.setZonalName("".equals(zonalName)?aFactorPlan2.getZonalCode():zonalName);
}
}
}
}
@ResponseBody
@RequestMapping(value = “save”)
public AjaxJson save(AFactorPlan aFactorPlan, HttpServletRequest request) throws Exception {
AjaxJson j = new AjaxJson();
String errMsg = beanValidator(aFactorPlan);
if (StringUtils.isNotBlank(errMsg)) {
j.setSuccess(false);
j.setMsg(errMsg);
return j;
}
if(AfactorPlanTypeEnum.A实时.getAFactorPlanType().equals(aFactorPlan.getPlanType())) {
// 设置 A计算 区域编码 zonalCode
aFactorPlanService.setAFactorZonalCode(aFactorPlan);
// 验证数据的重复性
List aFactorPlanList = aFactorPlanService.getAFactorByTimeAndPlanType(aFactorPlan);
if(aFactorPlanList != null && aFactorPlanList.size()>0) {
j.setSuccess(false);
this.setZonalName(aFactorPlanList);
j.put(“aFactorPlanList”,aFactorPlanList);
j.setMsg(“保存计算任务失败!已经存在相同的计算任务”+aFactorPlanList.size()+“条!”);
return j;
}
aFactorPlanService.saveAfactor(aFactorPlan);// 保存 A 计算
}
else {
// 设置 R计算 区域编码 zonalCode
aFactorPlanService.setRFactorZonalCode(aFactorPlan);
// 验证数据的重复性
List aFactorPlanList = aFactorPlanService.getAFactorByTimeAndPlanType(aFactorPlan);
if(aFactorPlanList != null && aFactorPlanList.size()>0) {
j.setSuccess(false);
this.setZonalName(aFactorPlanList);
j.put(“aFactorPlanList”,aFactorPlanList);
j.setMsg(“保存计算任务失败!已经存在相同的计算任务”+aFactorPlanList.size()+“条!”);
return j;
}
aFactorPlanService.saveRfactor(aFactorPlan);// 保存 R 计算
}
j.setSuccess(true);
j.setMsg(“保存计算任务成功”);
return j;
}
/**
- 查看a因子计算相关信息
- 发布因子相关的tif文件到geoserver
- @param aFactorPlan
- @param request
- @return
- @throws Exception
*/
@ResponseBody
@RequestMapping(value = “rePublish”)
public AjaxJson rePublish(AFactorPlan aFactorPlan, HttpServletRequest request) throws Exception {
AjaxJson j = new AjaxJson();
// 因子类型
Integer factorType = aFactorPlan.getFactorType();
// 任务类型
String planType = aFactorPlan.getPlanType();
if(factorType == null) {
j.setSuccess(false);
j.setMsg(“查看因子类型不能为空!”);
return j;
}
if(planType == null || “”.equals(planType)) {
j.setSuccess(false);
j.setMsg(“任务类型不能为空!”);
return j;
}
//用户级别
Integer userLevel = UserUtils.getUserLevel();
//获取任务ID
String aFactorPlanId = aFactorPlan.getId();
// A计算任务ID为空取定时任务产生的tif图层
if(aFactorPlanId == null || “”.equals(aFactorPlanId)) {
AFactorPlan aFactorPlanParam = new AFactorPlan();
//定时计算 由开始时间和任务类型就可以确定一个任务,先查询任务,根据任务查询或者发布tif图层进行展示
aFactorPlanParam.setStartTime(getStartTimeByPlanType(planType));
//aFactorPlanParam.setEndTime(getEndTime());
aFactorPlanParam.setPlanType(planType);
aFactorPlanParam.setScope(CommonContants.SCOPE_SHENG);
List aFactorPlanList = aFactorPlanService.getAFactorByTimeAndPlanType(aFactorPlanParam);
if(aFactorPlanList != null && aFactorPlanList.size()>0) {
boolean haveSuccess = false;
String errorMessage = “定时计算失败!”;
for (AFactorPlan aFactorPlanRes:aFactorPlanList) {
if(CommonContants.AFACTOR_PLAN_STATE_SUCCESS.equals(aFactorPlanRes.getState())) {
haveSuccess = true;
aFactorPlanId = aFactorPlanRes.getId();
break;
}
else if(CommonContants.AFACTOR_PLAN_STATE_ERROR.equals(aFactorPlanRes.getState())) {
errorMessage = aFactorPlanRes.getErrorMessage();
}
}
if(!haveSuccess) {
j.setSuccess(false);
j.setMsg(errorMessage);
return j;
}
}
else {
j.setSuccess(false);
j.setMsg(“没有查询到该因子图层!”);
return j;
}
}
// 查询图层是否存在
AFactorPlanGeo aFactorPlanGeoParam = new AFactorPlanGeo();
aFactorPlanGeoParam.setAFactorPlanId(aFactorPlanId);
aFactorPlanGeoParam.setFactorType(factorType);
//不是省级用户,取省级任务下的定时任务生成的tif图层
List areaCodes = null;
if(StringUtils.isBlank(aFactorPlan.getId()) && userLevel != null && (!userLevel.equals(1))) {
areaCodes = areaService.getChildAndCodesByCode(UserUtils.getUserAreaCode());
aFactorPlanGeoParam.setAreaCodes(areaCodes);
}
//获取任务 图层是否存在,存在直接展示,不存在先发布图层再展示
List aFactorPlanGeoList = aFactorPlanGeoService.getAFactorPlanGeoByFactorIdAndType(aFactorPlanGeoParam);
if(aFactorPlanGeoList != null && aFactorPlanGeoList.size()>0) {
// 定时任务为省级,市级、县级用户需要过滤
if(areaCodes != null) {
j.put(“aFactorPlanGeoList”, filterAFactorPlanGeoListByAreaCodes(aFactorPlanGeoList, areaCodes));
}
else {
j.put(“aFactorPlanGeoList”, aFactorPlanGeoList);
}
j.setSuccess(true);
j.setMsg(“图层已发布成功,可直接展示!”);
return j;
}
//获取要发布的图层
List geoPublishList = aFactorPlanService.getGeoPublishList(aFactorPlanId,factorType);
if(geoPublishList == null || geoPublishList.size() == 0) {
j.setSuccess(false);
j.setMsg(“没有获取到可以发布的图层!”);
return j;
}
//发布图层
aFactorPlanGeoList = aFactorPlanService.rePublicGeo(geoPublishList);
if(aFactorPlanGeoList != null && aFactorPlanGeoList.size()>0) {
// 定时任务为省级,市级、县级用户需要过滤
if(areaCodes != null) {
j.put(“aFactorPlanGeoList”, filterAFactorPlanGeoListByAreaCodes(aFactorPlanGeoList, areaCodes));
}
else {
j.put(“aFactorPlanGeoList”, aFactorPlanGeoList);
}
j.setSuccess(true);
j.setMsg(“发布图层成功!”);
}
else {
j.setSuccess(false);
j.setMsg(“发布图层失败!”);
}
return j;
}
/**
- 根据区划集合过滤数据
- @param aFactorPlanGeoList
- @param areaCodes
- @return
*/
public List filterAFactorPlanGeoListByAreaCodes(List aFactorPlanGeoList, List areaCodes){
List aFactorPlanGeoListFilter = new ArrayList();
for (AFactorPlanGeo aFactorPlanGeo:aFactorPlanGeoList
) {
boolean bl= areaCodes.stream().anyMatch(areaCode -> Objects.equals(areaCode, aFactorPlanGeo.getZonalCode()));
if(bl) {
aFactorPlanGeoListFilter.add(aFactorPlanGeo);
}
}
return aFactorPlanGeoListFilter;
}
/**
- 获取定时的开始时间
- @return
*/
public Date getStartTimeByPlanType(String planType){
Date result = new Date();
//当前年 月 日
Calendar currCal = Calendar.getInstance();
int currentYear = currCal.get(Calendar.YEAR);
int currentMonth = currCal.get(Calendar.MONTH) + 1;
int currentDay = currCal.get(Calendar.DAY_OF_MONTH);
Calendar cale = Calendar.getInstance();
// 注释:cale.set(Calendar.MONTH, currentMonth - 1);代表设置月份为本月
//1、任务类型为A定时年、R定时年
if(AfactorPlanTypeEnum.A定时年.getAFactorPlanType().equals(planType) || AfactorPlanTypeEnum.R定时年.getAFactorPlanType().equals(planType)) {
cale.clear();
// 2019 年 查看的数据的开始时间是 2017年12月31号20点
cale.set(Calendar.YEAR,currentYear-2);
cale.roll(Calendar.DAY_OF_YEAR, -1);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
result = cale.getTime();
}
//2、任务类型为A定时月、R定时月
else if(AfactorPlanTypeEnum.A定时月.getAFactorPlanType().equals(planType) || AfactorPlanTypeEnum.R定时月.getAFactorPlanType().equals(planType)) {
cale.clear();
//上半月,取上个月下半月的数据
if(currentMonth == 1) {
// 1 月 取上一年 11月 最后一天开始的
cale.set(Calendar.YEAR,currentYear-1);
cale.set(Calendar.MONTH,10);
// 获取某月最大天数
int lastDay = cale.getActualMaximum(Calendar.DATE);
cale.set(Calendar.DAY_OF_MONTH, lastDay);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
}
else {
// 取上个月 15号20点开始的
cale.set(Calendar.YEAR,currentYear);
//设置月份为上上个月
cale.set(Calendar.MONTH, currentMonth - 3);
// 获取某月最大天数
int lastDay = cale.getActualMaximum(Calendar.DATE);
cale.set(Calendar.DAY_OF_MONTH, lastDay);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
}
result = cale.getTime();
}
//3、任务类型为A定时半月、R定时半月
else if(AfactorPlanTypeEnum.A定时半月.getAFactorPlanType().equals(planType) || AfactorPlanTypeEnum.R定时半月.getAFactorPlanType().equals(planType)) {
cale.clear();
if(currentDay < 16) {
//上半月,取上个月下半月的数据
if(currentMonth == 1) {
// 1 月 取上一年 12月15号开始的
cale.set(Calendar.YEAR,currentYear-1);
cale.set(Calendar.MONTH,11);
cale.set(Calendar.DAY_OF_YEAR, 15);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
}
else {
// 取上个月 15号20点开始的
cale.set(Calendar.YEAR,currentYear);
cale.set(Calendar.MONTH, currentMonth - 2);
cale.set(Calendar.DAY_OF_MONTH, 15);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
}
}
else {
//下半月, 取本月上半月
if(currentMonth == 1) {
// 1 月 取上一年 12月最后一天20点开始的
cale.set(Calendar.YEAR,currentYear-1);
cale.roll(Calendar.DAY_OF_YEAR, -1);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
}
else {
// 取上月 最后一天 20点开始的
cale.set(Calendar.YEAR,currentYear);
cale.set(Calendar.DAY_OF_MONTH,currentMonth - 2);
// 获取某月最大天数
int lastDay = cale.getActualMaximum(Calendar.DATE);
cale.set(Calendar.DAY_OF_MONTH, lastDay);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
}
}
result = cale.getTime();
}
//5、任务类型为A定时日、R定时日
else if(AfactorPlanTypeEnum.A定时日.getAFactorPlanType().equals(planType) || AfactorPlanTypeEnum.R定时日.getAFactorPlanType().equals(planType)) {
cale.add(Calendar.DAY_OF_MONTH, -2);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
result = cale.getTime();
}
return result;
}
/**
- 获取定时的结束时间
- @return
*/
public Date getEndTime(){
Calendar cale = Calendar.getInstance();
cale.add(Calendar.DAY_OF_MONTH, -1);
cale.set(Calendar.HOUR_OF_DAY, 20);
cale.set(Calendar.MINUTE, 0);
cale.set(Calendar.SECOND, 0);
cale.set(Calendar.MILLISECOND, 0);// 毫秒
return cale.getTime();
}
}
2、service
/**
- Copyright © 2015-2020 JeePlus All rights reserved.
*/
package com.jeeplus.modules.analysis.service;
import com.jeeplus.common.config.Global;
import com.jeeplus.common.utils.*;
import com.jeeplus.common.utils.time.DateFormatUtil;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.analysis.dto.GeoPublishEntity;
import com.jeeplus.modules.analysis.entity.AFactorPlan;
import com.jeeplus.modules.analysis.entity.AFactorPlanGeo;
import com.jeeplus.modules.analysis.mapper.AFactorPlanGeoMapper;
import com.jeeplus.modules.analysis.mapper.AFactorPlanMapper;
import com.jeeplus.modules.analysis.mapper.BasininfoMapper;
import com.jeeplus.modules.sys.entity.AddvSbSj;
import com.jeeplus.modules.sys.entity.Area;
import com.jeeplus.modules.sys.mapper.AreaMapper;
import com.jeeplus.modules.sys.mapper.SbSjMapper;
import ev.springboot.gsserver.RasterPublish;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
-
A因子计算Service
-
@author zb
-
@version 2019-10-24
*/
@Service
@Transactional(readOnly = true)
public class AFactorPlanService extends CrudService {
@Autowired
private AFactorPlanGeoMapper aFactorPlanGeoMapper;
@Autowired
private AreaMapper areaMapper;
@Autowired
private BasininfoMapper basininfoMapper;
@Autowired
private SbSjMapper sbSjMapper;
public AFactorPlan get(String id) {
return super.get(id);
}
public List findList(AFactorPlan aFactorPlan) {
return super.findList(aFactorPlan);
}
public List getAFactorByTimeAndPlanType(AFactorPlan aFactorPlan) {
return mapper.getAFactorByTimeAndPlanType(aFactorPlan);
}
/**
- 发布图层,可发布多个
- @param geoPublishList
- @return
*/
@Transactional(readOnly = false,rollbackFor = Exception.class)
public List rePublicGeo(List geoPublishList){
List aFactorPlanGeoList = new ArrayList();
//获取geoserver连接
RasterPublish rasterPublish = RasterPublishUtils.createGeoserverConnect();
if(rasterPublish == null) {
return aFactorPlanGeoList;
}
for (GeoPublishEntity geoPublishEntity: geoPublishList) {
boolean bl = RasterPublishUtils.rasterPublish(rasterPublish,geoPublishEntity.getFilePath(),geoPublishEntity.getStoreName(),geoPublishEntity.getStyleName());
AFactorPlanGeo aFactorPlanGeoResp = new AFactorPlanGeo();
if(!bl) {
aFactorPlanGeoResp.setAFactorPlanId(geoPublishEntity.getaFactorPlanId());
aFactorPlanGeoResp.setFactorType(geoPublishEntity.getFactorType());
aFactorPlanGeoResp.setGeoWs(Global.getConfig(“geoserver.ws”));
aFactorPlanGeoResp.setGeoName(geoPublishEntity.getStoreName());
aFactorPlanGeoResp.setPlanName(geoPublishEntity.getaFactorPlan().getPlanName());
aFactorPlanGeoResp.setPlanType(geoPublishEntity.getaFactorPlan().getPlanType());
aFactorPlanGeoResp.setScope(geoPublishEntity.getaFactorPlan().getScope());
aFactorPlanGeoResp.setZonalCode(geoPublishEntity.getZonalCode());
aFactorPlanGeoResp.setSuccess(false);
aFactorPlanGeoResp.setMsg(“区域编码为:”+geoPublishEntity.getZonalCode()+“的图层发布失败!”);
}
else {
//保存影像信息
aFactorPlanGeoResp = saveAfactorGeo(geoPublishEntity);
aFactorPlanGeoResp.setSuccess(true);
}
aFactorPlanGeoList.add(aFactorPlanGeoResp);
}
return aFactorPlanGeoList;
}
/**
- 获取要发布的图层集合
- @param aFactorPlanId
- @param factorType
- @return
/
public List getGeoPublishList(String aFactorPlanId,Integer factorType){
List geoPublishList = new ArrayList();
AFactorPlan aFactorPlanResponse = mapper.get(aFactorPlanId);
aFactorPlanResponse.setFactorType(factorType);
// 区域编码或小流域编码
String zonalCode = aFactorPlanResponse.getZonalCode();
zonalCode = zonalCode.length() == 2?(zonalCode+“0000”):zonalCode;
// 计算范围、省、市、县、小流域
String scope = aFactorPlanResponse.getScope();
// 任务类型(“A实时”、“R实时”、“A定时”、“R定时”。。)
String planType = aFactorPlanResponse.getPlanType();
// 任务名称
String planName = aFactorPlanResponse.getPlanName();
// 任务计算周期开始时间
//Date startTime = aFactorPlanResponse.getStartTime();
//Date endTime = aFactorPlanResponse.getEndTime();
Date date = aFactorPlanResponse.getStartTime();
Date endTime = aFactorPlanResponse.getEndTime();
// 因子图相对路径
String planTypePath = CommonContants.AFACTOR_REALTIME;
if(factorType>2) {
//6因子
planTypePath = CommonContants.AFACTOR_BG;
// B 因子
// 实时计算所选时间段跨半月
//B因子:42/4201/420101/RealTime/20191023110000/b.tif。
//实时计算所选时间段没跨半月,判断查询时间段所属半月号,如2019-11-01 —— 2019-11-10,则属于21半月,其B因子在
//B因子:42/4201/420101/ bg00/slr/slr21.tif实时计算所选时间段跨半月
//B因子:42/4201/420101/RealTime/20191023110000/b.tif。
//实时计算所选时间段没跨半月,判断查询时间段所属半月号,如2019-11-01 —— 2019-11-10,则属于21半月,其B因子在
//B因子:42/4201/420101/ bg00/slr/slr21.tif
if(AFactorTypeEnum.植被覆盖与生物措施因子.getFactorType().equals(factorType)) {
if(AfactorPlanTypeEnum.A实时.getAFactorPlanType().equals(planType)){
//没有跨半月, 不进行计算 直接取42/4201/420101/ bg00/slr/slr21.tif
if(isNotKuaBanYue(date,endTime)) {
planTypePath = CommonContants.AFACTOR_BG + “/slr”;
}
else {
planTypePath = CommonContants.AFACTOR_REALTIME + “/” + planName;
}
}
else {
// 定时的都是跨半月的
planTypePath = CommonContants.AFACTOR_REALTIME + “/” + planName;
}
}
}
else {
// A因子 R因子
planTypePath = this.getPlanFilePathByDateAndPlanType(date, planType, planName);
}
// tif 文件名
String fileName = AFactorTypeEnum.getTifNameByType(factorType);
/
if(AfactorPlanTypeEnum.R定时年.getAFactorPlanType().equals(planType)
|| AfactorPlanTypeEnum.R定时月.getAFactorPlanType().equals(planType)
|| AfactorPlanTypeEnum.R定时半月.getAFactorPlanType().equals(planType)
|| AfactorPlanTypeEnum.R定时日.getAFactorPlanType().equals(planType)
) {
fileName = CommonContants.R_RUNTIME_FILE_NAME;
}/
// A实时计算 :没有跨半月, 不进行计算 直接取42/4201/420101/ bg00/slr/slr21.tif
if(AFactorTypeEnum.植被覆盖与生物措施因子.getFactorType().equals(factorType)) {
if (AfactorPlanTypeEnum.A实时.getAFactorPlanType().equals(planType)) {
//没有跨半月, 不进行计算 直接取42/4201/420101/ bg00/slr/slr21.tif
//若:实时计算所选时间段跨半月会生成b.tif,存放路径为:
//B因子:42/4201/420101/RealTime/20191023110000/b.tif。
//若:实时计算所选时间段没跨半月,判断查询时间段所属半月,判断规则为:当日<=15时,所属半月为 2月-1,当日>15时,所属半月为2月。
//如2019-11-01 —— 2019-11-10。则属于211-1=21半月,其B因子调用对应半月slr参与计算。
//B因子:42/4201/420101/ bg00/slr/slr21.tif
if (isNotKuaBanYue(date, endTime)) {
Calendar startCalender = Calendar.getInstance();
startCalender.setTime(date);
int startMonth = startCalender.get(Calendar.MONTH) + 1;
int startDayOfMonth = startCalender.get(Calendar.DAY_OF_MONTH);
Integer byInt = (startDayOfMonth<=15?(2startMonth - 1):(2startMonth));
fileName = “slr” + (byInt<10?“0”+byInt:byInt) + “.tif”;
}
}
}
// 样式名
String styleName = AFactorTypeEnum.getStyleNameByType(factorType);
// tif 文件路径
String filePath = “”;
//小流域
if(CommonContants.SCOPE_XIAOLIUYU.equals(scope)){
//获取所有小流域信息
String basincodes[] = zonalCode.split(",");
for (String basincode : basincodes) {
//小流域 D:\BJ-RUC\42\0000\420111\FA030000021420111
filePath = “0000/” + basincode.substring(basincode.length() - 6, basincode.length())
+ “/” + basincode
+ “/” + planTypePath
+ “/” + fileName;
String storeName = “sbjc_”+ UUID.randomUUID().toString().replace("-", “”);
geoPublishList.add(this.setGeoPublicEntity(filePath,storeName,styleName,aFactorPlanResponse,basincode));
}
}
//省 市
else if(CommonContants.SCOPE_SHENG.equals(scope) || CommonContants.SCOPE_SHI.equals(scope)){
if(AfactorPlanTypeEnum.R定时年.getAFactorPlanType().equals(planType)
|| AfactorPlanTypeEnum.R定时月.getAFactorPlanType().equals(planType)
|| AfactorPlanTypeEnum.R定时半月.getAFactorPlanType().equals(planType)
|| AfactorPlanTypeEnum.R定时日.getAFactorPlanType().equals(planType)
) {
// 这几个计算的都是全省的图 42/2019/10/23/rr.tif
// 42/2019/13/rr.tif
filePath = planTypePath
+ “/” + fileName;
String storeName = “sbjc_”+ UUID.randomUUID().toString().replace("-", “”);
geoPublishList.add(this.setGeoPublicEntity(filePath,storeName,styleName,aFactorPlanResponse,aFactorPlanResponse.getZonalCode()));
}
else if(AfactorPlanTypeEnum.R实时.getAFactorPlanType().equals(planType)){
//R实时 市级
if(CommonContants.SCOPE_SHI.equals(scope)){
String zonalCodes[] = zonalCode.split(",");
for (String cityCode : zonalCodes) {
// D:\42\4201\RealTime\20191122114921697
filePath = cityCode.substring(0,4)
+ “/” + planTypePath
+ “/” + fileName;
String storeName = “sbjc_” + UUID.randomUUID().toString().replace("-", “”);
geoPublishList.add(this.setGeoPublicEntity(filePath,storeName,styleName,aFactorPlanResponse,cityCode));
}
}
//R实时 省级
else if(CommonContants.SCOPE_SHENG.equals(scope)){
//D:\42\RealTime\20191122120823014
filePath = planTypePath
+ “/” + fileName;
String storeName = “sbjc_”+ UUID.randomUUID().toString().replace("-", “”);
geoPublishList.add(this.setGeoPublicEntity(filePath,storeName,styleName,aFactorPlanResponse,zonalCode));
}
}
else {
// A实时、 A定时年、A定时月、A定时半月、 A定时日、
//获取所有县信息
List areaList = areaMapper.getCountyByCodes(zonalCode.split(","));
for (Area area : areaList) {
// 县 D:\BJ-RUC\42\4201\420103\RealTime\20191025125410034
filePath = area.getParent().getCode().substring(0, 4)
+ “/” + area.getCode()
+ “/” + planTypePath
+ “/” + fileName;
String storeName = “sbjc_”+ UUID.randomUUID().toString().replace("-", “”);
geoPublishList.add(this.setGeoPublicEntity(filePath,storeName,styleName,aFactorPlanResponse,area.getCode()));
}
}
}
//县
else {
// 县 D:\BJ-RUC\42\4201\420103\RealTime\20191025125410034
//获取所有县信息
List areaList = areaMapper.getCountyByCodes(zonalCode.split(","));
for (Area area : areaList) {
// 县 D:\BJ-RUC\42\4201\420103\RealTime\20191025125410034
filePath = area.getParent().getCode().substring(0, 4)
+ “/” + area.getCode()
+ “/” + planTypePath
+ “/” + fileName;
String storeName = “sbjc_”+ UUID.randomUUID().toString().replace("-", “”);
geoPublishList.add(this.setGeoPublicEntity(filePath,storeName,styleName,aFactorPlanResponse,area.getCode()));
}
}
return geoPublishList;
}
/**
- 判断 开始时间和结束时间是没有跨半月,跨
- @param startTime
- @param endTime
- @return
*/
public boolean isNotKuaBanYue(Date startTime, Date endTime){
boolean bl = false;
// 开始时间
Calendar start = Calendar.getInstance();
start.setTime(startTime);
// 结束时间
Calendar end = Calendar.getInstance();
end.setTime(endTime);
int startMonth = start.get(Calendar.MONTH);
int startMonthOfDay = start.get(Calendar.DAY_OF_MONTH);
int endMonth = end.get(Calendar.MONTH);
int endMonthOfDay = end.get(Calendar.DAY_OF_MONTH);
if(startMonth == endMonth) {
if((startMonthOfDay<=15 && endMonthOfDay <=15)
|| (startMonthOfDay>15 && endMonthOfDay >15)) {
bl = true;
}
}
return bl;
}
/**
- 设置 图层对象
- @param filePath
- @param storeName
- @param styleName
- @param aFactorPlan
- @param zonalCode
- @return
*/
public GeoPublishEntity setGeoPublicEntity(String filePath, String storeName, String styleName,AFactorPlan aFactorPlan, String zonalCode){
GeoPublishEntity geoPublishEntity = new GeoPublishEntity();
geoPublishEntity.setFilePath(filePath);
geoPublishEntity.setStoreName(storeName);
geoPublishEntity.setStyleName(styleName);
geoPublishEntity.setaFactorPlanId(aFactorPlan.getId());
geoPublishEntity.setFactorType(aFactorPlan.getFactorType());
geoPublishEntity.setaFactorPlan(aFactorPlan);
geoPublishEntity.setZonalCode(zonalCode);
return geoPublishEntity;
}
/**
- 获取tif文件的相对路劲
- @param date
- @param planType
- @param planName
- @return
/
public String getPlanFilePathByDateAndPlanType(Date date, String planType, String planName){
String planTypePath = “”;
SimpleDateFormat yearSdf = new SimpleDateFormat(“yyyy”);
SimpleDateFormat monthSdf = new SimpleDateFormat(“yyyy/MM”);
SimpleDateFormat daySdf = new SimpleDateFormat(“yyyy/MM/dd”);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int monthOfDay = calendar.get(Calendar.DAY_OF_MONTH);
switch (planType) {
case “A实时” :
planTypePath = CommonContants.AFACTOR_REALTIME + “/” + planName;
break;
case “R实时” :
planTypePath = CommonContants.AFACTOR_REALTIME + “/” + planName;
break;
case “A定时年” :
planTypePath = String.valueOf(year + 1);
break;
case “R定时年” :
planTypePath = String.valueOf(year + 1);
break;
case “A定时月” :
if(month == 12) {
planTypePath = String.valueOf(year + 1) +"/01";
}
else {
planTypePath = String.valueOf(year) + “/” + String.valueOf(month + 1);
}
// planTypePath = monthSdf.format(date);
break;
case “R定时月” :
if(month == 12) {
planTypePath = String.valueOf(year + 1) +"/01";
}
else {
planTypePath = String.valueOf(year) + “/” + String.valueOf(month + 1);
}
// planTypePath = monthSdf.format(date);
break;
case “A定时半月” :
//下半月
if(monthOfDay == 15) {
int byMonthA = (2month);
planTypePath = String.valueOf(year) + “/by” + (byMonthA<10?(“0”+byMonthA) : byMonthA);
}
//上半月
else {
int byMonthA = (2month - 1);
planTypePath = String.valueOf(year) + “/by” + (byMonthA<10?(“0”+byMonthA) : byMonthA);
}
//int byMonthA = (2month - 1);
//planTypePath = yearSdf.format(date) + “/by” + (byMonthA<10?(“0”+byMonthA) : byMonthA);
// if(month<16) {
// //上半月 2n - 1
// planTypePath = yearSdf.format(date) + “/by” + (2month + 11);
// }{
// //下班月 2n + 12
// planTypePath = yearSdf.format(date) + “/by” + (2month + 12);
// }
break;
case “R定时半月” :
//下半月
if(monthOfDay == 15) {
int byMonthA = (2month);
planTypePath = String.valueOf(year) + “/by” + (byMonthA<10?(“0”+byMonthA) : byMonthA);
}
//上半月
else {
int byMonthA = (2month - 1);
planTypePath = String.valueOf(year) + “/by” + (byMonthA<10?(“0”+byMonthA) : byMonthA);
}
//int byMonthR = (2month - 1);
//planTypePath = yearSdf.format(date) + “/by” + (byMonthR<10?(“0”+byMonthR) : byMonthR);
// if(month<16) {
// //上半月 2n + 11
// planTypePath = yearSdf.format(date) + “/” + (2month + 11);
// }{
// //下班月 2n + 12
// planTypePath = yearSdf.format(date) + “/” + (2*month + 12);
// }
break;
case “A定时日” :
planTypePath = daySdf.format(date);
break;
case “R定时日” :
planTypePath = daySdf.format(date);
break;
default :
break;
}
return planTypePath;
}
/**
- 保存发布的影像信息
- @param geoPublishEntity
- @return
*/
@Transactional(readOnly = false,rollbackFor = Exception.class)
public AFactorPlanGeo saveAfactorGeo(GeoPublishEntity geoPublishEntity){
// 存放发布的影像信息
AFactorPlanGeo aFactorPlanGeo = new AFactorPlanGeo();
aFactorPlanGeo.setAFactorPlanId(geoPublishEntity.getaFactorPlanId());
aFactorPlanGeo.setFilePath(geoPublishEntity.getFilePath());
aFactorPlanGeo.setStyleName(geoPublishEntity.getStyleName());
aFactorPlanGeo.setFactorType(geoPublishEntity.getFactorType());
aFactorPlanGeo.setGeoWs(Global.getConfig(“geoserver.ws”));
aFactorPlanGeo.setGeoName(geoPublishEntity.getStoreName());
aFactorPlanGeo.setZonalCode(geoPublishEntity.getZonalCode());
aFactorPlanGeo.setPlanName(geoPublishEntity.getaFactorPlan().getPlanName());
aFactorPlanGeo.setPlanType(geoPublishEntity.getaFactorPlan().getPlanType());
aFactorPlanGeo.setScope(geoPublishEntity.getaFactorPlan().getScope());
aFactorPlanGeo.setId(IdGen.uuid());
aFactorPlanGeo.setCreateDate(new Date());
aFactorPlanGeoMapper.insert(aFactorPlanGeo);
return aFactorPlanGeo;
}
public Page findPage(Page page, AFactorPlan aFactorPlan) {
return super.findPage(page, aFactorPlan);
}
public Page findPageGroupByPlanName(Page page, AFactorPlan aFactorPlan) {
aFactorPlan.setPage(page);
page.setList(mapper.findPageGroupByPlanName(aFactorPlan));
return page;
}
/**
- A 计算实时计算保存
- @param aFactorPlan
*/
@Transactional(readOnly = false)
public void saveAfactor(AFactorPlan aFactorPlan) {
aFactorPlan.setIdType(“AUTO”);
aFactorPlan.setPlanStartTime(new Date());
aFactorPlan.setState(“待处理”);
aFactorPlan.setPlanName(DateFormatUtil.formatDate(“yyyyMMddHHmmssSSS”,new Date()));
super.save(aFactorPlan);
}
/**
- R实时计算保存
- @param aFactorPlan
*/
@Transactional(readOnly = false,rollbackFor = Exception.class)
public void saveRfactor(AFactorPlan aFactorPlan) {
aFactorPlan.setIdType(“AUTO”);
aFactorPlan.setPlanStartTime(new Date());
aFactorPlan.setState(“待处理”);
aFactorPlan.setPlanName(DateFormatUtil.formatDate(“yyyyMMddHHmmssSSS”,new Date()));
super.save(aFactorPlan);
}
/**
- 设置 A 计算保存的区域编码
- @param aFactorPlan
*/
public void setAFactorZonalCode(AFactorPlan aFactorPlan){
Integer chooseType = aFactorPlan.getChooseType();
if(chooseType != null) {
//选择的区域
if(chooseType == 1) {
// String zonalCodesParam[] = aFactorPlan.getZonalCode().split(",");
// List areaList = areaMapper.getCountyByCodes(zonalCodesParam);
// List countyList = areaList.stream().map(Area::getCode).collect(Collectors.toList());
// String zonalCodes[] = new String[countyList.size()];
// zonalCodes = countyList.toArray(zonalCodes);
// aFactorPlan.setZonalCodes(zonalCodes);
// aFactorPlan.setZonalCode(String.join(",",zonalCodes));
String zonalCodesParam[] = aFactorPlan.getZonalCode().split(",");
boolean haveProvince = false;
boolean haveCity = false;
List cityList = new ArrayList();
for (String code:zonalCodesParam) {
if(CommonContants.DEFAULT_SHENG_CODE.equals(code)) {
haveProvince = true;
}
if(“00”.equals(code.substring(code.length()-2,code.length()))) {
haveCity = true;
cityList.add(code);
}
}
// 有省级的,直接计算省级的
if(haveProvince) {
String zonalCodes[] = new String[]{CommonContants.DEFAULT_SHENG_CODE};
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setScope(CommonContants.SCOPE_SHENG);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
else {
if(haveCity) {
String zonalCodes[] = new String[cityList.size()];
zonalCodes = cityList.toArray(zonalCodes);
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setScope(CommonContants.SCOPE_SHI);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
else {
List areaList = areaMapper.getCountyByCodes(zonalCodesParam);
List countyList = areaList.stream().map(Area::getCode).collect(Collectors.toList());
String zonalCodes[] = new String[countyList.size()];
zonalCodes = countyList.toArray(zonalCodes);
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setScope(CommonContants.SCOPE_XIAN);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
}
}
//选择的八大块
else if(chooseType == 2) {
String sbsjCodes[] = aFactorPlan.getSbsjCode().split(",");
AddvSbSj addvSbSj = new AddvSbSj();
addvSbSj.setSbsjCodes(sbsjCodes);
List addvSbsjList = sbSjMapper.findAllAddvBySbSjs(addvSbSj);
List countyList = addvSbsjList.stream().map(AddvSbSj::getCountyCode).collect(Collectors.toList());
String zonalCodes[] = new String[countyList.size()];
zonalCodes = countyList.toArray(zonalCodes);
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
//选择小流域
else if(chooseType == 3) {
String zonalCodes[] = aFactorPlan.getBasincode().split(",");
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
}
else {
// 区域集合
String zonalCodes[] = aFactorPlan.getZonalCode().split(",");
aFactorPlan.setZonalCodes(zonalCodes);
}
}
/**
- 设置 R 计算保存的区域编码
- @param aFactorPlan
*/
public void setRFactorZonalCode(AFactorPlan aFactorPlan){
Integer chooseType = aFactorPlan.getChooseType();
if(chooseType != null) {
//选择的区域
if(chooseType == 1) {
String zonalCodesParam[] = aFactorPlan.getZonalCode().split(",");
boolean haveProvince = false;
boolean haveCity = false;
List cityList = new ArrayList();
for (String code:zonalCodesParam) {
if(CommonContants.DEFAULT_SHENG_CODE.equals(code)) {
haveProvince = true;
}
if(“00”.equals(code.substring(code.length()-2,code.length()))) {
haveCity = true;
cityList.add(code);
}
}
// 有省级的,直接计算省级的
if(haveProvince) {
String zonalCodes[] = new String[]{CommonContants.DEFAULT_SHENG_CODE};
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setScope(CommonContants.SCOPE_SHENG);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
else {
if(haveCity) {
String zonalCodes[] = new String[cityList.size()];
zonalCodes = cityList.toArray(zonalCodes);
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setScope(CommonContants.SCOPE_SHI);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
else {
List areaList = areaMapper.getCountyByCodes(zonalCodesParam);
List countyList = areaList.stream().map(Area::getCode).collect(Collectors.toList());
String zonalCodes[] = new String[countyList.size()];
zonalCodes = countyList.toArray(zonalCodes);
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setScope(CommonContants.SCOPE_XIAN);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
}
}
//选择的八大块
else if(chooseType == 2) {
String sbsjCodes[] = aFactorPlan.getSbsjCode().split(",");
AddvSbSj addvSbSj = new AddvSbSj();
addvSbSj.setSbsjCodes(sbsjCodes);
List addvSbsjList = sbSjMapper.findAllAddvBySbSjs(addvSbSj);
List countyList = addvSbsjList.stream().map(AddvSbSj::getCountyCode).collect(Collectors.toList());
String zonalCodes[] = new String[countyList.size()];
zonalCodes = countyList.toArray(zonalCodes);
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
//选择小流域
else if(chooseType == 3) {
String zonalCodes[] = aFactorPlan.getBasincode().split(",");
aFactorPlan.setZonalCodes(zonalCodes);
aFactorPlan.setZonalCode(String.join(",",zonalCodes));
}
}
else {
// 区域集合
String zonalCodes[] = aFactorPlan.getZonalCode().split(",");
aFactorPlan.setZonalCodes(zonalCodes);
}
}
@Transactional(readOnly = false)
public void delete(AFactorPlan aFactorPlan) {
super.delete(aFactorPlan);
}
}
3、entity
package com.jeeplus.modules.analysis.entity;
import java.util.Date;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeeplus.core.persistence.DataEntity;
/**
-
@author zb
-
A因子计算任务
*/
public class AFactorPlan extends DataEntity{
/**
*/
private static final long serialVersionUID = 1L;
/**
- 页面选择的类型 区域、八大块、小流域
*/
private Integer chooseType;
/**
- 因子类型
*/
private Integer factorType;
/**
- 开始时间
/
private Date planStartTime;
/*
- 截止时间
/
private Date planEndTime;
/*
- 开始时间
/
@NotNull(message = “开始时间不能为空”)
private Date startTime;
/*
结束时间
/
@NotNull(message = “截止时间不能为空”)
private Date endTime;
/
- 计算级别(“省”、“市”、“县”、“小流域”)
/
@NotBlank(message = “计算级别不能为空”)
private String scope;
/*
- 任务类型(“即时”、“周期”)
/
@NotBlank(message = “任务类型不能为空”)
private String planType;
/*
- 任务名称(采用任务发布时间字符串)
/
private String planName;
/*
- 分辨率
/
@NotNull(message = “分辨率不能为空”)
private Double cellSize;
/
- 区域编号
*/
@NotBlank(message = “区域编号不能为空”)
private String zonalCode;
/**
- 区域、小流域编码集合
/
private String zonalCodes[];
/*
- 区域名称
/
private String zonalName;
/*
- 小流域编码
/
private String basincode;
/*
- 小流域名称
/
private String basinname;
/*
- 三大分区编码
/
private String sbsjCode;
/*
- 三大分区名称
*/
private String sbsjName;
/**
- 处理状态
*/
private String state;
/**
- 错误消息
*/
private String errorMessage;
/**
- 用户区域编码
- @return
*/
private String userAreaCode;
/**
- 用户级别
*/
private Integer userLevel;
private String searchAreaCodes;//逗号分隔的用户区划下的区域编码集合
private String searchBasincodes;//逗号分隔的用户区划下的小流域编码集合
public String getSearchAreaCodes() {
return searchAreaCodes;
}
public void setSearchAreaCodes(String searchAreaCodes) {
this.searchAreaCodes = searchAreaCodes;
}
public String getSearchBasincodes() {
return searchBasincodes;
}
public void setSearchBasincodes(String searchBasincodes) {
this.searchBasincodes = searchBasincodes;
}
public String getUserAreaCode() {
return userAreaCode;
}
public void setUserAreaCode(String userAreaCode) {
this.userAreaCode = userAreaCode;
}
public Integer getUserLevel() {
return userLevel;
}
public void setUserLevel(Integer userLevel) {
this.userLevel = userLevel;
}
public String[] getZonalCodes() {
return zonalCodes;
}
public void setZonalCodes(String[] zonalCodes) {
this.zonalCodes = zonalCodes;
}
public String getSbsjCode() {
return sbsjCode;
}
public void setSbsjCode(String sbsjCode) {
this.sbsjCode = sbsjCode;
}
public String getSbsjName() {
return sbsjName;
}
public void setSbsjName(String sbsjName) {
this.sbsjName = sbsjName;
}
public Integer getChooseType() {
return chooseType;
}
public void setChooseType(Integer chooseType) {
this.chooseType = chooseType;
}
@JsonFormat(pattern = “yyyy-MM-dd HH:mm:ss”)
public Date getPlanStartTime() {
return planStartTime;
}
public void setPlanStartTime(Date planStartTime) {
this.planStartTime = planStartTime;
}
@JsonFormat(pattern = “yyyy-MM-dd HH:mm:ss”)
public Date getPlanEndTime() {
return planEndTime;
}
public void setPlanEndTime(Date planEndTime) {
this.planEndTime = planEndTime;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public Double getCellSize() {
return cellSize;
}
public void setCellSize(Double cellSize) {
this.cellSize = cellSize;
}
public String getZonalCode() {
return zonalCode;
}
public void setZonalCode(String zonalCode) {
this.zonalCode = zonalCode;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
@JsonFormat(pattern = “yyyy-MM-dd HH:mm:ss”)
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
@JsonFormat(pattern = “yyyy-MM-dd HH:mm:ss”)
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getFactorType() {
return factorType;
}
public void setFactorType(Integer factorType) {
this.factorType = factorType;
}
public String getZonalName() {
return zonalName;
}
public void setZonalName(String zonalName) {
this.zonalName = zonalName;
}
public String getBasincode() {
return basincode;
}
public void setBasincode(String basincode) {
this.basincode = basincode;
}
public String getBasinname() {
return basinname;
}
public void setBasinname(String basinname) {
this.basinname = basinname;
}
}
package com.jeeplus.modules.analysis.entity;
import com.jeeplus.core.persistence.DataEntity;
import java.util.List;
/**
-
@author zb
-
A因子计算任务发布的影像表
*/
public class AFactorPlanGeo extends DataEntity{
/**
*/
private static final long serialVersionUID = 1L;
/**
- A因子任务表
/
private String aFactorPlanId;
/*
- 范围
/
private String scope;
/*
- 编码
/
private String zonalCode;
/*
- 任务类型(“即时”、“周期”)
/
private String planType;
/*
- 任务名称(采用任务发布时间字符串)
*/
private String planName;
/**
- 因子类型
/
private Integer factorType;
/*
- geoserver 工作区
*/
private String geoWs;
/**
- geoserver 图层名
*/
private String geoName;
/**
- tif文件路径
*/
private String filePath;
/**
- tif图层样式文件名
*/
private String styleName;
/**
- 用户包含的区域集合
*/
private List areaCodes;
private boolean success = true;// 是否成功
private String msg = “操作成功”;// 提示信息
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List getAreaCodes() {
return areaCodes;
}
public void setAreaCodes(List areaCodes) {
this.areaCodes = areaCodes;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getStyleName() {
return styleName;
}
public void setStyleName(String styleName) {
this.styleName = styleName;
}
public String getAFactorPlanId() {
return aFactorPlanId;
}
public void setAFactorPlanId(String aFactorPlanId) {
this.aFactorPlanId = aFactorPlanId;
}
public Integer getFactorType() {
return factorType;
}
public void setFactorType(Integer factorType) {
this.factorType = factorType;
}
public String getGeoWs() {
return geoWs;
}
public void setGeoWs(String geoWs) {
this.geoWs = geoWs;
}
public String getGeoName() {
return geoName;
}
public void setGeoName(String geoName) {
this.geoName = geoName;
}
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getZonalCode() {
return zonalCode;
}
public void setZonalCode(String zonalCode) {
this.zonalCode = zonalCode;
}
}
package com.jeeplus.modules.analysis.dto;
import com.jeeplus.modules.analysis.entity.AFactorPlan;
import java.io.Serializable;
public class GeoPublishEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 任务ID
*/
private String aFactorPlanId;
/**
* 因子类型
*/
private Integer factorType;
/**
* 文件路径
*/
private String filePath;
/**
* 图层名称
*/
private String storeName;
/**
* 样式名称
*/
private String styleName;
/**
* A计算任务
*/
private AFactorPlan aFactorPlan;
/**
* 区域编码
*/
private String zonalCode;
private String zonalName;
public String getZonalName() {
return zonalName;
}
public void setZonalName(String zonalName) {
this.zonalName = zonalName;
}
public String getZonalCode() {
return zonalCode;
}
public void setZonalCode(String zonalCode) {
this.zonalCode = zonalCode;
}
public AFactorPlan getaFactorPlan() {
return aFactorPlan;
}
public void setaFactorPlan(AFactorPlan aFactorPlan) {
this.aFactorPlan = aFactorPlan;
}
public String getaFactorPlanId() {
return aFactorPlanId;
}
public void setaFactorPlanId(String aFactorPlanId) {
this.aFactorPlanId = aFactorPlanId;
}
public Integer getFactorType() {
return factorType;
}
public void setFactorType(Integer factorType) {
this.factorType = factorType;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStyleName() {
return styleName;
}
public void setStyleName(String styleName) {
this.styleName = styleName;
}
}
4、js代码
<%@ page contentType=“text/html; charset=UTF-8” pageEncoding=“UTF-8” %>
<%@ page language=“java” contentType=“text/html; charset=UTF-8” pageEncoding=“UTF-8”%>
<%@ include file="/webpage/include/taglib.jsp"%>
A因子计算地图 <%@ include file="/webpage/include/bootstraptable.jsp"%>
<%----%>
日 半月 月 年 |
计算级别: |
县 小流域 |
起止时间: |
|
|
区域 八大块 小流域 |
|
×
|
×
|
开始计算 |
|
<%@include file="js/aFactorMap.js" %>
@charset “UTF-8”;
#map {
height: 100%;
width: 100%;
}
#position{
float: right;
position: absolute;
bottom: 70px;
height: 20px;
z-index: 2000;
color: #fff;
right: 80px;
display: block;
}
#scaleLine{
float: left;
position: absolute;
bottom: 40px;
height: 20px;
z-index: 2000;
color: #fff;
right: 200px;
display: block;
}
.navigate-container{
position:fixed;
z-index: 99;
margin-left: 50px;
margin-top: 20px;
}
#right_contont{
width: 340px;
height: auto;
max-height: 100%;
position: fixed;
z-index: 999;
/* background: #fff; */
right: 0;
}
.map-top{
position: absolute;
top: 0;
width: 100%;
left: 0;
text-align: center;
margin: 0;
background: #fff;
z-index: 3000;
}
#bottom_content{
width: 100%;
height: 310px;
position: fixed;
z-index: 2001;
bottom: -285px;
background: #fff;
padding: 0px 3px 3px 3px;
/* overflow-y: scroll; */
}
.bottom_title {
position: relative;
margin: 0 auto;
display: block;
height: 30px;
width: 100%;
}
#bottomBotton{
width: 150px;
display: block;
margin: 0 auto;
}
.bottom_table {
height: 280px;
overflow-y: scroll;
position:relative;
}
.bottom_table_refresh{
position:absolute;
z-index: 2;
top: 1px;
right: 5px;
}
#aFactorTaskTable .dropdown-menu {
position:relative;
}
#aFactorTaskTable .dropdown-menu > li {
list-style: none;
position: absolute;
top: -34px;
left: -78px;
background: #fff;
width: 150px;
text-align: left;
padding: 2px;
border: #d6d6d6 1px solid;
height: 32px;
line-height: 32px;
}
.fixed-table-body {
overflow: visible;
}
#aFactorTaskTable .dropdown-menu > li > a {
padding: 3px 5px;
}
html {
font-size:14px;
}
#body-container {
margin-left: 0px !important;
margin-top: 0px !important;
padding: 0px;
overflow-x: hidden !important;
transition: all 0.2s ease-in-out !important;
height: 100% !important;
}
.map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
.layui-layer {
right:5px;
left: initial;
}
.layui-layim-close .layui-layer-content span {
width: auto;
max-width: 120px;
}
.layim-chat-list li span, .layui-layim-min .layui-layer-content span {
width: 100px;
padding-left: 10px;
font-size: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
body .layui-layim-min {
border: 1px solid #D9D9D9;
}
.layui-layim-min .layui-layer-content {
margin: 0 5px;
padding: 5px 10px;
white-space: nowrap;
}
.layim-chat-list li, .layui-layim-min .layui-layer-content {
position: relative;
margin: 5px;
padding: 5px 30px 5px 5px;
line-height: 40px;
cursor: pointer;
border-radius: 3px;
}
.layui-nav-child {
top: auto;
bottom: 40px;
}
.layui-bg-tl {
background: #F5F5F5 !important;
}
.layui-nav .layui-nav-item a {
color: #000;
}
.layui-nav .layui-nav-item a:hover {
color: #000;
}
.layui-nav-child dd {
line-height: 36px;
}
.layui-nav .layui-nav-item {
line-height: 45px;
}
.layui-input-inline {
height: 38px;
}
.layui-form-item .layui-input-inline {
width: 100%;
}
.well {
padding: 5px;
}
.form-horizontal {
margin: 0;
}
.ol-popup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
padding: 5px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
width: auto;
min-width: 500px;
}
.ol-popup:after, .ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
.ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
.ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.ol-popup-closer:after {
content: "✖";
}
.popup-content > div{
/* border: 1px solid #d6d6d6; */
}
.popup-content > div > div{
border-bottom : 1px solid #d6d6d6;
line-height: 1.5rem;
}
.popup-content > div > div:last-child{
border-bottom : none;
}
.popup-content > fieldset{
border: 1px solid #d6d6d6;
padding: .25em;
margin: .25rem;
border: 1px solid silver;
}
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 0;
line-height: inherit;
padding: .5em;
padding-bottom: 0;
border: 0;
width: auto;
font-size: 16px;
webkit-box-sizing: border-box;
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
white-space: normal;
}
.popup-content > fieldset > div{
border-bottom : 1px solid #d6d6d6;
line-height: 1.5rem;
width: 250px;
max-height: 125px;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
overflow: hidden;
}
.popup-content > fieldset > div:last-child{
border-bottom : none;
}
.layui-colla-content {
padding: 0;
}
.spc{width: 100%;background-color: red;}
.sp{
display: inline-block;
}
.main-container {
height: 100% !important;
overflow-y: scroll;
}
.page-content form table tr td > a.btn {
padding:0 .25rem;
}
.table > thead > tr {
background: #e3f2ff !important;
}
.animation {
position: absolute;
top: 0;
right: 0;
width: 20rem;
background: #fff;
}
.animation .container{
display: flex;width:100%;
}
.animation .container > label{
display: inline-block;
margin: 0;
width: 5rem;
padding-top: .25rem;
}
.animation .container > button{
background: #69aab8;
border: 1px #fff solid;
border-radius: .3rem;
height: 30px;
width: 13rem;
}
.layui-table td, .layui-table th {
position: relative;
/* padding: 2px !important;*/
min-height: 20px;
line-height: 20px;
font-size: 14px;
/* border:unset;*/
}
.layui-table-search td, .layui-table-search th{
padding: 2px !important;
border:unset;
}
.input-group .input-group-btn .btn {
width: 35px;
height: 32px;
}
.layui-tab-content{
padding: 5px 5px !important;
background-color: #ffffff;
}
.layui-tab-title .layui-this{
color:#1890ff !important;
}
.search-botton{
position: absolute;
top: 1px;
right: 5px;
}
.shenSuo-botton{
position: absolute;
left: 0;
top: 0;
color: #666666;
}
.shenSuo-botton:hover {
color: #1890ff;
}
.container{
position:relative;
display:block;
height:100%;
width:100%;
}
.ant-layout-footer, .ant-layout-header {
flex: 0 0 auto;
}
.ant-layout-header {
height: 64px;
padding: 0 50px;
line-height: 64px;
background: #001529;
}
.header___1fxJP {
height: 24px;
line-height: 24px;
font-size: 18px;
margin: 10px 20px 0 10px;
background-color: transparent;
padding: 0;
}
.tl-container{
z-index: 5;
position: absolute;
bottom: 20px;
left: 0;
width: 400px;
height: 250px;
color: #fff;
background-color: rgba(0,0,0,.55);
overflow: hidden;
}
.row___2TQGG {
line-height: 28px;
margin: 0 20px;
}
.ant-row {
position: relative;
height: auto;
zoom: 1;
display: block;
box-sizing: border-box;
}
.ant-col-12{
display:block;
width:50%;
box-sizing: border-box;
flex: 0 0 auto;
float: left;
margin: 0;
color: #fff;
font-size: 14px;
}
.anticon[tabindex] {
cursor: pointer;
}
.container___2rQsv {
z-index: 5;
position: absolute;
bottom: 40px;
left: 20px;
display: none;
}
.ant-btn {
line-height: 1.499;
position: relative;
display: inline-block;
font-weight: 400;
white-space: nowrap;
text-align: center;
background-image: none;
box-shadow: 0 2px 0 rgba(0,0,0,.015);
cursor: pointer;
transition: all .3s cubic-bezier(.645,.045,.355,1);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
touch-action: manipulation;
height: 32px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
color: rgba(0,0,0,.65);
background-color: #fff;
border: 1px solid #d9d9d9;
}
.anticon {
display: inline-block;
color: inherit;
font-style: normal;
line-height: 0;
text-align: center;
text-transform: none;
vertical-align: -.125em;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ant-btn-primary {
color: #fff;
background-color: #1890ff;
border-color: #1890ff;
text-shadow: 0 -1px 0 rgba(0,0,0,.12);
box-shadow: 0 2px 0 rgba(0,0,0,.045);
}
.ant-btn, .ant-btn:active, .ant-btn:focus {
outline: 0;
}
.ant-btn-circle, .ant-btn-circle-outline {
width: 32px;
height: 32px;
padding: 0;
font-size: 16px;
border-radius: 50%;
}