change 3 жил өмнө
parent
commit
20ed26d66e

+ 1 - 8
zhongzheng-api/src/main/java/com/zhongzheng/controller/base/ProfileTpController.java

@@ -90,15 +90,8 @@ public class ProfileTpController extends BaseController {
     public AjaxResult<UserProfileVo> getInfo(UserProfileQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        bo.setTypeStatus(1L);
         return AjaxResult.success(iUserProfileService.getInfo(bo));
     }
 
-    @ApiOperation("导出word七大员")
-    @PostMapping("/addWord")
-    public AjaxResult<Void> addWord(@RequestBody UserProfileAddBo bo) {
-        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
-        bo.setUserId(loginUser.getUser().getUserId());
-        String s = iUserProfileService.addWord(bo);
-        return AjaxResult.success(s);
-    }
 }

+ 1 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/plan/UserPlanController.java

@@ -81,7 +81,7 @@ public class UserPlanController extends BaseController {
      */
     @ApiOperation("获得七天活动计划")
     @GetMapping("/userPlanSeven")
-    public AjaxResult<UserPlanVo> userPlanSeven(UserPlanQueryBo bo) throws ParseException {
+    public AjaxResult<List<UserPlanVo>> userPlanSeven(UserPlanQueryBo bo) throws ParseException {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
         return AjaxResult.success(iUserPlanService.userPlanSeven(bo));

+ 23 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/UserProfileFit.java

@@ -0,0 +1,23 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.zhongzheng.modules.base.bo;
+
+import lombok.Data;
+
+/**
+ * Auto-generated: 2021-12-21 11:36:39
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+@Data
+public class UserProfileFit {
+
+    private String fieldKey;
+    private String value;
+    private String fieldName;
+    private int status;
+
+
+}

+ 24 - 15
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -8,8 +8,10 @@ import cn.hutool.extra.template.TemplateConfig;
 import cn.hutool.extra.template.TemplateEngine;
 import cn.hutool.extra.template.TemplateUtil;
 import cn.hutool.poi.word.Word07Writer;
+import com.alibaba.fastjson.JSONObject;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
+import com.zhongzheng.modules.base.bo.UserProfileFit;
 import org.apache.poi.xwpf.usermodel.BreakType;
 import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
 import org.springframework.stereotype.Service;
@@ -133,27 +135,34 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
 
     @Override
     public String addWord(UserProfileAddBo bo) {
+        UserProfileQueryBo userProfileQueryBo = new UserProfileQueryBo();
+        userProfileQueryBo.setUserId(bo.getUserId());
+        userProfileQueryBo.setGoodsId(bo.getGoodsId());
+        UserProfileVo info = baseMapper.getInfo(userProfileQueryBo);
+        //第一种方式
+        Map<String, String> maps = JSONObject.parseObject(info.getKeyValue(),Map.class);
+        JSONObject name = JSONObject.parseObject(maps.get("name"));
         //默认配置就够用了
         TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH));
         Template template = engine.getTemplate("word.ftl");
         //给STRING_TEMPLATE绑定数据
         Map<String, Object> bindingMap = new HashMap<>();
-        bindingMap.put("name", "zhou");
-        bindingMap.put("s", "niu");
-        bindingMap.put("post", "niu");
-        bindingMap.put("idcard", "niu");
-        bindingMap.put("phone", "niu");
-        bindingMap.put("school", "niu");
-        bindingMap.put("edu", "niu");
-        bindingMap.put("major", "niu");
-        bindingMap.put("cname", "niu");
-        bindingMap.put("cphone", "niu");
+/*        bindingMap.put("name", maps.get("name").getValue());
+        bindingMap.put("s", maps.get("sex").getValue());
+        bindingMap.put("post", maps.get("apply_post").getValue());
+        bindingMap.put("idcard", maps.get("idcard").getValue());
+        bindingMap.put("phone", maps.get("telphone").getValue());
+        bindingMap.put("school", maps.get("school").getValue());
+        bindingMap.put("edu", maps.get("education").getValue());
+        bindingMap.put("major", maps.get("major").getValue());
+        bindingMap.put("cname", maps.get("unit_contact").getValue());
+        bindingMap.put("cphone", maps.get("unit_tel").getValue());
         bindingMap.put("image",  Image2Base64("https://file-dev.xyyxt.net/oss/images/avatar/20211220/1639989015718_1121154924"));
-        bindingMap.put("y", "niu");
-        bindingMap.put("m", "niu");
-        bindingMap.put("d", "niu");
-        bindingMap.put("time", "niu");
-        bindingMap.put("year", "niu");
+        bindingMap.put("y", maps.get("education").getValue());
+        bindingMap.put("m", maps.get("education").getValue());
+        bindingMap.put("d", maps.get("education").getValue());
+        bindingMap.put("time", maps.get("graduation_time").getValue());
+        bindingMap.put("year", maps.get("working_years").getValue());*/
         //最终渲染出来的样子
         template.render(bindingMap,new File("D:\\Download/20211214.docx"));
         return "11";

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/UserProfileVo.java

@@ -29,6 +29,11 @@ public class UserProfileVo {
 	@ApiModelProperty("用户ID")
 	private Long userId;
 
+	/** 用户ID */
+	@Excel(name = "用户ID")
+	@ApiModelProperty("用户ID")
+	private Long sex;
+
 	/** 商品名称 */
 	@Excel(name = "商品名称")
 	@ApiModelProperty("商品名称")

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

@@ -57,5 +57,5 @@ public interface IUserPlanService extends IService<UserPlan> {
 
 	List<GoodsVo> listGoods(UserPlanQueryBo bo);
 
-	UserPlanVo userPlanSeven(UserPlanQueryBo bo) throws ParseException;
+	List<UserPlanVo> userPlanSeven(UserPlanQueryBo bo) throws ParseException;
 }

+ 70 - 54
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -626,67 +626,83 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
     }
 
     @Override
-    public UserPlanVo userPlanSeven(UserPlanQueryBo bo) throws ParseException {
-        UserPlan userPlan = this.baseMapper.selectById(bo.getPlanId());
-        //得到日历日期
-        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());
-        userPlanVo.setPlanId(userPlan.getPlanId());
-        List<GoodsUserVo> goodsVos = userPlanGoodsService.selectGoods(bo.getPlanId(),bo.getUserId());
-        userPlanVo.setGoodsVos(goodsVos);
-        // List转成数组
-        Long[] array = new Long[goodsVos.size()];
-        // 输出数组
-        List<Long> arrys = new ArrayList<>();
-        for (GoodsUserVo goodsVo : goodsVos) {
-            arrys.add(goodsVo.getGoodsId());
-        }
-        arrys.toArray(array);
-        userPlanVo.setGoodsId(array);
-        //得到日历日期
-        List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
+    public List<UserPlanVo> userPlanSeven(UserPlanQueryBo bo) throws ParseException {
+        LambdaQueryWrapper<UserPlan> lqw = Wrappers.lambdaQuery();
+        lqw.eq(StrUtil.isNotBlank(bo.getSchedule()), UserPlan::getSchedule, bo.getSchedule());
+        lqw.eq(bo.getUserId() != null, UserPlan::getUserId, bo.getUserId());
+        lqw.eq(bo.getExamDate() != null, UserPlan::getExamDate, bo.getExamDate());
+        lqw.eq(StrUtil.isNotBlank(bo.getReminderTime()), UserPlan::getReminderTime, bo.getReminderTime());
+        lqw.eq(StrUtil.isNotBlank(bo.getStudyCount()), UserPlan::getStudyCount, bo.getStudyCount());
+        lqw.eq(bo.getStudyDay() != null, UserPlan::getStudyDay, bo.getStudyDay());
+        lqw.eq(bo.getEndTime() != null, UserPlan::getEndTime, bo.getEndTime());
+        lqw.eq(bo.getStartTime() != null, UserPlan::getStartTime, bo.getStartTime());
+        lqw.in(bo.getStatus() != null, UserPlan::getStatus, bo.getStatus());
+        lqw.eq(bo.getPitchNum() != null, UserPlan::getPitchNum, bo.getPitchNum());
+        lqw.eq(bo.getStudyNum() != null, UserPlan::getStudyNum, bo.getStudyNum());
+        List<UserPlan> userPlans = this.list(lqw);
+        List<UserPlanVo> userPlanVos = new ArrayList<>();
+        for (UserPlan userPlan : userPlans) {
+            //得到日历日期
+            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());
+            userPlanVo.setPlanId(userPlan.getPlanId());
+            List<GoodsUserVo> goodsVos = userPlanGoodsService.selectGoods(bo.getPlanId(), bo.getUserId());
+            userPlanVo.setGoodsVos(goodsVos);
+            // List转成数组
+            Long[] array = new Long[goodsVos.size()];
+            // 输出数组
+            List<Long> arrys = new ArrayList<>();
+            for (GoodsUserVo goodsVo : goodsVos) {
+                arrys.add(goodsVo.getGoodsId());
+            }
+            arrys.toArray(array);
+            userPlanVo.setGoodsId(array);
+            //得到日历日期
+            List<CalendarStudyVo> calendarStudyVos = JSONObject.parseArray(userPlan.getSchedule(), CalendarStudyVo.class);
 
-        Calendar cal=Calendar.getInstance();
-        cal.add(Calendar.WEEK_OF_MONTH, 0);
-        cal.set(Calendar.DAY_OF_WEEK, 2);
-        Long timeInMillisStart = cal.getTimeInMillis()/1000-86400;
-        Calendar cal2=Calendar.getInstance();
-        cal2.set(Calendar.DAY_OF_WEEK, cal.getActualMaximum(Calendar.DAY_OF_WEEK));
-        cal2.add(Calendar.DAY_OF_WEEK, 1);
-        Long timeInMillis = cal2.getTimeInMillis()/1000;
-        List<CalendarStudyVo> sevenDates = findSevenDates(timeInMillisStart, timeInMillis);
-        for (CalendarStudyVo sevenDate : sevenDates) {
-            for (DayStudyVo dayStudyVo : sevenDate.getDayStudyList()) {
-                List<CalendarStudyVo> collect = calendarStudyVos.stream().filter(CalendarStudyVo -> CalendarStudyVo.getMonth().equals(sevenDate.getMonth())).collect(Collectors.toList());
-                if (!CollectionUtils.isEmpty(collect)) {
-                    for (CalendarStudyVo calendarStudyVo : collect) {
-                        for (DayStudyVo studyVo : calendarStudyVo.getDayStudyList()) {
-                            if (studyVo.getDate().equals(dayStudyVo.getDate())){
-                                dayStudyVo.setStudyCourseKnob(studyVo.getStudyCourseKnob());
-                                dayStudyVo.setPerform(studyVo.getPerform());
-                                dayStudyVo.setDaySectionList(studyVo.getDaySectionList());
-                                break;
+            Calendar cal = Calendar.getInstance();
+            cal.add(Calendar.WEEK_OF_MONTH, 0);
+            cal.set(Calendar.DAY_OF_WEEK, 2);
+            Long timeInMillisStart = cal.getTimeInMillis() / 1000 - 86400;
+            Calendar cal2 = Calendar.getInstance();
+            cal2.set(Calendar.DAY_OF_WEEK, cal.getActualMaximum(Calendar.DAY_OF_WEEK));
+            cal2.add(Calendar.DAY_OF_WEEK, 1);
+            Long timeInMillis = cal2.getTimeInMillis() / 1000;
+            List<CalendarStudyVo> sevenDates = findSevenDates(timeInMillisStart, timeInMillis);
+            for (CalendarStudyVo sevenDate : sevenDates) {
+                for (DayStudyVo dayStudyVo : sevenDate.getDayStudyList()) {
+                    List<CalendarStudyVo> collect = calendarStudyVos.stream().filter(CalendarStudyVo -> CalendarStudyVo.getMonth().equals(sevenDate.getMonth())).collect(Collectors.toList());
+                    if (!CollectionUtils.isEmpty(collect)) {
+                        for (CalendarStudyVo calendarStudyVo : collect) {
+                            for (DayStudyVo studyVo : calendarStudyVo.getDayStudyList()) {
+                                if (studyVo.getDate().equals(dayStudyVo.getDate())) {
+                                    dayStudyVo.setStudyCourseKnob(studyVo.getStudyCourseKnob());
+                                    dayStudyVo.setPerform(studyVo.getPerform());
+                                    dayStudyVo.setDaySectionList(studyVo.getDaySectionList());
+                                    break;
+                                }
                             }
                         }
                     }
                 }
             }
-        }
-        //得到学习的周
-        List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
-        Long[] strings = new Long[cont.size()];
-        cont.toArray(strings);
+            //得到学习的周
+            List<Long> cont = JSONObject.parseArray(userPlan.getStudyCount(), Long.class);
+            Long[] strings = new Long[cont.size()];
+            cont.toArray(strings);
 
-        userPlanVo.setCalendarStudyVo(sevenDates);
-        userPlanVo.setStudyCount(strings);
-        return userPlanVo;
+            userPlanVo.setCalendarStudyVo(sevenDates);
+            userPlanVo.setStudyCount(strings);
+            userPlanVos.add(userPlanVo);
+        }
+        return userPlanVos;
     }
 
 

+ 8 - 2
zhongzheng-system/src/main/resources/mapper/modules/base/UserProfileMapper.xml

@@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id" column="id"/>
         <result property="userId" column="user_id"/>
         <result property="goodsId" column="goods_id"/>
+        <result property="sex" column="sex"/>
         <result property="status" column="status"/>
         <result property="oneTime" column="one_time"/>
         <result property="lastTime" column="last_time"/>
@@ -103,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
         up.*,
         (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,
+        (SELECT u.sex FROM `user` u where u.user_id = up.user_id) as sex,
         (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,
         (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,
         (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,
@@ -115,7 +117,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         user_profile up
         where 1=1
           and up.current_status = 1
-        and up.type_status = 1
+        <if test="typeStatus != null and typeStatus !='' ">
+            and up.type_status = #{typeStatus}
+        </if>
         <if test="status != null and status.size()!=0 ">
             AND up.status in
             <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
@@ -149,7 +153,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
         user_profile up
         where 1=1
-        and up.type_status = 1
+        <if test="typeStatus != null and typeStatus !='' ">
+            and up.type_status = #{typeStatus}
+        </if>
         <if test="status != null and status.size()!=0 ">
             AND up.status in
             <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">