Преглед изворни кода

付款管理-删除付款单同步逻辑删除付款明细

ZhangWenQiang пре 5 година
родитељ
комит
53b396ac5e

+ 1 - 1
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/controller/HlgPaymentController.java

@@ -193,7 +193,7 @@ public class HlgPaymentController {
         if (hlgPaymentEntity == null) {
             result.error500("未找到对应实体");
         } else {
-            result = hlgPaymentService.deleteByLogic(hlgPayment);
+            result = hlgPaymentService.deleteByLogic(hlgPaymentEntity);
         }
         return result;
     }

+ 3 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/mapper/HlgPaymentDetailMapper.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
@@ -31,4 +32,6 @@ public interface HlgPaymentDetailMapper extends BaseMapper<HlgPaymentDetail> {
     List<HlgPaymentDetailStatistics> getPaymentDetailStatisticsList(@Param("hlgPaymentDetailStatistics")HlgPaymentDetailStatistics hlgPaymentDetailStatistics, @Param(Constants.WRAPPER)QueryWrapper<HlgPaymentDetailStatistics> queryWrapper);
 
     List<HlgPaymentDetail> findHlgPaymentDetailListByPaymentId(Integer id);
+
+    void deleteByLogic(@Param("hlgPayment") HlgPayment hlgPayment);
 }

+ 3 - 12
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/mapper/xml/HlgPaymentDetailMapper.xml

@@ -134,16 +134,6 @@
 		group by a.id
 	</select>
 
-    <select id="findAllList" resultType="org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail" >
-        SELECT
-        <include refid="hlgPaymentDetailColumns"/>
-        FROM hlg_payment_detail a
-        <include refid="hlgPaymentDetailJoins"/>
-        <where>
-            a.del_flag = #{DEL_FLAG_NORMAL}
-        </where>
-		ORDER BY a.update_time DESC
-    </select>
 
     <insert id="savePaymentDetail">
 		INSERT INTO hlg_payment_detail(
@@ -236,8 +226,8 @@
     <!--逻辑删除-->
     <update id="deleteByLogic">
 		UPDATE hlg_payment_detail SET
-			del_flag = #{DEL_FLAG_DELETE}
-		WHERE id = #{id}
+			del_flag = '1'
+		WHERE payment_id = #{hlgPayment.id}
 	</update>
 
 	<!--该付款明细用户本月累计已打款-->
@@ -250,6 +240,7 @@
 			a.idcard_number = #{hlgPaymentDetail.idcardNumber}
 			and DATE_FORMAT(a.payment_time, '%Y%m') = DATE_FORMAT( CURDATE( ) , '%Y%m' )
 			and (a.status = 1 or a.status = 2)
+			and a.del_flag = '0'
 		</where>
 	</select>
 

+ 3 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/service/IHlgPaymentDetailService.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.hlgpayment.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
@@ -30,4 +31,6 @@ public interface IHlgPaymentDetailService extends IService<HlgPaymentDetail> {
     List<HlgPaymentDetailStatistics> getPaymentDetailStatisticsList(HlgPaymentDetailStatistics hlgPaymentDetailStatistics,QueryWrapper<HlgPaymentDetailStatistics> queryWrapper);
 
     List<HlgPaymentDetail> findHlgPaymentDetailListByPaymentId(Integer id);
+
+    void deleteByLogic(HlgPayment hlgPayment);
 }

+ 10 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/service/impl/HlgPaymentDetailServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
+import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 import org.jeecg.modules.hlgpayment.mapper.HlgPaymentDetailMapper;
@@ -113,4 +114,13 @@ public class HlgPaymentDetailServiceImpl extends ServiceImpl<HlgPaymentDetailMap
     public List<HlgPaymentDetail> findHlgPaymentDetailListByPaymentId(Integer id) {
         return baseMapper.findHlgPaymentDetailListByPaymentId(id);
     }
+
+    /**
+     * 逻辑删除付款单下的所有明细
+     * @param hlgPayment
+     */
+    @Override
+    public void deleteByLogic(HlgPayment hlgPayment) {
+        baseMapper.deleteByLogic(hlgPayment);
+    }
 }

+ 10 - 4
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/service/impl/HlgPaymentServiceImpl.java

@@ -373,8 +373,14 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
     @Transactional(rollbackFor = Exception.class)
     public Result<HlgPayment> deleteByLogic(HlgPayment hlgPayment) {
         Result<HlgPayment> result = new Result<HlgPayment>();
-        baseMapper.deleteByLogic(hlgPayment);
-        result.success("删除成功");
+        if (hlgPayment.getStatus() == 0 || hlgPayment.getStatus() == 2) {
+            baseMapper.deleteByLogic(hlgPayment);
+            //同步逻辑删除付款明细
+            hlgPaymentDetailService.deleteByLogic(hlgPayment);
+            result.success("删除成功");
+        } else {
+            result.error500("删除失败");
+        }
         return result;
     }
 
@@ -683,7 +689,7 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
                         HlgUser hlgUser = hlgUserMapper.getUserByIdcardNumber(idcardNumber);
                         if (hlgUser == null) {
                             //获取当前平台id
-                            HlgCompany hlgCompany=hlgCompanyService.getById(hlgPayment.getCompanyId());
+                            HlgCompany hlgCompany = hlgCompanyService.getById(hlgPayment.getCompanyId());
                             HlgPlatform hlgPlatform = hlgPlatformMapper.selectById(hlgCompany.getPlatformId());
                             HlgUser hlgUser1 = new HlgUser();
                             hlgUser1.setPlatformId(hlgPlatform.getId());
@@ -743,7 +749,7 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
                 }
             }
         }
-        if(resultlist.size()>0){
+        if (resultlist.size() > 0) {
             return resultlist;
         }
         //定义导入付款总金额