2024-07-11 朱宝民 优化开卡接口、补卡接口,灌溉单元农户关联接口,轮灌组农户关联接口
9个文件已添加
9个文件已修改
783 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupClient.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrUnitClient.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/dto/GroupClient.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/dto/UnitClient.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/ActiveCard.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/DtoActiveCard.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.daoIr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoIr.IrGroupClient;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-07-10 14:48
 * @LastEditTime 2024-07-10 14:48
 * @Description
 */
@Mapper
public interface IrGroupClientMapper extends BaseMapper<IrGroupClient> {
    int deleteByPrimaryKey(Long id);
    int insert(IrGroupClient record);
    int insertSelective(IrGroupClient record);
    IrGroupClient selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(IrGroupClient record);
    int updateByPrimaryKey(IrGroupClient record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrGlobal.daoIr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoIr.IrUnitClient;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-07-10 14:47
 * @LastEditTime 2024-07-10 14:47
 * @Description
 */
@Mapper
public interface IrUnitClientMapper extends BaseMapper<IrUnitClient> {
    int deleteByPrimaryKey(Long id);
    int insert(IrUnitClient record);
    int insertSelective(IrUnitClient record);
    IrUnitClient selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(IrUnitClient record);
    int updateByPrimaryKey(IrUnitClient record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupClient.java
New file
@@ -0,0 +1,69 @@
package com.dy.pipIrrGlobal.pojoIr;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-07-10 14:48
 * @LastEditTime 2024-07-10 14:48
 * @Description
 */
/**
 * 轮灌组农户关联表
 */
@TableName(value="ir_group_client", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "轮灌组农户关联实体")
public class IrGroupClient implements BaseEntity {
    public static final long serialVersionUID = 202407101455001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
    * 轮灌组ID
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @NotNull(message = "轮灌组不能为空")
    private Long groupId;
    /**
    * 农户ID
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @NotNull(message = "农户不能为空")
    private Long clientId;
    /**
    * 创建人
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long operator;
    /**
    * 创建时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operateTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrUnitClient.java
New file
@@ -0,0 +1,68 @@
package com.dy.pipIrrGlobal.pojoIr;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-07-10 14:47
 * @LastEditTime 2024-07-10 14:47
 * @Description
 */
/**
 * 灌溉单元农户关联表
 */
@TableName(value="ir_unit_client", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "灌溉单元农户关联实体")
public class IrUnitClient implements BaseEntity {
    public static final long serialVersionUID = 202407101454001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
    * 灌溉单元ID
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @NotNull(message = "灌溉单元不能为空")
    private Long unitId;
    /**
    * 农户ID
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @NotNull(message = "农户不能为空")
    private Long clientId;
    /**
    * 创建人
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long operator;
    /**
    * 创建时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operateTime;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml
New file
@@ -0,0 +1,102 @@
<?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.daoIr.IrGroupClientMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupClient">
    <!--@mbg.generated-->
    <!--@Table ir_group_client-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="group_id" jdbcType="BIGINT" property="groupId" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="operator" jdbcType="BIGINT" property="operator" />
    <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, group_id, client_id, `operator`, operate_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ir_group_client
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ir_group_client
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient">
    <!--@mbg.generated-->
    insert into ir_group_client (id, group_id, client_id,
      `operator`, operate_time)
    values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT},
      #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient">
    <!--@mbg.generated-->
    insert into ir_group_client
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="groupId != null">
        group_id,
      </if>
      <if test="clientId != null">
        client_id,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="operateTime != null">
        operate_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="groupId != null">
        #{groupId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateTime != null">
        #{operateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient">
    <!--@mbg.generated-->
    update ir_group_client
    <set>
      <if test="groupId != null">
        group_id = #{groupId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateTime != null">
        operate_time = #{operateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupClient">
    <!--@mbg.generated-->
    update ir_group_client
    set group_id = #{groupId,jdbcType=BIGINT},
      client_id = #{clientId,jdbcType=BIGINT},
      `operator` = #{operator,jdbcType=BIGINT},
      operate_time = #{operateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml
New file
@@ -0,0 +1,102 @@
<?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.daoIr.IrUnitClientMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrUnitClient">
    <!--@mbg.generated-->
    <!--@Table ir_unit_client-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="unit_id" jdbcType="BIGINT" property="unitId" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="operator" jdbcType="BIGINT" property="operator" />
    <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, unit_id, client_id, `operator`, operate_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ir_unit_client
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ir_unit_client
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrUnitClient">
    <!--@mbg.generated-->
    insert into ir_unit_client (id, unit_id, client_id,
      `operator`, operate_time)
    values (#{id,jdbcType=BIGINT}, #{unitId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT},
      #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrUnitClient">
    <!--@mbg.generated-->
    insert into ir_unit_client
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="unitId != null">
        unit_id,
      </if>
      <if test="clientId != null">
        client_id,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="operateTime != null">
        operate_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="unitId != null">
        #{unitId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateTime != null">
        #{operateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrUnitClient">
    <!--@mbg.generated-->
    update ir_unit_client
    <set>
      <if test="unitId != null">
        unit_id = #{unitId,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateTime != null">
        operate_time = #{operateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrUnitClient">
    <!--@mbg.generated-->
    update ir_unit_client
    set unit_id = #{unitId,jdbcType=BIGINT},
      client_id = #{clientId,jdbcType=BIGINT},
      `operator` = #{operator,jdbcType=BIGINT},
      operate_time = #{operateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java
@@ -5,16 +5,13 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoIr.IrGroupClient;
import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.voIr.VoGroup;
import com.dy.pipIrrGlobal.voIr.VoGroupOne;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import com.dy.pipIrrIrrigate.irrigateUnit.IrrigateUnitSv;
import com.dy.pipIrrIrrigate.irrigateGroup.QueryVo;
import com.dy.pipIrrIrrigate.irrigateGroup.dto.GroupClient;
import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
@@ -415,4 +412,34 @@
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    /**
     * 轮灌组关联农户
     * @param po
     * @param bindingResult
     * @return
     */
    @PostMapping(path = "add_group_client", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> addGroupClient(@RequestBody @Valid GroupClient po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        IrGroupClient irGroupClient = new IrGroupClient();
        irGroupClient.setGroupId(po.getGroupId());
        irGroupClient.setClientId(po.getClientId());
        irGroupClient.setOperator(po.getOperator());
        irGroupClient.setOperateTime(new Date());
        try {
            Long rec = Optional.ofNullable(irrigateGroupSv.addGroupClient(irGroupClient)).orElse(0L);
            if (rec == 0) {
                return BaseResponseUtils.buildErrorMsg(IrrigateResultCode.GRPUP_ASSOCIATE_CLIENT_FAIL.getMessage());
            }
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
@@ -1,8 +1,10 @@
package com.dy.pipIrrIrrigate.irrigateGroup;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoIr.IrGroupClientMapper;
import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper;
import com.dy.pipIrrGlobal.pojoIr.IrGroupClient;
import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import com.dy.pipIrrGlobal.voIr.VoGroup;
@@ -25,11 +27,13 @@
@Slf4j
@Service
public class IrrigateGroupSv {
    @Autowired
    private IrIrrigateGroupMapper irIrrigateGroupMapper;
    @Autowired
    private IrGroupUnitMapper irGroupUnitMapper;
    @Autowired
    private IrGroupClientMapper irGroupClientMapper;
    /**
     * 创建轮灌组
@@ -149,4 +153,19 @@
        List<Long> notBindUnits = irGroupUnitMapper.getNotBindUnits();
        return notBindUnits;
    }
    //轮灌组关联农户
    public Long addGroupClient(IrGroupClient po) {
        irGroupClientMapper.insert(po);
        return po.getId();
    }
    /**
     * 删除轮灌组与农户管理
     * @param id
     * @return
     */
    public Integer deleteGroupClient (Long id) {
        return irGroupClientMapper.deleteByPrimaryKey(id);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/dto/GroupClient.java
New file
@@ -0,0 +1,34 @@
package com.dy.pipIrrIrrigate.irrigateGroup.dto;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-07-10 16:37
 * @LastEditTime 2024-07-10 16:37
 * @Description 轮灌组农户关联对象
 */
@Data
public class GroupClient {
    public static final long serialVersionUID = 202407101638001L;
    /**
     * 轮灌组ID
     */
    @NotNull(message = "轮灌组不能为空")
    private Long groupId;
    /**
     * 农户ID
     */
    @NotNull(message = "农户不能为空")
    private Long clientId;
    /**
     * 操作员
     */
    @NotNull(message = "操作员不能为空")
    private Long operator;
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java
@@ -7,13 +7,11 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.pojoIr.IrProject;
import com.dy.pipIrrGlobal.voIr.VoProject;
import com.dy.pipIrrGlobal.voIr.VoProjectOne;
import com.dy.pipIrrGlobal.pojoIr.IrUnitClient;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import com.dy.pipIrrIrrigate.irrigateUnit.QueryVo;
import com.dy.pipIrrIrrigate.irrigateUnit.dto.UnitClient;
import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
@@ -30,10 +28,7 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
/**
 * @author :WuZeYu
@@ -229,4 +224,58 @@
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 灌溉单元分配(农户租地)
     * @param po
     * @param bindingResult
     * @return
     */
    @PostMapping(path = "add_unit_client", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> addUnitClient(@RequestBody @Valid UnitClient po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        IrUnitClient irUnitClient = new IrUnitClient();
        irUnitClient.setUnitId(po.getUnitId());
        irUnitClient.setClientId(po.getClientId());
        irUnitClient.setOperator(po.getOperator());
        irUnitClient.setOperateTime(new Date());
        try {
            Long rec = Optional.ofNullable(irrigateUnitSv.addUnitClient(irUnitClient)).orElse(0L);
            if (rec == 0) {
                return BaseResponseUtils.buildErrorMsg(IrrigateResultCode.UNIT_ASSOCIATE_CLIENT_FAIL.getMessage());
            }
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
    @PostMapping(path = "delete_unit_client", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> deleteUnitClient(@RequestBody @Valid UnitClient po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        IrUnitClient irUnitClient = new IrUnitClient();
        irUnitClient.setUnitId(po.getUnitId());
        irUnitClient.setClientId(po.getClientId());
        irUnitClient.setOperator(po.getOperator());
        irUnitClient.setOperateTime(new Date());
        try {
            Long rec = Optional.ofNullable(irrigateUnitSv.addUnitClient(irUnitClient)).orElse(0L);
            if (rec == 0) {
                return BaseResponseUtils.buildErrorMsg(IrrigateResultCode.UNIT_ASSOCIATE_CLIENT_FAIL.getMessage());
            }
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java
@@ -3,14 +3,11 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper;
import com.dy.pipIrrGlobal.daoIr.IrProjectMapper;
import com.dy.pipIrrGlobal.daoIr.IrUnitClientMapper;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateUnit;
import com.dy.pipIrrGlobal.pojoIr.IrProject;
import com.dy.pipIrrGlobal.voIr.VoProject;
import com.dy.pipIrrGlobal.voIr.VoProjectOne;
import com.dy.pipIrrGlobal.pojoIr.IrUnitClient;
import com.dy.pipIrrGlobal.voIr.VoUnit;
import com.dy.pipIrrGlobal.voIr.VoUnitOne;
import com.dy.pipIrrIrrigate.irrigateUnit.QueryVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,11 +26,13 @@
@Slf4j
@Service
public class IrrigateUnitSv {
    @Autowired
    private IrIrrigateUnitMapper irIrrigateUnitMapper;
    @Autowired
    private IrGroupUnitMapper irGroupUnitMapper;
    @Autowired
    private IrUnitClientMapper irUnitClientMapper;
    /**
     * 创建灌溉单元
@@ -105,4 +104,20 @@
        rsVo.obj = irIrrigateUnitMapper.getUnits(params);
        return rsVo;
    }
    //灌溉单元分配(农户租地)
    public Long addUnitClient(IrUnitClient po) {
        irUnitClientMapper.insert(po);
        return po.getId();
    }
    /**
     * 删除灌溉单元与农户关联
     * @param id
     * @return
     */
    public Integer deleteUnitClient(Long id) {
        return irUnitClientMapper.deleteByPrimaryKey(id);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/dto/UnitClient.java
New file
@@ -0,0 +1,34 @@
package com.dy.pipIrrIrrigate.irrigateUnit.dto;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-07-10 15:35
 * @LastEditTime 2024-07-10 15:35
 * @Description 灌溉单元农户关联对象
 */
@Data
public class UnitClient {
    public static final long serialVersionUID = 202407101536001L;
    /**
     * 灌溉单元ID
     */
    @NotNull(message = "灌溉单元不能为空")
    private Long unitId;
    /**
     * 农户ID
     */
    @NotNull(message = "农户不能为空")
    private Long clientId;
    /**
     * 操作员
     */
    @NotNull(message = "操作员不能为空")
    private Long operator;
}
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java
@@ -20,12 +20,18 @@
    PLEASE_INPUT_PROJECT_ID(10002, "请输入项目ID"),
    DELETE_PROJECT_FAIL(10003, "项目删除失败"),
    UPDATE_PROJECT_FAIL(10004, "项目修改失败"),
    NO_PROJECT(10005, "无符合条件的项目记录");
    NO_PROJECT(10005, "无符合条件的项目记录"),
    /**
     * 灌溉单元
     */
    UNIT_ASSOCIATE_CLIENT_FAIL(20001, "灌溉单元分配失败"),
//    /**
//     * 灌溉单元
//     */
    /**
     * 轮灌组
     */
    GRPUP_ASSOCIATE_CLIENT_FAIL(30001, "轮灌组关联农户失败");
//    ADD_IRRIGATE_UNIT_FAIL(20001, "创建灌溉单元失败"),
    private final Integer code;
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -15,7 +15,6 @@
import com.dy.pipIrrGlobal.voSe.VoOperate;
import com.dy.pipIrrGlobal.voSe.VoRecharge;
import com.dy.pipIrrGlobal.voSe.VoReissueCard;
import com.dy.pipIrrSell.cardOperate.converter.RechargeDtoMapper;
import com.dy.pipIrrSell.cardOperate.dto.*;
import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM;
import com.dy.pipIrrSell.cardOperate.qo.*;
@@ -65,21 +64,19 @@
    @PostMapping(path = "active", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> add_active(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){
    public BaseResponse<Boolean> add_active(@RequestBody @Valid ActiveCard po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        Long clientId = po.getClientId();
        // 获取5级行政区划串areaCode
        String areaCode = cardOperateSv.getAreaCodeByNum(po.getClientNum());
        if(areaCode.trim().length() == 0) {
        Long areaCodeL = cardOperateSv.getAreaCodeById(clientId);
        if(areaCodeL == null) {
            return BaseResponseUtils.buildErrorMsg(SellResultCode.AREA_CODE_MISTAKE.getMessage());
        }
        // p206V1_0_1协议,取行政区划的后6位
        if(po.getProtocol() != null && po.getProtocol().trim().equals("p206V1_0_1")) {
            areaCode = areaCode.substring(6);
        }
        String areaCode = String.valueOf(areaCodeL);
        /**
         * 根据行政区划串(areaCode)在水卡表中针对水卡编号(cardNum)进行模糊查询
@@ -88,18 +85,6 @@
         * cardNum为新的卡号
         */
        String cardNum = Optional.ofNullable(cardOperateSv.getCardNumOfMax(areaCode)).orElse("");
        if(po.getProtocol().trim().equals("p206V1_0_1")) {
            if(cardNum != null && cardNum.trim().length() > 0) {
                Integer number = Integer.parseInt(cardNum.substring(6));
                number = number + 1;
                if(number > 9999) {
                    return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_OVERRUN.getMessage());
                }
                cardNum = cardNum.substring(0, 6) + String.format("%04d", number);
            } else {
                cardNum = areaCode + "0001";
            }
        }else {
            if(cardNum != null && cardNum.trim().length() > 0) {
                Integer number = Integer.parseInt(cardNum.substring(12));
                number = number + 1;
@@ -110,12 +95,11 @@
            } else {
                cardNum = areaCode + "00001";
            }
        }
        /**
         * cardAddr         水卡地址(仅仅写入,无业务)
         * clientNum        农户编号
         * cardCost         卡片费用
         * originalCardId   原水卡ID
         * amount           充值金额,充值接口为输入参数,补卡接口为原卡退还金额
         * reissueAmount    补卡金额,补卡时使用
         * paymentId        支付方式编号
@@ -124,7 +108,6 @@
         * activeTime       开卡时间
         */
        String cardAddr = po.getCardAddr();
        String clientNum = po.getClientNum();
        Integer cardCost = po.getCardCost();
        Long originalCardId = po.getOriginalCardId();
        Float amount = po.getAmount();
@@ -132,14 +115,6 @@
        String remarks = po.getRemarks();
        Long operator = po.getOperator();
        Date activeTime = new Date();
        /**
         * 根据农户编号获取农户ID
         */
        Long clientId = cardOperateSv.getClientIdByNum(clientNum);
        if(clientId == null) {
            return BaseResponseUtils.buildErrorMsg(SellResultCode.CLIENT_NUM_ERROR.getMessage());
        }
        /**
         * 添加农户卡记录,退还金额作为当前余额
@@ -166,7 +141,7 @@
        SeCardOperate seCardOperate = new SeCardOperate();
        seCardOperate.setCardId(cardId);
        seCardOperate.setClientId(clientId);
        seCardOperate.setMoney(amount);
        seCardOperate.setMoney(0f);
        seCardOperate.setCardCost(cardCost);
        seCardOperate.setPaymentId(paymentId);
        seCardOperate.setOperateType(OperateTypeENUM.ACTIVE.getCode());
@@ -182,10 +157,13 @@
         * 如果操作人员开卡时输入了充值金额,则开卡后调用充值功能
         * 补卡除外,补卡的退还金额是从挂失卡中转移过来的,没有实际金钱交易
         */
        po.setCardNum(Long.parseLong(cardNum));
        if(amount != null && amount > 0 && originalCardId == null) {
            po.setClientId(clientId);
            DtoRecharge dtoRecharge = RechargeDtoMapper.INSTANCT.po2vo(po);
            DtoRecharge dtoRecharge = new DtoRecharge();
            dtoRecharge.setCardNum(Long.parseLong(cardNum));
            dtoRecharge.setAmount(amount);
            dtoRecharge.setPaymentId(paymentId);
            dtoRecharge.setRemarks(remarks);
            dtoRecharge.setOperator(operator);
            dtoRecharge.setMoney(0f);
            dtoRecharge.setGift(0f);
            dtoRecharge.setPrice(0f);
@@ -231,6 +209,7 @@
        String cardAddr = po.getCardAddr();
        String clientNum = "";
        Long clientId = 0L;
        Long cardNum = po.getCardNum();
        Long cardId = 0L;
        Integer cardCost = Optional.ofNullable(po.getCardCost()).orElse(0);
@@ -238,7 +217,6 @@
        Long paymentId = po.getPaymentId();
        String remarks = po.getRemarks();
        Long operator = po.getOperator();
        String protocol = null;
        // 判断当前水卡是否为挂失状态且未补卡,仅已经挂失且未补卡的可以补卡
        if(!cardOperateSv.isLostAndUnreplaced(cardNum)) {
@@ -262,6 +240,7 @@
        }
        clientNum = map.get("clientNum").toString();
        cardId = Long.parseLong(map.get("cardId").toString());
        clientId = Long.parseLong(map.get("clientId").toString());
        /**
         * 如果是补卡调用的开卡且转移了退还金额,需修改挂失卡余额为0
@@ -276,20 +255,16 @@
        /**
         * 添加开卡记录,退还金额冲到新卡中
         */
        if(String.valueOf(cardNum).trim().length() == 10) {
            protocol = "p206V1_0_1";
        }
        DtoActiveCard dtoActiveCard = new DtoActiveCard();
        dtoActiveCard.setProtocol(protocol);
        dtoActiveCard.setCardAddr(cardAddr);
        dtoActiveCard.setClientNum(clientNum);
        dtoActiveCard.setOriginalCardId(cardId);
        dtoActiveCard.setCardCost(cardCost);
        dtoActiveCard.setAmount(reissueAmount);
        dtoActiveCard.setPaymentId(paymentId);
        dtoActiveCard.setRemarks(remarks);
        dtoActiveCard.setOperator(operator);
        BaseResponse<java.lang.Boolean> baseResponse_addActive = add_active(dtoActiveCard, null);
        ActiveCard activeCard = new ActiveCard();
        activeCard.setCardAddr(cardAddr);
        activeCard.setClientId(clientId);
        activeCard.setOriginalCardId(cardId);
        activeCard.setCardCost(cardCost);
        activeCard.setAmount(reissueAmount);
        activeCard.setPaymentId(paymentId);
        activeCard.setRemarks(remarks);
        activeCard.setOperator(operator);
        BaseResponse<java.lang.Boolean> baseResponse_addActive = add_active(activeCard, null);
        if(!baseResponse_addActive.getCode().equals("0001")) {
            return BaseResponseUtils.buildErrorMsg(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage());
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/ActiveCard.java
New file
@@ -0,0 +1,64 @@
package com.dy.pipIrrSell.cardOperate.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-07-11 11:27
 * @LastEditTime 2024-07-11 11:27
 * @Description 开卡传入对象
 */
@Data
public class ActiveCard {
    public static final long serialVersionUID = 202407111129001L;
    /**
     * 水卡地址,仅保存,无业务
     */
    @NotBlank(message = "水卡地址不能为空")
    private String cardAddr;
    /**
     * 农户ID(主键)
     */
    @NotNull(message = "农户不能为空")
    private Long clientId;
    /**
     * 原挂失卡ID,补卡过程开卡需要
     */
    @Schema(description = "原挂失卡ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long originalCardId;
    /**
     * 卡片费用
     */
    @NotNull(message = "卡片费用不能为空")
    private Integer cardCost;
    /**
     * 充值金额
     */
    private Float amount;
    /**
     * 支付方式编号
     */
    @NotNull(message = "付方式不能为空")
    private Long paymentId;
    /**
     * 备注信息
     */
    private String remarks;
    /**
     * 操作人编号
     */
    private Long operator;
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/DtoActiveCard.java
@@ -10,7 +10,7 @@
 * @author ZhuBaoMin
 * @date 2024-01-18 19:44
 * @LastEditTime 2024-01-18 19:44
 * @Description
 * @Description 开卡及补卡传入对象
 */
@Data
@@ -18,7 +18,7 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "开卡传入对象")
@Schema(name = "开卡及补卡传入对象")
public class DtoActiveCard {
    public static final long serialVersionUID = 202401181945001L;
@@ -43,7 +43,7 @@
    private String clientNum;
    /**
     * 农户ID(主键),不是开卡接口传入,由农户编号获得,保存开卡记录和充值记录都需要
     * 农户ID(主键)
     */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long clientId;
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
@@ -143,6 +143,9 @@
        String district8 = String.format("%02d", Integer.parseInt(countyNum))  + String.format("%03d", Integer.parseInt(townNum)) + String.format("%03d", Integer.parseInt(villageNum));
        // 生成农户编号
        String clientNum = generateClientNum(district8);
        if(clientNum == null) {
            return BaseResponseUtils.buildErrorMsg("农户编号超限");
        }
        // 生成12位5级行政区划编码串及名称串
        Long districtNum = Long.parseLong(provinceNum + cityNum + district8);
        String districtTitle = countryName + townName + villageName;
@@ -195,7 +198,7 @@
            Integer number = Integer.parseInt(clientNum.substring(8));
            number = number + 1;
            if(number > 9999) {
                return "农户编号超限";
                return null;
            }
            clientNum = clientNum.substring(0, 8) + String.format("%04d", number);
        } else {
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java
@@ -5,7 +5,6 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voPr.VoController;
import com.dy.pipIrrGlobal.voSe.VoVcRecharge;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.result.SellResultCode;
@@ -101,7 +100,7 @@
        if(vcNum != null && vcNum.trim().length() > 0) {
            Integer number = Integer.parseInt(vcNum.substring(12));
            number = number + 1;
            if(number > 99999) {
            if(number > 65535) {
                return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_OVERRUN.getMessage());
            }
            vcNum = vcNum.substring(0, 12) + String.format("%05d", number);