zhubaomin
2024-11-12 87399ae42948cb252a3afa3cf7afe5f2a6c4f809
开阀成功时,所用虚拟卡开阀时间赋值
6个文件已修改
74 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
@@ -30,12 +30,11 @@
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@@ -362,6 +361,7 @@
                    if (comType == 1) {
                        virtualCard.setInUse((byte) 0);
                        virtualCard.setIntakeId(null);
                        virtualCard.setOpenTime(null);
                    } else {
                        virtualCard.setInUse((byte) 1);
                        virtualCard.setIntakeId(intakeId);
@@ -384,6 +384,21 @@
                    if (comType == 1) {
                        virtualCard.setInUse((byte) 1);
                        virtualCard.setIntakeId(intakeId);
                        // 如果是计划开阀,从命令日志中获取计划时间,否则取当前时间
                        if(commandCode.equals(CodeV1.cd_A1) || commandCode.equals(CodeV1.cd_A2)) {
                            // 计划开阀
                            Date openTime = null;
                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            try {
                                openTime = sdf.parse(rmCommandHistoryMapper.getTimeByCommId(comId));
                            }catch (ParseException e) {
                            }
                            virtualCard.setOpenTime(openTime);
                        }else {
                            // 非计划开阀
                            virtualCard.setOpenTime(new Date());
                        }
                    } else {
                        virtualCard.setInUse((byte) 0);
                        virtualCard.setIntakeId(null);
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
@@ -60,4 +60,11 @@
     * @return
     */
    List<VoCommand> getCommandHistories(Map<?, ?> params);
    /**
     * 根据命令日志ID获取预约时间,向虚拟卡写开阀时间用
     * @param commId
     * @return
     */
    String getTimeByCommId(Long commId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java
@@ -93,15 +93,22 @@
    private Byte inUse;
    /**
     * 取水口ID(虚拟卡使用时所应用于的取水口ID)
     */
    @Schema(description = "取水口ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long intakeId;
    /**
     * 开阀时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date openTime;
    /**
     * 创建时间
     */
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date createTime;
    /**
     * 取水口ID(虚拟卡使用时所应用于的取水口ID)
     */
    @Schema(description = "取水口ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long intakeId;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -352,4 +352,12 @@
            </if>
        </trim>
    </select>
    <!--根据命令日志ID获取预约时间,向虚拟卡写开阀时间用-->
    <select id="getTimeByCommId" resultType="java.lang.String">
        SELECT
            CONCAT(param ->> '$.year', '-', param ->> '$.month', '-', param ->> '$.day', ' ',  param ->> '$.hour', ':', param ->> '$.minute', ':00') AS openTime
        FROM rm_command_history
        WHERE com_id = #{commId}
    </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
@@ -13,11 +13,12 @@
    <result column="last_operate_time" jdbcType="TIMESTAMP" property="lastOperateTime" />
    <result column="in_use" jdbcType="TINYINT" property="inUse" />
    <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
    <result column="open_time" jdbcType="TIMESTAMP" property="openTime" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, vc_num, client_id, money, state, last_operate, last_operate_time, in_use, intake_id, create_time
    id, vc_num, client_id, money, state, last_operate, last_operate_time, in_use, intake_id, open_time, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -36,10 +37,10 @@
    <!--@mbg.generated-->
    insert into se_virtual_card (id, vc_num, client_id, 
      money, state, last_operate, last_operate_time,
      in_use, intake_id, create_time)
      in_use, intake_id, open_time, create_time)
    values (#{id,jdbcType=BIGINT}, #{vcNum,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, 
      #{money,jdbcType=FLOAT}, #{state,jdbcType=TINYINT}, #{lastOperate,jdbcType=TINYINT}, #{lastOperateTime,jdbcType=TIMESTAMP},
      #{inUse,jdbcType=TINYINT}, #{intakeId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
      #{inUse,jdbcType=TINYINT}, #{intakeId,jdbcType=BIGINT},#{openTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard">
    <!--@mbg.generated-->
@@ -72,6 +73,9 @@
      <if test="intakeId != null">
        intake_id,
      </if>
      <if test="openTime != null">
        open_time,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
@@ -103,6 +107,9 @@
      </if>
      <if test="intakeId != null">
        #{intakeId,jdbcType=BIGINT},
      </if>
      <if test="openTime != null">
        #{openTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
@@ -137,6 +144,9 @@
      <if test="intakeId != null">
        intake_id = #{intakeId,jdbcType=BIGINT},
      </if>
      <if test="openTime != null">
        open_time = #{openTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
@@ -154,6 +164,7 @@
      last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP},
      in_use = #{inUse,jdbcType=TINYINT},
      intake_id = #{intakeId,jdbcType=BIGINT},
      open_time = #{openTime,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java
@@ -82,7 +82,7 @@
     * @return
     */
    @PostMapping(path = "open_wx", consumes = MediaType.APPLICATION_JSON_VALUE)
    //@Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public BaseResponse<Boolean> open(@RequestBody @Valid ValveOpen valve, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());