Bladeren bron

添加审核功能拒绝重新审核

xgb 1 maand geleden
bovenliggende
commit
ccded61814

+ 1 - 0
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreOrderAuditScrmController.java

@@ -5,6 +5,7 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.entity.SysUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.utils.SecurityUtils;
+import com.fs.company.domain.CompanyUser;
 import com.fs.hisStore.param.FsStoreOrderAuditParam;
 import com.fs.hisStore.param.FsStoreOrderAuditReviewParam;
 import com.fs.hisStore.service.IFsStoreOrderAuditScrmService;

+ 16 - 0
fs-company/src/main/java/com/fs/hisStore/controller/FsStoreOrderAuditScrmController.java

@@ -6,6 +6,7 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.company.domain.CompanyUser;
 import com.fs.framework.security.SecurityUtils;
 import com.fs.hisStore.param.FsStoreOrderAuditParam;
+import com.fs.hisStore.param.FsStoreOrderAuditPayRemainParam;
 import com.fs.hisStore.param.FsStoreOrderAuditReviewParam;
 import com.fs.hisStore.service.IFsStoreOrderAuditScrmService;
 import com.fs.hisStore.vo.FsStoreOrderAuditVO;
@@ -48,4 +49,19 @@ public class FsStoreOrderAuditScrmController extends BaseController {
         fsStoreOrderAuditService.auditBatch(ids, user.getUserId(), true);
         return AjaxResult.success();
     }
+
+    /**
+     * @Description: 审核拒绝后 重新审核
+     * @Param:
+     * @Return:
+     * @Author xgb
+     * @Date 2025/9/26 16:03
+     */
+    @PreAuthorize("@ss.hasAnyPermi('store:storeOrderAudit:auditAgain')")
+    @PostMapping("/auditAgain")
+    public AjaxResult auditAgain(@Valid @RequestBody FsStoreOrderAuditPayRemainParam param) {
+        fsStoreOrderAuditService.auditAgain(param, true);
+        return AjaxResult.success();
+    }
+
 }

+ 1 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreOrderAuditScrmMapper.java

@@ -26,4 +26,5 @@ public interface FsStoreOrderAuditScrmMapper extends BaseMapper<FsStoreOrderAudi
      */
     void updateBatchAudit(@Param("entity") FsStoreOrderAuditScrm entity, @Param("ids") List<Long> ids);
 
+    FsStoreOrderAuditScrm selectByOrderId(Long orderId);
 }

+ 5 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreOrderScrmMapper.java

