|
@@ -1,14 +1,26 @@
|
|
|
package com.huimv.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.huimv.admin.common.utils.DataUill;
|
|
|
+import com.huimv.admin.common.utils.Result;
|
|
|
+import com.huimv.admin.common.utils.ResultCode;
|
|
|
import com.huimv.admin.entity.ProtData;
|
|
|
import com.huimv.admin.mapper.ProtDataMapper;
|
|
|
import com.huimv.admin.service.IProtDataService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author author
|
|
@@ -17,4 +29,228 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> implements IProtDataService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProtDataMapper protDataMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
+ String loctionType = paramsMap.get("loctionType");
|
|
|
+ String startTime = paramsMap.get("startTime");
|
|
|
+ String endTime = paramsMap.get("endTime");
|
|
|
+ String type = paramsMap.get("type");
|
|
|
+ String dataType = paramsMap.get("dataType");
|
|
|
+
|
|
|
+ if (type == null || type == "") {
|
|
|
+ type = "1";
|
|
|
+ }
|
|
|
+ if (dataType == null || dataType == "") {
|
|
|
+ dataType = "1";
|
|
|
+ }
|
|
|
+ QueryWrapper<ProtData> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("farm_id", farmId);
|
|
|
+
|
|
|
+
|
|
|
+ List<ProtData> protDataList = null;
|
|
|
+ if ("1".equals(dataType)) {
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startTime = startTime + " 00:00:00";
|
|
|
+ endTime = endTime + " 23:59:59";
|
|
|
+ queryWrapper.between("create_date",startTime, endTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listPh(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本年
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfYear(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listPh(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
+ queryWrapper.ge("create_date", timesMonthmorning);
|
|
|
+ List<ProtData> protData = protDataMapper.listPh(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listPh(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //cod
|
|
|
+ else if ("2".equals(dataType)) {
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startTime = startTime + " 00:00:00";
|
|
|
+ endTime = endTime + " 23:59:59";
|
|
|
+ queryWrapper.between("create_date",startTime, endTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listCod(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本年
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfYear(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listCod(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
+ queryWrapper.ge("create_date", timesMonthmorning);
|
|
|
+ List<ProtData> protData = protDataMapper.listCod(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listCod(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //NH3N
|
|
|
+ else if ("3".equals(dataType)) {
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startTime = startTime + " 00:00:00";
|
|
|
+ endTime = endTime + " 23:59:59";
|
|
|
+ queryWrapper.between("create_date",startTime, endTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listNh3n(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本年
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfYear(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listNh3n(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
+ queryWrapper.ge("create_date", timesMonthmorning);
|
|
|
+ List<ProtData> protData = protDataMapper.listNh3n(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listNh3n(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //TP
|
|
|
+ else if ("4".equals(dataType)) {
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startTime = startTime + " 00:00:00";
|
|
|
+ endTime = endTime + " 23:59:59";
|
|
|
+ queryWrapper.between("create_date",startTime, endTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listTp(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本年
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfYear(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listTp(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
+ queryWrapper.ge("create_date", timesMonthmorning);
|
|
|
+ List<ProtData> protData = protDataMapper.listTp(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listTp(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //TN
|
|
|
+ else if ("5".equals(dataType)) {
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startTime = startTime + " 00:00:00";
|
|
|
+ endTime = endTime + " 23:59:59";
|
|
|
+ queryWrapper.between("create_date",startTime, endTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listTn(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本年
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfYear(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listTn(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
+ queryWrapper.ge("create_date", timesMonthmorning);
|
|
|
+ List<ProtData> protData = protDataMapper.listTn(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listTn(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //FLOW
|
|
|
+ else if ("6".equals(dataType)) {
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startTime = startTime + " 00:00:00";
|
|
|
+ endTime = endTime + " 23:59:59";
|
|
|
+ queryWrapper.between("create_date",startTime, endTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listFlow(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本年
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfYear(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listFlow(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
+ queryWrapper.ge("create_date", timesMonthmorning);
|
|
|
+ List<ProtData> protData = protDataMapper.listFlow(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
+ queryWrapper.ge("create_date", dateTime);
|
|
|
+ List<ProtData> protData = protDataMapper.listFlow(queryWrapper);
|
|
|
+ protDataList=protData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,protDataList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*@Override
|
|
|
+ public Result listType(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
+ String type = paramsMap.get("type");
|
|
|
+ QueryWrapper<ProtData> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("farm_id", farmId);
|
|
|
+
|
|
|
+ //ph
|
|
|
+ if ("1".equals(type)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }*/
|
|
|
}
|