转群功能优化

This commit is contained in:
zyh 2025-08-19 18:01:09 +08:00
parent f9e215458d
commit 861dae546a
2 changed files with 24 additions and 8 deletions

View File

@ -101,8 +101,8 @@ public class ScTransGroupController extends BaseController {
/** /**
* 审批转群记录 * 审批转群记录
*/ */
@PutMapping("/approve") // @PutMapping("/approve")
public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) { // public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) {
return toAjax(scTransGroupService.approveScTransGroup(scTransGroup)); // return toAjax(scTransGroupService.approveScTransGroup(scTransGroup));
} // }
} }

View File

@ -73,11 +73,21 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int insertScTransGroup(ScTransGroup scTransGroup) { public int insertScTransGroup(ScTransGroup scTransGroup) {
scTransGroup.setStatus(0); scTransGroup.setStatus(0);
scTransGroup.setCreateTime(DateUtils.getNowDate()); scTransGroup.setCreateTime(DateUtils.getNowDate());
scTransGroup.setCreateBy(SecurityUtils.getUsername()); scTransGroup.setCreateBy(SecurityUtils.getUsername());
return scTransGroupMapper.insertScTransGroup(scTransGroup); int rows = scTransGroupMapper.insertScTransGroup(scTransGroup);
if (rows > 0) {
try {
updateSheepFold(scTransGroup);
} catch (Exception e) {
throw new RuntimeException("新增转群记录后更新羊舍失败:" + e.getMessage(), e);
}
}
return rows;
// return scTransGroupMapper.insertScTransGroup(scTransGroup);
} }
/** /**
@ -133,9 +143,15 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
* 更新羊只所在羊舍 * 更新羊只所在羊舍
*/ */
private void updateSheepFold(ScTransGroup transGroup) { private void updateSheepFold(ScTransGroup transGroup) {
Long foldTo = Long.valueOf(transGroup.getFoldTo()); Object foldToObj = transGroup.getFoldTo();
if (foldTo == null) { if (foldToObj == null) {
throw new RuntimeException("转入羊舍不能为空"); throw new RuntimeException("转入羊舍ID为空请检查前端提交的foldTo参数");
}
Long foldTo;
try {
foldTo = Long.valueOf(foldToObj.toString());
} catch (NumberFormatException e) {
throw new RuntimeException("转入羊舍ID格式错误应为数字实际值" + foldToObj);
} }
String manageTags = transGroup.getManageTags(); String manageTags = transGroup.getManageTags();