Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hg-smart
Commits
43e668a3
Commit
43e668a3
authored
Jun 20, 2024
by
13420
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产驾驶舱大屏
parent
df92eea7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
3329 additions
and
0 deletions
+3329
-0
UserSessionUtils.java
...ava/com/baosight/hggp/core/security/UserSessionUtils.java
+22
-0
HGBI001.java
src/main/java/com/baosight/hggp/hg/bi/domain/HGBI001.java
+467
-0
ServiceHGBI001.java
.../java/com/baosight/hggp/hg/bi/service/ServiceHGBI001.java
+589
-0
ServiceHGBI002.java
.../java/com/baosight/hggp/hg/bi/service/ServiceHGBI002.java
+853
-0
ServiceHGBI003.java
.../java/com/baosight/hggp/hg/bi/service/ServiceHGBI003.java
+579
-0
HGBI001.xml
src/main/java/com/baosight/hggp/hg/bi/sql/HGBI001.xml
+783
-0
HGBI003.xml
src/main/java/com/baosight/hggp/hg/bi/sql/HGBI003.xml
+36
-0
No files found.
src/main/java/com/baosight/hggp/core/security/UserSessionUtils.java
View file @
43e668a3
package
com
.
baosight
.
hggp
.
core
.
security
;
package
com
.
baosight
.
hggp
.
core
.
security
;
import
com.baosight.hggp.core.enums.OrgTypeEnum
;
import
com.baosight.hggp.core.enums.OrgTypeEnum
;
import
com.baosight.hggp.hg.cw.vo.UserVO
;
import
com.baosight.hggp.hg.xs.domain.Company
;
import
com.baosight.hggp.hg.xs.domain.Company
;
import
com.baosight.hggp.hg.xs.domain.Dept
;
import
com.baosight.hggp.hg.xs.domain.Dept
;
import
com.baosight.hggp.hg.xs.domain.Org
;
import
com.baosight.hggp.hg.xs.domain.Org
;
...
@@ -77,6 +78,27 @@ public class UserSessionUtils extends UserSession {
...
@@ -77,6 +78,27 @@ public class UserSessionUtils extends UserSession {
}
}
/**
/**
获取用户所属公司 *
* @return
*/
public
static
UserVO
getUserCompany
()
{
UserVO
userVO
=
new
UserVO
();
List
<
Org
>
orgList
=
HGXSTools
.
XsOrg
.
queryByUser
();
if
(
CollectionUtils
.
isNotEmpty
(
orgList
))
{
Org
org
=
orgList
.
get
(
0
);
if
(!
org
.
getOrgType
().
equals
(
"company"
))
{
//如果不是公司公司,则找到上一级
Org
org1
=
HGXSTools
.
XsOrg
.
queryCompany
(
org
.
getOrgId
());
userVO
.
setUsercode
(
org1
.
getOrgId
());
userVO
.
setUsername
(
org1
.
getOrgCname
());
}
else
{
userVO
.
setUsercode
(
org
.
getOrgId
());
userVO
.
setUsername
(
org
.
getOrgCname
());
}
}
return
userVO
;
}
/**
* 获取登录用户的组织机构
* 获取登录用户的组织机构
*
*
* @return
* @return
...
...
src/main/java/com/baosight/hggp/hg/bi/domain/HGBI001.java
0 → 100644
View file @
43e668a3
package
com
.
baosight
.
hggp
.
hg
.
bi
.
domain
;
import
com.baosight.iplat4j.core.data.DaoEPBase
;
import
com.baosight.iplat4j.core.ei.EiColumn
;
import
com.baosight.iplat4j.core.util.NumberUtils
;
import
com.baosight.iplat4j.core.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Project: <br>
* Title:THPBI001.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-22 13:46:10 create
*/
public
class
HGBI001
extends
DaoEPBase
{
private
static
final
long
serialVersionUoctValue
=
1L
;
public
static
final
String
INDNAME
=
"indNmae"
;
/* 企业编码 预留*/
public
static
final
String
DAYVALUE
=
"dayValue"
;
/* 部门编码*/
public
static
final
String
MONVALUE
=
"monValue"
;
/* 供应商类型 1 国企 : 2 民营*/
public
static
final
String
YEARVALUE
=
"yearValue"
;
/* 供应商编码*/
public
static
final
String
JANVALUE
=
"janValue"
;
/* 供应商名称*/
public
static
final
String
FEBVALUE
=
"febValue"
;
/* 地址*/
public
static
final
String
MARVLAUE
=
"marValue"
;
/* 状态 0禁用 1启用*/
public
static
final
String
APRVALUE
=
"aprValue"
;
/* 创建人*/
public
static
final
String
MAYVALUE
=
"mayValue"
;
/* 创建人名称*/
public
static
final
String
JUNVALUE
=
"junValue"
;
/* 创建时间*/
public
static
final
String
JULVALUE
=
"julValue"
;
/* 更新人*/
public
static
final
String
AUGVALUE
=
"augValue"
;
/* 更新人名称*/
public
static
final
String
SEPVALUE
=
"sepValue"
;
/* 更新时间*/
public
static
final
String
OCTVALUE
=
"octValue"
;
public
static
final
String
NOVVALUE
=
"novValue"
;
/* 企业编码 预留*/
public
static
final
String
DECVALUE
=
"decValue"
;
/* 部门编码*/
public
static
final
String
COL_febValue
=
"febValue"
;
/* 地址*/
public
static
final
String
COL_marValue
=
"marValue"
;
/* 状态 0禁用 1启用*/
public
static
final
String
COL_CREATED_BY
=
"CREATED_BY"
;
/* 创建人*/
public
static
final
String
COL_CREATED_NAME
=
"CREATED_NAME"
;
/* 创建人名称*/
public
static
final
String
COL_CREATED_TIME
=
"CREATED_TIME"
;
/* 创建时间*/
public
static
final
String
COL_UPDATED_BY
=
"UPDATED_BY"
;
/* 更新人*/
public
static
final
String
COL_UPDATED_NAME
=
"UPDATED_NAME"
;
/* 更新人名称*/
public
static
final
String
COL_UPDATED_TIME
=
"UPDATED_TIME"
;
/* 更新时间*/
public
static
final
String
QUERY
=
"HPBI001.query"
;
public
static
final
String
COUNT
=
"HPBI001.count"
;
public
static
final
String
INSERT
=
"HPBI001.insert"
;
public
static
final
String
UPDATE
=
"HPBI001.update"
;
public
static
final
String
DELETE
=
"HPBI001.delete"
;
private
String
indNmae
=
" "
;
/* 企业编码 预留*/
private
String
dayValue
=
" "
;
/* 部门编码*/
private
String
monValue
=
" "
;
/* 供应商类型 1 国企 : 2 民营*/
private
String
yearValue
=
" "
;
/* 供应商编码*/
private
String
janValue
=
" "
;
/* 供应商名称*/
private
String
febValue
=
" "
;
/* 地址*/
private
String
marValue
=
" "
;
/* 状态 0禁用 1启用*/
private
String
aprValue
=
" "
;
/* 创建人*/
private
String
mayValue
=
" "
;
/* 创建人名称*/
private
String
junValue
=
" "
;
/* 创建时间*/
private
String
julValue
=
" "
;
/* 更新人*/
private
String
augValue
=
" "
;
/* 更新人名称*/
private
String
sepValue
=
" "
;
/* 更新时间*/
private
String
octValue
=
" "
;
private
String
novValue
=
" "
;
private
String
decValue
=
" "
;
/**
* initialize the metadata.
*/
public
void
initMetaData
()
{
EiColumn
eiColumn
;
eiColumn
=
new
EiColumn
(
INDNAME
);
eiColumn
.
setDescName
(
"指标名称"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
DAYVALUE
);
eiColumn
.
setDescName
(
"日"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
MONVALUE
);
eiColumn
.
setDescName
(
"月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
YEARVALUE
);
eiColumn
.
setDescName
(
"年"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
JANVALUE
);
eiColumn
.
setDescName
(
"1月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FEBVALUE
);
eiColumn
.
setDescName
(
"2月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
MARVLAUE
);
eiColumn
.
setDescName
(
"3月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
APRVALUE
);
eiColumn
.
setDescName
(
"4月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
MAYVALUE
);
eiColumn
.
setDescName
(
"5月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
JUNVALUE
);
eiColumn
.
setDescName
(
"6月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
JULVALUE
);
eiColumn
.
setDescName
(
"7月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
AUGVALUE
);
eiColumn
.
setDescName
(
"8月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
SEPVALUE
);
eiColumn
.
setDescName
(
"9月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
OCTVALUE
);
eiColumn
.
setDescName
(
"10月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
NOVVALUE
);
eiColumn
.
setDescName
(
"11月"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
DECVALUE
);
eiColumn
.
setDescName
(
"12月"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
/**
* the constructor.
*/
public
HGBI001
()
{
initMetaData
();
}
/**
* get the companyCode - 企业编码 预留.
* @return the companyCode
*/
public
String
getindNmae
()
{
return
this
.
indNmae
;
}
/**
* set the companyCode - 企业编码 预留.
*
* @param companyCode - 企业编码 预留
*/
public
void
setindNmae
(
String
companyCode
)
{
this
.
indNmae
=
companyCode
;
}
/**
* get the dayValue - 部门编码.
* @return the dayValue
*/
public
String
getdayValue
()
{
return
this
.
dayValue
;
}
/**
* set the dayValue - 部门编码.
*
* @param dayValue - 部门编码
*/
public
void
setdayValue
(
String
dayValue
)
{
this
.
dayValue
=
dayValue
;
}
/**
* get the monValue - 供应商类型 1 国企 : 2 民营.
* @return the monValue
*/
public
String
getmonValue
()
{
return
this
.
monValue
;
}
/**
* set the monValue - 供应商类型 1 国企 : 2 民营.
*
* @param monValue - 供应商类型 1 国企 : 2 民营
*/
public
void
setmonValue
(
String
monValue
)
{
this
.
monValue
=
monValue
;
}
/**
* get the yearValue - 供应商编码.
* @return the yearValue
*/
public
String
getyearValue
()
{
return
this
.
yearValue
;
}
/**
* set the yearValue - 供应商编码.
*
* @param yearValue - 供应商编码
*/
public
void
setyearValue
(
String
yearValue
)
{
this
.
yearValue
=
yearValue
;
}
/**
* get the janValue - 供应商名称.
* @return the janValue
*/
public
String
getjanValue
()
{
return
this
.
janValue
;
}
/**
* set the janValue - 供应商名称.
*
* @param janValue - 供应商名称
*/
public
void
setjanValue
(
String
janValue
)
{
this
.
janValue
=
janValue
;
}
/**
* get the febValue - 地址.
* @return the febValue
*/
public
String
getfebValue
()
{
return
this
.
febValue
;
}
/**
* set the febValue - 地址.
*
* @param febValue - 地址
*/
public
void
setfebValue
(
String
febValue
)
{
this
.
febValue
=
febValue
;
}
/**
* get the marValue - 状态 0禁用 1启用.
* @return the marValue
*/
public
String
getmarValue
()
{
return
this
.
marValue
;
}
/**
* set the marValue - 状态 0禁用 1启用.
*
* @param marValue - 状态 0禁用 1启用
*/
public
void
setmarValue
(
String
marValue
)
{
this
.
marValue
=
marValue
;
}
/**
* get the aprValue - 创建人.
* @return the aprValue
*/
public
String
getaprValue
()
{
return
this
.
aprValue
;
}
/**
* set the aprValue - 创建人.
*
* @param aprValue - 创建人
*/
public
void
setaprValue
(
String
aprValue
)
{
this
.
aprValue
=
aprValue
;
}
/**
* get the mayValue - 创建人名称.
* @return the mayValue
*/
public
String
getmayValue
()
{
return
this
.
mayValue
;
}
/**
* set the mayValue - 创建人名称.
*
* @param mayValue - 创建人名称
*/
public
void
setmayValue
(
String
mayValue
)
{
this
.
mayValue
=
mayValue
;
}
/**
* get the junValue - 创建时间.
* @return the junValue
*/
public
String
getjunValue
()
{
return
this
.
junValue
;
}
/**
* set the junValue - 创建时间.
*
* @param junValue - 创建时间
*/
public
void
setjunValue
(
String
junValue
)
{
this
.
junValue
=
junValue
;
}
/**
* get the julValue - 更新人.
* @return the julValue
*/
public
String
getjulValue
()
{
return
this
.
julValue
;
}
/**
* set the julValue - 更新人.
*
* @param julValue - 更新人
*/
public
void
setjulValue
(
String
julValue
)
{
this
.
julValue
=
julValue
;
}
/**
* get the augValue - 更新人名称.
* @return the augValue
*/
public
String
getaugValue
()
{
return
this
.
augValue
;
}
/**
* set the augValue - 更新人名称.
*
* @param augValue - 更新人名称
*/
public
void
setaugValue
(
String
augValue
)
{
this
.
augValue
=
augValue
;
}
/**
* get the sepValue - 更新时间.
* @return the sepValue
*/
public
String
getsepValue
()
{
return
this
.
sepValue
;
}
/**
* set the sepValue - 更新时间.
*
* @param sepValue - 更新时间
*/
public
void
setsepValue
(
String
sepValue
)
{
this
.
sepValue
=
sepValue
;
}
/**
* get the octValue .
* @return the octValue
*/
public
String
getoctValue
()
{
return
this
.
octValue
;
}
/**
* set the octValue .
*
* @param octValue
*/
public
void
setoctValue
(
String
octValue
)
{
this
.
octValue
=
octValue
;
}
/**
* get the novValue .
* @return the novValue
*/
public
String
getnovValue
()
{
return
this
.
novValue
;
}
/**
* set the octValue .
*
* @param novValue
*/
public
void
setnovValue
(
String
novValue
)
{
this
.
novValue
=
novValue
;
}
/**
* get the decValue .
* @return the decValue
*/
public
String
getdecValue
()
{
return
this
.
decValue
;
}
/**
* set the octValue .
*
* @param decValue
*/
public
void
setdecValue
(
String
decValue
)
{
this
.
decValue
=
decValue
;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public
void
fromMap
(
Map
map
)
{
setindNmae
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
INDNAME
)),
indNmae
));
setdayValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
DAYVALUE
)),
dayValue
));
setmonValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
MONVALUE
)),
monValue
));
setyearValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
YEARVALUE
)),
yearValue
));
setjanValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
JANVALUE
)),
janValue
));
setfebValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FEBVALUE
)),
febValue
));
setmarValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
MARVLAUE
)),
marValue
));
setaprValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
APRVALUE
)),
aprValue
));
setmayValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
MAYVALUE
)),
mayValue
));
setjunValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
JUNVALUE
)),
junValue
));
setjulValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
JULVALUE
)),
julValue
));
setaugValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
AUGVALUE
)),
augValue
));
setsepValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
SEPVALUE
)),
sepValue
));
setoctValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
OCTVALUE
)),
octValue
));
setnovValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
NOVVALUE
)),
novValue
));
setdecValue
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
DECVALUE
)),
decValue
));
}
/**
* set the value to Map.
*/
@Override
public
Map
toMap
()
{
Map
map
=
new
HashMap
();
map
.
put
(
INDNAME
,
StringUtils
.
toString
(
indNmae
,
eiMetadata
.
getMeta
(
INDNAME
)));
map
.
put
(
DAYVALUE
,
StringUtils
.
toString
(
dayValue
,
eiMetadata
.
getMeta
(
DAYVALUE
)));
map
.
put
(
MONVALUE
,
StringUtils
.
toString
(
monValue
,
eiMetadata
.
getMeta
(
MONVALUE
)));
map
.
put
(
YEARVALUE
,
StringUtils
.
toString
(
yearValue
,
eiMetadata
.
getMeta
(
YEARVALUE
)));
map
.
put
(
JANVALUE
,
StringUtils
.
toString
(
janValue
,
eiMetadata
.
getMeta
(
JANVALUE
)));
map
.
put
(
FEBVALUE
,
StringUtils
.
toString
(
febValue
,
eiMetadata
.
getMeta
(
FEBVALUE
)));
map
.
put
(
MARVLAUE
,
StringUtils
.
toString
(
marValue
,
eiMetadata
.
getMeta
(
MARVLAUE
)));
map
.
put
(
APRVALUE
,
StringUtils
.
toString
(
aprValue
,
eiMetadata
.
getMeta
(
APRVALUE
)));
map
.
put
(
MAYVALUE
,
StringUtils
.
toString
(
mayValue
,
eiMetadata
.
getMeta
(
MAYVALUE
)));
map
.
put
(
JUNVALUE
,
StringUtils
.
toString
(
junValue
,
eiMetadata
.
getMeta
(
JUNVALUE
)));
map
.
put
(
JULVALUE
,
StringUtils
.
toString
(
julValue
,
eiMetadata
.
getMeta
(
JULVALUE
)));
map
.
put
(
AUGVALUE
,
StringUtils
.
toString
(
augValue
,
eiMetadata
.
getMeta
(
AUGVALUE
)));
map
.
put
(
SEPVALUE
,
StringUtils
.
toString
(
sepValue
,
eiMetadata
.
getMeta
(
SEPVALUE
)));
map
.
put
(
OCTVALUE
,
StringUtils
.
toString
(
octValue
,
eiMetadata
.
getMeta
(
OCTVALUE
)));
map
.
put
(
NOVVALUE
,
StringUtils
.
toString
(
novValue
,
eiMetadata
.
getMeta
(
NOVVALUE
)));
map
.
put
(
DECVALUE
,
StringUtils
.
toString
(
decValue
,
eiMetadata
.
getMeta
(
DECVALUE
)));
return
map
;
}
}
src/main/java/com/baosight/hggp/hg/bi/service/ServiceHGBI001.java
0 → 100644
View file @
43e668a3
package
com
.
baosight
.
hggp
.
hg
.
bi
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baosight.eplat.be.dz.constants.BEDZConstants
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.InventTypeEnum
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.bi.domain.HGBI001
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.cw.tools.HGCWTools
;
import
com.baosight.hggp.hg.kc.domain.HGKC001
;
import
com.baosight.hggp.hg.kc.domain.HGKC007
;
import
com.baosight.hggp.hg.kc.tools.HGKCTools
;
import
com.baosight.hggp.hg.pz.tools.HGPZTools
;
import
com.baosight.hggp.util.*
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.MapUtils
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
static
com
.
baosight
.
eplat
.
be
.
dz
.
service
.
ServiceBEDZ04
.
PARAMS_KEY_STR
;
/**
* @author wancheng
* @date 2024年02月01日 17:18
*/
public
class
ServiceHGBI001
extends
ServiceBase
{
// 指定存货类型
private
static
final
Integer
[]
DEFAULT_INVENT_CODE
=
{
InventTypeEnum
.
RAW
.
getCode
(),
InventTypeEnum
.
CONSUMABLE
.
getCode
()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventTypes"
,
DEFAULT_INVENT_CODE
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
queryMap
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
FACTORY_RECORD_BLOCK_ID
),
queryMap
);
//inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new hgKC007().eiMetadata);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
return
inInfo
;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
EiInfo
outInfo
=
new
EiInfo
();
try
{
Map
params
=
new
HashMap
();
params
.
put
(
"factory"
,
inInfo
.
get
(
"factory"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"factory"
));
params
.
put
(
"date"
,
inInfo
.
get
(
"date"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"date"
));
params
.
put
(
"company_code"
,
UserSessionUtils
.
getUserCompany
().
getUsercode
());
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"company_code"
,
UserSessionUtils
.
getUserCompany
().
getUsercode
());
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"factory"
,
inInfo
.
get
(
"factory"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"factory"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"date"
,
inInfo
.
get
(
"date"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"date"
));
//汇总数据
//if(!StringUtils.isEmpty(inInfo.getCellStr(EiConstant.queryBlock, 0, "date"))){
//每日数据
String
pro_code
=
"***"
;
List
<
Map
>
mrsj
=
dao
.
query
(
"hgBI001.queryDay"
,
params
);
if
(
mrsj
!=
null
){
for
(
Map
obj:
mrsj
)
{
if
((
Long
)
obj
.
get
(
"SORT"
)
==
2
){
pro_code
=
(
String
)
obj
.
get
(
"PROJ_CODE"
);
}
}
}
params
.
put
(
"pro_name"
,
pro_code
);
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"pro_name"
,
pro_code
);
outInfo
=
super
.
query
(
inInfo
,
"hgBI001.querySum"
,
new
HGBI001
());
//生产月报
List
scyb
=
dao
.
query
(
"hgBI001.queryMon"
,
params
);
outInfo
.
set
(
"mrsj"
,
mrsj
);
outInfo
.
set
(
"scyb"
,
scyb
);
// }
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
outInfo
;
}
/**
* 查询CompanyCode
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"查询CompanyCode"
)
public
EiInfo
queryCompanyCode
(
EiInfo
inInfo
)
{
EiInfo
outInfo
=
new
EiInfo
();
try
{
Map
params
=
new
HashMap
();
params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
//params.put("loginName", "QY000019");
//汇总数据
List
company_code
=
super
.
dao
.
query
(
"hgBI001.queryCompanyCode"
,
params
);
outInfo
.
set
(
"company_code"
,
company_code
.
get
(
0
));
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
outInfo
;
}
/**
* 查询报屏模块show14
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show14"
)
public
EiInfo
queryZLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"22f02674b4b9448782b019686ce9c780"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"22f02674b4b9448782b019686ce9c780"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"DATE"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show14"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show17
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show17"
)
public
EiInfo
queryXMinfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"903f232398d44b8da7c5492434ce746f"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
/* Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("hgBI001.queryCompanyCode",user_params);
String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString();
}*/
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"903f232398d44b8da7c5492434ce746f"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"项目名称,计划完成时间,计划产量,实际产量,进度"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"项目名称"
));
datalist
.
add
(
obj
.
get
(
"计划完成时间"
));
datalist
.
add
(
obj
.
get
(
"计划产量"
));
datalist
.
add
(
obj
.
get
(
"实际产量"
));
datalist
.
add
(
obj
.
get
(
"进度"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show17"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show21
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show21"
)
public
EiInfo
queryRJCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"d5008eb93eac4d63b2fc0f1323683078"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"d5008eb93eac4d63b2fc0f1323683078"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show21"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show7
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show7"
)
public
EiInfo
queryYCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"05e22350db614c95b0e254aa38c81db2"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"05e22350db614c95b0e254aa38c81db2"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show7"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show6
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show6"
)
public
EiInfo
queryHAPlanInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"HA_PLAN_WT,hg_PLAN_WT,HA_FACT_WT,hg_FACT_WT,HA_VOLUME_UP,hg_VOLUME_UP,BFB"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"HA_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"hg_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"hg_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"hg_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"BFB"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show9
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show9"
)
public
EiInfo
queryMonWtInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"530ad899d9f64c4383da7c61a6fb1562"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"530ad899d9f64c4383da7c61a6fb1562"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"MON_PLAN_WT,MON_FACT_WT,VOLUME_UP"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"MON_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"MON_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"VOLUME_UP"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 微服务测试方法(柱形图、折线图、饼图)
* 微服务号:S_BE_DZ_04
*
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"微服务测试方法(柱形图、折线图、饼图)"
)
public
EiInfo
queryMicroServiceBarData
(
EiInfo
eiInfo
)
{
EiInfo
returnInfo
=
new
EiInfo
();
String
paramsStr
=
eiInfo
.
getString
(
PARAMS_KEY_STR
);
if
(
StringUtils
.
isEmpty
(
paramsStr
))
{
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_FAILURE
);
returnInfo
.
setMsg
(
"获取测试数据失败,原因为:参数不能为空!"
);
return
returnInfo
;
}
String
[]
jsonStrs
=
new
String
[]{
"appEname,date,unitCover&"
+
"xdata-show,1月,50&dataworks-admin,1月,100&dataworks-market,1月,160&*"
+
"xdata-show,2月,60&dataworks-admin,2月,150&dataworks-market,2月,80&*"
+
"xdata-show,3月,80&dataworks-admin,3月,50&dataworks-market,3月,60&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,100&*"
+
"xdata-show,5月,30&dataworks-admin,5月,80&dataworks-market,5月,60&*"
+
"xdata-show,6月,20&dataworks-admin,6月,30&dataworks-market,6月,50"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,90&dataworks-admin,1月,20&dataworks-market,1月,60&*"
+
"xdata-show,2月,70&dataworks-admin,2月,50&dataworks-market,2月,70&*"
+
"xdata-show,3月,60&dataworks-admin,3月,60&dataworks-market,3月,65&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,90&*"
+
"xdata-show,5月,20&dataworks-admin,5月,80&dataworks-market,5月,80&*"
+
"xdata-show,6月,50&dataworks-admin,6月,90&dataworks-market,6月,70"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,80&dataworks-admin,1月,30&dataworks-market,1月,90&*"
+
"xdata-show,2月,10&dataworks-admin,2月,100&dataworks-market,2月,10&*"
+
"xdata-show,3月,180&dataworks-admin,3月,150&dataworks-market,3月,45&*"
+
"xdata-show,4月,100&dataworks-admin,4月,170&dataworks-market,4月,40&*"
+
"xdata-show,5月,66&dataworks-admin,5月,80&dataworks-market,5月,180&*"
+
"xdata-show,6月,80&dataworks-admin,6月,90&dataworks-market,6月,40"
,
"appEname,date,unitCover&"
,
""
};
JSONArray
jsonArr
=
JSONArray
.
parseArray
(
paramsStr
);
List
items
=
new
ArrayList
<>();
for
(
int
index
=
0
;
index
<
jsonArr
.
size
();
index
++)
{
JSONObject
jsonObject
=
jsonArr
.
getJSONObject
(
index
);
JSONObject
testDataObj
=
jsonObject
.
getJSONObject
(
"params"
);
JSONObject
item
=
new
JSONObject
();
if
(
testDataObj
.
size
()
==
0
||
!
testDataObj
.
containsKey
(
"month"
))
{
item
.
put
(
"data"
,
new
JSONArray
());
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
items
.
add
(
item
);
continue
;
}
String
monthStr
=
testDataObj
.
getString
(
"month"
);
if
(
StringUtils
.
isNotEmpty
(
monthStr
))
{
int
month
=
Integer
.
parseInt
(
monthStr
);
Random
ran
=
new
Random
();
int
x
=
ran
.
nextInt
(
4
);
String
contentStr
=
jsonStrs
[
x
];
String
[]
monthDataStr
=
contentStr
.
split
(
"\\*"
);
if
(
month
>
monthDataStr
.
length
)
{
month
=
monthDataStr
.
length
;
}
StringBuilder
resultStr
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
month
;
i
++)
{
resultStr
.
append
(
monthDataStr
[
i
]);
}
JSONArray
tempArr
=
new
JSONArray
();
String
[]
contentStrArray
=
resultStr
.
toString
().
split
(
"&"
);
for
(
int
i
=
0
;
i
<
contentStrArray
.
length
;
i
++)
{
String
tempContentStr
=
contentStrArray
[
i
];
List
tempContentList
=
Arrays
.
asList
(
tempContentStr
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
}
item
.
put
(
"data"
,
tempArr
);
}
else
{
String
json
=
"appEname,date,unitCover"
;
JSONArray
tempArr
=
new
JSONArray
();
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
item
.
put
(
"data"
,
tempArr
);
}
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
item
.
put
(
"component"
,
jsonObject
.
get
(
"component"
));
items
.
add
(
item
);
}
returnInfo
.
set
(
"result"
,
items
);
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_SUCCESS
);
returnInfo
.
setMsg
(
"获取测试数据成功!"
);
return
returnInfo
;
}
}
src/main/java/com/baosight/hggp/hg/bi/service/ServiceHGBI002.java
0 → 100644
View file @
43e668a3
package
com
.
baosight
.
hggp
.
hg
.
bi
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baosight.eplat.be.dz.constants.BEDZConstants
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.InventTypeEnum
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.bi.domain.HGBI001
;
import
com.baosight.hggp.util.CommonMethod
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
java.util.*
;
import
static
com
.
baosight
.
eplat
.
be
.
dz
.
service
.
ServiceBEDZ04
.
PARAMS_KEY_STR
;
/**
* @author wancheng
* @date 2024年02月01日 17:18
*/
public
class
ServiceHGBI002
extends
ServiceBase
{
// 指定存货类型
private
static
final
Integer
[]
DEFAULT_INVENT_CODE
=
{
InventTypeEnum
.
RAW
.
getCode
(),
InventTypeEnum
.
CONSUMABLE
.
getCode
()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventTypes"
,
DEFAULT_INVENT_CODE
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
queryMap
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
FACTORY_RECORD_BLOCK_ID
),
queryMap
);
//inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new hgKC007().eiMetadata);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
return
inInfo
;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
EiInfo
outInfo
=
new
EiInfo
();
try
{
Map
params
=
new
HashMap
();
params
.
put
(
"factory"
,
inInfo
.
get
(
"factory"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"factory"
));
params
.
put
(
"date"
,
inInfo
.
get
(
"date"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"date"
));
params
.
put
(
"company_code"
,
UserSessionUtils
.
getUserCompany
().
getUsercode
());
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"company_code"
,
UserSessionUtils
.
getUserCompany
().
getUsercode
());
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"factory"
,
inInfo
.
get
(
"factory"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"factory"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"date"
,
inInfo
.
get
(
"date"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"date"
));
//汇总数据
//if(!StringUtils.isEmpty(inInfo.getCellStr(EiConstant.queryBlock, 0, "date"))){
//每日数据
String
pro_code
=
"***"
;
List
<
Map
>
mrsj
=
dao
.
query
(
"hgBI001.queryDay"
,
params
);
if
(
mrsj
!=
null
){
for
(
Map
obj:
mrsj
)
{
if
((
Long
)
obj
.
get
(
"SORT"
)
==
2
){
pro_code
=
(
String
)
obj
.
get
(
"PROJ_CODE"
);
}
}
}
params
.
put
(
"pro_name"
,
pro_code
);
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"pro_name"
,
pro_code
);
outInfo
=
super
.
query
(
inInfo
,
"hgBI001.querySum"
,
new
HGBI001
());
//生产月报
List
scyb
=
dao
.
query
(
"hgBI001.queryMon"
,
params
);
outInfo
.
set
(
"mrsj"
,
mrsj
);
outInfo
.
set
(
"scyb"
,
scyb
);
// }
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
outInfo
;
}
/**
* 查询CompanyCode
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"查询CompanyCode"
)
public
EiInfo
queryCompanyCode
(
EiInfo
inInfo
)
{
EiInfo
outInfo
=
new
EiInfo
();
try
{
Map
params
=
new
HashMap
();
params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
//params.put("loginName", "QY000019");
//汇总数据
List
company_code
=
super
.
dao
.
query
(
"hgBI001.queryCompanyCode"
,
params
);
outInfo
.
set
(
"company_code"
,
company_code
.
get
(
0
));
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
outInfo
;
}
/**
* 查询报屏模块日产量 038e2e3b41854a67be4797781a89fbf3
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱1"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块日产量"
)
public
EiInfo
queryRCLInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
JSONObject
paramsObj
=
null
;
if
(
jsonObject
.
get
(
"params"
)
instanceof
String
)
{
paramsObj
=
JSON
.
parseObject
((
String
)
jsonObject
.
get
(
"params"
));
}
else
{
paramsObj
=
(
JSONObject
)
jsonObject
.
get
(
"params"
);
}
String
factStr
=
paramsObj
.
getString
(
"factorycode"
);
String
dateStr
=
paramsObj
.
getString
(
"date"
).
replace
(
"-"
,
""
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"038e2e3b41854a67be4797781a89fbf3"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
companycode
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
companycode
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"companycode"
,
companycode
);
params
.
put
(
"factorycode"
,
factStr
);
params
.
put
(
"date"
,
dateStr
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"038e2e3b41854a67be4797781a89fbf3"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"RCL"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"RCL"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块月累计产量 89b407236129422488b4979d9042bc44
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱1"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块月累计产量"
)
public
EiInfo
queryYCLinfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
JSONObject
paramsObj
=
null
;
if
(
jsonObject
.
get
(
"params"
)
instanceof
String
)
{
paramsObj
=
JSON
.
parseObject
((
String
)
jsonObject
.
get
(
"params"
));
}
else
{
paramsObj
=
(
JSONObject
)
jsonObject
.
get
(
"params"
);
}
String
factStr
=
paramsObj
.
getString
(
"factorycode"
);
String
dateStr
=
paramsObj
.
getString
(
"date"
).
replace
(
"-"
,
""
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"89b407236129422488b4979d9042bc44"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
companycode
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
companycode
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"companycode"
,
companycode
);
params
.
put
(
"factorycode"
,
factStr
);
params
.
put
(
"date"
,
dateStr
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"89b407236129422488b4979d9042bc44"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"YCL"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"YCL"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块年累计产量 c3f97faf7b1540efb15d02462a8ac0dc
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱1"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块年累计产量"
)
public
EiInfo
queryNCLinfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
JSONObject
paramsObj
=
null
;
if
(
jsonObject
.
get
(
"params"
)
instanceof
String
)
{
paramsObj
=
JSON
.
parseObject
((
String
)
jsonObject
.
get
(
"params"
));
}
else
{
paramsObj
=
(
JSONObject
)
jsonObject
.
get
(
"params"
);
}
String
factStr
=
paramsObj
.
getString
(
"factorycode"
);
String
dateStr
=
paramsObj
.
getString
(
"date"
).
replace
(
"-"
,
""
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"c3f97faf7b1540efb15d02462a8ac0dc"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
companycode
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
companycode
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"companycode"
,
companycode
);
params
.
put
(
"factorycode"
,
factStr
);
params
.
put
(
"date"
,
dateStr
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"c3f97faf7b1540efb15d02462a8ac0dc"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"NCL"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"NCL"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 厂区 9b6a259be7c24e65adb6b91cd2d1cdfc
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱1"
,
operType
=
"查询"
,
operDesc
=
"厂区"
)
public
EiInfo
queryCompanyInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"9b6a259be7c24e65adb6b91cd2d1cdfc"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
companycode
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
companycode
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"companycode"
,
companycode
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"9b6a259be7c24e65adb6b91cd2d1cdfc"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"ORG_ID,ORG_CNAME"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"ORG_ID"
));
datalist
.
add
(
obj
.
get
(
"ORG_CNAME"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show14
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show14"
)
public
EiInfo
queryZLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"22f02674b4b9448782b019686ce9c780"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"22f02674b4b9448782b019686ce9c780"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"DATE"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show14"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 主要项目进度 a02eed6a3e3f4dd39dbd0851e6a7572a
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"主要项目进度"
)
public
EiInfo
queryXMinfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
JSONObject
paramsObj
=
null
;
if
(
jsonObject
.
get
(
"params"
)
instanceof
String
)
{
paramsObj
=
JSON
.
parseObject
((
String
)
jsonObject
.
get
(
"params"
));
}
else
{
paramsObj
=
(
JSONObject
)
jsonObject
.
get
(
"params"
);
}
String
dateStr
=
paramsObj
.
getString
(
"date"
).
replace
(
"-"
,
""
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"b865eed291984d3f9acf305da87046a5"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
companycode
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
companycode
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"companycode"
,
companycode
);
params
.
put
(
"date"
,
dateStr
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"b865eed291984d3f9acf305da87046a5"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"XMMC,JHSJ,JHCL,SJCL,JD"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"XMMC"
));
datalist
.
add
(
obj
.
get
(
"JHSJ"
));
datalist
.
add
(
obj
.
get
(
"JHCL"
));
datalist
.
add
(
obj
.
get
(
"SJCL"
));
datalist
.
add
(
obj
.
get
(
"JD"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show21
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show21"
)
public
EiInfo
queryRJCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"d5008eb93eac4d63b2fc0f1323683078"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"d5008eb93eac4d63b2fc0f1323683078"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show21"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show7
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show7"
)
public
EiInfo
queryYCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"05e22350db614c95b0e254aa38c81db2"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"05e22350db614c95b0e254aa38c81db2"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show7"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show6
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show6"
)
public
EiInfo
queryHAPlanInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"HA_PLAN_WT,hg_PLAN_WT,HA_FACT_WT,hg_FACT_WT,HA_VOLUME_UP,hg_VOLUME_UP,BFB"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"HA_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"hg_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"hg_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"hg_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"BFB"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show9
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show9"
)
public
EiInfo
queryMonWtInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"530ad899d9f64c4383da7c61a6fb1562"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"530ad899d9f64c4383da7c61a6fb1562"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"MON_PLAN_WT,MON_FACT_WT,VOLUME_UP"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"MON_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"MON_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"VOLUME_UP"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 微服务测试方法(柱形图、折线图、饼图)
* 微服务号:S_BE_DZ_04
*
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"微服务测试方法(柱形图、折线图、饼图)"
)
public
EiInfo
queryMicroServiceBarData
(
EiInfo
eiInfo
)
{
EiInfo
returnInfo
=
new
EiInfo
();
String
paramsStr
=
eiInfo
.
getString
(
PARAMS_KEY_STR
);
if
(
StringUtils
.
isEmpty
(
paramsStr
))
{
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_FAILURE
);
returnInfo
.
setMsg
(
"获取测试数据失败,原因为:参数不能为空!"
);
return
returnInfo
;
}
String
[]
jsonStrs
=
new
String
[]{
"appEname,date,unitCover&"
+
"xdata-show,1月,50&dataworks-admin,1月,100&dataworks-market,1月,160&*"
+
"xdata-show,2月,60&dataworks-admin,2月,150&dataworks-market,2月,80&*"
+
"xdata-show,3月,80&dataworks-admin,3月,50&dataworks-market,3月,60&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,100&*"
+
"xdata-show,5月,30&dataworks-admin,5月,80&dataworks-market,5月,60&*"
+
"xdata-show,6月,20&dataworks-admin,6月,30&dataworks-market,6月,50"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,90&dataworks-admin,1月,20&dataworks-market,1月,60&*"
+
"xdata-show,2月,70&dataworks-admin,2月,50&dataworks-market,2月,70&*"
+
"xdata-show,3月,60&dataworks-admin,3月,60&dataworks-market,3月,65&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,90&*"
+
"xdata-show,5月,20&dataworks-admin,5月,80&dataworks-market,5月,80&*"
+
"xdata-show,6月,50&dataworks-admin,6月,90&dataworks-market,6月,70"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,80&dataworks-admin,1月,30&dataworks-market,1月,90&*"
+
"xdata-show,2月,10&dataworks-admin,2月,100&dataworks-market,2月,10&*"
+
"xdata-show,3月,180&dataworks-admin,3月,150&dataworks-market,3月,45&*"
+
"xdata-show,4月,100&dataworks-admin,4月,170&dataworks-market,4月,40&*"
+
"xdata-show,5月,66&dataworks-admin,5月,80&dataworks-market,5月,180&*"
+
"xdata-show,6月,80&dataworks-admin,6月,90&dataworks-market,6月,40"
,
"appEname,date,unitCover&"
,
""
};
JSONArray
jsonArr
=
JSONArray
.
parseArray
(
paramsStr
);
List
items
=
new
ArrayList
<>();
for
(
int
index
=
0
;
index
<
jsonArr
.
size
();
index
++)
{
JSONObject
jsonObject
=
jsonArr
.
getJSONObject
(
index
);
JSONObject
testDataObj
=
jsonObject
.
getJSONObject
(
"params"
);
JSONObject
item
=
new
JSONObject
();
if
(
testDataObj
.
size
()
==
0
||
!
testDataObj
.
containsKey
(
"month"
))
{
item
.
put
(
"data"
,
new
JSONArray
());
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
items
.
add
(
item
);
continue
;
}
String
monthStr
=
testDataObj
.
getString
(
"month"
);
if
(
StringUtils
.
isNotEmpty
(
monthStr
))
{
int
month
=
Integer
.
parseInt
(
monthStr
);
Random
ran
=
new
Random
();
int
x
=
ran
.
nextInt
(
4
);
String
contentStr
=
jsonStrs
[
x
];
String
[]
monthDataStr
=
contentStr
.
split
(
"\\*"
);
if
(
month
>
monthDataStr
.
length
)
{
month
=
monthDataStr
.
length
;
}
StringBuilder
resultStr
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
month
;
i
++)
{
resultStr
.
append
(
monthDataStr
[
i
]);
}
JSONArray
tempArr
=
new
JSONArray
();
String
[]
contentStrArray
=
resultStr
.
toString
().
split
(
"&"
);
for
(
int
i
=
0
;
i
<
contentStrArray
.
length
;
i
++)
{
String
tempContentStr
=
contentStrArray
[
i
];
List
tempContentList
=
Arrays
.
asList
(
tempContentStr
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
}
item
.
put
(
"data"
,
tempArr
);
}
else
{
String
json
=
"appEname,date,unitCover"
;
JSONArray
tempArr
=
new
JSONArray
();
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
item
.
put
(
"data"
,
tempArr
);
}
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
item
.
put
(
"component"
,
jsonObject
.
get
(
"component"
));
items
.
add
(
item
);
}
returnInfo
.
set
(
"result"
,
items
);
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_SUCCESS
);
returnInfo
.
setMsg
(
"获取测试数据成功!"
);
return
returnInfo
;
}
}
src/main/java/com/baosight/hggp/hg/bi/service/ServiceHGBI003.java
0 → 100644
View file @
43e668a3
package
com
.
baosight
.
hggp
.
hg
.
bi
.
service
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baosight.eplat.be.dz.constants.BEDZConstants
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.InventTypeEnum
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.bi.domain.HGBI001
;
import
com.baosight.hggp.util.CommonMethod
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
java.util.*
;
import
static
com
.
baosight
.
eplat
.
be
.
dz
.
service
.
ServiceBEDZ04
.
PARAMS_KEY_STR
;
/**
* @author wancheng
* @date 2024年02月01日 17:18
*/
public
class
ServiceHGBI003
extends
ServiceBase
{
// 指定存货类型
private
static
final
Integer
[]
DEFAULT_INVENT_CODE
=
{
InventTypeEnum
.
RAW
.
getCode
(),
InventTypeEnum
.
CONSUMABLE
.
getCode
()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventTypes"
,
DEFAULT_INVENT_CODE
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
queryMap
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
FACTORY_RECORD_BLOCK_ID
),
queryMap
);
//inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new hgKC007().eiMetadata);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
return
inInfo
;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
EiInfo
outInfo
=
new
EiInfo
();
try
{
Map
params
=
new
HashMap
();
params
.
put
(
"factory"
,
inInfo
.
get
(
"factory"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"factory"
));
params
.
put
(
"date"
,
inInfo
.
get
(
"date"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"date"
));
params
.
put
(
"company_code"
,
UserSessionUtils
.
getUserCompany
().
getUsercode
());
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"company_code"
,
UserSessionUtils
.
getUserCompany
().
getUsercode
());
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"factory"
,
inInfo
.
get
(
"factory"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"factory"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"date"
,
inInfo
.
get
(
"date"
)==
null
?
"xxxx"
:
inInfo
.
get
(
"date"
));
//汇总数据
//if(!StringUtils.isEmpty(inInfo.getCellStr(EiConstant.queryBlock, 0, "date"))){
//每日数据
String
pro_code
=
"***"
;
List
<
Map
>
mrsj
=
dao
.
query
(
"hgBI001.queryDay"
,
params
);
if
(
mrsj
!=
null
){
for
(
Map
obj:
mrsj
)
{
if
((
Long
)
obj
.
get
(
"SORT"
)
==
2
){
pro_code
=
(
String
)
obj
.
get
(
"PROJ_CODE"
);
}
}
}
params
.
put
(
"pro_name"
,
pro_code
);
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"pro_name"
,
pro_code
);
outInfo
=
super
.
query
(
inInfo
,
"hgBI001.querySum"
,
new
HGBI001
());
//生产月报
List
scyb
=
dao
.
query
(
"hgBI001.queryMon"
,
params
);
outInfo
.
set
(
"mrsj"
,
mrsj
);
outInfo
.
set
(
"scyb"
,
scyb
);
// }
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
outInfo
;
}
/**
* 查询CompanyCode
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产日报"
,
operType
=
"查询"
,
operDesc
=
"查询CompanyCode"
)
public
EiInfo
queryCompanyCode
(
EiInfo
inInfo
)
{
EiInfo
outInfo
=
new
EiInfo
();
try
{
Map
params
=
new
HashMap
();
params
.
put
(
"loginName"
,
UserSession
.
getUserId
());
//params.put("loginName", "QY000019");
//汇总数据
List
company_code
=
super
.
dao
.
query
(
"hgBI001.queryCompanyCode"
,
params
);
outInfo
.
set
(
"company_code"
,
company_code
.
get
(
0
));
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
outInfo
;
}
/**
* 查询报屏模块show14
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show14"
)
public
EiInfo
queryZLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"22f02674b4b9448782b019686ce9c780"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"22f02674b4b9448782b019686ce9c780"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"DATE"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show14"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show17
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show17"
)
public
EiInfo
queryXMinfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"903f232398d44b8da7c5492434ce746f"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
/* Map user_params =new HashMap();
user_params.put("loginName", UserSession.getUserId());
List<Map> company_codes = super.dao.query("hgBI001.queryCompanyCode",user_params);
String company_code = "%";
if(!StringUtils.isEmpty(company_codes.get(0).get("COMPANY_CODE").toString().trim())){
company_code = company_codes.get(0).get("COMPANY_CODE").toString();
}*/
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"903f232398d44b8da7c5492434ce746f"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"项目名称,计划完成时间,计划产量,实际产量,进度"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"项目名称"
));
datalist
.
add
(
obj
.
get
(
"计划完成时间"
));
datalist
.
add
(
obj
.
get
(
"计划产量"
));
datalist
.
add
(
obj
.
get
(
"实际产量"
));
datalist
.
add
(
obj
.
get
(
"进度"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show17"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show21
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show21"
)
public
EiInfo
queryRJCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"d5008eb93eac4d63b2fc0f1323683078"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"d5008eb93eac4d63b2fc0f1323683078"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show21"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show7
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show7"
)
public
EiInfo
queryYCLInfo
(
EiInfo
inInfo
)
{
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"05e22350db614c95b0e254aa38c81db2"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"05e22350db614c95b0e254aa38c81db2"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"appEname,date,unitCover"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"SERIES"
));
datalist
.
add
(
obj
.
get
(
"X"
));
datalist
.
add
(
obj
.
get
(
"VALUE"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
"show7"
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show6
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show6"
)
public
EiInfo
queryHAPlanInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"bb6f3802bdf64bcbaef5c95ce3241c59"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"HA_PLAN_WT,hg_PLAN_WT,HA_FACT_WT,hg_FACT_WT,HA_VOLUME_UP,hg_VOLUME_UP,BFB"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"HA_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"hg_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"hg_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"HA_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"hg_VOLUME_UP"
));
datalist
.
add
(
obj
.
get
(
"BFB"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 查询报屏模块show9
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"查询报屏模块show9"
)
public
EiInfo
queryMonWtInfo
(
EiInfo
inInfo
)
{
String
paramsStr
=
inInfo
.
getString
(
PARAMS_KEY_STR
);
JSONArray
jsonArray
=
(
JSONArray
)
JSONArray
.
parse
(
paramsStr
);
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
0
);
JSONArray
idsArr
=
(
JSONArray
)
jsonObject
.
get
(
"ids"
);
String
idsStr
=
idsArr
.
getString
(
0
);
EiInfo
eiInfo
=
new
EiInfo
();
String
serviceId
=
"S_BE_XP_17"
;
eiInfo
.
set
(
EiConstant
.
serviceId
,
serviceId
);
Map
map
=
new
HashMap
();
map
.
put
(
"uuid"
,
"530ad899d9f64c4383da7c61a6fb1562"
);
map
.
put
(
"offset"
,
0
);
map
.
put
(
"limit"
,
1000
);
//获取公司代码
String
company_code
=
"%"
;
if
(!
StringUtils
.
isEmpty
(
UserSessionUtils
.
getUserCompany
().
getUsercode
())){
company_code
=
UserSessionUtils
.
getUserCompany
().
getUsercode
();
}
//数据集入参
Map
params
=
new
HashMap
();
params
.
put
(
"company_code"
,
company_code
);
map
.
put
(
"params"
,
params
);
List
list
=
new
ArrayList
();
list
.
add
(
map
);
eiInfo
.
set
(
"queryInfo"
,
list
);
//服务接口调用
EiInfo
outInfo
=
XServiceManager
.
call
(
eiInfo
);
//调用微服务后的结果
Map
result
=
(
Map
)
outInfo
.
get
(
"result"
);
Map
result1
=
(
Map
)
result
.
get
(
"530ad899d9f64c4383da7c61a6fb1562"
);
List
<
Map
>
list1
=
(
List
)
result1
.
get
(
"data"
);
JSONArray
tempArr
=
new
JSONArray
();
String
json
=
"MON_PLAN_WT,MON_FACT_WT,VOLUME_UP"
;
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
JSONObject
item
=
new
JSONObject
();
list1
.
forEach
(
obj
->
{
// 处理obj
List
datalist
=
new
ArrayList
();
datalist
.
add
(
obj
.
get
(
"MON_PLAN_WT"
));
datalist
.
add
(
obj
.
get
(
"MON_FACT_WT"
));
datalist
.
add
(
obj
.
get
(
"VOLUME_UP"
));
tempArr
.
add
(
datalist
);
});
JSONArray
ids
=
new
JSONArray
();
ids
.
add
(
idsStr
);
item
.
put
(
"ids"
,
ids
);
item
.
put
(
"component"
,
null
);
item
.
put
(
"data"
,
tempArr
);
List
list2
=
new
ArrayList
();
list2
.
add
(
item
);
outInfo
.
set
(
"result"
,
list2
);
return
outInfo
;
}
/**
* 微服务测试方法(柱形图、折线图、饼图)
* 微服务号:S_BE_DZ_04
*
* @return
*/
@OperationLogAnnotation
(
operModul
=
"生产管理驾驶舱"
,
operType
=
"查询"
,
operDesc
=
"微服务测试方法(柱形图、折线图、饼图)"
)
public
EiInfo
queryMicroServiceBarData
(
EiInfo
eiInfo
)
{
EiInfo
returnInfo
=
new
EiInfo
();
String
paramsStr
=
eiInfo
.
getString
(
PARAMS_KEY_STR
);
if
(
StringUtils
.
isEmpty
(
paramsStr
))
{
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_FAILURE
);
returnInfo
.
setMsg
(
"获取测试数据失败,原因为:参数不能为空!"
);
return
returnInfo
;
}
String
[]
jsonStrs
=
new
String
[]{
"appEname,date,unitCover&"
+
"xdata-show,1月,50&dataworks-admin,1月,100&dataworks-market,1月,160&*"
+
"xdata-show,2月,60&dataworks-admin,2月,150&dataworks-market,2月,80&*"
+
"xdata-show,3月,80&dataworks-admin,3月,50&dataworks-market,3月,60&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,100&*"
+
"xdata-show,5月,30&dataworks-admin,5月,80&dataworks-market,5月,60&*"
+
"xdata-show,6月,20&dataworks-admin,6月,30&dataworks-market,6月,50"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,90&dataworks-admin,1月,20&dataworks-market,1月,60&*"
+
"xdata-show,2月,70&dataworks-admin,2月,50&dataworks-market,2月,70&*"
+
"xdata-show,3月,60&dataworks-admin,3月,60&dataworks-market,3月,65&*"
+
"xdata-show,4月,100&dataworks-admin,4月,70&dataworks-market,4月,90&*"
+
"xdata-show,5月,20&dataworks-admin,5月,80&dataworks-market,5月,80&*"
+
"xdata-show,6月,50&dataworks-admin,6月,90&dataworks-market,6月,70"
,
"appEname,date,unitCover&"
+
"xdata-show,1月,80&dataworks-admin,1月,30&dataworks-market,1月,90&*"
+
"xdata-show,2月,10&dataworks-admin,2月,100&dataworks-market,2月,10&*"
+
"xdata-show,3月,180&dataworks-admin,3月,150&dataworks-market,3月,45&*"
+
"xdata-show,4月,100&dataworks-admin,4月,170&dataworks-market,4月,40&*"
+
"xdata-show,5月,66&dataworks-admin,5月,80&dataworks-market,5月,180&*"
+
"xdata-show,6月,80&dataworks-admin,6月,90&dataworks-market,6月,40"
,
"appEname,date,unitCover&"
,
""
};
JSONArray
jsonArr
=
JSONArray
.
parseArray
(
paramsStr
);
List
items
=
new
ArrayList
<>();
for
(
int
index
=
0
;
index
<
jsonArr
.
size
();
index
++)
{
JSONObject
jsonObject
=
jsonArr
.
getJSONObject
(
index
);
JSONObject
testDataObj
=
jsonObject
.
getJSONObject
(
"params"
);
JSONObject
item
=
new
JSONObject
();
if
(
testDataObj
.
size
()
==
0
||
!
testDataObj
.
containsKey
(
"month"
))
{
item
.
put
(
"data"
,
new
JSONArray
());
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
items
.
add
(
item
);
continue
;
}
String
monthStr
=
testDataObj
.
getString
(
"month"
);
if
(
StringUtils
.
isNotEmpty
(
monthStr
))
{
int
month
=
Integer
.
parseInt
(
monthStr
);
Random
ran
=
new
Random
();
int
x
=
ran
.
nextInt
(
4
);
String
contentStr
=
jsonStrs
[
x
];
String
[]
monthDataStr
=
contentStr
.
split
(
"\\*"
);
if
(
month
>
monthDataStr
.
length
)
{
month
=
monthDataStr
.
length
;
}
StringBuilder
resultStr
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
month
;
i
++)
{
resultStr
.
append
(
monthDataStr
[
i
]);
}
JSONArray
tempArr
=
new
JSONArray
();
String
[]
contentStrArray
=
resultStr
.
toString
().
split
(
"&"
);
for
(
int
i
=
0
;
i
<
contentStrArray
.
length
;
i
++)
{
String
tempContentStr
=
contentStrArray
[
i
];
List
tempContentList
=
Arrays
.
asList
(
tempContentStr
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
}
item
.
put
(
"data"
,
tempArr
);
}
else
{
String
json
=
"appEname,date,unitCover"
;
JSONArray
tempArr
=
new
JSONArray
();
List
tempContentList
=
Arrays
.
asList
(
json
.
split
(
","
));
tempArr
.
add
(
tempContentList
);
item
.
put
(
"data"
,
tempArr
);
}
item
.
put
(
"ids"
,
jsonObject
.
get
(
"ids"
));
item
.
put
(
"component"
,
jsonObject
.
get
(
"component"
));
items
.
add
(
item
);
}
returnInfo
.
set
(
"result"
,
items
);
returnInfo
.
setStatus
(
BEDZConstants
.
STATUS_SUCCESS
);
returnInfo
.
setMsg
(
"获取测试数据成功!"
);
return
returnInfo
;
}
}
src/main/java/com/baosight/hggp/hg/bi/sql/HGBI001.xml
0 → 100644
View file @
43e668a3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"HPBI001"
>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM hpjx.t_hppz001 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
FACTORY LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
DATE = #date#
</isNotEmpty>
</select>
<select
id=
"queryDay"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
SELECT '工厂' AS SERIES,FACTORY_NAME AS VALUE,PROJ_CODE, 1 AS SORT
FROM (
SELECT
A.COMPANY_CODE, B.FACTORY_CODE,
B.FACTORY_NAME, A.PROJ_NAME,
A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT,
SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"date"
>
D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1 ) A
UNION ALL
SELECT '生产项目' AS SERIES,PROJ_NAME AS VALUE,PROJ_CODE, 2 AS SORT
FROM (
SELECT
A.COMPANY_CODE,B.FACTORY_CODE,
B.FACTORY_NAME,A.PROJ_NAME,
A.PROJ_CODE,MAX(A.TOTAL_WT) AS TOTAL_WT,SUM(WEIGHT) AS WEIGHT,
MAX(C.NUM) AS NUM
FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"date"
>
D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1
) A
UNION ALL
SELECT
'生产产量' AS SERIES,
concat('计划产量:',TOTAL_WT,'吨 , 实际产量',WEIGHT,'吨') as VALUE,
PROJ_CODE, 3 AS SORT
FROM (
SELECT
A.COMPANY_CODE,B.FACTORY_CODE,
B.FACTORY_NAME,A.PROJ_NAME,
A.PROJ_CODE,MAX(A.TOTAL_WT) AS TOTAL_WT,
SUM(WEIGHT) AS WEIGHT,MAX(C.NUM) AS NUM
FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"date"
>
D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY A.COMPANY_CODE, A.FACTORY_CODE, A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME, A.PROJ_NAME, A.FACTORY_CODE, A.PROJ_CODE
LIMIT 1
) A
UNION ALL
SELECT
'生产人数' AS SERIES,
concat(NUM,'人') as VALUE,
PROJ_CODE, 4 AS SORT
FROM (
SELECT
A.COMPANY_CODE,B.FACTORY_CODE,
B.FACTORY_NAME,A.PROJ_NAME,
A.PROJ_CODE,MAX(A.TOTAL_WT) AS TOTAL_WT,
SUM(WEIGHT) AS WEIGHT,MAX(C.NUM) AS NUM
FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"date"
>
D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY A.COMPANY_CODE,A.FACTORY_CODE,A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME,A.PROJ_NAME,A.FACTORY_CODE,A.PROJ_CODE
LIMIT 1
) A
UNION ALL
SELECT
'人均日产' AS SERIES,
concat(ifnull(WEIGHT,0)/NUM,'吨') as VALUE,
PROJ_CODE, 5 AS SORT
FROM (
SELECT
A.COMPANY_CODE, B.FACTORY_CODE,
B.FACTORY_NAME, A.PROJ_NAME,
A.PROJ_CODE, MAX(A.TOTAL_WT) AS TOTAL_WT,
SUM(WEIGHT) AS WEIGHT, MAX(C.NUM) AS NUM
FROM hpjx.t_hpsc005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) C ON C.FACTORY_CODE=B.FACTORY_CODE AND C.GROUP_ID = B.ORG_NO
JOIN hpjx.t_hpkc003 D ON A.PROD_ORDER_NO = D.PROD_ORDER_NO
WHERE ifnull(D.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"date"
>
D.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
B.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
A.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY A.COMPANY_CODE,A.FACTORY_CODE,A.PLAN_COMPLETION_DATE,
B.FACTORY_NAME,A.PROJ_NAME,A.FACTORY_CODE,A.PROJ_CODE
LIMIT 1
) A
<dynamic
prepend=
"ORDER BY"
>
<isEmpty
property=
"orderBy"
>
SORT asc
</isEmpty>
</dynamic>
</select>
<select
id=
"querySum"
parameterClass=
"java.util.HashMap"
resultClass=
"com.baosight.hpjx.hp.bi.domain.HPBI001"
>
select
'生产人数(人)' AS indNmae,
(select
NUM as VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY DOCUMENT_DATE,C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS dayValue,
(select
NUM as VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS monValue,
(select
NUM as VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS yearValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN NUM ELSE 0 END) as janValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN NUM ELSE 0 END) as febValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '03' THEN NUM ELSE 0 END) as marValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '04' THEN NUM ELSE 0 END) as aprValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '05' THEN NUM ELSE 0 END) as mayValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '06' THEN NUM ELSE 0 END) as junValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '07' THEN NUM ELSE 0 END) as julValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '08' THEN NUM ELSE 0 END) as augValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '09' THEN NUM ELSE 0 END) as sepValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN NUM ELSE 0 END) as octValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN NUM ELSE 0 END) as novValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN NUM ELSE 0 END) as decValue
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL
select
'生产产量(吨)' AS indNmae,
(select
VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS dayValue,
(select
VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS monValue,
(select
VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS yearValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN VALUE ELSE 0 END) as janValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN VALUE ELSE 0 END) as febValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '03' THEN VALUE ELSE 0 END) as marValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '04' THEN VALUE ELSE 0 END) as aprValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '05' THEN VALUE ELSE 0 END) as mayValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '06' THEN VALUE ELSE 0 END) as junValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '07' THEN VALUE ELSE 0 END) as julValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '08' THEN VALUE ELSE 0 END) as augValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '09' THEN VALUE ELSE 0 END) as sepValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN VALUE ELSE 0 END) as octValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN VALUE ELSE 0 END) as novValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN VALUE ELSE 0 END) as decValue
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL
select
'人均产量(kg)' AS indNmae,
(select
VALUE/NUM AS VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS dayValue,
(select
VALUE/NUM AS VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,6) = left(replace(#date#,'-',''),6)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS monValue,
(select
VALUE/NUM AS VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
) AS yearValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '01' THEN VALUE/NUM ELSE 0 END) as janValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '02' THEN VALUE/NUM ELSE 0 END) as febValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '03' THEN VALUE/NUM ELSE 0 END) as marValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '04' THEN VALUE/NUM ELSE 0 END) as aprValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '05' THEN VALUE/NUM ELSE 0 END) as mayValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '06' THEN VALUE/NUM ELSE 0 END) as junValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '07' THEN VALUE/NUM ELSE 0 END) as julValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '08' THEN VALUE/NUM ELSE 0 END) as augValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '09' THEN VALUE/NUM ELSE 0 END) as sepValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '10' THEN VALUE/NUM ELSE 0 END) as octValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '11' THEN VALUE/NUM ELSE 0 END) as novValue,
MAX(case when substring(DOCUMENT_DATE,5,2) = '12' THEN VALUE/NUM ELSE 0 END) as decValue
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VALUE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE
<![CDATA[<=]]>
replace(#date#,'-','')
AND left(DOCUMENT_DATE,4) = left(replace(#date#,'-',''),4)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
<dynamic
prepend=
"ORDER BY"
>
<isEmpty
property=
"orderBy"
>
indNmae desc
</isEmpty>
</dynamic>
</select>
<select
id=
"queryMon"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
'sccl' as INDCODE,
'生产产量(吨)' as SERIES,
case when substring(DOCUMENT_DATE,5,1) = 0
then concat(substring(DOCUMENT_DATE,6,1),'月')
else concat(substring(DOCUMENT_DATE,5,2),'月')
end as X,
VAULE as VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL
select
'scrs' as INDCODE,
'生产人数(个)' as SERIES,
case when substring(DOCUMENT_DATE,5,1) = 0
then concat(substring(DOCUMENT_DATE,6,1),'月')
else concat(substring(DOCUMENT_DATE,5,2),'月')
end as X,
NUM as VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
UNION ALL
select
'rjcl' as INDCODE,
'人均产量(kg)' as SERIES,
case when substring(DOCUMENT_DATE,5,1) = 0
then concat(substring(DOCUMENT_DATE,6,1),'月')
else concat(substring(DOCUMENT_DATE,5,2),'月')
end as X,
VAULE/NUM as VALUE
FROM (select C.FACTORY_CODE,C.ORG_NO,DOCUMENT_DATE,sum(ifnull(WEIGHT,0)) as VAULE
FROM hpjx.t_hpkc003 A
JOIN hpjx.t_hpsc005 B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A C ON B.PROD_ORDER_NO = C.PROD_ORDER_NO
where ifnull(A.DOCUMENT_DATE,'')
<![CDATA[<>]]>
''
<isNotEmpty
prepend=
" AND "
property=
"pro_code"
>
A.PROJ_CODE = #pro_code#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"date"
>
A.DOCUMENT_DATE = replace(#date#,'-','')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factory"
>
C.FACTORY_CODE LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"company_code"
>
B.COMPANY_CODE LIKE CONCAT('%',CONCAT( #company_code#,'%'))
</isNotEmpty>
GROUP BY left(DOCUMENT_DATE,6),C.FACTORY_CODE,C.ORG_NO) A
JOIN (
SELECT
A.ORG_ID AS FACTORY_CODE, C.ORG_ID AS GROUP_ID,COUNT(*) AS NUM
FROM iplat.TXSOG01 A
JOIN iplat.TXSOG01 B ON A.ORG_ID = B.PARENT_ORG_ID
JOIN iplat.TXSOG02 C ON B.ORG_ID = C.ORG_ID
JOIN iplat.XS_USER D ON C.USER_ID = D.USER_ID
WHERE A.ORG_TYPE = 'factory' AND B.ORG_TYPE = 'prodGroup'
GROUP BY A.ORG_ID ,C.ORG_ID
) B ON B.FACTORY_CODE=B.FACTORY_CODE AND B.GROUP_ID = A.ORG_NO
<dynamic
prepend=
"ORDER BY"
>
<isEmpty
property=
"orderBy"
>
X asc
</isEmpty>
</dynamic>
</select>
<select
id=
"queryCompanyCode"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select COMPANY_CODE from iplat.XS_USER where 1=1
<isNotEmpty
prepend=
" AND "
property=
"loginName"
>
LOGIN_NAME = #loginName#
</isNotEmpty>
</select>
</sqlMap>
\ No newline at end of file
src/main/java/com/baosight/hggp/hg/bi/sql/HGBI003.xml
0 → 100644
View file @
43e668a3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"HPBI003"
>
<select
id=
"querySbStatus"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
select
a.DEVICE_CODE,b.ORG_CNAME,a.DEVICE_NAME,a.DEVICE_MODEL,
case when c.LOG_VALUE = 2 then 1 else 0 end as DEVICE_STATUS,
case when c.LOG_VALUE = 2 then '运行状态'
when c.LOG_VALUE = 1 then '默认状态'
when c.LOG_VALUE = 3 then '暂停状态'
when c.LOG_VALUE = 4 then '复位状态'
when c.LOG_VALUE = 5 then '一级报警状态'
when c.LOG_VALUE = 6 then '二级报警状态'
else '异常状态' end as STATUS_DESC
from hpjx.t_hpsb003 a
join iplat.TXSOG01 b on a.GROUP_CODE = b.ORG_ID and b.IS_DELETED = 0
join hpjx.t_hpsb002 c on a.DEVICE_CODE=c.EQUIPMENT_CODE
where a.DELETE_FLAG = 0 and DEVICE_STATUS = 1 and c.EQUIPMENT_TYPE = 'STARUS_TYPE'
and a.COMPANY_CODE = #companyCode#
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
a.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deviceCode"
>
a.DEVICE_CODE = #deviceCode#
</isNotEmpty>
order by c.CREATED_TIME desc
limit 1
</select>
</sqlMap>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment