车辆问题修改
This commit is contained in:
parent
44952ad1bf
commit
043eb8b461
|
|
@ -33,7 +33,7 @@ import java.util.Objects;
|
|||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CarNeedPlanServiceImpl implements CarNeedPlanService{
|
||||
public class CarNeedPlanServiceImpl implements CarNeedPlanService {
|
||||
|
||||
@Autowired
|
||||
private CarNeedPlanMapper mapper;
|
||||
|
|
@ -45,26 +45,28 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService{
|
|||
private AuditRecordService recordService;
|
||||
@Autowired
|
||||
private FileUploadService uploadService;
|
||||
|
||||
/**
|
||||
* 需求计划详情查询
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CarNeedPlanVo> getCarNeedPlanList(CarNeedPlanVo data) {
|
||||
try {
|
||||
List<CarNeedPlanVo> list= mapper.getCarNeedPlanList(data);
|
||||
if(ListHelpUtil.isNotEmpty(list)){
|
||||
List<CarNeedPlanVo> list = mapper.getCarNeedPlanList(data);
|
||||
if (ListHelpUtil.isNotEmpty(list)) {
|
||||
final int[] num = {1};
|
||||
list.forEach(vo->{
|
||||
list.forEach(vo -> {
|
||||
vo.setXh(num[0]);
|
||||
num[0]++;
|
||||
String auditStatus = AuditStatusUtil.getAuditStatus(vo.getStatus(),vo.getStatusType());
|
||||
String auditStatus = AuditStatusUtil.getAuditStatus(vo.getStatus(), vo.getStatusType());
|
||||
vo.setAuditStatus(auditStatus);
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}catch (Exception e){
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString());
|
||||
}
|
||||
return new ArrayList<CarNeedPlanVo>();
|
||||
|
|
@ -72,253 +74,265 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService{
|
|||
|
||||
/**
|
||||
* 新增 需求计划
|
||||
*
|
||||
* @param request
|
||||
* @param files
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse addNeedPlanData(HttpServletRequest request, MultipartFile[] files) {
|
||||
try{
|
||||
String params=request.getParameter("params");
|
||||
if(StringHelper.isEmpty(params)){
|
||||
return ServerResponse.createErroe("请求参数缺失");
|
||||
}
|
||||
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
CarNeedPlanVo vo = JSON.parseObject(params, CarNeedPlanVo.class);
|
||||
vo.setCreator(userId);
|
||||
vo.setUpdater(userId);
|
||||
vo.setUserName(Objects.requireNonNull(UserUtil.getLoginUser()).getUsername());
|
||||
String msg = validatorsUtils.valid(vo);
|
||||
if(StringHelper.isNotEmpty(msg)){
|
||||
return ServerResponse.createErroe(msg);
|
||||
}
|
||||
List<CarNeedPlanDetailVo> detailList=vo.getDetailList();
|
||||
try {
|
||||
String params = request.getParameter("params");
|
||||
if (StringHelper.isEmpty(params)) {
|
||||
return ServerResponse.createErroe("请求参数缺失");
|
||||
}
|
||||
String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
CarNeedPlanVo vo = JSON.parseObject(params, CarNeedPlanVo.class);
|
||||
vo.setCreator(userId);
|
||||
vo.setUpdater(userId);
|
||||
vo.setUserName(Objects.requireNonNull(UserUtil.getLoginUser()).getUsername());
|
||||
String msg = validatorsUtils.valid(vo);
|
||||
if (StringHelper.isNotEmpty(msg)) {
|
||||
return ServerResponse.createErroe(msg);
|
||||
}
|
||||
List<CarNeedPlanDetailVo> detailList = vo.getDetailList();
|
||||
|
||||
String requestParameterDetails = request.getParameter("details");
|
||||
if (StringHelper.isNotEmpty(requestParameterDetails)) {
|
||||
JSONArray detailListArray = JSON.parseArray(requestParameterDetails);
|
||||
detailList = detailListArray.toJavaList(CarNeedPlanDetailVo.class);
|
||||
}
|
||||
if(ListHelpUtil.isEmpty(detailList)){
|
||||
return ServerResponse.createErroe("请选择车辆规格信息");
|
||||
String requestParameterDetails = request.getParameter("details");
|
||||
if (StringHelper.isNotEmpty(requestParameterDetails)) {
|
||||
JSONArray detailListArray = JSON.parseArray(requestParameterDetails);
|
||||
detailList = detailListArray.toJavaList(CarNeedPlanDetailVo.class);
|
||||
}
|
||||
if (ListHelpUtil.isEmpty(detailList)) {
|
||||
return ServerResponse.createErroe("请选择车辆规格信息");
|
||||
}
|
||||
//紧急的
|
||||
if("1".equals(vo.getApplyType())){
|
||||
if ("1".equals(vo.getApplyType())) {
|
||||
vo.setStatus(2);
|
||||
vo.setStatusType(1);
|
||||
int num=mapper.getPlanCodeNum(vo);
|
||||
if(num>0){
|
||||
return ServerResponse.createErroe("计划编号已存在");
|
||||
int num = mapper.getPlanCodeNum(vo);
|
||||
if (num > 0) {
|
||||
return ServerResponse.createErroe("计划编号已存在");
|
||||
}
|
||||
if(files==null || files.length<1){
|
||||
if (files == null || files.length < 1) {
|
||||
System.out.println("未上传计划附件");
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
vo.setStatus(1);
|
||||
vo.setStatusType(2);
|
||||
String code=getPlanCode(vo);
|
||||
String code = getPlanCode(vo);
|
||||
vo.setCode(code);
|
||||
}
|
||||
int carNum=detailList.size();
|
||||
int carNum = detailList.size();
|
||||
vo.setCarNum(carNum);
|
||||
int carNeedNun=detailList.stream().mapToInt(CarNeedPlanDetailVo::getNeedNum).sum();
|
||||
vo.setNeedNum(carNeedNun);
|
||||
int num =mapper.addNeedPlanData(vo);
|
||||
int carNeedNun = detailList.stream().mapToInt(CarNeedPlanDetailVo::getNeedNum).sum();
|
||||
vo.setNeedNum(carNeedNun);
|
||||
int num = mapper.addNeedPlanData(vo);
|
||||
//紧急的上传附件
|
||||
if("1".equals(vo.getApplyType())){
|
||||
if (files != null && files.length > 0) {
|
||||
List<FileUploadVo> fileList=uploadService.uploadImage(files,vo.getId(),"car_plan_apply","紧急用车附件");
|
||||
if(fileList.size()!=files.length){
|
||||
return ServerResponse.createErroe("附件上传失败");
|
||||
}
|
||||
}
|
||||
recordService.addRecord(vo.getId(),"0","1","2","紧急内部用车","0");
|
||||
}else{
|
||||
if (files != null && files.length > 0) {
|
||||
List<FileUploadVo> fileList=uploadService.uploadImage(files,vo.getId(),"car_plan_apply","运输起始点高德地图截图");
|
||||
if(fileList.size()!=files.length){
|
||||
return ServerResponse.createErroe("附件上传失败");
|
||||
}
|
||||
}
|
||||
recordService.addRecord(vo.getId(),"0","1","2","","0");
|
||||
}
|
||||
if ("1".equals(vo.getApplyType())) {
|
||||
if (files != null && files.length > 0) {
|
||||
List<FileUploadVo> fileList = uploadService.uploadImage(files, vo.getId(), "car_plan_apply", "紧急用车附件");
|
||||
if (fileList.size() != files.length) {
|
||||
return ServerResponse.createErroe("附件上传失败");
|
||||
}
|
||||
}
|
||||
recordService.addRecord(vo.getId(), "0", "1", "2", "紧急内部用车", "0");
|
||||
} else {
|
||||
if (files != null && files.length > 0) {
|
||||
List<FileUploadVo> fileList = uploadService.uploadImage(files, vo.getId(), "car_plan_apply", "运输起始点高德地图截图");
|
||||
if (fileList.size() != files.length) {
|
||||
return ServerResponse.createErroe("附件上传失败");
|
||||
}
|
||||
}
|
||||
recordService.addRecord(vo.getId(), "0", "1", "2", "", "0");
|
||||
}
|
||||
|
||||
if(num>0){
|
||||
int success=mapper.addNeedPlanDetails(vo,detailList);
|
||||
if(success==detailList.size()){
|
||||
return ServerResponse.createBySuccessMsg("新增成功");
|
||||
if (num > 0) {
|
||||
int success = mapper.addNeedPlanDetails(vo, detailList);
|
||||
if (success == detailList.size()) {
|
||||
return ServerResponse.createBySuccessMsg("新增成功");
|
||||
}
|
||||
}
|
||||
return ServerResponse.createErroe("新增计划失败");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
return ServerResponse.createErroe("新增计划失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("新增失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计划详情0
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse getNeedPlanDetails(CarNeedPlanVo data) {
|
||||
try{
|
||||
CarNeedPlanVo vo=mapper.getNeedPlanDetails(data);
|
||||
if(vo!=null){
|
||||
try {
|
||||
CarNeedPlanVo vo = mapper.getNeedPlanDetails(data);
|
||||
if (vo != null) {
|
||||
//紧急的上传附件
|
||||
if("1".equals(vo.getApplyType())){
|
||||
List<FileUploadVo> fileList=uploadService.getFileList(vo.getId(),"car_plan_apply","");
|
||||
if ("1".equals(vo.getApplyType())) {
|
||||
List<FileUploadVo> fileList = uploadService.getFileList(vo.getId(), "car_plan_apply", "");
|
||||
vo.setFileList(fileList);
|
||||
}else{
|
||||
List<FileUploadVo> fileList=uploadService.getFileList(vo.getId(),"car_plan_apply","运输起始点高德地图截图");
|
||||
} else {
|
||||
List<FileUploadVo> fileList = uploadService.getFileList(vo.getId(), "car_plan_apply", "运输起始点高德地图截图");
|
||||
vo.setFileList(fileList);
|
||||
}
|
||||
List<AuditRecordVo> recordList=recordService.getRecordList(data.getId());
|
||||
List<AuditRecordVo> recordList = recordService.getRecordList(data.getId());
|
||||
List<AuditRecordVo> record = recordService.getRecordList("out-" + vo.getOutId());
|
||||
if (record != null && !record.isEmpty()) {
|
||||
List<AuditRecordVo> supRecordList = recordService.getSupRecordList(data.getId());
|
||||
record.addAll(supRecordList);
|
||||
recordList.addAll(record);
|
||||
}
|
||||
vo.setRecordList(recordList);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询成功",vo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return ServerResponse.createSuccess("查询成功", vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询失败",new CarSupVo());
|
||||
return ServerResponse.createSuccess("查询失败", new CarSupVo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改前查询
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServerResponse getNeedPlanInfo(CarNeedPlanVo data) {
|
||||
try{
|
||||
CarNeedPlanVo vo=mapper.getNeedPlanDetails(data);
|
||||
if(vo!=null){
|
||||
List<CarNeedPlanDetailVo> list=mapper.getNeedDetailInfo(data);
|
||||
vo.setDetailList(list);
|
||||
try {
|
||||
CarNeedPlanVo vo = mapper.getNeedPlanDetails(data);
|
||||
if (vo != null) {
|
||||
List<CarNeedPlanDetailVo> list = mapper.getNeedDetailInfo(data);
|
||||
vo.setDetailList(list);
|
||||
|
||||
List<FileUploadVo> fileList=uploadService.getFileList(vo.getId(),"car_plan_apply","运输起始点高德地图截图");
|
||||
List<FileUploadVo> fileList = uploadService.getFileList(vo.getId(), "car_plan_apply", "运输起始点高德地图截图");
|
||||
vo.setFileList(fileList);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询成功",vo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return ServerResponse.createSuccess("查询成功", vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询失败",new CarSupVo());
|
||||
return ServerResponse.createSuccess("查询失败", new CarSupVo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse updateNeedPlanData(HttpServletRequest request, MultipartFile[] files) {
|
||||
try{
|
||||
String params=request.getParameter("params");
|
||||
if(StringHelper.isEmpty(params)){
|
||||
return ServerResponse.createErroe("请求参数缺失");
|
||||
try {
|
||||
String params = request.getParameter("params");
|
||||
if (StringHelper.isEmpty(params)) {
|
||||
return ServerResponse.createErroe("请求参数缺失");
|
||||
}
|
||||
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
CarNeedPlanVo vo = JSON.parseObject(params, CarNeedPlanVo.class);
|
||||
vo.setUpdater(userId);
|
||||
String msg = validatorsUtils.valid(vo);
|
||||
if(StringHelper.isNotEmpty(msg)){
|
||||
return ServerResponse.createErroe(msg);
|
||||
if (StringHelper.isNotEmpty(msg)) {
|
||||
return ServerResponse.createErroe(msg);
|
||||
}
|
||||
List<CarNeedPlanDetailVo> detailList=vo.getDetailList();
|
||||
if(ListHelpUtil.isEmpty(detailList)){
|
||||
return ServerResponse.createErroe("请选择车辆规格信息");
|
||||
List<CarNeedPlanDetailVo> detailList = vo.getDetailList();
|
||||
if (ListHelpUtil.isEmpty(detailList)) {
|
||||
return ServerResponse.createErroe("请选择车辆规格信息");
|
||||
}
|
||||
CarNeedPlanVo hisData=mapper.getNeedPlanDetails(vo);
|
||||
if(hisData.getStatusType()!=2 && hisData.getStatus()!=3){
|
||||
return ServerResponse.createErroe("该计划已被审核,不允许修改,请刷新重试");
|
||||
CarNeedPlanVo hisData = mapper.getNeedPlanDetails(vo);
|
||||
if (hisData.getStatusType() != 2 && hisData.getStatus() != 3) {
|
||||
return ServerResponse.createErroe("该计划已被审核,不允许修改,请刷新重试");
|
||||
}
|
||||
if(hisData.getStatus()==3){
|
||||
recordService.addRecord(vo.getId(),"0","1","2","","0");
|
||||
if (hisData.getStatus() == 3) {
|
||||
recordService.addRecord(vo.getId(), "0", "1", "2", "", "0");
|
||||
}
|
||||
vo.setStatus(1);
|
||||
vo.setStatusType(2);
|
||||
int carNum=detailList.size();
|
||||
int carNum = detailList.size();
|
||||
vo.setCarNum(carNum);
|
||||
|
||||
int carNeedNun=detailList.stream().mapToInt(CarNeedPlanDetailVo::getNeedNum).sum();
|
||||
int carNeedNun = detailList.stream().mapToInt(CarNeedPlanDetailVo::getNeedNum).sum();
|
||||
vo.setNeedNum(carNeedNun);
|
||||
int num =mapper.updateNeedPlanData(vo);
|
||||
if(num>0){
|
||||
int num = mapper.updateNeedPlanData(vo);
|
||||
if (num > 0) {
|
||||
|
||||
if(files!=null && files.length>0){
|
||||
List<FileUploadVo> fileList=uploadService.uploadImage(files,vo.getId(),"car_plan_apply","运输起始点高德地图截图");
|
||||
if(fileList.size()!=files.length){
|
||||
return ServerResponse.createErroe("文件上传失败!");
|
||||
if (files != null && files.length > 0) {
|
||||
List<FileUploadVo> fileList = uploadService.uploadImage(files, vo.getId(), "car_plan_apply", "运输起始点高德地图截图");
|
||||
if (fileList.size() != files.length) {
|
||||
return ServerResponse.createErroe("文件上传失败!");
|
||||
}
|
||||
}
|
||||
if(StringHelper.isNotEmpty(vo.getDelFile())){
|
||||
if (StringHelper.isNotEmpty(vo.getDelFile())) {
|
||||
uploadService.deleteFile(vo.getDelFile());
|
||||
}
|
||||
|
||||
for (CarNeedPlanDetailVo detailVo:detailList){
|
||||
for (CarNeedPlanDetailVo detailVo : detailList) {
|
||||
detailVo.setPlanId(vo.getId());
|
||||
detailVo.setPlanType(vo.getType());
|
||||
if (StringHelper.isEmpty(detailVo.getId())){
|
||||
int success=mapper.addNeedPlanDetailsOnlyOne(detailVo);
|
||||
if(success<1){
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
if (StringHelper.isEmpty(detailVo.getId())) {
|
||||
int success = mapper.addNeedPlanDetailsOnlyOne(detailVo);
|
||||
if (success < 1) {
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}
|
||||
}else {
|
||||
int success=mapper.updateNeedPlanDetails(detailVo);
|
||||
if(success<1){
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
} else {
|
||||
int success = mapper.updateNeedPlanDetails(detailVo);
|
||||
if (success < 1) {
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringHelper.isNotEmpty(vo.getDelIds())){
|
||||
List<String> delId= Arrays.asList(vo.getDelIds().split("@"));
|
||||
int delNum=mapper.deleteDetails(delId);
|
||||
if(delNum!=delId.size()){
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
}
|
||||
if (StringHelper.isNotEmpty(vo.getDelIds())) {
|
||||
List<String> delId = Arrays.asList(vo.getDelIds().split("@"));
|
||||
int delNum = mapper.deleteDetails(delId);
|
||||
if (delNum != delId.size()) {
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
return ServerResponse.createBySuccessMsg("修改成功");
|
||||
return ServerResponse.createBySuccessMsg("修改成功");
|
||||
}
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("修改失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse deleteNeedPlanData(CarNeedPlanVo data) {
|
||||
try{
|
||||
CarNeedPlanVo hisData=mapper.getNeedPlanDetails(data);
|
||||
if(hisData.getStatusType()!=2 && hisData.getStatus()!=3){
|
||||
return ServerResponse.createErroe("该计划已被审核不允许删除,请刷新重试");
|
||||
try {
|
||||
CarNeedPlanVo hisData = mapper.getNeedPlanDetails(data);
|
||||
if (hisData.getStatusType() != 2 && hisData.getStatus() != 3) {
|
||||
return ServerResponse.createErroe("该计划已被审核不允许删除,请刷新重试");
|
||||
}
|
||||
int num=mapper.deleteNeedPlanData(data);
|
||||
int num2=mapper.deleteNeedPlanDetailsData(data);
|
||||
if(num>0){
|
||||
return ServerResponse.createSuccess("删除成功","删除成功");
|
||||
int num = mapper.deleteNeedPlanData(data);
|
||||
int num2 = mapper.deleteNeedPlanDetailsData(data);
|
||||
if (num > 0) {
|
||||
return ServerResponse.createSuccess("删除成功", "删除成功");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CarNeedPlanDetailVo> getCarNeedPlanDetailsList(CarNeedPlanVo dto) {
|
||||
try {
|
||||
List<CarNeedPlanDetailVo> list= mapper.getCarNeedPlanDetailsList(dto);
|
||||
if(ListHelpUtil.isNotEmpty(list)){
|
||||
List<CarNeedPlanDetailVo> list = mapper.getCarNeedPlanDetailsList(dto);
|
||||
if (ListHelpUtil.isNotEmpty(list)) {
|
||||
final int[] num = {1};
|
||||
list.forEach(vo->{
|
||||
list.forEach(vo -> {
|
||||
vo.setXh(num[0]);
|
||||
num[0]++;
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString());
|
||||
}
|
||||
return new ArrayList<CarNeedPlanDetailVo>();
|
||||
|
|
@ -328,32 +342,30 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService{
|
|||
public List<CarNeedPlanDetailVo> getNeedPlanDetailsList(CarNeedPlanVo data) {
|
||||
try {
|
||||
return mapper.getNeedDetailInfo(data);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString());
|
||||
}
|
||||
return new ArrayList<CarNeedPlanDetailVo>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
private String getPlanCode(CarNeedPlanVo vo) {
|
||||
int num =mapper.getPlanCode();
|
||||
int num = mapper.getPlanCode();
|
||||
num++;
|
||||
String year= DateTimeHelper.getNowYMD();
|
||||
if(num<10) {
|
||||
return year+"00"+num;
|
||||
}else if(num<100) {
|
||||
return year+"0"+num;
|
||||
String year = DateTimeHelper.getNowYMD();
|
||||
if (num < 10) {
|
||||
return year + "00" + num;
|
||||
} else if (num < 100) {
|
||||
return year + "0" + num;
|
||||
}
|
||||
if("1".equals(vo.getApplyType())){
|
||||
return "spec"+year+num;
|
||||
if ("1".equals(vo.getApplyType())) {
|
||||
return "spec" + year + num;
|
||||
}
|
||||
return year+num;
|
||||
return year + num;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -362,7 +374,7 @@ public class CarNeedPlanServiceImpl implements CarNeedPlanService{
|
|||
// 计划申请 status :0, status_type:0 表示撤回
|
||||
// 审批记录 status :0, status_type:-1 表示撤回
|
||||
mapper.withdrawData(dto);
|
||||
recordService.addRecord(dto.getId(),"0","-1","4","","0");
|
||||
recordService.addRecord(dto.getId(), "0", "-1", "4", "", "0");
|
||||
return ServerResponse.createBySuccessMsg("撤回成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
|
|||
|
|
@ -178,8 +178,12 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService {
|
|||
List<FileUploadVo> operaImage = uploadService.getFileList(detailsVo.getOperaUserId(), "car_driver_info", "");
|
||||
detailsVo.setOperaImage(operaImage);
|
||||
}
|
||||
List<AuditRecordVo> recordList=recordService.getRecordList(vo.getPlanId());
|
||||
List<AuditRecordVo> record = recordService.getRecordList("out-" + data.getId());
|
||||
vo.setRecordList(record);
|
||||
List<AuditRecordVo> supRecord = recordService.getSupRecordList(data.getId());
|
||||
record.addAll(supRecord);
|
||||
recordList.addAll(record);
|
||||
vo.setRecordList(recordList);
|
||||
vo.setDetailsVoList(list);
|
||||
}
|
||||
return ServerResponse.createSuccess("查询成功", vo);
|
||||
|
|
|
|||
|
|
@ -31,5 +31,5 @@ public interface AuditRecordMapper {
|
|||
String getUpTimes(@Param("id") String id,@Param("auditType") int statusType);
|
||||
|
||||
|
||||
|
||||
List<AuditRecordVo> getSupRecordList(String id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import java.util.Objects;
|
|||
|
||||
/**
|
||||
* 审核节点数据添加及删除
|
||||
*
|
||||
* @author 黑子
|
||||
*/
|
||||
@Service
|
||||
|
|
@ -30,21 +31,22 @@ public class AuditRecordService {
|
|||
|
||||
/**
|
||||
* 添加记录数据
|
||||
* @param applyId 审计id
|
||||
*
|
||||
* @param applyId 审计id
|
||||
* @param auditStatus 深恶黑状态
|
||||
* @param auditType 审核节点
|
||||
* @param type 类型
|
||||
* @param auditType 审核节点
|
||||
* @param type 类型
|
||||
* @return
|
||||
*/
|
||||
public int addRecord(String applyId,String auditStatus,String auditType,String type,String remark,String times){
|
||||
public int addRecord(String applyId, String auditStatus, String auditType, String type, String remark, String times) {
|
||||
try {
|
||||
AuditRecordVo vo=new AuditRecordVo();
|
||||
if(StringHelper.isNotEmpty(times)){
|
||||
String time = DateTimeHelper.getTimeDiff(DateTimeHelper.getNowTime(),times);
|
||||
AuditRecordVo vo = new AuditRecordVo();
|
||||
if (StringHelper.isNotEmpty(times)) {
|
||||
String time = DateTimeHelper.getTimeDiff(DateTimeHelper.getNowTime(), times);
|
||||
vo.setTimes(time);
|
||||
}
|
||||
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
String userName=UserUtil.getLoginUser().getUsername();
|
||||
String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
|
||||
String userName = UserUtil.getLoginUser().getUsername();
|
||||
vo.setApplyId(applyId);
|
||||
vo.setCreator(userId);
|
||||
vo.setAuditTime(DateTimeHelper.getNowTime());
|
||||
|
|
@ -54,55 +56,66 @@ public class AuditRecordService {
|
|||
vo.setAuditRemark(remark);
|
||||
vo.setUserName(userName);
|
||||
vo.setAuditor(userId);
|
||||
return mapper.addRecord(vo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return mapper.addRecord(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询审核记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<AuditRecordVo> getRecordList(String id){
|
||||
public List<AuditRecordVo> getRecordList(String id) {
|
||||
try {
|
||||
return mapper.getRecordList(id);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return mapper.getRecordList(id);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询上个节点时间
|
||||
*
|
||||
* @param id
|
||||
* @param statusType
|
||||
* @return
|
||||
*/
|
||||
public String getUpTimes(String id, int statusType,int status) {
|
||||
if(status==2){
|
||||
statusType=statusType-1;
|
||||
if(statusType==3){
|
||||
return mapper.getUpTimes(id,1);
|
||||
}else{
|
||||
return mapper.getUpTimes(id,statusType);
|
||||
}
|
||||
}else{
|
||||
return mapper.getUpTimes(id,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getUpTimes(String id,int status) {
|
||||
//发车审核
|
||||
if(status==3){
|
||||
status=2;
|
||||
return mapper.getUpTimes(id,status);
|
||||
}else{
|
||||
return mapper.getUpTimes(id,1);
|
||||
public String getUpTimes(String id, int statusType, int status) {
|
||||
if (status == 2) {
|
||||
statusType = statusType - 1;
|
||||
if (statusType == 3) {
|
||||
return mapper.getUpTimes(id, 1);
|
||||
} else {
|
||||
return mapper.getUpTimes(id, statusType);
|
||||
}
|
||||
} else {
|
||||
return mapper.getUpTimes(id, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getUpTimes(String id, int status) {
|
||||
//发车审核
|
||||
if (status == 3) {
|
||||
status = 2;
|
||||
return mapper.getUpTimes(id, status);
|
||||
} else {
|
||||
return mapper.getUpTimes(id, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<AuditRecordVo> getSupRecordList(String id) {
|
||||
try {
|
||||
return mapper.getSupRecordList(id);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,21 +149,24 @@
|
|||
order by cpo.create_time desc
|
||||
</select>
|
||||
<select id="getSltDetailsInfo" resultType="com.bonus.gzcar.business.backstage.entity.CarBalanceDetailsVo">
|
||||
select cpa.code,cs.name supName ,pro.name proName ,cpa.id planId ,cpa.dispatch_num carNum ,
|
||||
cpa.dispatch_day dispatchDay ,my.money ,csp.slt_id sltId ,
|
||||
cpa.remark
|
||||
from car_plan_apply cpa
|
||||
left join car_plan_apply_sup cpas on cpa.id=cpas.apply_id
|
||||
left join car_supplier cs on cs.id =cpas.sup_id
|
||||
left join bm_project pro on pro.bid_id=cpa.pro_id
|
||||
left join (
|
||||
select sum(money) money,apply_id
|
||||
from car_plan_out
|
||||
WHERE status=1
|
||||
GROUP BY apply_id
|
||||
)my on my.apply_id=cpa.id
|
||||
left join car_slt_plan csp on csp.plan_id=cpa.id
|
||||
where cpa.id=#{planId}
|
||||
select cpa.code,
|
||||
cs.name supName,
|
||||
pro.name proName,
|
||||
cpa.id planId,
|
||||
cpa.dispatch_num carNum,
|
||||
cpa.dispatch_day dispatchDay,
|
||||
my.money,
|
||||
csp.slt_id sltId,
|
||||
cpa.remark
|
||||
from car_plan_apply cpa
|
||||
left join car_plan_apply_sup cpas on cpa.id = cpas.apply_id
|
||||
left join car_supplier cs on cs.id = cpas.sup_id
|
||||
left join bm_project pro on pro.bid_id = cpa.pro_id
|
||||
left join (select sum(money) money, apply_id
|
||||
from car_plan_out
|
||||
GROUP BY apply_id) my on my.apply_id = cpa.id
|
||||
left join car_slt_plan csp on csp.plan_id = cpa.id
|
||||
where cpa.id = #{planId}
|
||||
</select>
|
||||
<select id="getOutIdByPlanId" resultType="java.lang.String">
|
||||
SELECT id
|
||||
|
|
|
|||
|
|
@ -107,17 +107,36 @@
|
|||
</select>
|
||||
<!--查询需求计划详情-->
|
||||
<select id="getNeedPlanDetails" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo">
|
||||
select
|
||||
cpa.id, cpa.code, cpa.type , cpa.pro_id proId, cpa.project_part projectPart, cpa.project_content projectContent,
|
||||
cpa.need_time needTime, cpa.creator,DATE_FORMAT(cpa.create_time,'%Y-%m-%d') appLyTime,pro.name proName,
|
||||
cpa.remark, cpa.status, cpa.updater, cpa.update_time updateTime,
|
||||
if(cpa.type=1,'车辆','吊车') typeName ,
|
||||
cpa.apply_type applyType, cpa.status_type statusType,cpa.user_name userName,
|
||||
cpa.car_length as carLength,cpa.car_width as carWidth ,cpa.car_height as carHeight ,cpa.car_weight as carWeight,
|
||||
cpa.car_start as carStart ,cpa.car_end as carEnd,cpa.route_point as routePoint
|
||||
select cpa.id,
|
||||
cpa.code,
|
||||
cpo.id AS outId,
|
||||
cpa.type,
|
||||
cpa.pro_id proId,
|
||||
cpa.project_part projectPart,
|
||||
cpa.project_content projectContent,
|
||||
cpa.need_time needTime,
|
||||
cpa.creator,
|
||||
DATE_FORMAT(cpa.create_time, '%Y-%m-%d') appLyTime,
|
||||
pro.name proName,
|
||||
cpa.remark,
|
||||
cpa.status,
|
||||
cpa.updater,
|
||||
cpa.update_time updateTime,
|
||||
if(cpa.type = 1, '车辆', '吊车') typeName,
|
||||
cpa.apply_type applyType,
|
||||
cpa.status_type statusType,
|
||||
cpa.user_name userName,
|
||||
cpa.car_length as carLength,
|
||||
cpa.car_width as carWidth,
|
||||
cpa.car_height as carHeight,
|
||||
cpa.car_weight as carWeight,
|
||||
cpa.car_start as carStart,
|
||||
cpa.car_end as carEnd,
|
||||
cpa.route_point as routePoint
|
||||
from car_plan_apply cpa
|
||||
left join bm_project pro on pro.bid_id=cpa.pro_id
|
||||
where cpa.id=#{id}
|
||||
LEFT JOIN car_plan_out cpo ON cpo.apply_id = cpa.id
|
||||
left join bm_project pro on pro.bid_id = cpa.pro_id
|
||||
where cpa.id = #{id}
|
||||
</select>
|
||||
<select id="getNeedDetailInfo" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanDetailVo">
|
||||
select cpd.id, cpd.apply_id planId, cpd.model_id modelId, cpd.need_day needDay, cpd.need_num needNum,
|
||||
|
|
|
|||
|
|
@ -27,5 +27,31 @@
|
|||
limit 1
|
||||
|
||||
</select>
|
||||
<select id="getSupRecordList" resultType="com.bonus.gzcar.business.system.entity.AuditRecordVo">
|
||||
select cpa.id applyId,
|
||||
cpa.update_time AS auditTime,
|
||||
cs.name nikeName,
|
||||
'5' AS auditType,
|
||||
'2' AS auditStatus,
|
||||
CONCAT(
|
||||
-- 小时数:总分钟数 ÷ 60(向下取整)
|
||||
FLOOR(TIMESTAMPDIFF(MINUTE, cpa.create_time, COALESCE(cpa.update_time, cpa.create_time)) / 60),
|
||||
'小时',
|
||||
-- 分钟数:总分钟数 % 60(取余数),不足10补零(可选)
|
||||
LPAD(TIMESTAMPDIFF(MINUTE, cpa.create_time, COALESCE(cpa.update_time, cpa.create_time)) % 60,
|
||||
2, '0'),
|
||||
'分'
|
||||
)
|
||||
AS times,
|
||||
'' AS phone,
|
||||
if(sum(cpa.need_num) = sum(cpa.dispatch_num), '全部派车',
|
||||
if(sum(cpa.dispatch_num) > 0, '部分派车', '待派车')) auditRemark
|
||||
from car_plan_apply cpa
|
||||
LEFT JOIN car_plan_apply_sup cpas ON cpas.apply_id = cpa.id
|
||||
LEFT JOIN car_supplier cs ON cs.id = cpas.sup_id
|
||||
where cpa.id = #{id}
|
||||
and cs.name is not null
|
||||
GROUP BY cpa.pro_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue