Jelajahi Sumber

人工审核成本添加bug修复

wuhp 2 tahun lalu
induk
melakukan
f19e277256

+ 2 - 1
src/main/java/com/ydtech/modules/ins/dao/InsLaborCostMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
 import com.ydtech.modules.ins.model.InsLaborCost;
 import com.ydtech.modules.ins.model.vo.InsLaborCostVo;
+import io.lettuce.core.dynamic.annotation.Param;
 
 /**
 * @author Administrator
@@ -19,7 +20,7 @@ public interface InsLaborCostMapper extends BaseMapper<InsLaborCost> {
      *  @Date: 2024/7/31 15:00
      *  @Description: 分页查询
      */
-    Page<InsLaborCost> queryPage(Page<SysUserLinkPtlAgreementDto> page, InsLaborCostVo insLaborCostVo);
+    Page<InsLaborCost> queryPage(@Param("page") Page<SysUserLinkPtlAgreementDto> page, @Param("vo") InsLaborCostVo vo);
 }
 
 

+ 15 - 4
src/main/java/com/ydtech/modules/ins/model/InsLaborCost.java

@@ -26,57 +26,68 @@ public class InsLaborCost implements Serializable {
     /**
      * 年-月
      */
-    private String yearMonth;
+    @TableField(value="year_and_month")
+    private String yearAndMonth;
 
 
     /**
      * 人力成本
      */
+    @TableField(value="labor_cost")
     private BigDecimal laborCost;
 
     /**
      * 固定成本
      */
+    @TableField(value="fixed_cost")
     private BigDecimal fixedCost;
 
     /**
      * 变动成本
      */
+    @TableField(value="variable_cost")
     private BigDecimal variableCost;
 
     /**
      * 经营利润
      */
+    @TableField(value="operating_profit")
     private BigDecimal operatingProfit;
 
     /**
      * 税费
      */
+    @TableField(value="taxation")
     private BigDecimal taxation;
 
     /**
      * 净利润
      */
+    @TableField(value="net_profit")
     private BigDecimal netProfit;
 
     /**
      * 创建人
      */
+    @TableField(value="create_user")
     private String createUser;
 
     /**
      * 创建时间
      */
+    @TableField(value="create_date")
     private Date createDate;
 
     /**
      * 修改人
      */
+    @TableField(value="update_user")
     private Date updateUser;
 
     /**
      * 修改时间
      */
+    @TableField(value="update_date")
     private Date updateDate;
 
     @TableField(exist = false)
@@ -95,7 +106,7 @@ public class InsLaborCost implements Serializable {
         }
         InsLaborCost other = (InsLaborCost) that;
         return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
-            && (this.getYearMonth() == null ? other.getYearMonth() == null : this.getYearMonth().equals(other.getYearMonth()))
+            && (this.getYearAndMonth() == null ? other.getYearAndMonth() == null : this.getYearAndMonth().equals(other.getYearAndMonth()))
             && (this.getLaborCost() == null ? other.getLaborCost() == null : this.getLaborCost().equals(other.getLaborCost()))
             && (this.getFixedCost() == null ? other.getFixedCost() == null : this.getFixedCost().equals(other.getFixedCost()))
             && (this.getVariableCost() == null ? other.getVariableCost() == null : this.getVariableCost().equals(other.getVariableCost()))
@@ -113,7 +124,7 @@ public class InsLaborCost implements Serializable {
         final int prime = 31;
         int result = 1;
         result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
-        result = prime * result + ((getYearMonth() == null) ? 0 : getYearMonth().hashCode());
+        result = prime * result + ((getYearAndMonth() == null) ? 0 : getYearAndMonth().hashCode());
         result = prime * result + ((getLaborCost() == null) ? 0 : getLaborCost().hashCode());
         result = prime * result + ((getFixedCost() == null) ? 0 : getFixedCost().hashCode());
         result = prime * result + ((getVariableCost() == null) ? 0 : getVariableCost().hashCode());
@@ -134,7 +145,7 @@ public class InsLaborCost implements Serializable {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
-        sb.append(", yearMonth=").append(yearMonth);
+        sb.append(", yearAndMonth=").append(yearAndMonth);
         sb.append(", laborCost=").append(laborCost);
         sb.append(", fixedCost=").append(fixedCost);
         sb.append(", variableCost=").append(variableCost);

+ 1 - 1
src/main/java/com/ydtech/modules/ins/model/vo/InsLaborCostAddVo.java

@@ -24,7 +24,7 @@ public class InsLaborCostAddVo implements Serializable {
      * 年-月
      */
     @ApiModelProperty("年-月")
-    private String yearMonth;
+    private String yearAndMonth;
 
 
     /**

+ 1 - 1
src/main/java/com/ydtech/modules/ins/model/vo/InsLaborCostVo.java

@@ -15,7 +15,7 @@ public class InsLaborCostVo {
      * 年-月
      */
     @ApiModelProperty("年月")
-    private String yearMonth;
+    private String yearAndMonth;
 
     /**
      * 当前页码

+ 12 - 0
src/main/java/com/ydtech/modules/ins/service/impl/InsLaborCostServiceImpl.java

@@ -1,9 +1,12 @@
 package com.ydtech.modules.ins.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
+import com.ydtech.modules.fnc.entity.InsFeeAuditHistory;
 import com.ydtech.modules.ins.dao.InsLaborCostMapper;
 import com.ydtech.modules.ins.model.InsLaborCost;
 import com.ydtech.modules.ins.model.vo.InsLaborCostAddVo;
@@ -52,6 +55,15 @@ public class InsLaborCostServiceImpl extends ServiceImpl<InsLaborCostMapper, Ins
     @Override
     public void addOrUpdate(InsLaborCostAddVo insLaborCostAddVo, SysUser user) {
         Long id = insLaborCostAddVo.getId();
+        LambdaQueryWrapper<InsLaborCost> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(InsLaborCost::getYearAndMonth, insLaborCostAddVo.getYearAndMonth());
+        if(id!=null){
+            wrapper.ne(InsLaborCost::getId, insLaborCostAddVo.getId());
+        }
+        InsLaborCost one = this.getOne(wrapper);
+        if(one!=null){
+            throw new SystemException("已存在"+insLaborCostAddVo.getYearAndMonth()+"的数据不允许添加!!");
+        }
         if(id==null){
             InsLaborCost vo = new InsLaborCost();
             BeanUtils.copyProperties(insLaborCostAddVo, vo);

+ 4 - 4
src/main/resources/mapper/modules/ins/InsLaborCostMapper.xml

@@ -6,7 +6,7 @@
 
     <resultMap id="BaseResultMap" type="com.ydtech.modules.ins.model.InsLaborCost">
             <id property="id" column="id" jdbcType="BIGINT"/>
-            <result property="yearMonth" column="year_month" jdbcType="VARCHAR"/>
+            <result property="yearAndMonth" column="year_and_month" jdbcType="VARCHAR"/>
             <result property="laborCost" column="labor_cost" jdbcType="DECIMAL"/>
             <result property="fixedCost" column="fixed_cost" jdbcType="DECIMAL"/>
             <result property="variableCost" column="variable_cost" jdbcType="DECIMAL"/>
@@ -20,7 +20,7 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,year,month,
+        id,year_and_month,
         labor_cost,fixed_cost,variable_cost,
         operating_profit,taxation,net_profit,
         create_user,create_date,update_user,
@@ -31,8 +31,8 @@
         <include refid="Base_Column_List"/>
         from ins_labor_cost
         <where>
-            <if test="yearMonth !=null  and  yearMonth !=''">
-                year_month =#{yearMonth}
+            <if test="vo.yearAndMonth !=null  and  vo.yearAndMonth !=''">
+                year_and_month = #{vo.yearAndMonth}
             </if>
         </where>
     </select>