yangdamao 5 روز پیش
والد
کامیت
2690aabd9d

+ 5 - 6
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -1283,12 +1283,11 @@ public class WxLoginService implements IWxLoginService {
     @Override
     public Map<String, String> questionGzh_login(WxLoginBody loginBody) {
         initData();
-//        String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
-//        String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
-//        //解析json
-//        JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
-//        String openId = String.valueOf(jsonObject.get("openid"));
-        String openId = "openId123";
+        String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
+        String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
+        //解析json
+        JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
+        String openId = String.valueOf(jsonObject.get("openid"));
         User user = iUserService.queryByOpenId(openId);;
         Map<String, String> map = new HashMap<>();
         if (user == null) {

+ 15 - 0
zhongzheng-question-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -11,6 +11,7 @@ import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.poi.EasyPoiUtil;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
+import com.zhongzheng.modules.bank.bo.QuestionExportBo;
 import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.bank.vo.QuestionAnswerVo;
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
@@ -458,4 +459,18 @@ public class GoodsController extends BaseController {
         ExcelUtil<QuestionAnswerVo> util = new ExcelUtil<QuestionAnswerVo>(QuestionAnswerVo.class);
         return util.exportExcel(list, major);
     }
+
+
+    /**
+     * 题库数据导入
+     */
+    @ApiOperation("题库数据导入")
+    @PostMapping("/question/export")
+    public AjaxResult<Void> questionExport(MultipartFile file,String majorName) {
+        List<QuestionExportBo> boList = EasyPoiUtil.importExcel(file,0,1, QuestionExportBo.class);
+        if (CollectionUtils.isEmpty(boList)){
+            throw new CustomException("导入文件格式不正确或文件为空,请检查文件!");
+        }
+        return toAjax(iGoodsService.questionExport(boList,majorName) ? 1 : 0);
+    }
 }

+ 55 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionExportBo.java

@@ -0,0 +1,55 @@
+package com.zhongzheng.modules.bank.bo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 题库题目对象 question
+ *
+ * @author hjl
+ * @date 2021-10-22
+ */
+@Data
+public class QuestionExportBo implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** 题目正文 */
+    @Excel(name = "content")
+    private String content;
+    /** 类型 1单选 2多选 3判断题 4简答题 5案列题 */
+    @Excel(name = "type")
+    private String type;
+    /** 答案  判断题1正确 0错误; 单选为数字; 多选数字用,拼接; 从1坐标开始; */
+    @Excel(name = "answer_question")
+    private String answerQuestion;
+    /** 解析文本 */
+    @Excel(name = "analysis_content")
+    private String analysisContent;
+    /** 图片地址,多个,拼接 */
+    @Excel(name = "img_url")
+    private String imgUrl;
+    /** 问题内容 */
+    @Excel(name = "json_str")
+    private String jsonStr;
+    /** 前缀名称 */
+    @Excel(name = "prefix_name")
+    private String prefixName;
+    /** 知识点id用,拼接 */
+    @Excel(name = "knowledge_ids")
+    private String knowledgeIds;
+    /** 发布状态 1发布 0未发布 */
+    @Excel(name = "publish_status")
+    private String publishStatus;
+    /** 编码 */
+    @Excel(name = "code")
+    private String code;
+}

+ 0 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -727,7 +727,6 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
 
     @Override
     public Map<String, Object> importExcelQuestionV2NotInBank(List<QuestionImportV2> questionList, Boolean isUpdateSupport, String operName) {
-        System.out.println(questionList);
         Map<String, Object> map = new HashMap<>();
         if (Validator.isNull(questionList) || questionList.size() == 0) {
             throw new CustomException("导入数据不能为空!");
@@ -940,7 +939,6 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
 
     @Override
     public Map<String, Object> importExcelQuestionV3NotInBankFromOld(List<QuestionImportV3> questionList, Boolean isUpdateSupport, String operName) {
-        System.out.println(questionList);
         Map<String, Object> map = new HashMap<>();
         if (Validator.isNull(questionList) || questionList.size() == 0) {
             throw new CustomException("导入数据不能为空!");

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.goods.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.bank.bo.QuestionExportBo;
 import com.zhongzheng.modules.bank.vo.QuestionAnswerVo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.bo.ExternalQuestionBo;
@@ -187,4 +188,7 @@ public interface IGoodsService extends IService<Goods> {
     List<QuestionAnswerVo> getQuestionAnswer(Long goodsId);
 
     void getImageWord(MultipartFile file, String major);
+
+    boolean questionExport(List<QuestionExportBo> boList, String majorName);
+
 }

+ 174 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -32,6 +32,7 @@ import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
 import com.zhongzheng.modules.activity.service.IActivityGoodsPriceService;
 import com.zhongzheng.modules.alioss.service.OssService;
+import com.zhongzheng.modules.bank.bo.QuestionExportBo;
 import com.zhongzheng.modules.bank.domain.*;
 import com.zhongzheng.modules.bank.mapper.QuestionMapper;
 import com.zhongzheng.modules.bank.service.*;
@@ -119,8 +120,11 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Function;
+import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -6029,6 +6033,176 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean questionExport(List<QuestionExportBo> boList, String majorName) {
+        List<QuestionExportBo> collect = boList.stream().filter(distinctByKey(p -> p.getContent()))
+                .collect(Collectors.toList());
+
+        Map<String, List<QuestionExportBo>> map = collect.stream().collect(Collectors.groupingBy(QuestionExportBo::getType));
+
+        if (CollectionUtils.isEmpty(map)){
+            return false;
+        }
+
+        //业务层次
+        //题库业务层次
+        CourseEducationType educationType = iCourseEducationTypeService
+                .getOne(new LambdaQueryWrapper<CourseEducationType>().eq(CourseEducationType::getEducationName, "考前培训").eq(CourseEducationType::getStatus, 1).last("limit 1"));
+        Long eduId = educationType.getId();
+        CourseProjectType projectType = iCourseProjectTypeService
+                .getOne(new LambdaQueryWrapper<CourseProjectType>().eq(CourseProjectType::getProjectName, "施工现场专业人员").eq(CourseProjectType::getEducationId, eduId).eq(CourseProjectType::getStatus, 1).last("limit 1"));
+        Long proId = projectType.getId();
+        CourseBusiness business = iCourseBusinessService
+                .getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getBusinessName, "七大员").eq(CourseBusiness::getProjectId, proId).eq(CourseBusiness::getStatus, 1).last("limit 1"));
+        Long businessId = business.getId();
+        List<CourseSubjectProject> list = iCourseSubjectProjectService.list(new LambdaQueryWrapper<CourseSubjectProject>().eq(CourseSubjectProject::getProjectId, proId));
+        List<Long> subIds = list.stream().map(CourseSubjectProject::getSubjectId).collect(Collectors.toList());
+        CourseSubject courseSubject = iCourseSubjectService.getOne(new LambdaQueryWrapper<CourseSubject>().in(CourseSubject::getId, subIds).eq(CourseSubject::getSubjectName, majorName).last("limit 1"));
+        Long subId = courseSubject.getId();
+
+        int count = 4;//切分的分数
+
+        List<List<QuestionExportBo>> danxuan = new ArrayList<>();
+        List<List<QuestionExportBo>> duoxuan = new ArrayList<>();
+        List<List<QuestionExportBo>> pandan = new ArrayList<>();
+        List<List<QuestionExportBo>> anli = new ArrayList<>();
+        map.forEach((k,v) ->{
+            List<List<QuestionExportBo>> lists = splitList(v, count);
+            switch (k){
+                case "1": danxuan.addAll(lists);
+                    break;
+                case "2": duoxuan.addAll(lists);
+                    break;
+                case "3": pandan.addAll(lists);
+                    break;
+                case "4": anli.addAll(lists);
+                    break;
+                default:
+                    break;
+            }
+
+        });
+
+
+        for (int i = 0; i < 4; i++) {
+            //创建试卷
+            //新增
+            Exam exam2 = new Exam();
+            exam2.setExamName(String.format("(%s)试卷%s",majorName,i+1));
+            exam2.setCode(ServletUtils.getEncoded("SJ"));
+            exam2.setCreateTime(DateUtils.getNowTime());
+            exam2.setUpdateTime(DateUtils.getNowTime());
+            exam2.setPrefixName(String.format("外部系统拉取试卷(%s)",DateUtils.getDate()));
+            exam2.setPublishStatus(1L);
+            exam2.setYear(2026L);
+            exam2.setStatus(1);
+            exam2.setDoType(1);
+            //试卷类型ID
+            ExamPaper paper = iExamPaperService.getOne(new LambdaUpdateWrapper<ExamPaper>().eq(ExamPaper::getStatus, 1).eq(ExamPaper::getPaperName, "模拟考试").last("limit 1"));
+            exam2.setExamPaperId(paper.getPaperId());
+            iExamService.save(exam2);
+            //业务乘次
+            QuestionBusiness questionBusiness = new QuestionBusiness();
+            questionBusiness.setEducationTypeId(eduId);
+            questionBusiness.setProjectId(proId);
+            questionBusiness.setBusinessId(businessId);
+            questionBusiness.setSubjectId(subId);
+            questionBusiness.setType(2);
+            questionBusiness.setMajorId(exam2.getExamId());
+            iQuestionBusinessService.save(questionBusiness);
+            Long examId = exam2.getExamId();
+
+            List<QuestionExportBo> all = new ArrayList<>();
+            List<QuestionExportBo> duanxuanList = danxuan.get(i);
+            all.addAll(duanxuanList);
+            List<QuestionExportBo> duoxuanList = duoxuan.get(i);
+            all.addAll(duoxuanList);
+            List<QuestionExportBo> pandanList = pandan.get(i);
+            all.addAll(pandanList);
+            List<QuestionExportBo> anliList = anli.get(i);
+            all.addAll(anliList);
+
+            all.forEach(item -> {
+                Question question = BeanUtil.toBean(item, Question.class);
+                question.setStatus(1);
+                question.setFromPlat(1);
+                question.setCreateTime(DateUtils.getNowTime());
+                question.setUpdateTime(DateUtils.getNowTime());
+                iQuestionService.save(question);
+                QuestionBusiness questionBusiness2 = new QuestionBusiness();
+                questionBusiness2.setEducationTypeId(eduId);
+                questionBusiness2.setProjectId(proId);
+                questionBusiness2.setBusinessId(businessId);
+                questionBusiness2.setSubjectId(subId);
+                questionBusiness2.setType(1);
+                questionBusiness2.setMajorId(question.getQuestionId());
+                iQuestionBusinessService.save(questionBusiness2);
+                saveExamQuestion(question.getQuestionId(),examId);
+
+            });
+        }
+
+
+
+        return true;
+    }
+
+    private void saveExamQuestion(Long questionId,Long examId){
+        ExamQuestion examQuestion = new ExamQuestion();
+        examQuestion.setExamId(examId);
+        examQuestion.setQuestionId(questionId);
+        //获取最新排序
+        Integer sort = 0;
+        ExamQuestion one = iExamQuestionService.getOne(new LambdaUpdateWrapper<ExamQuestion>().eq(ExamQuestion::getExamId, examId).orderByDesc(ExamQuestion::getSort).last("limit 1"));
+        if (ObjectUtils.isNotNull(one)){
+            sort = one.getSort() +1;
+        }
+        examQuestion.setSort(sort);
+        iExamQuestionService.save(examQuestion);
+    }
+
+
+
+    /**
+     * 将单个List尽量平均地切分成parts份
+     */
+    private static <T> List<List<T>> splitList(List<T> list, int parts) {
+        if (list == null || list.isEmpty()) {
+            List<List<T>> emptyParts = new ArrayList<>();
+            for (int i = 0; i < parts; i++) {
+                emptyParts.add(new ArrayList<>());
+            }
+            return emptyParts;
+        }
+
+        int totalSize = list.size();
+        int baseSize = totalSize / parts;
+        int remainder = totalSize % parts;
+
+        List<List<T>> result = new ArrayList<>();
+        int start = 0;
+
+        for (int i = 0; i < parts; i++) {
+            int currentSize = baseSize + (i < remainder ? 1 : 0);
+            if (currentSize > 0 && start < totalSize) {
+                int end = Math.min(start + currentSize, totalSize);
+                result.add(new ArrayList<>(list.subList(start, end)));
+                start = end;
+            } else {
+                result.add(new ArrayList<>());
+            }
+        }
+
+        return result;
+    }
+
+    public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
+        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
+        return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
+    }
+
+
     /**
      * 下载Markdown文件
      */

+ 188 - 184
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -971,7 +971,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             dealFreeGoods(orderGoods, add);
         }
 
-        instTimeSettleOrder(add,DateUtils.getNowTime());
+//        instTimeSettleOrder(add,DateUtils.getNowTime());
         Map<String, Object> result = new HashMap<>();
         result.put("orderId", add.getOrderId());
         result.put("orderSn", out_trade_no);
@@ -1153,7 +1153,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         for (OrderGoods orderGoods : freeList) {
             dealFreeGoods(orderGoods, add);
         }
-        instTimeSettleOrder(add,DateUtils.getNowTime());
+//        instTimeSettleOrder(add,DateUtils.getNowTime());
         Map<String, Object> result = new HashMap<>();
         result.put("orderId", add.getOrderId());
         result.put("orderSn", out_trade_no);
@@ -1636,10 +1636,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         //大于0元,获取微信支付信息
         if (payPrice.compareTo(BigDecimal.ZERO) != 0) {
             payResult = iWxPayService.payment(pay_no, userVo.getOpenId(), body, payPrice);
-        }else {
-            instTimeSettleOrder(add,DateUtils.getNowTime());
         }
 
+//        else {
+//            instTimeSettleOrder(add,DateUtils.getNowTime());
+//        }
+
         payResult.put("orderSn", out_trade_no);
         return payResult;
     }
