Commit c3aefbca by liulei

产品模板优化

parent 423d333e
......@@ -8,10 +8,7 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -20,10 +17,10 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 鸿鹏机械APP移动端接口调用处
......@@ -56,26 +53,96 @@ public class ServiceHPMT001 extends ServiceBase {
Map sqlMap = new HashMap();
sqlMap.put("queryMonth", queryMonth);
sqlMap.put("companyCode", companyCode);
List<Map> row1 = this.dao.query("HPMT001.pmOverview1", sqlMap);
List<Map> row2 = this.dao.query("HPMT001.pmOverview2", sqlMap);
List<Map> row1 = this.dao.query("HPMT001.pmOverview1", sqlMap);//目标
List<Map> row2 = this.dao.query("HPMT001.pmOverview2", sqlMap);//实际
List<Map> rows = new ArrayList<>();
Map resultMap = new HashMap();
if (BeanUtil.isEmpty(row1.get(0))) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
try {
Date parse = sdf.parse(queryMonth);
Calendar instance = Calendar.getInstance();
instance.setTime(parse);
instance.add(Calendar.MONTH,-1);
String newnewDate = sdf.format(instance.getTime());//上月
Map sqlMap2 = new HashMap();
sqlMap2.put("queryMonth", newnewDate);
sqlMap2.put("companyCode", companyCode);
List<Map> row3 = this.dao.query("HPMT001.pmOverview1", sqlMap2);//上月目标
List<Map> row4 = this.dao.query("HPMT001.pmOverview2", sqlMap2);//上月实际
Calendar instance2 = Calendar.getInstance();
instance2.setTime(parse);
instance2.add(Calendar.YEAR,-1);
String newnewDate2 = sdf.format(instance2.getTime());//同年
Map sqlMap3 = new HashMap();
sqlMap3.put("queryMonth", newnewDate2);
sqlMap3.put("companyCode", companyCode);
List<Map> row5 = this.dao.query("HPMT001.pmOverview1", sqlMap3);//去年目标
List<Map> row6 = this.dao.query("HPMT001.pmOverview2", sqlMap3);//去年实际
//目标本月row1-targetWt 实际本月row2-actualWt
if (row1.get(0).get("targetWt")==null) {
resultMap.put("targetWt", 0);
} else {
resultMap.put("targetWt", row1.get(0).get("targetWt"));
}
if (BeanUtil.isEmpty(row2.get(0))) {
if (row2.get(0).get("actualWt")==null) {
resultMap.put("actualWt", 0);
} else {
resultMap.put("actualWt", row2.get(0).get("actualWt"));
}
//环比 目标上月row3-targetWt 实际上月row4-actualWt
if (row3.get(0).get("targetWt")==null) {
resultMap.put("targetWt_s", 0);//目标环比值
resultMap.put("target_s_qoq", 0);//目标环比
} else {
resultMap.put("targetWt_s", row3.get(0).get("targetWt"));
BigDecimal targetWt = (BigDecimal) row1.get(0).get("targetWt");
BigDecimal targetWt2 = (BigDecimal) row3.get(0).get("targetWt");
resultMap.put("target_s_qoq", targetWt.subtract(targetWt2).divide(targetWt2,BigDecimal.ROUND_UP).
multiply(new BigDecimal(100)).doubleValue());
}
if (row4.get(0).get("actualWt")==null) {
resultMap.put("actualWt_s", 0);//实际环比值
resultMap.put("actualWt_s_qoq", 0);//实际环比
} else {
resultMap.put("actualWt_s", row4.get(0).get("actualWt"));
BigDecimal actualWt = (BigDecimal) row2.get(0).get("actualWt");
BigDecimal actualWt2 = (BigDecimal) row4.get(0).get("actualWt");
resultMap.put("actualWt_s_qoq",actualWt.subtract(actualWt2).divide(actualWt2,BigDecimal.ROUND_UP).
multiply(new BigDecimal(100)).doubleValue());
}
//同比 目标同期row5-targetWt 实际同期row6-actualWt
if (row5.get(0).get("targetWt")==null) {
resultMap.put("targetWt_h", 0);//目标同期值
resultMap.put("target_h_qoq", 0);//目标同期
} else {
resultMap.put("targetWt_h", row5.get(0).get("targetWt"));
BigDecimal targetWt = (BigDecimal) row1.get(0).get("targetWt");
BigDecimal targetWt2 = (BigDecimal) row5.get(0).get("targetWt");
resultMap.put("target_h_qoq", targetWt.subtract(targetWt2).divide(targetWt2,BigDecimal.ROUND_UP).
multiply(new BigDecimal(100)).doubleValue());
}
if (row6.get(0).get("actualWt")==null) {
resultMap.put("actualWt_h", 0);//实际同比值
resultMap.put("actualWt_h_yoy", 0);//实际同比
} else {
resultMap.put("actualWt_h", row6.get(0).get("actualWt"));
BigDecimal actualWt = (BigDecimal) row2.get(0).get("actualWt");
BigDecimal actualWt2 = (BigDecimal) row6.get(0).get("actualWt");
resultMap.put("actualWt_h_yoy", actualWt.subtract(actualWt2).divide(actualWt2,BigDecimal.ROUND_UP).
multiply(new BigDecimal(100)).doubleValue());
}
rows.add(resultMap);
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
return outInfo;
} catch (ParseException e) {
e.printStackTrace();
return inInfo;
}
}
/**
......
......@@ -179,8 +179,8 @@ public class ServiceHPMT002 extends ServiceBase {
}
Map Map = new HashMap();
Map.put("checkId", id);
Map.put("docType", "XJ_WC");
List<HPZL001A> docIdlist = this.dao.query("HPZL001A.query", Map);
Map.put("docType",CommonConstant.YesNo.NO_0);
List<HPZL001A> docIdlist = this.dao.query("HPZL001A.queryDev", Map);
List<String> imgList = new ArrayList<>();
for (int i = 0; i < docIdlist.size(); i++) {
Map dirId = new HashMap();
......@@ -193,6 +193,23 @@ public class ServiceHPMT002 extends ServiceBase {
String imgBase64 = UploadUtils.imageToBase64(bf);
imgList.add(imgBase64);
}
//处理的文件
Map Map2 = new HashMap();
Map2.put("checkId", id);
Map2.put("docType",CommonConstant.YesNo.NO_0);
List<HPZL001A> docIdlist2 = this.dao.query("HPZL001A.queryDev", Map);
List<String> imgList2 = new ArrayList<>();
for (int i = 0; i < docIdlist2.size(); i++) {
Map dirId = new HashMap();
HPZL001A hpzl001A = docIdlist.get(i);
String docId = hpzl001A.getDocId();
dirId.put("docId", docId);
List<Map> query = this.dao.query("HPMT002.queryFile", dirId);
File file = new File(UploadUtils.ROOT_PATH + "/A/" + query.get(0).get("CHG_NAME"));
BufferedImage bf = ImageIO.read(file);
String imgBase64 = UploadUtils.imageToBase64(bf);
imgList2.add(imgBase64);
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("id", id);
......@@ -201,6 +218,7 @@ public class ServiceHPMT002 extends ServiceBase {
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
outInfo.set("img",imgList);
outInfo.set("img2",imgList2);
} catch (Exception e){
outInfo.setMsg("账号异常");
}
......
......@@ -29,9 +29,9 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFInput ename="inqu_result-0-hpsc006Id" type="hidden"/>
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="库存ID" enable="false" width="60" align="center" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="10" align="center">
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="100" align="center"
......@@ -42,7 +42,7 @@
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="100" align="center"
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="150" align="center"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
......@@ -51,7 +51,7 @@
<EF:EFOptions blockId="proj_record_block_id" valueField="valueField" textField="textField" />
</EF:EFComboColumn>
<EF:EFColumn ename="applyAmount" cname="申请数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="applyRemark" cname="申请说明" width="300" editType="textarea" copy="true"/>
<EF:EFColumn ename="applyRemark" cname="申请说明" width="200" editType="textarea" copy="true"/>
<EF:EFColumn ename="amount" cname="库存数量" enable="false" width="120" align="right" format="{0:N0}"
sumType="all"/>
<EF:EFColumn ename="unitWeight" cname="单量(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
......
......@@ -24,9 +24,9 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="库存ID" enable="false" width="60" align="center" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="60" align="center">
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('2')"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
......@@ -37,11 +37,11 @@
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="150" align="center"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="projCode" cname="项目名称" width="350" align="center" defaultValue="" required="true"
<EF:EFComboColumn ename="projCode" cname="项目名称" width="300" align="center" defaultValue="" required="true"
filter="contains" >
<EF:EFOptions blockId="proj_record_block_id" valueField="valueField" textField="textField" />
</EF:EFComboColumn>
......
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