Authored by zhaoyue

ADD code for uspih

@@ -3,6 +3,7 @@ package com.xkl.authorization.resolvers; @@ -3,6 +3,7 @@ package com.xkl.authorization.resolvers;
3 import com.xkl.authorization.annotation.CurrentAdmin; 3 import com.xkl.authorization.annotation.CurrentAdmin;
4 import com.xkl.config.Constants; 4 import com.xkl.config.Constants;
5 import com.xkl.controller.uploadsoft.UpSoftAccountController; 5 import com.xkl.controller.uploadsoft.UpSoftAccountController;
  6 +import com.xkl.controller.uspih.AdminAccountController;
6 import com.xkl.domain.XklAdminEntity; 7 import com.xkl.domain.XklAdminEntity;
7 import com.xkl.repository.AdminRepository; 8 import com.xkl.repository.AdminRepository;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,7 +40,8 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument @@ -39,7 +40,8 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument
39 @Override 40 @Override
40 public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { 41 public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
41 //取出鉴权时存入的登录用户Id 42 //取出鉴权时存入的登录用户Id
42 - String currentAdminId = ((String) webRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST)).replace(UpSoftAccountController.UPSOFT_TOKEN_PREFIX, ""); 43 + String currentAdminId = ((String) webRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST)).
  44 + replace(UpSoftAccountController.UPSOFT_TOKEN_PREFIX, "").replace(AdminAccountController.USPIH_TOKEN_PREFIX, "");
43 if (currentAdminId != null) { 45 if (currentAdminId != null) {
44 //从数据库中查询并返回 46 //从数据库中查询并返回
45 XklAdminEntity admin = adminRepository.findByIdAndStatus(Long.parseLong(currentAdminId), Constants.STATUS_OK); 47 XklAdminEntity admin = adminRepository.findByIdAndStatus(Long.parseLong(currentAdminId), Constants.STATUS_OK);
@@ -127,6 +127,8 @@ public class ReportService implements IReportService { @@ -127,6 +127,8 @@ public class ReportService implements IReportService {
127 reportRepository.delete(report); 127 reportRepository.delete(report);
128 List<XklAmpReportDetailEntity> detailList = reportDetailRepository.findByReportId(report.getId()); 128 List<XklAmpReportDetailEntity> detailList = reportDetailRepository.findByReportId(report.getId());
129 reportDetailRepository.delete(detailList); 129 reportDetailRepository.delete(detailList);
  130 + List<XklAmpReportResultEntity> rpResList = reportResultRepository.findByReportId(report.getId());
  131 + reportResultRepository.delete(rpResList);
130 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); 132 return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
131 } 133 }
132 134
@@ -219,7 +221,7 @@ public class ReportService implements IReportService { @@ -219,7 +221,7 @@ public class ReportService implements IReportService {
219 rpRes.setReportId(ampReport.getId()); 221 rpRes.setReportId(ampReport.getId());
220 } 222 }
221 reportDetailRepository.save(report.getRpDetailList()); 223 reportDetailRepository.save(report.getRpDetailList());
222 - reportResultRepository.save(report.getBasicResList()); 224 + reportResultRepository.save(report.getBasicResList());
223 return ampReport.getId(); 225 return ampReport.getId();
224 } 226 }
225 227