|
@@ -37,66 +37,66 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class ScaleContentFacade extends ScaleContentServiceImpl {
|
|
|
|
|
|
- @Autowired
|
|
|
- @Qualifier("scaleContentServiceImpl")
|
|
|
- ScaleContentService scaleContentService;
|
|
|
- @Autowired
|
|
|
- UserServiceClient userServiceClient;
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("scaleContentServiceImpl")
|
|
|
+ ScaleContentService scaleContentService;
|
|
|
+ @Autowired
|
|
|
+ UserServiceClient userServiceClient;
|
|
|
|
|
|
- /**
|
|
|
- * 量表内容新增或更新
|
|
|
- *
|
|
|
- * @param scaleContentSaveVO
|
|
|
- */
|
|
|
- public void insertOrUpdate(ScaleContentSaveVO scaleContentSaveVO) {
|
|
|
- Long scaleId = scaleContentSaveVO.getScaleId();
|
|
|
- Date now = DateUtil.now();
|
|
|
- String userId = "ddd";
|
|
|
- //删除原关联内容
|
|
|
- if(scaleId != null) {
|
|
|
- this.update(new ScaleContent(), new UpdateWrapper<ScaleContent>()
|
|
|
- .eq("scale_id", scaleId)
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .set("gmt_modified", now)
|
|
|
- .set("modifier", userId)
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
- }
|
|
|
- //新增关联内容
|
|
|
- List<ScaleContent> list = new ArrayList<>();
|
|
|
- List<ScaleContentVO> scaleContentVOS = scaleContentSaveVO.getContent();
|
|
|
- for(ScaleContentVO scaleContentVO : scaleContentVOS) {
|
|
|
- ScaleContent bean = new ScaleContent();
|
|
|
- BeanUtil.copyProperties(scaleContentVO, bean);
|
|
|
- bean.setScaleId(scaleId);
|
|
|
- bean.setModifier(userId);
|
|
|
- bean.setCreator(userId);
|
|
|
- bean.setGmtCreate(now);
|
|
|
- bean.setGmtModified(now);
|
|
|
- list.add(bean);
|
|
|
- }
|
|
|
- scaleContentService.saveBatch(list);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 量表内容新增或更新
|
|
|
+ *
|
|
|
+ * @param scaleContentSaveVO
|
|
|
+ */
|
|
|
+ public void insertOrUpdate(ScaleContentSaveVO scaleContentSaveVO) {
|
|
|
+ Long scaleId = scaleContentSaveVO.getScaleId();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ String userId = "ddd";
|
|
|
+ //删除原关联内容
|
|
|
+ if (scaleId != null) {
|
|
|
+ this.update(new ScaleContent(), new UpdateWrapper<ScaleContent>()
|
|
|
+ .eq("scale_id", scaleId)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .set("gmt_modified", now)
|
|
|
+ .set("modifier", userId)
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
+ }
|
|
|
+ //新增关联内容
|
|
|
+ List<ScaleContent> list = new ArrayList<>();
|
|
|
+ List<ScaleContentVO> scaleContentVOS = scaleContentSaveVO.getContent();
|
|
|
+ for (ScaleContentVO scaleContentVO : scaleContentVOS) {
|
|
|
+ ScaleContent bean = new ScaleContent();
|
|
|
+ BeanUtil.copyProperties(scaleContentVO, bean);
|
|
|
+ bean.setScaleId(scaleId);
|
|
|
+ bean.setModifier(userId);
|
|
|
+ bean.setCreator(userId);
|
|
|
+ bean.setGmtCreate(now);
|
|
|
+ bean.setGmtModified(now);
|
|
|
+ list.add(bean);
|
|
|
+ }
|
|
|
+ scaleContentService.saveBatch(list);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 量表列表
|
|
|
- *
|
|
|
- * @param questionPageVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public IPage<QuestionPageDTO> getListFac(QuestionPageVO questionPageVO) {
|
|
|
- IPage<QuestionPageDTO> res = this.getList(questionPageVO);
|
|
|
- if (res.getTotal() <= 0) {
|
|
|
- return res;
|
|
|
- }
|
|
|
- List<String> personIds = res.getRecords().stream().map(row -> row.getModifier()).collect(Collectors.toList());
|
|
|
- RespDTO<Map<String, String>> mapRespDTO = userServiceClient.getUserInfoByIds(personIds);
|
|
|
- if (mapRespDTO == null || !CommonErrorCode.OK.getCode().equals(mapRespDTO.code)) {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR, "获取操作人失败");
|
|
|
- }
|
|
|
- for (QuestionPageDTO bean : res.getRecords()) {
|
|
|
- bean.setModifier(mapRespDTO.data.get(bean.getModifier()));
|
|
|
- }
|
|
|
- return res;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 量表列表
|
|
|
+ *
|
|
|
+ * @param questionPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<QuestionPageDTO> getListFac(QuestionPageVO questionPageVO) {
|
|
|
+ IPage<QuestionPageDTO> res = this.getList(questionPageVO);
|
|
|
+ if (res.getTotal() <= 0) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ List<String> personIds = res.getRecords().stream().map(row -> row.getModifier()).collect(Collectors.toList());
|
|
|
+ RespDTO<Map<String, String>> mapRespDTO = userServiceClient.getUserInfoByIds(personIds);
|
|
|
+ if (mapRespDTO == null || !CommonErrorCode.OK.getCode().equals(mapRespDTO.code)) {
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "获取操作人失败");
|
|
|
+ }
|
|
|
+ for (QuestionPageDTO bean : res.getRecords()) {
|
|
|
+ bean.setModifier(mapRespDTO.data.get(bean.getModifier()));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|