Browse Source

Merge remote-tracking branch 'origin/mall' into mall

yangdamao 2 years ago
parent
commit
79f7cdd1c3

+ 7 - 0
zhongzheng-admin-store/src/main/java/com/zhongzheng/controller/store/GoodsController.java

@@ -3,8 +3,11 @@ package com.zhongzheng.controller.store;
 import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.domain.model.TopLoginUser;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.TopTokenService;
 import com.zhongzheng.modules.goods.bo.GoodsAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsEditBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
@@ -32,6 +35,8 @@ import java.util.List;
 public class GoodsController extends BaseController {
 
     private final IGoodsService iGoodsService;
+
+    private final TopTokenService tokenService;
     /**
      * 新增题库商品
      */
@@ -60,6 +65,8 @@ public class GoodsController extends BaseController {
     @Log(title = "编辑积分商品", businessType = BusinessType.INSERT)
     @PostMapping("/updatePoints")
     public AjaxResult<Void> updatePoints(@RequestBody GoodsEditBo bo) {
+        TopLoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setOperName(loginUser.getUser().getUserName());
         return toAjax(iGoodsService.updatePointsByEditBo(bo) ? 1 : 0);
     }
 

+ 31 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -37,7 +37,9 @@ import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
 import com.zhongzheng.modules.inform.domain.InformRemind;
 import com.zhongzheng.modules.system.service.ISysConfigService;
+import com.zhongzheng.modules.top.mall.bo.TopActionLogAddBo;
 import com.zhongzheng.modules.top.mall.domain.TopStore;
+import com.zhongzheng.modules.top.mall.service.ITopActionLogService;
 import com.zhongzheng.modules.top.mall.service.ITopStoreService;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderExportVo;
 import com.zhongzheng.modules.top.user.vo.TopSysPointsRuleVo;
@@ -121,6 +123,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     private  ISysConfigService configService;
     @Autowired
     private  ITopStoreService iTopStoreService;
+    @Autowired
+    private ITopActionLogService iTopActionLogService;
 
     @Override
     public UserVo queryById(Long userId) {
@@ -1097,6 +1101,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Override
     public Boolean openVip(UserEditBo bo) {
         User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
+        if(Validator.isEmpty(user)){
+            throw new CustomException("用户不存在");
+        }
         if(Validator.isNotEmpty(user)&&(user.getVipTag()!=0)){
             throw new CustomException("该会员已开通过会员");
         }
@@ -1108,7 +1115,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         objectLambdaUpdateWrapper.set(User::getVipFrom, 6);
         objectLambdaUpdateWrapper.set(User::getVipOpenTime, DateUtils.getNowTime());
         objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
-        return this.update(null, objectLambdaUpdateWrapper);
+        if(this.update(null, objectLambdaUpdateWrapper)){
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(2);
+            addBo.setLogAction(4L);
+            addBo.setMajorId(bo.getUserId());
+            addBo.setNewContent("正常");
+            iTopActionLogService.insertByAddBo(addBo);
+            return true;
+        }
+        return false;
     }
 
     @Override
@@ -1130,6 +1146,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             objectLambdaUpdateWrapper.set(User::getVipCloseTime, DateUtils.getNowTime());
             objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
             this.update(null, objectLambdaUpdateWrapper);
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(2);
+            addBo.setLogAction(6L);
+            addBo.setMajorId(userId);
+            addBo.setOldContent("正常");
+            addBo.setNewContent("已注销");
+            iTopActionLogService.insertByAddBo(addBo);
         }
         return true;
     }
@@ -1146,6 +1169,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             objectLambdaUpdateWrapper.set(User::getVipTag, 1);
             objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
             this.update(null, objectLambdaUpdateWrapper);
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(2);
+            addBo.setLogAction(5L);
+            addBo.setMajorId(userId);
+            addBo.setOldContent("已注销");
+            addBo.setNewContent("正常");
+            iTopActionLogService.insertByAddBo(addBo);
         }
         return true;
     }

+ 3 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsEditBo.java

