|
@@ -12,7 +12,6 @@ import com.yunfeiyun.agmp.common.exception.BizException;
|
|
|
import com.yunfeiyun.agmp.common.service.WeatherService;
|
|
import com.yunfeiyun.agmp.common.service.WeatherService;
|
|
|
import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
import com.yunfeiyun.agmp.common.utils.DateUtils;
|
|
|
import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
import com.yunfeiyun.agmp.common.utils.SecurityUtils;
|
|
|
-import com.yunfeiyun.agmp.common.utils.StringUtils;
|
|
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsBlock;
|
|
import com.yunfeiyun.agmp.fms.domain.FmsBlock;
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsLand;
|
|
import com.yunfeiyun.agmp.fms.domain.FmsLand;
|
|
|
import com.yunfeiyun.agmp.fms.domain.FmsSolar;
|
|
import com.yunfeiyun.agmp.fms.domain.FmsSolar;
|
|
@@ -28,6 +27,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.DayOfWeek;
|
|
import java.time.DayOfWeek;
|
|
@@ -74,7 +74,120 @@ public class FmsConsoleController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WeatherService weatherService;
|
|
private WeatherService weatherService;
|
|
|
|
|
|
|
|
|
|
+ public void getWeather(ScreenDataReqVo reqVo, Map<String, Object> resultMap) {
|
|
|
|
|
+ FmsWeatherInfoResVo fmsWeatherInfoResVo = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ JSONObject resultObj = weatherService.getProjectWeather();
|
|
|
|
|
+ fmsWeatherInfoResVo = JSONObject.parseObject(resultObj.toString(), FmsWeatherInfoResVo.class);
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ List<FmsWeatherInfoResVo> weatherList = new ArrayList<>();
|
|
|
|
|
+ JSONArray data = resultObj.getJSONArray("data");
|
|
|
|
|
+ if (data != null) {
|
|
|
|
|
+ for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
+ String str = data.getString(i);
|
|
|
|
|
+ FmsWeatherInfoResVo weatherResVo = JSONObject.parseObject(str, FmsWeatherInfoResVo.class);
|
|
|
|
|
+ weatherResVo.setCity(fmsWeatherInfoResVo.getCity());
|
|
|
|
|
+ weatherResVo.setZoneProvincezh(map.get("zoneProvincezh") == null ? "" : map.get("zoneProvincezh").toString());
|
|
|
|
|
+ weatherResVo.setZoneCapitalzh(map.get("zoneCapitalzh") == null ? "" : map.get("zoneCapitalzh").toString());
|
|
|
|
|
+ weatherList.add(weatherResVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ resultMap.put("weather", weatherList);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new BizException(ErrorCode.FMS_WEATHER_SEARCH_FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询节气信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('fms:console:weather:info')")
|
|
|
|
|
+ @GetMapping("/weather/info")
|
|
|
|
|
+ public AjaxResult weatherInfo(ScreenDataReqVo reqVo) {
|
|
|
|
|
+
|
|
|
|
|
+ FmsWeatherInfoResVo fmsWeatherInfoResVo = new FmsWeatherInfoResVo();
|
|
|
|
|
+ FmsSolar fmsSolar = iFmsSolarService.getNowSolar(DateUtils.dateTimeNow(), SecurityUtils.getTid());
|
|
|
|
|
+ fmsWeatherInfoResVo.setSolarName(fmsSolar.getSolarName());
|
|
|
|
|
+ fmsWeatherInfoResVo.setSolarRemark(fmsSolar.getSolarRemark());
|
|
|
|
|
+ fmsWeatherInfoResVo.setSolarDigest(fmsSolar.getSolarDigest());
|
|
|
|
|
+ return AjaxResult.success(fmsWeatherInfoResVo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页数据查询
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('fms:console:console:data')")
|
|
|
|
|
+ @GetMapping(value = "/console/data")
|
|
|
|
|
+ public AjaxResult consoleData(ScreenDataReqVo reqVo) {
|
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ JSONObject resultObj = weatherService.getProjectWeather("7");
|
|
|
|
|
+ String city = resultObj.getString("city");
|
|
|
|
|
+ String province = resultObj.getString("province");
|
|
|
|
|
+ String district = resultObj.getString("district");
|
|
|
|
|
+
|
|
|
|
|
+ List<FmsWeatherInfoResVo> weatherList = new ArrayList<>();
|
|
|
|
|
+ JSONArray data = resultObj.getJSONArray("data");
|
|
|
|
|
+ if (data != null) {
|
|
|
|
|
+ for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
+ String str = data.getString(i);
|
|
|
|
|
+ FmsWeatherInfoResVo weatherResVo = JSONObject.parseObject(str, FmsWeatherInfoResVo.class);
|
|
|
|
|
+ weatherResVo.setCity(city);
|
|
|
|
|
+ weatherResVo.setZoneProvincezh(province);
|
|
|
|
|
+ weatherResVo.setZoneCapitalzh(district);
|
|
|
|
|
+ weatherList.add(weatherResVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ resultMap.put("weather", weatherList);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ throw new BizException(ErrorCode.FMS_WEATHER_SEARCH_FAILED);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ boolean b = SecurityUtils.isValidate();
|
|
|
|
|
+ if (b) {
|
|
|
|
|
+ List<String> strings = dataAuthUtil.landListOfBlock();
|
|
|
|
|
+ if (strings.isEmpty()) {
|
|
|
|
|
+ resultMap.put("landTotal", new ArrayList<>());
|
|
|
|
|
+ Map<String, Object> countMap = new HashMap<>();
|
|
|
|
|
+ countMap.put("count1", new ArrayList<>());
|
|
|
|
|
+ countMap.put("count2", new ArrayList<>());
|
|
|
|
|
+ countMap.put("count3", new ArrayList<>());
|
|
|
|
|
+ resultMap.put("taskTypeCount", countMap);
|
|
|
|
|
+ resultMap.put("fmsPlanStat", new ArrayList<>());
|
|
|
|
|
+ return AjaxResult.success(resultMap);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* 获取基地统计信息 */
|
|
|
|
|
+ getLandStat(reqVo, resultMap, b);
|
|
|
|
|
+
|
|
|
|
|
+ /* 获取农事任务统计信息 */
|
|
|
|
|
+ getTaskStat(reqVo, resultMap, b);
|
|
|
|
|
|
|
|
|
|
+ /* 当前种植状态 */
|
|
|
|
|
+ getPlanStat(reqVo, resultMap, b);
|
|
|
|
|
+
|
|
|
|
|
+ //取收入支出數據
|
|
|
|
|
+ SelectOfTssStatReqVo reqVo1 = new SelectOfTssStatReqVo();
|
|
|
|
|
+ reqVo1.setStartTime(DateUtils.dateTimeNow(DateUtils.YYYY));
|
|
|
|
|
+ Map<String, Object> moneyMap = getMoney(reqVo1);
|
|
|
|
|
+ resultMap.put("totalExpenditure", moneyMap.get("payTotal"));
|
|
|
|
|
+ resultMap.put("orderPriceSum", moneyMap.get("incomeTotal"));
|
|
|
|
|
+
|
|
|
|
|
+ resultMap.put("warehouseNumber", "0");
|
|
|
|
|
+
|
|
|
|
|
+ WmsWarehouseListReqVo wmsWarehouseListReqVo = new WmsWarehouseListReqVo();
|
|
|
|
|
+ wmsWarehouseListReqVo.setWarehouseType("");
|
|
|
|
|
+ List<WmsWarehouse> wmsWarehouseList = wmsWarehouseService.selectWmsWarehouseList(wmsWarehouseListReqVo);
|
|
|
|
|
+
|
|
|
|
|
+ if(wmsWarehouseList!=null){
|
|
|
|
|
+ resultMap.put("warehouseNumber", "" + wmsWarehouseList.size());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return AjaxResult.success(resultMap);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -247,7 +360,7 @@ public class FmsConsoleController {
|
|
|
|
|
|
|
|
if (isValid) {
|
|
if (isValid) {
|
|
|
List<String> strings = dataAuthUtil.blockList();
|
|
List<String> strings = dataAuthUtil.blockList();
|
|
|
- if (strings.size() == 0) {
|
|
|
|
|
|
|
+ if (strings.isEmpty()) {
|
|
|
countMap.put("count1", new JSONArray());
|
|
countMap.put("count1", new JSONArray());
|
|
|
countMap.put("count2", new JSONArray());
|
|
countMap.put("count2", new JSONArray());
|
|
|
countMap.put("count3", new JSONArray());
|
|
countMap.put("count3", new JSONArray());
|