|
|
@ -46,6 +46,7 @@ import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -78,6 +79,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
public BusinessAlert addBusinessAlert(BusinessAlertVo param) { |
|
|
|
BusinessAlert alert = MapstructUtils.convert(param, BusinessAlert.class); |
|
|
|
alert.setCreateTime(new Date()); |
|
|
|
alert.setCaseNumber(param.getCaseNumber()); |
|
|
|
alert.setJobName(alert.getDeptName()+alert.getLabelCn()+ DateUtils.getTime()); |
|
|
|
this.baseMapper.insert(alert); |
|
|
|
return alert; |
|
|
@ -86,6 +88,8 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
@Override |
|
|
|
public void addBusinessAlertList(List<BusinessAlertVo> alertVoList) { |
|
|
|
if(!alertVoList.isEmpty()) { |
|
|
|
incrementalCount(alertVoList); |
|
|
|
|
|
|
|
List<RemoteStartProcess> remoteStartProcessList = new ArrayList<>(); |
|
|
|
for (BusinessAlertVo alertVo : alertVoList) { |
|
|
|
alertVo.setBusinessType(2); |
|
|
@ -680,7 +684,35 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void batchUpdateDept(List<BusinessAlertVo> alertVoList) { |
|
|
|
//更新部门
|
|
|
|
this.baseMapper.batchUpdateDept(alertVoList); |
|
|
|
|
|
|
|
incrementalCount(alertVoList); |
|
|
|
|
|
|
|
//更新number
|
|
|
|
this.baseMapper.batchUpdateCaseNumber(alertVoList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 创建递归caseNumber |
|
|
|
* @param alertVoList |
|
|
|
*/ |
|
|
|
public void incrementalCount(List<BusinessAlertVo> alertVoList){ |
|
|
|
//查询当天时间有多少条预警
|
|
|
|
Integer currentCount = this.baseMapper.selectCurrentAlertCount(DateUtils.getDate()); |
|
|
|
//获取当天的时间戳
|
|
|
|
String currentDate = DateUtils.getDate().replace("-",""); |
|
|
|
|
|
|
|
//然后0 + 个数 + 1 当前年月日 例如 202505150 total + 1
|
|
|
|
AtomicInteger number = new AtomicInteger(1); |
|
|
|
|
|
|
|
alertVoList.forEach(alertVo -> { |
|
|
|
int incremental = currentCount + number.get(); |
|
|
|
alertVo.setCaseNumber(currentDate + "0" + incremental); |
|
|
|
number.getAndIncrement(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -780,6 +812,25 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
return businessAlerts; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean transferAlert(BusinessAlertVo vo) { |
|
|
|
if (ObjectUtil.hasEmpty(vo.getId(),vo.getDeptId(),vo.getDeptName())){ |
|
|
|
throw new RuntimeException("参数为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
BusinessAlert businessAlert = this.baseMapper.selectById(vo.getId()); |
|
|
|
|
|
|
|
LambdaUpdateWrapper<BusinessAlert> wrapper = new LambdaUpdateWrapper<>(); |
|
|
|
wrapper.eq(BusinessAlert::getId, businessAlert.getId()); |
|
|
|
|
|
|
|
wrapper.set(BusinessAlert::getDeptId,vo.getDeptId()); |
|
|
|
wrapper.set(BusinessAlert::getDeptName,vo.getDeptName()); |
|
|
|
wrapper.set(BusinessAlert::getJobName,vo.getDeptName() + businessAlert.getLabelCn() + businessAlert.getCreateTime()); |
|
|
|
|
|
|
|
|
|
|
|
return this.baseMapper.update(wrapper) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
System.out.println(getLastSixDays()); |
|
|
|