|
|
|
@ -276,25 +276,38 @@ public class OpenServiceImpl implements OpenService {
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult machineRepair(EquRepairOrderDTO equRepairOrderDTO) {
|
|
|
|
|
|
|
|
|
|
if (equRepairOrderDTO.getFactory() == null) {
|
|
|
|
|
return error("工厂源不可为空!");
|
|
|
|
|
}
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + equRepairOrderDTO.getFactory());// 这是数据源的key
|
|
|
|
|
|
|
|
|
|
// 创建报修单
|
|
|
|
|
DeviceRepairOrder equRepairOrder = new DeviceRepairOrder();
|
|
|
|
|
// 获取故障报修流水号
|
|
|
|
|
String serialNum = String.format("%03d", openMapper.selectOrderCodeSerialNumber());
|
|
|
|
|
if (equRepairOrderDTO.getEquipmentCode() == null) {
|
|
|
|
|
return error("设备信息不可为空!");
|
|
|
|
|
}
|
|
|
|
|
equRepairOrder.setOrderCode("BX" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairOrderDTO.getEquipmentCode() + serialNum);// 报修单号
|
|
|
|
|
equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());// id
|
|
|
|
|
equRepairOrder.setEquipmentCode(equRepairOrderDTO.getEquipmentCode());
|
|
|
|
|
equRepairOrder.setOrderSource("上位机");// 故障来源
|
|
|
|
|
equRepairOrder.setOrderTime(DateUtils.getNowDate());// 报修时间
|
|
|
|
|
equRepairOrder.setOrderBreakdownTime(DateUtils.getNowDate());// 故障时间
|
|
|
|
|
equRepairOrder.setOrderRepairmanCode(equRepairOrderDTO.getUserName());// 用户账号
|
|
|
|
|
equRepairOrder.setOrderRepairmanName(equRepairOrderDTO.getUserNickName());// 用户名称
|
|
|
|
|
if (equRepairOrderDTO.getUserName() != null) {
|
|
|
|
|
equRepairOrder.setOrderRepairmanCode(equRepairOrderDTO.getUserName());// 用户账号
|
|
|
|
|
}
|
|
|
|
|
if (equRepairOrderDTO.getUserNickName() != null) {
|
|
|
|
|
equRepairOrder.setOrderRepairmanName(equRepairOrderDTO.getUserNickName());// 用户名称
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
equRepairOrder.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
equRepairOrder.setCreateBy(equRepairOrderDTO.getUserName());
|
|
|
|
|
equRepairOrder.setOrderStatus("待审核");// 报修单状态
|
|
|
|
|
equRepairOrder.setFactoryCode(equRepairOrderDTO.getFactory());// 工厂
|
|
|
|
|
equRepairOrder.setOrderConnection(equRepairOrderDTO.getPhoneNumber());// 联系方式
|
|
|
|
|
if (equRepairOrderDTO.getPhoneNumber() != null) {
|
|
|
|
|
equRepairOrder.setOrderConnection(equRepairOrderDTO.getPhoneNumber());// 联系方式
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openMapper.insertEquRepairOrder(equRepairOrder);
|
|
|
|
|
|
|
|
|
|