Parcourir la source

Merge remote-tracking branch 'origin/master'

LiRong il y a 3 mois
Parent
commit
230f8f8711

+ 1 - 3
leromro-core/src/main/java/com/leromro/core/controller/OrdersController.java

@@ -23,7 +23,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -219,7 +218,6 @@ public class OrdersController extends BaseController {
      * 导出订单费用结算列表
      */
     @ApiOperation("导出订单费用结算列表")
-    @PreAuthorize("@ss.hasPermi('core:orderSettlementApplication:export')")
     @Log(title = "订单费用结算申请", businessType = BusinessType.EXPORT)
     @PostMapping("/settlementOrderList/export")
     public void export(HttpServletResponse response, SettlementOrderListDTO settlementOrderListDTO)
@@ -234,7 +232,7 @@ public class OrdersController extends BaseController {
             util.hideColumn("areaDistributionRatio","areaDistributionAmount"
                     ,"areaSettlementStatus", "areaSettlementTime","areaPayerMethod"
                     ,"areaPayerAccount","areaPayerAccountBankName","areaPayeeMethod"
-                    ,"areaPayeeAccount","areaPayeeBankName","areaPayeeName");
+                    ,"areaPayeeAccount","areaPayeeBankName","areaPayeeName","areaAuditorRemark");
         }
         util.exportExcel(response, list, "订单费用结算申请数据");
     }

+ 4 - 0
leromro-core/src/main/java/com/leromro/core/domain/OrderSettlementApplication.java

@@ -95,5 +95,9 @@ public class OrderSettlementApplication extends BaseEntity
     @ApiModelProperty("审核结果说明")
     private String auditorRemark;
 
+    @TableField("isNew")
+    @ApiModelProperty("是否最新申请记录 0不是 1是")
+    private Integer isNew;
+
 
 }

+ 2 - 2
leromro-core/src/main/java/com/leromro/core/domain/vo/OrderSettlementApplicationListVO.java

