Commit 20109acc by wangweidong

土工试验LIMS初始化修改

parent 14ba1fa8
FROM java:8
VOLUME /tmp
EXPOSE 8005
# Path to jar created by gradle build
ADD build/libs/patzn-cloud-service-lims-1.0.jar app.jar
RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
\ No newline at end of file
ext {
configuration = [
javaVersion = JavaVersion.VERSION_1_8
]
// 仓库配置
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://repo.spring.io/release' }
maven { url 'https://repo.spring.io/milestone' }
maven { url 'http://repo.spring.io/snapshot' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'http://119.3.176.130:8081/repository/patzn-releases/' }
maven { url 'http://119.3.176.130:8081/repository/patzn-snapshots/' }
jcenter()
}
}
// 编译脚本
buildscript {
ext {
springCloudVersion = "Greenwich.SR2"
springBootVersion = "2.1.7.RELEASE"
nettyAllVersion = '4.1.43.Final'
}
// 仓库配置
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://repo.spring.io/release' }
maven { url 'https://repo.spring.io/milestone' }
maven { url 'http://repo.spring.io/snapshot' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: "java"
apply plugin: "maven"
apply plugin: "idea"
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
group = "com.patzn.cloud"
version = "1.0"
description "计量检定服务"
sourceCompatibility = "${javaVersion}"
targetCompatibility = "${javaVersion}"
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
configurations {
compile.exclude group: "ch.qos.logback"
compile.exclude group: "com.amazonaws"
compile.exclude group: "org.apache.tomcat"
// 使用Undertow 替代Tomcat
compile.exclude module: "spring-boot-starter-tomcat"
compile.exclude module: "undertow-websockets-jsr"
compile.exclude module: "spring-boot-starter-logging"
compile.exclude module: "slf4j-simple"
}
// 依赖管理
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
dependencies {
compile fileTree(dir: "libs", include: "*.jar")
// 报表依赖 Begin
compile("org.apache.commons:commons-lang3:3.5")
compile("commons-beanutils:commons-beanutils-core:1.8.3")
compile("com.itextpdf:itextpdf:5.5.13")
compile("com.google.zxing:core:3.3.3")
compile("org.codehaus.jackson:jackson-mapper-asl:1.9.13")
compile("commons-io:commons-io:2.5")
compile("commons-fileupload:commons-fileupload:1.3.3")
compile("org.antlr:antlr4-runtime:4.7.1")
compile("org.dom4j:dom4j:2.1.1")
// 报表依赖 End
compile("com.baomidou:jobs-spring-boot-starter:1.0.3.3")
compile("io.netty:netty-all:${nettyAllVersion}")
compile("com.cronutils:cron-utils:9.0.2")
compile("com.caucho:hessian:4.0.62")
compile("com.patzn.cloud:patzn-entitys:2.0")
compile("com.patzn.cloud:patzn-feign-base:2.0")
compile("com.patzn.cloud:patzn-feign-lims:2.0")
compile("com.patzn.cloud:patzn-feign-standard:2.0")
compile("com.patzn.cloud:patzn-service-parent:2.0")
compile("com.patzn.cloud:patzn-oss-starter:2.0")
compile("com.patzn.cloud:patzn-mq-starter:2.0")
compile("org.springframework.boot:spring-boot-starter-mail")
compile('org.springframework.boot:spring-boot-starter-freemarker')
compile("org.springframework.boot:spring-boot-starter-data-redis")
compile("com.belerweb:pinyin4j:2.5.1")
compile("com.patzn.cloud:patzn-poi-box:2.0")
compile("net.coobird:thumbnailator:0.4.8")
compile("com.google.guava:guava:25.1-jre")
compile("net.java.dev.jna:jna-platform:4.5.2")
compile("net.java.dev.jna:jna:4.5.2")
compile("com.google.zxing:core:3.3.3")
compile("com.google.zxing:javase:3.3.3")
compile("com.baomidou:dynamic-datasource-spring-boot-starter:2.5.7")
compile("com.qcloud:cos_api:5.2.4") {
exclude module: 'slf4j-log4j12'
}
compile("org.json:json:20170516")
// compile group: 'cn.afterturn',name:'easypoi-spring-boot-starter',version:'4.0.0'
// 开发环境经常自动启动导致报错
// compileOnly("org.springframework.boot:spring-boot-devtools")
/*compile("mysql:mysql-connector-java:8.0.12")*/
// 监控客户端
compile("de.codecentric:spring-boot-admin-starter-client:2.2.0")
// 编译测试
testCompile("com.patzn.cloud:patzn-test-parent:2.0")
}
// 帕特智能 - 云平台计量检测服务模块
rootProject.name = 'patzn-cloud-service-soil-back'
package com.patzn.cloud.service.lims;
import com.patzn.cloud.commons.lock.EnableRedisDistributedLock;
import com.patzn.cloud.commons.spring.SpringHelper;
import com.patzn.cloud.commons.starter.EnablePatzn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* <p>
* LimsService 实验室管理服务
* </p>
*
* @author hubin
* @since 2017-08-28
*/
@EnablePatzn
@EnableAsync
@EnableCaching
@EnableSwagger2
@EnableDiscoveryClient
@EnableRedisDistributedLock
@SpringBootApplication
@EnableTransactionManagement
@EnableFeignClients(basePackages = {"com.patzn.cloud.feign"})
public class SoilServiceApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SoilServiceApplication.class);
}
private static final Logger logger = LoggerFactory.getLogger(SoilServiceApplication.class);
public static void main(String[] args) {
SpringApplication application = new SpringApplication(SoilServiceApplication.class);
application.setBannerMode(Banner.Mode.CONSOLE);
SpringHelper.setApplicationContext(application.run(args));
SoilServiceApplication.logger.info("SoilService start!\thttp://api.dev.patzn.com:7000/soil/swagger-ui.html");
}
}
package com.patzn.cloud.service.lims.common;
import com.aspose.cells.License;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
/**
* @version 1.0 说明 :
*/
public class Excel2Pdf {
public static boolean getLicense() {
boolean result = false;
try {
InputStream is = Word2Pdf.class.getClassLoader()
.getResourceAsStream("classpath:statis/license.xml");
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static void excel2pdf(String sourceFilePath, String desFilePath) {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!getLicense()) {
return;
}
try {
// 输出路径
File pdfFile = new File(desFilePath);
// 原始excel路径
Workbook wb = new Workbook(sourceFilePath);
FileOutputStream fileOS = new FileOutputStream(pdfFile);
wb.save(fileOS, SaveFormat.PDF);
fileOS.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.patzn.cloud.service.lims.common;
import com.patzn.cloud.commons.toolkit.DateUtils;
import com.patzn.cloud.service.lims.env.vo.EnvSampleDetailVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.xwpf.usermodel.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class ExportPlanSample {
public static void setPlanSample(XWPFDocument doc, String tablePlanSampleTitlt, Map<String,String> tablePlanSampleMap, List<EnvSampleDetailVO> sampleList){
//创建表格1 标题
XWPFParagraph paragraphTableOneTitle= doc.createParagraph();
XWPFRun runTableOneTitle= paragraphTableOneTitle.createRun();
paragraphTableOneTitle.setAlignment(ParagraphAlignment.CENTER);
runTableOneTitle.setBold(true);
runTableOneTitle.setTextPosition(50);
runTableOneTitle.setFontSize(12);
runTableOneTitle.setText(tablePlanSampleTitlt);
//处理表格
int count=1;
if (CollectionUtils.isNotEmpty(sampleList)){
count= sampleList.size();
}
//创建表格1
XWPFTable tableOne = doc.createTable(count+1,tablePlanSampleMap.size());
XWPFTableRow rowOne0=getRow(tableOne,0);
rowOne0.setHeight(120);
int tableOneTitleIndex=0;
for (Map.Entry<String,String> map :tablePlanSampleMap.entrySet()) {
rowOne0.getCell(tableOneTitleIndex).setText(map.getValue());
tableOneTitleIndex++;
}
Map<Integer ,Integer> merger=new LinkedHashMap<>();
String point="";
Integer mergeStart=1;
Integer mergeSum=0;
for (int i=0;i<count;i++) {
int tableOneContentIndex=0;
EnvSampleDetailVO sampleDetailVO= sampleList.get(i);
if ("".equalsIgnoreCase(point)){
point =sampleDetailVO.getPoint();
}else{
if (sampleDetailVO.getPoint().equalsIgnoreCase(sampleList.get(i-1).getPoint())){
mergeSum++;
}else{
merger.put(mergeStart,mergeStart+mergeSum);
mergeStart=mergeStart+mergeStart+mergeSum;
}
if (i==count-1){
merger.put(mergeStart,count);
}
}
for (Map.Entry<String,String> map :tablePlanSampleMap.entrySet()) {
if ("samplingDate".equalsIgnoreCase(map.getKey())){
String date=DateUtils.toYearMonthDay(sampleDetailVO.getSamplingDate());
StringHandleUtils.setText(tableOne,i+1,tableOneContentIndex,date);
}else{
StringHandleUtils.setText(tableOne,i+1,tableOneContentIndex,StringHandleUtils.getFieldValueByFieldName(map.getKey(),sampleDetailVO));
}
tableOneContentIndex++;
}
}
for (Map.Entry<Integer,Integer> mapMerger :merger.entrySet()) {
PoiUtil2007.mergeCellsVertically(tableOne, 0, mapMerger.getKey(), mapMerger.getValue());
PoiUtil2007.mergeCellsVertically(tableOne, 3, mapMerger.getKey(), mapMerger.getValue());
}
}
public static XWPFTableRow getRow(XWPFTable table, int rowIndex){
return table.getRow(rowIndex);
}
public static boolean isNotEmpty(Object object){
return null!=object;
}
}
package com.patzn.cloud.service.lims.common;
import com.patzn.cloud.service.lims.env.vo.EnvPlanVO;
import org.apache.poi.xwpf.usermodel.*;
import java.lang.reflect.Method;
import java.util.Map;
public class ExportPlanUtil {
public static void setPlanInfo(XWPFDocument doc, String titlePlan,
String titleTableOne, Map<String,String> tableOneMap,
EnvPlanVO plan){
//创建方案标题
XWPFParagraph paragraphPlanTitle= doc.createParagraph();
XWPFRun runPlanTitle= paragraphPlanTitle.createRun();
runPlanTitle.setText(titlePlan);
runPlanTitle.setBold(true);
//创建表格1 标题
XWPFParagraph paragraphTableOneTitle= doc.createParagraph();
XWPFRun runTableOneTitle= paragraphTableOneTitle.createRun();
paragraphTableOneTitle.setAlignment(ParagraphAlignment.CENTER);
runTableOneTitle.setBold(true);
runTableOneTitle.setTextPosition(50);
runTableOneTitle.setFontSize(12);
runTableOneTitle.setText(titleTableOne);
int count=1;
if (isNotEmpty(plan)){
count= plan.getPointNum();
}
//创建表格1
XWPFTable tableOne = doc.createTable(count+1,tableOneMap.size());
/* tableOne.setCellMargins(30, 0, 0, 1200);// top, left, bottom, right
*/ XWPFTableRow rowOne0=getRow(tableOne,0);
rowOne0.setHeight(120);
int tableOneTitleIndex=0;
for (Map.Entry<String,String> map :tableOneMap.entrySet()) {
rowOne0.getCell(tableOneTitleIndex).setText(map.getValue());
tableOneTitleIndex++;
}
for (int i=0;i<count;i++) {
int tableOneContentIndex=0;
for (Map.Entry<String,String> map :tableOneMap.entrySet()) {
if (map.getKey().equalsIgnoreCase("points")){
String points= StringHandleUtils.getFieldValueByFieldName(map.getKey(),plan);
StringHandleUtils.setText(tableOne,i+1,tableOneContentIndex,points.split("、")[i]);
}else{
StringHandleUtils.setText(tableOne,i+1,tableOneContentIndex,StringHandleUtils.getFieldValueByFieldName(map.getKey(),plan));
}
tableOneContentIndex++;
}
}
PoiUtil2007.mergeCellsVertically(tableOne, 1, 1, count);
PoiUtil2007.mergeCellsVertically(tableOne, 2, 1, count);
PoiUtil2007.mergeCellsVertically(tableOne, 3, 1, count);
PoiUtil2007.mergeCellsVertically(tableOne, 4, 1, count);
}
public static XWPFTableRow getRow(XWPFTable table, int rowIndex){
return table.getRow(rowIndex);
}
public static boolean isNotEmpty(Object object){
return null!=object;
}
public static String getChineseNormalNum(int num) {
switch (num){
case 1:
return "一";
case 2:
return "二";
case 3:
return "三";
case 4:
return "四";
case 5:
return "五";
case 6:
return "六";
case 7:
return "七";
case 8:
return "八";
case 9:
return "九";
case 10:
return "十";
default:
return "";
}
}
public static String getChineseNum(int num) {
switch (num){
case 1:
return "一";
case 2:
return "三";
case 3:
return "五";
case 4:
return "七";
case 5:
return "九";
case 6:
return "十一";
case 7:
return "十三";
case 8:
return "十五";
case 9:
return "十七";
case 10:
return "十九";
default:
return "";
}
}
public static String getChineseTwoNum(int num) {
switch (num){
case 1:
return "二";
case 2:
return "四";
case 3:
return "六";
case 4:
return "八";
case 5:
return "十";
case 6:
return "十二";
case 7:
return "十四";
case 8:
return "十六";
case 9:
return "十八";
case 10:
return "二十";
default:
return "";
}
}
}
package com.patzn.cloud.service.lims.common;
import com.google.common.collect.Lists;
import java.util.List;
/**
* @author zhaokai
* @since 2019-11-19
*/
public interface FoodConstants {
/**
* 食品生成原始记录的绑定的数据源的key
*
* @see com.patzn.cloud.service.lims.food.service.impl.FoodItemServiceImpl#originalRecordDataBind(Long[], Long, com.patzn.cloud.commons.controller.Account)
*/
String DATASOURCE_COMMON = "common";
String CTIME = "ctime";
String CTIME_CN = "ctimeCn";
String CTIME_POINT = "ctimePoint";
String SAMPLE = "sample";
String SAMPLING = "sampling";
String CONTRACT = "contract";
String CUSTOMER = "customer";
String ENGLISH_COMMA = ",";
String CHINESE_COMMA = ",";
String PRE_RECORD = "preRecord";
String EMPTY_STR = "";
/**
* 这个表示在回调结果时,项目的行和列定位的是样品编号
*/
String ONE_ITEM_MANY_SAMPLE = "callback_sample";
String CONTENT = "content";
String DATA_SCALA = "dataQuantityScala";
String APTITUDE_ITEM_ATTACHMENT = "aptitudeItemAttachment";
String DATA_REQUEST = "revisionRequest";
String DATA_SIGNATURE = "dataQuantitySignatures";
String DATA_FORMULA = "dataQuantityFormula";
/**
* 食品的特殊的汉字检测值
*/
List<String> TEST_VALUE_LIST = Lists.newArrayList("ND", "不得检出", "未检出", "商业无菌");
/**
* 检测步骤处 JSON 字符串的 key 值
*/
String STEP_INFO = "stepInfo";
String PARAM_INFO = "paramInfo";
String DATA = "data";
String STEP_INFO_TEMP_LIST = "stepInfoTempList";
String COMMON_LIST = "commonList";
String LIST = "list";
String NAME = "name";
String FIELD_NAME = "fieldName";
String TITLE = "title";
String VALUE = "value";
String COMPLEX = "COMPLEX";
String SAMPLE_STEP = "SAMPLE_STEP";
String ITEM_STEP = "ITEM_STEP";
String STEP_OPTIONS_LIST = "optionsList";
String COMPLEX_LIST = "complexList";
String ITEM_LIST = "itemList";
String SAMPLE_LIST = "sampleList";
String INFO_LIST = "infoList";
String COMPLEX_INFO_LIST = "complexInfoList";
String SINGLE = "single";
String NUM = "num";
String SAMPLE_NUM = "sampleNum";
String TEST_VALUE = "testValue";
String TEST_VALUE_5 = "testValue5";
String TEST_VALUE_STR = "testValueStr";
String STEP_ID = "stepId";
String EQUIP = "equip";
String NAMES = "names";
String NUMS = "nums";
String DEFAULT_VALUE = "defaultValue";
String ID = "id";
String EQUIP_INFO_SAVE = "equipInfoSave";
String TEXT = "text";
String OBJECT = "object";
String ARRAY = "array";
String DATA_FIELD_TYPE = "dataFieldType";
String PROPERTIES = "properties";
String STRING = "string";
String TYPE = "type";
String TABLE = "table";
String DATA_SOURCE_BASE = "{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"properties\":{\"sample\":{\"dataFieldType\":\"text\",\"type\":\"string\",\"properties\":{\"num\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"name\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"boothNum\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"testBasis\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"standard\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"judgeBasis\":{\"dataFieldType\":\"text\",\"type\":\"string\"}}},\"common\":{\"dataFieldType\":\"text\",\"type\":\"string\",\"properties\":{\"ctime\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"ctimeCn\":{\"dataFieldType\":\"text\",\"type\":\"string\"},\"ctimePoint\":{\"dataFieldType\":\"text\",\"type\":\"string\"}}},\"sampling\":{\"dataFieldType\":\"text\",\"type\":\"string\",\"properties\":{\"samplingNum\":{\"dataFieldType\":\"text\",\"type\":\"string\"}}}},\"type\":\"object\"}";
}
package com.patzn.cloud.service.lims.common;
/**
* 食品导出检测任务单的常量
*
* @author zhaokai
* @since 2019-12-25
*/
public interface FoodExportTestTaskConstants {
/**
* 是, 否
*/
String YES_NO = "%s是 %s否";
/**
* 任务类别
*/
String TASK_TYPE_DJK_CONFIG = "taskTypeDjk";
String TASK_TYPE_DJK = "%s日常监督抽检 %s专项监督抽检 %s风险监测";
String TASK_TYPE_DAILY = "日常监督抽检";
String TASK_TYPE_SPECIAL = "专项监督抽检";
String TASK_TYPE_RISK = "风险监测";
/**
* 抽样地点
*/
String SAMPLING_PLACE_DJK_CONFIG = "samplingPlaceDjk";
String SAMPLING_PLACE_DJK = "生产环节:%s原辅料库 %s生产线/生产现场 %s半成品库 成品库(%s待检区 %s已检区) \n" +
"流通环节:%s农贸市场 %s菜市场 %s批发市场 %s商场 %s超市 %s小食杂店 %s网购 其他( %s ) \n" +
"餐饮环节:餐馆(%s特大型餐馆 %s大型餐馆 %s中型餐馆 %s小型餐馆) \n" +
" 食堂(%s机关食堂 %s学校/托幼食堂 %s企事业单位食堂 %s建筑工地食堂) \n" +
" %s小吃店 %s快餐店 %s饮品店 %s集体用餐配送单位 %s中央厨房 %s其他( %s )\n";
String SAMPLING_PLACE_YFLK = "原辅料库";
String SAMPLING_PLACE_SCXC = "生产线";
String SAMPLING_PLACE_BCPK = "半成品库";
String SAMPLING_PLACE_CPKDJQ = "成品库(待检区)";
String SAMPLING_PLACE_CPKYJQ = "成品库(已检区)";
String SAMPLING_PLACE_NMSC = "农贸市场";
String SAMPLING_PLACE_CSC = "菜市场";
String SAMPLING_PLACE_PFSC = "批发市场";
String SAMPLING_PLACE_SC = "商场";
String SAMPLING_PLACE_SUPERMARKET = "超市";
String SAMPLING_PLACE_XSZD = "小食杂店";
String SAMPLING_PLACE_WG = "网购";
String SAMPLING_PLACE_TDXCG = "餐馆(特大型餐馆)";
String SAMPLING_PLACE_DXCG = "餐馆(大型餐馆)";
String SAMPLING_PLACE_ZXCG = "餐馆(中型餐馆)";
String SAMPLING_PLACE_XXCG = "餐馆(小型餐馆)";
String SAMPLING_PLACE_JGST = "食堂(机关食堂)";
String SAMPLING_PLACE_XXTYST = "食堂(学校/托幼食堂)";
String SAMPLING_PLACE_QSYDW = "食堂(企事业单位食堂)";
String SAMPLING_PLACE_JZGDST = "食堂(建筑工地食堂)";
String SAMPLING_PLACE_XCD = "小吃店";
String SAMPLING_PLACE_KCD = "快餐店";
String SAMPLING_PLACE_YPD = "饮品店";
String SAMPLING_PLACE_JTYCPS = "集体用餐配送单位";
String SAMPLING_PLACE_ZYCF = "中央厨房";
String SAMPLING_PLACE_ELSE = "其他";
String SAMPLING_PLACE_FLOW = "食品流通";
String SAMPLING_PLACE_FOOD = "餐饮服务";
/**
* 样品来源
*/
String SOURCE_DJK_CONFIG = "sourceDjk";
String SOURCE_DJK = "%s加工/自制 %s委托生产 %s外购 %s其他";
String SOURCE_DJK_PRODUCE = "加工/自制";
String SOURCE_DJK_CONTRACT = "委托生产";
String SOURCE_DJK_BUY_OUT = "外购";
String SOURCE_DJK_ELSE = "其他";
/**
* 样品属性
*/
String PROPERTIES_DJK_CONFIG = "propertiesDjk";
String PROPERTIES_DJK = "%s普通食品 %s特殊膳食食品 %s节令食品 %s重大活动保障食品";
String PROPERTIES_DJK_COMMON = "普通食品";
String PROPERTIES_DJK_SPECIAL = "特殊膳食食品";
String PROPERTIES_DJK_SEASON = "节令食品";
String PROPERTIES_DJK_ACTIVITY_FOOD = "重大活动保障食品";
/**
* 日期类型
*/
String DATE_TYPE_DJK_CONFIG = "dateTypeDjk";
String DATE_TYPE_DJK = "%s生产/%s加工/%s购进日期";
String DATE_TYPE_DJK_PRODUCE = "生产";
String DATE_TYPE_DJK_MACHINING = "加工";
String DATE_TYPE_DJK_BUY = "购进";
/**
* 生产许可证编号
*/
String LICENSE_NO_ARRAY_DJK_CONFIG = "licenseNoArrDjk";
String LICENSE_NO_DJK_CONFIG = "licenseNoDjk";
String LICENSE_NO_DJK = "%s食品生产许可证号\n%s生产加工小作坊许可证号";
/**
* 是否出口
*/
String EXPORT_CONFIG = "exportDjk";
/**
* 抽样数量带单位
*/
String QUANTITY_UNIT_CONFIG = "quantityUnit";
/**
* 抽样方式
*/
String SAMPLING_METHOD_DJK_CONFIG = "samplingMethodDjk";
String SAMPLING_METHOD_DJK = "%s无菌抽样\n%s非无菌抽样";
String SAMPLING_METHOD_DJK_NO_GERM = "无菌抽样";
String SAMPLING_METHOD_DJK_GERM = "非无菌抽样";
/**
* 抽样样品包装
*/
String SAMPLING_PACKING_DJK_CONFIG = "samplingPackingDjk";
String SAMPLING_PACKING_DJK = "%s玻璃瓶 %s塑料瓶 %s塑料袋 %s无菌袋 %s其他(%s)";
String SAMPLING_PACKING_DJK_GLASS_BOTTLE = "玻璃瓶";
String SAMPLING_PACKING_DJK_PLASTIC_BOTTLE = "塑料瓶";
String SAMPLING_PACKING_DJK_PLASTIC_BAG = "塑料袋";
String SAMPLING_PACKING_DJK_NO_GERM = "无菌袋";
String SAMPLING_PACKING_DJK_ELSE = "其他";
/**
* 样品保存条件
*/
String KEEP_STATE_DJK_CONFIG = "keepStateDjk";
String KEEP_STATE_DJK = "%s常温 %s冷藏 %s冷冻 %s避光 %s密闭 %s其他(%s)";
String KEEP_STATE_DJK_CHANG_WEN = "常温";
String KEEP_STATE_DJK_LENG_CANG = "冷藏";
String KEEP_STATE_DJK_LENG_DONG = "冷冻";
String KEEP_STATE_DJK_BI_GUANG = "避光";
String KEEP_STATE_DJK_MI_BI = "密闭";
/**
* 许可证类型
*/
String LICENSE_TYPE_DJK_CONFIG = "licenseTypeDjk";
String LICENSE_TYPE_DJK = "%s食品经营许可证号 %s小餐饮经营许可证号";
String LICENSE_TYPE_DJK_FOOD_MANAGE = "食品经营许可证";
String LICENSE_TYPE_DJK_FOOD = "餐饮经营许可证";
/**
* 包装分类
*/
String PACK_CLASS_DJK_CONFIG = "packClassDjk";
String PACK_CLASS_DJK = "%s散装 %s预包装";
String PACK_CLASS_DJK_SAN_ZHUANG = "散装";
String PACK_CLASS_DJK_YU_BAO_ZHUANG = "预包装";
/**
* 区域类型
*/
String AREA_TYPE_CONFIG = "areaType";
String AREA_TYPE = "%s城市 %s乡村 %s景点";
String AREA_TYPE_CITY = "城市";
String AREA_TYPE_COUNTRY = "乡村";
String AREA_TYPE_ATTRACTIONS = "景点";
String FOOD_SAMPLE_TESTED_CONFIG = "tested";
String FOOD_SAMPLE_TESTER_CONFIG = "tester";
String FOOD_SAMPLE_PRODUCER_CONFIG = "producer";
/**
* 生产/加工/购进日期
*/
String DATE_TIME_CHINESE = "dateTypeCn";
String DATE_TIME_POINT = "dateTypePoint";
}
package com.patzn.cloud.service.lims.common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
public class LabreOfficeUtil {
private static final Logger logger = LoggerFactory.getLogger(LabreOfficeUtil.class);
//
//
//
//
//
//
//
// public static synchronized File libreOffice2PDF(String url,File inputfile) {
// logger.error("LabreOfficeUtil开始转化PDF");
// String fileName = inputfile.getName().replace(".xlsx","");
// File outputfile=null;
// String LibreOffice_HOME = url;
// DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
// OfficeManager officeManager=null;
// logger.error("fileName"+fileName);
// try {
//
//
// outputfile= File.createTempFile(fileName,".pdf");
//
//
// logger.error("outputfile"+outputfile.getName());
//
//
// // libreOffice的安装目录
// configuration.setOfficeHome(new File(LibreOffice_HOME));
// // 端口号
// configuration.setPortNumber(8100);
// //configuration.setPortNumbers(ports);
// logger.error("configuration.setPortNumber(8100);F");
// configuration.setTaskExecutionTimeout(1000 * 60 * 25L);
//// 设置任务执行超时为10分钟
// configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
//// 设置任务队列超时为24小时
// officeManager = configuration.buildOfficeManager();
// officeManager.start();
// OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
// converter.getFormatRegistry();
// converter.convert(inputfile, outputfile);
// } catch (Exception e) {
// logger.error("pdf转化失败"+e.getMessage());
// e.printStackTrace();
// } finally {
// officeManager.stop();
// }
//
// return outputfile;
//
//
//
// }
public static void main(String[] args) {
convertOffice2PDF("D:/patzn-lims/libreoffice6.1/libreoffice6.1",new File("D:/icps/aaa.xlsx"));
}
public static synchronized File convertOffice2PDF(String url,File inputFile){
long start = System.currentTimeMillis();
boolean flag;
String parent= inputFile.getParent();
String pdfFile = parent+"/"+(inputFile.getName().replace(".xlsx",".pdf"));
// String osName = System.getProperty("os.name");
// if (osName.contains("Windows")) {
// }else {
// command = "libreoffice --headless --invisible --convert-to pdf:writer_pdf_Export " + inputFile + " --outdir " + pdfFile;
// }
String osName = System.getProperty("os.name");
String command="";
if(osName.contains("win")||osName.contains("Win")){
command = "cmd /c soffice --headless --invisible --convert-to pdf " + inputFile.getPath() + " --outdir " + parent;
flag = executeLibreOfficeCommand(command,url);
}else{
command = "libreoffice6.2 --headless --invisible --convert-to pdf:writer_pdf_Export " + inputFile.getPath() + " --outdir " + parent;
flag = executeLibreOfficeCommand(command);
}
long end = System.currentTimeMillis();
logger.debug("用时:{} ms", end - start);
if (true){
return new File(pdfFile);
}
return null;
}
/**
* 执行command指令
* @param command
* @return
*/
public static boolean executeLibreOfficeCommand(String command,String url) {
logger.info("开始进行转化.......");
Process process;// Process可以控制该子进程的执行或获取该子进程的信息
try {
logger.debug("convertOffice2PDF cmd : {}", command);
process = Runtime.getRuntime().exec(command,null,new File(url+"/program"));// exec()方法指示Java虚拟机创建一个子进程执行指定的可执行程序,并返回与该子进程对应的Process对象实例。
// 下面两个可以获取输入输出流
// InputStream errorStream = process.getErrorStream();
// InputStream inputStream = process.getInputStream();
} catch (IOException e) {
logger.error(" convertOffice2PDF {} error", command, e);
return false;
}
int exitStatus = 0;
try {
exitStatus = process.waitFor();// 等待子进程完成再往下执行,返回值是子线程执行完毕的返回值,返回0表示正常结束
// 第二种接受返回值的方法
int i = process.exitValue(); // 接收执行完毕的返回值
logger.debug("i----" + i);
} catch (InterruptedException e) {
logger.error("InterruptedException convertOffice2PDF {}", command, e);
return false;
}
if (exitStatus != 0) {
logger.error("convertOffice2PDF cmd exitStatus {}", exitStatus);
} else {
logger.debug("convertOffice2PDF cmd exitStatus {}", exitStatus);
}
process.destroy(); // 销毁子进程
logger.info("转化结束.......");
return true;
}
public static boolean executeLibreOfficeCommand(String command) {
logger.info("开始进行转化.......");
Process process;// Process可以控制该子进程的执行或获取该子进程的信息
try {
logger.debug("convertOffice2PDF cmd : {}", command);
process = Runtime.getRuntime().exec(command);// exec()方法指示Java虚拟机创建一个子进程执行指定的可执行程序,并返回与该子进程对应的Process对象实例。
// 下面两个可以获取输入输出流
// InputStream errorStream = process.getErrorStream();
// InputStream inputStream = process.getInputStream();
} catch (IOException e) {
logger.error(" convertOffice2PDF {} error", command, e);
return false;
}
int exitStatus = 0;
try {
exitStatus = process.waitFor();// 等待子进程完成再往下执行,返回值是子线程执行完毕的返回值,返回0表示正常结束
// 第二种接受返回值的方法
int i = process.exitValue(); // 接收执行完毕的返回值
logger.debug("i----" + i);
} catch (InterruptedException e) {
logger.error("InterruptedException convertOffice2PDF {}", command, e);
return false;
}
if (exitStatus != 0) {
logger.error("convertOffice2PDF cmd exitStatus {}", exitStatus);
} else {
logger.debug("convertOffice2PDF cmd exitStatus {}", exitStatus);
}
process.destroy(); // 销毁子进程
logger.info("转化结束.......");
return true;
}
}
package com.patzn.cloud.service.lims.common;
public class LongHandleUtils {
public static boolean isYes(Integer num){
return null!=num&&num.equals(1);
}
}
package com.patzn.cloud.service.lims.common;
import java.util.*;
public final class MsgUrlDataUtils {
public static final String REVIEW_URL = "/entrust/entrust_review";
}
package com.patzn.cloud.service.lims.common;
import java.time.Instant;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.FastDateFormat;
/**
* 订单编号策略
*
* @project common-utils
* @fileName ODDGenerator.java
* @Description
* @author light-zhang
* @date 2018年5月11日
* @version 1.0.0
*/
public abstract class ODDGenerator {
private static final FastDateFormat pattern = FastDateFormat.getInstance("yyyyMMddHHmmss");
private static final AtomicInteger atomicInteger = new AtomicInteger(1);
private static ThreadLocal<StringBuilder> threadLocal = new ThreadLocal<StringBuilder>();
/**
* 【长码生成策略】
*
* @时间20180511231532
* @二位随机数
* @lock的hash-code编码
* @param lock 生成的UUID32位参数
* @return 长码机制
*/
public static String getC(String lock) {
StringBuilder builder = new StringBuilder(pattern.format(Instant.now().toEpochMilli()));// 取系统当前时间作为订单号前半部分
builder.append(Math.abs(lock.hashCode()));// HASH-CODE
builder.append(atomicInteger.getAndIncrement());// 自增顺序
threadLocal.set(builder);
return threadLocal.get().toString();
}
/**
* 【短码生成策略】
*
* @param lock
* @return
*/
public static String getD(String lock) {
StringBuilder builder = new StringBuilder(ThreadLocalRandom.current().nextInt(0,999));// 随机数
builder.append(Math.abs(lock.hashCode()));// HASH-CODE
builder.append(atomicInteger.getAndIncrement());// 自增顺序
threadLocal.set(builder);
return threadLocal.get().toString();
}
/**
* 1000个线程并发测试
*
* @param args
* @throws InterruptedException
* @throws ExecutionException
*/
public static void main(String[] args) throws InterruptedException, ExecutionException {
Set<String> set = new HashSet<String>();
FutureTask<String> task = null;
long startTime = System.currentTimeMillis();
for (int i = 0; i <1; i++) {
Callable<String> callable = new Callable<String>() {
@Override
public String call() throws Exception {
// System.out.println("当前线程:>>>>> ".concat(Thread.currentThread().getName()));
// return getC(StringUtils.replace(UUID.randomUUID().toString(), "-", ""));
return getD(StringUtils.replace(UUID.randomUUID().toString(), "-", ""));
}
};
task = new FutureTask<String>(callable);
new Thread(task).start();
//System.out.println(task.get());
set.add(task.get());
}
System.out.println("总共耗时:" + ((System.currentTimeMillis() - startTime)) + "ms");
System.out.println("*************** " + set.size());
}
}
\ No newline at end of file
package com.patzn.cloud.service.lims.common;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class OrderNumUtil {
public final static Map<String, Integer> psdMap= new HashMap<>();
static {
psdMap.put("00",5);
psdMap.put("01",9);
psdMap.put("02",0);
psdMap.put("03",8);
psdMap.put("04",1);
psdMap.put("05",7);
psdMap.put("06",2);
psdMap.put("07",6);
psdMap.put("08",4);
psdMap.put("09",3);
psdMap.put("10",3);
psdMap.put("11",4);
psdMap.put("12",6);
psdMap.put("13",2);
psdMap.put("14",7);
psdMap.put("15",7);
psdMap.put("16",8);
psdMap.put("17",0);
psdMap.put("18",9);
psdMap.put("19",5);
psdMap.put("20",1);
psdMap.put("21",3);
psdMap.put("22",5);
psdMap.put("23",7);
psdMap.put("24",9);
psdMap.put("25",2);
psdMap.put("26",4);
psdMap.put("27",6);
psdMap.put("28",8);
psdMap.put("29",0);
psdMap.put("30",0);
psdMap.put("31",8);
psdMap.put("32",6);
psdMap.put("33",4);
psdMap.put("34",2);
psdMap.put("35",9);
psdMap.put("36",7);
psdMap.put("37",5);
psdMap.put("38",3);
psdMap.put("39",1);
psdMap.put("40",1);
psdMap.put("41",9);
psdMap.put("42",2);
psdMap.put("43",8);
psdMap.put("44",3);
psdMap.put("45",7);
psdMap.put("46",4);
psdMap.put("47",6);
psdMap.put("48",5);
psdMap.put("49",0);
psdMap.put("50",0);
psdMap.put("51",5);
psdMap.put("52",6);
psdMap.put("53",4);
psdMap.put("54",7);
psdMap.put("55",3);
psdMap.put("56",8);
psdMap.put("57",2);
psdMap.put("58",9);
psdMap.put("59",1);
psdMap.put("60",9);
psdMap.put("61",8);
psdMap.put("62",7);
psdMap.put("63",6);
psdMap.put("64",5);
psdMap.put("65",0);
psdMap.put("66",1);
psdMap.put("67",2);
psdMap.put("68",3);
psdMap.put("69",4);
psdMap.put("70",4);
psdMap.put("71",3);
psdMap.put("72",2);
psdMap.put("73",1);
psdMap.put("74",0);
psdMap.put("75",5);
psdMap.put("76",6);
psdMap.put("77",7);
psdMap.put("78",8);
psdMap.put("79",9);
}
public static String makePsd(String num) {
Map<Integer, Integer> indexNumMap= new HashMap<>();
int length = num.length();
for (int i=0;i<length;i++){
String indexNum= String.valueOf(num.charAt(i));
indexNumMap.put(i, Integer.parseInt(indexNum));
}
StringBuffer buffer = new StringBuffer();
for (Map.Entry<Integer, Integer> e:indexNumMap.entrySet()) {
int index = e.getKey();
int value = e.getValue();
String numKey = index+""+value;
numKey.intern();
Integer valueOk= psdMap.get(numKey);
if (null == valueOk){
valueOk= value;
}
buffer.append(valueOk);
}
return buffer.toString();
}
public static String getPsdNum(String num) {
Map<String, Integer> jiemi = new HashMap<>();
for (Map.Entry<String, Integer> e:psdMap.entrySet()) {
String index = e.getKey();
String first= String.valueOf(index.charAt(0)) ;
String next= String.valueOf(index.charAt(1)) ;
int firstNum = Integer.parseInt(first);
int nextNum = Integer.parseInt(next);
int trueNum = e.getValue();
jiemi.put(firstNum+"---"+trueNum,nextNum);
}
StringBuffer buffer = new StringBuffer();
int length = num.length();
for (int i=0;i<length;i++){
String indexNum= String.valueOf(num.charAt(i));
String key = i+"---"+indexNum;
key.intern();
Integer okValue= jiemi.get(key);
if (null == okValue){
okValue = Integer.parseInt(indexNum);
}
buffer.append(okValue);
}
return buffer.toString();
}
public static String getOrderNum(String code){
SimpleDateFormat sd = new SimpleDateFormat("yyMMddHHmmss");
return "NO"+sd.format(new Date())+""+makePsd(code);
}
public static void main(String[] args) {
System.out.println(getOrderNum("1234"));
System.out.println(getPsdNum("67509271099672"));
}
}
package com.patzn.cloud.service.lims.common;
import java.util.*;
public final class StringStaticDataUtils {
public static final String SUCCESS = "success";
public static final String FALSE = "false";
public static final String ZERO = "0";
public static final String ONE = "1";
public static final String JING = "#";
public static final String SELECT_WAITING_ITEM = "请选择待提交的项目";
public static final String CONTRACT_ID_NULL = "委托id未传递";
public static final String CONTRACT_WRONG = "委托有误";
public static final String SELECT_SAMPLE = "请选择样品";
public static final String DATA_WRONG = "数据有误";
public static final String MSG_TITLE_QC_TASK = "新的质控编制任务";
public static final Map<String,List<String>> mapItemFlows=new HashMap<>();
static {
List<String> draftItemList=new ArrayList<>();
draftItemList.add("ALLOT");
draftItemList.add("INPUT");
mapItemFlows.put("DRAFT",draftItemList);
List<String> allotItemList=new ArrayList<>();
allotItemList.add("INPUT");
mapItemFlows.put("ALLOT",allotItemList);
List<String> inputItemList=new ArrayList<>();
inputItemList.add("REVIEW");
inputItemList.add("AUDIT");
inputItemList.add("COLLECT");
mapItemFlows.put("INPUT",inputItemList);
List<String> reviewItemList=new ArrayList<>();
reviewItemList.add("AUDIT");
reviewItemList.add("COLLECT");
mapItemFlows.put("REVIEW",reviewItemList);
List<String> auditItemList=new ArrayList<>();
auditItemList.add("COLLECT");
mapItemFlows.put("AUDIT",auditItemList);
List<String> collectItemList=new ArrayList<>();
collectItemList.add("END");
mapItemFlows.put("COLLECT",collectItemList);
}
public static final Map<String,List<String>> mapFlows=new HashMap<>();
static {
List<String> draftList=new ArrayList<>();
draftList.add("SEARCH");
draftList.add("PLAN");
draftList.add("REVIEW");
draftList.add("SIGN");
draftList.add("SAMPLING_ARRANGE");
mapFlows.put("DRAFT",draftList);
List<String> searchList=new ArrayList<>();
searchList.add("PLAN");
searchList.add("REVIEW");
searchList.add("SIGN");
searchList.add("SAMPLING_ARRANGE");
mapFlows.put("SEARCH",searchList);
List<String> planList=new ArrayList<>();
planList.add("PROJECT_LEADER");
planList.add("REVIEW");
planList.add("SIGN");
planList.add("SAMPLING_ARRANGE");
mapFlows.put("PLAN",planList);
List<String> planCheckList=new ArrayList<>();
planCheckList.add("REVIEW");
planCheckList.add("SIGN");
planCheckList.add("SAMPLING_ARRANGE");
mapFlows.put("PROJECT_LEADER",planCheckList);
List<String> reviewList=new ArrayList<>();
reviewList.add("SIGN");
reviewList.add("SAMPLING_ARRANGE");
mapFlows.put("REVIEW",reviewList);
List<String> signList=new ArrayList<>();
signList.add("SAMPLING_ARRANGE");
mapFlows.put("SIGN",signList);
List<String> samplingArrangeList=new ArrayList<>();
samplingArrangeList.add("SAMPLING");
mapFlows.put("SAMPLING_ARRANGE",samplingArrangeList);
List<String> samplingList=new ArrayList<>();
samplingList.add("RECEIVE");
mapFlows.put("SAMPLING",samplingList);
List<String> receiveList=new ArrayList<>();
receiveList.add("WAIT_QC");
receiveList.add("TESTING");
mapFlows.put("RECEIVE",receiveList);
List<String> testingList=new ArrayList<>();
receiveList.add("REPORT_ALLOT");
mapFlows.put("TESTING",testingList);
List<String> reportAllotList=new ArrayList<>();
reportAllotList.add("REPORT_MAKE");
mapFlows.put("REPORT_ALLOT",reportAllotList);
List<String> reportMakeList=new ArrayList<>();
reportMakeList.add("REPORT_CHECK");
mapFlows.put("REPORT_MAKE",reportMakeList);
List<String> reportCheckList=new ArrayList<>();
reportCheckList.add("REPORT_ISSUE");
mapFlows.put("REPORT_CHECK",reportCheckList);
List<String> reportIssueList=new ArrayList<>();
reportIssueList.add("REPORT_PRINT");
mapFlows.put("REPORT_ISSUE",reportIssueList);
List<String> reportPrintList=new ArrayList<>();
reportPrintList.add("REPORT_FILE");
mapFlows.put("REPORT_PRINT",reportPrintList);
List<String> reportFileList=new ArrayList<>();
reportFileList.add("END");
mapFlows.put("REPORT_FILE",reportFileList);
}
public static final Map<String,String> mapFlowOption=new LinkedHashMap<>();
static {
mapFlowOption.put("DRAFT", "草稿");
mapFlowOption.put("SEARCH", "现场调查");
mapFlowOption.put("PLAN", "方案编制");
mapFlowOption.put("PROJECT_LEADER", "项目负责人评审");
mapFlowOption.put("TECHNOLOGY_LEADER", "技术负责人评审");
mapFlowOption.put("REVIEW", "采样委托评审");
mapFlowOption.put("SIGN", "采样委托签订");
mapFlowOption.put("SAMPLING_ARRANGE", "采样任务安排");
mapFlowOption.put("SAMPLING", "采样任务进行中");
mapFlowOption.put("RECEIVE", "待样品接收发放");
mapFlowOption.put("WAIT_QC", "待实验室加质控");
mapFlowOption.put("TESTING", "实验室检测中");
mapFlowOption.put("REPORT_ALLOT", "待报告编制分配");
mapFlowOption.put("REPORT_MAKE", "待报告编制");
mapFlowOption.put("REPORT_CHECK", "待报告审核");
mapFlowOption.put("REPORT_ISSUE", "待报告签发");
mapFlowOption.put("REPORT_PRINT", "待报告打印发放");
mapFlowOption.put("REPORT_FILE", "待报告归档");
mapFlowOption.put("END", "结束");
}
public static final Map<String,String> mapFlowItemOption=new LinkedHashMap<>();
static {
mapFlowItemOption.put("DRAFT", "初始");
mapFlowItemOption.put("ALLOT", "待分配");
mapFlowItemOption.put("CLAIM", "待认领");
mapFlowItemOption.put("INPUT", "待数据录入");
mapFlowItemOption.put("REVIEW", "待数据复核");
mapFlowItemOption.put("AUDIT", "待数据审核");
mapFlowItemOption.put("COLLECT", "数据汇总");
mapFlowItemOption.put("END", "检测完成");
}
public static final List<String> reportModelList=new ArrayList<>();
static {
reportModelList.add("envReport.docx");
reportModelList.add("envSendReport.docx");
reportModelList.add("envSampleItemReport.docx");
}
}
package com.patzn.cloud.service.lims.common;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
/**
* @version 1.0
* 说明 :
*/
public class Word2Pdf {
public static void main(String[] args) {
String sourceFilePath="L:/testPDF/test.xls";//可生成PDF 没问题
String desFilePath="L:\\testPDF\\PDF\\test.pdf";
word2pdf(sourceFilePath, desFilePath);
}
public static boolean getLicense() {
boolean result = false;
try {
InputStream is = Word2Pdf.class.getClassLoader().getResourceAsStream(
"classpath:statis/license.xml");
com.aspose.words.License aposeLic = new com.aspose.words.License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static void word2pdf(String sourceFilePath,String desFilePath) {
if (!getLicense()) { // 验证License 若不验证则转化出的PDP文档会有水印产生
return;
}
try {
File file = new File(desFilePath); // 新建一个空白pdf文档
FileOutputStream os = new FileOutputStream(file);
Document doc = new Document(sourceFilePath); // Address是将要被转化的word文档
doc.save(os, SaveFormat.PDF); // 全面支持DOC, DOCX, OOXML, RTF HTML,
// OpenDocument, PDF, EPUB, XPS, SWF
// 相互转换 os.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.patzn.cloud.service.lims.common.service;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.Map;
public interface IExportService {
String storageWord(XWPFDocument doc, String filePath);
Map<String, Object> wordToMap(String docFilePath);
String filePath(String fileName);
InputStream entrustInputStreamPath(String fileName);
InputStream inputStreamPath(String fileName);
String fileFolderPath(String folder, String fileName);
/**
* <p>
* 下载 DOCX 文件
* </p>
*
* @param response 响应流
* @param fileName 文件名
* @param doc DOCX 文档对象
*/
void downloadDoc(HttpServletResponse response, String fileName, XWPFDocument doc);
void downloadXls(HttpServletResponse response, String fileName, HSSFWorkbook workbook);
void downloadXlsx(HttpServletResponse response, String fileName, XSSFWorkbook workbook);
void downloadXlsxs(HttpServletResponse response, String fileName, SXSSFWorkbook workbook);
XWPFDocument getXWPFDoc(String folder, String modelName);
XWPFDocument getXWPFDoc(InputStream io);
XSSFWorkbook getXSSFWorkbook(String modelName);
SXSSFWorkbook getSXSSFWorkbook(String modelName);
XSSFWorkbook getXSSFWorkbook(InputStream io);
HSSFWorkbook getHSSFWorkbook(String modelName);
}
package com.patzn.cloud.service.lims.common.service;
import com.patzn.cloud.commons.controller.Account;
import java.util.List;
public interface ILmsMsgService {
/**
* <p>
* 发送消息通知
* </p>
*
* @param uri 取拥有uri权限人员的参数
* @param content 发送消息的主体内容
* @param title 标题
* @param account 发送消息的人
* @param toUserId 接受消息的人
*/
void sendMsg(String uri, String content, String title, Account account, List<Long> toUserId);
/**
* <p>
* 发送消息通知
* </p>
*
* @param uri 取拥有uri权限人员的参数
* @param msgType 消息类型
* @param content 发送消息的主体内容
* @param title 标题
* @param account 发送消息的人
* @param toUserId 接受消息的人
*/
void sendMsg(String uri, String msgType, String content, String title, Account account, List<Long> toUserId);
/**
* <p>
* 给审批组下的人发消息
* </p>
*
* @param businessType 消息业务类型
* @param groupAlias 审批组别名
* @param content 消息主题内容
* @param title 标题
* @param account 发送消息的人
*/
void sendMsg(int businessType, String groupAlias, String content, String title, Account account);
}
package com.patzn.cloud.service.lims.common.service;
import com.patzn.cloud.commons.controller.Account;
import java.util.List;
public interface ISteelMsgService {
void sendMsg(String uri, String content, String title, Account account, List<Long> toUserId);
}
package com.patzn.cloud.service.lims.common.service.impl;
import com.patzn.cloud.commons.api.RestAssert;
import com.patzn.cloud.service.lims.common.service.IExportService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 导出相关
* </p>
*
* @author wwd
* @since 2018-06-13
*/
@Service
public class ExportServiceImpl implements IExportService {
private final Logger logger = LoggerFactory.getLogger(ExportServiceImpl.class);
@Override
public String storageWord(XWPFDocument doc, String filePath) {
try (
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileOutputStream out = new FileOutputStream(filePath, true)
) {
doc.write(bos);
out.write(bos.toByteArray());
} catch (Exception e) {
logger.error("保存 word 异常", e);
return null;
}
return filePath;
}
@Override
public Map<String, Object> wordToMap(String docFilePath) {
String filePath = String.format("templates/word/model/%s", docFilePath);
// 兼容打包 JAR 压缩情况处理
logger.debug("doc 文件路径 {}", docFilePath);
XWPFDocument doc = null;
try (InputStream in = this.getClass().getClassLoader().getResourceAsStream(filePath)) {
doc = new XWPFDocument(in);
} catch (Exception e) {
logger.error("word 转 map 异常", e);
}
Map<String, Object> map = new HashMap<>(2);
if (null!=doc&&null != doc.getTables()) {
map.put("table", doc.getTables().iterator());
}
map.put("doc", doc);
return map;
}
@Override
public String filePath(String fileName) {
URL url = this.getClass().getClassLoader().getResource("templates/word/model/" + fileName);
RestAssert.fail(null == url, fileName + "不存在");
return url.getPath();
}
@Override
public String fileFolderPath(String folder,String fileName) {
URL url = this.getClass().getClassLoader().getResource("templates/word/"+folder+"/" + fileName);
RestAssert.fail(null == url, fileName + "不存在");
return url.getPath();
}
public String fileFolderPath(String fileName) {
URL url = this.getClass().getClassLoader().getResource("templates/excel/"+fileName);
RestAssert.fail(null == url, fileName + "不存在");
return url.getPath();
}
public InputStream fileInputStreamPath(String fileName) {
InputStream url = this.getClass().getClassLoader().getResourceAsStream("templates/excel/"+fileName);
return url;
}
@Override
public InputStream entrustInputStreamPath(String fileName) {
InputStream url = this.getClass().getClassLoader().getResourceAsStream("templates/word/entrust/"+fileName);
return url;
}
@Override
public InputStream inputStreamPath(String fileName) {
InputStream url = this.getClass().getClassLoader().getResourceAsStream("templates/"+fileName);
return url;
}
@Override
public void downloadDoc(HttpServletResponse response, String fileName, XWPFDocument doc) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.addHeader("Content-Disposition", String.format("attachment; filename=%s;charset=UTF-8", fileName));
try (
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream os = response.getOutputStream()
) {
doc.write(bos);
os.write(bos.toByteArray());
os.flush();
} catch (Exception e) {
logger.error("word 转 map 异常", e);
}
}
@Override
public void downloadXls(HttpServletResponse response, String fileName, HSSFWorkbook workbook) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.addHeader("Content-Disposition", String.format("attachment; filename=%s;charset=UTF-8", fileName));
try (
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream os = response.getOutputStream()
) {
workbook.write(bos);
os.write(bos.toByteArray());
os.flush();
} catch (Exception e) {
logger.error("excel 转 map 异常", e);
}
}
@Override
public void downloadXlsx(HttpServletResponse response, String fileName, XSSFWorkbook workbook) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.addHeader("Content-Disposition", String.format("attachment; filename=%s;charset=UTF-8", fileName));
try (
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream os = response.getOutputStream()
) {
workbook.write(bos);
os.write(bos.toByteArray());
os.flush();
} catch (Exception e) {
logger.error("excel 转 map 异常", e);
}
}
@Override
public void downloadXlsxs(HttpServletResponse response, String fileName, SXSSFWorkbook workbook) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.addHeader("Content-Disposition", String.format("attachment; filename=%s;charset=UTF-8", fileName));
try (
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream os = response.getOutputStream()
) {
workbook.write(bos);
os.write(bos.toByteArray());
os.flush();
} catch (Exception e) {
logger.error("excel 转 map 异常", e);
}
}
@Override
public XWPFDocument getXWPFDoc(String folder, String modelName) {
FileInputStream in;
XWPFDocument doc = null;
try {
in = new FileInputStream(new File(fileFolderPath(folder,modelName)));
doc = new XWPFDocument(in);
} catch (Exception e1) {
e1.printStackTrace();
}
return doc;
}
@Override
public XWPFDocument getXWPFDoc(InputStream io) {
XWPFDocument doc = null;
try {
doc = new XWPFDocument(io);
} catch (Exception e1) {
e1.printStackTrace();
}
return doc;
}
@Override
public XSSFWorkbook getXSSFWorkbook(String modelName){
InputStream is;
XSSFWorkbook xssfWorkbook=null;
try {
is = fileInputStreamPath(modelName);
xssfWorkbook = new XSSFWorkbook(is);
} catch (Exception e1) {
e1.printStackTrace();
}
return xssfWorkbook;
}
@Override
public SXSSFWorkbook getSXSSFWorkbook(String modelName){
InputStream is;
SXSSFWorkbook xssfWorkbook=null;
try {
is = fileInputStreamPath(modelName);
xssfWorkbook = new SXSSFWorkbook(new XSSFWorkbook(is));
xssfWorkbook.setCompressTempFiles(true); //压缩临时文件,很重要,否则磁盘很快就会被写满
} catch (Exception e1) {
e1.printStackTrace();
}
return xssfWorkbook;
}
@Override
public XSSFWorkbook getXSSFWorkbook(InputStream io) {
XSSFWorkbook xssfWorkbook=null;
try {
xssfWorkbook = new XSSFWorkbook(io);
} catch (Exception e1) {
e1.printStackTrace();
}
return xssfWorkbook;
}
@Override
public HSSFWorkbook getHSSFWorkbook(String modelName){
FileInputStream is;
HSSFWorkbook xssfWorkbook=null;
try {
is = new FileInputStream(new File(fileFolderPath(modelName)));
xssfWorkbook = new HSSFWorkbook(is);
} catch (Exception e1) {
e1.printStackTrace();
}
return xssfWorkbook;
}
}
\ No newline at end of file
//package com.patzn.cloud.service.lims.common.service.impl;
//import com.patzn.cloud.commons.controller.Account;
//import com.patzn.cloud.mq.MqMsg;
//import com.patzn.cloud.mq.MqProperties;
//import com.patzn.cloud.service.lims.common.service.ILmsMsgService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.AmqpException;
//import org.springframework.amqp.core.AmqpTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class LmsMsgService implements ILmsMsgService {
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
//
// @Autowired
// private AmqpTemplate amqpTemplate;
// @Autowired
// private MqProperties mqProperties;
// @Value("${spring.application.name}")
// private String service;
//
// @Override
// public void sendMsg(String uri, String content, String title, Account account, List<Long> toUserId) {
// sendMsg(uri, null, content, title, account, toUserId);
// }
//
// @Override
// public void sendMsg(String uri, String msgType, String content, String title, Account account, List<Long> toUserId) {
// try {
// MqMsg mqMsg = getMqMsg(uri, msgType, content, title, account, toUserId, 0, null);
// mqMsg.setService(service);
// amqpTemplate.convertAndSend(mqProperties.getTopic().getMeterWorkMsg(), mqMsg);
// } catch (AmqpException e) {
// logger.error("发送消息异常:", e);
// }
// }
//
// @Override
// public void sendMsg(int businessType, String groupAlias, String content, String title, Account account) {
// try {
// MqMsg mqMsg = getMqMsg(null, null, content, title, account, null, businessType, groupAlias);
// amqpTemplate.convertAndSend(mqProperties.getTopic().getMeterWorkMsg(), mqMsg);
// } catch (AmqpException e) {
// logger.error("发送消息异常:", e);
// }
// }
//
// private MqMsg getMqMsg(String uri, String msgType, String content, String title, Account account, List<Long> toUserId, int businessType, String groupAlias) {
// MqMsg mqMsg = new MqMsg();
//// mqMsg.setUid(account.getUserId());
//// // 消息类型
//// mqMsg.setMsgType(msgType);
//// if (StringUtils.isNotEmpty(msgType) && StringUtils.isEmpty(uri)) {
//// // 不是空的并且路由是空的,需要根据 msgType 查询标签的路由
//// mqMsg.setUri(EnvMessageTypeEnum.getByValue(msgType));
//// } else {
//// // 路由
//// mqMsg.setUri(uri);
//// }
//// // 企业ID
//// mqMsg.setCompanyId(account.getCompanyId());
//// // 发送人
//// mqMsg.setSender(account.getUserName());
//// // 标题
//// mqMsg.setTitle(title);
//// // 内容
//// mqMsg.setContent(content);
//// // 类型
//// mqMsg.setType(1);
//// // 服务名称
//// mqMsg.setService(service);
//// // 接收人集合
//// mqMsg.setReceiverIds(toUserId);
//// mqMsg.setBusinessType(businessType);
//// mqMsg.setBusiness(groupAlias);
// return mqMsg;
// }
//
//}
//
package com.patzn.cloud.service.lims.config;
import com.patzn.cloud.commons.exception.ExceptionAspect;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AspectConfig {
@Bean
public ExceptionAspect exceptionAspect() {
return new ExceptionAspect();
}
}
package com.patzn.cloud.service.lims.config;
import com.netflix.loadbalancer.IRule;
import com.patzn.cloud.zuul.LocalRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.patzn.cloud.commons.controller.LoginHelper;
import feign.Request;
import feign.RequestInterceptor;
import feign.RequestTemplate;
/**
* <p>
* Feign拦截器
* </p>
*
* @author hubin
* @since 2017-09-28
*/
@Configuration
public class FeignConfig implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
LoginHelper.setAccessToken(requestTemplate);
}
@Bean
public Request.Options options() {
return new Request.Options(
10000,
10000
);
}
}
package com.patzn.cloud.service.lims.config;
import com.patzn.cloud.commons.spring.ServiceExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* <p>
* 全局异常处理
* </p>
*
* @author hubin
* @since 2017-02-18
*/
@RestControllerAdvice
public class GlobalExceptionHandler extends ServiceExceptionHandler {
}
package com.patzn.cloud.service.lims.config;
import com.baomidou.jobs.starter.EnableJobs;
import org.springframework.context.annotation.Configuration;
/**
* @author dingzg
* @since 2019/10/18
*/
//@EnableJobs
//@Configuration
public class JobsConfig {
}
package com.patzn.cloud.service.lims.config;
import com.baomidou.dynamic.datasource.plugin.MasterSlaveAutoRoutingPlugin;
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.plugins.PerformanceInterceptor;
import com.baomidou.mybatisplus.plugins.parser.ISqlParser;
import com.baomidou.mybatisplus.plugins.parser.SqlInfo;
import com.baomidou.mybatisplus.plugins.parser.tenant.TenantHandler;
import com.baomidou.mybatisplus.plugins.parser.tenant.TenantSqlParser;
import com.baomidou.mybatisplus.toolkit.PluginUtils;
import com.patzn.cloud.commons.controller.LoginHelper;
import com.patzn.cloud.commons.service.BlockAttackSqlParser;
import com.patzn.cloud.commons.spring.PatznMetaObjectHandler;
import net.sf.jsqlparser.expression.BinaryExpression;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.insert.Insert;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.reflection.MetaObject;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* MybatisPlus 配置
* </p>
*
* @author hubin
* @since 2017-03-31
*/
@EnableTransactionManagement
@Configuration
@MapperScan("com.patzn.cloud.service.lims.*.mapper*")
public class MybatisPlusConfig {
@Autowired
protected HttpServletRequest request;
private Long currentCompanyId() {
try {
return LoginHelper.getAccount(request).getCompanyId();
} catch (Throwable t) {
// 不处理
return null;
}
}
/**
* mybatis-plus分页插件<br>
* 文档:http://mp.baomidou.com<br>
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
List<ISqlParser> sqlParserList = new ArrayList<>();
TenantSqlParser tenantSqlParser = new TenantSqlParser() {
@Override
public SqlInfo processParser(Statement statement) {
if (statement instanceof Insert) {
// 不处理插入操作
return null;
}
return super.processParser(statement);
}
@Override
protected BinaryExpression andExpression(Table table, Expression where) {
return super.andExpression(table, where);
}
@Override
public boolean allowProcess(MetaObject metaObject) {
MappedStatement mappedStatement = PluginUtils.getMappedStatement(metaObject);
if ("com.baomidou.mybatisplus.mapper.SqlRunner.SelectList".equals(mappedStatement.getId())) {
return false;
}
return true;
}
};
tenantSqlParser.setTenantHandler(new TenantHandler() {
@Override
public Expression getTenantId() {
return new LongValue(currentCompanyId());
}
@Override
public String getTenantIdColumn() {
return "company_id";
}
@Override
public boolean doTableFilter(String tableName) {
// 过滤不存在企业 ID 的表,兼容企业 ID 不存在定时任务可用
if (null == currentCompanyId()
|| "lms_chemical_stock_delivery".equals(tableName)
|| "lms_customer_detail".equals(tableName)
|| "lms_supplier_detail".equals(tableName)
|| "lms_equip_product".equals(tableName)
|| "lms_staff_rel_org".equals(tableName)
|| "lms_staff_item".equals(tableName)
|| "lms_staff_equip".equals(tableName)
|| "lms_staff_professional".equals(tableName)
|| "food_keywords".equals(tableName)) {
return true;
}
return false;
}
});
sqlParserList.add(tenantSqlParser);
sqlParserList.add(new BlockAttackSqlParser());
paginationInterceptor.setSqlParserList(sqlParserList);
return paginationInterceptor;
}
/**
* mybatis-plus SQL执行效率插件
*/
@Bean
@Profile({"dev", "test"})
public PerformanceInterceptor performanceInterceptor() {
return new PerformanceInterceptor();
}
/**
* 注入自动填充器
*/
@Bean
public MetaObjectHandler metaObjectHandler() {
return new PatznMetaObjectHandler();
}
/**
* 读写分离配置
*/
@Bean
@Profile({"test"})
public MasterSlaveAutoRoutingPlugin masterSlaveAutoRoutingPlugin(){
return new MasterSlaveAutoRoutingPlugin();
}
}
\ No newline at end of file
package com.patzn.cloud.service.lims.config;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.patzn.cloud.mq.MqAutoConfiguration;
import com.patzn.cloud.mq.log.LogDisruptor;
/**
* <p>
* RabbitMQ 消息推送服务配置
* </p>
*
* @author hubin
* @since 2018-01-05
*/
@Configuration
public class RabbitMQConfig extends MqAutoConfiguration {
/**
* 初始化耗材归类报警队列
*/
@Bean
public Queue chemicalClassifyWarningQueue() {
return new Queue(mqProperties.getTopic().getChemicalClassifyWarning());
}
/**
* 初始化跟踪日志队列
*/
@Bean
public Queue syslog() {
// 启动 lmax Disruptor
LogDisruptor.INSTANCE.start();
return new Queue(mqProperties.getTopic().getSyslog());
}
/**
* 初始化推送消息队列
*/
@Bean
public Queue pushMsgQueue() {
return new Queue(mqProperties.getTopic().getPushMsg());
}
/**
* 初始化期间核查消息队列
*/
@Bean
public Queue equipCheckQueue() {
return new Queue(mqProperties.getTopic().getEquipCheckMsg());
}
// /**
// * 初始化计量队列
// */
// @Bean
// public Queue meterQueue() {
// return new Queue(mqProperties.getTopic().getMeterWorkMsg());
// }
}
package com.patzn.cloud.service.lims.config;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import com.patzn.report.console.ReportServlet;
/**
* <p>
* 报表配置
* </p>
*
* @author hubin
* @since 2018-12-03
*/
//@Configuration
//@ImportResource("classpath:report-context.xml")
public class ReportConfig {
// @Bean
public ServletRegistrationBean initUReport() {
return new ServletRegistrationBean(new ReportServlet(), "/report/*");
}
}
\ No newline at end of file
package com.patzn.cloud.service.lims.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* <p>
* 服务配置属性,对应 yml 中配置
* </p>
*
* @author hubin
* @since 2018-07-17
*/
@Configuration
@ConfigurationProperties(prefix = "service")
public class ServiceProperties {
/**
* LibreOffice 转换路径 soffice
*/
private String soffice;
private String url;
public String getSoffice() {
return soffice;
}
public void setSoffice(String soffice) {
this.soffice = soffice;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
package com.patzn.cloud.service.lims.config;
import java.util.ArrayList;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* <p>
* RESTful 服务 API 管理框架 Swagger 配置初始化 <br>
* 官方地址:http://swagger.io<br>
* </p>
*
* @author hubin
* @since 2017-08-23
*/
@Configuration
@EnableSwagger2
@ConditionalOnProperty(prefix = "swagger", value = "enable")
public class SwaggerConfig {
/**
* 可以定义多个组,比如本类中定义把test和demo区分开了 (访问页面就可以看到效果了)
*/
@Bean
public Docket testApi() {
//全局参数配置
// List<Parameter> params = new ArrayList<>();
// Parameter jwtHeader = new ParameterBuilder()
// .name(RestConstants.TOKEN_FLAG)
// .defaultValue(RestConstants.TOKEN_DEFAULT)
// .description("访问 Token 登录授权 KEY")
// .modelRef(new ModelRef("string"))
// .parameterType("header")
// .required(false)
// .build();
// params.add(jwtHeader);
// API 配置
ApiSelectorBuilder asb = new Docket(DocumentationType.SWAGGER_2)
// .globalOperationParameters(params)
.apiInfo(this.apiInfo()).select();
asb.apis(RequestHandlerSelectors.basePackage("com.patzn.cloud.service"));
asb.paths(PathSelectors.any());
return asb.build();
}
private ApiInfo apiInfo() {
return new ApiInfo("Lims Service API",
"Lims 服务 API",
"1.0",
"NO terms of service",
new Contact("帕特智能", "", ""),
"帕特智能云",
"http://patzn.com"
, new ArrayList()
);
}
}
package com.patzn.cloud.service.lims.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import com.baomidou.kisso.web.interceptor.SSOSpringInterceptor;
import com.patzn.cloud.commons.spring.LoginHandlerInterceptor;
import com.patzn.cloud.commons.spring.WebServiceConfigurer;
import com.patzn.cloud.mq.log.LogInterceptor;
/**
* <p>
* WEB 初始化相关配置
* </p>
*
* @author hubin
* @since 2017-03-31
*/
@ControllerAdvice
@Configuration
public class WebConfig extends WebServiceConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// SSO 授权拦截器
SSOSpringInterceptor ssoInterceptor = new SSOSpringInterceptor();
ssoInterceptor.setHandlerInterceptor(new LoginHandlerInterceptor());
registry.addInterceptor(ssoInterceptor).addPathPatterns("/**");
// 表单重复提交拦截器
// registry.addInterceptor(new RepeatFormInterceptor()).excludePathPatterns("/list");
// 注入跟踪访问日志
registry.addInterceptor(new LogInterceptor().setService("lims"));
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
package com.patzn.cloud.service.lims.excel.controller;
import com.patzn.cloud.commons.api.RestAssert;
import com.patzn.cloud.commons.controller.ServiceController;
import com.patzn.poibox.excel.ExcelHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* Excel 相关控制器
* </p>
*
* @author hubin
* @since 2018-04-08
*/
@Api(description = "Excel 相关操作")
@RestController
@RequestMapping("/v1/excel")
public class ExcelController extends ServiceController {
private static final Map<String, String> TPL = new HashMap<>();
static {
ExcelController.TPL.put("QuotationList", "报价单导入模板");
ExcelController.TPL.put("MeterAptitudeItemImport", "授权资质检测项目导入模板");
ExcelController.TPL.put("MeterSampleImport", "样品导入模板");
ExcelController.TPL.put("MeterAptitudeImport", "授权资质导入模板");
ExcelController.TPL.put("MeterOutAptitudeImport", "资质外计量器具导入模板");
ExcelController.TPL.put("MeterSendSampleImport", "出检样品导入模板");
}
@ApiOperation(value = "根据模板名称下载模板", notes = "根据模板名称下载导入模板")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "模板名称", required = true, paramType = "path", dataType = "String"),
})
@GetMapping("/template/{name}")
public void template(@PathVariable("name") String name) {
RestAssert.fail(null == ExcelController.TPL.get(name), "导入模板不存请联系管理员");
try {
// 文件路径
String filePath = String.format("templates/excel/input/%s.xlsx", name);
// 兼容打包 JAR 压缩情况处理
ExcelHelper.excelTemplateDownload(response, ExcelController.TPL.get(name), getClass().getClassLoader().getResourceAsStream(filePath));
} catch (Throwable t) {
RestAssert.fail("该模板不存在");
}
}
}
package com.patzn.cloud.service.lims.handler;
public class ProgressEntity {
private String date;
private String content;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
# 开发环境
server:
exception:
enable: false
swagger:
enable: true
service:
api-url: http://api.dev.patzn.com:7000
url: http://api.dev.patzn.com:7000
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:postgresql://localhost:5432/dev_lims_meter
username: postgres
password: 123456
url: jdbc:postgresql://192.168.0.115:5432/dev_lims_meter
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 192.168.0.115
discovery:
health-check-interval: 5s
# host: localhost
rabbitmq:
host: 121.36.130.208
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: dev.topic.push.msg
sys-log: dev.topic.sys.log
chemical-classify-warning: dev.topic.chemical.classify.warning
equip-check-msg: dev.topic.equip.check.msg
report-make-msg: dev.topic.report.make.msg
meter-work-msg: dev.topic.soil.work.msg
### jobs
jobs:
admin-address: http://api.dev.patzn.com:7000/print
# 对象存储配置
oss:
bucket-name: pt-web-sys
aliyun:
endpoint: http://oss.test.patzn.com
folder: dev/soil
#libreOffice 安装信息
libreOffice:
url: C:/Program Files/LibreOffice
# ribbon 路由配置
food.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
print.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
res.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
convert.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
# 开发环境
server:
exception:
enable: false
swagger:
enable: true
service:
api-url: http://api.dev.patzn.com:7000
url: http://api.dev.patzn.com:7000
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:postgresql://localhost:5432/dev_lims_meter
username: dbmeter
password: sfdWrE39&d!Pt
url: jdbc:postgresql://139.9.144.39:5432/pertest_lims_meter
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: localhost
discovery:
health-check-interval: 5s
# host: localhost
rabbitmq:
host: 121.36.130.208
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: dev.topic.push.msg
sys-log: dev.topic.sys.log
chemical-classify-warning: dev.topic.chemical.classify.warning
equip-check-msg: dev.topic.equip.check.msg
env-work-msg: dev.topic.env.work.msg
food-work-msg: dev.topic.food.work.msg
food-statistics-customer-contract: dev.topic.food.statistics.customer.contract
food-statistics-contract-progress: dev.topic.food.statistics.contract.progress
food-statistics-sample-progress: dev.topic.food.statistics.sample.progress
report-make-msg: dev.topic.report.make.msg
### jobs
jobs:
admin-address: http://api.dev.patzn.com:7000/print
# 对象存储配置
oss:
bucket-name: pt-web-sys
aliyun:
endpoint: http://oss.test.patzn.com
folder: dev/soil
# ribbon 路由配置
food.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
print.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
res.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
convert.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
# 测试环境
server:
exception:
enable: false
swagger:
enable: true
service:
api-url: http://api.devtest.patzn.com
url: http://api.devtest.patzn.com
food-url: http://food.devtest.patzn.com
province-item-url: http://60.216.97.250:8087/
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://114.116.10.31:5432/devtest_lims
username: dbdevtest
password: devTest&10@31!Bg
# 注册中心配置
cloud:
consul:
host: 114.116.10.31
rabbitmq:
host: 114.116.10.31
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: devtest.topic.push.msg
sys-log: devtest.topic.sys.log
chemical-classify-warning: devtest.topic.chemical.classify.warning
equip-check-msg: devtest.topic.equip.check.msg
env-work-msg: devtest.topic.env.work.msg
food-work-msg: devtest.topic.food.work.msg
food-statistics-customer-contract: devtest.topic.food.statistics.customer.contract
food-statistics-contract-progress: devtest.topic.food.statistics.contract.progress
food-statistics-sample-progress: devtest.topic.food.statistics.sample.progress
report-make-msg: devtest.topic.report.make.msg
# Mongodb GridFS
data:
mongodb:
uri: mongodb://114.116.10.31:27017/lims
grid-fs-database: lims
# Mongodb GridFS 存储
oss:
grid-fs: true
bucket-name: base
\ No newline at end of file
# 开发环境
server:
exception:
enable: false
swagger:
enable: true
service:
api-url: http://api.dev.patzn.com:7000
url: http://api.dev.patzn.com:7000
food-url: http://web.dev.patzn.com:8090
province-item-url: http://60.216.97.250:8087
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:postgresql://localhost:5432/dev_lims
username: devuser
password: wqa21$#&w#n
url: jdbc:postgresql://39.98.166.218:5432/dev_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 39.98.166.218
# host: localhost
rabbitmq:
host: 121.36.130.208
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: dev.topic.push.msg
sys-log: dev.topic.sys.log
chemical-classify-warning: dev.topic.chemical.classify.warning
equip-check-msg: dev.topic.equip.check.msg
env-work-msg: dev.topic.env.work.msg
food-work-msg: dev.topic.food.work.msg
food-statistics-customer-contract: dev.topic.food.statistics.customer.contract
food-statistics-contract-progress: dev.topic.food.statistics.contract.progress
food-statistics-sample-progress: dev.topic.food.statistics.sample.progress
report-make-msg: dev.topic.report.make.msg
### jobs
jobs:
admin-address: http://api.dev.patzn.com:7000/print
# 对象存储配置
oss:
bucket-name: pt-web-sys
aliyun:
endpoint: http://oss.test.patzn.com
folder: dev/soil
# ribbon 路由配置
food.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
print.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
res.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
convert.ribbon.NFLoadBalancerRuleClassName: com.patzn.cloud.zuul.LocalRule
# 生产环境
server:
exception:
subject: 河南奶牛 food 服务异常
service:
api-url: http://api.test.hndhi.com
food-url: http://food.test.hndhi.com
province-item-url: http://60.216.97.250:8087
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
username: dbnnadmin
password: ptcus!%&nn768
url: jdbc:postgresql://127.0.0.1:5432/pc_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 127.0.0.1
rabbitmq:
host: 127.0.0.1
port: 5672
username: patznrmq
password: mqnn456#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: pro.topic.push.msg
sys-log: pro.topic.sys.log
chemical-classify-warning: pro.topic.chemical.classify.warning
equip-check-msg: pro.topic.equip.check.msg
env-work-msg: pro.topic.env.work.msg
food-work-msg: pro.topic.food.work.msg
food-statistics-customer-contract: pro.topic.food.statistics.customer.contract
food-statistics-contract-progress: pro.topic.food.statistics.contract.progress
food-statistics-sample-progress: pro.topic.food.statistics.sample.progress
redis:
host: 127.0.0.1
password: ptnn456TQa
# Mongodb GridFS
data:
mongodb:
uri: mongodb://localhost:27017/lims
grid-fs-database: lims
# Mongodb GridFS 存储
oss:
grid-fs: true
bucket-name: base
### jobs
jobs:
admin-address: http://api.patzn.com/print
# 日志
logging:
config: classpath:log4j2-pro.xml
# 生产环境
server:
exception:
subject: 英格尔 food 服务异常
service:
api-url: http://api.fdlims.icas.org.cn
food-url: http://food.fdlims.icas.org.cn
province-item-url: http://60.216.97.250:8087
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
username: dbicaslims
password: ptcus!%&768
url: jdbc:postgresql://127.0.0.1:5432/pc_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 127.0.0.1
rabbitmq:
host: 127.0.0.1
port: 5672
username: patznrmq
password: mqcus123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: pro.topic.push.msg
sys-log: pro.topic.sys.log
chemical-classify-warning: pro.topic.chemical.classify.warning
equip-check-msg: pro.topic.equip.check.msg
env-work-msg: pro.topic.env.work.msg
food-work-msg: pro.topic.food.work.msg
food-statistics-customer-contract: pro.topic.food.statistics.customer.contract
food-statistics-contract-progress: pro.topic.food.statistics.contract.progress
food-statistics-sample-progress: pro.topic.food.statistics.sample.progress
report-make-msg: pro.topic.report.make.msg
# Mongodb GridFS
data:
mongodb:
uri: mongodb://localhost:27017/lims
grid-fs-database: lims
redis:
host: 127.0.0.1
password: ptcli456TQa
# Mongodb GridFS 存储
oss:
grid-fs: true
### jobs
jobs:
admin-address: http://api.patzn.com/print
# 日志
logging:
config: classpath:log4j2-pro.xml
server:
exception:
subject: JLSC Food 服务异常
# 生产环境
service:
api-url: http://api.jlssckxyjy.cn
url: http://api.jlssckxyjy.cn
food-url: http://food.jlssckxyjy.cn
province-item-url: http://60.216.97.250:8087
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
username: jllims
password: psql_jl&568!
url: jdbc:postgresql://localhost:5432/jl_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: localhost
rabbitmq:
host: localhost
port: 5672
username: mq_jlsc
password: rmq_jlsc&568!
publisher-confirms: true
virtual-host: /
topic:
push-msg: pro.topic.push.msg
sys-log: pro.topic.sys.log
chemical-classify-warning: pro.topic.chemical.classify.warning
equip-check-msg: pro.topic.equip.check.msg
env-work-msg: pro.topic.env.work.msg
food-work-msg: pro.topic.food.work.msg
food-statistics-customer-contract: pro.topic.food.statistics.customer.contract
food-statistics-contract-progress: pro.topic.food.statistics.contract.progress
food-statistics-sample-progress: pro.topic.food.statistics.sample.progress
report-make-msg: pro.topic.report.make.msg
data:
mongodb:
uri: mongodb://localhost:27017/lims
grid-fs-database: lims
redis:
host: localhost
password: redis_jlsc&568!
# 对象存储配置
oss:
grid-fs: true
bucket-name: base
### jobs
jobs:
admin-address: http://api.jlssckxyjy.cn/print
# 日志
logging:
config: classpath:log4j2-pro.xml
# 测试环境
server:
exception:
to: 1327531085@qq.com;18463106881@163.com
form: ptlims@163.com
subject: 性能测试 metr服务异常
swagger:
enable: true
service:
api-url: http://api.pertest.patzn.com
url: http://api.pertest.patzn.com
food-url: http://food.pertest.patzn.com
province-item-url: http://60.216.97.250:8087/
soffice: /opt/libreoffice6.2/program/soffice
spring:
datasource:
dynamic:
health: true
datasource:
master:
username: dbmeter
password: sfdWrE39&d!Pt
url: jdbc:postgresql://121.36.94.193:5432/test_lims_meter
driver-class-name: org.postgresql.Driver
slave:
username: dbmeter
password: sfdWrE39&d!Pt
url: jdbc:postgresql://121.36.94.193:5432/test_lims_meter
driver-class-name: org.postgresql.Driver
# 注册中心配置
cloud:
consul:
host: 124.70.150.247
redis:
host: 124.70.150.247
password: patzn123TQa
mail:
host: smtp.163.com
username: ptlims@163.com
password: HFQYDSHMSKTVYRQW
port: 25
protocol: smtp
default-encoding: UTF-8
rabbitmq:
host: 124.70.150.247
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: test.topic.push.msg
sys-log: test.topic.sys.log
chemical-classify-warning: test.topic.chemical.classify.warning
equip-check-msg: test.topic.equip.check.msg
env-work-msg: test.topic.env.work.msg
food-work-msg: test.topic.food.work.msg
food-statistics-customer-contract: test.topic.food.statistics.customer.contract
food-statistics-contract-progress: test.topic.food.statistics.contract.progress
food-statistics-sample-progress: test.topic.food.statistics.sample.progress
report-make-msg: test.topic.report.make.msg
# 对象存储配置
oss:
bucket-name: pt-web-sys
aliyun:
endpoint: http://oss.test.patzn.com
folder: pertest/soil
#libreOffice 安装信息
libreOffice:
url: /opt/libreOffice6.2
### jobs
jobs:
admin-address: http://api.pertest.patzn.com/print
\ No newline at end of file
# 生产环境
service:
api-url: http://api.patzn.com
url: http://api.patzn.com
food-url: http://food.patzn.com
province-item-url: http://60.216.97.250:8087
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
dynamic:
health: true
datasource:
master:
username: dbmeter
password: ptd895%$!321
url: jdbc:postgresql://116.63.140.241:5432/pc_lims_meter
driver-class-name: org.postgresql.Driver
slave:
username: dbmeter
password: ptd895%$!321
url: jdbc:postgresql://116.63.140.241:5432/pc_lims_meter
driver-class-name: org.postgresql.Driver
hikari:
minimum-idle: 5 #最小连接数量
idle-timeout: 180000 #空闲连接存活最大时间
maximum-pool-size: 100 #最大连接数,默认是10
max-lifetime: 1800000 #在连接池中的最长生命周期
connection-timeout: 600000 #超时时间
#validation-timeout: #默认是5秒
# 注册中心配置
cloud:
consul:
host: 124.70.154.133
rabbitmq:
host: 124.70.154.133
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: pro.topic.push.msg
sys-log: pro.topic.sys.log
chemical-classify-warning: pro.topic.chemical.classify.warning
equip-check-msg: pro.topic.equip.check.msg
env-work-msg: pro.topic.env.work.msg
food-work-msg: pro.topic.food.work.msg
food-statistics-customer-contract: pro.topic.food.statistics.customer.contract
food-statistics-contract-progress: pro.topic.food.statistics.contract.progress
food-statistics-sample-progress: pro.topic.food.statistics.sample.progress
report-make-msg: pro.topic.report.make.msg
redis:
database: 0
host: 124.70.154.133
port: 6379
password: patzn123TQa
#服务监控
boot:
admin:
client:
instance:
service-url: http://${network-ip}:${server.port}
name: food
username: "patznAdmin"
password: "asd9*765"
url:
- http://springadmin.patzn.com
# 对象存储配置
oss:
aliyun:
folder: soil
### jobs
jobs:
admin-address: http://api.patzn.com/print
# 日志
logging:
config: classpath:log4j2-pro.xml
#libreOffice 安装信息
libreOffice:
url: /opt/libreoffice6.2
server:
port: 8013
exception:
to: 929339256@qq.com;1516330897@qq.com;18463106881@163.com
subject: 时进检测 Food 服务异常
service:
api-url: http://api.taixiangcloud.com:9000
url: http://api.taixiangcloud.com:9000
food-url: http://food.taixiangcloud.com:9000
province-item-url: http://60.216.97.250:8087
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
username: dbsjjcadmin
password: ptcus!%&whsj778
url: jdbc:postgresql://192.168.8.187:5432/pc_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 192.168.8.187
rabbitmq:
host: 192.168.8.187
port: 5672
username: patznrmq
password: mqsjjc476#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: pro.topic.push.msg
sys-log: pro.topic.sys.log
chemical-classify-warning: pro.topic.chemical.classify.warning
equip-check-msg: pro.topic.equip.check.msg
env-work-msg: pro.topic.env.work.msg
food-work-msg: pro.topic.food.work.msg
food-statistics-customer-contract: pro.topic.food.statistics.customer.contract
food-statistics-contract-progress: pro.topic.food.statistics.contract.progress
food-statistics-sample-progress: pro.topic.food.statistics.sample.progress
report-make-msg: pro.topic.report.make.msg
redis:
host: 192.168.8.187
password: ptsjjc476TQa
# Mongodb GridFS
data:
mongodb:
uri: mongodb://192.168.8.187:27017/lims
grid-fs-database: lims
# Mongodb GridFS 存储
oss:
grid-fs: true
bucket-name: base
### jobs
jobs:
admin-address: http://api.taixiangcloud.com:9000/print
# 日志
logging:
config: classpath:log4j2-pro.xml
# 测试环境
server:
exception:
to: 1327531085@qq.com;18463106881@163.com
subject: 测试 food 服务异常
swagger:
enable: true
service:
api-url: http://api.test.patzn.com
url: http://api.test.patzn.com
food-url: http://food.test.patzn.com
province-item-url: http://60.216.97.250:8087/
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
dynamic:
health: true
datasource:
master:
username: dblims
password: sfdWrE33&d!Pt
url: jdbc:postgresql://119.3.109.49:5432/test_lims
driver-class-name: org.postgresql.Driver
slave:
username: dblims
password: sfdWrE33&d!Pt
url: jdbc:postgresql://119.3.109.49:5432/test_lims
driver-class-name: org.postgresql.Driver
# 注册中心配置
cloud:
consul:
host: 121.36.130.208
rabbitmq:
host: 121.36.130.208
port: 5672
username: mqbase
password: mqb123#@$5
publisher-confirms: true
virtual-host: /
topic:
push-msg: test.topic.push.msg
sys-log: test.topic.sys.log
chemical-classify-warning: test.topic.chemical.classify.warning
equip-check-msg: test.topic.equip.check.msg
env-work-msg: test.topic.env.work.msg
food-work-msg: test.topic.food.work.msg
food-statistics-customer-contract: test.topic.food.statistics.customer.contract
food-statistics-contract-progress: test.topic.food.statistics.contract.progress
food-statistics-sample-progress: test.topic.food.statistics.sample.progress
report-make-msg: test.topic.report.make.msg
# 对象存储配置
oss:
bucket-name: pt-web-sys
aliyun:
endpoint: http://oss.test.patzn.com
folder: test/food
#libreOffice 安装信息
libreOffice:
url: C:/Program Files/LibreOffice
### jobs
jobs:
admin-address: http://api.test.patzn.com/print
\ No newline at end of file
# 测试环境
server:
exception:
enable: false
swagger:
enable: true
service:
api-url: http://api.exetest.patzn.com
url: http://api.exetest.patzn.com
food-url: http://food.exetest.patzn.com
province-item-url: http://60.216.97.250:8087/
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
username: pglims
password: 1qazqwer
url: jdbc:postgresql://127.0.0.1:5432/testexe_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 127.0.0.1
rabbitmq:
host: 127.0.0.1
#host: 119.3.221.237,121.36.130.208,119.3.238.56
port: 5672
username: mquser
password: 1qazqwer
publisher-confirms: true
virtual-host: /
topic:
push-msg: test.topic.push.msg
sys-log: test.topic.sys.log
chemical-classify-warning: test.topic.chemical.classify.warning
equip-check-msg: test.topic.equip.check.msg
env-work-msg: test.topic.env.work.msg
food-work-msg: test.topic.food.work.msg
food-statistics-customer-contract: test.topic.food.statistics.customer.contract
food-statistics-contract-progress: test.topic.food.statistics.contract.progress
food-statistics-sample-progress: test.topic.food.statistics.sample.progress
# Mongodb GridFS
data:
mongodb:
uri: mongodb://localhost:27017/lims
grid-fs-database: lims
# Mongodb GridFS 存储
oss:
grid-fs: true
bucket-name: base
server:
port: 8013
exception:
to: 1516330897@qq.com;18463106881@163.com
subject: 威海检测 Food 服务异常
# 生产环境
service:
api-url: http://api.scjgj.weihai.gov.cn
url: http://api.scjgj.weihai.gov.cn
food-url: http://food.scjgj.weihai.gov.cn
province-item-url: http://60.216.97.250:8087
soffice: /opt/libreoffice6.1/program/soffice
spring:
datasource:
username: dbwhlad
password: ptd688%$_wh&321
url: jdbc:postgresql://192.168.235.219:5432/pc_lims
driver-class-name: org.postgresql.Driver
dynamic:
enabled: false
# 注册中心配置
cloud:
consul:
host: 192.168.235.217
rabbitmq:
host: 192.168.235.217
port: 5672
username: ptmqwh
password: mq_weihai#125
publisher-confirms: true
virtual-host: /
topic:
push-msg: pro.topic.push.msg
sys-log: pro.topic.sys.log
chemical-classify-warning: pro.topic.chemical.classify.warning
equip-check-msg: pro.topic.equip.check.msg
env-work-msg: pro.topic.env.work.msg
food-work-msg: pro.topic.food.work.msg
food-statistics-customer-contract: pro.topic.food.statistics.customer.contract
food-statistics-contract-progress: pro.topic.food.statistics.contract.progress
food-statistics-sample-progress: pro.topic.food.statistics.sample.progress
report-make-msg: pro.topic.report.make.msg
redis:
host: 192.168.235.217
port: 6379
password: patzn489Wza_weihai
# Mongodb GridFS
data:
mongodb:
uri: mongodb://192.168.235.245:27017/lims
grid-fs-database: lims
# Mongodb GridFS 存储
oss:
grid-fs: true
bucket-name: base
### jobs
jobs:
admin-address: http://api.scjgj.weihai.gov.cn/print
# 日志
logging:
config: classpath:log4j2-pro.xml
server:
port: 8015
exception:
to: 1781849245@qq.com
subject: Meter 服务异常
compression:
enabled: true
mime-types: application/json
spring:
# 环境 dev|test|pro
profiles:
active: dev
application:
name: soil
# 模板引擎配置
freemarker:
prefix: classpath:/templates/html
suffix: .html
cache: false
# thymeleaf模板配置
thymeleaf:
template-loader-path: classpath:/templates/
suffix: .html
cache: false
encoding: UTF-8
# 文件上传大小设置 50MB
servlet:
multipart:
max-request-size: 50MB
max-file-size: 50MB
datasource:
driver-class-name: org.postgresql.Driver
platform: postgres
continue-on-error: true
hikari:
minimum-idle: 5 #最小连接数量
idle-timeout: 180000 #空闲连接存活最大时间
maximum-pool-size: 20 #最大连接数,默认是10
max-lifetime: 1800000 #在连接池中的最长生命周期
connection-timeout: 600000 #超时时间
#validation-timeout: #默认是5秒
cloud:
loadbalancer:
retry:
enabled: true # 是否重试机制,默认 fasle
# 注册中心配置
consul:
host: localhost
port: 8500
discovery:
prefer-ip-address: true
ip-address: ${network-ip:${spring.cloud.client.ip-address}}
tags: version=1.0,author=pt
health-check-path: /actuator/health
health-check-interval: 15s
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}
acl-token: 26fcba2e-c460-2644-be78-584ea3b91a0c
# 缓存配置
cache:
infinispan.config: infinispan.xml
caffeine.spec: maximumSize=500,expireAfterAccess=60s
# Redis 数据库索引(默认为0),如果设置为1,那么存入的key-value都存放在select 1中
redis:
database: 0
host: 124.70.150.247
port: 6379
password: patzn123TQa
mail:
host: smtp.exmail.qq.com
username: admin@qd-partner.com
password: 5Ddz2stH4yrcixo3
port: 587
protocol: smtp
default-encoding: UTF-8
main:
allow-bean-definition-overriding: true
#ribbon超时设置
ribbon:
OkToRetryOnAllOperations: true
MaxAutoRetriesNextServer: 2
MaxAutoRetries: 1
ReadTimeout: 600000
ConnectTimeout: 100000
res:
ribbon:
ReadTimeout: 600000
ConnectTimeout: 100000
standard:
ribbon:
ReadTimeout: 600000
ConnectTimeout: 100000
### jobs
#jobs:
# app-name: soil
# app-port: 8026
#mybatis
mybatis-plus:
mapper-locations: classpath:/mapper/*/*Mapper.xml
type-aliases-package: com.patzn.cloud.service.soil.entity
type-enums-package: com.patzn.cloud.service.soil.enums
global-config:
#字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断"
field-strategy: 2
# 逻辑删除
logic-delete-value: 1
logic-not-delete-value: 0
# 自定义 SQL 注入器
sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
sql-parser-cache: true
configuration:
cache-enabled: false
map-underscore-to-camel-case: true
# 单点登录
kisso:
config:
signAlgorithm: RS512
rsaCertstore: public.cert
# 日志
logging:
config: classpath:log4j2.xml
pattern:
console: "%-5level - %msg%n"
level:
- error
- com.memorynotfound=trace
management:
health:
defaults:
enabled: false
db:
enabled: true
endpoint:
health:
show-details: always
\ No newline at end of file
__________ __ .__ .___
\______ \_____ _/ |_________ ____ ____ | | ____ __ __ __| _/
| ___/\__ \\ __\___ // \ _/ ___\| | / _ \| | \/ __ |
| | / __ \| | / /| | \ \ \___| |_( <_> ) | / /_/ |
|____| (____ /__| /_____ \___| / \___ >____/\____/|____/\____ |
\/ \/ \/ \/ \/
Service-Soil 土工试验LIMS平台服务
<?xml version="1.0" encoding="UTF-8"?>
<infinispan>
<cache-container default-cache="default">
<local-cache name="default"/>
<local-cache name="resource">
<eviction max-entries="200"/>
<expiration lifespan="600000"/>
</local-cache>
</cache-container>
</infinispan>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出。-->
<!--monitorInterval:Log4j2能够自动检测修改配置 文件和重新配置本身,设置间隔秒数。-->
<Configuration status="off" monitorInterval="600">
<properties>
<!--通用变量-->
<property name="LOG_HOME">../logs/patzn-service-food</property>
<property name="ERROR_LOG_FILE_NAME">error</property>
<property name="INFO_LOG_FILE_NAME">info</property>
<Property name="PATTERN">[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} - (%F:%L) - %m%n</Property>
</properties>
<Appenders>
<!-- ELK 日志分析 http://logging.apache.org/log4j/2.x/manual/appenders.html#SocketAppender
<Socket name="Logstash" host="114.115.217.147" port="5044">
<Filters>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" />
</Filters>
<JsonLayout properties="true" compact="true" eventEol="true"/>
</Socket>
-->
<!-- 控制台日志打印 -->
<Console name="Console" target="SYSTEM_OUT">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<Filters>
<ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<!--输出日志的格式-->
<PatternLayout pattern="${PATTERN}"/>
</Console>
<!-- 服务器日志文件记录 -->
<RollingRandomAccessFile name="ErrorLog" fileName="${LOG_HOME}/${ERROR_LOG_FILE_NAME}.log"
filePattern="${LOG_HOME}/${ERROR_LOG_FILE_NAME}.log.%d{yyyy-MM-dd}.gz">
<PatternLayout pattern="${PATTERN}"/>
<Filters>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="128MB"/>
</Policies>
<DefaultRolloverStrategy max="30"/>
</RollingRandomAccessFile>
<RollingRandomAccessFile name="InfoLog" fileName="${LOG_HOME}/${INFO_LOG_FILE_NAME}.log"
filePattern="${LOG_HOME}/${INFO_LOG_FILE_NAME}.log.%d{yyyy-MM-dd}.gz">
<PatternLayout pattern="${PATTERN}"/>
<Filters>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="200MB"/>
</Policies>
<DefaultRolloverStrategy max="30"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<!--AsyncLogger-->
<AsyncLogger name="com.patzn.cloud" level="info" includeLocation="true"/>
<AsyncLogger name="org.apache.ibatis" level="error" includeLocation="true"/>
<AsyncLogger name="org.springframework.web" level="error" includeLocation="true"/>
<!--root的logger-->
<AsyncRoot level="info" includeLocation="true">
<AppenderRef ref="Console"/>
<AppenderRef ref="InfoLog"/>
<AppenderRef ref="ErrorLog"/>
<AppenderRef ref="Logstash"/>
</AsyncRoot>
</Loggers>
</Configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!--status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出。-->
<!--monitorInterval:Log4j2能够自动检测修改配置 文件和重新配置本身,设置间隔秒数。-->
<Configuration status="off" monitorInterval="600">
<properties>
<!--通用变量-->
<property name="LOG_HOME">../logs/patzn-service-meter</property>
<property name="ERROR_LOG_FILE_NAME">error</property>
<property name="INFO_LOG_FILE_NAME">info</property>
<Property name="PATTERN">[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} - (%F:%L) - %m%n</Property>
</properties>
<Appenders>
<!-- 控制台日志打印 -->
<Console name="Console" target="SYSTEM_OUT">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<Filters>
<ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<!--输出日志的格式-->
<PatternLayout pattern="${PATTERN}"/>
</Console>
<!-- 服务器日志文件记录 -->
<RollingRandomAccessFile name="ErrorLog" fileName="${LOG_HOME}/${ERROR_LOG_FILE_NAME}.log"
filePattern="${LOG_HOME}/${ERROR_LOG_FILE_NAME}.log.%d{yyyy-MM-dd}.gz">
<PatternLayout pattern="${PATTERN}"/>
<Filters>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="128MB"/>
</Policies>
<DefaultRolloverStrategy max="30"/>
</RollingRandomAccessFile>
<RollingRandomAccessFile name="InfoLog" fileName="${LOG_HOME}/${INFO_LOG_FILE_NAME}.log"
filePattern="${LOG_HOME}/${INFO_LOG_FILE_NAME}.log.%d{yyyy-MM-dd}.gz">
<PatternLayout pattern="${PATTERN}"/>
<Filters>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="128MB"/>
</Policies>
<DefaultRolloverStrategy max="30"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<!--AsyncLogger-->
<AsyncLogger name="com.patzn.cloud" level="debug" includeLocation="true"/>
<AsyncLogger name="org.apache.ibatis" level="error" includeLocation="true"/>
<AsyncLogger name="springfox.documentation" level="error" includeLocation="true"/>
<AsyncLogger name="org.springframework.web" level="error" includeLocation="true"/>
<!--root的logger-->
<AsyncRoot level="error" includeLocation="true">
<AppenderRef ref="Console"/>
<AppenderRef ref="InfoLog"/>
<AppenderRef ref="ErrorLog"/>
</AsyncRoot>
</Loggers>
</Configuration>
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAucwkbQyl33CAIod4NT64
2Swwjh8izNBdXju6EQTBTGAWBcCBPG3Q2IoNN64jQzRURLlSDZ1oJIB0e65KBkQM
0y8IZcHKRG97f1lYQVWwlqdwtVkn1BwDdBNTRf2CO6fDwxGhukugX91f0KkgNv8B
NXB8AzB3f03XEyzxLFMD0Az8KaYfauc5CV+OP2aPUNEaChhmW2G5Nmmg45iFKCY9
I/UBKFsAeP7rrUxKErY1CSWdbPKeDSwNM+BRqDDNLudxN8Rz1XJzt3Zx2NPNEYbZ
VQDqm2ze/8baozvSsqvnIA3Izd6VuswCIhWkBStypO/q66jOjkv4qWifgNyccIPu
LQIDAQAB
-----END PUBLIC KEY-----
\ No newline at end of file
# 关闭默认报表存储器
report.disableFileProvider=true
report.service=food
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<import resource="classpath:report-console-context.xml"/>
<bean id="propertyConfigurer" parent="report.props">
<property name="location">
<value>classpath:report-config.properties</value>
</property>
</bean>
</beans>
\ No newline at end of file
var CreatedOKLodop7766=null;
//====判断是否需要安装CLodop云打印服务器:====
function needCLodop(){
try{
var ua=navigator.userAgent;
if (ua.match(/Windows\sPhone/i) !=null) return true;
if (ua.match(/iPhone|iPod/i) != null) return true;
if (ua.match(/Android/i) != null) return true;
if (ua.match(/Edge\D?\d+/i) != null) return true;
var verTrident=ua.match(/Trident\D?\d+/i);
var verIE=ua.match(/MSIE\D?\d+/i);
var verOPR=ua.match(/OPR\D?\d+/i);
var verFF=ua.match(/Firefox\D?\d+/i);
var x64=ua.match(/x64/i);
if ((verTrident==null)&&(verIE==null)&&(x64!==null))
return true; else
if ( verFF !== null) {
verFF = verFF[0].match(/\d+/);
if ((verFF[0]>= 41)||(x64!==null)) return true;
} else
if ( verOPR !== null) {
verOPR = verOPR[0].match(/\d+/);
if ( verOPR[0] >= 32 ) return true;
} else
if ((verTrident==null)&&(verIE==null)) {
var verChrome=ua.match(/Chrome\D?\d+/i);
if ( verChrome !== null ) {
verChrome = verChrome[0].match(/\d+/);
if (verChrome[0]>=41) return true;
};
};
return false;
} catch(err) {return true;};
};
//====页面引用CLodop云打印必须的JS文件:====
if (needCLodop()) {
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
var oscript = document.createElement("script");
oscript.src ="http://localhost:8000/CLodopfuncs.js?priority=1";
head.insertBefore( oscript,head.firstChild );
//引用双端口(8000和18000)避免其中某个被占用:
oscript = document.createElement("script");
oscript.src ="http://localhost:18000/CLodopfuncs.js?priority=0";
head.insertBefore( oscript,head.firstChild );
};
//====获取LODOP对象的主过程:====
function getLodop(oOBJECT,oEMBED){
var strHtmInstall="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
var strHtmUpdate="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
var strHtm64_Install="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
var strHtm64_Update="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
var strHtmFireFox="<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
var strHtmChrome="<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
var strCLodopInstall="<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行安装</a>,安装后请刷新页面。</font>";
var strCLodopUpdate="<br><font color='#FF00FF'>CLodop云打印服务需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
var LODOP;
try{
var isIE = (navigator.userAgent.indexOf('MSIE')>=0) || (navigator.userAgent.indexOf('Trident')>=0);
if (needCLodop()) {
try{ LODOP=getCLodop();} catch(err) {};
if (!LODOP && document.readyState!=="complete") {alert("C-Lodop没准备好,请稍后再试!"); return;};
if (!LODOP) {
if (isIE) document.write(strCLodopInstall); else
document.body.innerHTML=strCLodopInstall+document.body.innerHTML;
return;
} else {
if (CLODOP.CVERSION<"3.0.3.7") {
if (isIE) document.write(strCLodopUpdate); else
document.body.innerHTML=strCLodopUpdate+document.body.innerHTML;
};
if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED);
if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT);
};
} else {
var is64IE = isIE && (navigator.userAgent.indexOf('x64')>=0);
//=====如果页面有Lodop就直接使用,没有则新建:==========
if (oOBJECT!=undefined || oEMBED!=undefined) {
if (isIE) LODOP=oOBJECT; else LODOP=oEMBED;
} else if (CreatedOKLodop7766==null){
LODOP=document.createElement("object");
LODOP.setAttribute("width",0);
LODOP.setAttribute("height",0);
LODOP.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;");
if (isIE) LODOP.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
else LODOP.setAttribute("type","application/x-print-lodop");
document.documentElement.appendChild(LODOP);
CreatedOKLodop7766=LODOP;
} else LODOP=CreatedOKLodop7766;
//=====Lodop插件未安装时提示下载地址:==========
if ((LODOP==null)||(typeof(LODOP.VERSION)=="undefined")) {
if (navigator.userAgent.indexOf('Chrome')>=0)
document.body.innerHTML=strHtmChrome+document.body.innerHTML;
if (navigator.userAgent.indexOf('Firefox')>=0)
document.body.innerHTML=strHtmFireFox+document.body.innerHTML;
if (is64IE) document.write(strHtm64_Install); else
if (isIE) document.write(strHtmInstall); else
document.body.innerHTML=strHtmInstall+document.body.innerHTML;
return LODOP;
};
};
if (LODOP.VERSION<"6.2.2.1") {
if (!needCLodop()){
if (is64IE) document.write(strHtm64_Update); else
if (isIE) document.write(strHtmUpdate); else
document.body.innerHTML=strHtmUpdate+document.body.innerHTML;
};
return LODOP;
};
//===如下空白位置适合调用统一功能(如注册语句、语言选择等):===
//===========================================================
return LODOP;
} catch(err) {alert("getLodop出错:"+err);};
};
table {border-collapse: collapse; border-style: double;border-width:3px;border-color: black;}
td {border-width: 1px;border-style: solid;}
\ No newline at end of file
function test_script(){
document.write('<font color="red">这是用script加入的动态内容</font>');
}
\ No newline at end of file
<License>
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
<Product>Aspose.Words for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
</License>
\ No newline at end of file
12
\ No newline at end of file
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>打开Excel文件</title>
<script type="text/javascript">
function Save() {
document.getElementById("PageOfficeCtrl1").WebSave();
}
</script>
<script type="text/javascript">
function AddSeal() {
try{
document.getElementById("PageOfficeCtrl1").ZoomSeal.AddSeal();
}catch (e){ };
}
</script>
</head>
<body>
<div style="width:auto;height:700px;" th:utext="${pageoffice}"></div>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>打开Word文件</title>
<script type="text/javascript">
function Save() {
document.getElementById("PageOfficeCtrl1").WebSave();
}
</script>
<script type="text/javascript">
function AddSeal() {
try{
document.getElementById("PageOfficeCtrl1").ZoomSeal.AddSeal();
}catch (e){ };
}
</script>
</head>
<body>
<div style="width:1000px;height:700px;" th:utext="${pageoffice}"> </div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<SCRIPT type=text/javascript src="/lims/PrintSample10.js"></SCRIPT>
<title>WEB打印控件演示demo</title>
<style id="style1">
table {
border-width: 5px;
border-style: solid;
border-color: #0000FF;
}
td {
border-width: 1px;
border-style: solid;
}
</style>
<script language="javascript" src="/lims/LodopFuncs.js"></script>
</head>
<body id="body01">
<h2><font color="#009999">演示clodop打印</font>
</h2>
<p><a href="javascript:myPreview1()">打印设计</a></p>
<script language="javascript" type="text/javascript">
var LODOP; //声明为全局变量
function myPreview1(){
LODOP=getLodop();
LODOP.PRINT_INITA("0mm","0mm","60.01mm","40.01mm","打印标签");
LODOP.ADD_PRINT_TEXT(0,55,100,20,"备样标签");
LODOP.SET_PRINT_STYLEA(0,"FontName","楷体");
LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(18,11,67,20,"样品名称:");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(19,67,155,19,"2017-04-06");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(44,11,64,20,"样品编号:");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(45,66,152,20,"14578411425");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_BARCODE(59,11,204,35,"128A","20170017-001");
LODOP.SET_PRINT_STYLEA(0,"FontSize",6);
LODOP.ADD_PRINT_TEXT(99,9,80,20,"收样日期:");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(98,72,135,20,"2017-08-06");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(115,9,80,20,"保存条件:");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.ADD_PRINT_TEXT(114,73,136,20,"shd=shhhwveedwsdsds");
LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
LODOP.PRINT_DESIGN();
};
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>正在打开编辑文档</title>
<script src="//s1.pstatp.com/cdn/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="http://api.dev.patzn.com:7000/lims/pageoffice.js" id="po_js_main"></script>
</head>
<body>
<a href="javascript:POBrowser.openWindowModeless('/lims/v1/page_office/word','width=1200px;height=800px;');">打开文件 </a>
<script>
function pageOffice() {
POBrowser.openWindowModeless('/lims/v1/page_office/word', 'width=1200px;height=800px;');
}
window.onload = pageOffice();
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>编辑原始记录</title>
<script type="text/javascript">
function Save() {
document.getElementById("PageOfficeCtrl1").WebSave();
}
</script>
<script type="text/javascript">
function AddSeal() {
try {
document.getElementById("PageOfficeCtrl1").ZoomSeal.AddSeal();
} catch (e) {
}
}
</script>
</head>
<body>
<div style="width:100%;height:1000px;">${pageoffice}</div>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment