Veronique 1 rok temu
rodzic
commit
bf136b021d

+ 27 - 0
conf/KeyId.xml

@@ -145,4 +145,31 @@
             <TableWhere/>
         </Table>
     </Item>
+
+    <Item>
+        <IDName>deDesignFont.id</IDName>
+        <Table>
+            <TableName>deDesignFont</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deDesignTemplate.id</IDName>
+        <Table>
+            <TableName>deDesignTemplate</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deDesignTemplateItem.id</IDName>
+        <Table>
+            <TableName>deDesignTemplateItem</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
 </Items>

+ 20 - 11
conf/application-sdWebOne.xml

@@ -91,10 +91,11 @@
             <service value="com.sdtool.webcore.rest.DocInfoRest">
                 <isUseScriptService value="true"/>
             </service>
-            <service value="com.sdtool.webcore.rest.SiteRest" />
+            <service value="com.sdtool.webcore.rest.SiteRest"/>
             <service value="com.sdtool.webcore.rest.MallAdminRest"/>
             <service value="com.sdtool.webcore.rest.MallFrontRest"/>
             <service value="com.sdtool.webcore.rest.AddressRest"/>
+            <service value="com.sdtool.webcore.rest.DesignRest"/>
         </services>
 
         <resource-servlet webroot="root" index="index.html">
@@ -119,7 +120,8 @@
             <service value="com.sdtool.webcore.rest.DocInfoRest">
                 <isUseScriptService value="true"/>
             </service>
-            <service value="com.sdtool.webcore.rest.SiteRest" />
+            <service value="com.sdtool.webcore.rest.SiteRest"/>
+            <service value="com.sdtool.webcore.rest.DesignRest"/>
 
             <websocket value="com.sdtool.webcore.websocket.ERPWebSocket" name="aws" groups="ERP_SERVICE_REMOTE"/>
         </rest>
@@ -167,18 +169,19 @@
                 <dao value="com.sdtool.business.dao.SystemDao"/>
                 <dao value="com.sdtool.business.dao.DocDao"/>
                 <dao value="com.sdtool.business.dao.MallDao"/>
+                <dao value="com.sdtool.business.dao.DesignDao"/>
             </service>
 
             <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJQService" groups="ERP_SERVICE_REMOTE"/>
             <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJobProducer" groups="ERP_SERVICE_REMOTE"/>
             <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJobConsumer" groups="ERP_SERVICE_REMOTE">
                 <namespace value="sdtool_jobmain"/>
-<!--                <queue name="ClientDataJob" jobclass="com.sdtool.common.entity.doc.ClientDataJob"-->
-<!--                       execclass="com.sdtool.business.service.erp.ClientDataJobExecutor"/>-->
-<!--                <queue name="PayDataJob" jobclass="com.sdtool.common.entity.pay.RedisPayJob"-->
-<!--                       execclass="com.sdtool.business.service.pay.RedisPayJobExecutor"/>-->
-<!--                <queue name="OrderTimeOutJob" jobclass="com.sdtool.common.entity.order.MallOrderDataJob"-->
-<!--                       execclass="com.sdtool.business.service.mall.MallOrderTimeOutExecutor"/>-->
+                <!--                <queue name="ClientDataJob" jobclass="com.sdtool.common.entity.doc.ClientDataJob"-->
+                <!--                       execclass="com.sdtool.business.service.erp.ClientDataJobExecutor"/>-->
+                <!--                <queue name="PayDataJob" jobclass="com.sdtool.common.entity.pay.RedisPayJob"-->
+                <!--                       execclass="com.sdtool.business.service.pay.RedisPayJobExecutor"/>-->
+                <!--                <queue name="OrderTimeOutJob" jobclass="com.sdtool.common.entity.order.MallOrderDataJob"-->
+                <!--                       execclass="com.sdtool.business.service.mall.MallOrderTimeOutExecutor"/>-->
             </service>
 
             <service value="com.sdtool.common.api.NoSqlKeysService" load="rediskeys.properties;eskeys.properties"
@@ -192,7 +195,7 @@
                 <port value="9300"/>
             </service>
 
-            <service value="com.sdtool.common.tool.AliSmsService" groups="ERP_SERVICE_REMOTE" />
+            <service value="com.sdtool.common.tool.AliSmsService" groups="ERP_SERVICE_REMOTE"/>
 
             <service value="com.sdtool.common.api.ERPLockDataService" groups="ERP_SERVICE_REMOTE">
                 <master value="true"/>
@@ -217,7 +220,7 @@
                 <clearESData value="false"/>
                 <resetAccountTradeBill value="false"/>
                 <resetPaperInfo value="false"/> <!-- 每次启动载入纸张6秒多,为提高效率,加了这个,如果不合适改成true或者删了都行-->
-                <initScriptPathName value="init" />
+                <initScriptPathName value="init"/>
             </service>
 
             <service value="com.sdtool.business.service.ERPServiceImpl" groups="ERP_SERVICE_REMOTE">
@@ -241,7 +244,7 @@
             <service value="com.sdtool.business.service.SystemServiceImpl" groups="ERP_SERVICE_REMOTE">
                 <master value="true"/>
                 <isUseScriptService value="true"/>
