he2802 2 years ago
parent
commit
c5d1e3be81
16 changed files with 732 additions and 20 deletions
  1. 79 3
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/settle/TopInstSettleController.java
  2. 29 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/CheckSettleBo.java
  3. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/NumSettleBo.java
  4. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/NumSettleOrderBo.java
  5. 8 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/SettleQueryBo.java
  6. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/TimeSettleBo.java
  7. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/domian/TopInstSettle.java
  8. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/domian/TopInstSettleRelaiton.java
  9. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/mapper/TopInstSettleMapper.java
  10. 15 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/service/ITopInstSettleService.java
  11. 297 10
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/service/impl/ITopInstSettleServiceImpl.java
  12. 82 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/NumSettleDetailVo.java
  13. 49 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/NumSettleOrderVo.java
  14. 6 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/SettleVo.java
  15. 84 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/TimeSettleDetailVo.java
  16. 65 0
      zhongzheng-system/src/main/resources/mapper/modules/settle/ExamActivityMapper.xml

+ 79 - 3
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/settle/TopInstSettleController.java

@@ -14,9 +14,7 @@ import com.zhongzheng.framework.web.service.TopTokenService;
 import com.zhongzheng.modules.top.goods.vo.TopOldOrderVo;
 import com.zhongzheng.modules.top.settle.bo.*;
 import com.zhongzheng.modules.top.settle.service.ITopInstSettleService;
-import com.zhongzheng.modules.top.settle.vo.SettleOrderImportVo;
-import com.zhongzheng.modules.top.settle.vo.SettleVo;
-import com.zhongzheng.modules.top.settle.vo.TopOrderInfoVo;
+import com.zhongzheng.modules.top.settle.vo.*;
 import com.zhongzheng.modules.user.bo.UserImportAddBo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -25,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.validation.Valid;
 import java.math.BigDecimal;
 import java.util.Collections;
 import java.util.List;
@@ -115,8 +114,85 @@ public class TopInstSettleController extends BaseController {
     @ApiOperation("结算订单列表")
     @GetMapping("/list")
     public TableDataInfo<SettleVo> list(SettleQueryBo bo) {
+        TopLoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setLoginId(loginUser.getUser().getUserId());
+        bo.setLoginName(loginUser.getUser().getUserName());
         startPage();
         List<SettleVo> list = ITopInstSettleService.getSettleList(bo);
         return getDataTable(list);
     }
+
+    /**
+     * 获取时间结算单详情信息
+     */
+    @ApiOperation("获取时间结算单详情信息")
+    @GetMapping("/time/detail/{settleId}")
+    public AjaxResult<TimeSettleDetailVo> getTimeSettleDetail(@PathVariable("settleId") Long settleId) {
+        return AjaxResult.success(ITopInstSettleService.getTimeSettleDetail(settleId));
+    }
+
+    /**
+     * 获取数量结算单详情信息
+     */
+    @ApiOperation("获取数量结算单详情信息")
+    @GetMapping("/num/detail/{settleId}")
+    public AjaxResult<NumSettleDetailVo> getNumSettleDetail(@PathVariable("settleId") Long settleId) {
+        return AjaxResult.success(ITopInstSettleService.getNumSettleDetail(settleId));
+    }
+
+    /**
+     * 时间结算单修改
+     */
+    @ApiOperation("时间结算单修改")
+    @PostMapping("/time/update")
+    public AjaxResult<Void> updateTimeSettle(@RequestBody TimeSettleBo bo) {
+        TopLoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setLoginId(loginUser.getUser().getUserId());
+        bo.setLoginName(loginUser.getUser().getUserName());
+        return toAjax(ITopInstSettleService.updateTimeSettle(bo) ? 1 : 0);
+    }
+
+    /**
+     * 数量结算单修改
+     */
+    @ApiOperation("数量结算单修改")
+    @PostMapping("/num/update")
+    public AjaxResult<Void> updateNumSettle(@RequestBody NumSettleBo bo) {
+        TopLoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setLoginId(loginUser.getUser().getUserId());
+        bo.setLoginName(loginUser.getUser().getUserName());
+        return toAjax(ITopInstSettleService.updateNumSettle(bo) ? 1 : 0);
+    }
+
+    /**
+     * 结算单批量提交审核
+     */
+    @ApiOperation("结算单批量提交审核")
+    @PostMapping("/batch/submit/check")
+    public AjaxResult<Void> batchSubmitCheck(@RequestBody List<Long> settleIds) {
+        TopLoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        return toAjax(ITopInstSettleService.batchSubmitCheck(settleIds,loginUser.getUser().getUserId(),loginUser.getUser().getUserName()) ? 1 : 0);
+    }
+
+    /**
+     * 结算单批量删除
+     */
+    @ApiOperation("结算单批量删除")
+    @PostMapping("/batch/delete")
+    public AjaxResult<Void> batchDeleteSettle(@RequestBody List<Long> settleIds) {
+        return toAjax(ITopInstSettleService.batchDeleteSettle(settleIds) ? 1 : 0);
+    }
+
+    /**
+     * 结算单审核
+     */
+    @ApiOperation("结算单审核")
+    @PostMapping("/check")
+    public AjaxResult<Void> checkSettle(@RequestBody CheckSettleBo bo) {
+        TopLoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setLoginId(loginUser.getUser().getUserId());
+        bo.setLoginName(loginUser.getUser().getUserName());
+        return toAjax(ITopInstSettleService.checkSettle(bo) ? 1 : 0);
+    }
+
 }

