Bläddra i källkod

计划生成修改

change 4 år sedan
förälder
incheckning
652258d391

+ 16 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/activity/PlanController.java

@@ -7,6 +7,7 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.controller.wx.WxLoginController;
 import com.zhongzheng.controller.wx.WxLoginController;
 import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.modules.activity.bo.ActivityTaskQueryBo;
 import com.zhongzheng.modules.activity.bo.ActivityTaskQueryBo;
+import com.zhongzheng.modules.activity.bo.ActivityTaskUserAddBo;
 import com.zhongzheng.modules.activity.service.IActivityTaskService;
 import com.zhongzheng.modules.activity.service.IActivityTaskService;
 import com.zhongzheng.modules.activity.vo.ActivityTaskVo;
 import com.zhongzheng.modules.activity.vo.ActivityTaskVo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
@@ -17,9 +18,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -64,5 +63,19 @@ public class PlanController extends BaseController {
     }
     }
 
 
 
 
+    /**
+     * 修改任务
+     */
+    @ApiOperation("修改计划")
+    @PostMapping("/updateGenerate")
+    public AjaxResult<Void> updateGenerate(UserPlanQueryBo bo) throws ParseException {
+        ClientLoginUser loginUser = WxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return toAjax(userPlanService.updateGenerate(bo) ? 1 : 0);
+    }
+
+
+
+
 
 
 }
 }

+ 15 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -8,11 +8,13 @@ import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.user.bo.UserAddBo;
 import com.zhongzheng.modules.user.bo.UserAddBo;
 import com.zhongzheng.modules.user.bo.UserEditBo;
 import com.zhongzheng.modules.user.bo.UserEditBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
 import com.zhongzheng.modules.user.vo.UserVo;
 import com.zhongzheng.modules.user.vo.UserVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -70,4 +72,17 @@ public class UserController extends BaseController {
         return AjaxResult.success(map);
         return AjaxResult.success(map);
     }
     }
 
 
+    /**
+     * 收藏数等数据
+     */
+    @ApiOperation("收藏数等数据")
+    @GetMapping("/rankingList")
+    public TableDataInfo<UserVo> rankingList(UserQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<UserVo> list = iUserService.rankingList(bo);
+        return getDataTable(list);
+    }
+
 }
 }

+ 5 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -161,4 +161,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 .eq(CollectNote::getUserId,userId));
                 .eq(CollectNote::getUserId,userId));
         return collectCourse+collectBank+collectNote;
         return collectCourse+collectBank+collectNote;
     }
     }
+
+    @Override
+    public List<UserVo> rankingList(UserQueryBo bo) {
+        return null;
+    }
 }
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserPlanQueryBo.java

