Browse Source

添加训练题的训练目标等

master
zhizhi wu 4 years ago
parent
commit
54188e27b3
  1. 2
      bjyy-core/src/main/resources/prod/redis.properties
  2. 4
      bjyy-core/src/main/resources/prod/wechat.properties
  3. 42
      bjyy-dal/src/main/java/com/wmeimob/bjyy/mapping/TrainDao.xml
  4. 18
      bjyy-dal/src/main/java/com/wmeimob/bjyy/vo/TrainVo.java
  5. 2
      bjyy-weixin/src/main/java/com/wmeimob/bjyy/controller/MentalController.java
  6. 8
      bjyy-weixin/src/main/java/com/wmeimob/bjyy/controller/PracticeController.java
  7. 38
      bjyy-weixin/src/main/java/com/wmeimob/bjyy/service/impl/TrainServiceImpl.java
  8. 22
      bjyy-weixin/src/main/webapp/WEB-INF/pages/mental/practice.jsp
  9. 1
      bjyy-weixin/src/main/webapp/static/css/style.css
  10. BIN
      bjyy-weixin/src/main/webapp/static/train/1.1.1.jpg
  11. BIN
      bjyy-weixin/src/main/webapp/static/train/1.15.1.jpg
  12. BIN
      bjyy-weixin/src/main/webapp/static/train/1.2.1.jpg
  13. BIN
      bjyy-weixin/src/main/webapp/static/train/1.7.1.jpg
  14. BIN
      bjyy-weixin/src/main/webapp/static/train/10.10.1.jpg
  15. BIN
      bjyy-weixin/src/main/webapp/static/train/10.5.1.jpg
  16. BIN
      bjyy-weixin/src/main/webapp/static/train/6.1.1.jpg
  17. BIN
      bjyy-weixin/src/main/webapp/static/train/6.1.2.jpg
  18. BIN
      bjyy-weixin/src/main/webapp/static/train/6.2.1.jpg
  19. BIN
      bjyy-weixin/src/main/webapp/static/train/6.2.2.jpg
  20. BIN
      bjyy-weixin/src/main/webapp/static/train/6.3.1.jpg
  21. BIN
      bjyy-weixin/src/main/webapp/static/train/6.3.2.jpg
  22. BIN
      bjyy-weixin/src/main/webapp/static/train/6.3.3.jpg
  23. BIN
      bjyy-weixin/src/main/webapp/static/train/6.3.4.jpg
  24. BIN
      bjyy-weixin/src/main/webapp/static/train/6.3.5.jpg
  25. BIN
      bjyy-weixin/src/main/webapp/static/train/6.4.1..jpg
  26. BIN
      bjyy-weixin/src/main/webapp/static/train/6.4.2.jpg
  27. BIN
      bjyy-weixin/src/main/webapp/static/train/6.4.3.jpg
  28. BIN
      bjyy-weixin/src/main/webapp/static/train/6.4.4.jpg
  29. BIN
      bjyy-weixin/src/main/webapp/static/train/6.4.5.jpg
  30. BIN
      bjyy-weixin/src/main/webapp/static/train/6.5.1.jpg
  31. BIN
      bjyy-weixin/src/main/webapp/static/train/6.5.2.jpg
  32. BIN
      bjyy-weixin/src/main/webapp/static/train/6.5.3.jpg
  33. BIN
      bjyy-weixin/src/main/webapp/static/train/7.1.1.jpg
  34. BIN
      bjyy-weixin/src/main/webapp/static/train/7.1.2.jpg
  35. BIN
      bjyy-weixin/src/main/webapp/static/train/7.2.1.jpg
  36. BIN
      bjyy-weixin/src/main/webapp/static/train/7.2.2.jpg
  37. BIN
      bjyy-weixin/src/main/webapp/static/train/7.3.1.jpg
  38. BIN
      bjyy-weixin/src/main/webapp/static/train/7.3.2.jpg
  39. BIN
      bjyy-weixin/src/main/webapp/static/train/7.3.3.jpg
  40. BIN
      bjyy-weixin/src/main/webapp/static/train/7.3.4.jpg
  41. BIN
      bjyy-weixin/src/main/webapp/static/train/7.3.5.jpg
  42. BIN
      bjyy-weixin/src/main/webapp/static/train/7.4.1.jpg
  43. BIN
      bjyy-weixin/src/main/webapp/static/train/7.4.2.jpg
  44. BIN
      bjyy-weixin/src/main/webapp/static/train/7.4.3.jpg
  45. BIN
      bjyy-weixin/src/main/webapp/static/train/7.4.4.jpg
  46. BIN
      bjyy-weixin/src/main/webapp/static/train/7.4.5.jpg
  47. BIN
      bjyy-weixin/src/main/webapp/static/train/7.5.1.jpg
  48. BIN
      bjyy-weixin/src/main/webapp/static/train/7.5.2.jpg
  49. BIN
      bjyy-weixin/src/main/webapp/static/train/7.5.3.jpg
  50. BIN
      bjyy-weixin/src/main/webapp/static/train/8.6.1.jpg
  51. BIN
      bjyy-weixin/src/main/webapp/static/train/8.7.1.jpg
  52. BIN
      bjyy-weixin/src/main/webapp/static/train/8.8.1.jpg
  53. BIN
      bjyy-weixin/src/main/webapp/static/train/8.9.1.jpg