-<!--                <preCompiler value="1000/business/BE_System_TestListExt.groovy"/>-->
+                <!--                <preCompiler value="1000/business/BE_System_TestListExt.groovy"/>-->
             </service>
 
             <service value="com.sdtool.business.service.LoginServiceImpl" groups="ERP_SERVICE_REMOTE">
@@ -309,6 +312,12 @@
                 <!--使用业务脚本-->
                 <isUseScriptService value="true"/>
             </service>
+
+            <service value="com.sdtool.business.service.mall.DesignServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <!--使用业务脚本-->
+                <isUseScriptService value="true"/>
+            </service>
         </services>
     </server>
 </application>

+ 6 - 1
conf/rediskeys.properties

@@ -205,4 +205,9 @@ redis.order.image.manual.item = sdtool:mall:erp:image:designer:manual:item
 #科目余额
 redis.erp.account.money.balance = sdtool:mall:erp:balance:account:money
 #科目最新账期
-redis.erp.account.last.period = sdtool:mall:erp:account:last:period
+redis.erp.account.last.period = sdtool:mall:erp:account:last:period
+
+#在线设计
+redis.designer.design.template.edit = sdtool:mall:designer:design:template:edit
+redis.designer.design.template.imposition = sdtool:mall:designer:design:template:imposition
+redis.designer.design.font = sdtool:mall:designer:design:font

+ 32 - 0
conf/script/0/init/Init_50_DesignFont.groovy

@@ -0,0 +1,32 @@
+import com.sdtool.business.dao.DesignDao
+import com.sdtool.common.api.NoSqlKeysService
+import com.sdtool.common.datas.RedisKeys
+import com.sdtool.common.entity.design.DesignFont
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.apache.logging.log4j.Logger
+import org.rex.RMap
+
+/**
+ * @Author: xl Created on 2024-05-11
+ * @Content:
+ */
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService,
+                          DesignDao designDao, Logger logger, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    RMap params = new RMap()
+    return {
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_FONT, supplierCode))
+        Ignore_ExecPageFlipper.execute(1000, { PageFlipper p ->
+            List<DesignFont> designFontList = designDao.selectDesignFonts(params, dataSourceId, supplierCode, p)
+            if (!designFontList.isEmpty()) {
+                Map<String, String> redisMap = designFontList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_FONT, supplierCode), redisMap)
+                logger.info("设计字体共" + designFontList.size() + "条记录")
+            }
+        })
+    } as Runnable
+}
+
+createRunnable(redisService, keysService, designDao, logger, jsonConvert, dataSourceId, supplierCode)

+ 59 - 0
conf/script/0/init/Init_51_DesignTempalte.groovy

@@ -0,0 +1,59 @@
+import com.sdtool.business.dao.DesignDao
+import com.sdtool.common.api.NoSqlKeysService
+import com.sdtool.common.datas.RedisKeys
+import com.dySweetFishPlugin.redis.RedisService
+import com.sdtool.common.entity.design.DesignTemplate
+import com.sdtool.common.entity.design.DesignTemplateItem
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.apache.commons.lang3.StringUtils
+import org.apache.logging.log4j.Logger
+import org.rex.RMap
+
+import java.nio.file.Files
+import java.nio.file.Paths
+
+/**
+ * @Author: xl Created on 2024-05-11
+ * @Content:
+ */
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService,
+                          DesignDao designDao, Logger logger, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    RMap params = new RMap()
+    return {
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_EDIT, supplierCode))
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION, supplierCode))
+        Ignore_ExecPageFlipper.execute(1000, { PageFlipper p ->
+            List<DesignTemplate> templates = designDao.selectDesignTemplates(params, dataSourceId, supplierCode, p)
+
+            if (!templates.isEmpty()) {
+                templates.each {
+                    if (StringUtils.isNotEmpty(it.jsonContent)) {
+                        File file = new File(it.jsonContent)
+                        if (file.exists()) {
+                            String content = new String(Files.readAllBytes(Paths.get(it.jsonContent)), "UTF-8")
+                            it.setJsonContent(content)
+                        }
+                    }
+                }
+                Map<String, String> redisMap = templates.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_EDIT, supplierCode), redisMap)
+
+                RMap itemParams = new RMap()
+                templates.each {
+                    itemParams.set("idTemplate", it.id)
+                    List<DesignTemplateItem> itemList = designDao.selectDesignTemplateItems(itemParams, dataSourceId, supplierCode)
+                    it.setItemList(itemList)
+                    it.setJsonContent("")
+                }
+                redisMap = templates.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION, supplierCode), redisMap)
+
+                logger.info("设计模板共" + templates.size() + "条记录")
+            }
+        })
+    } as Runnable
+}
+
+createRunnable(redisService, keysService, designDao, logger, jsonConvert, dataSourceId, supplierCode)

+ 78 - 0
conf/sqlroot/com/sdtool/business/dao/DesignDao.dql

