Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

yfh 1 týždeň pred
rodič
commit
2802d72b1a

+ 3 - 5
fs-company/src/main/java/com/fs/company/controller/store/FsUserCouponController.java

@@ -105,11 +105,9 @@ public class FsUserCouponController extends BaseController
     @PostMapping("/sendCoupon")
     public AjaxResult sendCoupon(@RequestBody FsUserCouponSendParam fsUserCoupon)
     {
-        if (fsUserCoupon.getSetSendUserId() == null){
-            LoginUser loginUser = SecurityUtils.getLoginUser();
-            Long userId = loginUser.getUser().getUserId();
-            fsUserCoupon.setSetSendUserId(userId);
-        }
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        fsUserCoupon.setCompanyId(loginUser.getCompany().getCompanyId());
+        fsUserCoupon.setCompanyUserId(loginUser.getUser().getUserId());
         return toAjax(fsUserCouponService.sendFsUserCoupon(fsUserCoupon));
     }
 

+ 2 - 2
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -1031,8 +1031,8 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
             if(ObjectUtils.isNotNull(item.getUserId())) {
                 FsUser fsUser = fsUserCacheService.selectFsUserById(item.getUserId());
                 if(ObjectUtils.isNotNull(fsUser)){
-                    item.setExternalUserName(String.format("%s_%d",fsUser.getNickname(),fsUser.getUserId()));
-                    item.setFsNickName(fsUser.getNickname());
+                    item.setExternalUserName(String.format("%s_%d",fsUser.getNickName(),fsUser.getUserId()));
+                    item.setFsNickName(fsUser.getNickName());
                     item.setFsAvatar(fsUser.getAvatar());
                 }
             }

+ 17 - 11
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -942,22 +942,28 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             logger.error("未答题:{}",param.getUserId());
             return R.error("未答题");
         }
-        if (log.getRewardType() != null) {
-            FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(),param.getPeriodId());
-            if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
-                return R.error("已领取该课程奖励,不可重复领取!");
-            }
-            if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 0) {
-                if(StringUtils.isNotEmpty(fsCourseRedPacketLog.getResult())){
-                    R r = JSON.parseObject(fsCourseRedPacketLog.getResult(), R.class);
-                    return r;
-                } else {
-                    return R.error("操作频繁,请稍后再试!");
+        if (log.getRewardType() != null ) {
+            if (log.getRewardType() == 1){
+                FsCourseRedPacketLog fsCourseRedPacketLog = redPacketLogMapper.selectUserFsCourseRedPacketLog(param.getVideoId(), param.getUserId(),param.getPeriodId());
+                if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 1) {
+                    return R.error("已领取该课程奖励,不可重复领取!");
                 }
+                if(fsCourseRedPacketLog != null && fsCourseRedPacketLog.getStatus() == 0) {
+                    if(StringUtils.isNotEmpty(fsCourseRedPacketLog.getResult())){
+                        R r = JSON.parseObject(fsCourseRedPacketLog.getResult(), R.class);
+                        return r;
+                    } else {
+                        return R.error("操作频繁,请稍后再试!");
+                    }
+                }
+            }else if (log.getRewardType() == 2){
+                return R.error("已领取该课程奖励,不可重复领取!");
             }
+
         }
 
 
+
         // 获取视频信息
         FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
 

+ 2 - 2
fs-service/src/main/java/com/fs/his/mapper/FsUserIntegralLogsMapper.java

@@ -88,10 +88,10 @@ public interface FsUserIntegralLogsMapper
             "and l.user_id = #{maps.userId}  " +
             "</if>" +
             "<if test = 'maps.type != null and maps.type==1       '> " +
-            "and (l.log_type =1 or l.log_type =2)  " +
+            "and l.integral &gt;= 0  " +
             "</if>" +
             "<if test = 'maps.type != null and maps.type==2       '> " +
-            "and (l.log_type =3 or l.log_type =4)  " +
+            "and l.integral &lt; 0  " +
             "</if>" +
             " order by l.id desc "+
             "</script>"})

+ 2 - 2
fs-service/src/main/java/com/fs/his/mapper/FsUserMapper.java

