Commit b2bc73c6 authored by chenhao's avatar chenhao

提交开发车辆和微型消防站排班的月视图借口

parent 1bcfacc5
...@@ -72,4 +72,60 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> { ...@@ -72,4 +72,60 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
@Param("beginDate") String beginDate, @Param("beginDate") String beginDate,
@Param("endDate") String endDate @Param("endDate") String endDate
); );
/**
* 获取指定日期下的当前排班的人员列表
* eg : {"name":"夜班","value":"李某某、张作霖、张作相"}
* @param dutyDate
* @param groupCode
* @param targetFiled
* @return
*/
List<Map<String, Object>> getSpecifyDateList(String dutyDate,String groupCode,String[] instanceIds,String params);
/**
* 获取指定日期下的装备ID、eg:车辆、微型消防站
* @param dutyDate
* @param groupCode
* @param targetFiled
* @return
*/
List<Map<String, Object>> getEquipmentForSpecifyDate(String dutyDate,String groupCode,String equipmentId,String equipmentName,String teamName,String groupByName);
/**
* 通过装备ID查询指定如期下的该装备所包含的InstanceId
* @param dutyDate
* @param groupCode
* @param targetId eg: carId
* @return
*/
Map<String, Object> getInstanceIdForSpecifyDateAndEquipment(String dutyDate,String groupCode,String targetId);
/**
* 获取指定日期装备的操作人员,例如车辆的驾驶员
* @param dutyDate
* @param groupCode
* @param instanceIds
* @param operator
* @return
*/
Map<String, Object> getEquipmentOperator(String dutyDate,String groupCode,String[] instanceIds,String operator,String duty);
/**
* 获取指定日期下的排班人员与岗位等信息
* @param dutyDate
* @param groupCode
* @param instanceIds
* @return
*/
List<Map<String, Object>> getPositionStaffDutyForSpecifyDate(String dutyDate,String groupCode,String[] instanceIds,String duty);
/**
* 获取指定日期下的班次信息
* @param duty
* @return
*/
List<Map<String, Object>> getDutyForSpecifyDate(String duty);
} }
...@@ -29,4 +29,6 @@ public interface IDutyCarService extends IDutyCommonService { ...@@ -29,4 +29,6 @@ public interface IDutyCarService extends IDutyCommonService {
* @return * @return
*/ */
JSONObject isFireCarDriver(); JSONObject isFireCarDriver();
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType);
} }
...@@ -17,4 +17,6 @@ public interface IDutyFireFightingService extends IDutyCommonService { ...@@ -17,4 +17,6 @@ public interface IDutyFireFightingService extends IDutyCommonService {
* @return List<DutyCarDto> * @return List<DutyCarDto>
*/ */
DutyFireFightingDto update(Long instanceId, DutyFireFightingDto dto); DutyFireFightingDto update(Long instanceId, DutyFireFightingDto dto);
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType);
} }
<?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.common.api.mapper.DutyPersonShiftMapper"> <mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper">
<select id="calMaxPersonAndShiftNum" resultType="java.util.Map"> <select id="calMaxPersonAndShiftNum" resultType="java.util.Map">
select select
(select (select
...@@ -17,8 +18,10 @@ ...@@ -17,8 +18,10 @@
and s.instance_id = i.instance_id and s.instance_id = i.instance_id
AND i.field_code = 'userId' AND i.field_code = 'userId'
and s.duty_date >= #{beginDate} and s.duty_date >= #{beginDate}
and s.duty_date <![CDATA[<=]]> #{endDate} and s.duty_date <![CDATA[<=]]>
AND s.shift_id is not null <!--// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。 同步修改 查询 导出相关逻辑 by kongfm 2021-09-14--> #{endDate}
AND s.shift_id is not null <!--// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。
同步修改 查询 导出相关逻辑 by kongfm 2021-09-14 -->
and s.app_Key = #{appKey} and s.app_Key = #{appKey}
GROUP BY s.duty_date,s.shift_id <!--增添分组条件 根据班次分组技术 --> GROUP BY s.duty_date,s.shift_id <!--增添分组条件 根据班次分组技术 -->
) a) as maxDutyPersonNumDay, ) a) as maxDutyPersonNumDay,
...@@ -36,7 +39,8 @@ ...@@ -36,7 +39,8 @@
and s.instance_id = i.instance_id and s.instance_id = i.instance_id
AND i.field_code = 'userId' AND i.field_code = 'userId'
and s.duty_date >= #{beginDate} and s.duty_date >= #{beginDate}
and s.duty_date <![CDATA[<=]]> #{endDate} and s.duty_date <![CDATA[<=]]>
#{endDate}
and s.app_Key = #{appKey} and s.app_Key = #{appKey}
GROUP BY s.duty_date) b) as maxShiftNumDay GROUP BY s.duty_date) b) as maxShiftNumDay
</select> </select>
...@@ -91,6 +95,217 @@ ...@@ -91,6 +95,217 @@
mysql.help_topic, mysql.help_topic,
( SELECT @s := 0 ) temp ( SELECT @s := 0 ) temp
WHERE WHERE
@s <![CDATA[<=]]> DATEDIFF(#{endDate},#{beginDate}) @s <![CDATA[<=]]>
DATEDIFF(#{endDate},#{beginDate})
</select> </select>
<select id='getSpecifyDateList' resultType='map'>
SELECT
GROUP_CONCAT(cd.field_value) AS
value
,
cds.name
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.field_code = 'userName'
<if test="params != null and params!='' ">
and cd.field_value !='消防车驾驶员'
</if>
AND cd.instance_id IN
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
#{instanceId}
</foreach>
GROUP BY
cds.`name`
</select>
<select id='getEquipmentForSpecifyDate' resultType='map'>
select * from (
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = #{equipmentId} THEN
cd.FIELD_VALUE
END
) AS #{equipmentId},
MAX(
CASE
WHEN cd.FIELD_CODE = #{equipmentName} THEN
cd.FIELD_VALUE
END
) AS #{equipmentName},
MAX(
CASE
WHEN cd.FIELD_CODE = #{teamName} THEN
cd.FIELD_VALUE
END
) AS #{teamName}
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate} and dp.is_delete=0
) cds ON cd.instance_id = cds.instance_id
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result group by ${groupByName}
</select>
<select id='getInstanceIdForSpecifyDateAndEquipment'
resultType='map'>
SELECT
GROUP_CONCAT(cd.instance_id) as instanceIds
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.field_value = #{targetId}
</select>
<select id='getEquipmentOperator' resultType='map'>
SELECT
result.userName
FROM
(
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
cds. NAME
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.instance_id IN
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
#{instanceId}
</foreach>
) result
WHERE
result.postTypeName = #{operator} and result.name =#{duty}
</select>
<select id ='getPositionStaffDutyForSpecifyDate' resultType="map">
SELECT
GROUP_CONCAT(ss.userName) AS userName,
ss.postTypeName
FROM
(
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
cd.instance_id
FROM
cb_dynamic_form_instance cd
WHERE
cd.instance_id in
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
#{instanceId}
</foreach>
AND cd.group_code = #{groupCode}
AND cd.is_delete = 0
GROUP BY
cd.instance_id
) ss
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
) cds ON ss.instance_id = cds.instance_id
WHERE
cds.NAME =#{duty}
GROUP BY
ss.postTypeName
</select>
<select id='getDutyForSpecifyDate' resultType="map">
SELECT
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
GROUP BY
NAME
</select>
</mapper> </mapper>
...@@ -152,7 +152,7 @@ public class DutyCarController extends BaseController { ...@@ -152,7 +152,7 @@ public class DutyCarController extends BaseController {
public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay, public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId, @ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){ @ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyCarService.dayDutyPersonList(dutyDay,shiftId,postType)); return ResponseHelper.buildResponse(iDutyCarService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
} }
} }
\ No newline at end of file
...@@ -155,6 +155,6 @@ public class DutyFireFightingController extends BaseController{ ...@@ -155,6 +155,6 @@ public class DutyFireFightingController extends BaseController{
public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay, public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId, @ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){ @ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyFireFightingService.dayDutyPersonList(dutyDay,shiftId,postType)); return ResponseHelper.buildResponse(iDutyFireFightingService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
} }
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -18,14 +19,14 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -18,14 +19,14 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; 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.dto.DutyCarDto;
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.entity.DynamicFormColumn; 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.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters; import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService; import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
...@@ -49,6 +50,9 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -49,6 +50,9 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
@Autowired @Autowired
EquipFeignClient equipFeign; EquipFeignClient equipFeign;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
@Override @Override
public String getGroupCode() { public String getGroupCode() {
return "dutyCar"; return "dutyCar";
...@@ -57,8 +61,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -57,8 +61,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
@Override @Override
public DutyCarDto save(DutyCarDto dutyCarDto) { public DutyCarDto save(DutyCarDto dutyCarDto) {
// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。 同步修改 查询 导出相关逻辑 by kongfm 2021-09-14 // BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。 同步修改 查询 导出相关逻辑 by kongfm 2021-09-14
//1.保存行数据 // 1.保存行数据
if(StringUtils.isNotEmpty(dutyCarDto.getDutyAreaId())) { if (StringUtils.isNotEmpty(dutyCarDto.getDutyAreaId())) {
// 根据建筑id 查找建筑 // 根据建筑id 查找建筑
ResponseModel<Map<String, Object>> response = null; ResponseModel<Map<String, Object>> response = null;
try { try {
...@@ -72,11 +76,11 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -72,11 +76,11 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
Map<String, Object> map = Bean.BeantoMap(dutyCarDto); Map<String, Object> map = Bean.BeantoMap(dutyCarDto);
// 修改操作动态表单的方法,修改人陈浩 -------------start 2021-09-28 // 修改操作动态表单的方法,修改人陈浩 -------------start 2021-09-28
Long instanceId =excuteDynamicFormInstance(dutyCarDto.getUserId(),map,this.getGroupCode()); Long instanceId = excuteDynamicFormInstance(dutyCarDto.getUserId(), map, this.getGroupCode());
saveDutyPersonShiftDetail( instanceId ,dutyCarDto.getDutyShift() ,dutyCarDto.getStartTime()) ; saveDutyPersonShiftDetail(instanceId, dutyCarDto.getDutyShift(), dutyCarDto.getStartTime());
insertPersonShift(instanceId, dutyCarDto.getDutyShift()); insertPersonShift(instanceId, dutyCarDto.getDutyShift());
// 修改操作动态表单的方法,修改人陈浩 -------------end 2021-09-28 // 修改操作动态表单的方法,修改人陈浩 -------------end 2021-09-28
//3.返回保存后的数据 // 3.返回保存后的数据
return dutyCarDto; return dutyCarDto;
} }
...@@ -84,16 +88,16 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -84,16 +88,16 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
@Override @Override
public DutyCarDto update(Long instanceId, DutyCarDto dutyCarDto) { public DutyCarDto update(Long instanceId, DutyCarDto dutyCarDto) {
//修改操作动态表单修改的逻辑方法,陈浩 start ----2021-09-28 // 修改操作动态表单修改的逻辑方法,陈浩 start ----2021-09-28
updateDynamicFormInstance(this.getGroupCode(),instanceId,Bean.BeantoMap(dutyCarDto)); updateDynamicFormInstance(this.getGroupCode(), instanceId, Bean.BeantoMap(dutyCarDto));
//修改操作动态表单修改的逻辑方法,陈浩 end ----2021-09-28 // 修改操作动态表单修改的逻辑方法,陈浩 end ----2021-09-28
//5.更新值班信息人日期数据 // 5.更新值班信息人日期数据
insertPersonShift(instanceId, dutyCarDto.getDutyShift()); insertPersonShift(instanceId, dutyCarDto.getDutyShift());
return dutyCarDto; return dutyCarDto;
} }
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column,
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column, DynamicFormInstance formInstance) { DynamicFormInstance formInstance) {
fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId()); fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId());
} }
...@@ -106,9 +110,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -106,9 +110,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
String loginUserId = RequestContext.getExeUserId(); String loginUserId = RequestContext.getExeUserId();
// 根据登陆人id查询对应消防人员 // 根据登陆人id查询对应消防人员
Firefighters firefighters = Firefighters firefighters = firefightersMapper
firefightersMapper.selectOne(new LambdaQueryWrapper<Firefighters>().eq(Firefighters::getSystemAccount, .selectOne(new LambdaQueryWrapper<Firefighters>().eq(Firefighters::getSystemAccount, loginUserId));
loginUserId));
if (ValidationUtil.isEmpty(firefighters)) { if (ValidationUtil.isEmpty(firefighters)) {
return result; return result;
} }
...@@ -135,10 +138,88 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa ...@@ -135,10 +138,88 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
result.put("isDriver", true); result.put("isDriver", true);
result.put("carId", personList.get(0).get("carId")); result.put("carId", personList.get(0).get("carId"));
ResponseModel<Map<String, Object>> resultModel = ResponseModel<Map<String, Object>> resultModel = equipFeignClient
equipFeignClient.queryCarSimpleInfoById((Long) personList.get(0).get("carId")); .queryCarSimpleInfoById((Long) personList.get(0).get("carId"));
Map<String, Object> carInfo = resultModel.getResult(); Map<String, Object> carInfo = resultModel.getResult();
result.put("carStatus", carInfo.get("carStatus")); result.put("carStatus", carInfo.get("carStatus"));
return result; return result;
} }
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "carId", "carName", "teamName","result.carId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
return null;
}
List<Object> detailList = new ArrayList<Object>();
for (Map<String, Object> map : equipmentList) {
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
LinkedHashMap<String, Object> titleMap_1 =new LinkedHashMap<String, Object>();
titleMap_1.put("消防车辆", map.get("carName").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 =new LinkedHashMap<String, Object>();
titleMap_2.put("单位/部门", map.get("teamName").toString());
resultList.add(titleMap_2);
String carId =map.get("carId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
this.getGroupCode(), carId);
if(instanceMap==null) {
continue;
}
String instanceId = instanceMap.get("instanceIds").toString();
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
if(dutyList!=null && dutyList.size()>0) {
for (Map<String, Object> dutyDetail : dutyList) {
if(!dutyDetail.containsKey("name")) {
continue;
}
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,dutyDetail.get("name").toString());
if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}
LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
infoMap_1.put(dutyDetail.get("name").toString(), "");
resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
// 获取当前装备ID下的排版数据
// List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getSpecifyDateList(dutyDay,
// this.getGroupCode(), instanceIds,null);
// for (Map<String, Object> specify : specifyDateList) {
//
// if(!specify.containsKey("name") || specify.get("name").toString()==null) {
// continue;
// }
// LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
// infoMap_1.put(specify.get("name").toString(), "");
// resultList.add(infoMap_1);
// Map<String, Object> equipmentOperatorMap = dutyPersonShiftMapper.getEquipmentOperator(dutyDay,
// this.getGroupCode(), instanceIds, "消防车驾驶员", specify.get("name").toString());
// String operator =null;
// if (equipmentOperatorMap!=null && equipmentOperatorMap.containsKey("userName")) {
// operator = equipmentOperatorMap.get("equipmentOperatorMap").toString();
// }
// LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
// infoMap_2.put("驾驶员", operator!=null?operator:"");
// resultList.add(infoMap_2);
// LinkedHashMap<String, Object> infoMap_3 =new LinkedHashMap<String, Object>();
// infoMap_3.put("战斗员",specify.get("value").toString());
// resultList.add(infoMap_3);
// }
}
detailList.add(resultList);
}
return detailList;
}
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -9,13 +13,22 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -9,13 +13,22 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto; import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService; import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
@Service @Service
public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implements IDutyFireFightingService { public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implements IDutyFireFightingService {
@Autowired @Autowired
FireStationServiceImpl fireStationServiceImpl; FireStationServiceImpl fireStationServiceImpl;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
public String getGroupCode() {
return "dutyFireFighting";
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DutyFireFightingDto save(DutyFireFightingDto dto) { public DutyFireFightingDto save(DutyFireFightingDto dto) {
...@@ -32,13 +45,61 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement ...@@ -32,13 +45,61 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
@Override @Override
public DutyFireFightingDto update(Long instanceId, DutyFireFightingDto dto) { public DutyFireFightingDto update(Long instanceId, DutyFireFightingDto dto) {
updateDynamicFormInstance(this.getGroupCode(),instanceId,Bean.BeantoMap(dto)); updateDynamicFormInstance(this.getGroupCode(), instanceId, Bean.BeantoMap(dto));
insertPersonShift(instanceId, dto.getDutyShift()); insertPersonShift(instanceId, dto.getDutyShift());
return dto; return dto;
} }
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "fireFightingId", "fireFighting", "teamName","result.fireFightingId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
return null;
}
List<Object> detailList = new ArrayList<Object>();
for (Map<String, Object> map : equipmentList) {
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
LinkedHashMap<String, Object> titleMap_1 =new LinkedHashMap<String, Object>();
titleMap_1.put("微型消防站", map.get("fireFighting").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 =new LinkedHashMap<String, Object>();
titleMap_2.put("单位/部门", map.get("teamName").toString());
resultList.add(titleMap_2);
String carId =map.get("fireFightingId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
this.getGroupCode(), carId);
if(instanceMap==null) {
continue;
}
String instanceId = instanceMap.get("instanceIds").toString();
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
public String getGroupCode() { List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
return "dutyFireFighting"; if(dutyList!=null && dutyList.size()>0) {
for (Map<String, Object> dutyDetail : dutyList) {
if(!dutyDetail.containsKey("name")) {
continue;
}
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,dutyDetail.get("name").toString());
if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}
LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
infoMap_1.put(dutyDetail.get("name").toString(), "");
resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
}
detailList.add(resultList);
}
return detailList;
} }
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import java.util.ArrayList;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import java.util.Calendar;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto; import java.util.Date;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto; import java.util.HashMap;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift; import java.util.LinkedHashMap;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift; import java.util.List;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn; import java.util.Map;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import java.util.Set;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,13 +19,15 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -20,13 +19,15 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList; import com.alibaba.fastjson.JSONArray;
import java.util.Calendar; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.Date; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import java.util.List; import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import java.util.Map; import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import java.util.Set; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import java.util.stream.Collectors; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
/** /**
* @author DELL * @author DELL
...@@ -37,6 +38,7 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut ...@@ -37,6 +38,7 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
@Autowired @Autowired
EquipFeignClient equipFeign; EquipFeignClient equipFeign;
@Override @Override
public String getGroupCode(){ public String getGroupCode(){
return "dutyPerson"; return "dutyPerson";
...@@ -234,4 +236,98 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut ...@@ -234,4 +236,98 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
}); });
return temp; return temp;
} }
public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType) {
List<Map<String, Object>> list = dayDutyPersonList(dutyDay, shiftId, postType);
list.stream().forEach(i->{
List<Object> fieldsList= new ArrayList<Object>();
List<Object>infoList= new ArrayList<Object>();
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
map.put("name", "微型消防站");
map.put("value",i.get("deptName").toString());
map.put("id","1");
fieldsList.add(map);
map.clear();
map.put("name", "微型消防站");
map.put("value",i.get("deptName").toString());
});
return postType;
}
public static void main(String[] args) {
String ssString="[{\"teamName\":\"发士大夫大师傅\",\"shiftId\":\"1437585222345547778\",\"carName\":\"特种消防车(46586458)\",\"postType\":\"\",\"dutyArea\":\"测试控制室\",\"dutyAreaId\":\"1382166994773610497\",\"postTypeName\":\"\",\"userName\":\"故障报修\",\"userId\":\"1428653787706347522\",\"dutyDate\":\"2021-10-12 00:00:00\",\"carId\":\"1432590747256770562\",\"shiftName\":\"晚班\",\"instanceId\":\"1447490875843239937\",\"teamId\":\"1404995716634050561\",\"groupCode\":\"dutyCar\"},{\"teamName\":\"发士大夫大师傅\",\"shiftId\":\"1432883228491972609\",\"carName\":\"特种消防车(46586458)\",\"postType\":\"\",\"dutyArea\":\"消防小室-shg\",\"dutyAreaId\":\"1382530839199387650\",\"postTypeName\":\"\",\"userName\":\"78678676\",\"userId\":\"1435886728803000322\",\"dutyDate\":\"2021-10-12 00:00:00\",\"carId\":\"1432590747256770562\",\"shiftName\":\"夜班\",\"instanceId\":\"1447490812534415361\",\"teamId\":\"1404995716634050561\",\"groupCode\":\"dutyCar\"},{\"teamName\":\"发士大夫大师傅\",\"shiftId\":\"1432883228491972609\",\"carName\":\"特种消防车(46586458)\",\"postType\":\"1\",\"dutyArea\":\"建构住-shg\",\"dutyAreaId\":\"1382157469081407490\",\"postTypeName\":\"指挥员\",\"userName\":\"张小四6\",\"userId\":\"1435072204550225922\",\"dutyDate\":\"2021-10-12 00:00:00\",\"carId\":\"1432590747256770562\",\"shiftName\":\"夜班\",\"instanceId\":\"1447490699435008001\",\"teamId\":\"1404995716634050561\",\"groupCode\":\"dutyCar\"}]\r\n"
+ "";
List<Map> jjList= JSONArray.parseArray(ssString, Map.class);
Map< String, String> map20 = new HashMap<String, String>();
jjList.forEach(i->{
List<Object> fieldsList= new ArrayList<Object>();
List<Object>infoList= new ArrayList<Object>();
Map<String, String> map = new HashMap<String, String>();
map.put("name", "微型消防站");
map.put("value",i.get("carName").toString());
map.put("id","1");
fieldsList.add(map);
Map<String, String> map1 = new HashMap<String, String>();
map1.put("name", "微型消防站");
map1.put("value",i.get("teamName").toString());
map1.put("id","2");
fieldsList.add(map1);
if(!map20.containsKey(i.get("shiftName").toString())) {
map20.put(ssString, ssString);
}
System.out.println("ssssssssss");
});
}
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift; import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyShiftMapper; import com.yeejoin.amos.boot.module.common.api.mapper.DutyShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyShiftService; import com.yeejoin.amos.boot.module.common.api.service.IDutyShiftService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/** /**
* 值班班次服务实现类 * 值班班次服务实现类
...@@ -35,4 +36,5 @@ public class DutyShiftServiceImpl extends BaseService<DutyShiftDto, DutyShift, D ...@@ -35,4 +36,5 @@ public class DutyShiftServiceImpl extends BaseService<DutyShiftDto, DutyShift, D
public List<DutyShiftDto> queryForDutyShiftList(Boolean isDelete) { public List<DutyShiftDto> queryForDutyShiftList(Boolean isDelete) {
return this.queryForList("", false, isDelete); return this.queryForList("", false, isDelete);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment