2024-01-25 朱宝民 总账生成功能、总账审核功能
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrGlobal.daoSe; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.SeAudits; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 18:57 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 18:57 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | public interface SeAuditsMapper extends BaseMapper<SeAudits> { | 
|---|
|  |  |  | int deleteByPrimaryKey(Long id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int insert(SeAudits record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int insertSelective(SeAudits record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SeAudits selectByPrimaryKey(Long id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int updateByPrimaryKeySelective(SeAudits record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int updateByPrimaryKey(SeAudits record); | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrGlobal.daoSe; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoGeneral; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 18:57 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 18:57 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | public interface SeGeneralMapper extends BaseMapper<SeGeneral> { | 
|---|
|  |  |  | int deleteByPrimaryKey(Long id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int insert(SeGeneral record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int insertSelective(SeGeneral record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SeGeneral selectByPrimaryKey(Long id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int updateByPrimaryKeySelective(SeGeneral record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int updateByPrimaryKey(SeGeneral record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取未生成总账的交易日期列表(当天的交易记录不生成总账) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<Map<String, Object>> getDatesOfNotInGenerals(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据交易日期获取总账记录列表(待生成的) | 
|---|
|  |  |  | * @param operateDate | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<SeGeneral> getGeneralByOperateDate(@Param("operateDate") String operateDate); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据指定条件获取总账记录数 | 
|---|
|  |  |  | * @param params | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Long getRecordCount(Map<?, ?> params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据指定条件获取总账记录 | 
|---|
|  |  |  | * @param params | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<VoGeneral> getGenerals(Map<?, ?> params); | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrGlobal.pojoSe; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import jakarta.validation.constraints.NotNull; | 
|---|
|  |  |  | import jakarta.validation.constraints.Positive; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  | import org.hibernate.validator.constraints.Length; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 18:57 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 18:57 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @TableName(value="se_audits", autoResultMap = true) | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @Builder | 
|---|
|  |  |  | @ToString | 
|---|
|  |  |  | @NoArgsConstructor | 
|---|
|  |  |  | @AllArgsConstructor | 
|---|
|  |  |  | @Schema(name = "总账审核记录实体") | 
|---|
|  |  |  | public class SeAudits implements BaseEntity { | 
|---|
|  |  |  | public static final long serialVersionUID = 202401251043001L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 主键 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @JSONField(serializeUsing= ObjectWriterImplToString.class) | 
|---|
|  |  |  | @TableId(type = IdType.INPUT) | 
|---|
|  |  |  | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | private Long id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 总账ID | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "总账ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "总账ID不能为空") | 
|---|
|  |  |  | private Long generalId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核状态;1-未审核,2-同意,3-驳回 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "审核状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "审核状态不能为空") | 
|---|
|  |  |  | private Byte auditStatus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核意见 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "审核意见", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @Length(max = 200, message = "审核意见最多200字") | 
|---|
|  |  |  | private String auditOpinion; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 操作人编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "操作人ID不能为空") | 
|---|
|  |  |  | @Positive(message = "操作人ID必须为大于0的整数") | 
|---|
|  |  |  | private Long operator; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 操作时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | private Date operateDt; | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrGlobal.pojoSe; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import jakarta.validation.constraints.Max; | 
|---|
|  |  |  | import jakarta.validation.constraints.Min; | 
|---|
|  |  |  | import jakarta.validation.constraints.NotBlank; | 
|---|
|  |  |  | import jakarta.validation.constraints.NotNull; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 18:57 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 18:57 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @TableName(value="se_general", autoResultMap = true) | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @Builder | 
|---|
|  |  |  | @ToString | 
|---|
|  |  |  | @NoArgsConstructor | 
|---|
|  |  |  | @AllArgsConstructor | 
|---|
|  |  |  | @Schema(name = "总账实体") | 
|---|
|  |  |  | public class SeGeneral implements BaseEntity { | 
|---|
|  |  |  | public static final long serialVersionUID = 202401241912001L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 主键 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @JSONField(serializeUsing= ObjectWriterImplToString.class) | 
|---|
|  |  |  | @TableId(type = IdType.INPUT) | 
|---|
|  |  |  | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | private Long id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 收银员姓名 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "收银员姓名", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotBlank(message = "收银员姓名不能为空") | 
|---|
|  |  |  | private String cashierName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 实收金额 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "实收金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "实收金额不能为空") | 
|---|
|  |  |  | private Double tradeAmount; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 赠送金额 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "赠送金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "赠送金额不能为空") | 
|---|
|  |  |  | private Double gift; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 总额 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "总额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "总额不能为空") | 
|---|
|  |  |  | private Double totalAmount; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 交易日期 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "交易日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "交易日期不能为空") | 
|---|
|  |  |  | private Date operateDate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核状态;1-未审核,2-同意,3-驳回 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "审核状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @Max(message = "审核状态最大为3", value = 3) | 
|---|
|  |  |  | @Min(message = "审核状态最小为1",value = 1) | 
|---|
|  |  |  | private Byte auditStatus; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 17:00 | 
|---|
|  |  |  | 
|---|
|  |  |  | public class VoGeneral implements BaseEntity { | 
|---|
|  |  |  | private static final long serialVersionUID = 202401241706001L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(title = "总账ID") | 
|---|
|  |  |  | private Long generalId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(title = "收银员姓名") | 
|---|
|  |  |  | private String clientNum; | 
|---|
|  |  |  | private String cashierName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(title = "实收金额") | 
|---|
|  |  |  | private Float tradeAmount; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Schema(title = "总额") | 
|---|
|  |  |  | private Float totalAmount; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(title = "日期") | 
|---|
|  |  |  | private Date operateDate; | 
|---|
|  |  |  | @Schema(title = "交易日期") | 
|---|
|  |  |  | private String operateDate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(title = "审核状态") | 
|---|
|  |  |  | private String auditStatus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| 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.daoSe.SeAuditsMapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeAudits"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table se_audits--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="general_id" jdbcType="BIGINT" property="generalId" /> | 
|---|
|  |  |  | <result column="audit_status" jdbcType="TINYINT" property="auditStatus" /> | 
|---|
|  |  |  | <result column="audit_opinion" jdbcType="VARCHAR" property="auditOpinion" /> | 
|---|
|  |  |  | <result column="operator" jdbcType="BIGINT" property="operator" /> | 
|---|
|  |  |  | <result column="operate_dt" jdbcType="TIMESTAMP" property="operateDt" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, general_id, audit_status, audit_opinion, `operator`, operate_dt | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List" /> | 
|---|
|  |  |  | from se_audits | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | delete from se_audits | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeAudits"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_audits (id, general_id, audit_status, | 
|---|
|  |  |  | audit_opinion, `operator`, operate_dt | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{generalId,jdbcType=BIGINT}, #{auditStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{auditOpinion,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeAudits"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_audits | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="generalId != null"> | 
|---|
|  |  |  | general_id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditStatus != null"> | 
|---|
|  |  |  | audit_status, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditOpinion != null"> | 
|---|
|  |  |  | audit_opinion, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | `operator`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operate_dt, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="generalId != null"> | 
|---|
|  |  |  | #{generalId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditStatus != null"> | 
|---|
|  |  |  | #{auditStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditOpinion != null"> | 
|---|
|  |  |  | #{auditOpinion,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeAudits"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update se_audits | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="generalId != null"> | 
|---|
|  |  |  | general_id = #{generalId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditStatus != null"> | 
|---|
|  |  |  | audit_status = #{auditStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditOpinion != null"> | 
|---|
|  |  |  | audit_opinion = #{auditOpinion,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | `operator` = #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operate_dt = #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeAudits"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update se_audits | 
|---|
|  |  |  | set general_id = #{generalId,jdbcType=BIGINT}, | 
|---|
|  |  |  | audit_status = #{auditStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | audit_opinion = #{auditOpinion,jdbcType=VARCHAR}, | 
|---|
|  |  |  | `operator` = #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | operate_dt = #{operateDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | 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.daoSe.SeGeneralMapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table se_general--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="cashier_name" jdbcType="VARCHAR" property="cashierName" /> | 
|---|
|  |  |  | <result column="trade_amount" jdbcType="FLOAT" property="tradeAmount" /> | 
|---|
|  |  |  | <result column="gift" jdbcType="FLOAT" property="gift" /> | 
|---|
|  |  |  | <result column="total_amount" jdbcType="FLOAT" property="totalAmount" /> | 
|---|
|  |  |  | <result column="operate_date" jdbcType="TIMESTAMP" property="operateDate" /> | 
|---|
|  |  |  | <result column="audit_status" jdbcType="TINYINT" property="auditStatus" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, cashier_name, trade_amount, gift, total_amount, operate_date, audit_status | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List" /> | 
|---|
|  |  |  | from se_general | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | delete from se_general | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_general (id, cashier_name, trade_amount, | 
|---|
|  |  |  | gift, total_amount, operate_date, | 
|---|
|  |  |  | audit_status) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{cashierName,jdbcType=VARCHAR}, #{tradeAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | #{gift,jdbcType=FLOAT}, #{totalAmount,jdbcType=FLOAT}, #{operateDate,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{auditStatus,jdbcType=TINYINT}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_general | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="cashierName != null"> | 
|---|
|  |  |  | cashier_name, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="tradeAmount != null"> | 
|---|
|  |  |  | trade_amount, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="gift != null"> | 
|---|
|  |  |  | gift, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="totalAmount != null"> | 
|---|
|  |  |  | total_amount, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDate != null"> | 
|---|
|  |  |  | operate_date, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditStatus != null"> | 
|---|
|  |  |  | audit_status, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="cashierName != null"> | 
|---|
|  |  |  | #{cashierName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="tradeAmount != null"> | 
|---|
|  |  |  | #{tradeAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="gift != null"> | 
|---|
|  |  |  | #{gift,jdbcType=FLOAT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="totalAmount != null"> | 
|---|
|  |  |  | #{totalAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDate != null"> | 
|---|
|  |  |  | #{operateDate,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditStatus != null"> | 
|---|
|  |  |  | #{auditStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update se_general | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="cashierName != null"> | 
|---|
|  |  |  | cashier_name = #{cashierName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="tradeAmount != null"> | 
|---|
|  |  |  | trade_amount = #{tradeAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="gift != null"> | 
|---|
|  |  |  | gift = #{gift,jdbcType=FLOAT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="totalAmount != null"> | 
|---|
|  |  |  | total_amount = #{totalAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDate != null"> | 
|---|
|  |  |  | operate_date = #{operateDate,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="auditStatus != null"> | 
|---|
|  |  |  | audit_status = #{auditStatus,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update se_general | 
|---|
|  |  |  | set cashier_name = #{cashierName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | trade_amount = #{tradeAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | gift = #{gift,jdbcType=FLOAT}, | 
|---|
|  |  |  | total_amount = #{totalAmount,jdbcType=FLOAT}, | 
|---|
|  |  |  | operate_date = #{operateDate,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | audit_status = #{auditStatus,jdbcType=TINYINT} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--获取未生成总账的交易日期列表(当天的交易记录不生成总账)--> | 
|---|
|  |  |  | <select id="getDatesOfNotInGenerals" resultType="java.util.HashMap"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | DISTINCT Date(ope.operate_dt) AS operateDate | 
|---|
|  |  |  | FROM se_card_operate ope | 
|---|
|  |  |  | WHERE Date(ope.operate_dt) NOT IN(SELECT operate_date FROM se_general) AND Date(ope.operate_dt) != CURDATE() | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据交易日期获取总账记录列表(待生成的)  --> | 
|---|
|  |  |  | <select id="getGeneralByOperateDate" resultType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | us.`name` AS cashierName, | 
|---|
|  |  |  | IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, | 
|---|
|  |  |  | IFNULL(SUM(ope.gift),0) AS gift, | 
|---|
|  |  |  | IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, | 
|---|
|  |  |  | Date(ope.operate_dt) AS operateDate, | 
|---|
|  |  |  | 1 AS auditStatus | 
|---|
|  |  |  | FROM se_card_operate ope | 
|---|
|  |  |  | INNER JOIN ba_user us ON ope.operator = us.id | 
|---|
|  |  |  | WHERE Date(ope.operate_dt) = #{operateDate} | 
|---|
|  |  |  | GROUP BY ope.operator, Date(ope.operate_dt) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据指定条件获取总账记录数--> | 
|---|
|  |  |  | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | COUNT(*) AS recordCount | 
|---|
|  |  |  | FROM se_general | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test = "cashierName != null and cashierName !=''"> | 
|---|
|  |  |  | AND cashier_name like CONCAT('%',#{cashierName},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test = "auditStatus != null and auditStatus > 0"> | 
|---|
|  |  |  | AND audit_status = ${auditStatus} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test = "operateDateStart != null and operateDateStop != null"> | 
|---|
|  |  |  | AND Date(operate_date) BETWEEN #{operateDateStart} AND #{operateDateStop} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据指定条件获取总账记录--> | 
|---|
|  |  |  | <select id="getGenerals" resultType="com.dy.pipIrrGlobal.voSe.VoGeneral"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | id AS generalId, | 
|---|
|  |  |  | cashier_name AS cashierName, | 
|---|
|  |  |  | trade_amount AS tradeAmount, | 
|---|
|  |  |  | gift, | 
|---|
|  |  |  | total_amount AS totalAmount, | 
|---|
|  |  |  | Date(operate_date) AS operateDate, | 
|---|
|  |  |  | (CASE | 
|---|
|  |  |  | WHEN audit_status = 1 THEN "未审核" | 
|---|
|  |  |  | WHEN audit_status = 2 THEN "同意" | 
|---|
|  |  |  | WHEN audit_status = 3 THEN "驳回" | 
|---|
|  |  |  | END) AS auditStatus | 
|---|
|  |  |  | FROM se_general | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test = "cashierName != null and cashierName !=''"> | 
|---|
|  |  |  | AND cashier_name like CONCAT('%',#{cashierName},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test = "auditStatus != null and auditStatus > 0"> | 
|---|
|  |  |  | AND audit_status = ${auditStatus} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test = "operateDateStart != null and operateDateStop != null"> | 
|---|
|  |  |  | AND Date(operate_date) BETWEEN #{operateDateStart} AND #{operateDateStop} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY Date(operate_date) DESC | 
|---|
|  |  |  | <if test="pageCurr != null and pageSize != null"> | 
|---|
|  |  |  | LIMIT ${pageCurr}, ${pageSize} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrSell.general; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.aop.SsoAop; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponse; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.common.webUtil.ResultCodeMsg; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoBa.BaClient; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.SeAudits; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrSell.general.dto.DtoGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrSell.general.qo.QoGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrSell.result.SellResultCode; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.Operation; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Content; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.responses.ApiResponse; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.responses.ApiResponses; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.tags.Tag; | 
|---|
|  |  |  | import jakarta.validation.Valid; | 
|---|
|  |  |  | import lombok.RequiredArgsConstructor; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.http.MediaType; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.validation.BindingResult; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 19:01 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 19:01 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Tag(name = "总账管理", description = "总账管理") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(path="general") | 
|---|
|  |  |  | @RequiredArgsConstructor | 
|---|
|  |  |  | public class GeneralCtrl { | 
|---|
|  |  |  | private final GeneralSv generalSv; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据指定条件获取总账记录 | 
|---|
|  |  |  | * 查询前先生成未生成的总账记录 | 
|---|
|  |  |  | * @param vo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "获取总账记录", description = "获取总账记录") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = BaClient.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(path = "get_generals") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoGeneral>>> getOperates(QoGeneral vo){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | add_general(); | 
|---|
|  |  |  | QueryResultVo<List<VoGeneral>> res = generalSv.getGenerals(vo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("查询交易记录异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生成总账 | 
|---|
|  |  |  | *      获取未生成总账的交易日期列表(当天的交易记录不生成总账) | 
|---|
|  |  |  | *      将指定日期的交易记录汇总到总账表 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void add_general(){ | 
|---|
|  |  |  | // 获取未生成总账的交易日期列表(当天的交易记录不生成总账) | 
|---|
|  |  |  | List<Map<String, Object>> list_operateDate = Optional.ofNullable(generalSv.getDatesOfNotInGenerals()).orElse(new ArrayList<>()); | 
|---|
|  |  |  | if(list_operateDate.size() > 0) { | 
|---|
|  |  |  | for(int i = 0; i < list_operateDate.size(); i++) { | 
|---|
|  |  |  | String operateDate = list_operateDate.get(i).get("operateDate").toString(); | 
|---|
|  |  |  | // 根据交易日期获取总账记录列表(待生成的) | 
|---|
|  |  |  | List<SeGeneral> list_general = Optional.ofNullable(generalSv.getGeneralByOperateDate(operateDate)).orElse(new ArrayList<>()); | 
|---|
|  |  |  | if(list_general.size() > 0) { | 
|---|
|  |  |  | for(int j = 0; j < list_general.size(); j++) { | 
|---|
|  |  |  | SeGeneral general = list_general.get(j); | 
|---|
|  |  |  | generalSv.addGeneral(general); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核总账 | 
|---|
|  |  |  | *  1. 修改总账审核状态 | 
|---|
|  |  |  | *  2. 添加总账审核记录 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Operation(summary = "审核总账", description = "审核总账") | 
|---|
|  |  |  | @ApiResponses(value = { | 
|---|
|  |  |  | @ApiResponse( | 
|---|
|  |  |  | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
|---|
|  |  |  | description = "操作结果:true:成功,false:失败(BaseResponse.content)", | 
|---|
|  |  |  | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "audit", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> audit(@RequestBody @Valid DtoGeneral po, BindingResult bindingResult){ | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Long generalId = po.getGeneralId(); | 
|---|
|  |  |  | Byte auditStatus = po.getAuditStatus(); | 
|---|
|  |  |  | String auditOpinion = po.getAuditOpinion(); | 
|---|
|  |  |  | Long operator = po.getOperator(); | 
|---|
|  |  |  | Date auditTime = new Date(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(generalId == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SellResultCode.GENERAL_ID_CANNOT_BE_NULL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 判断总账是否存在 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | if(generalSv.getGeneralById(generalId) == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SellResultCode.GENERAL_NOT_EXIST.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改总账审核状态 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | SeGeneral seGeneral = new SeGeneral(); | 
|---|
|  |  |  | seGeneral.setId(generalId); | 
|---|
|  |  |  | seGeneral.setAuditStatus(auditStatus); | 
|---|
|  |  |  | Integer rec_updateGeneral = Optional.ofNullable(generalSv.updateGeneral(seGeneral)).orElse(0); | 
|---|
|  |  |  | if(rec_updateGeneral == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SellResultCode.GENERAL_AUDIT_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加总账审核记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | SeAudits seAudits = new SeAudits(); | 
|---|
|  |  |  | seAudits.setGeneralId(generalId); | 
|---|
|  |  |  | seAudits.setAuditStatus(auditStatus); | 
|---|
|  |  |  | seAudits.setAuditOpinion(auditOpinion); | 
|---|
|  |  |  | seAudits.setOperator(operator); | 
|---|
|  |  |  | seAudits.setOperateDt(auditTime); | 
|---|
|  |  |  | Integer rec_addAucits = Optional.ofNullable(generalSv.addAudits(seAudits)).orElse(0); | 
|---|
|  |  |  | if(rec_addAucits == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SellResultCode.AUDITS_ADD_FAIL.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrSell.general; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.SeAuditsMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.SeGeneralMapper; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.SeAudits; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoGeneral; | 
|---|
|  |  |  | import com.dy.pipIrrSell.general.qo.QoGeneral; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 19:02 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 19:02 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class GeneralSv { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeGeneralMapper seGeneralMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeAuditsMapper seAuditsMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取未生成总账的交易日期列表(当天的交易记录不生成总账) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Map<String, Object>> getDatesOfNotInGenerals() { | 
|---|
|  |  |  | return seGeneralMapper.getDatesOfNotInGenerals(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加总账 | 
|---|
|  |  |  | * @param po 总账对象 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer addGeneral(SeGeneral po) { | 
|---|
|  |  |  | return seGeneralMapper.insert(po); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据交易日期获取总账记录列表(待生成的) | 
|---|
|  |  |  | * @param operateDate 交易日期 | 
|---|
|  |  |  | * @return 取总账记录列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<SeGeneral> getGeneralByOperateDate(String operateDate) { | 
|---|
|  |  |  | return seGeneralMapper.getGeneralByOperateDate(operateDate); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据指定条件获取总账记录 | 
|---|
|  |  |  | * @param queryVo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoGeneral>> getGenerals(QoGeneral queryVo) { | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long itemTotal = seGeneralMapper.getRecordCount(params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QueryResultVo<List<VoGeneral>> rsVo = new QueryResultVo<>() ; | 
|---|
|  |  |  | Integer pageCurr = 0; | 
|---|
|  |  |  | Integer pageSize = 10000; | 
|---|
|  |  |  | rsVo.pageCurr = 1; | 
|---|
|  |  |  | rsVo.pageSize = 10000; | 
|---|
|  |  |  | if(queryVo.pageSize != null && queryVo.pageCurr != null) { | 
|---|
|  |  |  | rsVo.pageSize = queryVo.pageSize ; | 
|---|
|  |  |  | rsVo.pageCurr = queryVo.pageCurr; | 
|---|
|  |  |  | pageSize = queryVo.pageSize ; | 
|---|
|  |  |  | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | params.put("pageCurr", pageCurr); | 
|---|
|  |  |  | params.put("pageSize", pageSize); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rsVo.calculateAndSet(itemTotal, params); | 
|---|
|  |  |  | rsVo.obj = seGeneralMapper.getGenerals(params); | 
|---|
|  |  |  | return rsVo ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改总账审核意见 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer updateGeneral(SeGeneral po) { | 
|---|
|  |  |  | return seGeneralMapper.updateByPrimaryKeySelective(po); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据编号查询总账 | 
|---|
|  |  |  | * @param id | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public SeGeneral getGeneralById(Long id) { | 
|---|
|  |  |  | return seGeneralMapper.selectByPrimaryKey(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * t添加总账审核记录 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer addAudits(SeAudits po) { | 
|---|
|  |  |  | return seAuditsMapper.insert(po); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrSell.general.dto; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import jakarta.validation.constraints.NotNull; | 
|---|
|  |  |  | import jakarta.validation.constraints.Positive; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  | import org.hibernate.validator.constraints.Length; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-25 10:19 | 
|---|
|  |  |  | * @LastEditTime 2024-01-25 10:19 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @Builder | 
|---|
|  |  |  | @ToString | 
|---|
|  |  |  | @NoArgsConstructor | 
|---|
|  |  |  | @AllArgsConstructor | 
|---|
|  |  |  | @Schema(name = "总账审核传入对象") | 
|---|
|  |  |  | public class DtoGeneral { | 
|---|
|  |  |  | public static final long serialVersionUID = 202401251020001L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 总账ID | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "总账ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "总账ID不能为空") | 
|---|
|  |  |  | @Positive(message = "总账编号必须为大于0的整数") | 
|---|
|  |  |  | private Long generalId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核状态 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "审核状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "审核状态不能为空") | 
|---|
|  |  |  | private Byte auditStatus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 审核意见 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "审核意见", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @Length(max = 200, message = "审核意见最多200字") | 
|---|
|  |  |  | private String auditOpinion; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 操作人编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "操作人编号不能为空") | 
|---|
|  |  |  | @Positive(message = "操作人编号必须为大于0的整数") | 
|---|
|  |  |  | private Long operator; | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrSell.general.qo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryConditionVo; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-01-24 20:25 | 
|---|
|  |  |  | * @LastEditTime 2024-01-24 20:25 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @EqualsAndHashCode(callSuper = false) | 
|---|
|  |  |  | @ToString(callSuper = true) | 
|---|
|  |  |  | @NoArgsConstructor | 
|---|
|  |  |  | @AllArgsConstructor | 
|---|
|  |  |  | @Builder | 
|---|
|  |  |  | @Schema(name = "总账查询条件") | 
|---|
|  |  |  | public class QoGeneral extends QueryConditionVo { | 
|---|
|  |  |  | @Schema(description = "收银员姓名") | 
|---|
|  |  |  | public String cashierName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "交易查询起始日期") | 
|---|
|  |  |  | public String operateDateStart; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "交易查询截止日期") | 
|---|
|  |  |  | public String operateDateStop; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "审核状态") | 
|---|
|  |  |  | private Byte auditStatus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 补扣 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | REFUND_FAIL_WRITE_REFUND_ERROR(70001, "补扣失败-补扣记录写入异常"); | 
|---|
|  |  |  | REFUND_FAIL_WRITE_REFUND_ERROR(70001, "补扣失败-补扣记录写入异常"), | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 总账 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | GENERAL_ID_CANNOT_BE_NULL(80001, "总账编号不能为空"), | 
|---|
|  |  |  | GENERAL_NOT_EXIST(80001, "总账不存在"), | 
|---|
|  |  |  | GENERAL_AUDIT_FAIL(80001, "总账审核失败"), | 
|---|
|  |  |  | AUDITS_ADD_FAIL(80001, "总账审核记录添加失败"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final Integer code; | 
|---|
|  |  |  | private final String message; | 
|---|