@@ -0,0 +1,78 @@
+-- [selectDesignFonts]
+select * from $table$;
+
+-- [addDesignFont]
+insert into $table$ (id, fontName, fontThumbUrl, voidFlag,
+fontFilePath, createBy, createTime,
+createTimeLong, updateBy, updateTime,
+updateTimeLong ) values ( #{id}, #{fontname}, #{fontthumburl}, #{voidflag},
+#{fontfilepath}, #{createby}, #{createtime},
+#{createtimelong}, #{updateby}, #{updatetime},
+#{updatetimelong} );
+
+-- [voidDesignFont]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [selectDesignTemplates]
+select *
+from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- isNotEmpty voidFlag
+    -- if voidFlag >= 0
+        voidFlag = #{voidFlag}
+    -- end
+  -- end
+  -- isNotEmpty keyWord
+    and (templateName LIKE #{Like:keyWord})
+  -- end
+  -- isNotEmpty templateName
+    and templateName LIKE #{Like:templateName}
+  -- end
+-- end
+-- isEmpty orderBy
+order by createTime desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [selectDesignTemplateItems]
+select * from $table$ where idTemplate = #{idTemplate};
+
+-- [addDesignTemplate]
+insert into $table$ (id, templateName, backgroundPath, viewThumbPath,
+canvasHeight, canvasWidth, breedHeight,
+breedWidth, idProduct, voidFlag,
+jsonContent, createBy, createTime,
+createTimeLong, updateBy, updateTime,
+updateTimeLong ) values ( #{id}, #{templatename}, #{backgroundpath}, #{viewthumbpath},
+#{canvasheight}, #{canvaswidth}, #{breedheight},
+#{breedwidth}, #{idproduct}, #{voidflag},
+#{jsoncontent}, #{createby}, #{createtime},
+#{createtimelong}, #{updateby}, #{updatetime},
+#{updatetimelong} );
+
+-- [addDesignTemplateItem]
+insert into $table$ (id, idTemplate, itemType, locationX,
+locationY, sizeWidth, sizeHeight,
+rotation, zIndex, jsonContent,
+createBy, createTime, createTimeLong,
+updateBy, updateTime, updateTimeLong ) values ( #{id}, #{idtemplate}, #{itemtype}, #{locationx},
+#{locationy}, #{sizewidth}, #{sizeheight},
+#{rotation}, #{zindex}, #{jsoncontent},
+#{createby}, #{createtime}, #{createtimelong},
+#{updateby}, #{updatetime}, #{updatetimelong} );
+
+-- [deleteDesignTemplateItem]
+delete from $table$ where idTemplate = #{id};
+
+-- [voidDesignTemplate]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};

+ 62 - 0
sdBusiness/src/main/java/com/sdtool/business/dao/DesignDao.java

@@ -0,0 +1,62 @@
+package com.sdtool.business.dao;
+
+import com.dySweetFishPlugin.sql.dao.*;
+import com.sdtool.common.entity.design.DesignFont;
+import com.sdtool.common.entity.design.DesignTemplate;
+import com.sdtool.common.entity.design.DesignTemplateItem;
+import com.sweetfish.source.PageFlipper;
+import org.rex.RMap;
+
+import java.util.List;
+
+public interface DesignDao extends DaoRepository {
+    //region 设计字体
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DesignDao.class, sql = "selectDesignFonts", table = "dedesignfont", params = {1})
+    List<DesignFont> selectDesignFonts(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
+                                       PageFlipper pageFlipper);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DesignDao.class, sql = "addDesignFont", table = "dedesignfont", params = {1})
+    void addDesignFont(DesignFont designFont, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DesignDao.class, sql = "voidDesignFont", table = "dedesignfont", params = {1})
+    void voidDesignFont(DesignFont designFont, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+    //endregion
+
+    //region 设计模板
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DesignDao.class, sql = "selectDesignTemplates", table = "dedesigntemplate", params = {1})
+    List<DesignTemplate> selectDesignTemplates(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
+                                              PageFlipper pageFlipper);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DesignDao.class, sql = "selectDesignTemplateItems", table = "dedesigntemplateitem", params = {1})
+    List<DesignTemplateItem> selectDesignTemplateItems(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplate", table = "dedesigntemplate", params = {1}, sort = 1)
+    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplateItem", table = "dedesigntemplateitem", params = {2}, sort = 2)
+    void addDesignTemplate(DesignFont designFont, List<DesignTemplateItem> itemList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplate", table = "dedesigntemplate", params = {1}, sort = 1)
+    @SqlId(clazz = DesignDao.class, sql = "deleteDesignTemplateItem", table = "dedesigntemplateitem", params = {1}, sort = 2)
+    @SqlId(clazz = DesignDao.class, sql = "addDesignTemplateItem", table = "dedesigntemplateitem", params = {2}, sort = 3)
+    void updateDesignTemplate(DesignTemplate designTemplate, List<DesignTemplateItem> itemList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DesignDao.class, sql = "voidDesignTemplate", table = "dedesigntemplate", params = {1})
+    void voidDesignTemplate(DesignTemplate designTemplate, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+    //endregion
+
+}

+ 3 - 0
sdBusiness/src/main/java/com/sdtool/business/service/SupplierInitImpl.java

@@ -135,6 +135,7 @@ public class SupplierInitImpl extends BaseService implements SupplierInitService
     private DocDao docDao;
     private SystemDao systemDao;
     private MallDao mallDao;
+    private DesignDao designDao;
     private ExecutorService initInfoExecutor;
 
     private final List<ScheduledThreadPoolExecutor> scheduleThreadList = new ArrayList<>();
@@ -264,6 +265,7 @@ public class SupplierInitImpl extends BaseService implements SupplierInitService
         systemDao = tunaService.generate(SystemDao.class);
         docDao = tunaService.generate(DocDao.class);
         mallDao = tunaService.generate(MallDao.class);
+        designDao = tunaService.generate(DesignDao.class);
 
         AnyValue environmentValue = config.getAnyValue("environment");
         if (environmentValue != null) {
@@ -545,6 +547,7 @@ public class SupplierInitImpl extends BaseService implements SupplierInitService
                 "systemDao", systemDao,
                 "docDao", docDao,
                 "mallDao", mallDao,
+                "designDao", designDao,
                 "jsonConvert", jsonConvert,
                 "dataSourceId", dataSourceId,
                 "supplierCode", supplierCode,

+ 197 - 0
sdBusiness/src/main/java/com/sdtool/business/service/mall/DesignServiceImpl.java

@@ -0,0 +1,197 @@
+package com.sdtool.business.service.mall;
+
+import com.dySweetFishPlugin.redis.RedisService;
+import com.dySweetFishPlugin.sql.TableIdService;
+import com.dySweetFishPlugin.sql.dao.TunaService;
+import com.sdtool.business.dao.DesignDao;
+import com.sdtool.common.api.NoSqlKeysService;
+import com.sdtool.common.api.mall.DesignService;
+import com.sdtool.common.base.BaseService;
+import com.sdtool.common.datas.RedisKeys;
+import com.sdtool.common.entity.design.DesignFont;
+import com.sdtool.common.entity.design.DesignTemplate;
+import com.sdtool.common.entity.design.DesignTemplateItem;
+import com.sdtool.common.entity.site.ERPTokenUser;
+import com.sdtool.common.tool.ERPUtils;
+import com.sweetfish.convert.json.JsonConvert;
+import com.sweetfish.service.Local;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.source.PageFlipper;
+import com.sweetfish.util.AnyValue;
+import com.sweetfish.util.AutoLoad;
+import com.sweetfish.util.ResourceType;
+import org.apache.commons.compress.utils.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.rex.RMap;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@Local
+@AutoLoad(false)
+@ResourceType(DesignService.class)
+public class DesignServiceImpl extends BaseService implements DesignService {
+
+    @Resource
+    private TunaService tunaService;
+
+    @Resource
+    private JsonConvert jsonConvert;
+
+    @Resource
+    private RedisService redisService;
+
+    @Resource
+    private TableIdService tableIdService;
+
+    @Resource
+    private NoSqlKeysService keysService;
+
+    @Resource(name = "APP_HOME")
+    private String appHome;
+
+    private String designContentRoot;
+
+    private DesignDao designDao;
+
+    @Override
+    public void start(AnyValue config) {
+        designDao = tunaService.generate(DesignDao.class);
+
+        designContentRoot = appHome + File.separator + "conf" + File.separator + "designContent";
+    }
+
+    @Override
+    public RetResult<List<DesignFont>> getDesignFonts(RMap params, String dataSourceId, long supplierCode) {
+        List<DesignFont> fontList = getRedisDocInfos(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_FONT, supplierCode), DesignFont.class);
+        if (ERPUtils.mapContainKey(params, "voidFlag")) {
+            return RetResult.<List<DesignFont>>successT().result(fontList.stream().filter(x -> x.getVoidFlag() == params.getInt("voidFlag")).toList());
+        } else {
+            return RetResult.<List<DesignFont>>successT().result(fontList.stream().filter(x -> x.getVoidFlag() == 0).toList());
+        }
+    }
+
+    @Override
+    public RetResult<DesignFont> addDesignFont(DesignFont designFont, String dataSourceId, long supplierCode, ERPTokenUser currentUser) {
+        designFont.setId(tableIdService.getTableIdMulti("deDesignFont.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        designFont.setVoidFlag(0);
+        DesignFont.create(designFont, currentUser.getId());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_FONT, supplierCode), String.valueOf(designFont.getId()), designFont);
+        designDao.addDesignFont(designFont, dataSourceId, supplierCode);
+
+        return RetResult.<DesignFont>successT().result(designFont);
+    }
+
+    @Override
+    public RetResult<DesignFont> voidDesignFont(DesignFont font, String dataSourceId, long supplierCode, ERPTokenUser currentUser) {
+        DesignFont redisFont = getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_FONT, supplierCode),
+                String.valueOf(font.getId()), DesignFont.class);
+
+        if (redisFont == null) return RetResult.successT();
+
+        redisFont.setVoidFlag(font.getVoidFlag());
+        DesignFont.update(redisFont, currentUser.getId());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_FONT, supplierCode), String.valueOf(redisFont.getId()), redisFont);
+        designDao.voidDesignFont(redisFont, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<List<DesignTemplate>> queryDesignTemplates(RMap params, PageFlipper pageFlipper, String dataSourceId, long supplierCode) {
+        List<DesignTemplate> templateList = designDao.selectDesignTemplates(params, dataSourceId, supplierCode, pageFlipper);
+
+        return RetResult.<List<DesignTemplate>>successT().result(templateList);
+    }
+
+    @Override
+    public RetResult<DesignTemplate> getDesignTemplateEdit(long id, String dataSourceId, long supplierCode) {
+        DesignTemplate redisTemplate = getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_EDIT, supplierCode),
+                String.valueOf(id), DesignTemplate.class);
+
+        if (redisTemplate == null) return RetResult.<DesignTemplate>errorT().retinfo("模板id不正确");
+        else
+            return RetResult.<DesignTemplate>successT().result(redisTemplate);
+    }
+
+    @Override
+    public RetResult<DesignTemplate> getDesignTemplateImposition(long id, String dataSourceId, long supplierCode) {
+        DesignTemplate redisTemplate = getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION, supplierCode),
+                String.valueOf(id), DesignTemplate.class);
+
+        if (redisTemplate == null) return RetResult.<DesignTemplate>errorT().retinfo("模板id不正确");
+        else
+            return RetResult.<DesignTemplate>successT().result(redisTemplate);
+    }
+
+    //todo 转换fabric的元素结构
+    private List<DesignTemplateItem> convertJsonObjectsToItems(String jsonObjects) {
+        return new ArrayList<>();
+    }
+
+    @Override
+    public RetResult<DesignTemplate> updateDesignTemplate(DesignTemplate template, String dataSourceId, long supplierCode, ERPTokenUser currentUser) {
+        if (template.getId() <= 0) {
+            //新增
+            template.setId(tableIdService.getTableIdMulti("deDesignTemplate.id", 1, dataSourceId, String.valueOf(supplierCode)));
+            DesignTemplate.create(template, currentUser.getId());
+        } else {
+            DesignTemplate.update(template, currentUser.getId());
+        }
+
+        String fileName = designContentRoot + File.separator + supplierCode +
+                File.separator + template.getId() + ".txt";
+
+        String writeContent = "";
+        if (StringUtils.isNotEmpty(template.getJsonContent())) {
+            writeContent = template.getJsonContent();
+        }
+        try {
+            Files.write(Paths.get(fileName),
+                    Collections.singleton(new StringBuilder(writeContent)),
+                    StandardCharsets.UTF_8,
+                    StandardOpenOption.CREATE,
+                    StandardOpenOption.WRITE,
+                    StandardOpenOption.TRUNCATE_EXISTING);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_EDIT, supplierCode), String.valueOf(template.getId()), template);
+        List<DesignTemplateItem> itemList = convertJsonObjectsToItems(template.getJsonContent());
+        template.setJsonContent(fileName);
+        template.setItemList(itemList);
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION, supplierCode), String.valueOf(template.getId()), template);
+
+        designDao.updateDesignTemplate(template, template.getItemList(), dataSourceId, supplierCode);
+
+        return RetResult.<DesignTemplate>successT().result(template);
+    }
+
+    @Override
+    public RetResult<DesignTemplate> voidDesignTemplate(DesignTemplate template, String dataSourceId, long supplierCode, ERPTokenUser currentUser) {
+        DesignTemplate redisTemplateEdit = getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_EDIT, supplierCode),
+                String.valueOf(template.getId()), DesignTemplate.class);
+        DesignTemplate redisTemplateImposition = getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION, supplierCode),
+                String.valueOf(template.getId()), DesignTemplate.class);
+
+        if (redisTemplateEdit != null)
+            redisTemplateEdit.setVoidFlag(template.getVoidFlag());
+        if (redisTemplateImposition != null)
+            redisTemplateImposition.setVoidFlag(template.getVoidFlag());
+
+        designDao.voidDesignTemplate(template, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+}

