Commit 2ed750c3 authored by zhangsen's avatar zhangsen

运维概览运维人员列表 接口 重写

parent 62bed114
......@@ -142,6 +142,13 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
List<Map<String, Object>> getOrgPersonTelphone(List<Map<String, Object>> companyIds);
List<Map<String, Object>> personInfoList(String groupCode, HashSet<String> userIdSet);
/**
* 查询运维人员
* @param page
* @return
*/
Page<Map<String, Object>> getPersonInfoByPage(Page page, @Param("bizOrgCode") String bizOrgCode);
}
......@@ -32,7 +32,7 @@ public interface IDutyCommonService {
* @return
* @throws ParseException
*/
IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate) throws ParseException;
IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate, String bizOrgCode) throws ParseException;
/**
* 值班明细
......
......@@ -594,5 +594,33 @@ WHERE
GROUP BY
i.instance_id
</select>
<select id="getPersonInfoByPage" resultType="java.util.Map">
SELECT
ou.sequence_nbr as id,
ou.biz_org_name as userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IFNULL( MAX( CASE WHEN cfi.field_code = 'postTypeName' THEN field_value END ), '' ) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
HAVING
peopleType = 1602
</select>
</mapper>
package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -68,7 +71,12 @@ public class DutyPersonController extends BaseController {
beginDate = date;
endDate = date;
}
return ResponseHelper.buildResponse(iDutyPersonService.pageListDetail(current, size, beginDate, endDate));
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
return ResponseHelper.buildResponse(iDutyPersonService.pageListDetail(current, size, beginDate, endDate, bizOrgCode));
}
/**
......
......@@ -19,8 +19,10 @@ import java.util.stream.Stream;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.biz.enums.DataDictionaryTypeEnum;
import com.yeejoin.amos.boot.module.common.biz.enums.DynamicGroupCodeEnum;
import org.apache.commons.collections4.CollectionUtils;
......@@ -88,6 +90,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
@Autowired
IDataDictionaryService dataDictionaryService;
@Autowired
DynamicFormInstanceMapper dynamicFormInstanceMapper;
/**
* 每天单个班次执勤人数全部小于等于3人
......@@ -115,33 +119,34 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
@Override
public IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate)
public IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate, String bizOrgCode)
throws ParseException {
// 1.已column为准 进行返回
String groupCode = this.getGroupCode();
// 不存在值班数据则不查找 修改sql 方法去除 by kongfm 2021-09-14
IPage<Map<String, Object>> iPage = dynamicFormInstanceService.pageListNew(current, size, groupCode, beginDate, endDate);
List<Map<String, Object>> records = iPage.getRecords();
HashSet<String> userIdSet = new HashSet<>();
if (!CollectionUtils.isEmpty(records)) {
records.forEach(x -> {
userIdSet.add(x.get("userId").toString());
});
}
// 获取人员详细信息
List<Map<String, Object>> personInfoList = dynamicFormInstanceService.personInfoList(DynamicGroupCodeEnum.JCS_PERSON.getCode(), userIdSet);
if (!CollectionUtils.isEmpty(personInfoList)) {
Map<String, List<Map<String, Object>>> listMap = personInfoList.stream().collect(Collectors.groupingBy((Map m) -> String.valueOf(m.get("userId"))));
records.forEach(x -> {
String userId = x.get("userId").toString();
List<Map<String, Object>> list = listMap.get(userId);
if (!CollectionUtils.isEmpty(list)) {
list.forEach(x::putAll);
}
});
iPage.setRecords(records);
}
return iPage;
// // 1.已column为准 进行返回
// String groupCode = this.getGroupCode();
// // 不存在值班数据则不查找 修改sql 方法去除 by kongfm 2021-09-14
// IPage<Map<String, Object>> iPage = dynamicFormInstanceService.pageListNew(current, size, groupCode, beginDate, endDate);
// List<Map<String, Object>> records = iPage.getRecords();
// HashSet<String> userIdSet = new HashSet<>();
// if (!CollectionUtils.isEmpty(records)) {
// records.forEach(x -> {
// userIdSet.add(x.get("userId").toString());
// });
// }
// // 获取人员详细信息
// List<Map<String, Object>> personInfoList = dynamicFormInstanceService.personInfoList(DynamicGroupCodeEnum.JCS_PERSON.getCode(), userIdSet);
// if (!CollectionUtils.isEmpty(personInfoList)) {
// Map<String, List<Map<String, Object>>> listMap = personInfoList.stream().collect(Collectors.groupingBy((Map m) -> String.valueOf(m.get("userId"))));
// records.forEach(x -> {
// String userId = x.get("userId").toString();
// List<Map<String, Object>> list = listMap.get(userId);
// if (!CollectionUtils.isEmpty(list)) {
// list.forEach(x::putAll);
// }
// });
// iPage.setRecords(records);
// }
// return iPage;
return dynamicFormInstanceMapper.getPersonInfoByPage(new Page(current, size), bizOrgCode);
}
private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException {
......
......@@ -220,7 +220,10 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
equipment1.setImg("");
}
int savedEquipment = equipmentMapper.updateById(equipment1);
iEquipmentDetailService.update(new UpdateWrapper<EquipmentDetail>().eq("equipment_id", equipment1.getId()).set("name", equipment1.getName()));
iEquipmentDetailService.update(new UpdateWrapper<EquipmentDetail>().eq("equipment_id", equipment1.getId())
.set("name", equipment1.getName())
.set("expiry_date", equipment1.getExpiryDate())
.set("maintenance_cycle", equipment1.getMaintenanceCycle()));
JSONObject equipRuleParams = new JSONObject();
equipRuleParams.put("name", equipment1.getName());
equipRuleParams.put("inspectionSpecId", equipment1.getInspectionSpec());
......
......@@ -1828,8 +1828,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap();
equipSpecificScrap.forEach(e->{
try {
if(e.get("wesExpiry") != null) {
int year = Integer.parseInt(e.get("wesExpiry").toString());
if(e.get("weExpiry") != null) {
int year = Integer.parseInt(e.get("weExpiry").toString());
Date productDate = DateUtils.dateParse(e.get("product").toString(),"yyyy-MM-dd'T'HH:mm");
Calendar calendar = Calendar.getInstance();
calendar.setTime(productDate);
......@@ -1857,7 +1857,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
model.setTitle("报废到期提醒");
String equipName = map.get("name").toString();
String location = map.get("sname").toString() + map.get("position").toString() ;
String location = map.get("position").toString() + map.get("area").toString();
String body = String.format("%s-%s于%s报废,请提前更换处理", equipName, location, scrapTime);
String join = String.format("设备还剩%s天报废,请提前更换", i);
......
......@@ -2003,7 +2003,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public List<Map<String, Object>> getEquipExpiryStatistics(String bizOrgCode, Integer expiryDayNum) {
List<Map<String, Object>> equipExpiryStatistics = fireFightingSystemMapper.getEquipExpiryStatistics(bizOrgCode, expiryDayNum);
equipExpiryStatistics.stream().forEach(item -> {
equipExpiryStatistics.forEach(item -> {
item.put("value", Integer.parseInt(item.get("value").toString()));
});
return equipExpiryStatistics;
......
......@@ -472,7 +472,8 @@
wes.position,
wes.name,
we.expiry_date as weExpiry,
wed.expiry_date as wesExpiry,
<!-- wed.expiry_date as wesExpiry,-->
wed.area as area,
wed.production_date as product
from wl_equipment_specific wes
left join wl_equipment_detail wed on wes.equipment_detail_id = wed.id
......
......@@ -5065,10 +5065,10 @@
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND sd.`status` != 7
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) a
GROUP BY
......@@ -5094,10 +5094,10 @@
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND sd.`status` != 7
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
ORDER BY DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) ASC
</select>
......@@ -5143,7 +5143,7 @@
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND sd.`status` != 7
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND 0 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
......@@ -5161,10 +5161,10 @@
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND sd.`status` != 7
AND ( (sd.`status` != 7) or (sd.`status` is null) or (sd.`status` = ''))
AND e.expiry_date IS NOT NULL
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0
<!-- AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0-->
AND 60 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) AS countNum
</select>
......
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