@@ -37,6 +37,9 @@ public class UserPlanQueryBo extends BaseEntity {
 	private String isAsc;
 	private String isAsc;
 
 
 
 
+	/** 计划json格式 */
+	@ApiModelProperty("计划Id")
+	private Long planId;
 	/** 计划json格式 */
 	/** 计划json格式 */
 	@ApiModelProperty("计划json格式")
 	@ApiModelProperty("计划json格式")
 	private String schedule;
 	private String schedule;
@@ -63,7 +66,7 @@ public class UserPlanQueryBo extends BaseEntity {
 	@ApiModelProperty("起始时间")
 	@ApiModelProperty("起始时间")
 	private Long startTime;
 	private Long startTime;
 	/** 0 失效 1启用 */
 	/** 0 失效 1启用 */
-	@ApiModelProperty("0 失效 1启用")
+	@ApiModelProperty("0 失效 1启用  2修改计划")
 	private Integer status;
 	private Integer status;
 	/** 总结数 */
 	/** 总结数 */
 	@ApiModelProperty("总结数")
 	@ApiModelProperty("总结数")

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserQueryBo.java

@@ -37,6 +37,9 @@ public class UserQueryBo extends BaseEntity {
 	private String isAsc;
 	private String isAsc;
 
 
 
 
+	/** 用户名 */
+	@ApiModelProperty("用户名")
+	private Long userId;
 	/** 账号 */
 	/** 账号 */
 	@ApiModelProperty("账号")
 	@ApiModelProperty("账号")
 	private String userAccout;
 	private String userAccout;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserPlanService.java

@@ -60,4 +60,6 @@ public interface IUserPlanService extends IService<UserPlan> {
 	UserPlanVo generate(UserPlanQueryBo bo) throws ParseException;
 	UserPlanVo generate(UserPlanQueryBo bo) throws ParseException;
 
 
 	UserPlanVo userPlan(UserPlanQueryBo bo);
 	UserPlanVo userPlan(UserPlanQueryBo bo);
+
+	Boolean updateGenerate(UserPlanQueryBo bo) throws ParseException;
 }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -56,4 +56,6 @@ public interface IUserService extends IService<User> {
 
 
 
 
 	Integer getCollectTotal(Long userId);
 	Integer getCollectTotal(Long userId);
+
+    List<UserVo> rankingList(UserQueryBo bo);
 }
 }

+ 111 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -4,14 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.google.gson.JsonArray;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
 import com.zhongzheng.modules.exam.vo.ExamArrangementTimeVo;
 import com.zhongzheng.modules.user.vo.CalendarStudyVo;
 import com.zhongzheng.modules.user.vo.CalendarStudyVo;
 import com.zhongzheng.modules.user.vo.CoursePlanVo;
 import com.zhongzheng.modules.user.vo.CoursePlanVo;
 import com.zhongzheng.modules.user.vo.DayStudyVo;
 import com.zhongzheng.modules.user.vo.DayStudyVo;
 import io.micrometer.core.instrument.util.TimeUtils;
 import io.micrometer.core.instrument.util.TimeUtils;
-import org.codehaus.jettison.json.JSONArray;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -126,7 +128,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
             if (bo.getStatus() != null && bo.getStatus() == 1){
             if (bo.getStatus() != null && bo.getStatus() == 1){
                 UserPlan userPlan = new UserPlan();
                 UserPlan userPlan = new UserPlan();
                 String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
                 String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
-                String s1 = JSON.toJSONString(userPlanVo);
+                String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
 
 
                 userPlan.setStudyDay(bo.getStudyDay());
                 userPlan.setStudyDay(bo.getStudyDay());
                 userPlan.setStudyCount(s1);
                 userPlan.setStudyCount(s1);
@@ -139,7 +141,13 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                 if (bo.getStatus() != null){
                 if (bo.getStatus() != null){
                     userPlan.setStatus(bo.getStatus());
                     userPlan.setStatus(bo.getStatus());
                 }
                 }
-                boolean save = this.save(userPlan);
+                if (bo.getStatus() == 1) {
+                    boolean save = this.save(userPlan);
+                }
+                if (bo.getStatus() == 2){
+                    userPlan.setPlanId(bo.getPlanId());
+                    boolean save = this.updateById(userPlan);
+                }
             }
             }
             return userPlanVo;
             return userPlanVo;
         }else{
         }else{
@@ -147,7 +155,7 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
             if (bo.getStatus() != null && bo.getStatus() == 1) {
             if (bo.getStatus() != null && bo.getStatus() == 1) {
                 UserPlan userPlan = new UserPlan();
                 UserPlan userPlan = new UserPlan();
                 String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
                 String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
-                String s1 = JSON.toJSONString(userPlanVo);
+                String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
 
 
                 userPlan.setStudyDay(bo.getStudyDay());
                 userPlan.setStudyDay(bo.getStudyDay());
                 userPlan.setStudyCount(s1);
                 userPlan.setStudyCount(s1);
@@ -165,7 +173,13 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
                 if (bo.getStatus() != null){
                 if (bo.getStatus() != null){
                     userPlan.setStatus(bo.getStatus());
                     userPlan.setStatus(bo.getStatus());
                 }
                 }
-                boolean save = this.save(userPlan);
+                if (bo.getStatus() == 1) {
+                    boolean save = this.save(userPlan);
+                }
+                if (bo.getStatus() == 2){
+                    userPlan.setPlanId(bo.getPlanId());
+                    boolean save = this.updateById(userPlan);
+                }
             }
             }
             return userPlanVo;
             return userPlanVo;
         }
         }