+ 33 - 0
sdCommon/src/main/java/com/sdtool/common/api/mall/DesignService.java

@@ -0,0 +1,33 @@
+package com.sdtool.common.api.mall;
+
+import com.sdtool.common.api.ScriptService;
+import com.sdtool.common.entity.design.DesignFont;
+import com.sdtool.common.entity.design.DesignTemplate;
+import com.sdtool.common.entity.site.ERPTokenUser;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.source.PageFlipper;
+import org.rex.RMap;
+
+import java.util.List;
+
+public interface DesignService extends ScriptService {
+    //region 字体
+    RetResult<List<DesignFont>> getDesignFonts(RMap params, String dataSourceId, long supplierCode);
+
+    RetResult<DesignFont> addDesignFont(DesignFont designFont, String dataSourceId, long supplierCode, ERPTokenUser currentUser);
+
+    RetResult<DesignFont> voidDesignFont(DesignFont font, String dataSourceId, long supplierCode, ERPTokenUser currentUser);
+    //endregion
+
+    //region 模板
+    RetResult<List<DesignTemplate>> queryDesignTemplates(RMap params, PageFlipper pageFlipper, String dataSourceId, long supplierCode);
+
+    RetResult<DesignTemplate> getDesignTemplateEdit(long id, String dataSourceId, long supplierCode);
+
+    RetResult<DesignTemplate> getDesignTemplateImposition(long id, String dataSourceId, long supplierCode);
+
+    RetResult<DesignTemplate> updateDesignTemplate(DesignTemplate template, String dataSourceId, long supplierCode, ERPTokenUser currentUser);
+
+    RetResult<DesignTemplate> voidDesignTemplate(DesignTemplate template, String dataSourceId, long supplierCode, ERPTokenUser currentUser);
+    //endregion
+}

