Commit e9a2d03e authored by chenhao's avatar chenhao

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

parents 042a6d73 c8d99622
......@@ -52,4 +52,11 @@ public class DutyCarDto implements Serializable {
@ApiModelProperty(value = "值班结束时间")
private String endTime;
// 需求 958 新增值班区域 值班区域id 字段 前台保存字段 by kongfm 2021-09-15
@ApiModelProperty(value = "值班区域")
private String dutyArea;
@ApiModelProperty(value = "值班区域Id")
private String dutyAreaId;
}
......@@ -62,4 +62,9 @@ public class DutyCarExcelDto implements Serializable {
@ExcelProperty(value = "车辆名称(车牌)", index = 4)
@ApiModelProperty(value = "车辆名称")
private String carName;
// 需求 958 新增值班区域 值班区域id 字段 导出字段 by kongfm 2021-09-15
@ExplicitConstraint(indexNum = 5, sourceClass = RoleNameExplicitConstraint.class, method = "getDutyArea") //固定下拉内容
@ExcelProperty(value = "值班区域", index = 5)
@ApiModelProperty(value = "值班区域")
private String dutyArea;
}
......@@ -45,4 +45,11 @@ public class DutyPersonDto implements Serializable {
@ApiModelProperty(value = "值班结束时间")
private String endTime;
// 需求 958 新增值班区域 值班区域id 字段 前台保存字段 by kongfm 2021-09-15
@ApiModelProperty(value = "值班区域")
private String dutyArea;
@ApiModelProperty(value = "值班区域Id")
private String dutyAreaId;
}
......@@ -52,4 +52,9 @@ public class DutyPersonExcelDto implements Serializable {
@ExcelProperty(value = "岗位", index = 4)
@ApiModelProperty(value = "岗位名称")
private String postTypeName;
// 需求 958 新增值班区域 值班区域id 字段 导出字段 by kongfm 2021-09-15
@ExplicitConstraint(indexNum = 5, sourceClass = RoleNameExplicitConstraint.class, method = "getDutyArea") //固定下拉内容
@ExcelProperty(value = "值班区域", index = 5)
@ApiModelProperty(value = "值班区域")
private String dutyArea;
}
......@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -184,4 +185,19 @@ public interface EquipFeignClient {
@RequestMapping(value = "/equipSpecificAlarm/getcountAlarmHandle/{type}", method = RequestMethod.GET)
ResponseModel<Integer> getcountAlarmHandle(@PathVariable String type);
/**
* 根据实例id 获取实例信息 // 需求 958 新增值班区域 值班区域id 字段 获取名称 by kongfm 2021-09-15
*
* @return
*/
@RequestMapping(value = "/building/getFormInstanceById", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getFormInstanceById(@RequestParam Long instanceId);
/**
* 查询所有建筑的数据字典 // 需求 958 新增值班区域 值班区域id 字段 获取下拉列表 by kongfm 2021-09-15
* @return
*/
@RequestMapping(value = "/building/getAllBuilding", method = RequestMethod.GET)
ResponseModel<List<LinkedHashMap<String, Object>>> getAllBuilding();
}
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.common.api.service;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import java.util.List;
/**
* @author DELL
*/
......@@ -23,4 +25,11 @@ public interface IDutyPersonService extends IDutyCommonService {
* @return List<DutyCarDto>
*/
DutyPersonDto update(Long instanceId, DutyPersonDto dutyPersonDto);
/**
* 根据区域ID 查询此时该区域值班人员 新需求 提供根据区域ID 获取值班人员 by kongfm 2021-09-15
* @param dutyAreaId
* @return
*/
List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId);
}
......@@ -195,8 +195,8 @@ public class Plan extends BasicEntity {
/**
* 状态:0-已停用;1-正常
*/
@Column(name="[status]")
private byte status;
@Column(name="status")
private Integer status;
/**
* 用户编号
*/
......@@ -562,11 +562,11 @@ public class Plan extends BasicEntity {
this.scoreFormula = scoreFormula;
}
public byte getStatus() {
public Integer getStatus() {
return this.status;
}
public void setStatus(byte status) {
public void setStatus(Integer status) {
this.status = status;
}
......
......@@ -166,4 +166,18 @@ public class DutyPersonController extends BaseController {
}
/**
*
* 新接口 根据值班区域id 查询值班人 by kongfm 2021-09-15
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/findByDutyAreaId/{dutyAreaId}")
@ApiOperation(httpMethod = "GET", value = "根据值班区域ID查询当前值班人", notes = "根据值班区域ID查询当前值班人")
public ResponseModel<List<DutyPersonDto>> findByDutyAreaId(
@PathVariable Long dutyAreaId
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.findByDutyAreaId(dutyAreaId));
}
}
......@@ -12,12 +12,14 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
import org.apache.commons.lang3.StringUtils;
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 org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
......@@ -44,6 +46,9 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
String driverPostTypeCode = "5";
@Autowired
EquipFeignClient equipFeign;
@Override
public String getGroupCode() {
return "dutyCar";
......@@ -60,6 +65,18 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
.eq(DynamicFormInstance::getFieldValue, userId)
.eq(DynamicFormInstance::getGroupCode, this.getGroupCode()));
Long instanceId = null;
if(StringUtils.isNotEmpty(dutyCarDto.getDutyAreaId())) {
// 根据建筑id 查找建筑
ResponseModel<Map<String, Object>> response = null;
try {
response = equipFeign.getFormInstanceById(Long.parseLong(dutyCarDto.getDutyAreaId()));
} catch (NumberFormatException e) {
throw new BadRequest("值班区域id异常!");
}
Map<String, Object> result = response.getResult();
dutyCarDto.setDutyArea(result.get("name").toString());
}
Map<String, Object> map = Bean.BeantoMap(dutyCarDto);
if (!instances.isEmpty()) {
// 0.定位instanceId,准备进行更新操作
......
......@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -99,9 +100,14 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
// 根据时间 查询值班关系表
// BUG 2806 获取月份第一天和最后一天 2021-09-09 by kongfm
if(beginDate != null ) {
SimpleDateFormat shortformat = new SimpleDateFormat("yyyy-MM-dd");
if(beginDate != null ) {
Calendar c = Calendar.getInstance();
c.setTime(DateUtils.longStr2Date(beginDate));
if(DateUtils.longStr2Date(beginDate) != null) {
c.setTime(DateUtils.longStr2Date(beginDate));
} else {
c.setTime(shortformat.parse(beginDate));
}
c.set(Calendar.DAY_OF_MONTH, 1);
c.set(Calendar.HOUR_OF_DAY,0);
c.set(Calendar.MINUTE,0);
......@@ -110,7 +116,11 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
if(endDate != null ) {
Calendar c = Calendar.getInstance();
c.setTime(DateUtils.longStr2Date(beginDate));
if(DateUtils.longStr2Date(endDate) != null) {
c.setTime(DateUtils.longStr2Date(endDate));
} else {
c.setTime(shortformat.parse(endDate));
}
c.add(Calendar.MONTH, 1);
c.set(Calendar.DAY_OF_MONTH, 1);
c.add(Calendar.DATE, -1);
......
......@@ -5,17 +5,24 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
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.DutyShift;
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.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import org.apache.commons.lang3.StringUtils;
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 org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -27,6 +34,9 @@ import java.util.stream.Collectors;
@Service
public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDutyPersonService{
@Autowired
EquipFeignClient equipFeign;
@Override
public String getGroupCode(){
return "dutyPerson";
......@@ -43,6 +53,18 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
.eq(DynamicFormInstance::getFieldValue, userId)
.eq(DynamicFormInstance::getGroupCode, this.getGroupCode()));
Long instanceId = null;
// 如果人员有区域id 则创建区域字段
if(StringUtils.isNotEmpty(dutyPersonDto.getDutyAreaId())) {
// 根据建筑id 查找建筑
ResponseModel<Map<String, Object>> response = null;
try {
response = equipFeign.getFormInstanceById(Long.parseLong(dutyPersonDto.getDutyAreaId()));
} catch (NumberFormatException e) {
throw new BadRequest("值班区域id异常!");
}
Map<String, Object> result = response.getResult();
dutyPersonDto.setDutyArea(result.get("name").toString());
}
Map<String, Object> map = Bean.BeantoMap(dutyPersonDto);
......@@ -153,4 +175,63 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column, DynamicFormInstance formInstance) {
fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId());
}
@Override
public List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId) {
Date now = new Date();
Calendar c = Calendar.getInstance();
c.setTime(now);
c.set(Calendar.DAY_OF_MONTH, 1);
c.set(Calendar.HOUR_OF_DAY,0);
c.set(Calendar.MINUTE,0);
c.set(Calendar.SECOND,0);
String beginDate = DateUtils.date2LongStr(c.getTime());
c.setTime(now);
c.add(Calendar.MONTH, 1);
c.set(Calendar.DAY_OF_MONTH, 1);
c.add(Calendar.DATE, -1);
c.set(Calendar.HOUR_OF_DAY,23);
c.set(Calendar.MINUTE,59);
c.set(Calendar.SECOND,59);
String endDate = DateUtils.date2LongStr(c.getTime());
List<DutyPersonDto> temp = new ArrayList<>();
dutyPersonShiftService.list(new LambdaQueryWrapper<DutyPersonShift>()
.ge(beginDate != null, DutyPersonShift::getDutyDate, beginDate)
.le(endDate != null, DutyPersonShift::getDutyDate, endDate).groupBy(DutyPersonShift::getInstanceId))
.stream().forEach(e -> {
//1.查询已有数据
List<DynamicFormInstance> instances = dynamicFormInstanceService.list(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId, e.getInstanceId()).eq(DynamicFormInstance::getGroupCode,this.getGroupCode()));
if(instances.size() > 0) {
DutyPersonDto dto = new DutyPersonDto();
boolean add = false;
for(DynamicFormInstance t : instances) {
if("userId".equals(t.getFieldCode())) {
dto.setUserId(t.getFieldValue());
} else if("userName".equals(t.getFieldCode())) {
dto.setUserName(t.getFieldValue());
} else if("deptId".equals(t.getFieldCode())) {
dto.setDeptId(t.getFieldValue());
} else if("deptName".equals(t.getFieldCode())) {
dto.setDeptName(t.getFieldValue());
} else if("postType".equals(t.getFieldCode())) {
dto.setPostType(t.getFieldValue());
} else if("postTypeName".equals(t.getFieldCode())) {
dto.setPostTypeName(t.getFieldValue());
} else if("dutyArea".equals(t.getFieldCode())) {
dto.setDutyArea(t.getFieldValue());
} else if("dutyAreaId".equals(t.getFieldCode())) {
if(dutyAreaId.toString().equals(t.getFieldValue())) {
add = true;
}
dto.setDutyAreaId(t.getFieldValue());
}
}
if(add) {
temp.add(dto);
}
}
});
return temp;
}
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -152,6 +153,9 @@ public class DataSourcesImpl implements DataSources {
case "getCitys":
str =getCitys();
break;
case "getDutyArea":
str =getDutyArea();
break;
}
}
return str;
......@@ -362,4 +366,15 @@ public class DataSourcesImpl implements DataSources {
}
});
}
private String[] getDutyArea() {
ResponseModel<List<LinkedHashMap<String, Object>>> response = equipFeignClient.getAllBuilding();
List<LinkedHashMap<String, Object>> buildingList = response.getResult();
List<String> areaList = Lists.newArrayList();
buildingList.forEach(building -> {
areaList.add(building.get("buildName") + "@" + building.get("instanceId"));
});
String[] str = areaList.toArray(new String[buildingList.size()]);
return str;
}
}
......@@ -850,7 +850,8 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
if (sheet != null) {
// 获取表头月份
Row titleRow = sheet.getRow(0);
Cell monthCell = titleRow.getCell(5);
// 958
Cell monthCell = titleRow.getCell(6);
String dateStr = monthCell == null ? "" : monthCell.toString();
List<Date> dayByMonth = DateUtils.getDayByMonth(dateStr);
......@@ -897,9 +898,15 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
dutyCarDto.setCarName(carName[0]);
dutyCarDto.setCarId(carName[1]);
}
cell = row.getCell(5);
if (cell != null) {
String[] dutyArea = cell.toString().split("@");
dutyCarDto.setDutyArea(dutyArea[0]);
dutyCarDto.setDutyAreaId(dutyArea[1]);
}
List<DutyPersonShiftDto> dutyShift = dutyCarDto.getDutyShift();
for (int j = 0; j < dayByMonth.size(); j++) {
cell = row.getCell(5 + j);
cell = row.getCell(6 + j);
String dutyType = cell == null ? "" : cell.toString();
if (!StringUtils.isEmpty(dutyType)) {
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
......@@ -942,9 +949,16 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
dutyPersonDto.setPostTypeName(split[0]);
dutyPersonDto.setPostType(split[1]);
}
//需求958 添加值班区域 导入 by kongfm 2021-09-15
cell = row.getCell(5);
if (cell != null) {
String[] dutyArea = cell.toString().split("@");
dutyPersonDto.setDutyArea(dutyArea[0]);
dutyPersonDto.setDutyAreaId(dutyArea[1]);
}
List<DutyPersonShiftDto> dutyShift = new ArrayList<>();
for (int j = 0; j < dayByMonth.size(); j++) {
cell = row.getCell(5 + j);
cell = row.getCell(6 + j);
String dutyType = cell == null ? "" : cell.toString();
if (!StringUtils.isEmpty(dutyType)) {
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
......@@ -1123,7 +1137,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
list.add(o.getUserName());
list.add(o.getPostTypeName());
list.add(o.getCarName());
list.add(o.getDutyArea());
List<DutyPersonShiftDto> dutyShift = o.getDutyShift();
initDutyShift(dayByMonth, dutyShift, list);
......@@ -1162,7 +1176,7 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
list.add(o.getUserName());
list.add(o.getDeptName());
list.add(o.getPostTypeName());
list.add(o.getDutyArea());
List<DutyPersonShiftDto> dutyShift = o.getDutyShift();
initDutyShift(dayByMonth, dutyShift, list);
......
......@@ -196,7 +196,7 @@ public class PlanController extends AbstractBaseController {
@RequestMapping(value = "/setPlanStatus", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse setPlanStatus(
@ApiParam(value = "计划id") @RequestParam(value = "planId", required = false) Long planId,
@ApiParam(value = "计划状态") @RequestParam(value = "status", required = false) byte status ) {
@ApiParam(value = "计划状态") @RequestParam(value = "status", required = false) Integer status ) {
planService.setplanstatus(planId, status);
return CommonResponseUtil.success();
}
......
......@@ -52,7 +52,7 @@ public class RoutePointItemController extends AbstractBaseController {
@ApiOperation(value = "新增巡检路线点项关系", notes = "新增巡检路线点项关系")
@PostMapping(value = "/addRoutePointItem", produces = "application/json;charset=UTF-8")
public CommonResponse addRoute(@ApiParam(value = "巡检计划", required = true) @RequestBody Plan plan,
@ApiParam(value = "检查项IDS", required = true) @RequestParam List<Long> inputItemIds,
@ApiParam(value = "检查项IDS", required = false) @RequestParam List<Long> inputItemIds,
@ApiParam(value = "是否保存并提交", required = true) @RequestParam Boolean status) {
try {
String userId = getUserId();
......
......@@ -32,7 +32,7 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
@Modifying
@Transactional
@Query(value = "UPDATE p_plan SET `status` = (?1) WHERE id IN (?2)", nativeQuery = true)
@Query(value = "UPDATE p_plan SET `status` = (?1) WHERE id = (?2)", nativeQuery = true)
void updatePlanStatus(Integer status, Long planId);
Plan findByOriginalId(String originalId);
......
......@@ -241,7 +241,7 @@ public class PlanServiceImpl implements IPlanService {
for (long planId : planIds) {
List<Plan> planList = getPlanByRouteId(planId);
for (Plan plan : planList) {
plan.setStatus((byte) 1);
plan.setStatus(1);
planDao.save(plan);
}
}
......@@ -270,7 +270,7 @@ public class PlanServiceImpl implements IPlanService {
}
@Override
public void setplanstatus (Long id, byte status) {
public void setplanstatus (Long id, Integer status) {
Plan oriPlan = planDao.findById(id).get();
oriPlan.setStatus(status);
planDao.save(oriPlan);
......
......@@ -294,7 +294,7 @@ public class SynDataServiceImpl implements ISynDataService {
plan.setMinSpace(0);
plan.setIsScore("1");
plan.setError(0);
plan.setStatus(Byte.parseByte(XJConstant.PLAN_STATUS_START));
plan.setStatus(Integer.parseInt(XJConstant.PLAN_STATUS_START));
plan.setNextGenDate(DateUtil.getIntervalDate(now, 0));
plan.setCreateBy(userId.toString());
plan.setRemark1(synPlanParam.getRemark());
......@@ -381,7 +381,7 @@ public class SynDataServiceImpl implements ISynDataService {
public CommonResponse stopPlan(String originalId) {
Plan plan = iPlanDao.findByOriginalId(originalId);
if (plan != null) {
plan.setStatus(Byte.parseByte(XJConstant.PLAN_STATUS_STOP));
plan.setStatus(Integer.parseInt(XJConstant.PLAN_STATUS_STOP));
iPlanDao.save(plan);
List<PlanTask> planTasks = iplanTaskDao.findByPlanId(plan.getId());
if (!CollectionUtils.isEmpty(planTasks)) {
......
......@@ -76,7 +76,7 @@ public interface IPlanService {
/**
* 计划启用停用
*/
void setplanstatus(Long id, byte status);
void setplanstatus(Long id, Integer status);
/**
* 获取计划详情
......
......@@ -15,7 +15,7 @@ public class RoutePointItemVo {
/**
* 检查项名称
*/
private String itemName;
private String name;
private String itemType;
private String inputClassify;
private String checkType;
......
......@@ -61,7 +61,7 @@
SELECT
pi.id,
i.id AS itemId,
i.`name` AS itemName,
i.`name`,
i.item_type,
i.input_classify,
i.check_type,
......
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