|
@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
|
|
|
import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
|
|
|
import com.ym.mec.biz.dal.entity.Employee;
|
|
|
import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
|
|
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RequestMapping("replacementInstrumentActivity")
|
|
@@ -34,6 +36,8 @@ public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
|
+ @Autowired
|
|
|
+ private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
|
|
|
|
|
|
@ApiOperation(value = "分页查询列表")
|
|
|
@GetMapping("/queryPage")
|
|
@@ -46,11 +50,11 @@ public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
Employee employee = employeeDao.get(sysUser.getId());
|
|
|
if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
- }else if(StringUtils.isEmpty(employee.getOrganIdList())){
|
|
|
+ } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
return failed("用户所在分部异常");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
- if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
return failed("非法请求");
|
|
|
}
|
|
|
}
|
|
@@ -67,11 +71,11 @@ public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
Employee employee = employeeDao.get(sysUser.getId());
|
|
|
if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
- }else if(StringUtils.isEmpty(employee.getOrganIdList())){
|
|
|
+ } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
return failed("用户所在分部异常");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
- if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
return failed("非法请求");
|
|
|
}
|
|
|
}
|
|
@@ -82,10 +86,12 @@ public class ReplacementInstrumentActivityController extends BaseController {
|
|
|
@GetMapping("/update")
|
|
|
@PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/update')")
|
|
|
public HttpResponseResult<ReplacementInstrumentActivity> update(ReplacementInstrumentActivity replacementInstrumentActivity) {
|
|
|
- ReplacementInstrumentActivity old = replacementInstrumentActivityService.get(replacementInstrumentActivity.getId());
|
|
|
- if (old.getInstrumentsId().equals(replacementInstrumentActivity.getInstrumentsId())) {
|
|
|
+ ReplacementInstrumentActivity oldReplacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementInstrumentActivity.getId());
|
|
|
+ if (oldReplacementInstrumentActivity.getInstrumentsId().equals(replacementInstrumentActivity.getInstrumentsId())) {
|
|
|
return succeed();
|
|
|
}
|
|
|
+ oldReplacementInstrumentActivity.setInstrumentsId(replacementInstrumentActivity.getInstrumentsId());
|
|
|
+ oldReplacementInstrumentActivity.setUpdateTime(new Date());
|
|
|
replacementInstrumentActivityService.update(replacementInstrumentActivity);
|
|
|
return succeed(replacementInstrumentActivity);
|
|
|
}
|