+ 10 - 0
sdCommon/src/main/java/com/sdtool/common/datas/RedisKeys.java

@@ -457,6 +457,16 @@ public class RedisKeys {
 
     //endregion
 
+
+    //region 在线设计
+    //模板--给模板编辑用的,不记录item,全文记录jsonContent
+    public static final String KEY_DESIGNER_DESIGN_TEMPLATE_EDIT = "redis.designer.design.template.edit";
+    //模板--给后面流程用的,记录itemList,不记录jsonContent
+    public static final String KEY_DESIGNER_DESIGN_TEMPLATE_IMPOSITION = "redis.designer.design.template.imposition";
+
+    public static final String KEY_DESIGNER_DESIGN_FONT = "redis.designer.design.font";
+    //endregion
+
     private RedisKeys() {
     }
 }

+ 70 - 0
sdCommon/src/main/java/com/sdtool/common/entity/design/DesignFont.java

@@ -0,0 +1,70 @@
+package com.sdtool.common.entity.design;
+
+import com.sdtool.common.entity.base.BaseEntity;
+import com.sweetfish.util.Comment;
+import org.rex.db.RColumn;
+
+/**
+ * 设计字体
+ */
+public class DesignFont extends BaseEntity {
+    @Comment("")
+    @RColumn("id")
+    private long id;
+
+    @Comment("字体名称")
+    @RColumn("fontname")
+    private String fontName;
+
+    @Comment("字体缩略图")
+    @RColumn("fontthumburl")
+    private String fontThumbUrl;
+
+    @Comment("")
+    @RColumn("voidflag")
+    private int voidFlag;
+
+    @Comment("字体链接")
+    @RColumn("fontfilepath")
+    private String fontFilePath;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getFontName() {
+        return fontName;
+    }
+
+    public void setFontName(String fontName) {
+        this.fontName = fontName;
+    }
+
+    public String getFontThumbUrl() {
+        return fontThumbUrl;
+    }
+
+    public void setFontThumbUrl(String fontThumbUrl) {
+        this.fontThumbUrl = fontThumbUrl;
+    }
+
+    public int getVoidFlag() {
+        return voidFlag;
+    }
+
+    public void setVoidFlag(int voidFlag) {
+        this.voidFlag = voidFlag;
+    }
+
+    public String getFontFilePath() {
+        return fontFilePath;
+    }
+
+    public void setFontFilePath(String fontFilePath) {
+        this.fontFilePath = fontFilePath;
+    }
+}