@@ -1669,183 +1671,183 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         add.setOrderCost(BigDecimal.ZERO);
         add.setOrderProfit(BigDecimal.ZERO);
 
-        String TenantId = ServletUtils.getRequest().getHeader("TenantId");
-        //获取机构分成方式
-        SysTenant tenant = sysTenantService
-                .getOne(new LambdaQueryWrapper<SysTenant>()
-                        .eq(SysTenant::getTenantId,TenantId));
-        Integer divideModel = tenant.getDivideModel();
-        //成本和盈亏
-        // 获取企业默认成本模板
-        TopCostTp costTp = topCostTpService.getOne(new LambdaQueryWrapper<TopCostTp>()
-                .eq(TopCostTp::getTenantId, TenantId).eq(TopCostTp::getDefaultStatus, 1).last("limit 1"));
-        if (ObjectUtils.isNotNull(costTp)){
-            List<OrderGoods> orderGoodsList = iOrderGoodsService
-                    .list(new LambdaQueryWrapper<OrderGoods>()
-                            .eq(OrderGoods::getOrderSn, add.getOrderSn())
-                            .ne(OrderGoods::getRefundStatus,2)
-                            .eq(OrderGoods::getStatus, 1));
-            TopCostTpVo topCostTpVo = BeanUtil.toBean(costTp, TopCostTpVo.class);
-            //成本项
-            BigDecimal costTotal = new BigDecimal("0.00");//成本
-            BigDecimal profitTotal = new BigDecimal("0.00"); //盈亏
-            BigDecimal divideTotal = new BigDecimal("0.00");//分成
-            for (OrderGoods orderGoods : orderGoodsList) {
-                BigDecimal goodsPrice = orderGoods.getGoodsRealPrice();
-                //商品业务层 新系统默认是学校业务
-                String businessName = iOrderGoodsService.getBusinessById(orderGoods.getOrderGoodsId());
-                List<TopCostTpItem> items = topCostTpItemService.getCostByBusiness(businessName, costTp.getTpId());
-                if (CollectionUtils.isEmpty(items)) {
-                    //匹配不到成本项
-                    continue;
-                }
-                //根据订单金额匹配成本阶梯
-                List<TopCostTpItem> tpItems = new ArrayList<>();
-                for (TopCostTpItem x : items) {
-                    BigDecimal price = goodsPrice;
-                    if (ObjectUtil.isNotNull(x.getDockStatus()) && x.getDockStatus() == 1){
-                        //启用成本扣除项
-                        switch (x.getDockType()){
-                            case 1://百分比
-                                //成本扣除金额
-                                BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
-                                BigDecimal multiply = goodsPrice.multiply(divide1);
-                                price = price.subtract(multiply);
-                                break;
-                            case 2://固定金额
-                                price = price.subtract(x.getDockValue());
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-
-                    if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                            || (price.compareTo(x.getMinValue()) > 0 && (x.getMaxValue().compareTo(new BigDecimal("-1.00")) == 0 || price.compareTo(x.getMaxValue()) < 0))
-                            || (price.compareTo(x.getMinValue()) == 0 && (x.getMaxValue().compareTo(new BigDecimal("-1.00")) == 0 || price.compareTo(x.getMaxValue()) == 0))){
-                        tpItems.add(x);
-                    }
-                }
-                if (CollectionUtils.isEmpty(tpItems)) {
-                    //匹配不到成本项阶梯值
-                    continue;
-                }
-//                if (tpItems.size() > 1) {
-//                    //匹配到多个成本项
-//                    throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", businessName, goodsPrice.toString()));
+//        String TenantId = ServletUtils.getRequest().getHeader("TenantId");
+//        //获取机构分成方式
+//        SysTenant tenant = sysTenantService
+//                .getOne(new LambdaQueryWrapper<SysTenant>()
+//                        .eq(SysTenant::getTenantId,TenantId));
+//        Integer divideModel = tenant.getDivideModel();
+//        //成本和盈亏
+//        // 获取企业默认成本模板
+//        TopCostTp costTp = topCostTpService.getOne(new LambdaQueryWrapper<TopCostTp>()
+//                .eq(TopCostTp::getTenantId, TenantId).eq(TopCostTp::getDefaultStatus, 1).last("limit 1"));
+//        if (ObjectUtils.isNotNull(costTp)){
+//            List<OrderGoods> orderGoodsList = iOrderGoodsService
+//                    .list(new LambdaQueryWrapper<OrderGoods>()
+//                            .eq(OrderGoods::getOrderSn, add.getOrderSn())
+//                            .ne(OrderGoods::getRefundStatus,2)
+//                            .eq(OrderGoods::getStatus, 1));
+//            TopCostTpVo topCostTpVo = BeanUtil.toBean(costTp, TopCostTpVo.class);
+//            //成本项
+//            BigDecimal costTotal = new BigDecimal("0.00");//成本
+//            BigDecimal profitTotal = new BigDecimal("0.00"); //盈亏
+//            BigDecimal divideTotal = new BigDecimal("0.00");//分成
+//            for (OrderGoods orderGoods : orderGoodsList) {
+//                BigDecimal goodsPrice = orderGoods.getGoodsRealPrice();
+//                //商品业务层 新系统默认是学校业务
+//                String businessName = iOrderGoodsService.getBusinessById(orderGoods.getOrderGoodsId());
+//                List<TopCostTpItem> items = topCostTpItemService.getCostByBusiness(businessName, costTp.getTpId());
+//                if (CollectionUtils.isEmpty(items)) {
+//                    //匹配不到成本项
+//                    continue;
 //                }
-                BigDecimal divideMoney = new BigDecimal("0.00");//分成
-                BigDecimal cost = new BigDecimal("0.00");//成本
-                BigDecimal bigDecimal = new BigDecimal("100");
-                for (TopCostTpItem tpItem : tpItems) {
-                    BigDecimal goodsDecimal = goodsPrice;
-                    //换算订单成本和盈亏
-                    TopCostTpItem topCostTpItem = tpItem;
-                    orderGoods.setDivideType(topCostTpItem.getDockType());
-                    orderGoods.setDivideRate(topCostTpItem.getDockValue());
-                    if (ObjectUtil.isNotNull(topCostTpItem.getDockStatus()) && topCostTpItem.getDockStatus() == 1){
-                        //启用成本扣除项
-                        switch (topCostTpItem.getDockType()){
-                            case 1://百分比
-                                //成本扣除金额
-                                BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
-                                BigDecimal multiply = goodsDecimal.multiply(divide1);
-                                goodsDecimal = goodsDecimal.subtract(multiply);
-                                break;
-                            case 2://固定金额
-                                goodsDecimal = goodsDecimal.subtract(topCostTpItem.getDockValue());
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-                    switch (topCostTpItem.getItemType()) {
-                        case 1://百分比
-                            BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
-                            BigDecimal multiply = goodsDecimal.multiply(divide);
-                            cost = cost.add(multiply);
-                            if (topCostTpItem.getItemCategory() == 1 && add.getFinishStatus() == 1){
-                                //订单已完单 并且是分成成本
-                                divideMoney = divideMoney.add(multiply);
-                            }
-                            break;
-                        case 2://固定金额
-                            cost = cost.add(topCostTpItem.getTypeValue());
-                            if (topCostTpItem.getItemCategory() == 1 && add.getFinishStatus() == 1){
-                                //分成
-                                divideMoney = divideMoney.add(topCostTpItem.getTypeValue());
-                            }
-                            break;
-                        default:
-                            break;
-                    }
-                }
-
-                if (add.getFinishStatus() == 1 && divideTotal.compareTo(BigDecimal.ZERO) >0 ){
-                    orderGoods.setDivideModel(divideModel);
-                    orderGoods.setDivideMoney(divideMoney);
-                    iOrderGoodsService.updateById(orderGoods);
-                }
-                costTotal = costTotal.add(cost);
-                divideTotal = divideTotal.add(divideMoney);
-            }
-            List<TopCostTpItem> costTpItemList = topCostTpItemService
-                    .list(new LambdaQueryWrapper<TopCostTpItem>()
-                            .eq(TopCostTpItem::getTpId, costTp.getTpId())
-                            .eq(TopCostTpItem::getStatus, 1));
-            if (CollectionUtils.isNotEmpty(costTpItemList)) {
-                List<TopCostTpItemVo> itemVoList = costTpItemList.stream().map(x -> BeanUtil.toBean(x, TopCostTpItemVo.class)).collect(Collectors.toList());
-                topCostTpVo.setItemList(itemVoList);
-            }
-            //实际账款 = 已收 - 已退
-            BigDecimal subtract = add.getOrderReceived().subtract(add.getOrderRefunded());
-            profitTotal = subtract.subtract(costTotal);
-            add.setOrderCost(costTotal);
-            add.setOrderProfit(profitTotal);
-            add.setCostJson(JSONObject.toJSONString(topCostTpVo));
-            if (add.getFinishStatus() == 1 && divideTotal.compareTo(BigDecimal.ZERO) >0){
-                add.setDivideModel(divideModel);
-                add.setDivideStatus(2);//待审核
-                add.setAccomplishTime(DateUtils.getNowTime());
-                if (divideModel == 1) {
-                    //机构分成
-                    add.setDivideCompanyMoney(divideTotal);
-                } else {
-                    //业务员分成
-                    add.setDivideSellerMoney(divideTotal);
-                }
-
-                //创建订单分成审核流程
-                List<TopOldOrderCheck> checkList = topOldOrderCheckService
-                        .list(new LambdaQueryWrapper<TopOldOrderCheck>().in(TopOldOrderCheck::getCheckType, Arrays.asList(5, 6))
-                                .orderByAsc(TopOldOrderCheck::getCheckSort));
-                if (CollectionUtils.isNotEmpty(checkList)) {
-                    List<TopOldOrderCheckLog> logs = new ArrayList<>();
-                    for (int i = 0; i < checkList.size(); i++) {
-                        TopOldOrderCheck check = checkList.get(i);
-                        TopOldOrderCheckLog log = new TopOldOrderCheckLog();
-                        log.setOrderSn(add.getOrderSn());
-                        log.setRoleId(check.getCheckRole());
-                        log.setCheckFrom(divideModel == 1? 2:3);
-                        log.setUpdateTime(DateUtils.getNowTime());
-                        log.setCreateTime(DateUtils.getNowTime());
-                        log.setTenantId(add.getTenantId());
-                        log.setCheckSign(i > 0 ? 0 : 1);
-                        log.setCheckSort(check.getCheckSort());
-                        log.setType(check.getCheckType());
-                        log.setTenantId(Long.valueOf(TenantId));
-                        if (check.getCheckType() == 6) {
-                            //分成支付
-                            log.setCheckStatus(2);//待支付
-                        } else {
-                            log.setCheckStatus(0);//待审核
-                        }
-                        logs.add(log);
-                    }
-                    topOldOrderCheckLogService.saveBatch(logs);
-                }
-            }
-        }
+//                //根据订单金额匹配成本阶梯
+//                List<TopCostTpItem> tpItems = new ArrayList<>();
+//                for (TopCostTpItem x : items) {
+//                    BigDecimal price = goodsPrice;
+//                    if (ObjectUtil.isNotNull(x.getDockStatus()) && x.getDockStatus() == 1){
+//                        //启用成本扣除项
+//                        switch (x.getDockType()){
+//                            case 1://百分比
+//                                //成本扣除金额
+//                                BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+//                                BigDecimal multiply = goodsPrice.multiply(divide1);
+//                                price = price.subtract(multiply);
+//                                break;
+//                            case 2://固定金额
+//                                price = price.subtract(x.getDockValue());
+//                                break;
+//                            default:
+//                                break;
+//                        }
+//                    }
+//
+//                    if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
+//                            || (price.compareTo(x.getMinValue()) > 0 && (x.getMaxValue().compareTo(new BigDecimal("-1.00")) == 0 || price.compareTo(x.getMaxValue()) < 0))
+//                            || (price.compareTo(x.getMinValue()) == 0 && (x.getMaxValue().compareTo(new BigDecimal("-1.00")) == 0 || price.compareTo(x.getMaxValue()) == 0))){
+//                        tpItems.add(x);
+//                    }
+//                }
+//                if (CollectionUtils.isEmpty(tpItems)) {
+//                    //匹配不到成本项阶梯值
+//                    continue;
+//                }
+////                if (tpItems.size() > 1) {
+////                    //匹配到多个成本项
+////                    throw new CustomException(String.format("成本项阶梯匹配有误!(有多个)请检查【%s,价格:%s】", businessName, goodsPrice.toString()));
+////                }
+//                BigDecimal divideMoney = new BigDecimal("0.00");//分成
+//                BigDecimal cost = new BigDecimal("0.00");//成本
+//                BigDecimal bigDecimal = new BigDecimal("100");
+//                for (TopCostTpItem tpItem : tpItems) {
+//                    BigDecimal goodsDecimal = goodsPrice;
+//                    //换算订单成本和盈亏
+//                    TopCostTpItem topCostTpItem = tpItem;
+//                    orderGoods.setDivideType(topCostTpItem.getDockType());
+//                    orderGoods.setDivideRate(topCostTpItem.getDockValue());
+//                    if (ObjectUtil.isNotNull(topCostTpItem.getDockStatus()) && topCostTpItem.getDockStatus() == 1){
+//                        //启用成本扣除项
+//                        switch (topCostTpItem.getDockType()){
+//                            case 1://百分比
+//                                //成本扣除金额
+//                                BigDecimal divide1 = topCostTpItem.getDockValue().divide(bigDecimal);
+//                                BigDecimal multiply = goodsDecimal.multiply(divide1);
+//                                goodsDecimal = goodsDecimal.subtract(multiply);
+//                                break;
+//                            case 2://固定金额
+//                                goodsDecimal = goodsDecimal.subtract(topCostTpItem.getDockValue());
+//                                break;
+//                            default:
+//                                break;
+//                        }
+//                    }
+//                    switch (topCostTpItem.getItemType()) {
+//                        case 1://百分比
+//                            BigDecimal divide = topCostTpItem.getTypeValue().divide(bigDecimal);
+//                            BigDecimal multiply = goodsDecimal.multiply(divide);
+//                            cost = cost.add(multiply);
+//                            if (topCostTpItem.getItemCategory() == 1 && add.getFinishStatus() == 1){
+//                                //订单已完单 并且是分成成本
+//                                divideMoney = divideMoney.add(multiply);
+//                            }
+//                            break;
+//                        case 2://固定金额
+//                            cost = cost.add(topCostTpItem.getTypeValue());
+//                            if (topCostTpItem.getItemCategory() == 1 && add.getFinishStatus() == 1){
+//                                //分成
+//                                divideMoney = divideMoney.add(topCostTpItem.getTypeValue());
+//                            }
+//                            break;
+//                        default:
+//                            break;
+//                    }
+//                }
+//
+//                if (add.getFinishStatus() == 1 && divideTotal.compareTo(BigDecimal.ZERO) >0 ){
+//                    orderGoods.setDivideModel(divideModel);
+//                    orderGoods.setDivideMoney(divideMoney);
+//                    iOrderGoodsService.updateById(orderGoods);
+//                }
+//                costTotal = costTotal.add(cost);
+//                divideTotal = divideTotal.add(divideMoney);
+//            }
+//            List<TopCostTpItem> costTpItemList = topCostTpItemService
+//                    .list(new LambdaQueryWrapper<TopCostTpItem>()
+//                            .eq(TopCostTpItem::getTpId, costTp.getTpId())
+//                            .eq(TopCostTpItem::getStatus, 1));
+//            if (CollectionUtils.isNotEmpty(costTpItemList)) {
+//                List<TopCostTpItemVo> itemVoList = costTpItemList.stream().map(x -> BeanUtil.toBean(x, TopCostTpItemVo.class)).collect(Collectors.toList());
+//                topCostTpVo.setItemList(itemVoList);
+//            }
+//            //实际账款 = 已收 - 已退
+//            BigDecimal subtract = add.getOrderReceived().subtract(add.getOrderRefunded());
+//            profitTotal = subtract.subtract(costTotal);
+//            add.setOrderCost(costTotal);
+//            add.setOrderProfit(profitTotal);
+//            add.setCostJson(JSONObject.toJSONString(topCostTpVo));
+//            if (add.getFinishStatus() == 1 && divideTotal.compareTo(BigDecimal.ZERO) >0){
+//                add.setDivideModel(divideModel);
+//                add.setDivideStatus(2);//待审核
+//                add.setAccomplishTime(DateUtils.getNowTime());
+//                if (divideModel == 1) {
+//                    //机构分成
+//                    add.setDivideCompanyMoney(divideTotal);
+//                } else {
+//                    //业务员分成
+//                    add.setDivideSellerMoney(divideTotal);
+//                }
+//
+//                //创建订单分成审核流程
+//                List<TopOldOrderCheck> checkList = topOldOrderCheckService
+//                        .list(new LambdaQueryWrapper<TopOldOrderCheck>().in(TopOldOrderCheck::getCheckType, Arrays.asList(5, 6))
+//                                .orderByAsc(TopOldOrderCheck::getCheckSort));
+//                if (CollectionUtils.isNotEmpty(checkList)) {
+//                    List<TopOldOrderCheckLog> logs = new ArrayList<>();
+//                    for (int i = 0; i < checkList.size(); i++) {
+//                        TopOldOrderCheck check = checkList.get(i);
+//                        TopOldOrderCheckLog log = new TopOldOrderCheckLog();
+//                        log.setOrderSn(add.getOrderSn());
+//                        log.setRoleId(check.getCheckRole());
+//                        log.setCheckFrom(divideModel == 1? 2:3);
+//                        log.setUpdateTime(DateUtils.getNowTime());
+//                        log.setCreateTime(DateUtils.getNowTime());
+//                        log.setTenantId(add.getTenantId());
+//                        log.setCheckSign(i > 0 ? 0 : 1);
+//                        log.setCheckSort(check.getCheckSort());
+//                        log.setType(check.getCheckType());
+//                        log.setTenantId(Long.valueOf(TenantId));
+//                        if (check.getCheckType() == 6) {
+//                            //分成支付
+//                            log.setCheckStatus(2);//待支付
+//                        } else {
+//                            log.setCheckStatus(0);//待审核
+//                        }
+//                        logs.add(log);
+//                    }
+//                    topOldOrderCheckLogService.saveBatch(logs);
+//                }
+//            }
+//        }
 
     }
 
@@ -2073,9 +2075,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 throw new CustomException("请先授权绑定公众号信息");
             }
             payResult = iWxPayService.paymentGzh(pay_no, userVo.getGzhOpenId(), body, payPrice, bo.getUrl());
-        }else {
-            instTimeSettleOrder(add,DateUtils.getNowTime());
         }
