|
|
|
@ -62,11 +62,31 @@ public class BsGasClassGroupTaskController { |
|
|
|
|
@ApiOperation(value = "开启班组任务") |
|
|
|
|
public ResponseData startGroupTask(@RequestBody JSONObject body) { |
|
|
|
|
try { |
|
|
|
|
if (body == null || body.getLong("gasId") == null || body.getLong("gasClassGroupId") == null) { |
|
|
|
|
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
|
|
|
|
if (userInfoModel == null || |
|
|
|
|
(!userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) |
|
|
|
|
&& !userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()))) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (body == null || body.getLong("gasClassGroupId") == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gasClassGroupTaskService.startGroupTask(body.getLong("gasId"), body.getLong("gasClassGroupId")); |
|
|
|
|
Long gasId = null; |
|
|
|
|
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
|
|
|
|
gasId = userInfoModel.getAccount().getObjectId(); |
|
|
|
|
|
|
|
|
|
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
|
|
|
|
// 查询油站工作人员
|
|
|
|
|
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); |
|
|
|
|
if (gasStaff == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
gasId = gasStaff.getMerId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gasClassGroupTaskService.startGroupTask(gasId, body.getLong("gasClassGroupId")); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
@ -79,13 +99,28 @@ public class BsGasClassGroupTaskController { |
|
|
|
|
@RequestMapping(value = "/endGroupTask", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "结束班组任务") |
|
|
|
|
public ResponseData endGroupTask(@RequestBody JSONObject body) { |
|
|
|
|
public ResponseData endGroupTask() { |
|
|
|
|
try { |
|
|
|
|
if (body == null || body.getLong("gasId") == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
|
|
|
|
if (userInfoModel == null || |
|
|
|
|
(!userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) |
|
|
|
|
&& !userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()))) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); |
|
|
|
|
} |
|
|
|
|
Long gasId = null; |
|
|
|
|
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
|
|
|
|
gasId = userInfoModel.getAccount().getObjectId(); |
|
|
|
|
|
|
|
|
|
gasClassGroupTaskService.endGroupTask(body.getLong("gasId")); |
|
|
|
|
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
|
|
|
|
// 查询油站工作人员
|
|
|
|
|
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); |
|
|
|
|
if (gasStaff == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
gasId = gasStaff.getMerId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gasClassGroupTaskService.endGroupTask(gasId); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
@ -100,11 +135,30 @@ public class BsGasClassGroupTaskController { |
|
|
|
|
@ApiOperation(value = "交换班组任务") |
|
|
|
|
public ResponseData swapGroupTask(@RequestBody JSONObject body) { |
|
|
|
|
try { |
|
|
|
|
if (body == null || body.getLong("gasId") == null || body.getLong("gasClassGroupId") == null) { |
|
|
|
|
if (body == null || body.getLong("gasClassGroupId") == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gasClassGroupTaskService.swapGroupTask(body.getLong("gasId"), body.getLong("gasClassGroupId")); |
|
|
|
|
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
|
|
|
|
if (userInfoModel == null || |
|
|
|
|
(!userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) |
|
|
|
|
&& !userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()))) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); |
|
|
|
|
} |
|
|
|
|
Long gasId = null; |
|
|
|
|
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
|
|
|
|
gasId = userInfoModel.getAccount().getObjectId(); |
|
|
|
|
|
|
|
|
|
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
|
|
|
|
// 查询油站工作人员
|
|
|
|
|
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); |
|
|
|
|
if (gasStaff == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
gasId = gasStaff.getMerId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gasClassGroupTaskService.swapGroupTask(gasId, body.getLong("gasClassGroupId")); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
@ -117,15 +171,31 @@ public class BsGasClassGroupTaskController { |
|
|
|
|
@RequestMapping(value = "/getCurrentClassGroupTask", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询当前班次") |
|
|
|
|
public ResponseData getCurrentClassGroupTask(@RequestParam(name = "gasId", required = true) Long gasId) { |
|
|
|
|
public ResponseData getCurrentClassGroupTask(@RequestParam(name = "gasId", required = false) Long gasId) { |
|
|
|
|
try { |
|
|
|
|
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
|
|
|
|
if (userInfoModel == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS); |
|
|
|
|
} |
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
|
|
|
|
gasId = userInfoModel.getAccount().getObjectId(); |
|
|
|
|
|
|
|
|
|
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
|
|
|
|
// 查询油站工作人员
|
|
|
|
|
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); |
|
|
|
|
if (gasStaff == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
gasId = gasStaff.getMerId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GasClassGroupTaskDataCount dataCount; |
|
|
|
|
|
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
param.put("merchantStoreId", gasId); |
|
|
|
|
param.put("merId", gasId); |
|
|
|
|
param.put("status", GasClassGroupTaskStatus.status1.getStatus()); |
|
|
|
|
List<BsGasClassGroupTask> list = gasClassGroupTaskService.getGroupTaskList(param); |
|
|
|
|
if (list.size() > 0) { |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
dataCount = gasClassGroupTaskService.countGroupTaskData(gasId, |
|
|
|
|
list.get(0).getClassNum(), |
|
|
|
|
list.get(0).getId(), |
|
|
|
|