+ 129 - 0
sdCommon/src/main/java/com/sdtool/common/entity/design/DesignTemplate.java

@@ -1,27 +1,156 @@
 package com.sdtool.common.entity.design;
 
 import com.sdtool.common.entity.base.BaseEntity;
+import com.sweetfish.util.Comment;
+import org.rex.db.RColumn;
 
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 设计模板
+ */
 public class DesignTemplate extends BaseEntity {
+    @RColumn("id")
+    @Comment("")
     private long id;
 
+    @RColumn("templatename")
+    @Comment("模板名称")
     private String templateName;
 
+    @RColumn("backgroundpath")
+    @Comment("背景图片")
     private String backgroundPath;
 
+    @RColumn("viewthumbpath")
+    @Comment("缩略图")
     private String viewThumbPath;
 
+    @RColumn("canvasheight")
+    @Comment("画布高(mm)")
     private double canvasHeight;
 
+    @RColumn("canvaswidth")
+    @Comment("画布宽(mm)")
     private double canvasWidth;
 
+    @RColumn("breedheight")
+    @Comment("拼版尺寸高")
     private double breedHeight;
 
+    @RColumn("breedwidth")
+    @Comment("拼版尺寸宽")
     private double breedWidth;
 
+    @RColumn("idproduct")
+    @Comment("产品id,暂时手传")
     private long idProduct;
 
+    @Comment("")
+    @RColumn("voidflag")
+    private int voidFlag;
+
+    @RColumn("jsoncontent")
+    @Comment("模板属性json,数据库记录的是文件链接")
+    private String jsonContent;
+
+    @Comment("元素")
+    private List<DesignTemplateItem> itemList = new ArrayList<>();
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public void setTemplateName(String templateName) {
+        this.templateName = templateName;
+    }
+
+    public String getBackgroundPath() {
+        return backgroundPath;
+    }
+
+    public void setBackgroundPath(String backgroundPath) {
+        this.backgroundPath = backgroundPath;
+    }
+
+    public String getViewThumbPath() {
+        return viewThumbPath;
+    }
+
+    public void setViewThumbPath(String viewThumbPath) {
+        this.viewThumbPath = viewThumbPath;
+    }
+
+    public double getCanvasHeight() {
+        return canvasHeight;
+    }
+
+    public void setCanvasHeight(double canvasHeight) {
+        this.canvasHeight = canvasHeight;
+    }
+
+    public double getCanvasWidth() {
+        return canvasWidth;
+    }
+
+    public void setCanvasWidth(double canvasWidth) {
+        this.canvasWidth = canvasWidth;
+    }
+
+    public double getBreedHeight() {
+        return breedHeight;
+    }
+
+    public void setBreedHeight(double breedHeight) {
+        this.breedHeight = breedHeight;
+    }
+
+    public double getBreedWidth() {
+        return breedWidth;
+    }
+
+    public void setBreedWidth(double breedWidth) {
+        this.breedWidth = breedWidth;
+    }
+
+    public long getIdProduct() {
+        return idProduct;
+    }
+
+    public void setIdProduct(long idProduct) {
+        this.idProduct = idProduct;
+    }
+
+    public List<DesignTemplateItem> getItemList() {
+        return itemList;
+    }
+
+    public void setItemList(List<DesignTemplateItem> itemList) {
+        this.itemList = itemList;
+    }
+
+    public int getVoidFlag() {
+        return voidFlag;
+    }
 
+    public void setVoidFlag(int voidFlag) {
+        this.voidFlag = voidFlag;
+    }
 
+    public String getJsonContent() {
+        return jsonContent;
+    }
 
+    public void setJsonContent(String jsonContent) {
+        this.jsonContent = jsonContent;
+    }
 }