+ 29 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/CheckSettleBo.java

@@ -0,0 +1,29 @@
+package com.zhongzheng.modules.top.settle.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年07月26日 15:55
+ */
+@Data
+@ApiModel("结算单审核BO")
+public class CheckSettleBo implements Serializable {
+
+    @ApiModelProperty("结算单ID")
+    private Long settleId;
+
+    @ApiModelProperty("审核结果:1通过 2不通过")
+    private Integer checkResult;
+
+    @ApiModelProperty("审核意见")
+    private Integer checkReason;
+
+    private Long loginId;
+
+    private String loginName;
+}

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/NumSettleBo.java

@@ -16,6 +16,10 @@ import java.util.List;
 @ApiModel("数量保存Bo")
 public class NumSettleBo implements Serializable {
 
+    private Long settleId;
+
+    private Long settleSn;
+
     @ApiModelProperty("标题")
     private String title;
 

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/NumSettleOrderBo.java

@@ -15,6 +15,10 @@ import java.math.BigDecimal;
 @ApiModel("数量保存Bo")
 public class NumSettleOrderBo implements Serializable {
 
+    private Long id;
+
+    private Long settleId;
+
     @ApiModelProperty("订单号")
     private String orderSn;
 

+ 8 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/SettleQueryBo.java

@@ -5,6 +5,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * @author yangdamao
@@ -34,7 +35,7 @@ public class SettleQueryBo implements Serializable {
     @ApiModelProperty("项目ID")
     private Long projectId;
 
-    @ApiModelProperty("审核状态:1待提交 2待审核 3审核中 4未通过 5待支付 6支付失败 7已结算")
+    @ApiModelProperty("审核状态:1待提交 2审核中 3未通过 4待支付 5支付失败 6已结算 7账号待审核")
     private Integer checkStatus;
 
     @ApiModelProperty("开始时间")
@@ -49,4 +50,10 @@ public class SettleQueryBo implements Serializable {
     /** 当前页数 */
     @ApiModelProperty("当前页数")
     private Integer pageNum;
+
+    private Long loginId;
+
+    private String loginName;
+
+    private List<Long> roleIds;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/bo/TimeSettleBo.java

@@ -16,6 +16,10 @@ import java.util.List;
 @ApiModel("时间保存Bo")
 public class TimeSettleBo implements Serializable {
 
+    private Long settleId;
+
+    private Long settleSn;
+
     @ApiModelProperty("标题")
     private String title;
 

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/domian/TopInstSettle.java

@@ -44,7 +44,7 @@ public class TopInstSettle implements Serializable {
     private Long instTpId;
     /** 供应商成本分类id */
     private Long costCatId;
-    /** 审核状态:1待提交 2待审核 3审核中 4未通过 5待支付 6支付失败 7已结算 */
+    /** 审核状态:1待提交 2审核中 3未通过 4待支付 5支付失败 6已结算*/
     private Integer checkStatus;
     /** 1有效 0草稿 */
     private Integer status;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/domian/TopInstSettleRelaiton.java

@@ -34,7 +34,7 @@ public class TopInstSettleRelaiton implements Serializable {
     /** 订单来源 1新系统C端订单,2旧系统C端订单,3旧系统B端订单  */
     private Integer orderFrom;
     /** 提交资料日期 */
-    private String submitDataTime;
+    private Long submitDataTime;
     /** 结算金额 */
     private BigDecimal settleMoney;
     /** 1有效 0草稿 */

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/mapper/TopInstSettleMapper.java

@@ -1,7 +1,9 @@
 package com.zhongzheng.modules.top.settle.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.top.settle.bo.SettleQueryBo;
 import com.zhongzheng.modules.top.settle.domian.TopInstSettle;
+import com.zhongzheng.modules.top.settle.vo.SettleVo;
 import com.zhongzheng.modules.top.settle.vo.TopOrderInfoVo;
 import org.apache.ibatis.annotations.Param;
 
@@ -18,4 +20,6 @@ public interface TopInstSettleMapper extends BaseMapper<TopInstSettle> {
     String getGoodsBusinessName(@Param("orderSn") String orderSn,@Param("orderGoodsId") Long orderGoodsId);
 
     List<Long> getOrderGoodsByBusiness(@Param("orderSn") String orderSn,@Param("tpBusinessName") String tpBusinessName);
+
+    List<SettleVo> getSettleList(SettleQueryBo bo);
 }

+ 15 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/service/ITopInstSettleService.java

@@ -3,9 +3,7 @@ package com.zhongzheng.modules.top.settle.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.top.settle.bo.*;
 import com.zhongzheng.modules.top.settle.domian.TopInstSettle;
-import com.zhongzheng.modules.top.settle.vo.SettleOrderImportVo;
-import com.zhongzheng.modules.top.settle.vo.SettleVo;
-import com.zhongzheng.modules.top.settle.vo.TopOrderInfoVo;
+import com.zhongzheng.modules.top.settle.vo.*;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -23,4 +21,18 @@ public interface ITopInstSettleService extends IService<TopInstSettle> {
     boolean timeSettleOrderSave(TimeSettleBo bo);
 
     List<SettleVo> getSettleList(SettleQueryBo bo);
+
+    TimeSettleDetailVo getTimeSettleDetail(Long settleId);
+
+    NumSettleDetailVo getNumSettleDetail(Long settleId);
+
+    boolean updateTimeSettle(TimeSettleBo bo);
+
+    boolean updateNumSettle(NumSettleBo bo);
+
+    boolean batchSubmitCheck(List<Long> settleIds, Long userId, String userName);
+
+    boolean batchDeleteSettle(List<Long> settleIds);
+
+    boolean checkSettle(CheckSettleBo bo);
 }

+ 297 - 10
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/service/impl/ITopInstSettleServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
@@ -28,17 +29,19 @@ import com.zhongzheng.modules.top.settle.domian.TopInstSettleRelaiton;
 import com.zhongzheng.modules.top.settle.mapper.TopInstSettleMapper;
 import com.zhongzheng.modules.top.settle.service.ITopInstSettleRelationService;
 import com.zhongzheng.modules.top.settle.service.ITopInstSettleService;
-import com.zhongzheng.modules.top.settle.vo.SettleOrderImportVo;
-import com.zhongzheng.modules.top.settle.vo.SettleVo;
-import com.zhongzheng.modules.top.settle.vo.TopOrderInfoVo;
-import com.zhongzheng.modules.top.settle.vo.TopOrderStudyInfoVo;
+import com.zhongzheng.modules.top.settle.vo.*;
+import com.zhongzheng.modules.top.system.domain.TopInstCategory;
+import com.zhongzheng.modules.top.system.domain.TopInstitution;
+import com.zhongzheng.modules.top.system.service.ITopInstCategoryService;
+import com.zhongzheng.modules.top.system.service.ITopInstitutionService;
 import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
+import com.zhongzheng.modules.top.user.service.ITopSysRoleService;
 import com.zhongzheng.modules.top.user.service.ITopSysUserRoleService;
-import com.zhongzheng.modules.top.user.service.ITopSysUserService;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -84,6 +87,12 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
     private ITopOldOrderCheckLogService topOldOrderCheckLogService;
     @Autowired
     private ITopSysUserRoleService topSysUserRoleService;
+    @Autowired
+    private ITopSysRoleService topSysRoleService;
+    @Autowired
+    private ITopInstitutionService topInstitutionService;
+    @Autowired
+    private ITopInstCategoryService topInstCategoryService;
 
 
     @Override
@@ -329,6 +338,7 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean numSettleOrderSave(NumSettleBo bo) {
         //结算信息
         TopInstSettle entity = BeanUtil.toBean(bo, TopInstSettle.class);
@@ -385,7 +395,6 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
             if (userRoles.stream().anyMatch(x -> x.getRoleId().equals(orderCheck.getCheckRole())) && orderCheck.getCheckType() == 7){
                 //创建人包含审核角色(跳过审核)
                 checkLog.setCheckStatus(1);
-                checkLog.setCheckReason("系统自动审核");
                 checkLog.setCheckTime(DateUtils.getNowTime());
                 checkLog.setCheckUsername(loginName);
             }else {
@@ -400,21 +409,23 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
         checkLog.setCheckSign(1);
         topOldOrderCheckLogService.updateById(checkLog);
         //订单审核状态
-        Integer checkStatus = 2;//待审核
+        Integer checkStatus = 1;//待审核
         for (TopOldOrderCheckLog item : checkLogList) {
             if (item.getId().equals(checkLog.getId()) && item.getType() == 7 && item.getCheckSort() > 1){
-                checkStatus = 3;//审核中
+                checkStatus = 2;//审核中
             }
             if (item.getId().equals(checkLog.getId()) && item.getType() == 8 ){
-                checkStatus = 5;//待支付
+                checkStatus = 4;//待支付
             }
         }
         update(new LambdaUpdateWrapper<TopInstSettle>()
         .set(TopInstSettle::getCheckStatus,checkStatus)
+        .set(TopInstSettle::getStatus,1)
         .eq(TopInstSettle::getSettleSn,settleSn));
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean timeSettleOrderSave(TimeSettleBo bo) {
         //结算信息
         TopInstSettle entity = BeanUtil.toBean(bo, TopInstSettle.class);
@@ -422,6 +433,7 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
         entity.setStatus(bo.getStatus());
         entity.setCreateTime(DateUtils.getNowTime());
         entity.setUpdateTime(DateUtils.getNowTime());
+        entity.setCheckStatus(1);
         save(entity);
         if (bo.getStatus() == 1){
             //提交审核
@@ -432,8 +444,283 @@ public class ITopInstSettleServiceImpl extends ServiceImpl<TopInstSettleMapper,
 
     @Override
     public List<SettleVo> getSettleList(SettleQueryBo bo) {
+        if (ObjectUtil.isNotNull(bo.getCheckStatus())
+            && (bo.getCheckStatus() == 2 || bo.getCheckStatus() == 7) && !bo.getLoginName().equals("admin")){
+            List<TopSysUserRole> roleList = topSysUserRoleService.list(new LambdaQueryWrapper<TopSysUserRole>().eq(TopSysUserRole::getUserId, bo.getLoginId()));
+            if (CollectionUtils.isNotEmpty(roleList)){
+                bo.setRoleIds(roleList.stream().map(TopSysUserRole::getRoleId).collect(Collectors.toList()));
+            }
+        }
+        List<SettleVo> settleVos = baseMapper.getSettleList(bo);
+        if (CollectionUtils.isEmpty(settleVos)){
+            return new ArrayList<>();
+        }
+        //审核角色和审核时间
+        settleVos.forEach(item -> {
+            TopOldOrderCheckLog checkLog = topOldOrderCheckLogService
+                    .getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                    .eq(TopOldOrderCheckLog::getOrderSn, item.getSettleSn())
+                    .eq(TopOldOrderCheckLog::getCheckSign, 1)
+                    .eq(TopOldOrderCheckLog::getCheckFrom, 4)
+                    .eq(TopOldOrderCheckLog::getStatus, 1));
+            if (ObjectUtils.isNotNull(checkLog)){
+                TopSysRole role = topSysRoleService.getById(checkLog.getRoleId());
+                item.setCheckRole(role.getRoleName());
+                if (ObjectUtils.isNotNull(checkLog.getCheckTime())){
+                    item.setCheckTime(checkLog.getCheckTime());
+                }else if (checkLog.getCheckSort() > 1){
+                    TopOldOrderCheckLog checkLogTwo = topOldOrderCheckLogService
+                                    .getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                                    .eq(TopOldOrderCheckLog::getOrderSn, item.getSettleSn())
+                                    .eq(TopOldOrderCheckLog::getCheckSort, checkLog.getCheckSort() -1)
+                                    .eq(TopOldOrderCheckLog::getCheckFrom, 4)
+                                    .eq(TopOldOrderCheckLog::getStatus, 1));
+                    if (ObjectUtil.isNotNull(checkLogTwo)){
+                        item.setCheckTime(checkLogTwo.getCheckTime());
+                    }
+                }
+            }
+        });
+        return settleVos;
+    }
+
+    @Override
+    public TimeSettleDetailVo getTimeSettleDetail(Long settleId) {
+        TopInstSettle instSettle = getById(settleId);
+        if (ObjectUtil.isNull(instSettle)){
+            throw new CustomException("数据不存在!");
+        }
+        TimeSettleDetailVo detailVo = BeanUtil.toBean(instSettle, TimeSettleDetailVo.class);
+        //供应商信息
+        TopInstitution institution = topInstitutionService.getById(detailVo.getInstId());
+        detailVo.setInstName(institution.getInstName());
+        detailVo.setBankAccount(institution.getBankAccount());
+        detailVo.setBankName(institution.getBankName());
+        detailVo.setBank(institution.getBank());
+
+        TopInstCategory category = topInstCategoryService.getById(detailVo.getCostCatId());
+        detailVo.setCostCatName(category.getCategoryName());
+
+        //业务层次
+        TopCourseEducationType educationType = topCourseEducationTypeService.getById(detailVo.getEducationTypeId());
+        TopCourseProjectType projectType = topCourseProjectTypeService.getById(detailVo.getProjectId());
+        TopCourseBusiness business = topCourseBusinessService.getById(detailVo.getBusinessId());
+        detailVo.setEducationName(educationType.getEducationName());
+        detailVo.setBusinessName(business.getBusinessName()+projectType.getProjectName());
+
+        //审核意见
+        TopOldOrderCheckLog checkLog = topOldOrderCheckLogService
+                .getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                .eq(TopOldOrderCheckLog::getOrderSn, detailVo.getSettleSn())
+                .isNotNull(TopOldOrderCheckLog::getCheckReason)
+                .orderByDesc(TopOldOrderCheckLog::getCheckSort)
+                .last("limit 1"));
+        if (ObjectUtils.isNotNull(checkLog)){
+            detailVo.setCheckReason(checkLog.getCheckReason());
+        }
+        return detailVo;
+    }
+
+    @Override
+    public NumSettleDetailVo getNumSettleDetail(Long settleId) {
+        TopInstSettle instSettle = getById(settleId);
+        if (ObjectUtil.isNull(instSettle)){
+            throw new CustomException("数据不存在!");
+        }
+        NumSettleDetailVo detailVo = BeanUtil.toBean(instSettle, NumSettleDetailVo.class);
+        //供应商信息
+        TopInstitution institution = topInstitutionService.getById(detailVo.getInstId());
+        detailVo.setInstName(institution.getInstName());
+        detailVo.setBankAccount(institution.getBankAccount());
+        detailVo.setBankName(institution.getBankName());
+        detailVo.setBank(institution.getBank());
+
+        TopInstCategory category = topInstCategoryService.getById(detailVo.getCostCatId());
+        detailVo.setCostCatName(category.getCategoryName());
+
+        //业务层次
+        TopCourseEducationType educationType = topCourseEducationTypeService.getById(detailVo.getEducationTypeId());
+        TopCourseProjectType projectType = topCourseProjectTypeService.getById(detailVo.getProjectId());
+        TopCourseBusiness business = topCourseBusinessService.getById(detailVo.getBusinessId());
+        detailVo.setEducationName(educationType.getEducationName());
+        detailVo.setBusinessName(business.getBusinessName()+projectType.getProjectName());
 
-        return null;
+        //审核意见
+        TopOldOrderCheckLog checkLog = topOldOrderCheckLogService
+                .getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                        .eq(TopOldOrderCheckLog::getOrderSn, detailVo.getSettleSn())
+                        .isNotNull(TopOldOrderCheckLog::getCheckReason)
+                        .orderByDesc(TopOldOrderCheckLog::getCheckSort)
+                        .last("limit 1"));
+        if (ObjectUtils.isNotNull(checkLog)){
+            detailVo.setCheckReason(checkLog.getCheckReason());
+        }
+
+        //结算订单
+        List<TopInstSettleRelaiton> relaitonList = topInstSettleRelationService
+                .list(new LambdaQueryWrapper<TopInstSettleRelaiton>()
+                .eq(TopInstSettleRelaiton::getSettleId, instSettle.getSettleId())
+                .eq(TopInstSettleRelaiton::getStatus, 1));
+        if (CollectionUtils.isNotEmpty(relaitonList)){
+            List<NumSettleOrderVo> collect = relaitonList.stream().map(item -> {
+                NumSettleOrderVo orderVo = new NumSettleOrderVo();
+                orderVo.setSettleId(item.getSettleId());
+                orderVo.setOrderSn(item.getOrderSn());
+                orderVo.setSubmitDataTime(item.getSubmitDataTime());
+                orderVo.setSettleMoney(item.getSettleMoney());
+                if (item.getOrderFrom() == 1) {
+                    Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, item.getOrderSn()));
+                    User user = userService.getById(order.getUserId());
+                    orderVo.setUserName(user.getRealname());
+                    orderVo.setUserCard(EncryptHandler.decrypt(user.getIdCard()));
+                } else {
+                    TopOldOrder oldOrder = topOldOrderService.getOne(new LambdaQueryWrapper<TopOldOrder>().eq(TopOldOrder::getOrderSn, item.getOrderSn()));
+                    orderVo.setCreateNo(oldOrder.getCreateNo());
+                    orderVo.setCreateUsername(oldOrder.getCreateUsername());
+                    orderVo.setClientName(oldOrder.getPurchaseOrg());
+                    TopOldOrderGoods orderGoods = topOldOrderGoodsService.getById(item.getOrderGoodsId());
+                    orderVo.setUserName(orderGoods.getUserName());
+                    orderVo.setUserCard(EncryptHandler.decrypt(orderGoods.getUserCard()));
+                }
+                return orderVo;
+            }).collect(Collectors.toList());
+            detailVo.setSettleOrderVos(collect);
+            detailVo.setSettleOrderNum(collect.size());
+        }
+
+        return detailVo;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateTimeSettle(TimeSettleBo bo) {
+        //修改校验
+        updateSettleCheck(bo.getSettleId(),bo.getLoginId(),bo.getLoginName());
+        TopInstSettle entity = BeanUtil.toBean(bo, TopInstSettle.class);
+        entity.setStatus(bo.getStatus());
+        entity.setUpdateTime(DateUtils.getNowTime());
+        updateById(entity);
+        if (bo.getStatus() == 1){
+            //提交审核
+            createCheckLog(entity.getSettleSn(),bo.getLoginId(),bo.getLoginName());
+        }
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateNumSettle(NumSettleBo bo) {
+        //修改校验
+        updateSettleCheck(bo.getSettleId(),bo.getLoginId(),bo.getLoginName());
+        TopInstSettle entity = BeanUtil.toBean(bo, TopInstSettle.class);
+        entity.setStatus(bo.getStatus());
+        entity.setUpdateTime(DateUtils.getNowTime());
+        updateById(entity);
+        //删除重新添加结算订单信息
+        topInstSettleRelationService.remove(new LambdaQueryWrapper<TopInstSettleRelaiton>()
+        .eq(TopInstSettleRelaiton::getSettleId,entity.getSettleId()));
+        if (CollectionUtils.isNotEmpty(bo.getSettleOrders())){
+            List<TopInstSettleRelaiton> relaitonList = bo.getSettleOrders().stream().map(item -> {
+                TopInstSettleRelaiton relaiton = BeanUtil.toBean(item, TopInstSettleRelaiton.class);
+                relaiton.setSettleId(entity.getSettleId());
+                relaiton.setCreateTime(DateUtils.getNowTime());
+                relaiton.setUpdateTime(DateUtils.getNowTime());
+                relaiton.setStatus(1);
+                return relaiton;
+            }).collect(Collectors.toList());
+            topInstSettleRelationService.saveBatch(relaitonList);
+        }
+        if (bo.getStatus() == 1){
+            //提交审核
+            createCheckLog(entity.getSettleSn(),bo.getLoginId(),bo.getLoginName());
+        }
+        return false;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean batchSubmitCheck(List<Long> settleIds, Long userId, String userName) {
+        for (Long settleId : settleIds) {
+            TopInstSettle settle = getById(settleId);
+            if (settle.getCheckStatus() != 1 ){
+                throw new CustomException(String.format("结算单【%s】已提交审核,无需重复提交!",settle.getTitle()));
+            }
+            //提交审核
+            createCheckLog(settle.getSettleSn(),userId,userName);
+        }
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean batchDeleteSettle(List<Long> settleIds) {
+        for (Long settleId : settleIds) {
+            TopInstSettle settle = getById(settleId);
+            if (settle.getCheckStatus() != 1 ){
+                throw new CustomException(String.format("结算单【%s】已提交审核,请勿删除!",settle.getTitle()));
+            }
+            settle.setStatus(-1);
+            updateById(settle);
+            List<TopInstSettleRelaiton> relaitonList = topInstSettleRelationService
+                    .list(new LambdaQueryWrapper<TopInstSettleRelaiton>()
+                    .eq(TopInstSettleRelaiton::getSettleId, settle.getSettleId())
+                    .eq(TopInstSettleRelaiton::getStatus, 1));
+            if (CollectionUtils.isNotEmpty(relaitonList)){
+                relaitonList.forEach(x -> x.setStatus(-1));
+                topInstSettleRelationService.updateBatchById(relaitonList);
+            }
+
+        }
+        return false;
+    }
+
+    @Override
+    public boolean checkSettle(CheckSettleBo bo) {
+        //审核校验
+        TopInstSettle settle = getById(bo.getSettleId());
+        if (settle.getCheckStatus() != 2){
+            throw new CustomException("结算单不在审核流程中,请检查!");
+        }
+        //获取当前审核节点
+        TopOldOrderCheckLog checkLog = topOldOrderCheckLogService
+                .getOne(new LambdaQueryWrapper<TopOldOrderCheckLog>()
+                .eq(TopOldOrderCheckLog::getOrderSn, settle.getSettleSn())
+                .eq(TopOldOrderCheckLog::getCheckSign, 1)
+                .eq(TopOldOrderCheckLog::getStatus, 1)
+                .eq(TopOldOrderCheckLog::getCheckFrom, 4));
+        if (ObjectUtils.isEmpty(checkLog)){
+            throw new CustomException("结算单审核节点有误,请联系管理员!");
+        }
+        List<TopSysUserRole> roleList = topSysUserRoleService
+                .list(new LambdaQueryWrapper<TopSysUserRole>().eq(TopSysUserRole::getUserId, bo.getLoginId()));
+        if (CollectionUtils.isEmpty(roleList) && !"admin".equals(bo.getLoginName())){
+            throw new CustomException("当前账号没有审核权限!");
+        }
+        List<Long> roleIds = roleList.stream().map(TopSysUserRole::getRoleId).collect(Collectors.toList());
+        if (roleIds.stream().noneMatch(x -> x.equals(checkLog.getRoleId())) && !"admin".equals(bo.getLoginName())){
+            throw new CustomException("当前账号没有审核权限!");
+        }
+        switch (bo.getCheckResult()){
+            case 1://审核通过
+
+
+        }
+        return false;
+    }
+
+
+
+    private void updateSettleCheck(Long settleId, Long loginId,String loginName) {
+        TopInstSettle settle = getById(settleId);
+        if (ObjectUtils.isNull(settle)){
+            throw new CustomException("数据不存在!");
+        }
+        if (settle.getCheckStatus() != 1){
+            throw new CustomException("该结算单已进入审核流程,请勿修改!");
+        }
+        if (!"admin".equals(loginName) && !settle.getCreateUserId().equals(loginId)){
+            throw new CustomException("该结算单不是当前账号创建,请勿修改!");
+        }
     }
 
     //结算订单导入校验

+ 82 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/NumSettleDetailVo.java

@@ -0,0 +1,82 @@
+package com.zhongzheng.modules.top.settle.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2023年07月26日 11:45
+ */
+@Data
+@ApiModel("时间结算详情")
+public class NumSettleDetailVo implements Serializable {
+
+    private Long settleId;
+
+    private String settleSn;
+
+    @ApiModelProperty("标题")
+    private String title;
+
+    @ApiModelProperty("结算方式:1数量 2时间")
+    private Integer settleType;
+
+    @ApiModelProperty("供应商ID")
+    private Long instId;
+
+    @ApiModelProperty("供应商成本分类id")
+    private Long costCatId;
+
+    @ApiModelProperty("教育类型")
+    private Long educationTypeId;
+
+    @ApiModelProperty("业务层次")
+    private Long businessId;
+
+    @ApiModelProperty("项目ID")
+    private Long projectId;
+
+    @ApiModelProperty("供应商ID")
+    private String instName;
+
+    @ApiModelProperty("开户名")
+    private String bankName;
+
+    @ApiModelProperty("开户行")
+    private String bank;
+
+    @ApiModelProperty("开户账号")
+    private String bankAccount;
+
+    @ApiModelProperty("供应商成本分类id")
+    private String costCatName;
+
+    @ApiModelProperty("教育类型")
+    private String educationName;
+
+    @ApiModelProperty("业务层次")
+    private String businessName;
+
+    @ApiModelProperty("结算金额")
+    private BigDecimal settleMoney;
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+    @ApiModelProperty("审核状态:1待提交 2审核中 3未通过 4待支付 5支付失败 6已结算")
+    private Integer checkStatus;
+
+    @ApiModelProperty("审核意见")
+    private String checkReason;
+
+    @ApiModelProperty("结算数量")
+    private Integer settleOrderNum;
+
+    @ApiModelProperty("订单信息")
+    public List<NumSettleOrderVo> settleOrderVos;
+}

+ 49 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/NumSettleOrderVo.java

@@ -0,0 +1,49 @@
+package com.zhongzheng.modules.top.settle.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author yangdamao
+ * @date 2023年07月25日 9:31
+ */
+@Data
+@ApiModel("结算订单导入对象")
+public class NumSettleOrderVo implements Serializable {
+
+    private Long settleId;
+
+    @ApiModelProperty("订单号")
+    private String orderSn;
+
+    @ApiModelProperty("订单来源 1新系统C端订单,2旧系统C端订单,3旧系统B端订单 ")
+    private Integer orderFrom;
+
+    @ApiModelProperty("业务号")
+    private String createNo;
+
+    @ApiModelProperty("业务员名称")
+    private String createUsername;
+
+    @ApiModelProperty("客户名称")
+    private String clientName;
+
+    @ApiModelProperty("身份证号")
+    private String userCard;
+
+    @ApiModelProperty("学员姓名")
+    private String userName;
+
+    @ApiModelProperty("提交资料日期")
+    private Long submitDataTime;
+
+    @ApiModelProperty("结算金额")
+    private BigDecimal settleMoney;
+
+    @ApiModelProperty("订单商品ID")
+    private Long orderGoodsId;
+}

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/SettleVo.java

@@ -17,7 +17,9 @@ import java.util.List;
 @ApiModel("结算列表")
 public class SettleVo implements Serializable {
 
-    private Long id;
+    private Long settleId;
+
+    private String settleSn;
 
     @ApiModelProperty("标题")
     private String title;
@@ -40,6 +42,9 @@ public class SettleVo implements Serializable {
     @ApiModelProperty("开户账号")
     private String bankAccount;
 
+    @ApiModelProperty("教育类型")
+    private String educationName;
+
     @ApiModelProperty("业务层次")
     private String businessName;
 

+ 84 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/settle/vo/TimeSettleDetailVo.java

@@ -0,0 +1,84 @@
+package com.zhongzheng.modules.top.settle.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author yangdamao
+ * @date 2023年07月26日 11:45
+ */
+@Data
+@ApiModel("时间结算详情")
+public class TimeSettleDetailVo implements Serializable {
+
+    private Long settleId;
+
+    private String settleSn;
+
+    @ApiModelProperty("标题")
+    private String title;
+
+    @ApiModelProperty("结算方式:1数量 2时间")
+    private Integer settleType;
+
+    @ApiModelProperty("供应商ID")
+    private Long instId;
+
+    @ApiModelProperty("供应商成本分类id")
+    private Long costCatId;
+
+    @ApiModelProperty("教育类型")
+    private Long educationTypeId;
+
+    @ApiModelProperty("业务层次")
+    private Long businessId;
+
+    @ApiModelProperty("项目ID")
+    private Long projectId;
+
+    @ApiModelProperty("供应商ID")
+    private String instName;
+
+    @ApiModelProperty("开户名")
+    private String bankName;
+
+    @ApiModelProperty("开户行")
+    private String bank;
+
+    @ApiModelProperty("开户账号")
+    private String bankAccount;
+
+    @ApiModelProperty("供应商成本分类id")
+    private String costCatName;
+
+    @ApiModelProperty("教育类型")
+    private String educationName;
+
+    @ApiModelProperty("业务层次")
+    private String businessName;
+
+    @ApiModelProperty("结算金额")
+    private BigDecimal settleMoney;
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+    @ApiModelProperty("签约开始时间")
+    private Long signStartTime;
+
+    @ApiModelProperty("签约结束时间")
+    private Long signEndTime;
+
+    @ApiModelProperty("结算订单类型:1全部 2代运营订单 3独立订单")
+    private Integer settleOrderType;
+
+    @ApiModelProperty("审核状态:1待提交 2审核中 3未通过 4待支付 5支付失败 6已结算")
+    private Integer checkStatus;
+
+    @ApiModelProperty("审核意见")
+    private String checkReason;
+}

+ 65 - 0
zhongzheng-system/src/main/resources/mapper/modules/settle/ExamActivityMapper.xml

@@ -45,4 +45,69 @@
     <select id="getOrderGoodsByBusiness" parameterType="map" resultType="java.lang.Long">
         SELECT order_goods_id FROM v_top_order_business WHERE order_sn = #{orderSn} AND INSTR(business_full_name,#{tpBusinessName})
     </select>
+
+    <select id="getSettleList" parameterType="com.zhongzheng.modules.top.settle.bo.SettleQueryBo" resultType="com.zhongzheng.modules.top.settle.vo.SettleVo">
+        SELECT
+            tis.settle_id,
+            tis.settle_sn,
+            tis.create_time,
+            tis.title,
+            tis.remark,
+            tis.settle_type,
+            tis.education_type_id,
+            tis.project_id,
+            tis.business_id,
+            tis.settle_money,
+            tis.inst_id,
+            ti.inst_name,
+            ti.bank_name,
+            ti.bank_name,
+            ti.bank_account,
+            tis.check_status,
+            tis.`status`,
+            cet.education_name,
+            CONCAT(cb.business_name,cpt.project_name) AS business_name
+        FROM
+            top_inst_settle tis
+            LEFT JOIN top_course_education_type cet ON tis.education_type_id = cet.id
+            LEFT JOIN top_course_project_type cpt ON tis.project_id = cpt.id
+            LEFT JOIN top_course_business cb ON tis.business_id = cb.id
+            LEFT JOIN top_institution ti ON tis.inst_id = ti.inst_id
+            LEFT JOIN top_inst_category tic ON tis.cost_cat_id = tic.cost_cat_id
+        WHERE
+            tis.`status` != - 1
+            <if test="settleType != null and settleType != ''">
+                AND tis.settle_type = #{settleType}
+            </if>
+            <if test="costCatId != null and costCatId != ''">
+                AND tis.cost_cat_id = #{costCatId}
+            </if>
+            <if test="educationTypeId != null and educationTypeId != ''">
+                AND tis.education_type_id = #{educationTypeId}
+            </if>
+            <if test="businessId != null and businessId != ''">
+                AND tis.business_id = #{businessId}
+            </if>
+            <if test="checkStatus != null and checkStatus != ''and checkStatus == 7">
+                AND tis.check_status = 2
+                AND ((SELECT tcl.role_id FROM top_old_order_check_log tcl
+                WHERE tis.settle_sn = tcl.order_sn AND tcl.check_sign = 1 AND tcl.`status` = 1 LIMIT 1) IN
+                <foreach collection="roleIds" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>)
+            </if>
+            <if test="checkStatus != null and checkStatus != '' and checkStatus != 7">
+                AND tis.check_status = #{checkStatus}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND tis.create_time &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND tis.create_time &lt;= #{endTime}
+            </if>
+            <if test="title != null and title != ''">
+                AND tis.title LIKE concat('%', #{title}, '%')
+            </if>
+            ORDER BY tis.create_time DESC
+    </select>
 </mapper>