2
bjyy-core/src/main/resources/prod/redis.properties

@ -1,5 +1,5 @@
redis.host=127.0.0.1
redis.port=6379
#redis.password=keepAwayFromGithub&CodeSave
redis.password=areowqr!@43ef
redis.password=
redis.index=1

4
bjyy-core/src/main/resources/prod/wechat.properties

@ -10,5 +10,5 @@ wechat.CallbackDomain=https://www.tall.wiki
filePath=/home/staticrec/
domain=https://www.tall.wiki/
logoPath=/home/tomcat/apache-tomcat-8.5.61/webapps/bjyy-weixin/static/images/logo.jpg
projectPath=/home/tomcat/apache-tomcat-8.5.61/webapps/bjyy-weixin/
logoPath=/home/apache-tomcat-8.5.61/webapps/bjyy-weixin/static/images/logo.jpg
projectPath=/home/apache-tomcat-8.5.61/webapps/bjyy-weixin/

42
bjyy-dal/src/main/java/com/wmeimob/bjyy/mapping/TrainDao.xml

@ -9,8 +9,15 @@
<result column="startTime" property="startTime"/>
<result column="content" property="content"/>
<collection property="images" ofType="com.wmeimob.bjyy.vo.TrainVo$ContentImage">
<id column="imgId" property="id"/>
<result column="url" property="url"/>
</collection>
<collection property="details" ofType="com.wmeimob.bjyy.vo.TrainVo$ContentDetail">
<id column="detailId" property="id"/>
<result column="detail" property="content"/>
<result column="type" property="type"/>
<result column="sort" property="sort"/>
</collection>
</resultMap>
<resultMap id="contentMap" type="com.wmeimob.bjyy.vo.TrainVo$TrainContentVo">
@ -21,8 +28,15 @@
<id column="id" property="id"/>
<result column="content" property="content"/>
<collection property="images" ofType="com.wmeimob.bjyy.vo.TrainVo$ContentImage">
<id column="imgId" property="id"/>
<result column="url" property="url"/>
</collection>
<collection property="details" ofType="com.wmeimob.bjyy.vo.TrainVo$ContentDetail">
<id column="detailId" property="id"/>
<result column="detail" property="content"/>
<result column="type" property="type"/>
<result column="sort" property="sort"/>
</collection>
</collection>
</resultMap>
@ -33,7 +47,12 @@
a.description,
c.id,
c.content,
c.url
c.imgId,
c.url,
c.detailId,
c.detail,
c.type,
c.sort
FROM
t_train_aid a,
(
@ -41,11 +60,16 @@
c.aid_id,
c.id,
c.content,
i.url
i.id as imgId,
i.url,
d.id as detailId,
d.content as detail,
d.type as type,
d.sort
FROM
t_train_content c
LEFT JOIN t_train_img i ON c.id = i.content_id
AND i.rec_status = 0
LEFT JOIN t_train_img i ON c.id = i.content_id AND i.rec_status = 0
left join t_train_content_detail d on c.id = d.content_id and d.rec_status = 0
WHERE
c.LEVEL = #{level}
and c.rec_status = 0
@ -55,11 +79,13 @@
and a.rec_status = 0
ORDER BY
a.id,
c.id
c.id,
c.type,
c.sort
</select>
<select id="queryLastPractice" resultMap="TrainQueryMap">
select c.*, i.url from
(select t.startTime, a.name, a.description, c.id, c.content from
select c.*, i.id as imgId, i.url, d.id as detailId, d.content as detail, d.type as type, d.sort from
(select r.id as recordId, t.startTime, a.name, a.description, c.id, c.content from
(select id, test_at as startTime from u_mental_test where
<choose>
<when test="testId != null and testId != ''">id = #{testId}</when>
@ -77,5 +103,7 @@
and a.rec_status in (0,1)
) c left join t_train_img i
on c.id = i.content_id and i.rec_status = 0
left join t_train_content_detail d on c.id = d.content_id and d.rec_status = 0
order by c.recordId, d.type, d.sort
</select>
</mapper>

18
bjyy-dal/src/main/java/com/wmeimob/bjyy/vo/TrainVo.java

@ -28,6 +28,10 @@ public class TrainVo {
private String content;
/**图片*/
private List<ContentImage> images;
/**
* 内容详情 0训练目标 1训练元素 2训练原理 3训练步骤
*/
private List<ContentDetail> details;
public Date getEndTime() {
if (endTime == null && startTime != null) {
@ -40,6 +44,14 @@ public class TrainVo {
}
}
@Data
public static class ContentDetail {
private int id;
private String content;
private byte type;
private byte sort;
}
@Data
public static class TrainContentVo{
/**教具*/
@ -60,9 +72,15 @@ public class TrainVo {
private String content;
/**图片*/
private List<ContentImage> images;
/**
* 内容详情 0训练目标 1训练元素 2训练原理 3训练步骤
*/
private List<ContentDetail> details;
}
@Data
public static class ContentImage {
private int id;
private String url;
}
}

2
bjyy-weixin/src/main/java/com/wmeimob/bjyy/controller/MentalController.java

@ -128,7 +128,7 @@ public class MentalController extends BaseController {
// for (MentalTest mentalTest : queryMentalRecordTop) {
// arl.remove(mentalTest.getFromType()-1);
// }
result.setData(new Random().nextInt(5));
result.setData(new Random().nextInt(4) + 1);
log.info("已满14天。再次做题。题目类型是" + result.getData());
} else {
result.setCode(-1);

8
bjyy-weixin/src/main/java/com/wmeimob/bjyy/controller/PracticeController.java

@ -1,5 +1,6 @@
package com.wmeimob.bjyy.controller;
import cn.hutool.core.util.StrUtil;
import com.wmeimob.bjyy.common.BaseController;
import com.wmeimob.bjyy.model.MentalTest;
import com.wmeimob.bjyy.model.User;
@ -56,7 +57,12 @@ public class PracticeController extends BaseController {
public void download(HttpServletResponse response, String testId) throws Exception {
log.info("下载:{}" + testId);
MentalTest test = mentalService.getMentalTestById(testId);
UploadFileUtil_Servlet3.download(response, test.getPdfUrl(),
log.info("训练计划:" + test);
if (test == null || test.getGradeResult() == null) {
throw new RuntimeException("没有找到您的训练计划");
}
String pdfUrl = test.getPdfUrl();
UploadFileUtil_Servlet3.download(response, pdfUrl,
"脑益宝—老年脑健康认知训练方案" + DateUtil.format(test.getTestAt(), DateUtil.yyyyMMddDot) + ".pdf");
}
}

38
bjyy-weixin/src/main/java/com/wmeimob/bjyy/service/impl/TrainServiceImpl.java

@ -169,23 +169,55 @@ public class TrainServiceImpl implements TrainService {
cell2.setBorderLeft(null);
row2.addCell(cell2);
contents.add(row2);
// 规则等
List<TrainVo.ContentDetail> details = contentVo.getDetails();
if (CollectionUtil.isNotEmpty(details)) {
details.forEach(detail -> {
PdfUtil.Row rowDetail = new PdfUtil.Row();
rowDetail.setFontSize(16);
PdfUtil.Cell cellDetail = new PdfUtil.Cell();
StringBuilder builder = new StringBuilder();
if (detail.getSort() <= 1) {
switch (detail.getType()) {
case 0: builder.append("训练目标:").append(detail.getContent());break;
case 1: builder.append("训练元素:").append(detail.getContent());break;
case 2: builder.append("训练原理:").append(detail.getContent());break;
case 3: builder.append("训练步骤:").append(detail.getSort()).append(".").append(detail.getContent());break;
}
} else {
builder.append(" ").append(detail.getSort()).append(".").append(detail.getContent());
}
cellDetail.setContent(builder.toString());
cellDetail.setCenter(false);
cellDetail.setBorderBottom(null);
cellDetail.setBorderLeft(null);
rowDetail.addCell(cellDetail);
contents.add(rowDetail);
});
}
if (CollectionUtil.isEmpty(contentVo.getImages())) {
contents.add(PdfUtil.Row.fillBlankRow());
return 0;
}
// 图片
PdfUtil.Row row3 = new PdfUtil.Row();
contentVo.getImages().forEach(image->{
PdfUtil.Row row3 = new PdfUtil.Row();
PdfUtil.Cell cell3 = new PdfUtil.Cell();
cell3.setContent(WeChatConfig.getValue("projectPath") + image.getUrl());
cell3.setScalePercent(10);
cell3.setScalePercent(100);
cell3.setType((byte)1);
cell3.setBorderBottom(0);
cell3.setBorderLeft(0);
row3.addCell(cell3);
contents.add(row3);
});
contents.add(row3);
contents.add(PdfUtil.Row.fillBlankRow());
log.info("contents:" + contents);
return contentVo.getImages().size();

22
bjyy-weixin/src/main/webapp/WEB-INF/pages/mental/practice.jsp

@ -99,6 +99,15 @@
}
});
$(function(){
let detailType = function(i) {
switch(i) {
case 0 : return '训练目标';
case 1 : return '训练元素';
case 2 : return '训练原理';
case 3 : return '训练步骤';
}
};
$.ajax({
url:"${contextPath}/wx/practice/last",
type:'post',
@ -120,6 +129,19 @@
ul.append("<li>")
ul.append("<p>"+(i+1) + "." +item.name+"</p>");
ul.append("<p>"+item.content+"</p>");
if (item.details && item.details.length) {
let details = item.details;
for(let j = 0; j< details.length; j++) {
let detail = details[j];
if (j == 0 || detail.type != details[j-1].type) {
ul.append("<p style='line-height: 0.35rem; color:#888888'><span style='display: inline-block;width: 1.5rem'>"+detailType(detail.type) +":</span>"+(detail.type!=3? "" : "<span>"+detail.sort+".</span>")+"<span>"+detail.content+"</span></p>");
} else {
ul.append("<p style='line-height: 0.35rem; color:#888888'><span style='display: inline-block;width: 1.5rem'></span>"+(detail.type!=3? "" : "<span>"+detail.sort+".</span>")+"<span>"+detail.content+"</span></p>");
}
}
}
if (!item.images || !item.images.length) {
ul.append("</li>");
continue;

1
bjyy-weixin/src/main/webapp/static/css/style.css

@ -320,6 +320,7 @@ b{ font-weight:normal}
.follow h2{ padding: 0 0.3rem; line-height: 1.2rem; height: 1.2rem; font-size: 0.35rem; border-bottom: 1px solid #f0f0f0 }
.follow h2 span{ font-size: 0.35rem; float: right; }
.follow p{ padding: 0.3rem 0.3rem; line-height: 0.6rem; font-size: 0.35rem; }
.follow p span{font-size: 0.30rem; font-weight: lighter;}
.follow li{ height: 1.2rem; line-height: 1.2rem;border-bottom: 1px solid #f0f0f0}
.follow li .left{ width: 5rem; float: left; border-right: 1px solid #f0f0f0; font-size: 0.35rem; text-align: center; }
.follow li .right{ width: 5rem; float: right;}

BIN
bjyy-weixin/src/main/webapp/static/train/1.1.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/1.15.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/1.2.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/1.7.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/10.10.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/10.5.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.1.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.1.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.2.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.2.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.3.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.3.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.3.3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.3.4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.3.5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.4.1..jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.4.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.4.3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.4.4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.4.5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.5.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.5.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/6.5.3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.1.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.1.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.2.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.2.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.3.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.3.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.3.3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.3.4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.3.5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.4.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.4.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.4.3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.4.4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.4.5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.5.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.5.2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/7.5.3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/8.6.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/8.7.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/8.8.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
bjyy-weixin/src/main/webapp/static/train/8.9.1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Loading…
Cancel
Save