日期修复问题

This commit is contained in:
bai 2024-07-14 02:06:25 +08:00
parent b937018241
commit ab4b0d2c3b
6 changed files with 203 additions and 178 deletions

View File

@ -237,6 +237,7 @@ public class BlStuAnswerController extends JeecgController<BlStuAnswer, IBlStuAn
updateWp.lambda().eq(BlStuInfo::getId, id);
updateWp.lambda().set(BlStuInfo::getFilePath,exportWordPath);
blStuInfoService.update(updateWp);
log.info("更新后的文档地址: {}", exportWordPath);
return Result.OK("生成成功");
}

View File

@ -466,6 +466,8 @@
and z.major = n.major
and z.major = t.major
GROUP BY z.major
order by CONVERT(z.major USING gbk) COLLATE gbk_chinese_ci
</select>
<select id="b2_1_1" resultType="String">
@ -528,7 +530,7 @@
select
major as 'key',
round(sum(SXZZK_SATI2)/count(*)) as '01'
from bl_stu_answer where main_id = #{id} GROUP BY MAJOR
from bl_stu_answer where main_id = #{id} GROUP BY MAJOR order by CONVERT(major USING gbk) COLLATE gbk_chinese_ci
</select>
<select id="i2_5" resultType="java.util.LinkedHashMap">
@ -796,7 +798,7 @@
round(sum(ZYK_ADVANCED2)/count('x'),2) as '04',
round(sum(ZYK_INTERN2)/count('x'),2) as '05',
round(sum(ZYK_EFFORT2)/count('x'),2) as '06'
from bl_stu_answer GROUP BY major order by CONVERT(major USING gbk) COLLATE gbk_chinese_ci;
from bl_stu_answer GROUP BY major order by CONVERT(major USING gbk) COLLATE gbk_chinese_ci
</select>
<select id="i2_12" resultType="java.util.LinkedHashMap">
@ -1223,6 +1225,7 @@
and a.major = c.MAJOR
and a.major = d.MAJOR
and a.major = e.major
order by CONVERT(a.major USING gbk) COLLATE gbk_chinese_ci
</select>
<select id="i2_26" resultType="java.util.LinkedHashMap">
@ -1833,7 +1836,7 @@
</select>
<select id="t3_8" resultType="java.util.LinkedHashMap">
select major as 'key',round(sum(TEACHERSATI_ZONGTI2)/count(*))as '01' from bl_stu_answer where main_id = #{id} GROUP BY MAJOR
select major as 'key',round(sum(TEACHERSATI_ZONGTI2)/count(*))as '01' from bl_stu_answer where main_id = #{id} GROUP BY MAJOR order by CONVERT(major USING gbk) COLLATE gbk_chinese_ci
</select>
<select id="i3_9" resultType="java.util.LinkedHashMap">
@ -2539,7 +2542,7 @@
</select>
<select id="t5_4" resultType="java.util.LinkedHashMap">
select major as 'key',round(sum(SATI_ZONGTI2)/count(*)) as '01' from bl_stu_answer where main_id = #{id} GROUP BY MAJOR
select major as 'key',round(sum(SATI_ZONGTI2)/count(*)) as '01' from bl_stu_answer where main_id = #{id} GROUP BY MAJOR order by CONVERT(major USING gbk) COLLATE gbk_chinese_ci
</select>
</mapper>

View File

