From e129cf3e703b98b6ffeed14e9d39d4bff84c196e Mon Sep 17 00:00:00 2001 From: huangfeng Date: Wed, 10 Jul 2024 14:23:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E6=B2=B3=E5=8D=97?= =?UTF-8?q?=E8=A6=86=E5=86=B0=E6=8B=89=E5=8A=9B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ZhipingController.java | 18 +- .../entity/TerminalPoint.java | 178 +++++ .../entity/TerminalPointExample.java | 621 ++++++++++++++++++ .../dao/TerminalPointMapper.java | 97 +++ .../resources/mappers/TerminalPointMapper.xml | 271 ++++++++ .../impl/HenanServiceImpl.java | 97 +++ .../service/HenanService.java | 15 + 7 files changed, 1290 insertions(+), 7 deletions(-) create mode 100644 xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPoint.java create mode 100644 xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPointExample.java create mode 100644 xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/TerminalPointMapper.java create mode 100644 xymanager_dao/src/main/resources/mappers/TerminalPointMapper.xml create mode 100644 xymanager_service/src/main/java/com/shxy/xymanager_service/impl/HenanServiceImpl.java create mode 100644 xymanager_service/src/main/java/com/shxy/xymanager_service/service/HenanService.java diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/ZhipingController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/ZhipingController.java index ca2082b..980169f 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/ZhipingController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/ZhipingController.java @@ -10,6 +10,7 @@ import com.shxy.xymanager_common.zhiping.*; import com.shxy.xymanager_common.entity.LeadPulls; import com.shxy.xymanager_common.entity.Weathers; import com.shxy.xymanager_common.util.DateUtil; +import com.shxy.xymanager_service.service.HenanService; import com.shxy.xymanager_service.service.LeadPullsService; import com.shxy.xymanager_service.service.WeatherService; import io.swagger.annotations.Api; @@ -38,6 +39,8 @@ public class ZhipingController extends BaseController { WeatherService weatherService; @Autowired TokenUtil tokenUtil; + @Resource + HenanService henanService; @GetMapping("query") @ApiOperation("查询") @@ -227,11 +230,10 @@ public class ZhipingController extends BaseController { Date start = DateUtil.parse(startTime); Date end = DateUtil.parse(endTime); - List list = new ArrayList<>(); - PageInfo page = leadPullsService.list(null, null, null, - start.getTime() / 1000, end.getTime() / 1000, 1, 10000); - if (!CollectionUtils.isEmpty(page.getList())) { - for (LeadPulls pull : page.getList()) { + List result = new ArrayList<>(); + List list = henanService.queryPullIces(start, end); + if (!CollectionUtils.isEmpty(list)) { + for (LeadPulls pull : list) { PulliceModel item = new PulliceModel(); item.setCollTime(DateUtil.format(pull.getUpdateDate())); item.setPull(String.valueOf(pull.getMaxpullPull())); @@ -241,10 +243,12 @@ public class ZhipingController extends BaseController { item.setHumidity("0"); item.setWindSpeed("0"); item.setWAngle("0"); + item.setEquipId(pull.getCmdid()); + item.setPointId(pull.getCmdid() + "_" + pull.getPhase()); item.calculate(); - list.add(item); + result.add(item); } } - return SdqjResult.success(list); + return SdqjResult.success(result); } } diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPoint.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPoint.java new file mode 100644 index 0000000..94ae146 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPoint.java @@ -0,0 +1,178 @@ +package com.shxy.xymanager_common.entity; + +public class TerminalPoint { + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column terminal_point.id + * + * @mbg.generated + */ + private Integer id; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column terminal_point.term_id + * + * @mbg.generated + */ + private Integer termId; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column terminal_point.point + * + * @mbg.generated + */ + private String point; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column terminal_point.func_code + * + * @mbg.generated + */ + private String funcCode; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column terminal_point.ccll + * + * @mbg.generated + */ + private Integer ccll; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column terminal_point.id + * + * @return the value of terminal_point.id + * + * @mbg.generated + */ + public Integer getId() { + return id; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column terminal_point.id + * + * @param id the value for terminal_point.id + * + * @mbg.generated + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column terminal_point.term_id + * + * @return the value of terminal_point.term_id + * + * @mbg.generated + */ + public Integer getTermId() { + return termId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column terminal_point.term_id + * + * @param termId the value for terminal_point.term_id + * + * @mbg.generated + */ + public void setTermId(Integer termId) { + this.termId = termId; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column terminal_point.point + * + * @return the value of terminal_point.point + * + * @mbg.generated + */ + public String getPoint() { + return point; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column terminal_point.point + * + * @param point the value for terminal_point.point + * + * @mbg.generated + */ + public void setPoint(String point) { + this.point = point; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column terminal_point.func_code + * + * @return the value of terminal_point.func_code + * + * @mbg.generated + */ + public String getFuncCode() { + return funcCode; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column terminal_point.func_code + * + * @param funcCode the value for terminal_point.func_code + * + * @mbg.generated + */ + public void setFuncCode(String funcCode) { + this.funcCode = funcCode; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column terminal_point.ccll + * + * @return the value of terminal_point.ccll + * + * @mbg.generated + */ + public Integer getCcll() { + return ccll; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column terminal_point.ccll + * + * @param ccll the value for terminal_point.ccll + * + * @mbg.generated + */ + public void setCcll(Integer ccll) { + this.ccll = ccll; + } + + private String cmdid; + + public String getCmdid() { + return cmdid; + } + + public void setCmdid(String cmdid) { + this.cmdid = cmdid; + } +} \ No newline at end of file diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPointExample.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPointExample.java new file mode 100644 index 0000000..0de1240 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/TerminalPointExample.java @@ -0,0 +1,621 @@ +package com.shxy.xymanager_common.entity; + +import java.util.ArrayList; +import java.util.List; + +public class TerminalPointExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table terminal_point + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table terminal_point + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table terminal_point + * + * @mbg.generated + */ + protected List oredCriteria; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public TerminalPointExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table terminal_point + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andTermIdIsNull() { + addCriterion("term_id is null"); + return (Criteria) this; + } + + public Criteria andTermIdIsNotNull() { + addCriterion("term_id is not null"); + return (Criteria) this; + } + + public Criteria andTermIdEqualTo(Integer value) { + addCriterion("term_id =", value, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdNotEqualTo(Integer value) { + addCriterion("term_id <>", value, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdGreaterThan(Integer value) { + addCriterion("term_id >", value, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdGreaterThanOrEqualTo(Integer value) { + addCriterion("term_id >=", value, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdLessThan(Integer value) { + addCriterion("term_id <", value, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdLessThanOrEqualTo(Integer value) { + addCriterion("term_id <=", value, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdIn(List values) { + addCriterion("term_id in", values, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdNotIn(List values) { + addCriterion("term_id not in", values, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdBetween(Integer value1, Integer value2) { + addCriterion("term_id between", value1, value2, "termId"); + return (Criteria) this; + } + + public Criteria andTermIdNotBetween(Integer value1, Integer value2) { + addCriterion("term_id not between", value1, value2, "termId"); + return (Criteria) this; + } + + public Criteria andPointIsNull() { + addCriterion("point is null"); + return (Criteria) this; + } + + public Criteria andPointIsNotNull() { + addCriterion("point is not null"); + return (Criteria) this; + } + + public Criteria andPointEqualTo(String value) { + addCriterion("point =", value, "point"); + return (Criteria) this; + } + + public Criteria andPointNotEqualTo(String value) { + addCriterion("point <>", value, "point"); + return (Criteria) this; + } + + public Criteria andPointGreaterThan(String value) { + addCriterion("point >", value, "point"); + return (Criteria) this; + } + + public Criteria andPointGreaterThanOrEqualTo(String value) { + addCriterion("point >=", value, "point"); + return (Criteria) this; + } + + public Criteria andPointLessThan(String value) { + addCriterion("point <", value, "point"); + return (Criteria) this; + } + + public Criteria andPointLessThanOrEqualTo(String value) { + addCriterion("point <=", value, "point"); + return (Criteria) this; + } + + public Criteria andPointLike(String value) { + addCriterion("point like", value, "point"); + return (Criteria) this; + } + + public Criteria andPointNotLike(String value) { + addCriterion("point not like", value, "point"); + return (Criteria) this; + } + + public Criteria andPointIn(List values) { + addCriterion("point in", values, "point"); + return (Criteria) this; + } + + public Criteria andPointNotIn(List values) { + addCriterion("point not in", values, "point"); + return (Criteria) this; + } + + public Criteria andPointBetween(String value1, String value2) { + addCriterion("point between", value1, value2, "point"); + return (Criteria) this; + } + + public Criteria andPointNotBetween(String value1, String value2) { + addCriterion("point not between", value1, value2, "point"); + return (Criteria) this; + } + + public Criteria andFuncCodeIsNull() { + addCriterion("func_code is null"); + return (Criteria) this; + } + + public Criteria andFuncCodeIsNotNull() { + addCriterion("func_code is not null"); + return (Criteria) this; + } + + public Criteria andFuncCodeEqualTo(String value) { + addCriterion("func_code =", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeNotEqualTo(String value) { + addCriterion("func_code <>", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeGreaterThan(String value) { + addCriterion("func_code >", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeGreaterThanOrEqualTo(String value) { + addCriterion("func_code >=", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeLessThan(String value) { + addCriterion("func_code <", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeLessThanOrEqualTo(String value) { + addCriterion("func_code <=", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeLike(String value) { + addCriterion("func_code like", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeNotLike(String value) { + addCriterion("func_code not like", value, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeIn(List values) { + addCriterion("func_code in", values, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeNotIn(List values) { + addCriterion("func_code not in", values, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeBetween(String value1, String value2) { + addCriterion("func_code between", value1, value2, "funcCode"); + return (Criteria) this; + } + + public Criteria andFuncCodeNotBetween(String value1, String value2) { + addCriterion("func_code not between", value1, value2, "funcCode"); + return (Criteria) this; + } + + public Criteria andCcllIsNull() { + addCriterion("ccll is null"); + return (Criteria) this; + } + + public Criteria andCcllIsNotNull() { + addCriterion("ccll is not null"); + return (Criteria) this; + } + + public Criteria andCcllEqualTo(Integer value) { + addCriterion("ccll =", value, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllNotEqualTo(Integer value) { + addCriterion("ccll <>", value, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllGreaterThan(Integer value) { + addCriterion("ccll >", value, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllGreaterThanOrEqualTo(Integer value) { + addCriterion("ccll >=", value, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllLessThan(Integer value) { + addCriterion("ccll <", value, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllLessThanOrEqualTo(Integer value) { + addCriterion("ccll <=", value, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllIn(List values) { + addCriterion("ccll in", values, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllNotIn(List values) { + addCriterion("ccll not in", values, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllBetween(Integer value1, Integer value2) { + addCriterion("ccll between", value1, value2, "ccll"); + return (Criteria) this; + } + + public Criteria andCcllNotBetween(Integer value1, Integer value2) { + addCriterion("ccll not between", value1, value2, "ccll"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table terminal_point + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table terminal_point + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/TerminalPointMapper.java b/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/TerminalPointMapper.java new file mode 100644 index 0000000..442d121 --- /dev/null +++ b/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/TerminalPointMapper.java @@ -0,0 +1,97 @@ +package com.shxy.xymanager_dao.dao; + +import com.shxy.xymanager_common.entity.TerminalPoint; +import com.shxy.xymanager_common.entity.TerminalPointExample; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface TerminalPointMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + long countByExample(TerminalPointExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int deleteByExample(TerminalPointExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int deleteByPrimaryKey(Integer id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int insert(TerminalPoint row); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int insertSelective(TerminalPoint row); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + List selectByExample(TerminalPointExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + TerminalPoint selectByPrimaryKey(Integer id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("row") TerminalPoint row, @Param("example") TerminalPointExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int updateByExample(@Param("row") TerminalPoint row, @Param("example") TerminalPointExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(TerminalPoint row); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table terminal_point + * + * @mbg.generated + */ + int updateByPrimaryKey(TerminalPoint row); +} \ No newline at end of file diff --git a/xymanager_dao/src/main/resources/mappers/TerminalPointMapper.xml b/xymanager_dao/src/main/resources/mappers/TerminalPointMapper.xml new file mode 100644 index 0000000..d5e09a6 --- /dev/null +++ b/xymanager_dao/src/main/resources/mappers/TerminalPointMapper.xml @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + id, term_id, point, func_code, ccll + + + + + + delete from terminal_point + where id = #{id,jdbcType=INTEGER} + + + + delete from terminal_point + + + + + + + + SELECT LAST_INSERT_ID() + + insert into terminal_point (term_id, point, func_code, + ccll) + values (#{termId,jdbcType=INTEGER}, #{point,jdbcType=VARCHAR}, #{funcCode,jdbcType=VARCHAR}, + #{ccll,jdbcType=INTEGER}) + + + + + SELECT LAST_INSERT_ID() + + insert into terminal_point + + + term_id, + + + point, + + + func_code, + + + ccll, + + + + + #{termId,jdbcType=INTEGER}, + + + #{point,jdbcType=VARCHAR}, + + + #{funcCode,jdbcType=VARCHAR}, + + + #{ccll,jdbcType=INTEGER}, + + + + + + + update terminal_point + + + id = #{row.id,jdbcType=INTEGER}, + + + term_id = #{row.termId,jdbcType=INTEGER}, + + + point = #{row.point,jdbcType=VARCHAR}, + + + func_code = #{row.funcCode,jdbcType=VARCHAR}, + + + ccll = #{row.ccll,jdbcType=INTEGER}, + + + + + + + + + update terminal_point + set id = #{row.id,jdbcType=INTEGER}, + term_id = #{row.termId,jdbcType=INTEGER}, + point = #{row.point,jdbcType=VARCHAR}, + func_code = #{row.funcCode,jdbcType=VARCHAR}, + ccll = #{row.ccll,jdbcType=INTEGER} + + + + + + + update terminal_point + + + term_id = #{termId,jdbcType=INTEGER}, + + + point = #{point,jdbcType=VARCHAR}, + + + func_code = #{funcCode,jdbcType=VARCHAR}, + + + ccll = #{ccll,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + + update terminal_point + set term_id = #{termId,jdbcType=INTEGER}, + point = #{point,jdbcType=VARCHAR}, + func_code = #{funcCode,jdbcType=VARCHAR}, + ccll = #{ccll,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/HenanServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/HenanServiceImpl.java new file mode 100644 index 0000000..0d13aeb --- /dev/null +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/HenanServiceImpl.java @@ -0,0 +1,97 @@ +package com.shxy.xymanager_service.impl; + + +import com.github.pagehelper.PageInfo; +import com.shxy.xymanager_common.entity.*; +import com.shxy.xymanager_dao.dao.TerminalPointMapper; +import com.shxy.xymanager_service.service.HenanService; +import com.shxy.xymanager_service.service.LeadPullsService; +import com.shxy.xymanager_service.service.NewCacheService; +import com.shxy.xymanager_service.service.WeatherService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +@Service +@Slf4j +public class HenanServiceImpl implements HenanService { + + @Resource + LeadPullsService leadPullsService; + @Resource + WeatherService weatherService; + @Resource + TerminalPointMapper terminalPointMapper; + @Resource + NewCacheService newCacheService; + + @Override + public List queryMicromes(Date start, Date end) { + return null; + } + + @Override + public List queryPullIces(Date start, Date end) { + List pointList = this.getPointList(); + List idList = new ArrayList<>(); + for (TerminalPoint point : pointList) { + if (!idList.contains(point.getTermId())) { + idList.add(point.getTermId()); + } + } + + List result = new ArrayList<>(); + HashMap map = new HashMap<>(); + PageInfo page = leadPullsService.list(null, null, idList, + start.getTime() / 1000, end.getTime() / 1000, 1, 10000); + + for (LeadPulls item : page.getList()) { + String key = this.getKey(pointList, item); + if (key != null) { + if (map.containsKey(key)) { + LeadPulls old = map.get(key); + old.setMaxpullPull(old.getMaxpullPull() + item.getMaxpullPull()); + old.setMaxpullWind(old.getMaxpullWind() + item.getMaxpullWind()); + old.setMaxpullTilt(old.getMaxpullTilt() + item.getMaxpullTilt()); + } else { + map.put(key, item); + result.add(item); + } + } + } + return result; + } + + private List getPointList() { + TerminalPointExample example = new TerminalPointExample(); + TerminalPointExample.Criteria criteria = example.createCriteria(); + example.setOrderByClause("term_id asc, point asc"); + List list = terminalPointMapper.selectByExample(example); + for (TerminalPoint point : list) { + Terminals term = newCacheService.getTerminal(point.getTermId()); + if (term != null) { + point.setCmdid(term.getCmdid()); + } + } + + return list; + } + + private String getKey(List pointList, LeadPulls item) { + for (TerminalPoint point : pointList) { + if (item.getTermId().equals(point.getTermId()) && + point.getFuncCode().contains(String.valueOf(item.getFuncCode()))) { + String key = item.getUpdateTime() + "-" + item.getTermId() + "-" + point.getPoint(); + item.setPhase(point.getPoint()); + item.setCmdid(point.getCmdid()); + return key; + } + } + return null; + } +} diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/HenanService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/HenanService.java new file mode 100644 index 0000000..53af5e5 --- /dev/null +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/HenanService.java @@ -0,0 +1,15 @@ +package com.shxy.xymanager_service.service; + + +import com.shxy.xymanager_common.entity.LeadPulls; +import com.shxy.xymanager_common.entity.Weathers; + +import java.util.Date; +import java.util.List; + +public interface HenanService { + + List queryMicromes(Date start, Date end); + + List queryPullIces(Date start, Date end); +}