|
@@ -67,10 +67,14 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type, ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime, Long endTime) {
|
|
|
|
|
|
+ public IPage<TBViolationResult> query(IPage<Map> iPage, Long serviceId, ViolationTypeEnum type,
|
|
|
|
+ ViolationStatusEnum status, Long userId, String custom, String sopNo, Long createId, Long startTime,
|
|
|
|
+ Long endTime) {
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
- return this.baseMapper.query(iPage, serviceId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(status) ? status.name() : null, userId, custom, sopNo, createId, startTime, endTime, dpr);
|
|
|
|
|
|
+ return this.baseMapper.query(iPage, serviceId, Objects.nonNull(type) ? type.name() : null,
|
|
|
|
+ Objects.nonNull(status) ? status.name() : null, userId, custom, sopNo, createId, startTime, endTime,
|
|
|
|
+ dpr);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -84,17 +88,18 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
|
|
try {
|
|
try {
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
if (Objects.isNull(tBViolation.getId())) {// 新增
|
|
if (Objects.isNull(tBViolation.getId())) {// 新增
|
|
- tBViolation.setCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getMark() + sequenceService.createCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getCode()));
|
|
|
|
|
|
+ tBViolation.setCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getMark() + sequenceService.createCode(
|
|
|
|
+ DelayWarnSeqTypeEnum.VIOLATION_WARN.getCode()));
|
|
tBViolation.insertInfo(sysUser.getId());
|
|
tBViolation.insertInfo(sysUser.getId());
|
|
saveOrUpdate(tBViolation);
|
|
saveOrUpdate(tBViolation);
|
|
TBViolationResult tbViolationResult = getByCode(tBViolation.getCode());
|
|
TBViolationResult tbViolationResult = getByCode(tBViolation.getCode());
|
|
|
|
|
|
-// String content = MessageEnum.NOTICE_OF_VIOLATION_REMIND.getTemplate();
|
|
|
|
-// content = content.replaceAll("\\$\\{userName\\}", tbViolationResult.getUserName());
|
|
|
|
-// content = content.replaceAll("\\$\\{serviceName\\}", tbViolationResult.getService());
|
|
|
|
-// content = content.replaceAll("\\$\\{customName\\}", tbViolationResult.getCustom());
|
|
|
|
-// content = content.replaceAll("\\$\\{createUserName\\}", tbViolationResult.getCreateName());
|
|
|
|
-// content = content.replaceAll("\\$\\{violationType\\}", tbViolationResult.getType().getTitle());
|
|
|
|
|
|
+ // String content = MessageEnum.NOTICE_OF_VIOLATION_REMIND.getTemplate();
|
|
|
|
+ // content = content.replaceAll("\\$\\{userName\\}", tbViolationResult.getUserName());
|
|
|
|
+ // content = content.replaceAll("\\$\\{serviceName\\}", tbViolationResult.getService());
|
|
|
|
+ // content = content.replaceAll("\\$\\{customName\\}", tbViolationResult.getCustom());
|
|
|
|
+ // content = content.replaceAll("\\$\\{createUserName\\}", tbViolationResult.getCreateName());
|
|
|
|
+ // content = content.replaceAll("\\$\\{violationType\\}", tbViolationResult.getType().getTitle());
|
|
|
|
|
|
String configKey = SystemConstant.SMS_VIOLATION_REMIND_CODE;
|
|
String configKey = SystemConstant.SMS_VIOLATION_REMIND_CODE;
|
|
Map<String, Object> templateParam = new HashMap<>();
|
|
Map<String, Object> templateParam = new HashMap<>();
|
|
@@ -105,10 +110,15 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
|
|
templateParam.put("violationType", tbViolationResult.getType().getTitle());
|
|
templateParam.put("violationType", tbViolationResult.getType().getTitle());
|
|
|
|
|
|
SysMessage sysMessage = new SysMessage(tBViolation.getCrmNo(), tBViolation.getCode(),
|
|
SysMessage sysMessage = new SysMessage(tBViolation.getCrmNo(), tBViolation.getCode(),
|
|
- MessageTypeEnum.VIOLATION, tBViolation.getType().name(), tBViolation.getServiceId(), tBViolation.getUserId(), tBViolation.getContent(),sysUser.getId());
|
|
|
|
|
|
+ MessageTypeEnum.VIOLATION, tBViolation.getType().name(), tBViolation.getServiceId(),
|
|
|
|
+ tBViolation.getUserId(), tBViolation.getContent(), sysUser.getId());
|
|
sysMessageService.saveSysMessage(Collections.singletonList(sysMessage));
|
|
sysMessageService.saveSysMessage(Collections.singletonList(sysMessage));
|
|
//发送短信
|
|
//发送短信
|
|
- smsSendUtil.sendSms(tbViolationResult.getMobileNumber(), configKey, templateParam);
|
|
|
|
|
|
+ try {
|
|
|
|
+ smsSendUtil.sendSms(tbViolationResult.getMobileNumber(), configKey, templateParam);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
} else { // 修改
|
|
} else { // 修改
|
|
tBViolation.updateInfo(sysUser.getId());
|
|
tBViolation.updateInfo(sysUser.getId());
|
|
saveOrUpdate(tBViolation);
|
|
saveOrUpdate(tBViolation);
|
|
@@ -117,8 +127,10 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
if (e instanceof DuplicateKeyException) {
|
|
if (e instanceof DuplicateKeyException) {
|
|
String errorColumn = e.getCause().toString();
|
|
String errorColumn = e.getCause().toString();
|
|
- String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
|
- throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
|
|
|
|
|
|
+ String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length())
|
|
|
|
+ .replaceAll("'", "");
|
|
|
|
+ throw ExceptionResultEnum.SQL_ERROR.exception(
|
|
|
|
+ "[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
|
|
} else if (e instanceof ApiException) {
|
|
} else if (e instanceof ApiException) {
|
|
ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
} else {
|
|
} else {
|
|
@@ -140,11 +152,13 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
|
|
return this.removeById(id);
|
|
return this.removeById(id);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public TBViolationResult getByCode(String code) {
|
|
public TBViolationResult getByCode(String code) {
|
|
TBViolationResult tbViolationResult = this.baseMapper.getByCode(code);
|
|
TBViolationResult tbViolationResult = this.baseMapper.getByCode(code);
|
|
- List<TBViolationDetail> TBViolationDetails = tbViolationDetailService.list(new QueryWrapper<TBViolationDetail>().lambda().eq(TBViolationDetail::getViolationId, tbViolationResult.getId()).orderByDesc(TBViolationDetail::getCreateTime));
|
|
|
|
|
|
+ List<TBViolationDetail> TBViolationDetails = tbViolationDetailService.list(
|
|
|
|
+ new QueryWrapper<TBViolationDetail>().lambda()
|
|
|
|
+ .eq(TBViolationDetail::getViolationId, tbViolationResult.getId())
|
|
|
|
+ .orderByDesc(TBViolationDetail::getCreateTime));
|
|
tbViolationResult.setTbViolationDetails(TBViolationDetails);
|
|
tbViolationResult.setTbViolationDetails(TBViolationDetails);
|
|
return tbViolationResult;
|
|
return tbViolationResult;
|
|
}
|
|
}
|