Browse Source

fix(system):
1.bug修复

wzq 1 day ago
parent
commit
b6bb1cc04c

+ 2 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/OrderController.java

@@ -12,6 +12,7 @@ import org.jeecg.modules.app.form.UserPayForm;
 import org.jeecg.modules.app.service.IOrderService;
 import org.jeecg.modules.app.vo.OrderVO;
 import org.jeecg.modules.system.app.entity.AppCoursesVerificationRecord;
+import org.simpleframework.xml.core.Validate;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.*;
 
@@ -117,7 +118,7 @@ public class OrderController {
      */
     @Operation(summary = "订单-创建")
     @PostMapping("/createOrder")
-    public Result<UserPayForm> createOrder(@RequestBody CreateOrderForm createOrderForm) {
+    public Result<UserPayForm> createOrder(@Validate @RequestBody CreateOrderForm createOrderForm) {
         return Result.ok(appOrderService.createOrder(createOrderForm));
     }
 

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/dto/AppOrderInfoDTO.java

@@ -49,6 +49,9 @@ public class AppOrderInfoDTO implements Serializable {
     @Schema(description = "经营状态 0-营业 1-休息")
     private Integer runStatus;
 
+    @Schema(description = "上课地址ID")
+    private String addressSiteId;
+
     @Schema(description = "上课地址")
     private String courseSiteAddress;
 

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/form/CreateOrderForm.java

@@ -22,7 +22,7 @@ public class CreateOrderForm implements Serializable {
     @NotNull(message = "订单类型不能为空")
     public Integer type;
 
-    @Schema(description = "订单子类型;0-学校 1-包场 2-无固定场 3-个人赛 4-团队赛")
+    @Schema(description = "订单子类型;0-学校 1-包场 2-无固定场 3-个人赛 4-团队赛 5-课程")
     //订单子类型;0-学校 1-包场 2-无固定场 3-个人赛 4-团队赛
     public Integer orderType;
 

+ 21 - 14
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.app.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -504,7 +506,9 @@ public class OrderServiceImpl implements IOrderService {
                 //合同编号
                 AppContractInfo appContractInfo = appContractInfoMapper.selectOne(Wrappers.<AppContractInfo>lambdaQuery()
                         .eq(AppContractInfo::getOrgCode, appOrder.getOrgCode()).eq(AppContractInfo::getDelFlag,0));
-                appOrder.setContractNo(appContractInfo.getId());
+                if (ObjectUtil.isNotEmpty(appContractInfo)) {
+                    appOrder.setContractNo(appContractInfo.getId());
+                }
 
                 //订单总价(商品的售价总和)
                 BigDecimal sumCoursePrice = new BigDecimal(0);
@@ -534,19 +538,21 @@ public class OrderServiceImpl implements IOrderService {
                     appOrderProInfo.setDelFlag(CommonConstant.DEL_FLAG_0);
 
                     //创建核销记录
-                    for (AppCoursesPriceRules appCoursesPriceRules : priceRulesList) {
-                        AppCoursesVerificationRecord appCoursesVerificationRecord = new AppCoursesVerificationRecord();
-                        appCoursesVerificationRecord.setCoursesId(appCourse.getId());
-                        appCoursesVerificationRecord.setCoursesPriceRuleId(appCoursesPriceRules.getId());
-                        appCoursesVerificationRecord.setCoursesName(appCourse.getName());
-                        appCoursesVerificationRecord.setCoursesStartTime(appCoursesPriceRules.getStartTime());
-                        appCoursesVerificationRecord.setCoursesEndTime(appCoursesPriceRules.getEndTime());
-                        appCoursesVerificationRecord.setUseUserId(familyUserId);
-                        appCoursesVerificationRecord.setUseUserName(familyMembers.getFullName());
-                        appCoursesVerificationRecord.setVerifyStatus(0);
-                        appCoursesVerificationRecord.setOrPostpone(0);
-                        appCoursesVerificationRecord.setCoursesType(0);
-                        appCoursesVerificationRecordList.add(appCoursesVerificationRecord);
+                    if (CollUtil.isNotEmpty(priceRulesList)) {
+                        for (AppCoursesPriceRules appCoursesPriceRules : priceRulesList) {
+                            AppCoursesVerificationRecord appCoursesVerificationRecord = new AppCoursesVerificationRecord();
+                            appCoursesVerificationRecord.setCoursesId(appCourse.getId());
+                            appCoursesVerificationRecord.setCoursesPriceRuleId(appCoursesPriceRules.getId());
+                            appCoursesVerificationRecord.setCoursesName(appCourse.getName());
+                            appCoursesVerificationRecord.setCoursesStartTime(appCoursesPriceRules.getStartTime());
+                            appCoursesVerificationRecord.setCoursesEndTime(appCoursesPriceRules.getEndTime());
+                            appCoursesVerificationRecord.setUseUserId(familyUserId);
+                            appCoursesVerificationRecord.setUseUserName(familyMembers.getFullName());
+                            appCoursesVerificationRecord.setVerifyStatus(0);
+                            appCoursesVerificationRecord.setOrPostpone(0);
+                            appCoursesVerificationRecord.setCoursesType(0);
+                            appCoursesVerificationRecordList.add(appCoursesVerificationRecord);
+                        }
                     }
 
                     if (createOrderForm.getOrFreeOrder() == 1) {
@@ -737,6 +743,7 @@ public class OrderServiceImpl implements IOrderService {
         appOrderInfoDTO.setLatitude(courseSite.getLatitude());
         appOrderInfoDTO.setLongitude(courseSite.getLongitude());
         appOrderInfoDTO.setPhone(courseSite.getPhone());
+        appOrderInfoDTO.setAddressSiteId(courseSite.getId());
 
         return appOrderInfoDTO;
     }

+ 22 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppCoursesController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.system.app.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
@@ -8,7 +9,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.modules.system.app.dto.*;
+import org.jeecg.modules.system.app.dto.AppCoursesDTO;
+import org.jeecg.modules.system.app.dto.AppCoursesInfoPageDTO;
+import org.jeecg.modules.system.app.dto.AppCoursesPageDTO;
+import org.jeecg.modules.system.app.dto.AppSiteAddressDTO;
 import org.jeecg.modules.system.app.entity.AppCourses;
 import org.jeecg.modules.system.app.service.IAppCoureseService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -73,6 +77,23 @@ public class AppCoursesController extends JeecgController<AppCourses, IAppCoures
 	public Result<String> edit(@RequestBody AppCoursesDTO appCoursesDTO) {
 		return appCoursesService.editWitchPriceRules(appCoursesDTO)?Result.OK("操作成功!"):Result.error("操作失败!");
 	}
+	/**
+	 *  编辑-上下架状态
+	 *
+	 * @param
+	 * @return
+	 */
+	@AutoLog(value = "课程/培训表-编辑-上下架状态")
+	@Operation(summary="课程/培训表-编辑-上下架状态")
+	@RequiresPermissions("app:appCourese:edit")
+	@PutMapping(value = "/editRackingStatus")
+	public Result<String> editRackingStatus(@RequestParam String appCourseId,@RequestParam Integer rackingStatus) {
+		boolean flag = appCoursesService.update(Wrappers.<AppCourses>lambdaUpdate(AppCourses.class).eq(AppCourses::getId, appCourseId).set(AppCourses::getRackingStatus, rackingStatus));
+		if(!flag){
+			return Result.OK("修改失败!");
+		}
+		return Result.OK("修改成功!");
+	}
 	
 	/**
 	 *   通过id删除

+ 6 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppCoureseServiceImpl.java

@@ -59,10 +59,13 @@ public class AppCoureseServiceImpl extends ServiceImpl<AppCoursesMapper, AppCour
         if (null == coursesCuDTO.getCategoryId()) throw new JeecgBootException("请选择课程类别");
         AppSite site = siteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, coursesCuDTO.getOrgCode()));
         AppCourses appCourses = new AppCourses();
-        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         BeanUtils.copyProperties(coursesCuDTO, appCourses);
-        appCourses.setOrgCode(site.getOrgCode());
-        appCourses.setTenantId(site.getTenantId());
+        if (ObjUtil.isNotEmpty(site)){
+            appCourses.setOrgCode(site.getOrgCode());
+            appCourses.setTenantId(site.getTenantId());
+            appCourses.setSiteId(site.getId());
+        }
+
         appCourses.setUserId(coursesCuDTO.getUserId());
         appCourses.setAddressSiteId(coursesCuDTO.getAddressSiteId());
         List<AppCoursesRuleDTO> coursesRuleDTOS = appCoursesDTO.getPriceRulesList();