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
019f4245
Commit
019f4245
authored
Jul 08, 2021
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.值班车辆
parent
254abd42
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
617 additions
and
223 deletions
+617
-223
DutyPersonShiftDto.java
...n/amos/boot/module/common/api/dto/DutyPersonShiftDto.java
+3
-0
DutyPersonShift.java
...n/amos/boot/module/common/api/entity/DutyPersonShift.java
+5
-0
DutyViewTypeEnum.java
...n/amos/boot/module/common/api/enums/DutyViewTypeEnum.java
+34
-0
DutyPersonShiftMapper.java
.../boot/module/common/api/mapper/DutyPersonShiftMapper.java
+67
-6
DynamicFormInstanceMapper.java
...t/module/common/api/mapper/DynamicFormInstanceMapper.java
+23
-11
DutyPersonShiftMapper.xml
...n-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
+81
-1
DynamicFormInstanceMapper.xml
...i/src/main/resources/mapper/DynamicFormInstanceMapper.xml
+37
-1
DutyCarController.java
.../boot/module/common/biz/controller/DutyCarController.java
+29
-26
DutyPersonController.java
...ot/module/common/biz/controller/DutyPersonController.java
+31
-12
IDutyCarService.java
.../amos/boot/module/common/biz/service/IDutyCarService.java
+1
-41
IDutyCommonService.java
...os/boot/module/common/biz/service/IDutyCommonService.java
+46
-0
IDutyPersonService.java
...os/boot/module/common/biz/service/IDutyPersonService.java
+10
-32
DutyCarServiceImpl.java
...ot/module/common/biz/service/impl/DutyCarServiceImpl.java
+13
-58
DutyCommonServiceImpl.java
...module/common/biz/service/impl/DutyCommonServiceImpl.java
+133
-0
DutyPersonServiceImpl.java
...module/common/biz/service/impl/DutyPersonServiceImpl.java
+81
-14
DutyPersonShiftServiceImpl.java
...e/common/biz/service/impl/DutyPersonShiftServiceImpl.java
+23
-21
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/DutyPersonShiftDto.java
View file @
019f4245
...
...
@@ -36,4 +36,7 @@ public class DutyPersonShiftDto extends BaseDto {
@ApiModelProperty
(
value
=
"班次名称"
)
private
String
shiftName
;
@ApiModelProperty
(
value
=
"应用标识(数据隔离使用)"
)
private
String
appKey
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/DutyPersonShift.java
View file @
019f4245
...
...
@@ -46,6 +46,11 @@ public class DutyPersonShift extends BaseEntity {
@TableField
(
"rec_user_name"
)
private
String
recUserName
;
/**
* 应用标识(数据隔离使用)
*/
private
String
appKey
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/enums/DutyViewTypeEnum.java
0 → 100644
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
enums
;
/**
* @author DELL
*/
public
enum
DutyViewTypeEnum
{
BANK
(
"jcs"
,
"银行视图"
),
STATION
(
"station"
,
"换流站视图"
);
private
String
code
;
private
String
name
;
DutyViewTypeEnum
(
String
code
,
String
name
){
this
.
code
=
code
;
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/DutyPersonShiftMapper.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 值班人员日期关联关系表 Mapper 接口
*
* @author system_generator
* @date 2021-07-06
*/
* 值班人员日期关联关系表 Mapper 接口
*
* @author system_generator
* @date 2021-07-06
*/
public
interface
DutyPersonShiftMapper
extends
BaseMapper
<
DutyPersonShift
>
{
/**
* 计算班次最大执勤人数,时间区间内
* 计算天的最大班次数量,时间区间内
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @param appKey 应用标识
* @param groupCode 分组标识
* @return Map
*/
Map
<
String
,
Long
>
calMaxPersonAndShiftNum
(
@Param
(
"beginDate"
)
String
beginDate
,
@Param
(
"endDate"
)
String
endDate
,
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"groupCode"
)
String
groupCode
);
/**
* 银行日历视图
*
* @param dutyDate 日期
* @param appKey 应用标识
* @param groupCode 分组标识
* @return List<Map < String, Object>>
*/
List
<
Map
<
String
,
Object
>>
bankViewData
(
@Param
(
"dutyDate"
)
String
dutyDate
,
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"groupCode"
)
String
groupCode
);
/**
* 换流站日历视图
*
* @param dutyDate 日期
* @param appKey 应用标识
* @param groupCode 分组标识
* @return List<Map < String, Object>>
*/
List
<
Map
<
String
,
Object
>>
stationViewData
(
@Param
(
"dutyDate"
)
String
dutyDate
,
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"groupCode"
)
String
groupCode
);
/**
* 利用mysql 生成连续时间区间
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return List<Map < String, Object>>
*/
List
<
Map
<
String
,
Object
>>
genRangeDate
(
@Param
(
"beginDate"
)
String
beginDate
,
@Param
(
"endDate"
)
String
endDate
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/DynamicFormInstanceMapper.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* 动态表单实例表 Mapper 接口
*
* @author system_generator
* @date 2021-07-06
*/
* 动态表单实例表 Mapper 接口
*
* @author system_generator
* @date 2021-07-06
*/
public
interface
DynamicFormInstanceMapper
extends
BaseMapper
<
DynamicFormInstance
>
{
public
List
<
DynamicFormInstanceDto
>
selectListByCalledId
(
Long
id
);
public
List
<
DynamicFormInstanceDto
>
selectListByCalledId
(
Long
id
);
/**
* 列转行查询
*
* @param appKey 应用标识
* @param appKey
应用标识
* @param fieldCodes 列
* @param groupCode 分组code
* @param groupCode
分组code
* @return List<Map>
*/
List
<
Map
<
String
,
Object
>>
listAll
(
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"fieldCodes"
)
Map
<
String
,
Object
>
fieldCodes
,
@Param
(
"groupCode"
)
String
groupCode
);
/**
* 分页查询
*
* @param page 分页信息
* @param appKey 应用
* @param fieldCodes 字段
* @param groupCode 表单类型
* @return IPage<Map<String, Object>>
*/
IPage
<
Map
<
String
,
Object
>>
pageList
(
Page
page
,
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"fieldCodes"
)
Map
<
String
,
Object
>
fieldCodes
,
@Param
(
"groupCode"
)
String
groupCode
,
@Param
(
"params"
)
Map
<
String
,
String
>
params
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
View file @
019f4245
<?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">
<mapper
namespace=
"com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper"
>
<select
id=
"calMaxPersonAndShiftNum"
resultType=
"java.util.Map"
>
select
(select
IFNULL(max(num),0)
from
(SELECT
ifnull(count(1),0) num
FROM
cb_duty_person_shift s,
cb_duty_shift ds,
cb_dynamic_form_instance i
WHERE
ds.sequence_nbr = s.shift_id
and s.instance_id = i.instance_id
AND i.field_code = 'userId'
and s.duty_date >= #{beginDate}
and s.duty_date
<![CDATA[<=]]>
#{endDate}
and s.app_Key = #{appKey}
GROUP BY s.duty_date
) a) as maxDutyPersonNumDay,
(select
IFNULL(max(num),0)
from
(SELECT
ifnull(count(DISTINCT(s.shift_id)),0) num
FROM
cb_duty_person_shift s,
cb_duty_shift ds,
cb_dynamic_form_instance i
WHERE
ds.sequence_nbr = s.shift_id
and s.instance_id = i.instance_id
AND i.field_code = 'userId'
and s.duty_date >= #{beginDate}
and s.duty_date
<![CDATA[<=]]>
#{endDate}
and s.app_Key = #{appKey}
GROUP BY s.duty_date) b) as maxShiftNumDay
</select>
<select
id=
"bankViewData"
resultType=
"java.util.Map"
>
SELECT
ds.`name` as shiftName,
GROUP_CONCAT(i.field_value) AS userName
FROM
cb_duty_person_shift s,
cb_duty_shift ds,
cb_dynamic_form_instance i
WHERE
s.instance_id = i.instance_id
AND ds.sequence_nbr = s.shift_id
AND i.field_code = 'userName'
AND s.duty_date = #{dutyDate}
AND s.app_key = #{appKey}
and i.group_code =#{groupCode}
GROUP BY
ds.NAME
</select>
<select
id=
"stationViewData"
resultType=
"java.util.Map"
>
select
i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
and i.field_code = 'postTypeName'
AND s.duty_date = #{dutyDate}
AND s.app_key = #{appKey}
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select
id=
"genRangeDate"
resultType=
"map"
>
SELECT
DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY ) ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 0 ) temp
WHERE
@s
<![CDATA[<=]]>
DATEDIFF(#{endDate},#{beginDate})
</select>
</mapper>
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/DynamicFormInstanceMapper.xml
View file @
019f4245
...
...
@@ -36,9 +36,45 @@
from
cb_dynamic_form_instance i
where i.GROUP_CODE = #{groupCode}
and APP_KEY = #{appKey}
and
i.
APP_KEY = #{appKey}
GROUP by
i.INSTANCE_ID)d
order by instanceId desc
</select>
<select
id=
"pageList"
resultType=
"java.util.Map"
>
select
d.*
from
(
select
i.INSTANCE_ID instanceId,
i.GROUP_CODE groupCode,
<foreach
collection=
"fieldCodes"
item=
"value"
index=
"key"
separator=
","
>
MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as ${key}
</foreach>
from
cb_dynamic_form_instance i
where
i.GROUP_CODE = #{groupCode}
<if
test=
"appKey != null and appKey !=''"
>
and i.APP_KEY = #{appKey}
</if>
GROUP by
i.INSTANCE_ID)d
<if
test=
"params != null and params.size() > 0"
>
where
1=1
<foreach
collection=
"params"
index=
"key"
item=
"value"
separator=
""
>
<choose>
<when
test=
"fieldCodes[key] == 'like' and value !=null and value !=''"
>
and d.${key} like concat('%',#{value},'%')
</when>
<when
test=
"fieldCodes[key] == 'eq' and value !=null and value !=''"
>
and d.${key} = #{value}
</when>
</choose>
</foreach>
</if>
order by instanceId desc
</select>
</mapper>
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/DutyCarController.java
View file @
019f4245
...
...
@@ -15,7 +15,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -42,11 +41,13 @@ public class DutyCarController extends BaseController {
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page-list"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班列表视图
"
,
notes
=
"值班列表视图
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班列表视图
-分页"
,
notes
=
"值班列表视图-分页
"
)
public
ResponseModel
<
IPage
<
Map
<
String
,
Object
>>>
pageList
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
,
@ApiParam
(
value
=
"当前页"
,
required
=
true
)
@RequestParam
(
value
=
"current"
)
int
current
,
@ApiParam
(
value
=
"页面大小"
,
required
=
true
)
@RequestParam
(
value
=
"size"
)
int
size
)
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
pageList
(
current
,
size
));
@ApiParam
(
value
=
"页面大小"
,
required
=
true
)
@RequestParam
(
value
=
"size"
)
int
size
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
pageList
(
current
,
size
,
beginDate
,
endDate
));
}
/**
...
...
@@ -57,8 +58,9 @@ public class DutyCarController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/list"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班列表视图"
,
notes
=
"值班列表视图"
)
public
ResponseModel
list
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
Date
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
Date
endDate
)
throws
ParseException
{
public
ResponseModel
list
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
list
(
beginDate
,
endDate
));
}
...
...
@@ -68,14 +70,14 @@ public class DutyCarController extends BaseController {
*
* @return ResponseModel
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
"/statistics-day"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班月视图"
,
notes
=
"值班月视图"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
dutyDetail
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
Date
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
Date
endDate
)
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
dutyDetail
(
beginDate
,
endDate
));
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
statisticsDay
(
beginDate
,
endDate
));
}
/**
...
...
@@ -83,25 +85,26 @@ public class DutyCarController extends BaseController {
*
* @return ResponseModel
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
"/duty-adjust"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"调班保存"
,
notes
=
"调班保存"
)
public
ResponseModel
dutyAdjustSave
(
@RequestBody
DutyCarDto
dutyCarDto
)
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
save
(
dutyCarDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
"/duty-adjust"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"调班保存"
,
notes
=
"调班保存"
)
public
ResponseModel
dutyAdjustSave
(
@RequestBody
DutyCarDto
dutyCarDto
)
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
save
(
dutyCarDto
));
}
/**
* 调班
* 调班
*
* @param instanceId 实例id
* @param dutyCarDto 业务对象
* @return DutyCarDto
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PutMapping
(
"/duty-adjust"
)
@ApiOperation
(
httpMethod
=
"POS
T"
,
value
=
"调班更新"
,
notes
=
"调班更新"
)
public
ResponseModel
dutyAdjustUpdate
(
@RequestParam
Long
instanceId
,
@RequestBody
DutyCarDto
dutyCarDto
)
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
update
(
instanceId
,
dutyCarDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
"/duty-adjust"
)
@ApiOperation
(
httpMethod
=
"PU
T"
,
value
=
"调班更新"
,
notes
=
"调班更新"
)
public
ResponseModel
dutyAdjustUpdate
(
@RequestParam
Long
instanceId
,
@RequestBody
DutyCarDto
dutyCarDto
)
{
return
ResponseHelper
.
buildResponse
(
iDutyCarService
.
update
(
instanceId
,
dutyCarDto
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/DutyPersonController.java
View file @
019f4245
...
...
@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto
;
import
com.yeejoin.amos.boot.module.common.biz.service.IDutyPersonService
;
import
io.swagger.annotations.Api
;
...
...
@@ -15,7 +14,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.
util.Date
;
import
java.
text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -44,9 +43,11 @@ public class DutyPersonController extends BaseController {
@GetMapping
(
value
=
"/page-list"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班列表视图"
,
notes
=
"值班列表视图"
)
public
ResponseModel
<
IPage
<
Map
<
String
,
Object
>>>
pageList
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
,
@ApiParam
(
value
=
"当前页"
,
required
=
true
)
@RequestParam
(
value
=
"current"
)
int
current
,
@ApiParam
(
value
=
"页面大小"
,
required
=
true
)
@RequestParam
(
value
=
"size"
)
int
size
)
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
pageList
(
current
,
size
));
@ApiParam
(
value
=
"页面大小"
,
required
=
true
)
@RequestParam
(
value
=
"size"
)
int
size
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
pageList
(
current
,
size
,
beginDate
,
endDate
));
}
/**
...
...
@@ -57,8 +58,8 @@ public class DutyPersonController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/list"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班列表视图"
,
notes
=
"值班列表视图"
)
public
ResponseModel
<
List
<
Map
>>
list
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
Date
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
Date
endDate
)
{
public
ResponseModel
list
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
list
(
beginDate
,
endDate
));
}
...
...
@@ -68,25 +69,43 @@ public class DutyPersonController extends BaseController {
*
* @return ResponseModel
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
"/duty-detail"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"值班月视图"
,
notes
=
"值班月视图"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
dutyDetail
(
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
Date
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
Date
endDate
)
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
dutyDetail
(
beginDate
,
endDate
));
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
statisticsDay
(
beginDate
,
endDate
));
}
/**
* 调班
*
* @return ResponseModel
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
"/duty-adjust"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"调班保存"
,
notes
=
"调班保存"
)
public
ResponseModel
dutyAdjust
(
@RequestBody
DutyPersonDto
dutyPersonDto
)
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
save
(
dutyPersonDto
));
}
/**
* 调班
*
* @param instanceId 实例id
* @param dutyPersonDto 业务对象
* @return DutyCarDto
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
"/duty-adjust"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"调班更新"
,
notes
=
"调班更新"
)
public
ResponseModel
dutyAdjustUpdate
(
@RequestParam
Long
instanceId
,
@RequestBody
DutyPersonDto
dutyPersonDto
)
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
update
(
instanceId
,
dutyPersonDto
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/IDutyCarService.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author DELL
*/
public
interface
IDutyCarService
{
/**
* 分页查询
*
* @param current 当前页
* @param size 页大小
* @return ResponseModel
*/
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
);
/**
* 值班明细
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return ResponseModel
*/
List
<
Map
<
String
,
Object
>>
dutyDetail
(
Date
beginDate
,
Date
endDate
);
/**
* 不分页查询
*
* @param dutyType 表单类型
* @return ResponseModel
*/
List
<
Map
>
list
(
String
dutyType
);
/**
* 不分页查询
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return ResponseModel
*/
List
<
Map
<
String
,
Object
>>
list
(
Date
beginDate
,
Date
endDate
)
throws
ParseException
;
public
interface
IDutyCarService
extends
IDutyCommonService
{
/**
* 值班信息保存
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/IDutyCommonService.java
0 → 100644
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author DELL
*/
public
interface
IDutyCommonService
{
/**
* 分页查询
* @param current 当前页
* @param size 页大小
* @param beginDate 开始日期
* @param endDate 结束日期
* @return IPage<Map<String, Object>>
*/
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
,
String
beginDate
,
String
endDate
)
throws
ParseException
;
/**
* 值班明细
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return ResponseModel
*/
List
<
Map
<
String
,
Object
>>
statisticsDay
(
String
beginDate
,
String
endDate
)
throws
ParseException
;
/**
* 不分页查询
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return ResponseModel
*/
List
<
Map
<
String
,
Object
>>
list
(
String
beginDate
,
String
endDate
)
throws
ParseException
;
/**
* 获取表单参数
* @return String
*/
String
getGroupCode
();
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/IDutyPersonService.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author DELL
*/
public
interface
IDutyPersonService
{
/**
* 分页查询
*
* @param current 当前页
* @param size 页大小
* @return ResponseModel
*/
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
);
public
interface
IDutyPersonService
extends
IDutyCommonService
{
/**
*
值班明细
*
保存
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return ResponseModel
* @param dutyPersonDto 业务对象
* @return List<DutyPersonDto>
*/
List
<
Map
<
String
,
Object
>>
dutyDetail
(
Date
beginDate
,
Date
endDate
);
DutyPersonDto
save
(
DutyPersonDto
dutyPersonDto
);
/**
* 不分页查询
*
* @param beginDate 开始日期
* @param endDate 结束日期
* @return ResponseModel
*/
List
<
Map
>
list
(
Date
beginDate
,
Date
endDate
);
/**
*
保存
*
更新
*
* @param dutyCarDto 业务对象
* @return List<DutyPersonDto>
* @param instanceId 实例id
* @param dutyPersonDto 业务对象
* @return List<DutyCarDto>
*/
List
<
DutyPersonDto
>
save
(
DutyPersonDto
dutyCar
Dto
);
DutyPersonDto
update
(
Long
instanceId
,
DutyPersonDto
dutyPerson
Dto
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyCarServiceImpl.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance
;
import
com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper
;
import
com.yeejoin.amos.boot.module.common.biz.service.IDutyCarService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -27,63 +21,18 @@ import java.util.stream.Collectors;
* @author DELL
*/
@Service
public
class
DutyCarServiceImpl
implements
IDutyCarService
{
@Autowired
DynamicFormColumnServiceImpl
dynamicFormColumnService
;
@Autowired
DynamicFormInstanceServiceImpl
dynamicFormInstanceService
;
@Autowired
DutyPersonShiftServiceImpl
dutyPersonShiftService
;
@Autowired
Sequence
sequence
;
@Autowired
DynamicFormInstanceMapper
dynamicFormInstanceMapper
;
private
final
String
GROUP_CODE
=
"dutyCar"
;
@Override
public
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
)
{
return
null
;
}
public
class
DutyCarServiceImpl
extends
DutyCommonServiceImpl
implements
IDutyCarService
{
@Override
public
List
<
Map
<
String
,
Object
>>
dutyDetail
(
Date
beginDate
,
Date
endDate
)
{
return
null
;
}
@Override
public
List
<
Map
>
list
(
String
dutyType
)
{
return
null
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
list
(
Date
beginDate
,
Date
endDate
)
throws
ParseException
{
//1.已column为准 进行返回
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
GROUP_CODE
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
List
<
Map
<
String
,
Object
>>
list
=
dynamicFormInstanceMapper
.
listAll
(
RequestContext
.
getAppKey
(),
fieldCodes
,
GROUP_CODE
);
//2.组织值班数据
for
(
Map
<
String
,
Object
>
map
:
list
)
{
String
instanceId
=
map
.
get
(
"instanceId"
).
toString
();
List
<
DutyPersonShift
>
personShiftList
=
dutyPersonShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyPersonShift
>()
.
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
)
.
ge
(
beginDate
!=
null
,
DutyPersonShift:
:
getDutyDate
,
DateUtils
.
dateFormat
(
beginDate
,
DateUtils
.
DATE_PATTERN
))
.
le
(
endDate
!=
null
,
DutyPersonShift:
:
getDutyDate
,
DateUtils
.
dateFormat
(
endDate
,
DateUtils
.
DATE_PATTERN
)));
map
.
put
(
"dutyShift"
,
personShiftList
);
}
return
list
;
public
String
getGroupCode
()
{
return
"dutyCar"
;
}
@Override
public
DutyCarDto
save
(
DutyCarDto
dutyCarDto
)
{
//1.保存行数据
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
GROUP_CODE
));
String
groupCode
=
this
.
getGroupCode
();
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
dutyCarDto
);
Long
instanceId
=
sequence
.
nextId
();
List
<
DynamicFormInstance
>
instances
=
columns
.
stream
().
map
(
column
->
{
...
...
@@ -102,15 +51,17 @@ public class DutyCarServiceImpl implements IDutyCarService {
@Override
public
DutyCarDto
update
(
Long
instanceId
,
DutyCarDto
dutyCarDto
)
{
String
groupCode
=
this
.
getGroupCode
();
//1.查询已有数据
List
<
DynamicFormInstance
>
instances
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
//2.list 转 map
Map
<
Object
,
DynamicFormInstance
>
instanceMap
=
Bean
.
listToMap
(
instances
,
"fieldCode"
,
DynamicFormInstance
.
class
);
//3.查询列数据,已列为主
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
GROUP_CODE
));
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
//页面数据转Map
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
dutyCarDto
);
//4.已列为主 填充动态表单数据
List
<
DynamicFormInstance
>
entrys
=
new
ArrayList
<>();
for
(
DynamicFormColumn
column
:
columns
)
{
DynamicFormInstance
formInstance
=
instanceMap
.
get
(
column
.
getFieldCode
());
if
(!
ObjectUtils
.
isEmpty
(
formInstance
))
{
...
...
@@ -121,6 +72,10 @@ public class DutyCarServiceImpl implements IDutyCarService {
formInstance
=
new
DynamicFormInstance
();
buildFormInstanceData
(
instanceId
,
map
,
column
,
formInstance
);
}
entrys
.
add
(
formInstance
);
}
if
(!
entrys
.
isEmpty
()){
dynamicFormInstanceService
.
saveOrUpdateBatch
(
entrys
);
}
//5.更新值班信息人日期数据
insertPersonShift
(
instanceId
,
dutyCarDto
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyCommonServiceImpl.java
0 → 100644
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn
;
import
com.yeejoin.amos.boot.module.common.api.enums.DutyViewTypeEnum
;
import
com.yeejoin.amos.boot.module.common.biz.service.IDutyCommonService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author DELL
*/
@Service
public
class
DutyCommonServiceImpl
implements
IDutyCommonService
{
@Autowired
DynamicFormColumnServiceImpl
dynamicFormColumnService
;
@Autowired
DynamicFormInstanceServiceImpl
dynamicFormInstanceService
;
@Autowired
DutyPersonShiftServiceImpl
dutyPersonShiftService
;
@Autowired
Sequence
sequence
;
/**
* 每天单个班次执勤人数全部小于等于3人
*/
final
int
LIMIT_PERSON_NUMBER
=
3
;
/**
* 班次小于等于2
*/
final
int
LIMIT_SHIFT_NUMBER
=
2
;
@Override
public
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
,
String
beginDate
,
String
endDate
)
throws
ParseException
{
//1.已column为准 进行返回
String
groupCode
=
this
.
getGroupCode
();
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
Page
page
=
new
Page
(
current
,
size
);
IPage
<
Map
<
String
,
Object
>>
iPage
=
dynamicFormInstanceService
.
getBaseMapper
().
pageList
(
page
,
RequestContext
.
getAppKey
(),
fieldCodes
,
groupCode
,
null
);
for
(
Map
<
String
,
Object
>
m
:
iPage
.
getRecords
())
{
this
.
fillDutyShiftData
(
beginDate
,
endDate
,
m
);
}
return
iPage
;
}
private
void
fillDutyShiftData
(
String
beginDate
,
String
endDate
,
Map
<
String
,
Object
>
m
)
throws
ParseException
{
String
instanceId
=
m
.
get
(
"instanceId"
).
toString
();
List
<
DutyPersonShift
>
personShiftList
=
dutyPersonShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyPersonShift
>()
.
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
)
.
ge
(
beginDate
!=
null
,
DutyPersonShift:
:
getDutyDate
,
beginDate
)
.
le
(
endDate
!=
null
,
DutyPersonShift:
:
getDutyDate
,
endDate
));
m
.
put
(
"dutyShift"
,
personShiftList
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
statisticsDay
(
String
beginDate
,
String
endDate
)
throws
ParseException
{
DutyViewTypeEnum
viewTypeEnum
=
this
.
inferView
(
beginDate
,
endDate
,
RequestContext
.
getAppKey
());
List
<
Map
<
String
,
Object
>>
rangeDate
=
dutyPersonShiftService
.
getBaseMapper
().
genRangeDate
(
beginDate
,
endDate
);
return
rangeDate
.
stream
().
map
(
p
->
{
Map
<
String
,
Object
>
result
=
new
LinkedHashMap
<>();
result
.
put
(
"key"
,
p
.
get
(
"date"
));
result
.
put
(
"data"
,
this
.
buildViewData
(
viewTypeEnum
,
p
.
get
(
"date"
).
toString
(),
RequestContext
.
getAppKey
()));
return
result
;
}).
collect
(
Collectors
.
toList
());
}
private
Object
buildViewData
(
DutyViewTypeEnum
viewTypeEnum
,
String
dutyDate
,
String
appKey
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
switch
(
viewTypeEnum
)
{
case
BANK:
result
=
dutyPersonShiftService
.
getBaseMapper
().
bankViewData
(
dutyDate
,
appKey
,
this
.
getGroupCode
());
break
;
case
STATION:
result
=
dutyPersonShiftService
.
getBaseMapper
().
stationViewData
(
dutyDate
,
appKey
,
this
.
getGroupCode
());
break
;
default
:
break
;
}
return
result
;
}
private
DutyViewTypeEnum
inferView
(
String
beginDate
,
String
endDate
,
String
appKey
)
{
Map
<
String
,
Long
>
result
=
dutyPersonShiftService
.
getBaseMapper
().
calMaxPersonAndShiftNum
(
beginDate
,
endDate
,
appKey
,
this
.
getGroupCode
());
//计算班次最大执勤人数,时间区间内
Long
maxDutyPersonNumDay
=
result
.
get
(
"maxDutyPersonNumDay"
);
//计算天的最大班次数量,时间区间内
Long
maxShiftNumDay
=
result
.
get
(
"maxShiftNumDay"
);
if
(
maxDutyPersonNumDay
<=
LIMIT_PERSON_NUMBER
&&
maxShiftNumDay
<=
LIMIT_SHIFT_NUMBER
)
{
return
DutyViewTypeEnum
.
BANK
;
}
else
{
return
DutyViewTypeEnum
.
STATION
;
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
list
(
String
beginDate
,
String
endDate
)
throws
ParseException
{
//1.已column为准 进行返回
String
groupCode
=
this
.
getGroupCode
();
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
List
<
Map
<
String
,
Object
>>
list
=
dynamicFormInstanceService
.
getBaseMapper
().
listAll
(
RequestContext
.
getAppKey
(),
fieldCodes
,
groupCode
);
//2.组织值班数据
for
(
Map
<
String
,
Object
>
map
:
list
)
{
this
.
fillDutyShiftData
(
beginDate
,
endDate
,
map
);
}
return
list
;
}
@Override
public
String
getGroupCode
()
{
return
null
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyPersonServiceImpl.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.
metadata.IPage
;
import
com.baomidou.mybatisplus.core.
conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance
;
import
com.yeejoin.amos.boot.module.common.biz.service.IDutyPersonService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
java.util.
Date
;
import
java.util.
ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
* @author DELL
*/
@Service
public
class
DutyPersonServiceImpl
implements
IDutyPersonService
{
public
class
DutyPersonServiceImpl
extends
DutyCommonServiceImpl
implements
IDutyPersonService
{
@Override
public
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
)
{
return
null
;
public
String
getGroupCode
()
{
return
"dutyPerson"
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
dutyDetail
(
Date
beginDate
,
Date
endDate
)
{
return
null
;
public
DutyPersonDto
save
(
DutyPersonDto
dutyCarDto
)
{
//1.保存行数据
String
groupCode
=
this
.
getGroupCode
();
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
dutyCarDto
);
Long
instanceId
=
sequence
.
nextId
();
List
<
DynamicFormInstance
>
instances
=
columns
.
stream
().
map
(
column
->
{
DynamicFormInstance
instance
=
new
DynamicFormInstance
();
buildFormInstanceData
(
instanceId
,
map
,
column
,
instance
);
return
instance
;
}).
collect
(
Collectors
.
toList
());
if
(!
instances
.
isEmpty
())
{
dynamicFormInstanceService
.
saveBatch
(
instances
);
}
//2.保存值班信息
insertPersonShift
(
instanceId
,
dutyCarDto
);
//3.返回保存后的数据
return
dutyCarDto
;
}
@Override
public
List
<
Map
>
list
(
Date
beginDate
,
Date
endDate
)
{
return
null
;
public
DutyPersonDto
update
(
Long
instanceId
,
DutyPersonDto
dutyPersonDto
)
{
String
groupCode
=
this
.
getGroupCode
();
//1.查询已有数据
List
<
DynamicFormInstance
>
instances
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
//2.list 转 map
Map
<
Object
,
DynamicFormInstance
>
instanceMap
=
Bean
.
listToMap
(
instances
,
"fieldCode"
,
DynamicFormInstance
.
class
);
//3.查询列数据,已列为主
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
//页面数据转Map
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
dutyPersonDto
);
//4.已列为主 填充动态表单数据
List
<
DynamicFormInstance
>
entrys
=
new
ArrayList
<>();
for
(
DynamicFormColumn
column
:
columns
)
{
DynamicFormInstance
formInstance
=
instanceMap
.
get
(
column
.
getFieldCode
());
if
(!
ObjectUtils
.
isEmpty
(
formInstance
))
{
//有的更新
formInstance
.
setFieldValue
(
map
.
get
(
column
.
getFieldCode
())
!=
null
?
map
.
get
(
column
.
getFieldCode
()).
toString
()
:
""
);
}
else
{
//没有的新增
formInstance
=
new
DynamicFormInstance
();
buildFormInstanceData
(
instanceId
,
map
,
column
,
formInstance
);
}
entrys
.
add
(
formInstance
);
}
if
(!
entrys
.
isEmpty
()){
dynamicFormInstanceService
.
saveOrUpdateBatch
(
entrys
);
}
//5.更新值班信息人日期数据
insertPersonShift
(
instanceId
,
dutyPersonDto
);
return
dutyPersonDto
;
}
@Override
public
List
<
DutyPersonDto
>
save
(
DutyPersonDto
dutyCarDto
)
{
return
null
;
private
void
insertPersonShift
(
Long
instanceId
,
DutyPersonDto
dutyPersonDto
)
{
Set
<
DutyPersonShift
>
personShiftList
=
dutyPersonDto
.
getDutyShift
().
stream
().
map
(
dto
->
{
DutyPersonShift
dutyPersonShift
=
new
DutyPersonShift
();
dto
.
setInstanceId
(
instanceId
);
Bean
.
copyExistPropertis
(
dto
,
dutyPersonShift
);
return
dutyPersonShift
;
}).
collect
(
Collectors
.
toSet
());
if
(!
personShiftList
.
isEmpty
())
{
dutyPersonShiftService
.
saveOrUpdateBatch
(
personShiftList
);
}
}
private
void
buildFormInstanceData
(
Long
instanceId
,
Map
<
String
,
Object
>
map
,
DynamicFormColumn
column
,
DynamicFormInstance
formInstance
)
{
Bean
.
copyExistPropertis
(
column
,
formInstance
);
formInstance
.
setAppKey
(
RequestContext
.
getAppKey
());
formInstance
.
setInstanceId
(
instanceId
);
formInstance
.
setSequenceNbr
(
sequence
.
nextId
());
formInstance
.
setFormColumnId
(
column
.
getSequenceNbr
());
formInstance
.
setFieldValue
(
map
.
get
(
column
.
getFieldCode
())
!=
null
?
map
.
get
(
column
.
getFieldCode
()).
toString
()
:
""
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyPersonShiftServiceImpl.java
View file @
019f4245
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.IDutyPersonShiftService
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.util.List
;
/**
* 值班人员日期关联关系表服务实现类
*
* @author system_generator
* @date 2021-07-06
*/
* 值班人员日期关联关系表服务实现类
*
* @author system_generator
* @date 2021-07-06
*/
@Service
public
class
DutyPersonShiftServiceImpl
extends
BaseService
<
DutyPersonShiftDto
,
DutyPersonShift
,
DutyPersonShiftMapper
>
implements
IDutyPersonShiftService
{
/**
* 分页查询
*/
public
Page
<
DutyPersonShiftDto
>
queryForDutyPersonShiftPage
(
Page
<
DutyPersonShiftDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
public
class
DutyPersonShiftServiceImpl
extends
BaseService
<
DutyPersonShiftDto
,
DutyPersonShift
,
DutyPersonShiftMapper
>
implements
IDutyPersonShiftService
{
/**
* 分页查询
*/
public
Page
<
DutyPersonShiftDto
>
queryForDutyPersonShiftPage
(
Page
<
DutyPersonShiftDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
DutyPersonShiftDto
>
queryForDutyPersonShiftList
()
{
return
this
.
queryForList
(
""
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
DutyPersonShiftDto
>
queryForDutyPersonShiftList
()
{
return
this
.
queryForList
(
""
,
false
);
}
}
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