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
ef50c515
Commit
ef50c515
authored
Jun 27, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-06-27 修改app角色权限查询公司
parent
668793de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
26 deletions
+84
-26
ServiceHGSC007.java
.../java/com/baosight/hggp/hg/sc/service/ServiceHGSC007.java
+32
-21
Factory.java
src/main/java/com/baosight/hggp/hg/xs/domain/Factory.java
+52
-5
No files found.
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC007.java
View file @
ef50c515
...
@@ -13,6 +13,7 @@ import com.baosight.hggp.hg.sb.domain.HGSB002;
...
@@ -13,6 +13,7 @@ import com.baosight.hggp.hg.sb.domain.HGSB002;
import
com.baosight.hggp.hg.sb.tools.HGSBTools
;
import
com.baosight.hggp.hg.sb.tools.HGSBTools
;
import
com.baosight.hggp.hg.sc.domain.HGSC007
;
import
com.baosight.hggp.hg.sc.domain.HGSC007
;
import
com.baosight.hggp.hg.xs.domain.Company
;
import
com.baosight.hggp.hg.xs.domain.Company
;
import
com.baosight.hggp.hg.xs.domain.Factory
;
import
com.baosight.hggp.hg.xs.domain.Org
;
import
com.baosight.hggp.hg.xs.domain.Org
;
import
com.baosight.hggp.hg.xs.tools.HGXSTools
;
import
com.baosight.hggp.hg.xs.tools.HGXSTools
;
import
com.baosight.hggp.util.*
;
import
com.baosight.hggp.util.*
;
...
@@ -26,6 +27,8 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -26,6 +27,8 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -90,15 +93,23 @@ import java.util.*;
...
@@ -90,15 +93,23 @@ import java.util.*;
}
}
@OperationLogAnnotation
(
operModul
=
"生产任务"
,
operType
=
"APP查询工厂"
,
operDesc
=
"APP查询当前登录用户角色所属工厂"
)
@OperationLogAnnotation
(
operModul
=
"生产任务"
,
operType
=
"APP查询工厂"
,
operDesc
=
"APP查询当前登录用户角色所属工厂"
)
public
List
<
Map
>
getRoleFactory
(
EiInfo
inInfo
)
{
public
List
<
Factory
>
getRoleFactory
(
EiInfo
inInfo
)
{
List
<
Map
>
factoryCodes
=
new
ArrayList
<>();
List
<
Org
>
factoryCodes
=
new
ArrayList
<>();
try
{
try
{
List
<
Map
<
String
,
Object
>>
mapList
=
getOrg
();
List
<
String
>
roleCompanyCode
=
HGSBTools
.
getRoleCompanyCode
();
factoryCodes
.
addAll
(
mapList
);
Optional
.
ofNullable
(
roleCompanyCode
).
orElse
(
new
ArrayList
<>()).
stream
().
forEach
(
code
->
{
factoryCodes
.
addAll
(
HGXSTools
.
XsOrg
.
queryByParent
(
code
,
OrgTypeEnum
.
FACTORY
.
getCode
()));
});
//List<Map<String,Object>> mapList = getOrg();
//factoryCodes.addAll(mapList);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"APP查询工厂失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"APP查询工厂失败"
);
}
}
return
factoryCodes
;
return
factoryCodes
.
stream
().
filter
(
o
->
com
.
baosight
.
hggp
.
util
.
StringUtils
.
equals
(
o
.
getOrgType
(),
OrgTypeEnum
.
FACTORY
.
getCode
())).
map
(
item
->
new
Factory
(
item
.
getCompanyCode
(),
item
.
getCompanyName
(),
item
.
getFactoryCode
(),
item
.
getFactoryName
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toMap
(
Factory:
:
getFactoryCode
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
oldValue
),
// 将Map转回List
m
->
new
ArrayList
<>(
m
.
values
())
));
}
}
/**
/**
...
@@ -108,11 +119,11 @@ import java.util.*;
...
@@ -108,11 +119,11 @@ import java.util.*;
public
EiInfo
getProcessSumWt
(
EiInfo
inInfo
)
{
public
EiInfo
getProcessSumWt
(
EiInfo
inInfo
)
{
try
{
try
{
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
//
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
String
companyCode
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
HGSC007
.
FIELD_company_code
);
/*
String companyCode = queryRow.getCellStr(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code);
if (StringUtils.isEmpty(companyCode)) {
if (StringUtils.isEmpty(companyCode)) {
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
}
}
*/
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_SUM_WT
);
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_SUM_WT
);
}
catch
(
PlatException
e
)
{
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
...
@@ -127,11 +138,11 @@ import java.util.*;
...
@@ -127,11 +138,11 @@ import java.util.*;
public
EiInfo
getProcessWt
(
EiInfo
inInfo
)
{
public
EiInfo
getProcessWt
(
EiInfo
inInfo
)
{
try
{
try
{
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
/*
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
String companyCode = queryRow.getCellStr(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code);
String companyCode = queryRow.getCellStr(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code);
if (StringUtils.isEmpty(companyCode)) {
if (StringUtils.isEmpty(companyCode)) {
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
}
}
*/
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_WT
);
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_WT
);
}
catch
(
PlatException
e
)
{
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
...
@@ -146,16 +157,16 @@ import java.util.*;
...
@@ -146,16 +157,16 @@ import java.util.*;
public
EiInfo
getProcessDayWt
(
EiInfo
inInfo
)
{
public
EiInfo
getProcessDayWt
(
EiInfo
inInfo
)
{
try
{
try
{
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
//
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
String
companyCode
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
HGSC007
.
FIELD_company_code
);
//
String companyCode = queryRow.getCellStr(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code);
String
endDate
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_END_DATE
);
String
endDate
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_END_DATE
);
if
(
StringUtils
.
isNotEmpty
(
endDate
))
{
if
(
StringUtils
.
isNotEmpty
(
endDate
))
{
String
startDate
=
DateUtil
.
dateSubStr
(
endDate
,-
7
);
String
startDate
=
DateUtil
.
dateSubStr
(
endDate
,-
7
);
queryRow
.
setCell
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_START_DATE
,
startDate
);
queryRow
.
setCell
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_START_DATE
,
startDate
);
}
}
if
(
StringUtils
.
isEmpty
(
companyCode
))
{
/*
if (StringUtils.isEmpty(companyCode)) {
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
}
}
*/
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_DAY_WT
);
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_DAY_WT
);
}
catch
(
PlatException
e
)
{
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
...
@@ -170,16 +181,16 @@ import java.util.*;
...
@@ -170,16 +181,16 @@ import java.util.*;
public
EiInfo
getProcessMonthWt
(
EiInfo
inInfo
)
{
public
EiInfo
getProcessMonthWt
(
EiInfo
inInfo
)
{
try
{
try
{
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
//
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
String
companyCode
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
HGSC007
.
FIELD_company_code
);
//
String companyCode = queryRow.getCellStr(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code);
String
endDate
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_END_DATE
);
String
endDate
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_END_DATE
);
if
(
StringUtils
.
isNotEmpty
(
endDate
))
{
if
(
StringUtils
.
isNotEmpty
(
endDate
))
{
String
startDate
=
DateUtil
.
getMonthOfDays
(
endDate
,-
6
,
DateUtil
.
DATE8_PATTERN
);
String
startDate
=
DateUtil
.
getMonthOfDays
(
endDate
,-
6
,
DateUtil
.
DATE8_PATTERN
);
queryRow
.
setCell
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_START_DATE
,
startDate
);
queryRow
.
setCell
(
ACConstants
.
ROW_CODE_0
,
ACConstants
.
SQL_START_DATE
,
startDate
);
}
}
if
(
StringUtils
.
isEmpty
(
companyCode
))
{
/*
if (StringUtils.isEmpty(companyCode)) {
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
}
}
*/
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_MONTH_WT
);
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_MONTH_WT
);
}
catch
(
PlatException
e
)
{
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
...
@@ -194,12 +205,12 @@ import java.util.*;
...
@@ -194,12 +205,12 @@ import java.util.*;
public
EiInfo
getProjCodeWt
(
EiInfo
inInfo
)
{
public
EiInfo
getProjCodeWt
(
EiInfo
inInfo
)
{
try
{
try
{
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
EiBlock
queryRow
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
);
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
//
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
//Map queryRow = EiInfoUtils.getFirstRow(inInfo);
//Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String
companyCode
=
queryRow
.
getCellStr
(
ACConstants
.
ROW_CODE_0
,
HGSC007
.
FIELD_company_code
);
/*
String companyCode = queryRow.getCellStr(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code);
if (StringUtils.isEmpty(companyCode)) {
if (StringUtils.isEmpty(companyCode)) {
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
queryRow.setCell(ACConstants.ROW_CODE_0,HGSC007.FIELD_company_code,userVO.getUsercode());
}
}
*/
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_PROJ_CODE_WT
);
inInfo
=
super
.
query
(
inInfo
,
HGSC007
.
QUERY_PROJ_CODE_WT
);
}
catch
(
PlatException
e
)
{
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
...
...
src/main/java/com/baosight/hggp/hg/xs/domain/Factory.java
View file @
ef50c515
...
@@ -12,10 +12,22 @@ import java.util.Map;
...
@@ -12,10 +12,22 @@ import java.util.Map;
* @date:2024/5/8,13:47
* @date:2024/5/8,13:47
*/
*/
public
class
Factory
extends
DaoEPBase
{
public
class
Factory
extends
DaoEPBase
{
public
static
final
String
FIELD_COMPANY_CODE
=
"companyCode"
;
/* 公司编码*/
public
static
final
String
FIELD_COMPANY_NAME
=
"companyName"
;
/* 公司名称*/
public
static
final
String
FIELD_FACTORY_CODE
=
"factoryCode"
;
/* 部门编码*/
public
static
final
String
FIELD_FACTORY_CODE
=
"factoryCode"
;
/* 部门编码*/
public
static
final
String
FIELD_FACTORY_NAME
=
"factoryName"
;
/* 部门名称*/
public
static
final
String
FIELD_FACTORY_NAME
=
"factoryName"
;
/* 部门名称*/
/**
* 公司编码
*/
private
String
companyCode
=
""
;
/**
* 公司名称
*/
private
String
companyName
=
""
;
/**
/**
* 厂区编码
* 厂区编码
*/
*/
...
@@ -31,7 +43,15 @@ public class Factory extends DaoEPBase {
...
@@ -31,7 +43,15 @@ public class Factory extends DaoEPBase {
*/
*/
public
void
initMetaData
()
{
public
void
initMetaData
()
{
EiColumn
eiColumn
;
EiColumn
eiColumn
;
eiColumn
=
new
EiColumn
(
FIELD_COMPANY_CODE
);
eiColumn
.
setDescName
(
"公司编码"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_COMPANY_NAME
);
eiColumn
.
setDescName
(
"公司名称"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_FACTORY_CODE
);
eiColumn
=
new
EiColumn
(
FIELD_FACTORY_CODE
);
eiColumn
.
setDescName
(
"厂区编码"
);
eiColumn
.
setDescName
(
"厂区编码"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
...
@@ -51,7 +71,31 @@ public class Factory extends DaoEPBase {
...
@@ -51,7 +71,31 @@ public class Factory extends DaoEPBase {
this
.
factoryCode
=
factoryCode
;
this
.
factoryCode
=
factoryCode
;
this
.
factoryName
=
factoryName
;
this
.
factoryName
=
factoryName
;
}
}
public
Factory
(
String
companyCode
,
String
companyName
,
String
factoryCode
,
String
factoryName
)
{
initMetaData
();
this
.
companyCode
=
companyCode
;
this
.
companyName
=
companyName
;
this
.
factoryCode
=
factoryCode
;
this
.
factoryName
=
factoryName
;
}
public
String
getCompanyCode
()
{
return
companyCode
;
}
public
void
setCompanyCode
(
String
companyCode
)
{
this
.
companyCode
=
companyCode
;
}
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getFactoryCode
()
{
public
String
getFactoryCode
()
{
return
factoryCode
;
return
factoryCode
;
}
}
...
@@ -75,7 +119,8 @@ public class Factory extends DaoEPBase {
...
@@ -75,7 +119,8 @@ public class Factory extends DaoEPBase {
*/
*/
@Override
@Override
public
void
fromMap
(
Map
map
)
{
public
void
fromMap
(
Map
map
)
{
setCompanyCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_COMPANY_CODE
)),
companyCode
));
setCompanyName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_COMPANY_NAME
)),
companyName
));
setFactoryCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_FACTORY_CODE
)),
factoryCode
));
setFactoryCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_FACTORY_CODE
)),
factoryCode
));
setFactoryName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_FACTORY_NAME
)),
factoryName
));
setFactoryName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_FACTORY_NAME
)),
factoryName
));
}
}
...
@@ -87,6 +132,8 @@ public class Factory extends DaoEPBase {
...
@@ -87,6 +132,8 @@ public class Factory extends DaoEPBase {
public
Map
toMap
()
{
public
Map
toMap
()
{
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
map
.
put
(
FIELD_COMPANY_CODE
,
StringUtils
.
toString
(
companyCode
,
eiMetadata
.
getMeta
(
FIELD_COMPANY_CODE
)));
map
.
put
(
FIELD_COMPANY_NAME
,
StringUtils
.
toString
(
companyName
,
eiMetadata
.
getMeta
(
FIELD_COMPANY_NAME
)));
map
.
put
(
FIELD_FACTORY_CODE
,
StringUtils
.
toString
(
factoryCode
,
eiMetadata
.
getMeta
(
FIELD_FACTORY_CODE
)));
map
.
put
(
FIELD_FACTORY_CODE
,
StringUtils
.
toString
(
factoryCode
,
eiMetadata
.
getMeta
(
FIELD_FACTORY_CODE
)));
map
.
put
(
FIELD_FACTORY_NAME
,
StringUtils
.
toString
(
factoryName
,
eiMetadata
.
getMeta
(
FIELD_FACTORY_NAME
)));
map
.
put
(
FIELD_FACTORY_NAME
,
StringUtils
.
toString
(
factoryName
,
eiMetadata
.
getMeta
(
FIELD_FACTORY_NAME
)));
...
...
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