Merge remote-tracking branch 'origin/develop_3' into develop_master

This commit is contained in:
yuezhihang
2022-01-27 09:34:43 +08:00
10 changed files with 195 additions and 10 deletions
+1 -1
View File
@@ -135,4 +135,4 @@
</dependency>
</dependencies>
</project>
</project>
@@ -61,4 +61,7 @@ public class SarStandMenu extends BaseEntity {
@TableField(exist = false)
private String menuName;
@TableField(exist = false)
private String standCode;
}
@@ -108,4 +108,9 @@ public class SarStandardsInfoEOPage extends BasePage {
* 标准添加到体系中的id多个
*/
private String menuIds;
/**
* 标准号
*/
private String standCode;
}
@@ -1,6 +1,8 @@
package com.adc.da.slrs.sarStandardsInfo.service.impl;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarStandWarning.dao.WarningDateDao;
@@ -814,6 +816,10 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandardsInfoEO.setCreationTime(new Date());
sarStandardsInfoEO.setModifyTime(new Date());
//根据新建标准所在目录,确定此处是否需要在标准目录关联表中插入数据
//当代替标准号在我的收藏中时此标准也关联到我的收藏中
associatedCollection(sarStandardsInfoEO);
if (StringUtils.isNotEmpty(sarStandardsInfoEO.getMenuIds())) {
for (String menuId : sarStandardsInfoEO.getMenuIds().split(",")) {
@@ -1411,8 +1417,57 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandardsInfoEO.setStandState(resultState);
}
@Autowired
private ISarStandardsInfoService sarStandardsInfoEOService;
private void associatedCollection(SarStandardsInfo standInfo){
/**
* 获取代替标准号
* 判断getAttrInfoMap, dtbzh.get("DTBJH") 不为空
*/
String DTBJH = Optional.ofNullable(standInfo)
.flatMap(standEO -> Optional.ofNullable(JSONObject.fromObject(standEO.getSarStandAttrEOStr())))
.flatMap(attrMap -> Optional.ofNullable(attrMap.get("DTBJH")))
.map(str -> str.toString())
.orElse("");
if (!"".equals(DTBJH)){
for (String s : DTBJH.split(",")) {
/**
* 以逗号分割的代替标准号,只要其中一个存在于我的收藏之中,此标准就插入我的收藏
*/
StandInfo query = new StandInfo();
//用户id
query.setUserId(LoginUserUtil.getUserId());
query.setStandCode(s);
if (personCollectEOService.countPersonCollectByStandInfo(query)>0){
TsPersonCollect tsPersonCollect = new TsPersonCollect();
tsPersonCollect.setId(UUIDUtils.randomUUID20());
tsPersonCollect.setValidFlag(0);
tsPersonCollect.setCreationTime(new Date());
tsPersonCollect.setModifyTime(new Date());
tsPersonCollect.setCollectResId(standInfo.getId());
tsPersonCollect.setCollectType(standInfo.getStandType()+"_STAND");
tsPersonCollect.setCollectTitle(standInfo.getStandName() +"(编号:"+ standInfo.getStandSort()+" "+standInfo.getStandNumber()+"-"+standInfo.getStandYear()+ ")");
tsPersonCollect.setUserId(LoginUserUtil.getUserId());
QueryWrapper<TsPersonCollect> ew = new QueryWrapper<>();
ew.eq("COLLECT_RES_ID",standInfo.getId())
.eq("VALID_FLAG",'0');
personCollectEOService.saveOrUpdate(tsPersonCollect,ew);
break;
}
}
}
}
/***
@@ -1466,8 +1521,11 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandAttrInfoEODao.deleteStandAttrByStandId(standId);
createStandAttrInfo(sarStandardsInfoEO);
/**
* 编辑体系目录
* 编辑体系目录 当代替的标准号在我的收藏中时,此条标准也需要在我的收藏中
*/
//当代替标准号在我的收藏中时此标准也关联到我的收藏中
associatedCollection(sarStandardsInfoEO);
if (StringUtils.isNotEmpty(sarStandardsInfoEO.getMenuIds())) {
@@ -1478,9 +1536,9 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
try {
sarStandardsInfoEOService.updateStandardsMenu(standardsInfoEO);
updateStandardsMenu(standardsInfoEO);
}catch (NullPointerException e){
sarStandardsInfoEOService.updateStandInfo(standardsInfoEO);
updateStandInfo(standardsInfoEO);
}
}
}
@@ -83,7 +83,7 @@
where stand_id = #{standId} and valid_flag=0
</select>
<select id="getMenuByStandId" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
SELECT
SELECT
SAR_STAND_MENU.valid_flag as validFlag,
menu_id as menuId,
stand_id as standId,
@@ -92,9 +92,55 @@
FROM
SAR_STAND_MENU
LEFT JOIN ts_resource ON SAR_STAND_MENU.MENU_ID = ts_resource.ID
WHERE
stand_id = #{standId}
AND SAR_STAND_MENU.VALID_FLAG = 0
<where>
SAR_STAND_MENU.VALID_FLAG = 0
<if test="standId !=null and stand != ''">
AND stand_id = #{standId}
</if>
<if test="standCode !=null and standCode != ''">
AND STAND_ID =
(
SELECT
id
FROM
sar_standards_info AS sarInfo
WHERE
VALID_FLAG = '0'
AND
(
(
REPLACE (
concat(
sarInfo.STAND_SORT,
' ',
sarInfo.STAND_NUMBER,
'-',
sarInfo.STAND_YEAR
),
' ',
''
) = REPLACE (
#{standCode},' ', '')
AND sarInfo.STAND_YEAR != ''
)
OR (
REPLACE (
concat(
sarInfo.STAND_SORT,
sarInfo.STAND_NUMBER
),
' ',
''
) = REPLACE (#{standCode},' ', '')
)
)
)
</if>
</where>
</select>
@@ -1,6 +1,7 @@
package com.adc.da.person.dao;
import com.adc.da.base.page.BasePage;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.page.PersonCollectEOPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -38,4 +39,5 @@ public interface PersonCollectEODao extends BaseMapper<TsPersonCollect> {
int updateByPrimaryKeySelective(TsPersonCollect tsPersonCollect);
int countPersonCollectByStandInfo(StandInfo standInfo);
}
@@ -0,0 +1,11 @@
package com.adc.da.person.entity;
import lombok.Data;
@Data
public class StandInfo {
private String userId;
private String standCode;
}
@@ -1,6 +1,7 @@
package com.adc.da.person.service;
import com.adc.da.http.ResponseMessage;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.page.PersonCollectEOPage;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -29,4 +30,10 @@ public interface IPersonCollectEOService extends IService<TsPersonCollect> {
public ResponseMessage<IPage<TsPersonCollect>> queryCollectByWrapper(Integer pageNo, Integer pageSize, String collectTitle,String modeType, String userId);
/**
* 通过标准号和用户id查询是否收藏此标准
* @param standInfo
* @return
*/
public int countPersonCollectByStandInfo(StandInfo standInfo);
}
@@ -5,6 +5,7 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.person.dao.PersonCollectEODao;
import com.adc.da.person.dao.PersonNoteEODao;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.entity.PersonNoteEO;
import com.adc.da.person.page.PersonCollectEOPage;
@@ -156,4 +157,9 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
return Result.success(page);
}
@Override
public int countPersonCollectByStandInfo(StandInfo standInfo) {
return personCollectEODao.countPersonCollectByStandInfo(standInfo);
}
}
@@ -403,4 +403,51 @@
from ts_pserson_collect
where collect_type=#{c}
</select>
<select id="countPersonCollectByStandInfo" resultType="java.lang.Integer">
SELECT COUNT(1)
from
ts_person_collect
WHERE
VALID_FLAG ='0'
AND USER_ID = #{userId}
AND COLLECT_RES_ID =
(
SELECT
id
FROM
sar_standards_info AS sarInfo
WHERE
VALID_FLAG = '0'
AND
(
(
REPLACE (
concat(
sarInfo.STAND_SORT,
' ',
sarInfo.STAND_NUMBER,
'-',
sarInfo.STAND_YEAR
),
' ',
''
) = REPLACE (
#{standCode},' ', '')
AND sarInfo.STAND_YEAR != ''
)
OR (
REPLACE (
concat(
sarInfo.STAND_SORT,
sarInfo.STAND_NUMBER
),
' ',
''
) = REPLACE ( #{standCode},' ', '')
)
)
)
</select>
</mapper>