@@ -76,7 +76,8 @@ public interface FsStoreOrderScrmMapper
     public int deleteFsStoreOrderByIds(Long[] ids);
 
     @Select({"<script> " +
-            "select o.*,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber   from fs_store_order_scrm o left join fs_user u on o.user_id=u.user_id  left join company c on c.company_id=o.company_id left join company_user cu on cu.user_id=o.company_user_id  " +
+            "select o.*,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber,fsoa.audit_status   from fs_store_order_scrm o left join fs_user u on o.user_id=u.user_id  left join company c on c.company_id=o.company_id left join company_user cu on cu.user_id=o.company_user_id  " +
+            "left join fs_store_order_audit_scrm fsoa on fsoa.order_id = o.id " +
             "<if test = 'maps.productName != null and  maps.productName !=  \"\" '> " +
             "left join fs_store_order_item_scrm oi on o.id = oi.order_id "+
             "left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id"+
@@ -168,6 +169,9 @@ public interface FsStoreOrderScrmMapper
             " AND date_format(o.delivery_import_time,'%y%m%d') &gt;= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d') " +
             " AND date_format(o.delivery_import_time,'%y%m%d') &lt;= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d') " +
             "</if>" +
+            "<if test='maps.auditStatus !=null '>" +
+            "AND fsoa.audit_status = #{maps.auditStatus} " +
+            "</if>" +
             "<if test = 'maps.deptId != null    '> " +
             "  AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
             "</if>" +

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreOrderAuditScrmService.java

@@ -3,6 +3,7 @@ package com.fs.hisStore.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.hisStore.domain.FsStoreOrderAuditScrm;
 import com.fs.hisStore.param.FsStoreOrderAuditParam;
+import com.fs.hisStore.param.FsStoreOrderAuditPayRemainParam;
 import com.fs.hisStore.param.FsStoreOrderAuditReviewParam;
 import com.fs.hisStore.vo.FsStoreOrderAuditVO;
 
@@ -34,4 +35,6 @@ public interface IFsStoreOrderAuditScrmService extends IService<FsStoreOrderAudi
      */
 
     void auditBatch(String ids, Long userId, boolean b);
+
+    void auditAgain(FsStoreOrderAuditPayRemainParam param, boolean b);
 }

+ 33 - 5
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderAuditScrmServiceImpl.java

@@ -8,6 +8,7 @@ import com.fs.hisStore.domain.FsStoreOrderAuditLogScrm;
 import com.fs.hisStore.enums.OrderAuditStateEnum;
 import com.fs.hisStore.mapper.FsStoreOrderAuditScrmMapper;
 import com.fs.hisStore.param.FsStoreOrderAuditParam;
+import com.fs.hisStore.param.FsStoreOrderAuditPayRemainParam;
 import com.fs.hisStore.param.FsStoreOrderAuditReviewParam;
 import com.fs.hisStore.service.IFsStoreOrderAuditLogScrmService;
 import com.fs.hisStore.service.IFsStoreOrderAuditScrmService;
@@ -123,7 +124,7 @@ public class FsStoreOrderAuditScrmServiceImpl extends ServiceImpl<FsStoreOrderAu
         if (param.getReviewType() == 1) { // 审核通过
             newStatus = OrderAuditStateEnum.APPROVED;
             message = "审核通过";
-        } else { // 审核拒绝
+        }else { // 审核拒绝
             newStatus = OrderAuditStateEnum.COMPANY_REJECT;
             if (StringUtils.isBlank(param.getReviewContent())) {
                 throw new CustomException("被拒原因不能为空");
@@ -134,13 +135,10 @@ public class FsStoreOrderAuditScrmServiceImpl extends ServiceImpl<FsStoreOrderAu
             fsStoreOrderAudit.setReason(param.getReviewContent());
         }
 
-
         fsStoreOrderAudit.setCompanyAuditTime(now);
-        fsStoreOrderAudit.setCompanyAuditUserId(userId);
         fsStoreOrderAudit.setAuditStatus(newStatus.getValue());
-
+        fsStoreOrderAudit.setCompanyAuditUserId(userId);
         baseMapper.updateById(fsStoreOrderAudit);
-
         FsStoreOrderAuditLogScrm auditLog = new FsStoreOrderAuditLogScrm();
         auditLog.setAuditId(fsStoreOrderAudit.getId());
         auditLog.setOrderId(fsStoreOrderAudit.getOrderId());
@@ -194,4 +192,34 @@ public class FsStoreOrderAuditScrmServiceImpl extends ServiceImpl<FsStoreOrderAu
         fsStoreOrderAuditLogService.saveBatch(auditLogs);
 
     }
+
+    /**
+     * @Description: 重新提交审核
+     * @Param:
+     * @Return:
+     * @Author xgb
+     * @Date 2025/9/26 17:16
+     */
+    @Override
+    public void auditAgain(FsStoreOrderAuditPayRemainParam param, boolean b) {
+        FsStoreOrderAuditScrm fsStoreOrderAudit = baseMapper.selectByOrderId(param.getOrderId());
+        if (Objects.isNull(fsStoreOrderAudit)) {
+            throw new CustomException("记录不存在");
+        }
+        OrderAuditStateEnum orderAuditStateEnum = OrderAuditStateEnum.getOrderAuditStateEnum(fsStoreOrderAudit.getAuditStatus());
+        if (OrderAuditStateEnum.COMPANY_REJECT != orderAuditStateEnum) {
+            throw new CustomException("审核未被拒绝,无需重新审核");
+        }
+
+        fsStoreOrderAudit.setCompanyAuditTime(LocalDateTime.now());
+        fsStoreOrderAudit.setAuditStatus(OrderAuditStateEnum.COMPANY_PENDING.getValue());
+        baseMapper.updateById(fsStoreOrderAudit);
+
+        FsStoreOrderAuditLogScrm auditLog = new FsStoreOrderAuditLogScrm();
+        auditLog.setAuditId(fsStoreOrderAudit.getId());
+        auditLog.setOrderId(fsStoreOrderAudit.getOrderId());
+        auditLog.setContent("销售修改订单重新提交审核");
+        auditLog.setCreateTime(LocalDateTime.now());
+        fsStoreOrderAuditLogService.save(auditLog);
+    }
 }

+ 4 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderAuditScrmMapper.xml

@@ -70,6 +70,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by fsoa.admin_audit_time desc, fsoa.company_audit_time desc, fsoa.create_time desc
     </select>
 
+    <select id="selectByOrderId" resultType="com.fs.hisStore.domain.FsStoreOrderAuditScrm">
+        select * from fs_store_order_audit_scrm where order_id = #{orderId}
+    </select>
+
     <update id="updateBatchAudit">
         update fs_store_order_audit_scrm
         set audit_status = #{entity.auditStatus},