@@ -241,11 +241,12 @@ public class GoodsEditBo {
     @ApiModelProperty("店铺ID")
     private Long storeId;
     /** 合作商户ID */
-    @ApiModelProperty("合作商户ID")
-    private Long merId;
+/*    @ApiModelProperty("合作商户ID")
+    private Long merId;*/
     /** 关联使用类型 1积分商城 2会员卡 */
     @ApiModelProperty("关联使用类型 1积分商城 2会员卡,多个,拼接")
     private String useType;
     @ApiModelProperty("商品ID")
     private List<Long> goodsIds;
+    private String operName;
 }

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

@@ -67,6 +67,9 @@ import com.zhongzheng.modules.system.domain.SysGoodsCopyRecord;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysGoodsCopyRecordService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
+import com.zhongzheng.modules.top.mall.bo.TopActionLogAddBo;
+import com.zhongzheng.modules.top.mall.domain.TopStore;
+import com.zhongzheng.modules.top.mall.service.ITopActionLogService;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserPhoneBo;
 import com.zhongzheng.modules.user.domain.School;
@@ -263,6 +266,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
     @Autowired
     private IActivityGoodsPriceService iActivityGoodsPriceService;
 
+    @Autowired
+    private ITopActionLogService iTopActionLogService;
+
 
     @Value("${oldStudySys.educationalInspector}")
     private String INFORM_PATH;
