Procházet zdrojové kódy

Merge branch 'master' of http://192.168.1.222:10010/zhongzheng-edu/zz_backend

he2802 před 4 roky
rodič
revize
22bea5ee5b

+ 6 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderController.java

@@ -6,6 +6,7 @@ import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.controller.alioss.OssController;
 import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.modules.order.bo.OrderAddBo;
 import com.zhongzheng.modules.order.bo.OrderEditBo;
@@ -16,6 +17,8 @@ import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -39,6 +42,8 @@ public class OrderController extends BaseController {
 
     private final WxTokenService wxTokenService;
 
+    private static Logger log = LoggerFactory.getLogger(OrderController.class);
+
     /**
      * 查询订单列表
      */
@@ -80,6 +85,7 @@ public class OrderController extends BaseController {
     public AjaxResult add(@RequestBody OrderAddBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        log.info("金币支付订单参数:{}",bo);
         return AjaxResult.success(iOrderService.placeOrder(bo));
     }
 

+ 11 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -86,8 +86,11 @@ public class OssServiceImpl implements OssService {
             String policy = BinaryUtil.toBase64String(binaryData);
             String signature = ossClient.calculatePostSignature(postPolicy);
             String callbackData = BinaryUtil.toBase64String(JSONUtil.parse(callback).toString().getBytes("utf-8"));
+            String now = String.valueOf(System.currentTimeMillis()) + "_";
+            Random rand = new Random();
+            int random = rand.nextInt();
             resultBean.set("accessid",ossClient.getCredentialsProvider().getCredentials().getAccessKeyId()).set("policy",policy).set("signature",signature)
-            .set("dir",dir).set("expire",String.valueOf(expireEndTime / 1000)).set("callback",callbackData).set("host",action);
+            .set("dir",dir+"/"+now + String.valueOf(random > 0 ? random : (-1) * random)).set("expire",String.valueOf(expireEndTime / 1000)).set("callback",callbackData).set("host",action);
             // 返回结果
         } catch (Exception e) {
             LOGGER.error("签名生成失败", e);
@@ -113,25 +116,25 @@ public class OssServiceImpl implements OssService {
         RandomFilename = now + String.valueOf(random > 0 ? random : (-1) * random);
         switch(ossRequest.getImageStatus()){
             case 0 :
-                RandomFilename = "avatar"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "avatar"+"/"+sdf.format(new Date());
                 break;
             case 1 :
-                RandomFilename = "IDNumber"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "IDNumber"+"/"+sdf.format(new Date());
                 break;
             case 2 :
-                RandomFilename = "QuestionBank"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "QuestionBank"+"/"+sdf.format(new Date());
                 break;
             case 3 :
-                RandomFilename = "guide"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "guide"+"/"+sdf.format(new Date());
                 break;
             case 4 :
-                RandomFilename = "advertising"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "advertising"+"/"+sdf.format(new Date());
                 break;
             case 5 :
-                RandomFilename = "IDCard"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "IDCard"+"/"+sdf.format(new Date());
                 break;
             case 6 :
-                RandomFilename = "file"+"/"+sdf.format(new Date())+"/"+RandomFilename;
+                RandomFilename = "file"+"/"+sdf.format(new Date());
                 break;
         }
 

+ 10 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -52,6 +52,8 @@ import com.zhongzheng.modules.user.vo.OrderPossessUserVo;
 import com.zhongzheng.modules.user.vo.RanKingUser;
 import com.zhongzheng.modules.user.vo.UserVo;
 import com.zhongzheng.modules.wx.service.IWxPayService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -128,6 +130,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private IActivityConfigurationUseService activityConfigurationUseServiceImpl;
 
+    private static Logger log = LoggerFactory.getLogger(OrderServiceImpl.class);
+
     @Override
     public OrderVo queryById(Long orderId){
         Order db = this.baseMapper.selectById(orderId);
@@ -382,6 +386,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 if(coupon.getCouponType()==0){
                     //优惠券
                     g.setGoodsPrice(g.getGoodsPrice().subtract(coupon.getPrice()));
+                    log.info("优惠金额:{}",g.getGoodsPrice());
+                    log.info("优惠金额券:{}",coupon.getPrice());
+
 
                 }
                 if(coupon.getCouponType()==1){
@@ -449,7 +456,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             payPrice = zero;
         }
         add.setPayPrice(payPrice);
-
+        log.info("优惠金额:{}",payPrice);
         if(userVo.getMoney().compareTo(payPrice) < 0){
             throw new CustomException("金币不足");
         }
@@ -491,10 +498,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 //用优惠券更新状态
                 OrderCoupon orderCoupon = iOrderCouponService.queryBySn(out_trade_no);
                 if(Validator.isNotNull(orderCoupon)){
-                    UpdateWrapper<Course> updateWrapper = new UpdateWrapper<>();
+                    UpdateWrapper<Coupon> updateWrapper = new UpdateWrapper<>();
                     updateWrapper.setSql("user_status = "+1);
                     updateWrapper.eq("coupon_id", orderCoupon.getCouponId());
-                    iCourseService.update(updateWrapper);
+                    iCouponService.update(updateWrapper);
                 }
                 return true;
             }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java

@@ -140,7 +140,7 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
         practice.between(ActivityTaskUser::getCreateTime,getTimesmorning(),getTimesnight());
         List<ActivityTaskUser> listPractice = activityTaskUserService.list(practice);
         ActivityTaskVo activityTaskVo = activityTaskService.queryByTaskId(5L);
-        if (activityTaskVo == null){
+        if (activityTaskVo == null && activityTaskVo.getId() == null){
             return;
         }
         if (!CollectionUtils.isEmpty(listPractice) && listPractice.size() >= activityTaskVo.getCountDay()){

+ 5 - 41
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -406,45 +406,6 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
             int i = baseMapper.updateById(userPlan);
         }else {
             //自定义学习计划,自动生成计划
-            if (bo.getCourseId() != null && bo.getStudyCount() == null) {
-                UserPlanVo userPlanVo = generateSelf(userPlanQueryBo);
-                if (bo.getStatus() != null) {
-                    UserPlan userPlan = new UserPlan();
-                    String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
-                    String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
-                    userPlan.setUpdateTime(DateUtils.getNowTime());
-                    userPlan.setStudyDay(bo.getStudyDay());
-                    userPlan.setStudyCount(s1);
-                    userPlan.setUserId(bo.getUserId());
-                    userPlan.setSchedule(s);
-                    userPlan.setPitchNum(userPlanVo.getPitchNum());
-                    userPlan.setStudyNum(0L);
-                    userPlan.setCreateTime(DateUtils.getNowTime());
-                    userPlan.setUpdateTime(DateUtils.getNowTime());
-                    if (bo.getStatus() != null) {
-                        userPlan.setStatus(bo.getStatus());
-                    }
-                    if (bo.getStatus() == 1) {
-                        boolean save = this.save(userPlan);
-                        for (CoursePlanVo coursePlanVo : userPlanVo.getCoursePlanVo()) {
-                            coursePlanVo.setPlanId(userPlan.getPlanId());
-                            baseMapper.insertSource(coursePlanVo);
-                        }
-                    }
-                    if (bo.getStatus() == 2) {
-                        userPlan.setPlanId(bo.getPlanId());
-                        userPlan.setStatus(1);
-                        boolean save = this.updateById(userPlan);
-                        LambdaQueryWrapper<UserPlanCource> lqw = Wrappers.lambdaQuery();
-                        lqw.eq(bo.getPlanId() != null,UserPlanCource::getPlanId,bo.getPlanId());
-                        userPlanCourceService.remove(lqw);
-                        for (CoursePlanVo coursePlanVo : userPlanVo.getCoursePlanVo()) {
-                            coursePlanVo.setPlanId(userPlan.getPlanId());
-                            baseMapper.insertSource(coursePlanVo);
-                        }
-                    }
-                }
-            } else {
                 UserPlanVo userPlanVo = generateSelfBo(userPlanQueryBo);
                 if (bo.getStatus() != null) {
                     UserPlan userPlan = new UserPlan();
@@ -486,7 +447,6 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                             baseMapper.insertSource(coursePlanVo);
                         }
                     }
-                }
             }
 
         }
@@ -1047,7 +1007,11 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
         List<CoursePlanVo> coursePlanVo = baseMapper.selectByListCourse(bo);
 
         UserPlanVo userPlanVo1 = null;
+        Long category=coursePlanVo.get(0).getCategoryId();
         for (CoursePlanVo planVo : coursePlanVo) {
+            if (!category.equals(planVo.getCategoryId())){
+                throw new IllegalArgumentException("课程类型不符合同一类型");
+            }
             if (userPlanVo1 == null) {
                 userPlanVo1 = generateList(bo, planVo);
             }else {
@@ -1070,7 +1034,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
         //总节数
         Integer sectionNum = planVo.getSectionNum();
         if(sectionNum <= 0){
-            throw new IllegalArgumentException("该课程没有节数,无法生成计划");
+            throw new IllegalArgumentException("课程错误");
         }
         //查出节的ID
         List<Long> listId= baseMapper.selectByCourseId(planVo.getCourseId());

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/activity/ActivityTaskMapper.xml

@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <select id="queryByTaskId" parameterType="Long" resultMap="ActivityTaskResult">
-        select * FROM activity_task where 1=1
+        select * FROM activity_task where 1=1 and status = 1
             and task_type = #{taskId} limit 1
 
     </select>

+ 4 - 4
zhongzheng-system/src/main/resources/mapper/modules/order/CouponMapper.xml

@@ -16,14 +16,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectCountCon" parameterType="Long" resultType="integer">
         SELECT
-        COUNT(a.id)
+        COUNT(a.coupon_id)
         FROM
-        activity_configuration a
-        LEFT JOIN activity_configuration_course t ON a.id = t.configuration_id
+        coupon a
+        LEFT JOIN activity_configuration_course t ON a.configuration_id = t.configuration_id
         WHERE
         1 = 1
         <if test="couponId != null and couponId != ''" >
-            AND a.id = #{couponId}
+            AND a.coupon_id = #{couponId}
         </if>
         <if test="goodsId != null and goodsId != ''" >
             AND t.course_id =#{goodsId}

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/recruit/RecruitCompanyMapper.xml

@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT * FROM v_tenant_company where status = 1
             <if test="status!=null">and status=#{status}</if>
             <if test="companyId!=null">and company_id=#{companyId} </if>
-            <if test="companyName!=null">and tenant_name like concat('%', #{companyName}, '%')</if>
+            <if test="companyName!=null">and company_name like concat('%', #{companyName}, '%')</if>
             <if test="companyTypeId!=null">and company_type_id=#{companyTypeId}</if>
             <if test="companySizeId!=null">and company_size_id=#{companySizeId}</if>
             <if test="industryTypeId!=null">and industry_type_id=#{industryTypeId}</if>