Commit bf981480 authored by chenhao's avatar chenhao

完成需求bug :4803

parent 98a03eff
......@@ -34,4 +34,6 @@ public interface IDutyCarService extends IDutyCommonService {
JSONObject isFireCarDriver();
int getDutyCarCount(Long carId);
List<Map<String, Object>> getDutyCaruser(Long carId);
List<Map<String, Object>> theCarDutyPerson(Long carId);
}
......@@ -178,4 +178,10 @@ public class DutyCarController extends BaseController {
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyCarService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("查询指定車輛值班人信息列表")
@GetMapping("/theCar/personList")
public ResponseModel<List<Map<String, Object>>> theCarDutyPerson(@RequestParam Long carId){
return ResponseHelper.buildResponse(iDutyCarService.theCarDutyPerson(carId));
}
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
DynamicFormInstanceServiceImpl dynamicFormInstanceService;
@Autowired
FirefightersMapper firefightersMapper;
FirefightersMapper firefightersMapper;
@Autowired
EquipFeignClient equipFeignClient;
......@@ -233,4 +233,22 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
return equipmentList;
}
@Override
public List<Map<String, Object>> theCarDutyPerson(Long carId) {
List<Map<String, Object>> specifyDateList =null;
String dutyDay = DateUtils.getDateNowShortStr();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
this.getGroupCode(), carId.toString());
if(instanceMap==null) {
return null;
}
String instanceId = instanceMap.get("instanceIds").toString();
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,null);
}
return specifyDateList;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataSourcesImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ExcelServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -26,9 +20,17 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataSourcesImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ExcelServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 导出导入
......@@ -67,7 +69,7 @@ public class ExcelController extends BaseController {
return ResponseHelper.buildResponse(null);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载模板")
@GetMapping("/download/template/{type}")
public void downloadTemplate(HttpServletResponse response, @PathVariable(value = "type") String type) {
......@@ -92,7 +94,7 @@ public class ExcelController extends BaseController {
* date 2021/9/13
* </PRE>
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出公用类")
@GetMapping("/export/{type}")
public void getFireStationFile(HttpServletResponse response, @PathVariable(value = "type") String type,
......
......@@ -303,13 +303,16 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
int num=0;
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(",");
num = num+ userNames.length;
infoMap_1.put(dutyDetail.get("name").toString(), userNames.length + "");
} else {
infoMap_1.put(dutyDetail.get("name").toString(), "1");
......@@ -317,65 +320,66 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
resultList.add(infoMap_1);
}
}
fireCarDto.setPersonCount(num);
}
}
}
}
int num = 0;
String todayTime = DateUtils.getDateNowShortStr();
String beginDate = todayTime;
beginDate = beginDate + " 00:00:00";
String endDate = todayTime;
endDate = endDate + " 23:59:59";
LambdaQueryWrapper<DutyShift> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false);
List<DutyShift> dutyShifts = dutyShiftMapper.selectList(wrapper);
String[] dutyShiftName = {" "};
dutyShifts.forEach(e -> {
String startTime = e.getStartTime();
Date startDate = null;
Date dateEnd = null;
if (startTime.startsWith("当日:")) {
String resultTime = startTime.replace("当日:", todayTime) + ":00";
startDate = DateUtils.longStr2Date(resultTime);
} else if (startTime.startsWith("次日:")) {
Date dateNow = DateUtils.getDateNow();
Date date = DateUtils.dateAddDays(dateNow, 1);
String s = DateUtils.convertDateToString(date, DateUtils.DATE_PATTERN);
String resultTime = startTime.replace("次日:", s) + ":00";
startDate = DateUtils.longStr2Date(resultTime);
}
String endTime = e.getEndTime();
if (endTime.startsWith("当日:")) {
String resultTime = endTime.replace("当日:", todayTime) + ":00";
dateEnd = DateUtils.longStr2Date(resultTime);
} else if (endTime.startsWith("次日:")) {
Date dateNow = DateUtils.getDateNow();
Date date = DateUtils.dateAddDays(dateNow, 1);
String s = DateUtils.convertDateToString(date, DateUtils.DATE_PATTERN);
String resultTime = endTime.replace("次日:", s) + ":00";
dateEnd = DateUtils.longStr2Date(resultTime);
}
if (DateUtils.belongCalendar(DateUtils.getDateNow(), startDate, dateEnd)) {
dutyShiftName[0] = dutyShiftName[0].replace(" ", e.getName());
}
});
if (resultList != null) {
resultList.forEach(e -> {
if (e.containsKey(dutyShiftName[0])) {
String personNum = e.get(dutyShiftName[0]);
fireCarDto.setPersonCount(Integer.valueOf(personNum));
}
});
} else {
fireCarDto.setPersonCount(num);
}
// int num = 0;
// String todayTime = DateUtils.getDateNowShortStr();
// String beginDate = todayTime;
// beginDate = beginDate + " 00:00:00";
// String endDate = todayTime;
// endDate = endDate + " 23:59:59";
// LambdaQueryWrapper<DutyShift> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(BaseEntity::getIsDelete, false);
// List<DutyShift> dutyShifts = dutyShiftMapper.selectList(wrapper);
//
// String[] dutyShiftName = {" "};
//
// dutyShifts.forEach(e -> {
// String startTime = e.getStartTime();
// Date startDate = null;
// Date dateEnd = null;
// if (startTime.startsWith("当日:")) {
// String resultTime = startTime.replace("当日:", todayTime) + ":00";
// startDate = DateUtils.longStr2Date(resultTime);
// } else if (startTime.startsWith("次日:")) {
// Date dateNow = DateUtils.getDateNow();
// Date date = DateUtils.dateAddDays(dateNow, 1);
// String s = DateUtils.convertDateToString(date, DateUtils.DATE_PATTERN);
// String resultTime = startTime.replace("次日:", s) + ":00";
// startDate = DateUtils.longStr2Date(resultTime);
// }
// String endTime = e.getEndTime();
// if (endTime.startsWith("当日:")) {
// String resultTime = endTime.replace("当日:", todayTime) + ":00";
// dateEnd = DateUtils.longStr2Date(resultTime);
// } else if (endTime.startsWith("次日:")) {
// Date dateNow = DateUtils.getDateNow();
// Date date = DateUtils.dateAddDays(dateNow, 1);
// String s = DateUtils.convertDateToString(date, DateUtils.DATE_PATTERN);
// String resultTime = endTime.replace("次日:", s) + ":00";
// dateEnd = DateUtils.longStr2Date(resultTime);
// }
//
// if (DateUtils.belongCalendar(DateUtils.getDateNow(), startDate, dateEnd)) {
// dutyShiftName[0] = dutyShiftName[0].replace(" ", e.getName());
// }
// });
//
// if (resultList != null) {
// resultList.forEach(e -> {
// if (e.containsKey(dutyShiftName[0])) {
// String personNum = e.get(dutyShiftName[0]);
// fireCarDto.setPersonCount(Integer.valueOf(personNum));
// }
// });
// } else {
// fireCarDto.setPersonCount(num);
// }
}
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