Commit ba7010fc by wuwenlong

List<Map>转Eiblock

parent 10b8d496
......@@ -24,12 +24,12 @@ public enum CompanyTypeEnum {
EiBlock block = new EiBlock("company_type_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, GQ.code + "-" + GQ.value);
put(HPConstants.VALUE_FIELD, GQ.code);
put(HGConstants.TEXT_FIELD, GQ.code + "-" + GQ.value);
put(HGConstants.VALUE_FIELD, GQ.code);
}});
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, MY.code + "-" + MY.value);
put(HPConstants.VALUE_FIELD, MY.code);
put(HGConstants.TEXT_FIELD, MY.code + "-" + MY.value);
put(HGConstants.VALUE_FIELD, MY.code);
}});
}};
block.setRows(rows);
......
......@@ -44,12 +44,12 @@ public enum CustomerTypeEnum {
EiBlock block = new EiBlock("customer_type_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, SUPPLIER.code);
put(HPConstants.VALUE_FIELD, SUPPLIER.value);
put(HGConstants.TEXT_FIELD, SUPPLIER.code);
put(HGConstants.VALUE_FIELD, SUPPLIER.value);
}});
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, CUSTOMER.code);
put(HPConstants.VALUE_FIELD, CUSTOMER.value);
put(HGConstants.TEXT_FIELD, CUSTOMER.code);
put(HGConstants.VALUE_FIELD, CUSTOMER.value);
}});
}};
block.setRows(rows);
......
......@@ -4,7 +4,7 @@ package com.baosight.hggp.common;
* @author xuao
* @date 2024年01月09日 14:53
*/
public class HPConstants {
public class HGConstants {
/** 多字段拼接符号 XTC */
public static final String BLOCK_DETAIL = "detail";
......
......@@ -43,12 +43,12 @@ public enum InitiateModeEnum {
EiBlock block = new EiBlock("initiate_mode_block_id");
List<Map<String,Object>> rows = new ArrayList<Map<String,Object>>(){{
add(new HashMap<String,Object>(){{
put(HPConstants.TEXT_FIELD,STOP.code);
put(HPConstants.VALUE_FIELD,STOP.value);
put(HGConstants.TEXT_FIELD,STOP.code);
put(HGConstants.VALUE_FIELD,STOP.value);
}});
add(new HashMap<String,Object>(){{
put(HPConstants.TEXT_FIELD,USING.code);
put(HPConstants.VALUE_FIELD,USING.value);
put(HGConstants.TEXT_FIELD,USING.code);
put(HGConstants.VALUE_FIELD,USING.value);
}});
}};
block.setRows(rows);
......
......@@ -67,20 +67,20 @@ public enum InventTypeEnum {
EiBlock block = new EiBlock("customer_type_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, MATERIAL.code + HPConstants.SPLICING_SYMBOL + MATERIAL.value);
put(HPConstants.VALUE_FIELD, MATERIAL.code);
put(HGConstants.TEXT_FIELD, MATERIAL.code + HGConstants.SPLICING_SYMBOL + MATERIAL.value);
put(HGConstants.VALUE_FIELD, MATERIAL.code);
}});
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, CONSUMABLE.code + HPConstants.SPLICING_SYMBOL + CONSUMABLE.value);
put(HPConstants.VALUE_FIELD, CONSUMABLE.code);
put(HGConstants.TEXT_FIELD, CONSUMABLE.code + HGConstants.SPLICING_SYMBOL + CONSUMABLE.value);
put(HGConstants.VALUE_FIELD, CONSUMABLE.code);
}});
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, SEMI_FINISHED_PRODUCT.code + HPConstants.SPLICING_SYMBOL + SEMI_FINISHED_PRODUCT.value);
put(HPConstants.VALUE_FIELD, SEMI_FINISHED_PRODUCT.code);
put(HGConstants.TEXT_FIELD, SEMI_FINISHED_PRODUCT.code + HGConstants.SPLICING_SYMBOL + SEMI_FINISHED_PRODUCT.value);
put(HGConstants.VALUE_FIELD, SEMI_FINISHED_PRODUCT.code);
}});
add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, FINISHED_PRODUCT.code + HPConstants.SPLICING_SYMBOL + FINISHED_PRODUCT.value);
put(HPConstants.VALUE_FIELD, FINISHED_PRODUCT.code);
put(HGConstants.TEXT_FIELD, FINISHED_PRODUCT.code + HGConstants.SPLICING_SYMBOL + FINISHED_PRODUCT.value);
put(HGConstants.VALUE_FIELD, FINISHED_PRODUCT.code);
}});
}};
block.setRows(rows);
......
package com.baosight.hggp.controller;
import com.baosight.hggp.common.HPConstants;
import com.baosight.hggp.equipment.hp.domain.CutterbarStatus;
import com.baosight.hggp.equipment.hp.domain.CutterbarTime;
import com.baosight.hggp.equipment.hp.domain.CutterbarWarning;
import com.baosight.hggp.equipment.hp.domain.CutterbarWarningBase;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.xml.XmlUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@CrossOrigin
......
......@@ -106,12 +106,12 @@ public class UserSessionUtils extends UserSession {
* *获取登录用户所有角色的公司列表
* @return
*/
public static List<Map<String,String>> getRoleCompany(){
Map<String,String> map = new HashMap<String,String>(){{
public static List<Map<String,Object>> getRoleCompany(){
Map<String,Object> map = new HashMap<String,Object>(){{
put("companyCode","001");
put("companyName","公司A");
}};
return new ArrayList<Map<String,String>>(){{add(map);}};
return new ArrayList<Map<String,Object>>(){{add(map);}};
}
/**
......
......@@ -180,4 +180,17 @@
ID = #id#
</update>
<select id="queryComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
NAT_CODE as "natCode",
NAT_NAME as "natName"
FROM ${hggpSchema}.hppz008
WHERE DELETE_FLAG = 0
AND STATUS=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
ORDER BY NAT_CODE
</select>
</sqlMap>
package com.baosight.hggp.util;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.HPConstants;
import com.baosight.hggp.common.HGConstants;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
......@@ -13,6 +13,8 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.Calendar;
......@@ -76,33 +78,33 @@ public class CommonMethod {
}catch (ClassCastException e){
tryValue = ((DaoEPBase)result).toMap();
}
row.put(HPConstants.VALUE_FIELD, String.valueOf(tryValue.get(tableParam.getValue())));
row.put(HGConstants.VALUE_FIELD, String.valueOf(tryValue.get(tableParam.getValue())));
if(isSplicingSymbol) {
row.put(HPConstants.TEXT_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getText())));
row.put(HPConstants.PARAM1_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam1())));
row.put(HPConstants.PARAM2_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam2())));
row.put(HPConstants.PARAM3_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam3())));
row.put(HPConstants.PARAM4_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam5())));
row.put(HPConstants.PARAM6_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam6())));
row.put(HPConstants.PARAM7_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam7())));
row.put(HPConstants.PARAM8_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam8())));
row.put(HPConstants.PARAM9_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam9())));
row.put(HGConstants.TEXT_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getText())));
row.put(HGConstants.PARAM1_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam1())));
row.put(HGConstants.PARAM2_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam2())));
row.put(HGConstants.PARAM3_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam3())));
row.put(HGConstants.PARAM4_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam4())));
row.put(HGConstants.PARAM5_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam5())));
row.put(HGConstants.PARAM6_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam6())));
row.put(HGConstants.PARAM7_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam7())));
row.put(HGConstants.PARAM8_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam8())));
row.put(HGConstants.PARAM9_FIELD, (tryValue.get(tableParam.getValue()) + HGConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam9())));
} else {
row.put(HPConstants.TEXT_FIELD, String.valueOf(tryValue.get(tableParam.getText())));
row.put(HPConstants.PARAM1_FIELD, String.valueOf(tryValue.get(tableParam.getParam1())));
row.put(HPConstants.PARAM2_FIELD, String.valueOf(tryValue.get(tableParam.getParam2())));
row.put(HPConstants.PARAM3_FIELD, String.valueOf(tryValue.get(tableParam.getParam3())));
row.put(HPConstants.PARAM4_FIELD, String.valueOf(tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, String.valueOf(tryValue.get(tableParam.getParam5())));
row.put(HPConstants.PARAM6_FIELD, String.valueOf(tryValue.get(tableParam.getParam6())));
row.put(HPConstants.PARAM7_FIELD, String.valueOf(tryValue.get(tableParam.getParam7())));
row.put(HPConstants.PARAM8_FIELD, String.valueOf(tryValue.get(tableParam.getParam8())));
row.put(HPConstants.PARAM9_FIELD, String.valueOf(tryValue.get(tableParam.getParam9())));
row.put(HGConstants.TEXT_FIELD, String.valueOf(tryValue.get(tableParam.getText())));
row.put(HGConstants.PARAM1_FIELD, String.valueOf(tryValue.get(tableParam.getParam1())));
row.put(HGConstants.PARAM2_FIELD, String.valueOf(tryValue.get(tableParam.getParam2())));
row.put(HGConstants.PARAM3_FIELD, String.valueOf(tryValue.get(tableParam.getParam3())));
row.put(HGConstants.PARAM4_FIELD, String.valueOf(tryValue.get(tableParam.getParam4())));
row.put(HGConstants.PARAM5_FIELD, String.valueOf(tryValue.get(tableParam.getParam5())));
row.put(HGConstants.PARAM6_FIELD, String.valueOf(tryValue.get(tableParam.getParam6())));
row.put(HGConstants.PARAM7_FIELD, String.valueOf(tryValue.get(tableParam.getParam7())));
row.put(HGConstants.PARAM8_FIELD, String.valueOf(tryValue.get(tableParam.getParam8())));
row.put(HGConstants.PARAM9_FIELD, String.valueOf(tryValue.get(tableParam.getParam9())));
}
resultRows.add(row);
}
eiBlock.addBlockMeta(initCodeMeta(HPConstants.TEXT_FIELD, HPConstants.VALUE_FIELD));
eiBlock.addBlockMeta(initCodeMeta(HGConstants.TEXT_FIELD, HGConstants.VALUE_FIELD));
eiBlock.addRows(resultRows);
inInfo.setBlock(eiBlock);
}
......@@ -116,14 +118,14 @@ public class CommonMethod {
String time = DateUtils.curDateTimeStr14();
for(int i=0; i < block.getRowCount(); i++){
//TODO 公司代码待补充
block.setCell(i, HPConstants.SQL_FIELD_ACCOUNT_CODE, "");
block.setCell(i, HPConstants.SQL_FIELD_CREATED_BY, userId);
block.setCell(i, HPConstants.SQL_FIELD_CREATED_NAME, userName);
block.setCell(i, HPConstants.SQL_FIELD_CREATED_TIME, time);
block.setCell(i, HGConstants.SQL_FIELD_ACCOUNT_CODE, "");
block.setCell(i, HGConstants.SQL_FIELD_CREATED_BY, userId);
block.setCell(i, HGConstants.SQL_FIELD_CREATED_NAME, userName);
block.setCell(i, HGConstants.SQL_FIELD_CREATED_TIME, time);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_BY, userId);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_NAME, userName);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_TIME, time);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_BY, userId);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_NAME, userName);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_TIME, time);
}
}
......@@ -135,10 +137,10 @@ public class CommonMethod {
String time = DateUtils.curDateTimeStr14();
for(int i=0; i < block.getRowCount(); i++){
//TODO 公司代码待补充
block.setCell(i, HPConstants.SQL_FIELD_ACCOUNT_CODE, "");
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_BY, userId);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_NAME, userName);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_TIME, time);
block.setCell(i, HGConstants.SQL_FIELD_ACCOUNT_CODE, "");
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_BY, userId);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_NAME, userName);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_TIME, time);
}
}
......@@ -150,8 +152,8 @@ public class CommonMethod {
String time = DateUtils.curDateTimeStr14();
for(int i=0; i < block.getRowCount(); i++){
//TODO 公司代码待补充
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_BY, userId+ HPConstants.SPLICING_SYMBOL + userName);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_TIME, time);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_BY, userId+ HGConstants.SPLICING_SYMBOL + userName);
block.setCell(i, HGConstants.SQL_FIELD_UPDATED_TIME, time);
}
}
......@@ -229,4 +231,26 @@ public class CommonMethod {
return eiMetadata;
}
public static void CollectionToBlock(EiInfo eiInfo,String blockId,List<Map<String,Object>> list){
if(CollectionUtils.isNotEmpty(list)){
Map map = list.get(0);
EiBlock eiBlock = new EiBlock(blockId);
eiBlock.addBlockMeta(initMetaByMap(map));
eiBlock.addRows(list);
eiInfo.setBlock(eiBlock);
}
}
private static EiBlockMeta initMetaByMap(Map<String,Object> map){
EiBlockMeta eiMetadata = new EiBlockMeta();
if(MapUtils.isNotEmpty(map)){
map.forEach((k,v)->{
EiColumn eiColumn = new EiColumn(k);
eiColumn.setDescName(k);
eiMetadata.addMeta(eiColumn);
});
}
return eiMetadata;
}
}
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