From 574cd6075fa308b4a0ba05f2adb20392bf1e6414 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Fri, 25 Jun 2021 17:54:36 +0800 Subject: [PATCH] =?UTF-8?q?pictures=E6=A8=A1=E5=9D=97=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BA=86=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PicturesTemplateController.java | 15 +- .../PicturesTemplateAreaController.java | 4 +- .../IPicturesTemplateDao.java | 4 + .../impl/PicturesTemplateServiceImpl.java | 22 ++- .../PicturesTemplateBuildingServiceImpl.java | 26 ++- .../picturesmplate-mapper.xml | 30 ++- .../picturesmplatearea-mapper.xml | 30 ++- .../list-picturestemplate.html | 111 ++++++++--- .../save-picturestemplate.html | 15 +- .../save-picturestemplatearea.html | 176 ++++++++++++------ .../update-picturestemplate.html | 6 + .../save-picturestemplatearea.html | 19 +- .../update-picturestemplatearea.html | 17 +- .../picturestemplate/PicturesTemplateDTO.java | 20 ++ .../PicturesTemplateAreaDTO.java | 22 ++- .../picturestemplate/PicturesTemplateVO.java | 10 + .../PicturesTemplateAreaVO.java | 21 +++ 17 files changed, 425 insertions(+), 123 deletions(-) diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplate/PicturesTemplateController.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplate/PicturesTemplateController.java index ac8aed6..ace3eab 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplate/PicturesTemplateController.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplate/PicturesTemplateController.java @@ -19,7 +19,6 @@ import ink.wgink.pojo.result.SuccessResultList; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; - import java.util.List; import java.util.Map; @@ -40,9 +39,9 @@ public class PicturesTemplateController extends DefaultBaseController { @Autowired private SecurityComponent securityComponent; - @ApiOperation(value = "生成模板", notes = "生成模板") + @ApiOperation(value = "生成模板预览图", notes = "生成模板预览图") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "id", paramType = "String", example = "") + @ApiImplicitParam(name = "picturesTemplateCode", value = "picturesTemplateCode", paramType = "String", example = "模板编码") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PutMapping("buiderpicturestemplate/{picturesTemplateCode}") @@ -50,10 +49,11 @@ public class PicturesTemplateController extends DefaultBaseController { return picturesTemplateService.buiderPicturesTemplate(picturesTemplateCode); } - - @ApiOperation(value = "复制模板", notes = "复制模板") + @ApiOperation(value = "复制新的模板", notes = "复制新的模板") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "id", paramType = "String", example = "") + @ApiImplicitParam(name = "id", value = "id", paramType = "String", example = ""), + @ApiImplicitParam(name = "picturesTemplateCode", value = "picturesTemplateCode", paramType = "String", example = "新的编码"), + @ApiImplicitParam(name = "picturesTemplateTitle", value = "picturesTemplateTitle", paramType = "String", example = "新的标题") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PutMapping("copypicturestemplate/{id}/{picturesTemplateCode}/{picturesTemplateTitle}") @@ -61,8 +61,7 @@ public class PicturesTemplateController extends DefaultBaseController { return picturesTemplateService.copyPicturesTemplate(id, picturesTemplateCode, picturesTemplateTitle); } - - @ApiOperation(value = "更改显示方式", notes = "更改显示方式") + @ApiOperation(value = "更改显示开关状态", notes = "更改显示开关状态") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PutMapping("updatepicturestemplatepublishstatus/{picturesTemplateId}/{picturesTemplatePublishStatus}") @CheckRequestBodyAnnotation diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplatearea/PicturesTemplateAreaController.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplatearea/PicturesTemplateAreaController.java index d406f40..a23f060 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplatearea/PicturesTemplateAreaController.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/controller/apis/picturestemplatearea/PicturesTemplateAreaController.java @@ -42,7 +42,7 @@ public class PicturesTemplateAreaController extends DefaultBaseController { @ApiOperation(value = "区域统一修改", notes = "区域统一修改接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "showTemplateAreaId", value = "大数据模块区域ID", paramType = "path") + @ApiImplicitParam(name = "picturesTemplateId", value = "模板ID", paramType = "path") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PutMapping("updatepicturestemplateareaall/{picturesTemplateId}") @@ -51,7 +51,7 @@ public class PicturesTemplateAreaController extends DefaultBaseController { return picturesTemplateAreaService.updatePicturesTemplateAreaAll(picturesTemplateId, picturesTemplateAreaAllVO); } - @ApiOperation(value = "修改大数据模块区域配置参数", notes = "修改大数据模块区域配置参数接口") + @ApiOperation(value = "修改大数据模块区域配置位置参数", notes = "修改大数据模块区域配置位置参数接口") @ApiImplicitParams({ @ApiImplicitParam(name = "showTemplateAreaId", value = "大数据模块区域ID", paramType = "path") }) diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/dao/picturestemplate/IPicturesTemplateDao.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/dao/picturestemplate/IPicturesTemplateDao.java index 631ff25..1849b15 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/dao/picturestemplate/IPicturesTemplateDao.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/dao/picturestemplate/IPicturesTemplateDao.java @@ -87,4 +87,8 @@ public interface IPicturesTemplateDao { List> querySqlAll(String sql) throws SearchException; void updatePicturesTemplateContent(Map params) throws UpdateException; + + void updatePicturesTemplatePicture(Map map) throws UpdateException; + + void updatePictureTemplateStatus(Map params) throws UpdateException; } \ No newline at end of file diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java index 9890403..9a64187 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java @@ -220,6 +220,10 @@ public class PicturesTemplateServiceImpl extends DefaultBaseService implements I throw new SaveException("自定义宽度不能大于底图"); } } + /** + * 默认为不发布 + */ + picturesTemplateVO.setPicturesTemplatePublishStatus("0"); Map params = HashMapUtil.beanToMap(picturesTemplateVO); params.put("picturesTemplateId", picturesTemplateId); if (StringUtils.isBlank(token)) { @@ -287,7 +291,6 @@ public class PicturesTemplateServiceImpl extends DefaultBaseService implements I * @param picturesTemplateVO */ private void updatePicturesTemplateInfo(String token, String picturesTemplateId, PicturesTemplateVO picturesTemplateVO) throws Exception { - Map query = new HashMap(); query.put("fileId", picturesTemplateVO.getPicturesTemplateBackgroundImage()); FilePO filePO = iFileService.getPO(query); @@ -509,13 +512,18 @@ public class PicturesTemplateServiceImpl extends DefaultBaseService implements I @Override public SuccessResultData buiderPicturesTemplate(String picturesTemplateCode) throws Exception { - FilePO file = new FilePO(); - file.setFileName("测试FileName"); - file.setFilePath("测试FilePath"); - String fileId = iPicturesTemplateBuildingService.buildingPictures(picturesTemplateCode, file); + String base64 = iPicturesTemplateBuildingService.buildingPictures(picturesTemplateCode, null); SuccessResultData result = new SuccessResultData(""); - if(fileId != null ) { - result.setData(fileId); + if(base64 != null ) { + result.setData(base64); + /** + * 更新预览图 + */ + PicturesTemplateDTO dto = picturesTemplateDao.getPicturesTemplateByCode(picturesTemplateCode); + Map map = new HashMap(); + map.put("picturesTemplatePicture", base64); + map.put("picturesTemplateId", dto.getPicturesTemplateId()); + picturesTemplateDao.updatePicturesTemplatePicture(map); } return result; } diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java index f357350..b387684 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java @@ -306,14 +306,21 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl for (PicturesTemplateAreaDTO areaDto : areaList) { String content = "2".equals(areaDto.getTemplateAreaServerLink()) ? areaDto.getTemplateAreaFile() : areaDto.getTemplateAreaFontValue(); String index = areaDto.getTemplateAreaSource(); - Field[] arr = bean.getClass().getDeclaredFields(); - for (Field key : arr) { - key.setAccessible(true); - if (index.equals(key.getName())) { - if (key.getType() == String.class) { - if(key.get(bean) != null) { - if(!StringUtil.isEmpty(key.get(bean).toString())) { - content = key.get(bean).toString(); + /** + * 1位占位区域 , 2为需要填充的区域 + */ + if("2".equals(areaDto.getTemplateAreaType())){ + if(bean != null) { + Field[] arr = bean.getClass().getDeclaredFields(); + for (Field key : arr) { + key.setAccessible(true); + if (index.equals(key.getName())) { + if (key.getType() == String.class) { + if(key.get(bean) != null) { + if(!StringUtil.isEmpty(key.get(bean).toString())) { + content = key.get(bean).toString(); + } + } } } } @@ -346,6 +353,9 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl Map params = new HashMap(); params.put("fileId", dto.getPicturesTemplateBackgroundImage()); FilePO filePO = iFileService.getPO(params); + if(filePO == null) { + throw new Exception("背景图片丢失, 无法生成"); + } File backFile = new File(filePO.getFilePath()); return createImage(list, backFile, dto.getPicturesTemplateWidth().intValue(), dto.getPicturesTemplateHeight().intValue()); } diff --git a/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplate/picturesmplate-mapper.xml b/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplate/picturesmplate-mapper.xml index df51126..46048e9 100644 --- a/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplate/picturesmplate-mapper.xml +++ b/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplate/picturesmplate-mapper.xml @@ -16,8 +16,19 @@ + + + + UPDATE + m_pictures_template + SET + pictures_template_picture = #{picturesTemplatePicture} + WHERE + pictures_template_id = #{picturesTemplateId} AND is_delete = 0 + + UPDATE m_pictures_template @@ -66,7 +77,9 @@ t1.pictures_template_id, t1.pictures_template_file, t1.pictures_template_back, - t1.pictures_template_size + t1.pictures_template_size, + t1.pictures_template_picture, + t1.pictures_template_remark FROM m_pictures_template t1 WHERE @@ -89,6 +102,8 @@ pictures_template_file, pictures_template_back, pictures_template_size, + pictures_template_picture, + pictures_template_remark, creator, gmt_create, modifier, @@ -108,6 +123,8 @@ #{picturesTemplateFile}, #{picturesTemplateBack}, #{picturesTemplateSize}, + '', + #{picturesTemplateRemark}, #{creator}, #{gmtCreate}, #{modifier}, @@ -167,6 +184,9 @@ pictures_template_size = #{picturesTemplateSize}, + + + pictures_template_remark = #{picturesTemplateRemark}, pictures_template_file = #{picturesTemplateFile}, modifier = #{modifier}, @@ -190,7 +210,9 @@ t1.pictures_template_id, t1.pictures_template_file, t1.pictures_template_back, - t1.pictures_template_size + t1.pictures_template_size, + t1.pictures_template_picture, + t1.pictures_template_remark FROM m_pictures_template t1 WHERE @@ -217,7 +239,9 @@ t1.pictures_template_id, t1.pictures_template_file, t1.pictures_template_back, - t1.pictures_template_size + t1.pictures_template_size, + t1.pictures_template_picture, + t1.pictures_template_remark FROM m_pictures_template t1 WHERE diff --git a/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplatearea/picturesmplatearea-mapper.xml b/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplatearea/picturesmplatearea-mapper.xml index d465d9c..c40bd5f 100644 --- a/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplatearea/picturesmplatearea-mapper.xml +++ b/module-building-pictures/src/main/resources/mybatis/mapper/picturestemplatearea/picturesmplatearea-mapper.xml @@ -25,6 +25,8 @@ + + @@ -104,6 +106,8 @@ t1.template_area_font_family, t1.template_area_font_color, t1.template_area_font_value, + t1.template_area_name, + t1.template_area_type, t2.pictures_template_code FROM m_pictures_template_area t1 @@ -139,7 +143,9 @@ t1.template_area_font_bold, t1.template_area_font_family, t1.template_area_font_color, - t1.template_area_font_value + t1.template_area_font_value, + t1.template_area_name, + t1.template_area_type FROM m_pictures_template_area t1 WHERE @@ -178,6 +184,8 @@ template_area_font_family, template_area_font_color, template_area_font_value, + template_area_name, + template_area_type, creator, gmt_create, modifier, @@ -204,6 +212,8 @@ #{templateAreaFontFamily}, #{templateAreaFontColor}, #{templateAreaFontValue}, + #{templateAreaName}, + #{templateAreaType}, #{creator}, #{gmtCreate}, #{modifier}, @@ -266,6 +276,12 @@ template_area_font_value = #{templateAreaFontValue}, + + + template_area_name = #{templateAreaName}, + + + template_area_type = #{templateAreaType}, template_area_remark = #{templateAreaRemark}, template_area_file = #{templateAreaFile}, @@ -293,7 +309,9 @@ t1.template_area_font_bold, t1.template_area_font_family, t1.template_area_font_color, - t1.template_area_font_value + t1.template_area_font_value, + t1.template_area_name, + t1.template_area_type FROM m_pictures_template_area t1 LEFT JOIN @@ -322,7 +340,9 @@ t1.template_area_font_bold, t1.template_area_font_family, t1.template_area_font_color, - t1.template_area_font_value + t1.template_area_font_value, + t1.template_area_name, + t1.template_area_type FROM m_pictures_template_area t1 LEFT JOIN @@ -353,7 +373,9 @@ t1.template_area_font_bold, t1.template_area_font_family, t1.template_area_font_color, - t1.template_area_font_value + t1.template_area_font_value, + t1.template_area_name, + t1.template_area_type FROM m_pictures_template_area t1 WHERE diff --git a/module-building-pictures/src/main/resources/templates/picturestemplate/list-picturestemplate.html b/module-building-pictures/src/main/resources/templates/picturestemplate/list-picturestemplate.html index 462c40b..14e2c70 100644 --- a/module-building-pictures/src/main/resources/templates/picturestemplate/list-picturestemplate.html +++ b/module-building-pictures/src/main/resources/templates/picturestemplate/list-picturestemplate.html @@ -9,12 +9,13 @@ +
-
+
@@ -90,6 +91,25 @@ [ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'picturesTemplateBackgroundImage', width: 100, title: '预览图', align:'center', + templet: function(row) { + var rowData = row[this.field]; + var picturesTemplatePicture = row['picturesTemplatePicture']; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + var value = ''; + if(picturesTemplatePicture) { + value = ''; + } + setTimeout(function() { + new Viewer(document.getElementById("viewer"),{ + loop:true + }); + }, 50); + return value; + } + }, {field: 'picturesTemplateCode', width: 100, title: '套版编码', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -99,7 +119,7 @@ return rowData; } }, - {field: 'picturesTemplateTitle', width: 350, title: '套版标题', align:'center', + {field: 'picturesTemplateTitle', width: 200, title: '套版标题', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -108,55 +128,73 @@ return rowData; } }, - {field: 'picturesTemplateWidth', width: 150, title: '画板宽度', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData + 'px'; - } - }, - {field: 'picturesTemplateHeight', width: 150, title: '画板高度', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData + 'px'; - } - }, - {field: 'picturesTemplateBack', width: 150, title: '生成尺寸', align:'center', + /* {field: 'picturesTemplateWidth', width: 80, title: '画板宽度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData + 'px'; + } + }, + {field: 'picturesTemplateHeight', width: 80, title: '画板高度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData + 'px'; + } + },*/ + {field: 'picturesTemplateBack', width: 200, title: '生成尺寸', align:'center', templet: function(row) { var rowData = row[this.field]; + var picturesTemplateHeight = row["picturesTemplateHeight"]; + var picturesTemplateWidth = row["picturesTemplateWidth"]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { return '-'; } + var rowStr = ""; if(rowData == "-1") { - return "自定义"; + rowStr = "自定义尺寸"; }else if(rowData == "0") { - return "底图"; + rowStr = "底图尺寸"; }else if(rowData == "4") { - return "A4(竖向)"; + rowStr = "A4(竖向)"; }else if(rowData == "5") { - return "A5(竖向)"; + rowStr = "A5(竖向)"; }else if(rowData == "6") { - return "A6(竖向)"; + rowStr = "A6(竖向)"; }else if(rowData == "-4") { - return "A4(横向)"; + rowStr = "A4(横向)"; }else if(rowData == "-5") { - return "A5(横向)"; + rowStr = "A5(横向)"; }else if(rowData == "-6") { - return "A6(横向)"; + rowStr = "A6(横向)"; } + rowStr = rowStr + "【" + picturesTemplateWidth + "*" + picturesTemplateHeight + "】"; + return rowStr; } }, + // {field: 'picturesTemplatePublishStatus', width: 150, fixed: 'right', title: '套版发布', align:'center', // templet: function(row) { // var rowData = row[this.field]; // return ''; // } // }, + {field:'picturesTemplatePublishTime', width:180, title: '发布时间', align:'center', + templet: function(row) { + var rowData = row[this.field]; + return rowData; + } + }, + {field:'picturesTemplatePublishStatus', width:120, title: '发布状态', fixed: 'right', align:'center', + templet: function(row) { + var rowData = row[this.field]; + return ''; + } + }, {field:'picturesTemplateAreaEvent', width:120, title: '套版配置', fixed: 'right', align:'center', templet: function(row) { return ''; @@ -190,6 +228,21 @@ height: $win.height() - 90, }); } + + // 发布开关 + form.on('switch(picturesTemplateCheckEvent)', function () { + var loadLayerIndex; + var obj = {}; + top.restAjax.put(top.restAjax.path('api/picturestemplate/updatepicturestemplatepublishstatus/{picturesTemplateId}/{picturesTemplatePublishStatus}', [$(this).attr("picturesTemplateId"), this.checked]), obj, null, function(code, data) { + }, function(code, data) { + top.dialog.msg(data.msg); + }, function() { + loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3}); + }, function() { + top.dialog.close(loadLayerIndex); + }); + }); + // 初始化日期 function initDate() { // 日期选择 diff --git a/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplate.html b/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplate.html index b1fe76a..25efdeb 100644 --- a/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplate.html +++ b/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplate.html @@ -54,9 +54,12 @@ - - - + + + + + + @@ -157,6 +160,12 @@
+
+ +
+ +
+