+//        else {
+//            instTimeSettleOrder(add,DateUtils.getNowTime());
+//        }
 
         payResult.put("orderSn", out_trade_no);
         return payResult;
@@ -2277,9 +2280,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         //大于0元,获取微信支付信息
         if (payPrice.compareTo(BigDecimal.ZERO) != 0) {
             payResult = iWxPayService.paymentPc(pay_no, userVo.getOpenId(), body, payPrice);
-        }else {
-            instTimeSettleOrder(add,DateUtils.getNowTime());
         }
+//        else {
+//            instTimeSettleOrder(add,DateUtils.getNowTime());
+//        }
 
         payResult.put("orderSn", out_trade_no);
         return payResult;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -4394,7 +4394,7 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                         GoodsVo goods = iGoodsService.queryById(gradeVo.getGoodsId());
                         System.out.println(goods);
                         if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness()) && !CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness().stream().filter(informRemindBusinessVo -> informRemindBusinessVo.getBusinessId().equals(goods.getBusinessId())).collect(Collectors.toList()))) {
-                            System.out.println(232323);
+
                             UserVo userVo = iUserService.queryById(user.getUserId());
                             if (informRemindVo.getWayStatus().equals(1)) {
                                 InformUserAddBo informUserAddBo = new InformUserAddBo();