@@ -639,6 +645,39 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
     @Override
     public Boolean updatePointsByEditBo(GoodsEditBo bo) {
+        Goods oldGoods = getOne(new LambdaQueryWrapper<Goods>()
+                .eq(Goods::getGoodsType,7)
+                .eq(Goods::getGoodsId, bo.getGoodsId()).last("limit 1"));
+        if(oldGoods.getStandPrice().compareTo(bo.getStandPrice())!=0){
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(3);
+            addBo.setLogAction(2L);
+            addBo.setMajorId(bo.getGoodsId());
+            addBo.setOldContent("商品原价:"+oldGoods.getStandPrice());
+            addBo.setNewContent("商品原价:"+bo.getStandPrice());
+            addBo.setOperName(bo.getOperName());
+            iTopActionLogService.insertByAddBo(addBo);
+        }
+        if(oldGoods.getSpecialPrice().compareTo(bo.getSpecialPrice())!=0){
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(3);
+            addBo.setLogAction(2L);
+            addBo.setMajorId(bo.getGoodsId());
+            addBo.setOldContent("会员优惠价:"+oldGoods.getSpecialPrice());
+            addBo.setNewContent("会员优惠价:"+bo.getSpecialPrice());
+            addBo.setOperName(bo.getOperName());
+            iTopActionLogService.insertByAddBo(addBo);
+        }
+        if(!oldGoods.getGoodsName().equals(bo.getGoodsName())){
+            TopActionLogAddBo addBo = new TopActionLogAddBo();
+            addBo.setLogType(3);
+            addBo.setLogAction(2L);
+            addBo.setMajorId(bo.getGoodsId());
+            addBo.setOldContent("商品名称:"+oldGoods.getGoodsName());
+            addBo.setNewContent("商品名称:"+bo.getGoodsName());
+            addBo.setOperName(bo.getOperName());
+            iTopActionLogService.insertByAddBo(addBo);
+        }
         Goods update = BeanUtil.toBean(bo, Goods.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/mall/bo/TopActionLogAddBo.java

@@ -45,4 +45,7 @@ public class TopActionLogAddBo {
     /** 操作人员 */
     @ApiModelProperty("操作人员")
     private String operName;
+    /** 主ID(商品ID,用户ID) */
+    @ApiModelProperty("主ID(商品ID,用户ID)")
+    private Long majorId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/mall/bo/TopActionLogEditBo.java

@@ -53,4 +53,7 @@ public class TopActionLogEditBo {
     @ApiModelProperty("操作人员")
     private String operName;
 
+    /** 主ID(商品ID,用户ID) */
+    @ApiModelProperty("主ID(商品ID,用户ID)")
+    private Long majorId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/mall/bo/TopActionLogQueryBo.java

@@ -57,4 +57,7 @@ public class TopActionLogQueryBo extends BaseEntity {
 	/** 操作人员 */
 	@ApiModelProperty("操作人员")
 	private String operName;
+	/** 主ID(商品ID,用户ID) */
+	@ApiModelProperty("主ID(商品ID,用户ID)")
+	private Long majorId;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/mall/domain/TopActionLog.java

@@ -46,4 +46,6 @@ private static final long serialVersionUID=1L;
     private Long logAction;
     /** 操作人员 */
     private String operName;
+    /** 主ID(商品ID,用户ID) */
+    private Long majorId;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/mall/service/impl/TopActionLogServiceImpl.java

@@ -45,6 +45,7 @@ public class TopActionLogServiceImpl extends ServiceImpl<TopActionLogMapper, Top
         lqw.eq(bo.getStatus() != null, TopActionLog::getStatus, bo.getStatus());
         lqw.eq(StrUtil.isNotBlank(bo.getLogKey()), TopActionLog::getLogKey, bo.getLogKey());
         lqw.eq(bo.getLogAction() != null, TopActionLog::getLogAction, bo.getLogAction());
+        lqw.eq(bo.getMajorId() != null, TopActionLog::getMajorId, bo.getMajorId());
         lqw.like(StrUtil.isNotBlank(bo.getOperName()), TopActionLog::getOperName, bo.getOperName());
         lqw.orderByDesc(TopActionLog::getLogId);
         return entity2Vo(this.list(lqw));

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/mall/vo/TopActionLogVo.java

@@ -53,4 +53,8 @@ public class TopActionLogVo {
 	@ApiModelProperty("操作人员")
 	private String operName;
 	private Long createTime;
+	/** 主ID(商品ID,用户ID) */
+	@Excel(name = "主ID" , readConverterExp = "商=品ID,用户ID")
+	@ApiModelProperty("主ID(商品ID,用户ID)")
+	private Long majorId;
 }

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserStudyRecordAddBo.java

@@ -92,5 +92,4 @@ public class UserStudyRecordAddBo {
     /** 相似度 */
     @ApiModelProperty("相似度")
     private Integer similarity;
-
 }

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

@@ -311,6 +311,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Integer insertByAddBo(UserStudyRecordAddBo bo) {
+        Boolean erJianErZao = false;
         CourseSectionVo courseSectionVo =iCourseSectionService.queryById(bo.getSectionId());
         //判断录播拍照是否达标
         if(courseSectionVo.getSectionType()==1&&Validator.isNotEmpty(bo.getStatus())&&bo.getStatus()==1){
@@ -321,6 +322,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                 String fullName = iCourseBusinessService.queryFullName(queryBo);
                 if(Validator.isNotEmpty(fullName)){
                     if(fullName.equals("继续教育二级建造师")||fullName.equals("继续教育二级造价师")){
+                        erJianErZao = true;
                         if(Validator.isNotEmpty(courseSectionVo.getDurationTime())||Validator.isNotEmpty(bo.getVideoCurrentTime())){
                             Long videoTime = 0L;
                             if(Validator.isNotEmpty(courseSectionVo.getDurationTime())&&courseSectionVo.getDurationTime().longValue()>0){
@@ -428,7 +430,11 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             UserStudyRecordVo lastVo = queryLast(queryBo);
             if(Validator.isEmpty(lastVo)||Validator.isNotEmpty(bo.getPhoto())||Validator.isEmpty(lastVo.getVideoCurrentTime())||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
                 //如果没有历史数据或者之前播放时长比现在晚,或者携带照片则新增观看记录
-                this.save(add);
+                if(erJianErZao&&Validator.isEmpty(bo.getPhoto())&&(lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue())){
+                    return 0;
+                }else{
+                    this.save(add);
+                }
             }else{
                 if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
                     lastVo.setStatus(1);

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/top/TopSysUserMapper.xml

@@ -116,12 +116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ${params.dataScope}
     </select>
 
-    <select id="selectUserByUserName" parameterType="String" resultType="com.zhongzheng.common.core.domain.entity.TopSysUser">
+    <select id="selectUserByUserName" parameterType="String" resultMap="TopSysUserResult">
         <include refid="selectTopUserVo"/>
         where u.user_name = #{userName} and u.`status` != -1
     </select>
 
-    <select id="selectUserById" parameterType="Long" resultType="com.zhongzheng.common.core.domain.entity.TopSysUser">
+    <select id="selectUserById" parameterType="Long" resultMap="TopSysUserResult">
         <include refid="selectTopUserVo"/>
         where u.user_id = #{userId}
     </select>