转群功能优化
This commit is contained in:
parent
f9e215458d
commit
861dae546a
@ -101,8 +101,8 @@ public class ScTransGroupController extends BaseController {
|
||||
/**
|
||||
* 审批转群记录
|
||||
*/
|
||||
@PutMapping("/approve")
|
||||
public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) {
|
||||
return toAjax(scTransGroupService.approveScTransGroup(scTransGroup));
|
||||
}
|
||||
// @PutMapping("/approve")
|
||||
// public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) {
|
||||
// return toAjax(scTransGroupService.approveScTransGroup(scTransGroup));
|
||||
// }
|
||||
}
|
||||
|
@ -73,11 +73,21 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
||||
*/
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertScTransGroup(ScTransGroup scTransGroup) {
|
||||
scTransGroup.setStatus(0);
|
||||
scTransGroup.setCreateTime(DateUtils.getNowDate());
|
||||
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) {
|
||||
Long foldTo = Long.valueOf(transGroup.getFoldTo());
|
||||
if (foldTo == null) {
|
||||
throw new RuntimeException("转入羊舍不能为空");
|
||||
Object foldToObj = transGroup.getFoldTo();
|
||||
if (foldToObj == null) {
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user