修改切換角色

This commit is contained in:
qq787203167
2022-06-06 11:56:27 +08:00
parent 3d90a84b97
commit e49641b5cb
2 changed files with 22 additions and 18 deletions
@@ -2,6 +2,7 @@ package com.jero.modules.project.service.impl;
import cn.hutool.core.util.ZipUtil; import cn.hutool.core.util.ZipUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.utils.IOUtils; import com.aliyuncs.utils.IOUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -1012,17 +1013,16 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
/** /**
* 批量更新状态 * 批量更新状态
* @param params * @param json
* @return * @return
*/ */
@Override @Override
public Result<?> updateStatusBatch(Map<String, Object> params) { public Result<?> updateStatusBatch(JSONObject json) {
String result = ""; String result = "";
//operatorType: 0studio工程师发起清单确认 1法规工程师/认证工程师 提交或拒绝 //operatorType: 0studio工程师发起清单确认 1法规工程师/认证工程师 提交或拒绝
String operatorType = (String) params.get("operatorType"); String operatorType = json.getString("operatorType");
String projectLibraryId = (String) params.get("projectLibraryId");//项目id String projectLibraryId = json.getString("projectLibraryId");//项目id
String cut = (String) params.get("cut");//中英文切换标识 String cut = json.getString("cut");//中英文切换标识
String ids = (String) params.get("ids");
if(StringUtils.isEmpty(operatorType)){ if(StringUtils.isEmpty(operatorType)){
throw new JeroBootException("操作类型不能为空!"); throw new JeroBootException("操作类型不能为空!");
} }
@@ -1030,11 +1030,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
try { try {
//TODO 切换成枚举不要在代码里出现魔数 //TODO 切换成枚举不要在代码里出现魔数
if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){ if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){
String ids = json.getString("ids");
//验证用户是否是该项目的studio //验证用户是否是该项目的studio
isStudio(projectLibraryId,cut); isStudio(projectLibraryId,cut);
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//清单确认截止时间 //清单确认截止时间
String inventoryAffirmDueDate = (String) params.get("inventoryAffirmDueDate"); String inventoryAffirmDueDate = json.getString("inventoryAffirmDueDate");
QueryWrapper<ProjectLawsInventoryEO> queryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectLawsInventoryEO> queryWrapper = new QueryWrapper<>();
if(StringUtils.isNotEmpty(ids)){ if(StringUtils.isNotEmpty(ids)){
@@ -1098,7 +1100,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
result = "发起清单确认"; result = "发起清单确认";
}else if(StringUtils.equals(operatorType,OperatorTypeEnum.SUBMIT_OR_REJECTED.getValue())){ }else if(StringUtils.equals(operatorType,OperatorTypeEnum.SUBMIT_OR_REJECTED.getValue())){
//提交结果 0通过 1拒绝 //提交结果 0通过 1拒绝
String operatorResult = (String) params.get("operatorResult"); String operatorResult = json.getString("operatorResult");
if(StringUtils.equals(operatorResult, OperatorResultEnum.ACCEPTED.getValue())){ if(StringUtils.equals(operatorResult, OperatorResultEnum.ACCEPTED.getValue())){
result = "提交"; result = "提交";
}else if(StringUtils.equals(operatorResult, OperatorResultEnum.REJECTED.getValue())){ }else if(StringUtils.equals(operatorResult, OperatorResultEnum.REJECTED.getValue())){
@@ -1145,11 +1147,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
}*/ }*/
List<Map<String,Object>> lawsInventoryList = (List<Map<String, Object>>) params.get("lawsInventoryList"); JSONArray lawsInventoryList = json.getJSONArray("lawsInventoryList");
if(CollectionUtils.isNotEmpty(lawsInventoryList)){ if(CollectionUtils.isNotEmpty(lawsInventoryList)){
lawsInventoryList.forEach(lawsInventory -> { Map<String,Object> lawsInventoryMap = null;
int isProjectRole = (int) lawsInventory.get("roleCode"); for (Object lawsInventory : lawsInventoryList) {
String id = (String) lawsInventory.get("id"); lawsInventoryMap = JSONObject.parseObject(JSONObject.toJSONString(lawsInventory),Map.class);
int isProjectRole = (int) lawsInventoryMap.get("roleCode");
String id = (String) lawsInventoryMap.get("id");
ProjectLawsInventoryEO projectLawsInventoryEO = getById(id); ProjectLawsInventoryEO projectLawsInventoryEO = getById(id);
@@ -1184,7 +1188,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
super.baseMapper.updateById(projectLawsInventoryEO); super.baseMapper.updateById(projectLawsInventoryEO);
} }
}); }
}else { }else {
throw new JeroBootException("请至少勾选一条法规清单进行" + result); throw new JeroBootException("请至少勾选一条法规清单进行" + result);
} }
@@ -114,7 +114,7 @@
{{ $t('add') }} {{ $t('add') }}
</div> </div>
<div class="operator-text" @click="roleSwitchingClick"> <div class="operator-text" @click="roleSwitchingClick">
<a-icon type="setting"/> <a-icon type="select"/>
{{ $t('roleSwitching') }} {{ $t('roleSwitching') }}
</div> </div>
</div> </div>
@@ -133,7 +133,7 @@
</div> </div>
<div class="operator-text" v-if="this.$route.query.studioEngineer == this.userInfo().id" <div class="operator-text" v-if="this.$route.query.studioEngineer == this.userInfo().id"
@click="roleSwitchingClick"> @click="roleSwitchingClick">
<a-icon type="setting"/> <a-icon type="select"/>
{{ $t('roleSwitching') }} {{ $t('roleSwitching') }}
</div> </div>
</div> </div>
@@ -1206,7 +1206,7 @@
...this.formInline ...this.formInline
} }
this.confirmLoading = true this.confirmLoading = true
getAction(this.url.updateStatusBatch, query).then((res) => { postAction(this.url.updateStatusBatch, query).then((res) => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.visible = false this.visible = false
@@ -1342,7 +1342,7 @@
projectLibraryId: _this.$route.query.id, projectLibraryId: _this.$route.query.id,
operatorResult: num operatorResult: num
} }
getAction(_this.url.updateStatusBatch, query).then((res) => { postAction(_this.url.updateStatusBatch, query).then((res) => {
if (res.success) { if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful')) _this.$message.success(_this.$t('OperationSuccessful'))
_this.visible = false _this.visible = false