|
@@ -1,5 +1,6 @@
|
|
|
package com.huimv.guowei.admin.utils;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.huimv.guowei.admin.entity.*;
|
|
@@ -36,10 +37,34 @@ public class Print {
|
|
|
//绑定数据
|
|
|
Context context = new Context();
|
|
|
context.putVar("duckCode", duckInfo.getDuckNum());
|
|
|
- context.putVar("duckType", duckInfo.getDuckBreed());
|
|
|
- context.putVar("duckSex", duckInfo.getDuckSex());
|
|
|
+ if (duckInfo.getDuckBreed() == 1) {
|
|
|
+ context.putVar("duckType", "北京鸭");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 2) {
|
|
|
+ context.putVar("duckType", "连城白鸭");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 3) {
|
|
|
+ context.putVar("duckType", "山麻鸭");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 4) {
|
|
|
+ context.putVar("duckType", "攸县麻鸭");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 5) {
|
|
|
+ context.putVar("duckType", "白改鸭");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 6) {
|
|
|
+ context.putVar("duckType", "缙云麻鸭");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 7) {
|
|
|
+ context.putVar("duckType", "绍兴鸭(带圈白翼梢)");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 8) {
|
|
|
+ context.putVar("duckType", "绍兴鸭(红毛绿翼梢)");
|
|
|
+ } else if (duckInfo.getDuckBreed() == 9) {
|
|
|
+ context.putVar("duckType", "绍兴鸭(白羽绍鸭)");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (duckInfo.getDuckSex() == 0) {
|
|
|
+ context.putVar("duckSex", "雌");
|
|
|
+ } else {
|
|
|
+ context.putVar("duckSex", "雄");
|
|
|
+ }
|
|
|
+
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- context.putVar("duckDate",sdf.format( duckInfo.getDuckBirthday()));
|
|
|
+ context.putVar("duckDate", sdf.format(duckInfo.getDuckBirthday()));
|
|
|
context.putVar("address", duckInfo.getDuckBirthplace());
|
|
|
context.putVar("father", duckInfo.getFatherNum());
|
|
|
context.putVar("father2", duckInfo.getFatherGenotype());
|
|
@@ -51,7 +76,7 @@ public class Print {
|
|
|
//健康状况
|
|
|
for (DuckHealthInfo healthInfo : healthInfos) {
|
|
|
if ("".equals(healthInfo.getHealthResult()) || null == healthInfo.getHealthResult()) {
|
|
|
- s1 = sdf.format(healthInfo.getHealthDate()) + "无"+ ";" + "\n" + s1;
|
|
|
+ s1 = sdf.format(healthInfo.getHealthDate()) + "无" + ";" + "\n" + s1;
|
|
|
} else {
|
|
|
s1 = sdf.format(healthInfo.getHealthDate()) + healthInfo.getHealthResult() + ";" + "\n" + s1;
|
|
|
}
|
|
@@ -83,7 +108,7 @@ public class Print {
|
|
|
JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
}
|
|
|
|
|
|
- public static void printEgg(List<EnvRegularCallEgg> eggs, List<EnvRegularCallFeeding> feedings) throws Exception {
|
|
|
+ public static void printEgg(List<EnvRegularCallEggVo> eggs) throws Exception {
|
|
|
|
|
|
//准备数据
|
|
|
String path = "/opt/guowei/egg.xls";
|
|
@@ -94,28 +119,14 @@ public class Print {
|
|
|
//绑定数据
|
|
|
Context context = new Context();
|
|
|
List<EnvRegularCallEggVo> list = new ArrayList<>();
|
|
|
- for (EnvRegularCallFeeding feeding : feedings) {
|
|
|
-
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- String format = sdf.format(feeding.getCallDate());
|
|
|
- for (EnvRegularCallEgg egg : eggs) {
|
|
|
- EnvRegularCallEggVo eggVo = new EnvRegularCallEggVo();
|
|
|
- String s = sdf.format(egg.getCallDate());
|
|
|
- if (s.equals(format)) {
|
|
|
- eggVo.setDate(sdf.format(feeding.getCallDate()));
|
|
|
- eggVo.setDuckCode(feeding.getDuckNum());
|
|
|
- eggVo.setFeed(feeding.getDuckWeight());
|
|
|
- eggVo.setEggNum(egg.getEggNum());
|
|
|
- eggVo.setWeight(egg.getDuckWeight());
|
|
|
- } else {
|
|
|
- eggVo.setDate(sdf.format(feeding.getCallDate()));
|
|
|
- eggVo.setDuckCode(feeding.getDuckNum());
|
|
|
- eggVo.setFeed(feeding.getDuckWeight());
|
|
|
- eggVo.setEggNum(0);
|
|
|
- eggVo.setWeight((double) 0);
|
|
|
- }
|
|
|
- list.add(eggVo);
|
|
|
- }
|
|
|
+ for (EnvRegularCallEggVo egg : eggs) {
|
|
|
+ EnvRegularCallEggVo eggVo = new EnvRegularCallEggVo();
|
|
|
+ eggVo.setEggNum(egg.getEggNum());
|
|
|
+ eggVo.setDuckCode(egg.getDuckCode());
|
|
|
+ eggVo.setDate(egg.getDate());
|
|
|
+ eggVo.setFeed(egg.getFeed());
|
|
|
+ eggVo.setWeight(egg.getWeight());
|
|
|
+ list.add(eggVo);
|
|
|
}
|
|
|
context.putVar("list", list);
|
|
|
//生成
|