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
2358b46b
Commit
2358b46b
authored
Nov 03, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
两员配备-三项制度统计统计表数据
parent
ed09931b
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
389 additions
and
32 deletions
+389
-32
DateUtils.java
...ava/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
+1
-0
ThreeSystemsDto.java
...yeejoin/amos/boot/module/tcm/api/dto/ThreeSystemsDto.java
+13
-3
ThreeSystems.java
...yeejoin/amos/boot/module/tcm/api/entity/ThreeSystems.java
+3
-3
ThreeSystemsMapper.java
...n/amos/boot/module/tcm/api/mapper/ThreeSystemsMapper.java
+9
-0
TzsTwoStaffingMapper.java
...amos/boot/module/tcm/api/mapper/TzsTwoStaffingMapper.java
+1
-0
IThreeSystemsService.java
...mos/boot/module/tcm/api/service/IThreeSystemsService.java
+3
-0
ITzsTwoStaffingService.java
...s/boot/module/tcm/api/service/ITzsTwoStaffingService.java
+0
-1
ThreeSystemsMapper.xml
...-tcm-api/src/main/resources/mapper/ThreeSystemsMapper.xml
+97
-0
ThreeSystemsController.java
...oot/module/tcm/biz/controller/ThreeSystemsController.java
+9
-0
TzsTwoStaffingController.java
...t/module/tcm/biz/controller/TzsTwoStaffingController.java
+0
-8
ThreeSystemsServiceImpl.java
.../module/tcm/biz/service/impl/ThreeSystemsServiceImpl.java
+250
-8
TzsTwoStaffingServiceImpl.java
...odule/tcm/biz/service/impl/TzsTwoStaffingServiceImpl.java
+3
-9
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
View file @
2358b46b
...
...
@@ -17,6 +17,7 @@ public class DateUtils {
public
static
final
String
DATE_TIME_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
MINUTE_PATTERN
=
"yyyy-MM-dd HH:mm"
;
public
static
final
String
DATE_HOUR_PATTERN
=
"yyyy-MM-dd HH"
;
public
static
final
String
HOUR_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
DATE_PATTERN
=
"yyyy-MM-dd"
;
public
static
final
String
MONTH_PATTERN
=
"yyyy-MM"
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/dto/ThreeSystemsDto.java
View file @
2358b46b
...
...
@@ -26,12 +26,22 @@ public class ThreeSystemsDto extends BaseDto {
@ApiModelProperty
(
value
=
"监管单位名称"
)
private
String
supervisoryUnitName
;
@ApiModelProperty
(
value
=
"监管单位org
c
ode"
)
private
String
supervisoryUnitOrg
c
ode
;
@ApiModelProperty
(
value
=
"监管单位org
C
ode"
)
private
String
supervisoryUnitOrg
C
ode
;
@ApiModelProperty
(
value
=
"监管单位等级"
)
private
String
supervisoryUnitLevel
;
@ApiModelProperty
(
value
=
"使用单位类型"
)
private
String
unitType
;
@ApiModelProperty
(
value
=
"使用单位统一信用代码"
)
private
String
useCode
;
@ApiModelProperty
(
value
=
"检查状态"
)
private
String
checkStatus
;
@ApiModelProperty
(
value
=
"占比"
)
private
String
proportion
;
...
...
@@ -48,7 +58,7 @@ public class ThreeSystemsDto extends BaseDto {
private
String
planType
;
@ApiModelProperty
(
value
=
"统计日期"
)
private
Date
checkDate
;
private
String
checkDate
;
@ApiModelProperty
(
value
=
"统计开始日期"
)
private
Date
startDate
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/entity/ThreeSystems.java
View file @
2358b46b
...
...
@@ -39,8 +39,8 @@ public class ThreeSystems extends BaseEntity {
/**
* 监管单位orgcode
*/
@TableField
(
"supervisory_unit_orgcode"
)
private
String
supervisoryUnitOrg
c
ode
;
@TableField
(
"supervisory_unit_org
_
code"
)
private
String
supervisoryUnitOrg
C
ode
;
/**
* 监管单位等级
...
...
@@ -82,6 +82,6 @@ public class ThreeSystems extends BaseEntity {
* 统计日期
*/
@TableField
(
"check_date"
)
private
Date
checkDate
;
private
String
checkDate
;
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/mapper/ThreeSystemsMapper.java
View file @
2358b46b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.ThreeSystems
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* Mapper 接口
...
...
@@ -11,4 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public
interface
ThreeSystemsMapper
extends
BaseMapper
<
ThreeSystems
>
{
List
<
ThreeSystemsDto
>
getCompanyThreeSystemsStatisticsList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"startDay"
)
String
startDay
,
@Param
(
"endDay"
)
String
endDay
);
void
saveOrUpdateBatch
(
@Param
(
"resultList"
)
List
<
ThreeSystems
>
resultList
);
List
<
ThreeSystemsDto
>
getOldCompanyThreeSystemsStatisticsList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"lastStart"
)
String
lastStart
);
}
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 @
2358b46b
...
...
@@ -2,6 +2,7 @@ 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.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyCheckDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/service/IThreeSystemsService.java
View file @
2358b46b
...
...
@@ -15,4 +15,7 @@ import java.util.List;
public
interface
IThreeSystemsService
{
List
<
ThreeSystems
>
getStatisticsMessage
(
List
<
LinkedHashMap
>
list
,
String
planType
,
String
startDate
,
String
endDate
);
void
getThreeSystemsStatistics
(
String
type
);
}
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 @
2358b46b
...
...
@@ -25,6 +25,5 @@ public interface ITzsTwoStaffingService {
Page
<
TzsTwoStaffingCompanyCheckDto
>
getCompanyCheckList
(
String
orgCode
,
TzsTwoStaffingCompanyCheckDto
companyDto
,
Page
<
TzsTwoStaffingCompanyCheckDto
>
page
);
void
getThreeSystemsStatistics
();
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/ThreeSystemsMapper.xml
View file @
2358b46b
...
...
@@ -2,4 +2,101 @@
<!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.ThreeSystemsMapper"
>
<select
id=
"getCompanyThreeSystemsStatisticsList"
resultType=
"com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto"
>
SELECT
ei.use_code useCode,
ei.supervise_org_code supervisoryUnitOrgCode,
ei.unit_type unitType,
CASE
WHEN (
SELECT COUNT
( 1 )
FROM
amos_tzs_biz.p_plan_task pt
WHERE
pt.finish_status = '2'
AND ppt.use_code = pt.use_code
AND pt.check_date BETWEEN #{startDay}
AND #{endDay}
AND pt.plan_type = #{type}
) > 0 THEN
1 ELSE 0
END AS checkStatus
FROM
amos_tzs_biz.tz_base_enterprise_info ei
LEFT JOIN amos_tzs_biz.p_plan_task ppt ON ei.use_code = ppt.use_code
GROUP BY
ei.use_code
</select>
<select
id=
"saveOrUpdateBatch"
>
INSERT INTO "amos_tzs_biz"."tzs_three_systems" (
"sequence_nbr",
"rec_date",
"rec_user_id",
"rec_user_name",
"is_delete",
"supervisory_unit_id",
"supervisory_unit_name",
"supervisory_unit_org_code",
"supervisory_unit_level",
"proportion",
"registered_num",
"check_num",
"finish_check_num",
"plan_type",
"check_date"
)
VALUES
<foreach
collection=
"resultList"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.sequenceNbr},
#{item.recDate},
#{item.recUserId},
#{item.recUserName},
false,
#{item.supervisoryUnitId},
#{item.supervisoryUnitName},
#{item.supervisoryUnitOrgCode},
#{item.supervisoryUnitLevel},
#{item.proportion},
#{item.registeredNum},
#{item.checkNum},
#{item.finishCheckNum},
#{item.planType},
#{item.checkDate}
)
</foreach>
on conflict (supervisory_unit_org_code,plan_type,check_date) do update set
"sequence_nbr" = EXCLUDED."sequence_nbr",
"rec_date" = EXCLUDED."rec_date",
"rec_user_id" = EXCLUDED."rec_user_id",
"rec_user_name" = EXCLUDED."rec_user_name",
"is_delete" = EXCLUDED."is_delete",
"supervisory_unit_id" = EXCLUDED."supervisory_unit_id",
"supervisory_unit_name" = EXCLUDED."supervisory_unit_name",
"supervisory_unit_org_code" = EXCLUDED."supervisory_unit_org_code",
"supervisory_unit_level" = EXCLUDED."supervisory_unit_level",
"proportion" = EXCLUDED."proportion",
"registered_num" = EXCLUDED."registered_num",
"check_num" = EXCLUDED."check_num",
"finish_check_num" = EXCLUDED."finish_check_num",
"plan_type" = EXCLUDED."plan_type",
"check_date" = EXCLUDED."check_date"
</select>
<select
id=
"getOldCompanyThreeSystemsStatisticsList"
resultType=
"com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto"
>
SELECT
*
FROM
tzs_three_systems
WHERE
plan_type = #{type}
AND check_date = #{lastStart}
</select>
</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/ThreeSystemsController.java
View file @
2358b46b
...
...
@@ -49,4 +49,13 @@ public class ThreeSystemsController<string> extends BaseController {
return
ResponseHelper
.
buildResponse
(
threeSystemsPage
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/getThreeSystemsStatistics"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成三项制度统计"
,
notes
=
"生成三项制度统计"
)
public
ResponseModel
<
Object
>
getThreeSystemsStatistics
(
@RequestParam
(
value
=
"type"
)
String
type
)
{
iThreeSystemsService
.
getThreeSystemsStatistics
(
type
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
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 @
2358b46b
...
...
@@ -130,12 +130,4 @@ public class TzsTwoStaffingController extends BaseController {
return
ResponseHelper
.
buildResponse
(
tzsTwoStaffingService
.
getCompanyCheckList
(
orgCode
,
companyDto
,
page
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/getThreeSystemsStatistics"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成三项制度统计"
,
notes
=
"生成三项制度统计"
)
public
ResponseModel
<
Object
>
getThreeSystemsStatistics
()
{
tzsTwoStaffingService
.
getThreeSystemsStatistics
();
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
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/ThreeSystemsServiceImpl.java
View file @
2358b46b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.IdWorker
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.ThreeSystems
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.SupervisoryEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.ThreeSystemsMapper
;
import
com.yeejoin.amos.boot.module.tcm.api.service.IThreeSystemsService
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.typroject.tyboot.core.foundation.utils.DateUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.apache.commons.compress.utils.Lists
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
/**
* 服务实现类
...
...
@@ -26,7 +43,16 @@ import java.util.List;
* @date 2023-11-01
*/
@Service
public
class
ThreeSystemsServiceImpl
extends
BaseService
<
ThreeSystemsDto
,
ThreeSystems
,
ThreeSystemsMapper
>
implements
IThreeSystemsService
{
public
class
ThreeSystemsServiceImpl
extends
BaseService
<
ThreeSystemsDto
,
ThreeSystems
,
ThreeSystemsMapper
>
implements
IThreeSystemsService
{
@Autowired
AmosRequestContext
amosRequestContext
;
@Autowired
ThreeSystemsMapper
threeSystemsMapper
;
@Autowired
TzsTwoStaffingServiceImpl
tzsTwoStaffingService
;
/**
* 列表查询
...
...
@@ -47,7 +73,7 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto,ThreeSy
nextLevel
=
"organization"
;
}
LambdaQueryWrapper
<
ThreeSystems
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
like
(
ThreeSystems:
:
getSupervisoryUnitOrg
c
ode
,
orgCode
);
queryWrapper
.
like
(
ThreeSystems:
:
getSupervisoryUnitOrg
C
ode
,
orgCode
);
queryWrapper
.
eq
(
ThreeSystems:
:
getIsDelete
,
false
);
queryWrapper
.
eq
(
ThreeSystems:
:
getPlanType
,
planType
);
queryWrapper
.
between
(
ThreeSystems:
:
getCheckDate
,
ValidationUtil
.
isEmpty
(
startDate
)
?
new
Date
()
:
...
...
@@ -79,4 +105,219 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto,ThreeSy
}
return
Lists
.
newArrayList
();
}
@Override
public
void
getThreeSystemsStatistics
(
String
type
)
{
if
(
type
.
equals
(
"1"
))
{
createDayThreeSystemsStatistics
();
}
else
if
(
type
.
equals
(
"2"
))
{
createWeekThreeSystemsStatistics
();
}
else
if
(
type
.
equals
(
"3"
))
{
createMonthThreeSystemsStatistics
();
}
}
@Scheduled
(
cron
=
"0 0 2,13 * * ?"
)
@SchedulerLock
(
name
=
"createDayThreeSystemsStatistics"
,
lockAtMostFor
=
"PT1H"
)
public
void
createDayThreeSystemsStatistics
()
{
createThreeSystemsStatistics
(
1
,
false
);
}
@Scheduled
(
cron
=
"0 0 2,13 * * ?"
)
@SchedulerLock
(
name
=
"createWeekThreeSystemsStatistics"
,
lockAtMostFor
=
"PT1H"
)
public
void
createWeekThreeSystemsStatistics
()
{
Date
nowDay
=
new
Date
();
String
day
=
DateUtils
.
convertDateToString
(
nowDay
,
DateUtils
.
DATE_HOUR_PATTERN
);
Calendar
c
=
DateUtils
.
getCalendar
();
c
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
MONDAY
);
String
monday
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_HOUR_PATTERN
);
Boolean
flag
=
false
;
if
(
day
.
equals
(
monday
))
{
flag
=
true
;
}
createThreeSystemsStatistics
(
2
,
flag
);
}
@Scheduled
(
cron
=
"0 0 2,13 * * ?"
)
@SchedulerLock
(
name
=
"createMonthThreeSystemsStatistics"
,
lockAtMostFor
=
"PT1H"
)
public
void
createMonthThreeSystemsStatistics
()
{
Date
nowDay
=
new
Date
();
String
day
=
DateUtils
.
convertDateToString
(
nowDay
,
DateUtils
.
DATE_HOUR_PATTERN
);
String
monthday
=
DateUtils
.
convertDateToString
(
nowDay
,
DateUtils
.
MONTH_PATTERN
)
+
"-01 02"
;
Boolean
flag
=
false
;
if
(
day
.
equals
(
monthday
))
{
flag
=
true
;
}
createThreeSystemsStatistics
(
3
,
flag
);
}
private
void
createThreeSystemsStatistics
(
Integer
type
,
Boolean
isFirstDay
)
{
// 所有监管单位列表
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
=
tzsTwoStaffingService
.
getSupervisionList
();
List
<
ThreeSystems
>
resultList
=
new
ArrayList
<>();
String
start
=
" 00:00:00"
;
String
end
=
" 23:59:59"
;
Date
nowDay
=
new
Date
();
String
day
=
DateUtils
.
getDateNowShortStr
();
String
hour
=
DateUtils
.
convertDateToString
(
nowDay
,
DateUtils
.
DATE_HOUR_PATTERN
);
String
startDay
=
""
;
String
endDay
=
""
;
String
lastStart
=
""
;
String
lastEnd
=
""
;
// 所有企业排查情况列表(昨天/上周/上月)
List
<
ThreeSystemsDto
>
oldStaffingCompanyList
=
new
ArrayList
<>();
// 所有企业排查情况列表(今天/本周/本月)
List
<
ThreeSystemsDto
>
newStaffingCompanyList
=
new
ArrayList
<>();
if
(
1
==
type
)
{
startDay
=
day
+
start
;
endDay
=
day
+
end
;
if
(
hour
.
endsWith
(
"02"
))
{
LocalDate
today
=
LocalDate
.
now
();
// 获取昨天日期
LocalDate
yesterday
=
today
.
minusDays
(
1
);
lastStart
=
yesterday
+
start
;
lastEnd
=
yesterday
+
end
;
}
}
else
if
(
2
==
type
)
{
//获取当前周第一天:
Calendar
c
=
DateUtils
.
getCalendar
();
c
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
MONDAY
);
startDay
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
start
;
//获取当前周最后一天
c
.
add
(
Calendar
.
DAY_OF_WEEK
,
6
);
endDay
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
end
;
if
(
isFirstDay
)
{
//获取上前周第一天
c
.
add
(
Calendar
.
DAY_OF_WEEK
,
-
13
);
lastStart
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
start
;
//获取上前周最后一天
c
.
add
(
Calendar
.
DAY_OF_WEEK
,
6
);
lastEnd
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
end
;
}
}
else
{
//获取当前月第一天:
Calendar
c
=
DateUtils
.
getCalendar
();
c
.
add
(
Calendar
.
MONTH
,
0
);
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
//设置为1号,当前日期既为本月第一天
startDay
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
start
;
//获取当前月最后一天
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
c
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
endDay
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
end
;
if
(
isFirstDay
)
{
//获取上月第一天
c
.
add
(
Calendar
.
MONTH
,
-
1
);
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
//设置为1号,当前日期既为本月第一天
lastStart
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
start
;
//获取上月最后一天
c
.
set
(
Calendar
.
DAY_OF_MONTH
,
c
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
lastEnd
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
end
;
}
}
newStaffingCompanyList
=
threeSystemsMapper
.
getCompanyThreeSystemsStatisticsList
(
type
,
startDay
,
endDay
);
resultList
=
getThreeSystems
(
supervisionList
,
newStaffingCompanyList
,
type
,
startDay
,
true
);
threeSystemsMapper
.
saveOrUpdateBatch
(
resultList
);
List
<
ThreeSystems
>
oldList
;
if
(!
""
.
equals
(
lastStart
)
&&
!
""
.
equals
(
lastEnd
))
{
oldStaffingCompanyList
=
threeSystemsMapper
.
getOldCompanyThreeSystemsStatisticsList
(
type
,
DateUtils
.
dateToString
(
lastStart
));
List
<
ThreeSystemsDto
>
oldNewStaffingCompanyList
=
threeSystemsMapper
.
getCompanyThreeSystemsStatisticsList
(
type
,
lastStart
,
lastEnd
);
if
(!
ValidationUtil
.
isEmpty
(
oldNewStaffingCompanyList
))
{
oldList
=
ValidationUtil
.
isEmpty
(
oldStaffingCompanyList
)
?
getThreeSystems
(
supervisionList
,
oldNewStaffingCompanyList
,
type
,
lastStart
,
true
)
:
getThreeSystems
(
supervisionList
,
oldNewStaffingCompanyList
,
type
,
lastStart
,
false
);
if
(!
ValidationUtil
.
isEmpty
(
oldStaffingCompanyList
))
{
if
(!
ValidationUtil
.
isEmpty
(
oldList
))
{
for
(
ThreeSystems
e
:
oldList
)
{
ThreeSystemsDto
threeSystemsDto
=
oldStaffingCompanyList
.
stream
().
filter
(
i
->
i
.
getSupervisoryUnitOrgCode
().
equals
(
e
.
getSupervisoryUnitOrgCode
())
&&
i
.
getCheckDate
().
equals
(
e
.
getCheckDate
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
e
.
setSequenceNbr
(
threeSystemsDto
.
getSequenceNbr
());
}
}
}
threeSystemsMapper
.
saveOrUpdateBatch
(
oldList
);
}
}
}
private
List
<
ThreeSystems
>
getThreeSystems
(
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
,
List
<
ThreeSystemsDto
>
StaffingCompanyList
,
Integer
type
,
String
date
,
boolean
isNew
)
{
List
<
ThreeSystems
>
resultList
=
new
ArrayList
<>();
supervisionList
.
forEach
(
i
->
{
ThreeSystemsDto
nowDayThreeSystemsDto
=
new
ThreeSystemsDto
();
//对应orgCode下所有注册企业列表
List
<
ThreeSystemsDto
>
allUnit
=
StaffingCompanyList
.
stream
().
filter
(
ii
->
ii
.
getSupervisoryUnitOrgCode
().
startsWith
(
i
.
get
(
"orgCode"
).
toString
())).
collect
(
Collectors
.
toList
());
//对应注册企业下所有应排查的企业列表
List
<
ThreeSystemsDto
>
shouldCheckUnit
=
allUnit
.
stream
().
filter
(
ii
->
!(
ii
.
getUnitType
().
contains
(
"个人主体"
)
||
ii
.
getUnitType
().
equals
(
"检验检测机构"
))).
collect
(
Collectors
.
toList
());
//应排查的企业下已排查完成的企业列表
List
<
ThreeSystemsDto
>
checkCompleteUnit
=
shouldCheckUnit
.
stream
().
filter
(
ii
->
"1"
.
equals
(
ii
.
getCheckStatus
())).
collect
(
Collectors
.
toList
());
if
(
isNew
)
{
try
{
nowDayThreeSystemsDto
.
setSequenceNbr
(
IdWorker
.
getFlowIdWorkerInstance
().
nextId
());
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
nowDayThreeSystemsDto
.
setRecDate
(
new
Date
());
nowDayThreeSystemsDto
.
setRecUserId
(
amosRequestContext
.
getUserId
());
nowDayThreeSystemsDto
.
setRecUserName
(
amosRequestContext
.
getUserName
());
nowDayThreeSystemsDto
.
setIsDelete
(
false
);
nowDayThreeSystemsDto
.
setSupervisoryUnitId
(
i
.
get
(
"sequenceNbr"
).
toString
());
nowDayThreeSystemsDto
.
setSupervisoryUnitLevel
(
i
.
get
(
"level"
).
toString
());
nowDayThreeSystemsDto
.
setSupervisoryUnitName
(
i
.
get
(
"companyName"
).
toString
());
nowDayThreeSystemsDto
.
setRegisteredNum
(
allUnit
.
size
());
nowDayThreeSystemsDto
.
setCheckNum
(
shouldCheckUnit
.
size
());
nowDayThreeSystemsDto
.
setFinishCheckNum
(
checkCompleteUnit
.
size
());
nowDayThreeSystemsDto
.
setSupervisoryUnitOrgCode
(
i
.
get
(
"orgCode"
).
toString
());
nowDayThreeSystemsDto
.
setPlanType
(
1
==
type
?
"1"
:
2
==
type
?
"2"
:
"3"
);
nowDayThreeSystemsDto
.
setCheckDate
(
DateUtils
.
dateToString
(
date
));
if
(
shouldCheckUnit
.
size
()
==
0
)
{
nowDayThreeSystemsDto
.
setProportion
(
"0%"
);
}
else
{
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"0.##"
);
BigDecimal
result
=
new
BigDecimal
(
checkCompleteUnit
.
size
()).
divide
(
new
BigDecimal
(
shouldCheckUnit
.
size
()),
4
,
RoundingMode
.
HALF_UP
);
nowDayThreeSystemsDto
.
setProportion
(
decimalFormat
.
format
(
result
.
multiply
(
new
BigDecimal
(
100
)))
+
"%"
);
}
ThreeSystems
threeSystems
=
new
ThreeSystems
();
BeanUtils
.
copyProperties
(
nowDayThreeSystemsDto
,
threeSystems
);
resultList
.
add
(
threeSystems
);
});
return
resultList
;
}
}
\ No newline at end of file
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 @
2358b46b
...
...
@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
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.ThreeSystemsDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyCheckDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingCompanyDto
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto
;
...
...
@@ -27,10 +28,7 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -160,12 +158,8 @@ public class TzsTwoStaffingServiceImpl extends BaseService<TzsTwoStaffingDto, Tz
return
tzsTwoStaffingMapper
.
getCompanyCheckList
(
page
,
orgCode
,
companyDto
);
}
@Override
public
void
getThreeSystemsStatistics
()
{
}
p
rivate
List
<
LinkedHashMap
<
String
,
Object
>>
getSupervisionList
()
{
p
ublic
List
<
LinkedHashMap
<
String
,
Object
>>
getSupervisionList
()
{
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
redisUtils
.
get
(
BizCommonConstant
.
REGULATOR_UNIT_LIST
);
if
(
ValidationUtil
.
isEmpty
(
supervisionList
))
{
...
...
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