package com.fdkankan.sale.service.impl;
import java.util.Date;
import java.util.List;
import java.util.WeakHashMap;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fdkankan.sale.entity.RepairLog;
import com.fdkankan.sale.mapper.IRepairLogMapper;
import com.fdkankan.sale.service.IRepairLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fdkankan.sale.service.IRepairPayService;
import com.fdkankan.sale.service.IRepairService;
import com.fdkankan.sale.vo.response.RepairLogVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.text.rtf.RTFEditorKit;
/**
*
* 服务实现类
*
*
* @author
* @since 2022-12-13
*/
@Service
public class RepairLogServiceImpl extends ServiceImpl implements IRepairLogService {
@Autowired
IRepairService repairService;
@Autowired
DingService dingService;
/**
* * status 0待接单,10待检测,20待报价,30待确认,40已取消,50待备料,60维修中,70待测试,
* * 80待支付(已完结),90待回收,100待发货,110已发货
*/
@Override
public RepairLog saveBySysUser(Long sysUserId, String repairId,Integer repairStatus,Integer oldRepairStatus,String remark) {
RepairLog repairLog = new RepairLog();
repairLog.setRepairId(repairId);
repairLog.setRepairStatus(repairStatus);
repairLog.setSysUserId(sysUserId);
repairLog.setRemark(remark);
repairLog.setOldRepairStatus(oldRepairStatus);
this.save(repairLog);
repairService.updateRepairStatus(repairId,repairStatus);
dingService.sendDingMsg(repairLog);
return repairLog;
}
@Override
public RepairLog saveBySysUser(Long sysUserId, String repairId, Integer repairStatus,Integer oldRepairStatus, String remark, Integer testId) {
RepairLog repairLog = new RepairLog();
repairLog.setRepairId(repairId);
repairLog.setRepairStatus(repairStatus);
repairLog.setSysUserId(sysUserId);
repairLog.setRemark(remark);
repairLog.setTestId(testId);
repairLog.setOldRepairStatus(oldRepairStatus);
this.save(repairLog);
repairService.updateRepairStatus(repairId,repairStatus);
dingService.sendDingMsg(repairLog);
return repairLog;
}
@Override
public RepairLog saveBySysUser(Long sysUserId, String repairId, Integer repairStatus,Integer oldRepairStatus, String remark, Integer testId,Integer registerLogId) {
RepairLog repairLog = new RepairLog();
repairLog.setRepairId(repairId);
repairLog.setRepairStatus(repairStatus);
repairLog.setSysUserId(sysUserId);
repairLog.setRemark(remark);
repairLog.setRegisterLogId(registerLogId);
repairLog.setOldRepairStatus(oldRepairStatus);
this.save(repairLog);
repairService.updateRepairStatus(repairId,repairStatus);
dingService.sendDingMsg(repairLog);
return repairLog;
}
@Override
public List getByRepairIdAndStatus(String repairId, Integer status) {
LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
wrapper.eq(RepairLog::getRepairId,repairId);
wrapper.eq(RepairLog::getRepairStatus,status);
return this.list(wrapper);
}
@Override
public List getByRepairId(String repairId) {
LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
wrapper.eq(RepairLog::getRepairId,repairId);
wrapper.orderByDesc(RepairLog::getCreateTime);
return list(wrapper);
}
@Override
public List getVoByRepairId(String repairId) {
return this.getBaseMapper().getVoByRepairId(repairId);
}
@Override
public List getBySysUserId(Long sysUserId) {
LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
wrapper.eq(RepairLog::getSysUserId,sysUserId);
wrapper.orderByDesc(RepairLog::getCreateTime);
return this.list(wrapper);
}
}