Commit a64427a9 authored by chenhao's avatar chenhao

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents a90ab0b5 b7a284c3
...@@ -9,9 +9,11 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; ...@@ -9,9 +9,11 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
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.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyShiftMapper; import com.yeejoin.amos.boot.module.common.api.mapper.DutyShiftMapper;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.runtime.directive.Break;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -111,6 +113,9 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -111,6 +113,9 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
@Value("${mqtt.topic.command.power.deployment}") @Value("${mqtt.topic.command.power.deployment}")
private String topic; private String topic;
...@@ -299,8 +304,50 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -299,8 +304,50 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
} }
if (fireCarDto.getId() != null) { if (fireCarDto.getId() != null) {
try { List<Map<String,String>> resultList = new ArrayList<>();
int num;
String dutyDay = DateUtils.getDateNowShortStr();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
"dutyCar", fireCarDto.getId());
if (instanceMap != null){
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,
"dutyCar", instanceIds,dutyDetail.get("name").toString());
if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}
LinkedHashMap<String, String> infoMap_1 =new LinkedHashMap<String, String>();
for (Map<String, Object> specify : specifyDateList) {
//
if(specify.containsKey("userName")&& specify.get("userName")!=null ) {
if (specify.get("userName").toString().contains(",")){
String[] userNames = specify.get("userName").toString().split(",");
infoMap_1.put(dutyDetail.get("name").toString(),userNames.length+"");
}else {
infoMap_1.put(dutyDetail.get("name").toString(),"1");
}
resultList.add(infoMap_1);
}
}
}
}
}
}
int num = 0;
String todayTime = DateUtils.getDateNowShortStr(); String todayTime = DateUtils.getDateNowShortStr();
String beginDate = todayTime; String beginDate = todayTime;
beginDate = beginDate + " 00:00:00"; beginDate = beginDate + " 00:00:00";
...@@ -341,15 +388,19 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -341,15 +388,19 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
if (DateUtils.belongCalendar(DateUtils.getDateNow(),startDate,dateEnd)) { if (DateUtils.belongCalendar(DateUtils.getDateNow(),startDate,dateEnd)) {
dutyShiftName[0] = dutyShiftName[0].replace(" ", e.getName()); dutyShiftName[0] = dutyShiftName[0].replace(" ", e.getName());
} }
}); });
List<Map<String, Object>> list = iDutyCarService.list(null, beginDate, endDate); if (resultList != null ){
num = (int) list.stream().filter(e -> e.get("carId").equals(fireCarDto.getId()) && ((List<DutyPersonShiftDto>) e.get("dutyShift")).get(0).getShiftName().equals(dutyShiftName[0])).count(); resultList.forEach(e->{
if (e.containsKey( dutyShiftName[0])) {
String personNum = e.get(dutyShiftName[0]);
fireCarDto.setPersonCount(Integer.valueOf(personNum));
}
});
}else {
fireCarDto.setPersonCount(num); fireCarDto.setPersonCount(num);
} catch (ParseException e) {
e.printStackTrace();
} }
} }
fireCarDtoList.add(fireCarDto); fireCarDtoList.add(fireCarDto);
}); });
......
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