From a8f31c8b9c1e9bb7644e27b8baa476e1593790c0 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期四, 11 七月 2024 14:50:39 +0800 Subject: [PATCH] 2024-07-11 朱宝民 优化开卡接口、补卡接口,灌溉单元农户关联接口,轮灌组农户关联接口 --- pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/dto/UnitClient.java | 34 ++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java | 3 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java | 27 + pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java | 21 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupClient.java | 69 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java | 93 ++---- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/DtoActiveCard.java | 6 pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java | 14 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java | 27 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml | 102 +++++++ pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java | 65 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/ActiveCard.java | 64 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java | 5 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java | 28 ++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml | 102 +++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrUnitClient.java | 68 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java | 37 ++ pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/dto/GroupClient.java | 34 ++ 18 files changed, 710 insertions(+), 89 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java new file mode 100644 index 0000000..cd16d9d --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrGroupClientMapper.java @@ -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); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java new file mode 100644 index 0000000..2721de6 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoIr/IrUnitClientMapper.java @@ -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); + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupClient.java new file mode 100644 index 0000000..d285396 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrGroupClient.java @@ -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; + + /** + * 杞亴缁処D + */ + @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; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrUnitClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrUnitClient.java new file mode 100644 index 0000000..d8f97e9 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoIr/IrUnitClient.java @@ -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; +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml new file mode 100644 index 0000000..6a2a9a7 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrGroupClientMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml new file mode 100644 index 0000000..6d74a8b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/IrUnitClientMapper.xml @@ -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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java index f94e15f..e3d4abe 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java +++ b/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); + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java index d1e3e50..76dd797 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java +++ b/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); + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/dto/GroupClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/dto/GroupClient.java new file mode 100644 index 0000000..05d6708 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/dto/GroupClient.java @@ -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; + + /** + * 杞亴缁処D + */ + @NotNull(message = "杞亴缁勪笉鑳戒负绌�") + private Long groupId; + + /** + * 鍐滄埛ID + */ + @NotNull(message = "鍐滄埛涓嶈兘涓虹┖") + private Long clientId; + + /** + * 鎿嶄綔鍛� + */ + @NotNull(message = "鎿嶄綔鍛樹笉鑳戒负绌�") + private Long operator; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java index 2688634..496e055 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitCtrl.java +++ b/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); + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java index 195f8cb..3ad9207 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/IrrigateUnitSv.java +++ b/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); + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/dto/UnitClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/dto/UnitClient.java new file mode 100644 index 0000000..72d435d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateUnit/dto/UnitClient.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java index 2dec946..da259a9 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/result/IrrigateResultCode.java +++ b/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, "璇疯緭鍏ラ」鐩甀D"), 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; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java index c42f2a8..cc04af9 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java +++ b/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锛夊湪姘村崱琛ㄤ腑閽堝姘村崱缂栧彿锛坈ardNum锛夎繘琛屾ā绯婃煡璇� @@ -88,34 +85,21 @@ * 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"; + if(cardNum != null && cardNum.trim().length() > 0) { + Integer number = Integer.parseInt(cardNum.substring(12)); + number = number + 1; + if(number > 65535) { + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_OVERRUN.getMessage()); } - }else { - if(cardNum != null && cardNum.trim().length() > 0) { - Integer number = Integer.parseInt(cardNum.substring(12)); - number = number + 1; - if(number > 65535) { - return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_OVERRUN.getMessage()); - } - cardNum = cardNum.substring(0, 12) + String.format("%05d", number); - } else { - cardNum = areaCode + "00001"; - } + cardNum = cardNum.substring(0, 12) + String.format("%05d", number); + } else { + cardNum = areaCode + "00001"; } /** * cardAddr 姘村崱鍦板潃锛堜粎浠呭啓鍏ワ紝鏃犱笟鍔★級 - * clientNum 鍐滄埛缂栧彿 * cardCost 鍗$墖璐圭敤 + * originalCardId 鍘熸按鍗D * amount 鍏呭�奸噾棰濓紝鍏呭�兼帴鍙d负杈撳叆鍙傛暟锛岃ˉ鍗℃帴鍙d负鍘熷崱閫�杩橀噾棰� * 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()); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/ActiveCard.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/ActiveCard.java new file mode 100644 index 0000000..2cbc5a0 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/ActiveCard.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/DtoActiveCard.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/DtoActiveCard.java index 0a5e3a5..d17a0fa 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/dto/DtoActiveCard.java +++ b/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锛堜富閿級锛屼笉鏄紑鍗℃帴鍙d紶鍏ワ紝鐢卞啘鎴风紪鍙疯幏寰楋紝淇濆瓨寮�鍗¤褰曞拰鍏呭�艰褰曢兘闇�瑕� + * 鍐滄埛ID锛堜富閿級 */ @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Long clientId; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java index 38061cc..447a341 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java +++ b/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 { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java index 8c2b4a6..c695e7c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java +++ b/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); -- Gitblit v1.8.0