1、生成灌溉模型计算模块;
2、生成灌溉模型计算需要的数据库表与实体(作物、作物计算参数)。
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoMd; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoMd.MdCrops; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/6 10:51 |
| | | * @Description |
| | | */ |
| | | public interface MdCropsMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(MdCrops record); |
| | | |
| | | int insertSelective(MdCrops record); |
| | | |
| | | MdCrops selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(MdCrops record); |
| | | |
| | | int updateByPrimaryKey(MdCrops record); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.daoMd; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoMd.MdParam; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/6 10:51 |
| | | * @Description |
| | | */ |
| | | public interface MdParamMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(MdParam record); |
| | | |
| | | int insertSelective(MdParam record); |
| | | |
| | | MdParam selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(MdParam record); |
| | | |
| | | int updateByPrimaryKey(MdParam record); |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoMd; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/6 10:51 |
| | | * @Description |
| | | */ |
| | | public class MdCrops { |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * ä½ç©åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 计ç®å¼å§æ¥æï¼ä¸å¹´çä½ç©æ¯ç§æ¤æ¶é´æåºè½æ¶é´ï¼ï¼å¦æä¸ºç©ºå¼å为é¿ä¹
计ç®ï¼æ ¼å¼yyyy-mm-dd |
| | | */ |
| | | private Date startDt; |
| | | |
| | | /** |
| | | * è®¡ç®æªæ¢æ¥æï¼ä¸å¹´çä½ç©æ¯åæ¢çæºæ¶é´ï¼ï¼å¦æä¸ºç©ºå¼å为é¿ä¹
计ç®ï¼æ ¼å¼yyyy-mm-dd |
| | | */ |
| | | private Date endDt; |
| | | |
| | | /** |
| | | * æ¯å¦åæ¢è®¡ç®ï¼1æ¯ï¼0å¦ |
| | | */ |
| | | private Byte stopped; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remarks; |
| | | |
| | | /** |
| | | * æ°æ®è®°å½åå»ºæ¥æï¼æ ¼å¼yyyy-mm-dd hh:mm:ss |
| | | */ |
| | | private Date createDt; |
| | | |
| | | /** |
| | | * æ¯å¦å é¤ï¼1æ¯ï¼0å¦ |
| | | */ |
| | | private Byte deleted; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Date getStartDt() { |
| | | return startDt; |
| | | } |
| | | |
| | | public void setStartDt(Date startDt) { |
| | | this.startDt = startDt; |
| | | } |
| | | |
| | | public Date getEndDt() { |
| | | return endDt; |
| | | } |
| | | |
| | | public void setEndDt(Date endDt) { |
| | | this.endDt = endDt; |
| | | } |
| | | |
| | | public Byte getStopped() { |
| | | return stopped; |
| | | } |
| | | |
| | | public void setStopped(Byte stopped) { |
| | | this.stopped = stopped; |
| | | } |
| | | |
| | | public String getRemarks() { |
| | | return remarks; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) { |
| | | this.remarks = remarks; |
| | | } |
| | | |
| | | public Date getCreateDt() { |
| | | return createDt; |
| | | } |
| | | |
| | | public void setCreateDt(Date createDt) { |
| | | this.createDt = createDt; |
| | | } |
| | | |
| | | public Byte getDeleted() { |
| | | return deleted; |
| | | } |
| | | |
| | | public void setDeleted(Byte deleted) { |
| | | this.deleted = deleted; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoMd; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/6 10:51 |
| | | * @Description |
| | | */ |
| | | public class MdParam { |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | private Long id; |
| | | |
| | | private Long cropsId; |
| | | |
| | | /** |
| | | * åæ°åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * åæ°å¼ |
| | | */ |
| | | private Double value; |
| | | |
| | | /** |
| | | * åæ°å«ä¹ |
| | | */ |
| | | private String sense; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getCropsId() { |
| | | return cropsId; |
| | | } |
| | | |
| | | public void setCropsId(Long cropsId) { |
| | | this.cropsId = cropsId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Double getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(Double value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getSense() { |
| | | return sense; |
| | | } |
| | | |
| | | public void setSense(String sense) { |
| | | this.sense = sense; |
| | | } |
| | | } |
| | |
| | | webPort: 8083 |
| | | actutorPort: 9083 |
| | | idSuffix: 5 |
| | | demo: |
| | | webPort: 8000 |
| | | actutorPort: 9000 |
| | | idSuffix: 99 |
| | | sell: |
| | | webPort: 8084 |
| | | actutorPort: 9084 |
| | |
| | | webPort: 8090 |
| | | actutorPort: 9090 |
| | | idSuffix: 12 |
| | | model: |
| | | webPort: 8091 |
| | | actutorPort: 9091 |
| | | idSuffix: 13 |
| | | # 2023-10-24æ°å¢ï¼ç¨äºæ§è¡ä¸´æ¶ä»»å¡ï¼ä¾å¦å 餿°æ®åºä¸ä¸äºåºéçæ°æ® |
| | | temp: |
| | | webPort: 8099 |
| | | actutorPort: 9099 |
| | | idSuffix: 98 |
| | | demo: |
| | | webPort: 8000 |
| | | actutorPort: 9000 |
| | | idSuffix: 99 |
| | | |
| | | # åå¸å¼webæä»¶ç³»ç» |
| | | file: |
| | |
| | | startHour: 0 #å¼å§å°æ¶ï¼å¿
é¡»æ¯0ç¹æä¹åï¼åå¼èå´æ¯0~5ï¼å¦StatisticsListenerä¸èªå¨è®¾ç½®æ0 |
| | | startMinute: 5 #å¼å§åé 5 |
| | | |
| | | #模å计ç®é
ç½®ï¼æ¨¡å计ç®å®æ¶ä»»å¡ä¼æ¯å¤©å®æ¶è¿è¡ |
| | | model-calculate: |
| | | startHour: 0 #å¼å§å°æ¶ï¼å¿
é¡»æ¯0ç¹æä¹åï¼åå¼èå´æ¯0~5ï¼å¦ModelListenerä¸èªå¨è®¾ç½®æ0 |
| | | startMinute: 10 #å¼å§åé 10 |
| | | |
| | | #ééæ¶æ¯æ¨é |
| | | dingtalk: |
| | | ym: |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoMd.MdCropsMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoMd.MdCrops"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table md_crops--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="start_dt" jdbcType="DATE" property="startDt" /> |
| | | <result column="end_dt" jdbcType="DATE" property="endDt" /> |
| | | <result column="stopped" jdbcType="TINYINT" property="stopped" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="create_dt" jdbcType="TIMESTAMP" property="createDt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name`, start_dt, end_dt, stopped, remarks, create_dt, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from md_crops |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from md_crops |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoMd.MdCrops"> |
| | | <!--@mbg.generated--> |
| | | insert into md_crops (id, `name`, start_dt, |
| | | end_dt, stopped, remarks, |
| | | create_dt, deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{startDt,jdbcType=DATE}, |
| | | #{endDt,jdbcType=DATE}, #{stopped,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}, |
| | | #{createDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdCrops"> |
| | | <!--@mbg.generated--> |
| | | insert into md_crops |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="startDt != null"> |
| | | start_dt, |
| | | </if> |
| | | <if test="endDt != null"> |
| | | end_dt, |
| | | </if> |
| | | <if test="stopped != null"> |
| | | stopped, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="createDt != null"> |
| | | create_dt, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="startDt != null"> |
| | | #{startDt,jdbcType=DATE}, |
| | | </if> |
| | | <if test="endDt != null"> |
| | | #{endDt,jdbcType=DATE}, |
| | | </if> |
| | | <if test="stopped != null"> |
| | | #{stopped,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createDt != null"> |
| | | #{createDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdCrops"> |
| | | <!--@mbg.generated--> |
| | | update md_crops |
| | | <set> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="startDt != null"> |
| | | start_dt = #{startDt,jdbcType=DATE}, |
| | | </if> |
| | | <if test="endDt != null"> |
| | | end_dt = #{endDt,jdbcType=DATE}, |
| | | </if> |
| | | <if test="stopped != null"> |
| | | stopped = #{stopped,jdbcType=TINYINT}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createDt != null"> |
| | | create_dt = #{createDt,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoMd.MdCrops"> |
| | | <!--@mbg.generated--> |
| | | update md_crops |
| | | set `name` = #{name,jdbcType=VARCHAR}, |
| | | start_dt = #{startDt,jdbcType=DATE}, |
| | | end_dt = #{endDt,jdbcType=DATE}, |
| | | stopped = #{stopped,jdbcType=TINYINT}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_dt = #{createDt,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoMd.MdParamMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoMd.MdParam"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table md_param--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="crops_id" jdbcType="BIGINT" property="cropsId" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="value" jdbcType="FLOAT" property="value" /> |
| | | <result column="sense" jdbcType="VARCHAR" property="sense" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, crops_id, `name`, `value`, sense |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from md_param |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from md_param |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoMd.MdParam"> |
| | | <!--@mbg.generated--> |
| | | insert into md_param (id, crops_id, `name`, |
| | | `value`, sense) |
| | | values (#{id,jdbcType=BIGINT}, #{cropsId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, |
| | | #{value,jdbcType=FLOAT}, #{sense,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdParam"> |
| | | <!--@mbg.generated--> |
| | | insert into md_param |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="cropsId != null"> |
| | | crops_id, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="value != null"> |
| | | `value`, |
| | | </if> |
| | | <if test="sense != null"> |
| | | sense, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="cropsId != null"> |
| | | #{cropsId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="value != null"> |
| | | #{value,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="sense != null"> |
| | | #{sense,jdbcType=VARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoMd.MdParam"> |
| | | <!--@mbg.generated--> |
| | | update md_param |
| | | <set> |
| | | <if test="cropsId != null"> |
| | | crops_id = #{cropsId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="value != null"> |
| | | `value` = #{value,jdbcType=FLOAT}, |
| | | </if> |
| | | <if test="sense != null"> |
| | | sense = #{sense,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoMd.MdParam"> |
| | | <!--@mbg.generated--> |
| | | update md_param |
| | | set crops_id = #{cropsId,jdbcType=BIGINT}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | `value` = #{value,jdbcType=FLOAT}, |
| | | sense = #{sense,jdbcType=VARCHAR} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| New file |
| | |
| | | package com.dy.pipIrrModel.config; |
| | | |
| | | import com.dy.common.webFilter.DevOfDataSourceNameSetFilter; |
| | | import com.dy.common.webFilter.UserTokenFilter; |
| | | import jakarta.servlet.Filter; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class WebFilterConfiguration { |
| | | |
| | | @Value("${pipIrr.global.dev}") |
| | | public String isDevStage ;//æ¯å¦ä¸ºå¼åé¶æ®µ |
| | | @Value("${pipIrr.global.dsName}") |
| | | public String dsName ;//å¼åé¶æ®µçæ°æ®æºåç§° |
| | | |
| | | /** |
| | | * DevOfDataSourceNameSetFilterä¸UserTokenFilteråªè½ä¸ä¸ªè¢«é
ç½®ä¸ï¼ |
| | | * æä»¥ä»ä»¬çorder齿¯1 |
| | | */ |
| | | private static final int order_UserTokenFilter = 1 ;//ä¸ä¸é¢ |
| | | private static final int order_DevOfDataSourceNameSetFilter = 1 ; |
| | | |
| | | |
| | | @Bean |
| | | public FilterRegistrationBean<? extends Filter> RegFilter() { |
| | | FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); |
| | | if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ |
| | | filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//é
ç½®è¿æ»¤è§å |
| | | filterRegistrationBean.addInitParameter("dataSourceName",dsName);//设置initåæ° |
| | | filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//è®¾ç½®è¿æ»¤å¨åç§° |
| | | filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//æ§è¡æ¬¡åº |
| | | }else{ |
| | | filterRegistrationBean.setFilter(new UserTokenFilter()); |
| | | filterRegistrationBean.addUrlPatterns("/*");//é
ç½®è¿æ»¤è§å |
| | | filterRegistrationBean.setName("UserTokenFilter");//è®¾ç½®è¿æ»¤å¨åç§° |
| | | filterRegistrationBean.setOrder(order_UserTokenFilter);//æ§è¡æ¬¡åº |
| | | } |
| | | return filterRegistrationBean; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrModel.config; |
| | | |
| | | import com.dy.common.webListener.GenerateIdSetSuffixListener; |
| | | import jakarta.servlet.ServletContextListener; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class WebListenerConfiguration { |
| | | |
| | | /** |
| | | * å¯å¨é¡ºåº |
| | | */ |
| | | private static final int order_idSetSuffix = 1 ; |
| | | |
| | | /** |
| | | * å
鍿ä¾listenerï¼è¯¥listenerå¨ç³»ç»å¯å¨æ¶ï¼æ ¹æ®é
ç½® 设置ID产çå¨çåç¼ |
| | | * @return 注åBean |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() { |
| | | ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); |
| | | listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); |
| | | listenerRegistrationBean.setOrder(order_idSetSuffix); |
| | | return listenerRegistrationBean; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrModel.modelCalculate; |
| | | |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.schedulerTask.TaskJob; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/6 9:32 |
| | | * @Description |
| | | */ |
| | | public class CalculateJob extends TaskJob { |
| | | |
| | | private static Logger log = LogManager.getLogger(CalculateJob.class.getName()) ; |
| | | |
| | | private String orgTag ; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext ctx) throws JobExecutionException { |
| | | JobDataMap jobDataMap = ctx.getJobDetail().getJobDataMap() ; |
| | | if(jobDataMap != null){ |
| | | orgTag = (String)jobDataMap.get(ModelListener.orgKey) ; |
| | | } |
| | | if(orgTag == null){ |
| | | return ; |
| | | } |
| | | DataSourceContext.set(orgTag);//è®¾ç½®æ°æ®æº |
| | | } |
| | | } |
| New file |
| | |
| | | package com.dy.pipIrrModel.modelCalculate; |
| | | |
| | | import com.dy.common.schedulerTask.SchedulerTaskSupport; |
| | | import com.dy.pipIrrGlobal.util.Org; |
| | | import com.dy.pipIrrGlobal.util.OrgListenerSupport; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.context.event.ApplicationReadyEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.core.io.ResourceLoader; |
| | | import org.springframework.lang.NonNull; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/6 9:32 |
| | | * @Description |
| | | * ä½ç©è¸è
¾èªå¨è®¡ç® |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class ModelListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> { |
| | | |
| | | protected static final String orgKey = "tag" ; |
| | | private static final String JobName = "modelCalculateJob" ; |
| | | private static final String JobGroupName = "modelCalculateGroup" ; |
| | | private static final Integer ThreadPoolMaxCount = 1 ;//çº¿ç¨æ± çº¿ç¨æå¤§ä¸ªæ° |
| | | private static final Integer ThreadPoolPriority = 5 ;//线ç¨ä¼å
级 |
| | | |
| | | /** |
| | | * 计ç®å¼å§å°æ¶ï¼å¿
é¡»0ç¹æä¹åï¼è§autoCalculateJobä¸è®¡ç®ï¼æç¨æ°æ®æ¯æ¨å¤©ç |
| | | */ |
| | | @Value("${model-calculate.startHour: 0}") |
| | | protected Integer startHour;//计ç®å¼å§æ¶å»--å°æ¶ |
| | | |
| | | @Value("${model-calculate.startMinute: 10}") |
| | | protected Integer startMinute;//计ç®å¼å§æ¶å»--åé |
| | | |
| | | @Autowired |
| | | protected ResourceLoader resourceLoader ; |
| | | |
| | | /** |
| | | * SpringBoot容å¨å·²ç»åå¤å¥½äºï¼æ§è¡ä¸é¢æ¹æ³ |
| | | * @param event äºä»¶ |
| | | */ |
| | | @Override |
| | | public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { |
| | | try { |
| | | //ç1ç§ï¼çå¾
com.alibaba.druid.pool.DruidDataSourceåå§å宿 |
| | | Thread.sleep(1000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try{ |
| | | super.init(resourceLoader); |
| | | this.start(event); |
| | | }catch (Exception e){ |
| | | log.error("æ³¨åæ¨¡å计ç®å®æ¶ä»»å¡åºé", e); |
| | | } |
| | | |
| | | } |
| | | } |
| | | /** |
| | | * åå§å |
| | | */ |
| | | private void start(ApplicationReadyEvent event) throws Exception{ |
| | | if(startHour < 0 || startHour > 5){ |
| | | startHour = 0 ; |
| | | } |
| | | List<Org.OrgVo> orgList = Org.OrgList ; |
| | | if(orgList != null && orgList.size() >0){ |
| | | SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount * orgList.size(), ThreadPoolPriority); |
| | | for(Org.OrgVo vo : orgList){ |
| | | HashMap<String , Object> jobDataMap = new HashMap<String , Object>() ; |
| | | jobDataMap.put(orgKey, vo.tag) ; |
| | | SchedulerTaskSupport.addDailyJob(JobName + vo.tag, JobGroupName, CalculateJob.class, jobDataMap, startHour, startMinute ) ; |
| | | //SchedulerTaskSupport.addSecondlyJob(JobName + vo.tag, JobGroupName, TestJob.class, jobDataMap, 10, 10000, 0 ) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | spring: |
| | | profiles: |
| | | include: common-web, global, database, database-mq, database-yq, database-hlj, database-gz, database-lz, database-jc, database-jyg, self |
| New file |
| | |
| | | spring: |
| | | profiles: |
| | | include: common-web, global, database, database-ym, database-sp, database-test,database-mj, self |
| New file |
| | |
| | | spring: |
| | | devtools: |
| | | livereload: |
| | | enabled: false |
| | | restart: |
| | | enabled: false #ç¦ç¨çé¨ç½² |
| | | #actutorçwebç«¯å£ |
| | | management: |
| | | server: |
| | | port: ${pipIrr.model.actutorPort} |
| | | #webæå¡ç«¯å£ï¼tomcaté»è®¤æ¯8080 |
| | | server: |
| | | port: ${pipIrr.model.webPort} |
| | | servlet: |
| | | context-path: /model #web访é®ä¸ä¸æè·¯å¾ |
| | | context-parameters: |
| | | #GenerateIdSetSuffixListenerä¸åºç¨ï¼åå¼èå´æ¯0-99 |
| | | idSuffix: ${pipIrr.model.idSuffix} |
| New file |
| | |
| | | spring: |
| | | profiles: |
| | | include: common-web, global, database, database-ym, database-sp, database-test,database-mj, self |
| New file |
| | |
| | | Configuration: |
| | | #statusï¼è¿ä¸ªç¨äºè®¾ç½®log4j2èªèº«å
é¨çä¿¡æ¯è¾åºï¼å¯ä»¥ä¸è®¾ç½®ï¼å½è®¾ç½®ætraceæ¶ï¼ä½ ä¼çå°log4j2å
é¨åç§è¯¦ç»è¾åºï¼å¯ä»¥è®¾ç½®æOff(å
³é)æError(åªè¾åºé误信æ¯) |
| | | status: Error |
| | | |
| | | Properties: # å®ä¹å
¨å±åé |
| | | Property: |
| | | #æ¥å¿æä»¶åå¨çç®å½ |
| | | - name: log.path |
| | | value: ./logs |
| | | #æ¥å¿æä»¶åå¨åç§° |
| | | - name: project.name |
| | | value: pipIrrModel |
| | | |
| | | #å®ä¹è¾åºå¨ï¼å¯ä»¥è¾åºå°æ§å¶å°åæä»¶. |
| | | Appenders: |
| | | #è¾åºå°æ§å¶å° |
| | | Console: |
| | | #Appenderå½å |
| | | name: CONSOLE |
| | | target: SYSTEM_OUT |
| | | ThresholdFilter: |
| | | level: debug #è¾åºæ¥å¿çº§å«ï¼è¾åºæ¥å¿æ¶ï¼é¦å
ç±Loggers.Root.levelæLoggers.Logger.level夿æ¯å¦è¾åºï¼ç¶ååç±æ¬level夿æ¯å¦è¾åº |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大äºçäº "level" é
ç½®çççº§å°æ¥å¿è¾åº |
| | | onMismatch: DENY #onMismatch=DENY å°äº "level" é
ç½®çççº§å°æ¥å¿ä¸è¾åº |
| | | #æ¥å¿å
å®¹æ ·å¼ |
| | | PatternLayout: |
| | | #%n-æ¢è¡ |
| | | #%m-æ¥å¿å
容ï¼è¾åºä»£ç 䏿å®çæ¥å¿ä¿¡æ¯ |
| | | #%p-è¾åºä¼å
级ï¼å³DEBUG,INFO,WARN,ERROR,FATAL |
| | | #%r-ç¨åºå¯å¨å°ç°å¨çæ¯«ç§æ° |
| | | #%%- è¾åºä¸ä¸ª"%" å符 |
| | | #%t-å½å线ç¨å |
| | | #%d-æ¥æåæ¶é´, 常ç¨çæ ¼å¼æ%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} |
| | | #%l-å%F%L%C%M |
| | | #%F-javaæºæä»¶å |
| | | #%L-javaæºç è¡æ° |
| | | #%C-javaç±»å,%C{1}è¾åºæåä¸ä¸ªå
ç´ |
| | | #%M-javaæ¹æ³å |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | # è¾åºå°æä»¶ï¼è¶
è¿10MB彿¡£ |
| | | RollingFile: |
| | | - name: ROLLING_FILE |
| | | ignoreExceptions: false |
| | | fileName: ${log.path}/${project.name}.log |
| | | filePattern: "${log.path}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" |
| | | ThresholdFilter: |
| | | level: error #è¾åºæ¥å¿çº§å«ï¼è¾åºæ¥å¿æ¶ï¼é¦å
ç±Loggers.Root.levelæLoggers.Logger.level夿æ¯å¦è¾åºï¼ç¶ååç±æ¬level夿æ¯å¦è¾åº |
| | | onMatch: ACCEPT #onMatch=ACCEPT 大äºçäº "level" é
ç½®çççº§å°æ¥å¿è¾åº |
| | | onMismatch: DENY #onMismatch=DENY å°äº "level" é
ç½®çççº§å°æ¥å¿ä¸è¾åº |
| | | #æ¥å¿å
å®¹æ ·å¼ |
| | | PatternLayout: |
| | | pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" |
| | | Policies: |
| | | # æ¯å¤©æ¥å¿æä»¶æå¤§å°ååæä»¶ |
| | | SizeBasedTriggeringPolicy: |
| | | size: "1 MB" |
| | | DefaultRolloverStrategy: |
| | | max: 10 #ä¸å¤©å
æ¥å¿æä»¶æå¤§ä¸ªæ° |
| | | Delete: |
| | | basePath: "${log.path}" |
| | | maxDepth: 2 #å 餿¥å¿æä»¶çæå¤§æ·±åº¦ |
| | | IfFileName: |
| | | glob: "${project.name}-%d{yyyy-MM-dd}-%i.log.gz" |
| | | IfLastModified: |
| | | age: "30d" #æ¥å¿æä»¶ä¿ççæå¤§å¤©æ° |
| | | Loggers: |
| | | Root: |
| | | level: info #æ¥å¿è¾åºçº§å«ï¼å
±æ8个级å«ï¼æç
§ä»ä½å°é«ä¸ºï¼all < trace < debug < info < warn < error < fatal < off |
| | | AppenderRef: #Rootçåèç¹ï¼ç¨æ¥æå®è¯¥æ¥å¿è¾åºå°åªä¸ªAppender. |
| | | - ref: CONSOLE #è¾åºæ¥å¿æ¶ï¼é¦å
ç±æ¬level夿æ¯å¦è¾åºï¼ç¶ååç±ä¸é¢çAppenders.Console.ThresholdFilter.level夿æ¯å¦è¾åº |
| | | - ref: ROLLING_FILE #è¾åºæ¥å¿æ¶ï¼é¦å
ç±æ¬level夿æ¯å¦è¾åºï¼ç¶ååç±ä¸é¢çAppenders.RollingFile.ThresholdFilter.level夿æ¯å¦è¾åº |
| | | # 为å
é
ç½®ç¹æ®çLog级å«ï¼æ¹ä¾¿è°è¯ï¼ |
| | | # ä¸åLoggers.Root.leveléå¶ |
| | | Logger: |
| | | - name: org.apache.dubbo |
| | | additivity: false #å»é¤éå¤çlog |
| | | level: error #è¾åºæ¥å¿çº§å« |
| | | AppenderRef: |
| | | - ref: CONSOLE #è¾åºæ¥å¿æ¶ï¼é¦å
ç±æ¬.level夿æ¯å¦è¾åºï¼ç¶ååç±ä¸é¢çAppenders.Console.ThresholdFilter.level夿æ¯å¦è¾åº |
| | | - ref: ROLLING_FILE #è¾åºæ¥å¿æ¶ï¼é¦å
ç±æ¬level夿æ¯å¦è¾åºï¼ç¶ååç±ä¸é¢çAppenders.RollingFile.ThresholdFilter.level夿æ¯å¦è¾åº |
| | |
| | | <module>pipIrr-web-app</module> |
| | | <module>pipIrr-web-operation</module> |
| | | <module>pipIrr-web-file</module> |
| | | <module>pipIrr-web-temp</module> |
| | | <module>pipIrr-web-terminal</module> |
| | | <module>pipIrr-web-model</module> |
| | | <module>pipIrr-web-temp</module> |
| | | </modules> |
| | | |
| | | <dependencies> |