Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
63fc61a1
Commit
63fc61a1
authored
Oct 30, 2023
by
litengwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register
parents
7fb7be17
e3f1eff4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
37 deletions
+179
-37
BizCommonConstant.java
...in/amos/boot/module/tcm/api/common/BizCommonConstant.java
+5
-0
TzsTwoStaffingMapper.java
...amos/boot/module/tcm/api/mapper/TzsTwoStaffingMapper.java
+6
-1
ITzsTwoStaffingService.java
...s/boot/module/tcm/api/service/ITzsTwoStaffingService.java
+3
-3
TzsTwoStaffingMapper.xml
...cm-api/src/main/resources/mapper/TzsTwoStaffingMapper.xml
+10
-2
TzsTwoStaffingController.java
...t/module/tcm/biz/controller/TzsTwoStaffingController.java
+9
-3
TzsTwoStaffingServiceImpl.java
...odule/tcm/biz/service/impl/TzsTwoStaffingServiceImpl.java
+146
-28
No files found.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/common/BizCommonConstant.java
View file @
63fc61a1
...
@@ -33,4 +33,9 @@ public interface BizCommonConstant {
...
@@ -33,4 +33,9 @@ public interface BizCommonConstant {
*/
*/
String
TCM_ALL_DATA_DICT_REDIS_KEY
=
"TCM_ALL_DATA_DICT_REDIS_KEY"
;
String
TCM_ALL_DATA_DICT_REDIS_KEY
=
"TCM_ALL_DATA_DICT_REDIS_KEY"
;
/**
* 监管单位列表redisKey
* */
String
REGULATOR_UNIT_LIST
=
"REGULATOR_UNIT_LIST"
;
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/mapper/TzsTwoStaffingMapper.java
View file @
63fc61a1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,5 +19,10 @@ public interface TzsTwoStaffingMapper extends BaseMapper<TzsTwoStaffing> {
...
@@ -19,5 +19,10 @@ public interface TzsTwoStaffingMapper extends BaseMapper<TzsTwoStaffing> {
Page
<
TzsTwoStaffingCompanyDto
>
getCompanyList
(
@Param
(
"page"
)
Page
<
TzsTwoStaffingCompanyDto
>
page
,
Page
<
TzsTwoStaffingCompanyDto
>
getCompanyList
(
@Param
(
"page"
)
Page
<
TzsTwoStaffingCompanyDto
>
page
,
@Param
(
"companyDto"
)
TzsTwoStaffingCompanyDto
companyDto
,
@Param
(
"companyDto"
)
TzsTwoStaffingCompanyDto
companyDto
,
@Param
(
"orgCode"
)
String
orgCode
);
@Param
(
"orgCode"
)
String
orgCode
);
List
<
TzsTwoStaffing
>
getListByOrgCode
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"type"
)
String
type
);
List
<
TzsTwoStaffingCompanyDto
>
getListAll
();
void
truncateTwoStaffingStatistics
();
List
<
TzsTwoStaffing
>
getListByOrgCode
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"type"
)
String
type
,
@Param
(
"level"
)
String
level
);
List
<
TzsTwoStaffing
>
getListByOrgCode
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"type"
)
String
type
,
@Param
(
"level"
)
String
level
);
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/service/ITzsTwoStaffingService.java
View file @
63fc61a1
...
@@ -2,10 +2,8 @@ package com.yeejoin.amos.boot.module.tcm.api.service;
...
@@ -2,10 +2,8 @@ package com.yeejoin.amos.boot.module.tcm.api.service;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
...
@@ -21,4 +19,6 @@ public interface ITzsTwoStaffingService {
...
@@ -21,4 +19,6 @@ public interface ITzsTwoStaffingService {
List
<
TzsTwoStaffing
>
getStatisticsMessage
(
List
<
LinkedHashMap
>
list
,
String
type
);
List
<
TzsTwoStaffing
>
getStatisticsMessage
(
List
<
LinkedHashMap
>
list
,
String
type
);
Page
<
TzsTwoStaffingCompanyDto
>
getCompanyList
(
String
orgCode
,
TzsTwoStaffingCompanyDto
companyDto
,
Page
<
TzsTwoStaffingCompanyDto
>
page
);
Page
<
TzsTwoStaffingCompanyDto
>
getCompanyList
(
String
orgCode
,
TzsTwoStaffingCompanyDto
companyDto
,
Page
<
TzsTwoStaffingCompanyDto
>
page
);
public
void
generateTwoStaffingStatistics
();
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/TzsTwoStaffingMapper.xml
View file @
63fc61a1
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper"
>
<mapper
namespace=
"com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper"
>
<select
id=
"getCompanyList"
resultType=
"com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto"
>
<select
id=
"getCompanyList"
resultType=
"com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto"
>
SELECT
SELECT
*
*
...
@@ -43,4 +42,13 @@
...
@@ -43,4 +42,13 @@
and supervisory_unit_level = #{level}
and supervisory_unit_level = #{level}
</if>
</if>
</select>
</select>
<select
id=
"getListAll"
resultType=
"com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto"
>
SELECT
*
FROM
view_two_staffing
</select>
<select
id=
"truncateTwoStaffingStatistics"
>
TRUNCATE TABLE tzs_two_staffing;
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/controller/TzsTwoStaffingController.java
View file @
63fc61a1
...
@@ -4,9 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
...
@@ -4,9 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService
;
import
com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService
;
import
com.yeejoin.amos.boot.module.tcm.api.vo.TzsTwoStaffingExportVo
;
import
com.yeejoin.amos.boot.module.tcm.api.vo.TzsTwoStaffingExportVo
;
...
@@ -73,8 +73,6 @@ public class TzsTwoStaffingController extends BaseController {
...
@@ -73,8 +73,6 @@ public class TzsTwoStaffingController extends BaseController {
ExcelUtil
.
createTemplate
(
response
,
"企业两员配备情况"
,
"企业两员配备情况"
,
equipExportData
,
TzsTwoStaffingCompanyDto
.
class
,
null
,
false
);
ExcelUtil
.
createTemplate
(
response
,
"企业两员配备情况"
,
"企业两员配备情况"
,
equipExportData
,
TzsTwoStaffingCompanyDto
.
class
,
null
,
false
);
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getStatisticsMessage"
)
@GetMapping
(
value
=
"/getStatisticsMessage"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管单位统计信息"
,
notes
=
"监管单位统计信息"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管单位统计信息"
,
notes
=
"监管单位统计信息"
)
...
@@ -88,6 +86,14 @@ public class TzsTwoStaffingController extends BaseController {
...
@@ -88,6 +86,14 @@ public class TzsTwoStaffingController extends BaseController {
return
ResponseHelper
.
buildResponse
(
tzsTwoStaffingPage
);
return
ResponseHelper
.
buildResponse
(
tzsTwoStaffingPage
);
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/generateTwoStaffingStatistics"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成两员配备统计"
,
notes
=
"生成两员配备统计"
)
public
ResponseModel
<
Object
>
generateTwoStaffingStatistics
()
{
tzsTwoStaffingService
.
generateTwoStaffingStatistics
();
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/exportData"
)
@GetMapping
(
value
=
"/exportData"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管单位统计信息导出"
,
notes
=
"监管单位统计信息导出"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"监管单位统计信息导出"
,
notes
=
"监管单位统计信息导出"
)
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsTwoStaffingServiceImpl.java
View file @
63fc61a1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tcm.api.common.BizCommonConstant
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.SupervisoryEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.SupervisoryEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper
;
import
com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService
;
import
com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 服务实现类
* 服务实现类
...
@@ -27,26 +36,128 @@ import java.util.List;
...
@@ -27,26 +36,128 @@ import java.util.List;
* @date 2023-10-27
* @date 2023-10-27
*/
*/
@Service
@Service
@Slf4j
public
class
TzsTwoStaffingServiceImpl
extends
BaseService
<
TzsTwoStaffingDto
,
TzsTwoStaffing
,
TzsTwoStaffingMapper
>
implements
ITzsTwoStaffingService
{
public
class
TzsTwoStaffingServiceImpl
extends
BaseService
<
TzsTwoStaffingDto
,
TzsTwoStaffing
,
TzsTwoStaffingMapper
>
implements
ITzsTwoStaffingService
{
// 监管列表key
private
static
final
String
REGULATOR_UNIT_LIST
=
"REGULATOR_UNIT_LIST"
;
@Autowired
@Autowired
TzsTwoStaffingMapper
tzsTwoStaffingMapper
;
RedisUtils
redisUtils
;
@Autowired
TzsTwoStaffingMapper
tzsTwoStaffingMapper
;
/**
@Override
* 分页查询
@Scheduled
(
cron
=
"0 0 2,13 * * ?"
)
*/
@SchedulerLock
(
name
=
"twoStaffingStatisticsTask"
,
lockAtMostFor
=
"PT1H"
)
public
Page
<
TzsTwoStaffingDto
>
queryForTzsTwoStaffingPage
(
Page
<
TzsTwoStaffingDto
>
page
)
{
public
void
generateTwoStaffingStatistics
()
{
return
this
.
queryForPage
(
page
,
null
,
false
);
StopWatch
timeWatch
=
new
StopWatch
();
}
timeWatch
.
start
();
// 所有监管单位列表
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
=
getSupervisionList
();
// 所有企业人员配备情况列表
List
<
TzsTwoStaffingCompanyDto
>
staffingCompanyList
=
tzsTwoStaffingMapper
.
getListAll
();
// 两员配备统计列表
List
<
TzsTwoStaffingDto
>
allStaffingDto
=
Lists
.
newArrayList
();
supervisionList
.
forEach
(
i
->
{
TzsTwoStaffingDto
useUnitTwoStaffingDto
=
new
TzsTwoStaffingDto
();
TzsTwoStaffingDto
productUnitTwoStaffingDto
=
new
TzsTwoStaffingDto
();
List
<
TzsTwoStaffingCompanyDto
>
useUnit
=
staffingCompanyList
.
stream
().
filter
(
ii
->
ii
.
getSuperviseOrgCode
().
startsWith
(
i
.
get
(
"orgCode"
).
toString
())
&&
ii
.
getUnitType
().
contains
(
"使用单位"
)).
collect
(
Collectors
.
toList
());
// 使用单位总数
int
useUnitCount
=
useUnit
.
size
();
// 已完成单位数
int
useUnitFinished
=
useUnit
.
stream
().
mapToInt
(
s
->
Integer
.
parseInt
(
s
.
getUseDone
())).
sum
();
// 已配备主要负责人单位数
int
useUnitMainChargerFinished
=
useUnit
.
stream
().
mapToInt
(
s
->
Integer
.
parseInt
(
s
.
getMainCharger
())).
sum
();
/**
if
(
useUnitCount
==
0
)
{
* 列表查询 示例
useUnitTwoStaffingDto
.
setCompletionRatio
(
"0%"
);
*/
useUnitTwoStaffingDto
.
setProportion
(
"0%"
);
public
List
<
TzsTwoStaffingDto
>
queryForTzsTwoStaffingList
()
{
}
else
{
return
this
.
queryForList
(
""
,
false
);
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"0.##"
);
}
BigDecimal
result
=
new
BigDecimal
(
useUnitFinished
).
divide
(
new
BigDecimal
(
useUnitCount
),
4
,
RoundingMode
.
HALF_UP
);
useUnitTwoStaffingDto
.
setCompletionRatio
(
decimalFormat
.
format
(
result
.
multiply
(
new
BigDecimal
(
100
)))
+
"%"
);
result
=
new
BigDecimal
(
useUnitMainChargerFinished
).
divide
(
new
BigDecimal
(
useUnitCount
),
4
,
RoundingMode
.
HALF_UP
);
useUnitTwoStaffingDto
.
setProportion
(
decimalFormat
.
format
(
result
.
multiply
(
new
BigDecimal
(
100
)))
+
"%"
);
}
useUnitTwoStaffingDto
.
setUnitType
(
"使用单位"
);
useUnitTwoStaffingDto
.
setNumberOfUnits
(
useUnitCount
);
useUnitTwoStaffingDto
.
setNumberOfCompletedUnits
(
useUnitFinished
);
useUnitTwoStaffingDto
.
setResponsibleUnitsAllocateNumber
(
useUnitMainChargerFinished
);
useUnitTwoStaffingDto
.
setSupervisoryUnitId
(
i
.
get
(
"sequenceNbr"
).
toString
());
useUnitTwoStaffingDto
.
setSupervisoryUnitLevel
(
i
.
get
(
"level"
).
toString
());
useUnitTwoStaffingDto
.
setSupervisoryUnitName
(
i
.
get
(
"companyName"
).
toString
());
useUnitTwoStaffingDto
.
setSupervisoryUnitOrgcode
(
i
.
get
(
"orgCode"
).
toString
());
allStaffingDto
.
add
(
useUnitTwoStaffingDto
);
List
<
TzsTwoStaffingCompanyDto
>
productUnit
=
staffingCompanyList
.
stream
().
filter
(
ii
->
ii
.
getSuperviseOrgCode
().
startsWith
(
i
.
get
(
"orgCode"
).
toString
())
&&
(
ii
.
getUnitType
().
contains
(
"充装单位"
)
||
ii
.
getUnitType
().
contains
(
"安装改造维修单位"
)
||
ii
.
getUnitType
().
contains
(
"制造单位"
)
||
ii
.
getUnitType
().
contains
(
"设计单位"
))).
collect
(
Collectors
.
toList
());
// 生产单位总数
int
productUnitCount
=
productUnit
.
size
();
// 已完成单位数
int
productUnitFinished
=
productUnit
.
stream
().
mapToInt
(
s
->
Integer
.
parseInt
(
s
.
getProductDone
())).
sum
();
// 已配备主要负责人单位数
int
productUnitMainChargerFinished
=
productUnit
.
stream
().
mapToInt
(
s
->
Integer
.
parseInt
(
s
.
getMainCharger
())).
sum
();
if
(
productUnitCount
==
0
)
{
productUnitTwoStaffingDto
.
setCompletionRatio
(
"0%"
);
productUnitTwoStaffingDto
.
setProportion
(
"0%"
);
}
else
{
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"0.##"
);
BigDecimal
result
=
new
BigDecimal
(
productUnitFinished
).
divide
(
new
BigDecimal
(
productUnitCount
),
4
,
RoundingMode
.
HALF_UP
);
productUnitTwoStaffingDto
.
setCompletionRatio
(
decimalFormat
.
format
(
result
.
multiply
(
new
BigDecimal
(
100
)))
+
"%"
);
result
=
new
BigDecimal
(
productUnitMainChargerFinished
).
divide
(
new
BigDecimal
(
productUnitCount
),
4
,
RoundingMode
.
HALF_UP
);
productUnitTwoStaffingDto
.
setProportion
(
decimalFormat
.
format
(
result
.
multiply
(
new
BigDecimal
(
100
)))
+
"%"
);
}
productUnitTwoStaffingDto
.
setUnitType
(
"生产单位"
);
productUnitTwoStaffingDto
.
setNumberOfUnits
(
productUnitCount
);
productUnitTwoStaffingDto
.
setNumberOfCompletedUnits
(
productUnitFinished
);
productUnitTwoStaffingDto
.
setResponsibleUnitsAllocateNumber
(
productUnitMainChargerFinished
);
productUnitTwoStaffingDto
.
setSupervisoryUnitId
(
i
.
get
(
"sequenceNbr"
).
toString
());
productUnitTwoStaffingDto
.
setSupervisoryUnitLevel
(
i
.
get
(
"level"
).
toString
());
productUnitTwoStaffingDto
.
setSupervisoryUnitName
(
i
.
get
(
"companyName"
).
toString
());
productUnitTwoStaffingDto
.
setSupervisoryUnitOrgcode
(
i
.
get
(
"orgCode"
).
toString
());
allStaffingDto
.
add
(
productUnitTwoStaffingDto
);
});
// 先清两员配备统计空表
tzsTwoStaffingMapper
.
truncateTwoStaffingStatistics
();
// 再重新生成统计信息
List
<
TzsTwoStaffing
>
allStaffing
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
allStaffingDto
))
{
allStaffingDto
.
forEach
(
e
->
{
TzsTwoStaffing
tzsTwoStaffing
=
new
TzsTwoStaffing
();
BeanUtils
.
copyProperties
(
e
,
tzsTwoStaffing
);
allStaffing
.
add
(
tzsTwoStaffing
);
});
}
this
.
saveBatch
(
allStaffing
);
timeWatch
.
stop
();
log
.
info
(
"两员配备统计耗时{}秒/n"
,
timeWatch
.
getTotalTimeSeconds
());
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
getSupervisionList
()
{
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
redisUtils
.
get
(
BizCommonConstant
.
REGULATOR_UNIT_LIST
);
if
(
ValidationUtil
.
isEmpty
(
supervisionList
))
{
// 监管单位树
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionTree
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
redisUtils
.
get
(
BizCommonConstant
.
COMPANY_TREE_REDIS_KEY
);
if
(!
ValidationUtil
.
isEmpty
(
supervisionTree
))
{
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionTree2List
=
tree2List
(
supervisionTree
);
redisUtils
.
set
(
REGULATOR_UNIT_LIST
,
supervisionTree2List
);
return
supervisionTree2List
;
}
}
return
supervisionList
;
}
@Override
@Override
public
List
<
TzsTwoStaffing
>
getStatisticsMessage
(
List
<
LinkedHashMap
>
list
,
String
type
)
{
public
List
<
TzsTwoStaffing
>
getStatisticsMessage
(
List
<
LinkedHashMap
>
list
,
String
type
)
{
...
@@ -101,19 +212,26 @@ public class TzsTwoStaffingServiceImpl extends BaseService<TzsTwoStaffingDto, Tz
...
@@ -101,19 +212,26 @@ public class TzsTwoStaffingServiceImpl extends BaseService<TzsTwoStaffingDto, Tz
return
null
;
return
null
;
}
}
private
List
<
LinkedHashMap
>
treeToList
(
List
<
LinkedHashMap
>
result
,
List
<
LinkedHashMap
>
list
){
private
List
<
LinkedHashMap
<
String
,
Object
>>
tree2List
(
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
)
{
if
(!
ObjectUtils
.
isEmpty
(
list
)
&&
!
ObjectUtils
.
isEmpty
(
list
.
get
(
0
).
get
(
"children"
))){
List
<
LinkedHashMap
<
String
,
Object
>>
result
=
Lists
.
newArrayList
();
result
.
addAll
((
List
<
LinkedHashMap
>)
list
.
get
(
0
).
get
(
"children"
));
for
(
LinkedHashMap
<
String
,
Object
>
map
:
supervisionList
)
{
}
else
{
result
.
add
(
map
);
result
.
add
(
list
.
get
(
0
));
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
"children"
)))
{
}
List
<
LinkedHashMap
<
String
,
Object
>>
childrenList
=
tree2List
((
List
<
LinkedHashMap
<
String
,
Object
>>)
map
.
get
(
"children"
));
return
result
;
result
.
addAll
(
childrenList
);
}
}
}
if
(
result
.
size
()
>
0
)
{
for
(
LinkedHashMap
<
String
,
Object
>
map
:
result
)
{
map
.
put
(
"children"
,
null
);
}
}
return
result
;
}
@Override
@Override
public
Page
<
TzsTwoStaffingCompanyDto
>
getCompanyList
(
String
orgCode
,
TzsTwoStaffingCompanyDto
companyDto
,
Page
<
TzsTwoStaffingCompanyDto
>
page
)
{
public
Page
<
TzsTwoStaffingCompanyDto
>
getCompanyList
(
String
orgCode
,
TzsTwoStaffingCompanyDto
companyDto
,
Page
<
TzsTwoStaffingCompanyDto
>
page
)
{
Page
<
TzsTwoStaffingCompanyDto
>
companyList
=
tzsTwoStaffingMapper
.
getCompanyList
(
page
,
companyDto
,
orgCode
);
Page
<
TzsTwoStaffingCompanyDto
>
companyList
=
tzsTwoStaffingMapper
.
getCompanyList
(
page
,
companyDto
,
orgCode
);
if
(!
ObjectUtils
.
isEmpty
(
companyList
.
getRecords
())){
if
(!
ObjectUtils
.
isEmpty
(
companyList
.
getRecords
())){
...
...
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