@ -550,7 +550,8 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
final WordOperator wo = ExportWord.getWordOperator(templateName);
Map<String, Object> result = Maps.newHashMap();
i1_13(wo, result, id);
//i1_13(wo, result, id);
b1_2(wo, result, id);
WordOperator wo2 = WordOperator.twoReplaceWord(wo);
wo2.replaceTextPlus(result);
@ -640,9 +641,9 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
data: %s
},
yAxis: { type: 'value' },
axisLabel: { color:'#000', fontSize: 20 },
axisLabel: { color:'#000', fontSize: 20, fontFamily: '宋体' },
barWidth: '25%%',
series: [ { label: { show: true, color: '#000', position: 'top' }, type: 'bar', data: %s } ]
series: [ { label: { show: true, color: '#000', position: 'top', fontFamily: '宋体' }, type: 'bar', data: %s } ]
}
""";
json = json.formatted(JSONUtil.toJsonStr(xAxisData), JSONUtil.toJsonStr(yAxisData));
@ -673,17 +674,17 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
//标准最简单横向柱状图
var json = """
{
title: { right: '30', text: '%%', textStyle: { fontSize: 30 } },
title: { right: '30', text: '%%', textStyle: { fontSize: 30, fontFamily: '宋体' } },
grid: { left: '12%%', right: '3%%', bottom: '0%%', containLabel: true },
xAxis: {
type: 'value', position: 'top', max: %s,
axisLabel: { textStyle: { color: '#000', fontSize: 20 }, },
axisLabel: { textStyle: { color: '#000', fontSize: 20, fontFamily: '宋体' }, },
axisLine: { show: true, },
axisTick: { show: true, inside: true, }
},
yAxis: {
type: 'category',
axisLabel: { textStyle: { color: '#000', fontSize: 20 }, },
type: 'category', inverse: true,
axisLabel: { textStyle: { color: '#000', fontSize: 20, fontFamily: '宋体' }, },
axisTick: { show: true, inside: true, },
data: %s,
},
@ -749,13 +750,13 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
};
var seriesTemp = """
{
name: '%s', type: 'bar', stack: 'total', label: { show: true, textStyle: { fontSize: 20, color: '#FFF' } },
name: '%s', type: 'bar', stack: 'total', label: { show: true, textStyle: { fontSize: 20, fontFamily: '宋体', color: '#FFF' } },
//emphasis: { focus: 'series' },
data: %s,
barWidth: 50,itemStyle: {color: '%s'}
},
""";
var yAxisTemp = "{ value: '%s', textStyle: { color: '#000', fontSize: 20 } },";
var yAxisTemp = "{ value: '%s', textStyle: { color: '#000', fontSize: 20, fontFamily: '宋体' } },";
var yAxisData = Lists.newArrayList();
List<String> nameList = Lists.newArrayList();
var seriesList = Lists.newArrayList();
@ -823,7 +824,7 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
//横向层叠柱状图
var json = """
{
title: { right: '30', text: '%%', textStyle: { fontSize: 30 } },
title: { right: '30', text: '%%', textStyle: { fontSize: 30, fontFamily: '宋体' } },
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: {},
grid: { left: '%s%%', right: '3%%', bottom: '0%%', containLabel: true },
@ -874,71 +875,52 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
String indicatorDataTemp = "{ name: '%s', max: " + maxNumber + " },";
List<String> nameList = Lists.newArrayList();
List<String> seriesDataList = Lists.newArrayList();
List<String> maxSeriesDataList = Lists.newArrayList();
//List<String> maxSeriesDataList = Lists.newArrayList();
if(map != null && !map.isEmpty()) {
Set<String> keys = Sets.filter(map.keySet(), key -> !KEY.equals(key));
for(String key: keys){
nameList.add(indicatorDataTemp.formatted(key));
seriesDataList.add(getMapStr(map.get(key)));
maxSeriesDataList.add(maxNumber);
//maxSeriesDataList.add(maxNumber);
}
}
Map<String, String> runJs = Maps.newHashMap();
var runBeforeTemp = "let dataList = %s;";
runJs.put("runBefore",runBeforeTemp.formatted(JSONUtil.toJsonStr(seriesDataList)));
var title = "title: { right: '30', text: '" + titleText + "', textStyle: { fontSize: 30 } },";
var title = "title: { right: '30', text: '" + titleText + "', textStyle: { fontSize: 30, fontFamily: '宋体' } },";
//雷达图
var json = """
{
%s
legend: { data: [] },
radar: {
radius: '50%%',
indicator: %s,
axisName: {
fontSize: 15, color: '#000', padding: 70,
formatter: (v) => {
let l = String(v).split('');let r = '';
l.forEach((x,i) => { if((i+1) %% 12 == 0){ r += x + '\\n'; } else { r += x; } });
return r;
}
%s
polar: { radius: '50%%', },
angleAxis: {
show: false, min: 0, max: %s, interval: 1, inverse: true,
axisLine: { lineStyle: { color: 'rgba(0,0,0,0)', }, }, axisTick: { show: false, inside: true, },
axisLabel: { textStyle: { color: '#000', fontSize: 20, fontFamily: '宋体' }, formatter: (i) => dataList[i], },
},
},
series: [
{
name: 'data',
type: 'radar',
label: { position: 'top' },
data: [{ name: 'alxc', value: dataList }]
radiusAxis: { show: false, },
radar: {
radius: '50%%',
axisName: {
fontSize: 15, fontFamily: '宋体', color: '#000', padding: 70,
formatter: (v) => {
let l = String(v).split('');let r = '';
l.forEach((x,i) => { if((i+1) %% 12 == 0){ r += x + '\\n'; } else { r += x; } });
return r;
}
},
indicator: %s,
},
{
type: 'radar',
data: [
{
name: 'max',
itemStyle: { color: '#000' },
lineStyle: { type: 'dashed', color: '#000' },
label: {
show: true,
fontSize: 20,
formatter: (params) => {
return dataList[params.dimensionIndex];
}
},
value: %s
}
]
}
]
series: [ { name: 'data', type: 'radar', label: { position: 'top' }, data: [ { value: dataList, name: 'value', }, ] } ]
}
""";
var nameListSb = new StringBuilder();
nameListSb.append("[");
nameList.forEach(nameListSb::append);
nameListSb.append("]");
json = json.formatted(title, nameListSb.toString(), JSONUtil.toJsonStr(maxSeriesDataList));
json = json.formatted(title, nameList.size(), nameListSb.toString());
return WebDriverUtil.getImgByte(json,"echarts500.html", runJs);
return WebDriverUtil.getImgByte(json,"echarts600.html", runJs);
}
public void t1_1(WordOperator wo, Map<String, Object> result, String id) {
var list1 = baseMapper.t1_1_1(id);
@ -2226,8 +2208,7 @@ public class BlStuAnswerServiceImpl extends ServiceImpl<BlStuAnswerMapper, BlStu
label: {
show: true,
fontSize: '30',
//fontWeight: 'bold',
//textStyle: {fontSize: 50}
fontFamily: '宋体',
position: 'center',
formatter: (e) => e.name + '\\n' + e.value +'%%'
},

View File

@ -12,7 +12,10 @@ import org.jeecg.modules.tools.CommonUtil;
import org.jeecg.modules.tools.FileUtils;
import org.jeecg.modules.tools.Global;
import org.jeecg.modules.tools.IdGen;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTShd;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -28,33 +31,33 @@ import java.util.Map;
*/
public class WordOperator {
private static Logger logger = LoggerFactory.getLogger(WordOperator.class);
private static final Logger logger = LoggerFactory.getLogger(WordOperator.class);
/**
* 模板替换标签开头
*/
private final static String LABEL_STR = "{";
private static final String LABEL_STR = "{";
/**
* 模板替换标签结尾
*/
private final static String LABEL_END = "}";
private static final String LABEL_END = "}";
/**
* 模板替换图片标签开头(List)
*/
private final static String LABEL_IMAGE_STR = "<";
private static final String LABEL_IMAGE_STR = "<";
/**
* 模板替换图片标签结尾(List)
*/
private final static String LABEL_IMAGE_END = ">";
private static final String LABEL_IMAGE_END = ">";
/**
* 模板替换图片标签开头(List)
*/
private final static String LABEL_RICH_TEXT_STR = "<richText[";
private static final String LABEL_RICH_TEXT_STR = "<richText[";
/**
* 模板替换图片标签结尾(List)
*/
private final static String LABEL_RICH_TEXT_END = "]richText>";
private static final String LABEL_RICH_TEXT_END = "]richText>";
/**
* 加载word对象
@ -69,8 +72,6 @@ public class WordOperator {
this.doc = doc;
}
private int picturesSize = 0;
public int getPicturesSize() {
@ -93,8 +94,6 @@ public class WordOperator {
public WordOperator(InputStream is) throws Exception {
doc = new XWPFDocument(is);
}
/**
* 要替换标签的KV对
@ -122,41 +121,38 @@ public class WordOperator {
*/
public void createPicture(XWPFParagraph pic, String picPath, int width, int height, String picAttch){
pic.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run = pic.createRun();
try {
if(StringUtils.isBlank(picPath) || picPath.lastIndexOf(".") == -1){
logger.error("文件路径错误:");
logger.error(picPath);
logger.error("文件路径错误: {}", picPath);
return;
}
//根据文件后缀名设置图片格式
String picType = picPath.substring(picPath.lastIndexOf("\\.")+1);
int res = XWPFDocument.PICTURE_TYPE_PICT;
if(picType != null){
int res = Document.PICTURE_TYPE_PICT;
if(StringUtils.isNotBlank(picType)){
if(picType.equalsIgnoreCase("png")){
res = XWPFDocument.PICTURE_TYPE_PNG;
res = Document.PICTURE_TYPE_PNG;
}else if(picType.equalsIgnoreCase("gif")) {
res = XWPFDocument.PICTURE_TYPE_GIF;
res = Document.PICTURE_TYPE_GIF;
}else if(picType.equalsIgnoreCase("emf")){
res = XWPFDocument.PICTURE_TYPE_EMF;
res = Document.PICTURE_TYPE_EMF;
}else if(picType.equalsIgnoreCase("jpg") || picType.equalsIgnoreCase("jpeg")){
res = XWPFDocument.PICTURE_TYPE_JPEG;
res = Document.PICTURE_TYPE_JPEG;
}else if(picType.equalsIgnoreCase("wmf")){
res = XWPFDocument.PICTURE_TYPE_WMF;
}else if(picType.equalsIgnoreCase("pict")){
res = XWPFDocument.PICTURE_TYPE_PICT;
res = Document.PICTURE_TYPE_WMF;
// }else if(picType.equalsIgnoreCase("pict")){
//res = Document.PICTURE_TYPE_PICT;
}else if(picType.equalsIgnoreCase("dib")){
res = XWPFDocument.PICTURE_TYPE_DIB;
res = Document.PICTURE_TYPE_DIB;
}else if(picType.equalsIgnoreCase("tiff")){
res = XWPFDocument.PICTURE_TYPE_TIFF;
res = Document.PICTURE_TYPE_TIFF;
}else if(picType.equalsIgnoreCase("eps")){
res = XWPFDocument.PICTURE_TYPE_EPS;
res = Document.PICTURE_TYPE_EPS;
}else if(picType.equalsIgnoreCase("bmp")){
res = XWPFDocument.PICTURE_TYPE_BMP;
res = Document.PICTURE_TYPE_BMP;
}else if(picType.equalsIgnoreCase("wpg")){
res = XWPFDocument.PICTURE_TYPE_WPG;
res = Document.PICTURE_TYPE_WPG;
}
}
//塞进文档中
@ -386,19 +382,17 @@ public class WordOperator {
private void replaceTextPlus(List<XWPFParagraph> paragraphList) {
//InputStream imageFileIs = null;
// 取出word模板里的全部段落遍历
for (int i = 0; i < paragraphList.size(); i++) {
XWPFParagraph paragraph = paragraphList.get(i);
for (XWPFParagraph paragraph : paragraphList) {
// 拿出每一个段落判断内容里是否包含字符串"{""}"只有两者同时存在了才执行替换标签的逻辑
String paragraphText = paragraph.getText();
if (!StringUtils.isBlank(paragraphText) && StringUtils.indexOf(paragraphText,LABEL_STR) != -1 && StringUtils.indexOf(paragraphText,LABEL_END) != -1) {
if (!StringUtils.isBlank(paragraphText) && StringUtils.contains(paragraphText, LABEL_STR) && StringUtils.contains(paragraphText, LABEL_END)) {
// 每一个段落分很多小段文本官方API只能通过XWPFRun对象执行替换文本功能
List<XWPFRun> runList = paragraph.getRuns();
// 组装replaceMap的key
String key = "";
// 是否检测到有"{"字符串有为true没有为false
boolean include = false;
for (int j = 0; j < runList.size(); j++) {
XWPFRun run = runList.get(j);
for (XWPFRun run : runList) {
//颜色
// run.setColor("F3C917");
//加粗
@ -413,9 +407,11 @@ public class WordOperator {
// 取出每一个小段里标签头和尾的角标
//是否存在两个{
boolean isParagraphReplaceAllText = false;
if(StringUtils.ordinalIndexOf(text,LABEL_STR,2) != -1){
//etxt是否存在两个以上的{
if (StringUtils.ordinalIndexOf(text, LABEL_STR, 2) != -1) {
isParagraphReplaceAllText = true;
text = paragraphReplaceAllText(text,replaceMap);
//进入同行匹配模式返回结果
text = paragraphReplaceAllText(text, replaceMap);
}
int labelStrIndex = StringUtils.indexOf(text, LABEL_STR);
int labelEndIndex = StringUtils.indexOf(text, LABEL_END);
@ -434,34 +430,34 @@ public class WordOperator {
String textAfter = text.substring(labelEndIndex + 1);
key += textBefore;
//Object value = replaceMap.get(key);
String value = (String)replaceMap.get(key);
String value = (String) replaceMap.get(key);
if (StringUtils.isBlank(value)) value = "";
WordTextStyle style = (WordTextStyle)replaceMap.get(key + "_style");
WordTextStyle style = (WordTextStyle) replaceMap.get(key + "_style");
//添加样式
if(style != null) style.run(run);
if (style != null) style.run(run);
if (StringUtils.isBlank(value)) value = "";
value = StringEscapeUtils.unescapeHtml4(value);
key = "";
//--2020-04修改
String[] values = value.split("\n");
if(values.length > 1) {
run.setText(values[0],0);
if (values.length > 1) {
run.setText(values[0], 0);
for (int x = 1; x < values.length; x++) {
//存在分段则新建一个run
XWPFRun newrun = paragraph.createRun();
XWPFRun newRun = paragraph.createRun();
//copy样式
newrun.getCTR().setRPr(run.getCTR().getRPr());
newRun.getCTR().setRPr(run.getCTR().getRPr());
//换行
newrun.addBreak();
newRun.addBreak();
//缩进
//newrun.addTab();
if(x == values.length - 1) {
newrun.setText(values[x] + textAfter);
}else {
newrun.setText(values[x]);
//newRun.addTab();
if (x == values.length - 1) {
newRun.setText(values[x] + textAfter);
} else {
newRun.setText(values[x]);
}
}
}else {
} else {
run.setText(value + textAfter, 0);
}
include = false;
@ -472,9 +468,9 @@ public class WordOperator {
key += text;
run.setText("", 0);
}
if(isParagraphReplaceAllText){
if (isParagraphReplaceAllText) {
//替换文本
run.setText(text,0);
run.setText(text, 0);
}
// 两个都存在这种情况比较复杂经过多次试验XWPFRun切割内容只会同时各出现1次而已
} else {
@ -484,32 +480,32 @@ public class WordOperator {
String textBefore = text.substring(0, labelStrIndex);
String textMiddle = text.substring(labelStrIndex + 1, labelEndIndex);
String textAfter = text.substring(labelEndIndex + 1);
String value = (String)replaceMap.get(textMiddle);
String value = (String) replaceMap.get(textMiddle);
if (StringUtils.isBlank(value)) value = "";
WordTextStyle style = (WordTextStyle)replaceMap.get(textMiddle + "_style");
WordTextStyle style = (WordTextStyle) replaceMap.get(textMiddle + "_style");
//添加样式
if(style != null) style.run(run);
if (style != null) style.run(run);
value = StringEscapeUtils.unescapeHtml4(value);
//--2020-04修改
String[] values = value.split("\n");
if(values.length > 1) {
run.setText(textBefore + values[0],0);
if (values.length > 1) {
run.setText(textBefore + values[0], 0);
for (int x = 1; x < values.length; x++) {
//存在分段则新建一个run
XWPFRun newrun = paragraph.createRun();
//存在分段则新建一个run
XWPFRun newRun = paragraph.createRun();
//copy样式
newrun.getCTR().setRPr(run.getCTR().getRPr());
newRun.getCTR().setRPr(run.getCTR().getRPr());
//换行
newrun.addBreak();
newRun.addBreak();
//缩进
//newrun.addTab();
if(x == values.length - 1) {
newrun.setText(values[x] + textAfter,0);
}else {
newrun.setText(values[x]);
//newRun.addTab();
if (x == values.length - 1) {
newRun.setText(values[x] + textAfter, 0);
} else {
newRun.setText(values[x]);
}
}
}else {
} else {
run.setText(textBefore + value + textAfter, 0);
}
@ -522,32 +518,32 @@ public class WordOperator {
String textMiddle = text.substring(labelEndIndex + 1, labelStrIndex);
String textAfter = text.substring(labelStrIndex + 1);
key += textBefore;
String value = (String)replaceMap.get(key);
if (value == null || StringUtils.isBlank(value.toString())) value = "";
WordTextStyle style = (WordTextStyle)replaceMap.get(textMiddle + "_style");
String value = (String) replaceMap.get(key);
if (value == null || StringUtils.isBlank(value)) value = "";
WordTextStyle style = (WordTextStyle) replaceMap.get(textMiddle + "_style");
//添加样式
if(style != null) style.run(run);
if (style != null) style.run(run);
value = StringEscapeUtils.unescapeHtml4(value);
//--2020-04修改
String[] values = value.toString().split("\n");
if(values.length > 1) {
run.setText(values[0],0);
String[] values = value.split("\n");
if (values.length > 1) {
run.setText(values[0], 0);
for (int x = 1; x < values.length; x++) {
//存在分段则新建一个run
XWPFRun newrun = paragraph.createRun();
//存在分段则新建一个run
XWPFRun newRun = paragraph.createRun();
//copy样式
newrun.getCTR().setRPr(run.getCTR().getRPr());
newRun.getCTR().setRPr(run.getCTR().getRPr());
//换行
newrun.addBreak();
newRun.addBreak();
//缩进
//newrun.addTab();
if(x == values.length - 1) {
newrun.setText(values[x] + textMiddle,0);
}else {
newrun.setText(values[x]);
//newRun.addTab();
if (x == values.length - 1) {
newRun.setText(values[x] + textMiddle, 0);
} else {
newRun.setText(values[x]);
}
}
}else {
} else {
run.setText(value + textMiddle, 0);
}
key = textAfter;
@ -555,31 +551,30 @@ public class WordOperator {
}
}
}
//富文本标签转成图片的富文本
} else if(StringUtils.isNotBlank(paragraphText) && paragraphText.indexOf(LABEL_RICH_TEXT_STR) != -1 && paragraphText.indexOf(LABEL_RICH_TEXT_END) != -1){
System.out.println("paragraphText="+paragraphText);
//富文本标签转成图片的富文本
} else if (StringUtils.isNotBlank(paragraphText) && StringUtils.contains(paragraphText, LABEL_RICH_TEXT_STR) && StringUtils.contains(paragraphText, LABEL_RICH_TEXT_END)) {
logger.info("paragraphText={}", paragraphText);
//如果匹配到<>则开始替换为图片
// 每一个段落分很多小段文本官方API只能否通过XWPFRun对象执行替换文本功能
List<XWPFRun> runList = paragraph.getRuns();
//组装replaceMap的key
String key = "";
//<richText[课题设计论证]richText>
//摘出key
int $labelStrIndex = StringUtils.indexOf(paragraphText, LABEL_RICH_TEXT_STR);
int $labelEndIndex = StringUtils.indexOf(paragraphText, LABEL_RICH_TEXT_END);
//必须存在开始和结束标签
if($labelStrIndex != -1 && $labelEndIndex != -1){
if ($labelStrIndex != -1 && $labelEndIndex != -1) {
key = paragraphText;
key = key.substring($labelStrIndex + LABEL_RICH_TEXT_STR.length());
$labelEndIndex = StringUtils.indexOf(key, LABEL_RICH_TEXT_END);
key = key.substring(0,$labelEndIndex);
key = key.substring(0, $labelEndIndex);
}
//去除整行整个paragraph
for (int j = 0; j < runList.size(); j++) {
XWPFRun run = runList.get(j);
for (XWPFRun run : runList) {
run.setText("", 0);
}
//添加图片
@ -591,18 +586,18 @@ public class WordOperator {
}
String imagePath = getHtmlImage(value.toString());
//try {
//imageFileIs = new FileInputStream(new File(imagePath));
//$run.addPicture(imageFileIs, 6, "image", 595,842);
//imageFileIs = new FileInputStream(new File(imagePath));
//$run.addPicture(imageFileIs, 6, "image", 595,842);
//} catch (InvalidFormatException | IOException e) {
//logger.error("图片读取或添加错误!");
//logger.error(e.getMessage(),e);
//e.printStackTrace();
//logger.error("图片读取或添加错误!");
//logger.error(e.getMessage(),e);
//e.printStackTrace();
//}
createPicturePlus(paragraph,imagePath,595,842,"");
createPicturePlus(paragraph, imagePath, 595, 842, "");
//FileUtils.deleteFile(imagePath);
//$run.setText();
//图片标签
}else if(StringUtils.isNotBlank(paragraphText) && paragraphText.indexOf(LABEL_IMAGE_STR) != -1 && paragraphText.indexOf(LABEL_IMAGE_END) != -1){
//图片标签
} else if (StringUtils.isNotBlank(paragraphText) && StringUtils.contains(paragraphText, LABEL_IMAGE_STR) && StringUtils.contains(paragraphText, LABEL_IMAGE_END)) {
//如果匹配到<>则开始替换为图片
// 每一个段落分很多小段文本官方API只能否通过XWPFRun对象执行替换文本功能
List<XWPFRun> runList = paragraph.getRuns();
@ -612,8 +607,9 @@ public class WordOperator {
WordImageLabel wordImageLabel = null;
// 是否检测到有"<"字符串有为true没有为false
boolean include = false;
for (int j = 0; j < runList.size(); j++) {
XWPFRun run = runList.get(j);
for (int i = 0; i < runList.size(); i++) {
//for (XWPFRun run : runList) {
XWPFRun run = runList.get(i);
String text = run.getText(0);
// 取出每一个小段里标签头和尾的角标
int labelStrIndex = StringUtils.indexOf(text, LABEL_IMAGE_STR);
@ -643,7 +639,7 @@ public class WordOperator {
//创建图片
run.setText("", 0);
// run.setText(value + textAfter, 0);
createPicturePlus(paragraph,(String)value,wordImageLabel.getWidth(),wordImageLabel.getHeight(),wordImageLabel.getPicAttch());
createPicturePlus(paragraph, (String) value, wordImageLabel.getWidth(), wordImageLabel.getHeight(), wordImageLabel.getPicAttch());
include = false;
// 两个都没有
} else if (labelStrIndex == -1 && labelEndIndex == -1) {
@ -667,7 +663,7 @@ public class WordOperator {
}
run.setText("", 0);
// run.setText(textBefore + value + textAfter, 0);
createPicturePlus(paragraph,(String)value,wordImageLabel.getWidth(),wordImageLabel.getHeight(),wordImageLabel.getPicAttch());
createPicturePlus(paragraph, (String) value, wordImageLabel.getWidth(), wordImageLabel.getHeight(), wordImageLabel.getPicAttch());
key = "";
include = false;
// >在前<在后
@ -683,15 +679,15 @@ public class WordOperator {
value = "";
}
run.setText("", 0);
createPicturePlus(paragraph,(String)value,wordImageLabel.getWidth(),wordImageLabel.getHeight(),wordImageLabel.getPicAttch());
createPicturePlus(paragraph, (String) value, wordImageLabel.getWidth(), wordImageLabel.getHeight(), wordImageLabel.getPicAttch());
key = textAfter;
include = true;
}
}
}
}
}
}
}
@ -710,23 +706,21 @@ public class WordOperator {
*/
private void replaceTextAndCreatePicture(List<XWPFParagraph> paragraphList) {
// 取出word模板里的全部段落遍历
for (int i = 0; i < paragraphList.size(); i++) {
XWPFParagraph paragraph = paragraphList.get(i);
for (XWPFParagraph paragraph : paragraphList) {
// 拿出每一个段落判断内容里是否包含字符串"{""}"只有两者同时存在了才执行替换标签的逻辑
String paragraphText = paragraph.getText();
if (!StringUtils.isBlank(paragraphText)) {
//判断是否为唯一的image关键字
if(StringUtils.equals(paragraphText, "{IMAGE}") && paragraphText.indexOf(LABEL_STR) != -1 && paragraphText.indexOf(LABEL_END) != -1){
if (StringUtils.equals(paragraphText, "{IMAGE}") && StringUtils.contains(paragraphText, LABEL_STR) && StringUtils.contains(paragraphText, LABEL_END)) {
//去掉关键字标记
List<XWPFRun> runList = paragraph.getRuns();
for (int j = 0; j < runList.size(); j++) {
XWPFRun run = runList.get(j);
for (XWPFRun run : runList) {
run.setText("", 0);
}
//获取图片地址
String picPath = (String) replaceMap.get("IMAGE");
//创建图片
createPicture(paragraph,picPath,83,83," ");
createPicture(paragraph, picPath, 83, 83, " ");
//创建后不需要普通的文字替换了跳过本段落
continue;
}
@ -736,8 +730,7 @@ public class WordOperator {
String key = "";
// 是否检测到有"{"字符串有为true没有为false
boolean include = false;
for (int j = 0; j < runList.size(); j++) {
XWPFRun run = runList.get(j);
for (XWPFRun run : runList) {
String text = run.getText(0);
// 取出每一个小段里标签头和尾的角标
int labelStrIndex = text.indexOf(LABEL_STR);

View File

@ -418,7 +418,7 @@
学生学习主动性评价各项占比
在落实推进学生刻苦读书学习,增强学习主动性方面,该校学生评价自身"课前运用网络课程平台、教材或资料进行自主预学,梳理知识并发现问题"的符合程度得分为{b1_1_1}分,"课堂上能跟上老师的讲解,主动提问或参与讨论,每节课学有所获"的符合程度得分为{b1_1_2}分,"课后复习笔记及总结课堂教学相关知识"的符合程度得分为{b1_1_3}分,"除了阅读教材,还延伸阅读教师推荐的其他相关书目"的符合程度得分为{b1_1_4}分。
<i1_2,400,210>
<i1_2,400,250>
各环节学生学习主动性
注:图表中数值为计算所得平均分数。
@ -621,7 +621,7 @@ Z
思政课程各分项满意度评价的各项占比
该校学生对本校思想政治课程的教学内容满意度为{b2_1_6}%,对教学形式的满意度为{b2_1_7}%,对教学质量的满意度为{b2_1_8}%,对教学效果的满意度为{b2_1_9}%。
<i2_6,400,170>
<i2_6,400,250>
思政课程各分项满意度
注:图表中数值为计算所得平均分数。
@ -647,7 +647,7 @@ Z
专业课"两性一度"评价各项占比
在落实课堂教学改革、提高课程两性一度方面,该校学生对专业课程的评价如下:高阶性方面,"课程将知识、能力、素养进行了有机融合"的符合程度得分为{b2_2_1}分,"课程教学培养了我解决复杂问题的综合能力"的符合程度得分为{b2_2_2}分;创新性方面,"课程内容注重学科间的交叉与融合"的符合程度得分为{b2_2_3}分,"课程内容反映了学科发展的前沿内容"的符合程度得分为{b2_2_4}分,"课程教学内容重视实践与理论的结合"的符合程度得分为{b2_2_5}分;挑战度方面,"需要非常努力才能达到课程要求"的符合程度得分为{b2_2_6}分。
<i2_9,400,170>
<i2_9,400,250>
学生对专业课"两性一度"评价
注:图表中数值为计算所得平均分数。
@ -699,7 +699,7 @@ Z
专业课教学方式评价各项占比
在推动"以学为中心、以教为主导"的课堂教学改革方面,该校学生对专业课程的教学方法使用情况评价如下,"课程以传统的教师讲授为主"的符合程度得分为{b2_3_1}分,"课堂中加入互动环节,注重学生参与(提问、讨论)"的符合程度得分为{b2_3_2}分,"提供案例或实例讨论"的符合程度得分为{b2_3_3}分,"采用小组合作的项目式教学方式"的符合程度得分为{b2_3_4}分。
<i2_13,400,170>
<i2_13,400,250>
学生对专业课教学方式评价
注:图表中数值为计算所得平均分数。
@ -747,7 +747,7 @@ Z
体美劳教育满意度评价各项占比
在落实体美劳教育建设方面,该校学生评价体育教育的满意度为{b2_5_1}%,美育教育的满意度为{b2_5_2}%,劳动教育的满意度为{b2_5_3}%。
<i2_18,400,170>
<i2_18,400,250>
体美劳教育满意度
注:图表中数值为计算所得平均分数。
@ -792,7 +792,7 @@ Z
学生发展活动满意度评价各项占比
该校参与过以上各项学生发展活动的学生,评价国际交流活动的满意度为{b2_6_6}%,学生社团活动的满意度为{b2_6_7}%,校园文化活动的满意度为{b2_6_8}%,创新创业活动的满意度为{b2_6_9}%,社会实践活动的满意度为{b2_6_10}%。
<i2_23,400,170>
<i2_23,400,250>
各项学生发展活动满意度
注:图表中数值为计算所得平均分数。
@ -836,7 +836,7 @@ Z
本校实习实践满意度评价各项占比
在落实实践教学建设方面,该校学生评价本校实习实践内容的满意度为{b2_7_1}%,实习实践时间安排的满意度为{b2_7_2}%,实习实践指导情况的满意度为{b2_7_3}%,实习实践场地及设备的满意度为{b2_7_4}%。
<i2_27,400,170>
<i2_27,400,250>
本校实习实践各方面满意度
注:图表中数值为计算所得平均分数。
@ -863,7 +863,7 @@ Z
学习收获评价各项占比
在对在校学习所取得的收获方面,该校学生的评价如下:"分析问题、解决问题能力提升"的符合程度得分为{b2_8_1}分,"自主学习能力提升"的符合程度得分为{b2_8_2}分,"合作能力提升"的符合程度得分为{b2_8_3}分,"书面表达和沟通能力提升"的符合程度得分为{b2_8_4}分,"有能力规划未来工作生活"的符合程度得分为{b2_8_5}分。
<i2_30,400,170>
<i2_30,400,250>
学生对学习收获的评价
注:图表中数值为计算所得平均分数。
@ -907,7 +907,7 @@ Z
核心素养满意度评价各项占比
在自我核心素养提升方面,该校学生对"人文底蕴"的满意度为{b2_9_1}%"科学精神"的满意度为{b2_9_2}%"学会学习"的满意度为{b2_9_3}%"健康生活"的满意度为{b2_9_4}%"责任担当"的满意度为{b2_9_5}%"实践创新"的满意度为{b2_9_6}%"自我提升"的满意度为{b2_9_7}%。
<i2_34,400,170>
<i2_34,400,250>
学生评价核心素养满意度
注:图表中数值为计算所得平均分数。
@ -956,7 +956,7 @@ Z
教学工作满意度评价各项占比
在教师教学工作方面,该校学生评价教师"师德师风及精神面貌"的满意度为{b3_1_1}%"教学投入"的满意度为{b3_1_2}%"依法依规,履行教师职责"的满意度为{b3_1_3}%"关心爱护学生"的满意度为{b3_1_4}%。
<i3_2,400,170>
<i3_2,400,250>
教学工作各方面满意度
注:图表中数值为计算所得平均分数。
@ -1034,7 +1034,7 @@ Z
教师教学行为评价各项占比
在教师教学能力方面,该校学生评价教师"重视立德树人,注重发挥课程育人的作用"的符合程度得分为{b3_3_1}分,"清楚地向学生解释了所学课程的目标和要求"的符合程度得分为{b3_3_2}分,"教学方法灵活多样,引导学生进行创造性思考"的符合程度得分为{b3_3_3}分,"课堂上激发学生的学习兴趣"的符合程度得分为{b3_3_4}分,"课后为学生提供辅导答疑"的符合程度得分为{b3_3_5}分。
<i3_10,400,170>
<i3_10,400,250>
教师各方面教学行为评价
注:图表中数值为计算所得平均分数。
@ -1079,7 +1079,7 @@ Z
本校体现"学生中心"和安全管理评价各项占比
在落实"以学生为中心"和安全管理方面,该校学生评价本校"学生服务能够做到"一站式"的服务与解决,体现了对学生的关怀"的符合程度得分为{b4_1_1}分,"重视实验实训的安全教育与管理"的符合程度得分为{b4_1_2}分,"任课教师积极参与学生活动"的符合程度得分为{b4_1_3}分,"校内学术讲座报告活动多"的符合程度得分为{b4_1_4}分。
<i4_2,400,170>
<i4_2,400,250>
本校体现"学生中心"和安全管理各方面评价
注:图表中数值为计算所得平均分数。
@ -1160,7 +1160,7 @@ Z
学生工作满意度评价各项占比
该校学生评价本校"心理健康教育/咨询"的满意度为{b4_3_1}%"职业生涯规划和就业创业指导"的满意度为{b4_3_2}%"班主任、辅导员工作"的满意度为{b4_3_3}%"学业指导工作"的满意度为{b4_3_4}%"重视家庭经济困难学生资助工作"的满意度为{b4_3_5}%。
<i4_9,400,170>
<i4_9,400,250>
各项学生工作满意度
注:图表中数值为计算所得平均分数。
@ -1204,7 +1204,7 @@ Z
资源条件满意度评价各项占比
在落实条件保障方面,该校学生评价本校"教室及教学设备"的满意度为{b4_4_1}%"实验实训室条件"的满意度为{b4_4_2}%"图书馆资源"的满意度为{b4_4_3}%"网络资源"的满意度为{b4_4_4}%"体育文化等基础设施"的满意度为{b4_4_5}%"住宿条件"的满意度为{b4_4_6}%。
<i4_13,400,170>
<i4_13,400,250>
资源条件各方面满意度
注:图表中数值为计算所得平均分数。

View File

@ -0,0 +1,47 @@
<html>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<head>
<script src="http://gssn.fw121.com/js/jquery-3.2.1.min.js"></script>
<script src="./echarts.min.js"></script>
</head>
<body>
<!-- ECharts 准备一个具备大小宽高 DOM -->
<div id="rhEcharts" style="height:600px;width:1050px"></div>
</body>
<script>
var rhEcharts = null;
$(function () {
// 基于准备好的dom初始化echarts实例
rhEcharts = echarts.init(document.getElementById('rhEcharts'));
});
function showImg(data) {
// var option = {
// xAxis: {
// type: 'category',
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
// },
// yAxis: {
// type: 'value'
// },
// series: [{
// data: [820, 932, 901, 934, 1290, 1330, 1320],
// type: 'line'
// }]
// };
// rhEcharts.setOption(option);
rhEcharts.setOption(data);
}
function returnEchartImg() {
var url = rhEcharts.getDataURL();
//清空绘画内容清空后实例可用
rhEcharts.clear();
return url;
}
</script>
</html>