+ 130 - 0
sdCommon/src/main/java/com/sdtool/common/entity/design/DesignTemplateItem.java

@@ -0,0 +1,130 @@
+package com.sdtool.common.entity.design;
+
+import com.sdtool.common.entity.base.BaseEntity;
+import com.sweetfish.util.Comment;
+import org.rex.db.RColumn;
+
+/**
+ * 设计元素
+ */
+public class DesignTemplateItem extends BaseEntity {
+    @Comment("")
+    @RColumn("id")
+    private long id;
+
+    @Comment("关联的模板id")
+    @RColumn("idtemplate")
+    private long idTemplate;
+
+    @Comment("元素类型")
+    @RColumn("itemtype")
+    private int itemType;
+
+    @Comment("坐标x(锚点相对于拼版尺寸左上角)")
+    @RColumn("locationx")
+    private double locationX;
+
+    @Comment("坐标y(锚点相对于拼版尺寸左上角)")
+    @RColumn("locationy")
+    private double locationY;
+
+    @Comment("元素宽")
+    @RColumn("sizewidth")
+    private double sizeWidth;
+
+    @Comment("元素高")
+    @RColumn("sizeheight")
+    private double sizeHeight;
+
+    @Comment("旋转角度")
+    @RColumn("rotation")
+    private double rotation;
+
+    @Comment("z轴顺序,0最底层")
+    @RColumn("zindex")
+    private int zIndex;
+
+    @Comment("元素属性json,通常是文件链接")
+    @RColumn("jsoncontent")
+    private String jsonContent;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getIdTemplate() {
+        return idTemplate;
+    }
+
+    public void setIdTemplate(long idTemplate) {
+        this.idTemplate = idTemplate;
+    }
+
+    public int getItemType() {
+        return itemType;
+    }
+
+    public void setItemType(int itemType) {
+        this.itemType = itemType;
+    }
+
+    public double getLocationX() {
+        return locationX;
+    }
+
+    public void setLocationX(double locationX) {
+        this.locationX = locationX;
+    }
+
+    public double getLocationY() {
+        return locationY;
+    }
+
+    public void setLocationY(double locationY) {
+        this.locationY = locationY;
+    }
+
+    public double getSizeWidth() {
+        return sizeWidth;
+    }
+
+    public void setSizeWidth(double sizeWidth) {
+        this.sizeWidth = sizeWidth;
+    }
+
+    public double getSizeHeight() {
+        return sizeHeight;
+    }
+
+    public void setSizeHeight(double sizeHeight) {
+        this.sizeHeight = sizeHeight;
+    }
+
+    public double getRotation() {
+        return rotation;
+    }
+
+    public void setRotation(double rotation) {
+        this.rotation = rotation;
+    }
+
+    public int getzIndex() {
+        return zIndex;
+    }
+
+    public void setzIndex(int zIndex) {
+        this.zIndex = zIndex;
+    }
+
+    public String getJsonContent() {
+        return jsonContent;
+    }
+
+    public void setJsonContent(String jsonContent) {
+        this.jsonContent = jsonContent;
+    }
+}

+ 173 - 0
sdWebCore/src/main/java/com/sdtool/webcore/rest/DesignRest.java