@@ -99,8 +99,8 @@ public interface FsUserMapper
             "            <if test=\"loginDevice != null  and loginDevice != ''\"> and f1.login_device = #{loginDevice}</if>\n" +
             "            <if test=\"sTime != null \">  and DATE(f1.create_time) &gt;= DATE(#{sTime})</if>\n" +
             "            <if test=\"eTime != null \">  and DATE(f1.create_time) &lt;= DATE(#{eTime})</if>\n" +
-            "            <if test=\"companyId != null \">and f1.company_id = #{companyId}</if>\n" +
-            "            <if test=\"companyUserId != null \">and f1.company_user_id = #{companyUserId}</if>\n" +
+            "            <if test=\"companyId != null \">and co.company_id = #{companyId}</if>\n" +
+            "            <if test=\"companyUserId != null \">and cuc.company_user_id = #{companyUserId}</if>\n" +
             "order by f1.user_id desc"+
             "</script>"})
     @Results({

+ 6 - 0
fs-service/src/main/java/com/fs/his/param/FsUserCouponSendParam.java

@@ -15,4 +15,10 @@ public class FsUserCouponSendParam {
 
     // 发送人id
     private Long setSendUserId;
+
+    //发送销售id
+    private Long companyUserId;
+
+    //发送销售公司id
+    private Long companyId;
 }

+ 9 - 4
fs-service/src/main/java/com/fs/his/service/impl/FsUserCouponServiceImpl.java

@@ -146,12 +146,17 @@ public class FsUserCouponServiceImpl implements IFsUserCouponService
         fsUserCoupon.setCouponCode("C"+System.currentTimeMillis());
         fsUserCoupon.setUserId(param.getUserId());
         fsUserCoupon.setCreateTime(DateUtils.getNowDate());
-        if (param.getSetSendUserId() != null){
-            fsUserCoupon.setSendUserId(param.getSetSendUserId());
+        if (param.getCompanyUserId() == null && param.getCompanyId() == null){
+            fsUserCoupon.setSendUserId(SecurityUtils.getUserId());
+            fsUserCoupon.setCompanyId(null);
+            fsUserCoupon.setCompanyUserId(null);
+            System.out.println("发送人id:"+ fsUserCoupon.getSendUserId());
         } else {
-            fsUserCoupon.setSendUserId( SecurityUtils.getUserId());
+            fsUserCoupon.setSendUserId(null);
+            fsUserCoupon.setCompanyUserId(param.getCompanyUserId());
+            fsUserCoupon.setCompanyId(param.getCompanyId());
+            System.out.println("销售发送人id:"+ fsUserCoupon.getCompanyUserId());
         }
-        System.out.println("发送人id:"+ fsUserCoupon.getSendUserId());
         fsUserCoupon.setStatus(0);
         int i = fsUserCouponMapper.insertFsUserCoupon(fsUserCoupon);
         coupon.setRemainNumber(coupon.getRemainNumber()-1);

+ 11 - 1
fs-user-app/src/main/java/com/fs/app/controller/CouponController.java

@@ -10,6 +10,8 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.enums.BusinessType;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.his.domain.FsCoupon;
 import com.fs.his.param.*;
 import com.fs.his.service.IFsCouponService;
@@ -43,6 +45,9 @@ public class CouponController extends  AppBaseController {
     @Autowired
     private IFsUserCouponService fsUserCouponService;
 
+    @Autowired
+    private ICompanyUserService companyUserService;
+
     @ApiOperation("获取优惠券列表")
     @GetMapping("/getCouponList")
     public R getCouponList(FsCouponListUParam param)
@@ -99,7 +104,12 @@ public class CouponController extends  AppBaseController {
         if(companyUserId==null){
             return AjaxResult.error("销售未登录!");
         }
-        fsUserCoupon.setSetSendUserId(companyUserId);
+        CompanyUser companyUser = companyUserService.selectCompanyUserById(companyUserId);
+        if(companyUser==null){
+            return AjaxResult.error("销售不存在!");
+        }
+        fsUserCoupon.setCompanyId(companyUser.getCompanyId());
+        fsUserCoupon.setCompanyUserId(companyUserId);
         return toAjax(fsUserCouponService.sendFsUserCoupon(fsUserCoupon));
     }