/*
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
*
|
* Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
*
|
* Redistributions of source code must retain the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
* Redistributions in binary form must reproduce the above copyright
|
* notice, this list of conditions and the following disclaimer in the
|
* documentation and/or other materials provided with the distribution.
|
* Neither the name of the dreamlu.net developer nor the names of its
|
* contributors may be used to endorse or promote products derived from
|
* this software without specific prior written permission.
|
* Author: Chill 庄骞 (smallchill@163.com)
|
*/
|
package org.springblade.modules.repairsorder.service.impl;
|
|
import org.springblade.common.constant.NoConstant;
|
import org.springblade.core.secure.BladeUser;
|
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.modules.eventgm.entity.EventgmRecordEntity;
|
import org.springblade.modules.eventgm.service.IEventgmRecordService;
|
import org.springblade.modules.repairsorder.entity.RepairsorderEntity;
|
import org.springblade.modules.repairsorder.entity.RepairsorderRecordEntity;
|
import org.springblade.modules.repairsorder.service.IRepairsorderRecordService;
|
import org.springblade.modules.repairsorder.vo.RepairsorderVO;
|
import org.springblade.modules.repairsorder.mapper.RepairsorderMapper;
|
import org.springblade.modules.repairsorder.service.IRepairsorderService;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.utils.NumberUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import org.springframework.transaction.annotation.Transactional;
|
|
/**
|
* 维修工单 服务实现类
|
*
|
* @author aix
|
* @since 2022-09-14
|
*/
|
@Service
|
@Transactional
|
public class RepairsorderServiceImpl extends BaseServiceImpl<RepairsorderMapper, RepairsorderEntity> implements IRepairsorderService {
|
|
@Autowired
|
private IRepairsorderRecordService repairsorderRecordService;
|
|
@Override
|
public IPage<RepairsorderVO> selectRepairsorderPage(IPage<RepairsorderVO> page, RepairsorderVO repairsorder) {
|
return page.setRecords(baseMapper.selectRepairsorderPage(page, repairsorder));
|
}
|
|
@Override
|
public boolean save(RepairsorderEntity entity) {
|
RepairsorderVO vo = this.getRepairsorderMaxNo();
|
String str = "";
|
if (vo != null) {
|
str = vo.getNo();
|
}
|
entity.setNo(NumberUtils.autoCreateNumber(NoConstant.WXGL_PREFIX_NO,str));
|
RepairsorderRecordEntity rrentity = new RepairsorderRecordEntity();
|
rrentity.setState("0");
|
rrentity.setRemark("工单提交");
|
BladeUser user = AuthUtil.getUser();
|
rrentity.setRepairPerson(user.getNickName());
|
rrentity.setNo(entity.getNo());
|
repairsorderRecordService.save(rrentity);
|
return super.save(entity);
|
}
|
|
@Override
|
public boolean saveOrUpdate(RepairsorderEntity entity) {
|
return entity.getId() == null ? this.save(entity) : this.updateById(entity);
|
}
|
|
@Override
|
public RepairsorderVO getRepairsorderMaxNo() {
|
return baseMapper.getRepairsorderMaxNo();
|
}
|
|
|
}
|