@@ -0,0 +1,173 @@
+package com.sdtool.webcore.rest;
+
+import com.dySweetFishPlugin.sql.RMapUtils;
+import com.sdtool.common.api.mall.DesignService;
+import com.sdtool.common.base.BaseService;
+import com.sdtool.common.datas.ERPHeader;
+import com.sdtool.common.datas.HttpCode;
+import com.sdtool.common.entity.design.DesignFont;
+import com.sdtool.common.entity.design.DesignTemplate;
+import com.sdtool.common.entity.site.ERPTokenUser;
+import com.sdtool.common.entity.system.CompanyInfo;
+import com.sweetfish.net.http.*;
+import com.sweetfish.service.Local;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.source.PageFlipper;
+import com.sweetfish.util.AutoLoad;
+import org.rex.RMap;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+@AutoLoad(false)
+@Local
+@RestService(name = "design", moduleid = 10, comment = "设计模块")
+public class DesignRest extends BaseService {
+    @Resource
+    private DesignService designService;
+
+    //region 设计字体
+    @RestMapping(name = "getDesignFonts", auth = true, sort = 1, comment = "获取设计字体", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignFont.class)
+    public CompletableFuture<RMap> getDesignFonts(
+            @RestParam(name = "params", comment = "搜索内容", required = false) RMap searchData,
+            @RestParam(name = "orderBy", comment = "排序", required = false) String orderBy,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<List<DesignFont>> result = designService.getDesignFonts(searchData, dataSourceId, Long.parseLong(supplierCode));
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, result.getPageFlipper());
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+
+    @RestMapping(name = "addDesignFont", auth = true, sort = 2, comment = "新增设计字体", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignFont.class)
+    public CompletableFuture<RMap> addDesignFont(
+            @RestParam(name = "font", comment = "字体") DesignFont designFont,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<DesignFont> result = designService.addDesignFont(designFont, dataSourceId, Long.parseLong(supplierCode), currentUser);
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, null);
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+
+    @RestMapping(name = "voidDesignFont", auth = true, sort = 3, comment = "禁用设计字体", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignFont.class)
+    public CompletableFuture<RMap> voidDesignFont(
+            @RestParam(name = "font", comment = "字体") DesignFont designFont,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<DesignFont> result = designService.voidDesignFont(designFont, dataSourceId, Long.parseLong(supplierCode), currentUser);
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, null);
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+    //endregion
+
+
+    //region 设计模板
+    @RestMapping(name = "queryDesignTemplates", auth = true, sort = 10, comment = "获取设计模板", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignTemplate.class)
+    public CompletableFuture<RMap> queryDesignTemplates(
+            @RestParam(name = "params", comment = "搜索内容", required = false) RMap searchData,
+            @RestParam(name = "page", comment = "分页信息", required = false) PageFlipper pageFlipper,
+            @RestParam(name = "orderBy", comment = "排序", required = false) String orderBy,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<List<DesignTemplate>> result = designService.queryDesignTemplates(searchData, pageFlipper, dataSourceId, Long.parseLong(supplierCode));
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, result.getPageFlipper());
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+
+    @RestMapping(name = "getDesignTemplateEdit", auth = true, sort = 11, comment = "获取设计模板--供编辑", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignTemplate.class)
+    public CompletableFuture<RMap> getDesignTemplateEdit(
+            @RestParam(name = "id", comment = "id") long id,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<DesignTemplate> result = designService.getDesignTemplateEdit(id, dataSourceId, Long.parseLong(supplierCode));
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, result.getPageFlipper());
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+
+    @RestMapping(name = "getDesignTemplateImposition", auth = true, sort = 12, comment = "获取设计模板--供流程", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignTemplate.class)
+    public CompletableFuture<RMap> getDesignTemplateImposition(
+            @RestParam(name = "id", comment = "id") long id,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<DesignTemplate> result = designService.getDesignTemplateImposition(id, dataSourceId, Long.parseLong(supplierCode));
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, result.getPageFlipper());
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+
+    @RestMapping(name = "updateDesignTemplate", auth = true, sort = 14, comment = "新增/修改设计模板", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignTemplate.class)
+    public CompletableFuture<RMap> updateDesignTemplate(
+            @RestParam(name = "template", comment = "字体") DesignTemplate designTemplate,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<DesignTemplate> result = designService.updateDesignTemplate(designTemplate, dataSourceId, Long.parseLong(supplierCode), currentUser);
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, null);
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+
+    @RestMapping(name = "voidDesignTemplate", auth = true, sort = 15, comment = "禁用设计模板", methods = {"POST"})
+    @WebApiBean(result = true, type = DesignTemplate.class)
+    public CompletableFuture<RMap> voidDesignTemplate(
+            @RestParam(name = "template", comment = "字体") DesignTemplate designTemplate,
+            @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
+            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
+            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
+        return CompletableFuture.supplyAsync(
+                () -> {
+                    RetResult<DesignTemplate> result = designService.voidDesignTemplate(designTemplate, dataSourceId, Long.parseLong(supplierCode), currentUser);
+                    if (result.isSuccess())
+                        return RMapUtils.successV2(result.getResult(), null, null);
+                    else return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
+                }, getExecutor()
+        );
+    }
+    //endregion
+}