@@ -27,7 +27,7 @@ public class OrderSettlementApplicationListVO {
     private String applyUserName;
 
     // 申请组织(区域/服务中心)
-    @Excel(name = "申请组织(区域/服务中心)")
+    @Excel(name = "申请组织")
     private String applicant;
 
     // 订单id
@@ -187,7 +187,7 @@ public class OrderSettlementApplicationListVO {
     private Date auditorTime;
 
     // 审核状态 10审核中 20审核通过 30审核未通过 40已取消
-    @Excel(name = "审核状态 10审核中 20审核通过 30审核未通过 40已取消",  handler = DictLaberHandler.class, args = { "auditor_status"})
+    @Excel(name = "审核状态",  handler = DictLaberHandler.class, args = { "auditor_status"})
     private String auditorStatus;
 
     // 审核结果说明

+ 14 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/SettlementOrderListVO.java

@@ -138,6 +138,13 @@ public class SettlementOrderListVO {
     @ApiModelProperty("区域收款人姓名")
     private String areaPayeeName;
 
+    /**
+     * 区域公司结算申请审核结果说明
+     */
+    @Excel(name = "区域公司结算申请审核结果说明")
+    @ApiModelProperty("区域公司结算申请审核结果说明")
+    private String areaAuditorRemark;
+
     // 服务中心抽成比例
     @Excel(name = "服务中心抽成比例")
     private BigDecimal serviceCentreDistributionRatio;
@@ -202,4 +209,11 @@ public class SettlementOrderListVO {
     @Excel(name = "服务中心收款人姓名")
     @ApiModelProperty("服务中心收款人姓名")
     private String serviceCentrePayeeName;
+
+    /**
+     * 服务中心结算申请审核结果说明
+     */
+    @Excel(name = "服务中心结算申请审核结果说明")
+    @ApiModelProperty("服务中心结算申请审核结果说明")
+    private String serviceCentreAuditorRemark;
 }

+ 2 - 1
leromro-core/src/main/java/com/leromro/core/service/IOrderSettlementApplicationService.java

@@ -77,8 +77,9 @@ public interface IOrderSettlementApplicationService extends IService<OrderSettle
     /**
      * 取消待审核的结算申请记录
      * @param mainOrderIds
+     * @param applicantType
      */
-    void cancelPendingRecord(List<Long> mainOrderIds);
+    void cancelPendingRecord(List<Long> mainOrderIds,String applicantType);
 
 
     /**

+ 22 - 4
leromro-core/src/main/java/com/leromro/core/service/impl/OrderSettlementApplicationServiceImpl.java

@@ -159,10 +159,11 @@ public class OrderSettlementApplicationServiceImpl extends ServiceImpl<OrderSett
 
     @Override
     @Transactional
-    public void cancelPendingRecord(List<Long> secondOrderIds) {
+    public void cancelPendingRecord(List<Long> secondOrderIds,String applicantType) {
         this.update(new LambdaUpdateWrapper<OrderSettlementApplication>()
                 .set(OrderSettlementApplication::getAuditorStatus, AuditorStatusEnum.CANCEL.getCode())
                 .eq(OrderSettlementApplication::getAuditorStatus, AuditorStatusEnum.AUDITING.getCode())
+                .eq(OrderSettlementApplication::getApplicantType, applicantType)
                 .in(OrderSettlementApplication::getOrderId, secondOrderIds)
         );
     }
@@ -203,8 +204,7 @@ public class OrderSettlementApplicationServiceImpl extends ServiceImpl<OrderSett
                         && !AreaSettlementStatusEnum.REJECTED.getCode().equals(settlementOrder.getAreaSettlementStatus())){
                     throw new ServiceException("订单不能重复申请结算");
                 }
-            }
-            if("4".equals(areaType)){
+            }else if("4".equals(areaType)){
                 if(!ServiceCentreSettlementStatusEnum.PENDING_SETTLEMENT.getCode().equals(settlementOrder.getServiceCentreSettlementStatus())
                         && !ServiceCentreSettlementStatusEnum.REJECTED.getCode().equals(settlementOrder.getServiceCentreSettlementStatus())){
                     throw new ServiceException("订单不能重复申请结算");
@@ -213,7 +213,9 @@ public class OrderSettlementApplicationServiceImpl extends ServiceImpl<OrderSett
         }
 
         // 取消订单之前正在审核中的结算申请记录
-        this.cancelPendingRecord(settlementOrderApplyDTO.getSecondOrderIds());
+        this.cancelPendingRecord(settlementOrderApplyDTO.getSecondOrderIds(),ApplicantTypeEnum.getCodeByAreaType(areaType));
+        // 之前的申请记录设置为不是最新的
+        this.updateIsNew(settlementOrderApplyDTO.getSecondOrderIds(),ApplicantTypeEnum.getCodeByAreaType(areaType),0);
 
         // 新增订单结算申请记录
         List<OrderSettlementApplication> orderSettlementApplicationList = new ArrayList<>();
@@ -230,6 +232,7 @@ public class OrderSettlementApplicationServiceImpl extends ServiceImpl<OrderSett
                     .payeeBankName(settlementOrderApplyDTO.getPayeeBankName())
                     .payeeName(settlementOrderApplyDTO.getPayeeName())
                     .payeeRemark(settlementOrderApplyDTO.getPayeeRemark())
+                    .isNew(1)
                     .build();
             orderSettlementApplicationList.add(orderSettlementApplication);
         }
@@ -243,6 +246,21 @@ public class OrderSettlementApplicationServiceImpl extends ServiceImpl<OrderSett
         }
     }
 
+    /**
+     * 更新订单结算申请记录是否最新
+     * @param secondOrderIds
+     * @param isNew
+     */
+    @Transactional
+    public void updateIsNew(List<Long> secondOrderIds,String applicantType,Integer isNew){
+        this.update(new LambdaUpdateWrapper<OrderSettlementApplication>()
+                .set(OrderSettlementApplication::getIsNew, isNew)
+                .in(OrderSettlementApplication::getOrderId, secondOrderIds)
+                .eq(OrderSettlementApplication::getApplicantType, applicantType)
+                .eq(OrderSettlementApplication::getIsNew,1)
+        );
+    }
+
     @Override
     @Transactional
     public void auditorOrderSettlement(SettlementOrderAuditorDTO settlementOrderAuditorDTO) {

+ 4 - 4
leromro-core/src/main/resources/mapper/core/OrderSettlementApplicationMapper.xml

@@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         a.id as id,
         a.application_time as applyTime,
         application_user.nick_name AS applyUserName,
-        sys_dept.dept_name AS applyUserName,
+        sys_dept.dept_name AS applicant,
         l_second_order.second_order_id AS secondOrderId,
         l_second_order.out_trade_no AS outTradeNo,
         l_second_order.create_time AS orderTime,
@@ -182,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND l_second_order.service_centre_payee_account LIKE CONCAT('%', #{serviceCentrePayeeAccount}, '%')
             </if>
             <if test="orderNo != null and orderNo != ''">
-                AND a.out_trade_no LIKE CONCAT('%', #{orderNo}, '%')
+                AND l_second_order.out_trade_no LIKE CONCAT('%', #{orderNo}, '%')
             </if>
             <if test="startTime != null">
                 AND l_second_order.create_time >= #{startTime}
@@ -193,11 +193,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 ]]>
             </if>
             <if test="serviceCompleteStartTime != null ">
-                AND a.work_end_time >= #{serviceCompleteStartTime}
+                AND l_second_order.service_end_time >= #{serviceCompleteStartTime}
             </if>
             <if test="serviceCompleteEndTime != null">
                 <![CDATA[
-                    AND a.work_end_time <= #{serviceCompleteEndTime}
+                    AND l_second_order.service_end_time <= #{serviceCompleteEndTime}
                 ]]>
             </if>
             <if test="userPhone != null and userPhone != ''">

+ 13 - 3
leromro-core/src/main/resources/mapper/core/SecondOrdersMapper.xml

@@ -339,6 +339,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         a.area_payee_account AS areaPayeeAccount,
         a.area_payee_bank_name AS areaPayeeBankName,
         a.area_payee_name AS areaPayeeName,
+        areaApplication.auditor_remark AS areaAuditorRemark,
         a.service_centre_distribution_ratio AS serviceCentreDistributionRatio,
         a.service_centre_distribution_amount AS serviceCentreDistributionAmount,
         a.service_centre_settlement_status AS serviceCentreSettlementStatus,
@@ -349,7 +350,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         a.service_centre_payee_method AS serviceCentrePayeeMethod,
         a.service_centre_payee_account AS serviceCentrePayeeAccount,
         a.service_centre_payee_bank_name AS serviceCentrePayeeBankName,
-        a.service_centre_payee_name AS serviceCentrePayeeName
+        a.service_centre_payee_name AS serviceCentrePayeeName,
+        serviceCentreApplication.auditor_remark AS serviceCentreAuditorRemark
         FROM l_second_order a
         left join sys_dept area on a.area_distribution_id = area.dept_id
         left join sys_dept service_centre on a.service_center_id = service_centre.dept_id
@@ -359,6 +361,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join sys_user as_user on a.area_settlement_user_id = as_user.user_id
         left join sys_user scs_user on a.service_centre_settlement_user_id = scs_user.user_id
         left join l_volunteer_info lvi on a.volunteer_info_id = lvi.volunteer_info_id
+        left join l_order_settlement_application areaApplication
+            on a.second_order_id = areaApplication.order_id
+            and areaApplication.applicant_type = 1
+            and areaApplication.isNew = 1
+        left join l_order_settlement_application serviceCentreApplication
+        on a.second_order_id = serviceCentreApplication.order_id
+        and serviceCentreApplication.applicant_type = 2
+        and serviceCentreApplication.isNew = 1
         <where>
             a.volunteer_settlement_status = 20
             <if test="areaDistributionId!=null">
@@ -397,11 +407,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 ]]>
             </if>
             <if test="serviceCompleteStartTime != null ">
-                AND a.service_start_time >= #{serviceStartTime}
+                AND a.service_end_time >= #{serviceCompleteStartTime}
             </if>
             <if test="serviceCompleteEndTime != null">
                 <![CDATA[
-                    AND a.work_end_time <= #{serviceEndTime}
+                    AND a.service_end_time <= #{serviceCompleteEndTime}
                 ]]>
             </if>
             <if test="areaSettlementStatus != null and areaSettlementStatus != ''">