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

This commit is contained in:
zhangjun
2022-08-31 12:22:21 +08:00
10 changed files with 209 additions and 25 deletions
@@ -19,6 +19,7 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.sys.service.IDicTypeEOService;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
@@ -159,8 +160,33 @@ public class ScheduledJob {
}
}
});
//此处开始处理条款中的预警数据
//查询符合预警期限的标准 多个
List<WarningDate> warningDateOfItems = sarStandardWarningDao.getWarningDateOfItems(term);
warningDateOfItems.forEach(item -> {
for (String s : item.getSSRQ().split(",")) {
String pattern = term.getTermStr();
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(s);
//判断是否是日期格式
if (m.matches()) {
//此处判断当前条款的数据是否是最新状态的
String lawsId = item.getLawId();
String fileType =item.getFileType();
String textState = sarStandardWarningDao.getStandTextStateByStandId(lawsId);
if(StringUtils.isNotBlank(textState)){
String convertFileType = convertTextStateToItemType(textState);
if(StringUtils.isNotBlank(convertFileType) && fileType.equals(convertFileType)){
WarningDate warningDate = new WarningDate();
BeanUtils.copyProperties(item, warningDate);
warningDate.setId(UUIDUtils.randomUUID20());
warningDate.setSSRQ(s);
data.add(warningDate);
}
}
}
}
});
//清空标准的日期子表
iWarningDateService.remove(null);
// 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个
@@ -184,6 +210,52 @@ public class ScheduledJob {
}
}
/**
* 将文本状态转换成文件类型
* @param textState
* @return
*/
private String convertTextStateToItemType(String textState){
String fileType ="";
switch (textState){
case "DRAFT"://草稿
fileType="CA";
break;
case "ADVICE"://征求意见稿
fileType="ZQYJG";
break;
case "RADYSUBMIT"://报批稿
fileType="BPG";
break;
case "SUBMIT"://送审稿
fileType="SSG";
break;
case "FJNVYX9Q7J"://发布稿
fileType="FBGBJBD";
break;
case "ZTJJSS"://修订中
fileType=null;
break;
case "TOVOID"://已作废
fileType=null;
break;
case "ZTXXYX"://计划修订
fileType=null;
break;
case "5E5Z3CELX6"://已实施
fileType="FBGBJBD";
break;
case "N5KLTFLNRC"://已修订
fileType=null;
break;
default:
fileType=null;
break;
}
return fileType;
}
@Autowired
private ISarUpdLogService sarUpdLogEOService;
@@ -285,17 +357,10 @@ public class ScheduledJob {
replaceIdCountMap.put(standId.get(0), 1);
}
}
}
}
}
});
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
for (String key : replaceIdCountMap.keySet()) {
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
@@ -23,4 +23,8 @@ public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> {
public List<WarningDate> getWarningDate(TermDTO term);
public List<WarningDate> getWarningDateOfItems(TermDTO term);
public String getStandTextStateByStandId(@Param(value = "standId") String standId);
}
@@ -22,4 +22,6 @@ public class WarningDate {
@TableField("time_Name")
private String timeName;
private String fileType;
}
@@ -65,6 +65,13 @@ public class TsUserController extends BaseController<TsUser> {
return tsUserService.setPositionBatch(userPositionVO);
}
@ApiOperation("配置岗位")
@PostMapping("/positionBatchByOrgId")
public ResponseMessage<Object> setPositionBatchByOrgId(@Valid @RequestBody UserPositionBatchVO userPositionVO){
return tsUserService.setPositionBatchByOrgId(userPositionVO);
}
@ApiOperation("查询当前登录用户权限")
@GetMapping("/menu")
public ResponseMessage<List<SarMenu>> getMenu(){
@@ -51,6 +51,8 @@ public interface TsUserDao extends BaseMapper<TsUser> {
List<TsUser> userUnderInstitution(@Param("start")Integer start, @Param("end")Integer end,@Param("TsUser") TsUser tsUser,@Param("ids") List<String> ids);
List<TsUser> getUserUnderInstitutionAll(@Param("ids") List<String> ids);
Integer getUserAndPositionCount(@Param("TsUser") TsUser tsUser);
Integer userUnderInstitutionCount(@Param("TsUser") TsUser tsUser,@Param("ids") List<String> ids);
@@ -11,4 +11,7 @@ public class UserPositionBatchVO {
private List<String> userId;
@NotNull(message = "positionIds不能为空")
private List<String> positionIds;
@NotNull(message = "orgId不能为空")
private String orgId;
}
@@ -47,6 +47,8 @@ public interface ITsUserService extends IService<TsUser> {
ResponseMessage<Object> setPositionBatch(UserPositionBatchVO userPositionVO);
ResponseMessage<Object> setPositionBatchByOrgId(UserPositionBatchVO userPositionVO);
/**
* 查询当前登录的用户权限
* @return List<SarMenu>
@@ -194,6 +194,71 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
}
}
/**
* 配置岗位
* @param userPositionVO2:用户、岗位ID
* @return ResponseMessage<Object>
*/
@Override
@Transactional
public ResponseMessage<Object> setPositionBatchByOrgId(UserPositionBatchVO userPositionVO2) {
boolean flag=true;
//首先将所有用户查出来
List<String> orgIds=new ArrayList<>();
orgIds.add(userPositionVO2.getOrgId());
List<String> middle=new ArrayList<>();
middle.addAll(orgIds);
boolean Orgflag=true;
while (Orgflag){
QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
queryWrapper.in("parent_id",middle);
List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
if (tsmiddle.size()>0){
tsmiddle.forEach(tsInstitution -> {
middle.add(tsInstitution.getId());
});
middle.removeAll(orgIds);
orgIds.addAll(middle);
}else {
tsmiddle.forEach(tsInstitution -> {
middle.add(tsInstitution.getId());
});
middle.removeAll(orgIds);
orgIds.addAll(middle);
Orgflag=false;
}
}
orgIds.removeIf(s -> null==s);
List<TsUser> allUsers = tsUserDao.getUserUnderInstitutionAll(orgIds);
for (TsUser user : allUsers) {
String userId = user.getUserId();
UserPositionVO userPositionVO=new UserPositionVO();
userPositionVO.setUserId(userId);
userPositionVO.setPositionIds(userPositionVO2.getPositionIds());
TsUser tsUser=tsUserDao.selectById(userPositionVO.getUserId());
if(tsUser==null){
continue;
}
List<String> oldPositionIds=tsUserDao.selectPositionIds(userPositionVO.getUserId());
Map<String,List<String>> ids= ListUtil.difList(userPositionVO.getPositionIds(),oldPositionIds);
List<String> insertIds=ids.get("insert");
List<String> deleteIds=ids.get("delete");
if(insertIds!=null&&insertIds.size()>0){
for(String positionId:insertIds){
tsUserDao.addPosition(userPositionVO.getUserId(),positionId);
}
}
if(deleteIds!=null&&deleteIds.size()>0){
for(String positionId:deleteIds){
tsUserDao.delPosition(userPositionVO.getUserId(),positionId);
}
}
}
return Result.success();
}
/**
* 查询当前登录的用户权限
* @return List<SarMenu>
@@ -91,22 +91,6 @@ select A.* from
from sar_stand_attr_info attr
WHERE
ZCCSSRQ REGEXP #{termStr}
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
ZCCSSRQ as SSRQ
from sar_stand_items item
WHERE
ZCCSSRQ REGEXP #{termStr}
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
XCXSSRQ as SSRQ
from sar_stand_items item
WHERE
XCXSSRQ REGEXP #{termStr}
) AS A
left join sar_standards_info as sarInfo
on sarInfo.id=A.lawId
@@ -115,5 +99,30 @@ select A.* from
</select>
<select id="getWarningDateOfItems" resultType="com.adc.da.slrs.sarStandWarning.entity.WarningDate">
select A.* from
(
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
ZCCSSRQ as SSRQ,item.FILE_TYPE AS fileType
from sar_stand_items item
WHERE
ZCCSSRQ REGEXP #{termStr}
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
XCXSSRQ as SSRQ,item.FILE_TYPE AS fileType
from sar_stand_items item
WHERE
XCXSSRQ REGEXP #{termStr}
) AS A
left join sar_standards_info as sarInfo
on sarInfo.id=A.lawId
where sarInfo.valid_flag = '0'
</select>
<select id="getStandTextStateByStandId" resultType="java.lang.String">
SELECT TEXT_STATUS FROM sar_standards_info WHERE ID = #{standId}
</select>
</mapper>
@@ -48,6 +48,31 @@
limit #{start},#{end}
</select>
<select id="getUserUnderInstitutionAll" resultMap="UserPosition">
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,
p.id p_id,p.name p_name from ts_user u
left join ts_user_position up
on u.usid=up.user_id
left join ts_position p
on up.position_id=p.id
where 1=1
<if test=" null != ids and ids.size()> 0">
and INSTITUTION_ID in
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
#{id}
</foreach>
</if>
<if test=" null != ids and ids.size()> 0">
order by field(INSTITUTION_ID,
<foreach item="id" collection="ids" open="" separator="," close="" index="index">
#{id}
</foreach>)
</if>
</select>
<select id="userUnderInstitution" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG