|
@@ -1,16 +1,5 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -18,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.VersionDetailDTO;
|
|
|
+import com.diagbot.dto.VersionDetailSpecDTO;
|
|
|
+import com.diagbot.dto.VersionSpecDTO;
|
|
|
import com.diagbot.dto.VersionWrapperDTO;
|
|
|
import com.diagbot.entity.VersionDetail;
|
|
|
import com.diagbot.entity.VersionInfo;
|
|
@@ -29,13 +20,25 @@ import com.diagbot.service.impl.VersionDetailServiceImpl;
|
|
|
import com.diagbot.service.impl.VersionInfoServiceImpl;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
+import com.diagbot.util.IntegerUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.VersionDetailVO;
|
|
|
import com.diagbot.vo.VersionInfoAllVO;
|
|
|
import com.diagbot.vo.VersionInfoIdVO;
|
|
|
import com.diagbot.vo.VersionInfoVO;
|
|
|
+import com.diagbot.vo.VersionVO;
|
|
|
import com.diagbot.vo.VersionWrapperNameVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author wangfeng
|
|
@@ -57,7 +60,7 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public IPage<VersionWrapperDTO> getVersionInfoAll(Page page,VersionWrapperNameVO versionWrapperNameVO) {
|
|
|
+ public IPage<VersionWrapperDTO> getVersionInfoAll(Page page, VersionWrapperNameVO versionWrapperNameVO) {
|
|
|
// 模糊查询最新的一条版本信息
|
|
|
/* QueryWrapper<VersionInfo> versionInfoQuery = new QueryWrapper<>();
|
|
|
versionInfoQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("STATUS", StatusEnum.Enable.getKey())
|
|
@@ -65,7 +68,7 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
|
|
|
// 分页查询
|
|
|
*/ //IPage<VersionInfo> queryUserInformation = page(page, versionInfoQuery);
|
|
|
- IPage<VersionWrapperDTO> queryUserInformation = getVersionInfoAPage(page,versionWrapperNameVO);
|
|
|
+ IPage<VersionWrapperDTO> queryUserInformation = getVersionInfoAPage(page, versionWrapperNameVO);
|
|
|
List<VersionWrapperDTO> versionInfos = queryUserInformation.getRecords();
|
|
|
List<VersionWrapperDTO> versionLists = new ArrayList<VersionWrapperDTO>();
|
|
|
// 取出操作人id
|
|
@@ -81,17 +84,17 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
userNames = userNamesDTO.data;
|
|
|
}
|
|
|
// 当查出的数据不为空时,取到版本id,再去版本明细表中查询详细的信息
|
|
|
- for (VersionWrapperDTO versionInfo : versionInfos) {
|
|
|
- VersionWrapperDTO versionList = new VersionWrapperDTO();
|
|
|
- versionList.setId(versionInfo.getId());
|
|
|
- versionList.setGmtCreate(versionInfo.getGmtCreate());
|
|
|
- versionList.setName(versionInfo.getName());
|
|
|
- versionList.setModifierid(userNames.get(versionInfo.getModifierid()));
|
|
|
- versionList.setRefreshTime(versionInfo.getRefreshTime());
|
|
|
- versionList.setStatus(versionInfo.getStatus());
|
|
|
- versionList.setRemark(versionInfo.getRemark());
|
|
|
- versionLists.add(versionList);
|
|
|
- }
|
|
|
+ for (VersionWrapperDTO versionInfo : versionInfos) {
|
|
|
+ VersionWrapperDTO versionList = new VersionWrapperDTO();
|
|
|
+ versionList.setId(versionInfo.getId());
|
|
|
+ versionList.setGmtCreate(versionInfo.getGmtCreate());
|
|
|
+ versionList.setName(versionInfo.getName());
|
|
|
+ versionList.setModifierid(userNames.get(versionInfo.getModifierid()));
|
|
|
+ versionList.setRefreshTime(versionInfo.getRefreshTime());
|
|
|
+ versionList.setStatus(versionInfo.getStatus());
|
|
|
+ versionList.setRemark(versionInfo.getRemark());
|
|
|
+ versionLists.add(versionList);
|
|
|
+ }
|
|
|
// 取版本id查明细
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
if (versionInfos != null) {
|
|
@@ -182,7 +185,7 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
*/
|
|
|
public boolean updateVersionInfoAll(VersionInfoAllVO versionInfoVO) {
|
|
|
// 1.先判断数据是否存在有效
|
|
|
- checkExist(versionInfoVO.getId());
|
|
|
+ checkExist(versionInfoVO.getId());
|
|
|
// 2.判断该版本号是否存在名字相同的数据
|
|
|
QueryWrapper<VersionInfo> templateInfoFand = new QueryWrapper<>();
|
|
|
templateInfoFand.eq("name", versionInfoVO.getName()).eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
@@ -222,8 +225,8 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean cancelVersionInfoAll(VersionInfoIdVO versionInfoVO) {
|
|
|
- // 1.先判断数据是否存在有效
|
|
|
- checkExist(versionInfoVO.getId());
|
|
|
+ // 1.先判断数据是否存在有效
|
|
|
+ checkExist(versionInfoVO.getId());
|
|
|
UpdateWrapper<VersionInfo> versionInfoNew = new UpdateWrapper<>();
|
|
|
versionInfoNew.in("id", versionInfoVO.getId()).eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.set("is_deleted", IsDeleteEnum.Y.getKey()).set("modifier", UserUtils.getCurrentPrincipleID())
|
|
@@ -237,7 +240,7 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
* @param id
|
|
|
*/
|
|
|
private void checkExist(Long id) {
|
|
|
- // 1.先判断数据是否存在有效
|
|
|
+ // 1.先判断数据是否存在有效
|
|
|
QueryWrapper<VersionInfo> VersionInfoFand = new QueryWrapper<>();
|
|
|
VersionInfoFand.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("id", id);
|
|
|
int sum = count(VersionInfoFand);
|
|
@@ -245,4 +248,43 @@ public class VersionInfoFacade extends VersionInfoServiceImpl {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS, "该数据不存在");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询版本信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public VersionSpecDTO getVersionInfo(VersionVO versionVO) {
|
|
|
+ //入参配置验证
|
|
|
+ if (null == versionVO) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (IntegerUtil.isNull(versionVO.getProductType())) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "产品类型不能为空!");
|
|
|
+ }
|
|
|
+ //查询最新的一条版本信息
|
|
|
+ QueryWrapper<VersionInfo> versionInfoQuery = new QueryWrapper<>();
|
|
|
+ versionInfoQuery.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("product_type", versionVO.getProductType())
|
|
|
+ .eq("STATUS", StatusEnum.Enable.getKey())
|
|
|
+ .orderByDesc("gmt_modified");
|
|
|
+
|
|
|
+ VersionInfo versionInfo = getOne(versionInfoQuery);
|
|
|
+ VersionSpecDTO versionList = new VersionSpecDTO();
|
|
|
+
|
|
|
+ if (versionInfo != null) {
|
|
|
+ //当查出的数据不为空时,取到版本id,再去版本明细表中查询详细的信息
|
|
|
+ long id = versionInfo.getId();
|
|
|
+ List<VersionDetailSpecDTO> detail = versionDetailFacade.getById2(id);
|
|
|
+ //System.out.println(detail.toString());
|
|
|
+ versionList.setId(versionInfo.getId());
|
|
|
+ versionList.setName(versionInfo.getName());
|
|
|
+ versionList.setRefreshTime(versionInfo.getRefreshTime());
|
|
|
+ versionList.setStatus(versionInfo.getStatus());
|
|
|
+ versionList.setDetail(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ return versionList;
|
|
|
+ }
|
|
|
}
|