@@ -173,8 +187,98 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
 
 
     @Override
     @Override
     public UserPlanVo userPlan(UserPlanQueryBo bo) {
     public UserPlanVo userPlan(UserPlanQueryBo bo) {
-        UserPlan UserPlan = baseMapper.selectByUserPlan(bo);
-        return null;
+        UserPlan userPlan = baseMapper.selectByUserPlan(bo);
+        UserPlanVo userPlanVo = new UserPlanVo();
+        userPlanVo.setUserId(userPlan.getUserId());
+        userPlanVo.setExamDate(userPlan.getExamDate());
+        userPlanVo.setReminderTime(userPlan.getReminderTime());
+        userPlanVo.setStudyDay(userPlan.getStudyDay());
+        userPlanVo.setStartTime(userPlan.getStartTime());
+        userPlanVo.setEndTime(userPlan.getEndTime());
+        userPlanVo.setPitchNum(userPlan.getPitchNum());
+        userPlanVo.setStudyNum(userPlan.getStudyNum());
+
+        List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
+        List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
+        Long[] strings = new Long[cont.size()];
+        cont.toArray(strings);
+        userPlanVo.setCalendarStudyVo(calendarStudyVos);
+        userPlanVo.setStudyCount(strings);
+        userPlanVo.setCoursePlanVo(null);
+
+        return userPlanVo;
+    }
+
+    @Override
+    public Boolean updateGenerate(UserPlanQueryBo bo) throws ParseException {
+        if (bo.getStatus() == 0) {
+            UserPlan userPlan = new UserPlan();
+            userPlan.setPlanId(bo.getPlanId());
+            userPlan.setStatus(0);
+            int i = baseMapper.updateById(userPlan);
+        }else {
+            //自定义学习计划,自动生成计划
+            if (bo.getCourseId() != null && bo.getStudyCount() == null) {
+                UserPlanVo userPlanVo = generateSelf(bo);
+                if (bo.getStatus() != null && bo.getStatus() == 1) {
+                    UserPlan userPlan = new UserPlan();
+                    String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
+                    String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
+
+                    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);
+                    }
+                    if (bo.getStatus() == 2) {
+                        userPlan.setPlanId(bo.getPlanId());
+                        boolean save = this.updateById(userPlan);
+                    }
+                }
+            } else {
+                UserPlanVo userPlanVo = generateSelfBo(bo);
+                if (bo.getStatus() != null && bo.getStatus() == 1) {
+                    UserPlan userPlan = new UserPlan();
+                    String s = JSON.toJSONString(userPlanVo.getCalendarStudyVo());
+                    String s1 = JSON.toJSONString(userPlanVo.getStudyCount());
+
+                    userPlan.setStudyDay(bo.getStudyDay());
+                    userPlan.setStudyCount(s1);
+                    userPlan.setUserId(bo.getUserId());
+                    userPlan.setSchedule(s);
+                    userPlan.setExamDate(bo.getExamDate());
+                    userPlan.setReminderTime(bo.getReminderTime());
+                    userPlan.setPitchNum(userPlanVo.getPitchNum());
+                    userPlan.setStudyNum(0L);
+                    userPlan.setCreateTime(DateUtils.getNowTime());
+                    userPlan.setUpdateTime(DateUtils.getNowTime());
+                    userPlan.setStartTime(bo.getStartTime());
+                    userPlan.setEndTime(bo.getEndTime());
+                    userPlan.setStudyDay(bo.getStudyDay());
+                    if (bo.getStatus() != null) {
+                        userPlan.setStatus(bo.getStatus());
+                    }
+                    if (bo.getStatus() == 1) {
+                        boolean save = this.save(userPlan);
+                    }
+                    if (bo.getStatus() == 2) {
+                        userPlan.setPlanId(bo.getPlanId());
+                        boolean save = this.updateById(userPlan);
+                    }
+                }
+            }
+
+        }
+        return true;
     }
     }
 
 
     private UserPlanVo generateSelfBo(UserPlanQueryBo bo) throws ParseException {
     private UserPlanVo generateSelfBo(UserPlanQueryBo bo) throws ParseException {

+ 165 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/RanKingUser.java

@@ -0,0 +1,165 @@
+package com.zhongzheng.modules.user.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.common.utils.TelPhoneUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 用户视图对象 mall_package
+ *
+ * @author change
+ * @date 2021-05-25
+ */
+@Data
+@ApiModel("用户视图对象")
+public class RanKingUser {
+    private static final long serialVersionUID = 1L;
+
+    /** $pkColumn.columnComment */
+    @ApiModelProperty("$pkColumn.columnComment")
+    private Long userId;
+
+    /** 账号 */
+    @Excel(name = "账号")
+    @ApiModelProperty("账号")
+    private String userAccout;
+    /** 昵称 */
+    @Excel(name = "昵称")
+    @ApiModelProperty("昵称")
+    private String nickname;
+    /** 真实姓名 */
+    @Excel(name = "真实姓名")
+    @ApiModelProperty("真实姓名")
+    private String realname;
+    /** 性别 */
+    @Excel(name = "性别")
+    @ApiModelProperty("性别")
+    private Integer sex;
+    /** 身份证号 */
+    @Excel(name = "身份证号")
+    @ApiModelProperty("身份证号")
+    private String idCard;
+    /** 手机号码 */
+    @Excel(name = "手机号码")
+    @ApiModelProperty("手机号码")
+    private String telphone;
+    /** 用户等级 */
+    @Excel(name = "用户等级")
+    @ApiModelProperty("用户等级")
+    private Integer userLevel;
+    /** 出生日期 */
+    @Excel(name = "出生日期")
+    @ApiModelProperty("出生日期")
+    private String userBirth;
+    /** 教育层次 */
+    @Excel(name = "教育层次")
+    @ApiModelProperty("教育层次")
+    private String eduLevel;
+    /** 学校ID */
+    @Excel(name = "学校ID")
+    @ApiModelProperty("学校ID")
+    private Long schoolId;
+    /** 专业 */
+    @Excel(name = "专业")
+    @ApiModelProperty("专业")
+    private String major;
+    /** 入学时间 */
+    @Excel(name = "入学时间")
+    @ApiModelProperty("入学时间")
+    private Long entranceTime;
+    /** $column.columnComment */
+    @Excel(name = "入学时间")
+    @ApiModelProperty("$column.columnComment")
+    private String openId;
+    /** 学籍证明照片 */
+    @Excel(name = "学籍证明照片")
+    @ApiModelProperty("学籍证明照片")
+    private String studentCertificateImg;
+    /** 身份证人像照 */
+    @Excel(name = "身份证人像照")
+    @ApiModelProperty("身份证人像照")
+    private String idCardImg1;
+    /** 身份证国徽照 */
+    @Excel(name = "身份证国徽照")
+    @ApiModelProperty("身份证国徽照")
+    private String idCardImg2;
+    /** 国家 */
+    @Excel(name = "国家")
+    @ApiModelProperty("国家")
+    private String country;
+    /** 省份 */
+    @Excel(name = "省份")
+    @ApiModelProperty("省份")
+    private String province;
+    /** 城市 */
+    @Excel(name = "城市")
+    @ApiModelProperty("城市")
+    private String city;
+    /** 用户积分 */
+    @Excel(name = "用户积分")
+    @ApiModelProperty("用户积分")
+    private Long integral;
+    /** 状态 1正常 0关闭 */
+    @Excel(name = "状态 1正常 0关闭")
+    @ApiModelProperty("状态 1正常 0关闭")
+    private Integer status;
+    @ApiModelProperty("是否人脸认证成功  1成功 0没有")
+    private Integer certified;
+    @ApiModelProperty("人脸认证时间")
+    private Long certifiedTime;
+    /** 区 */
+    @Excel(name = "区")
+    @ApiModelProperty("区")
+    private String district;
+    /** 结婚状态 */
+    @Excel(name = "结婚状态")
+    @ApiModelProperty("结婚状态")
+    private String marry;
+    /** 户籍省份 */
+    @Excel(name = "户籍省份")
+    @ApiModelProperty("户籍省份")
+    private String houseProvince;
+    /** 户籍城市 */
+    @Excel(name = "户籍城市")
+    @ApiModelProperty("户籍城市")
+    private String houseCity;
+    /** 户籍区 */
+    @Excel(name = "户籍区")
+    @ApiModelProperty("户籍区")
+    private String houseDistrict;
+    /** 一寸照片 */
+    @Excel(name = "一寸照片")
+    @ApiModelProperty("一寸照片")
+    private String oneInchPhotos;
+    /** 政治面貌 */
+    @Excel(name = "政治面貌")
+    @ApiModelProperty("政治面貌")
+    private String politic;
+    /** 邮箱 */
+    @Excel(name = "邮箱")
+    @ApiModelProperty("邮箱")
+    private String email;
+    /** 头像 */
+    @Excel(name = "头像")
+    @ApiModelProperty("头像")
+    private String avatar;
+
+    public void setNull(){
+        this.setOpenId(null);
+        this.setIdCardImg1(null);
+        this.setIdCardImg2(null);
+        this.setCertifiedTime(null);
+        if(this.getTelphone()!=null){
+            this.setTelphone(TelPhoneUtils.hideTelPhone(this.getTelphone()));
+        }
+		/*if(this.getIdCard()!=null){
+			this.setIdCard(TelPhoneUtils.hideTelPhone(this.getIdCard()));
+		}*/
+    }
+}