Commit ea97a4bc authored by 刘林's avatar 刘林

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

parents 03055517 4abe0b2d
......@@ -175,7 +175,7 @@ public class JgUseRegistrationController extends BaseController {
@GetMapping(value = "/getDetail")
public ResponseModel<Map<String, Object>> getDetail(@RequestParam(value = "record", required = false) String record,
@RequestParam(value = "sequenceNbr", required = false) Long sequenceNbr) {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDetail(record, sequenceNbr));
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDetail(record, sequenceNbr, getSelectedOrgInfo()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
......@@ -14,9 +17,16 @@ import java.util.List;
@Slf4j
public class FillingEditPermForCurrentUser extends BaseUseRegisterResultData {
private final CompanyBo company;
public FillingEditPermForCurrentUser(JSONObject data) {
private static final String COMPANY_TYPE = "companyType";
private static final String HAS_PERMISSION = "hasPermission";
public FillingEditPermForCurrentUser(JSONObject data, CompanyBo company) {
super(data);
this.company = company;
}
......@@ -29,7 +39,6 @@ public class FillingEditPermForCurrentUser extends BaseUseRegisterResultData {
private void fillingEditPermission(JSONObject jsonObject) {
String HAS_PERMISSION = "hasPermission";
jsonObject.put(HAS_PERMISSION, false);
// 当前登录人所在用户组
List<GroupModel> groupModels = FeignUtil.remoteCall(() -> Privilege.groupClient.queryByUserId(RequestContext.getExeUserId()));
......@@ -38,6 +47,12 @@ public class FillingEditPermForCurrentUser extends BaseUseRegisterResultData {
if (groupModels.stream().anyMatch(g -> hasPermGroup.stream().anyMatch(h -> h.getDictDataValue().equals(g.getGroupName())))) {
jsonObject.put(HAS_PERMISSION, true);
}
if(company != null) {
if (company.getLevel().equals(BaseController.COMPANY_TYPE_COMPANY)) {
jsonObject.put(COMPANY_TYPE, BaseController.COMPANY_TYPE_COMPANY);
} else {
jsonObject.put(COMPANY_TYPE, BaseController.COMPANY_TYPE_SUPERVISION);
}
}
}
}
......@@ -2144,16 +2144,16 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
}
public Map<String, Object> getDetail(String record, Long sequenceNbr) {
public Map<String, Object> getDetail(String record, Long sequenceNbr, ReginParams selectedOrgInfo) {
if (!ObjectUtils.isEmpty(sequenceNbr)) {
JgUseRegistration jgUseRegistration = this.getBaseMapper().selectById(sequenceNbr);
this.doCompensate(jgUseRegistration);
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, sequenceNbr);
lambda.eq(JgRegistrationHistory::getIsDelete, false);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda);
JSONObject jsonObject = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
jsonObject.put("manageType", jgUseRegistration.getManageType());
jsonObject.put("createUserId", jgUseRegistration.getCreateUserId());
jsonObject.put("receiveOrgCode", jgUseRegistration.getReceiveCompanyCode() + "_" + jgUseRegistration.getReceiveOrgName());
jsonObject.put("status", jgUseRegistration.getStatus());
......@@ -2219,7 +2219,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 结果增强,填充单据是否可变更设备状态,用来控制前端按钮的显示隐藏。
new FillingUseRegisterResult(sequenceNbr, jsonObject, applicationContext).getData();
// 结果增强,填充当前人是否有编辑按钮权限
new FillingEditPermForCurrentUser(jsonObject).getData();
new FillingEditPermForCurrentUser(jsonObject, Optional.ofNullable(selectedOrgInfo).map(ReginParams::getCompany).orElse(null)).getData();
return jsonObject;
}
// 基本信息 + 制造信息
......@@ -2270,7 +2270,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 结果增强,填充单据是否可变更设备状态
new DefaultUseRegisterResult(result).getData();
// 结果增强,填充当前人是否有编辑按钮权限
new FillingEditPermForCurrentUser(result).getData();
new FillingEditPermForCurrentUser(result, selectedOrgInfo.getCompany()).getData();
return result;
}
......@@ -4478,7 +4478,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if(CollUtil.isNotEmpty(useRegistrations)){
for (JgUseRegistration useRegistration : useRegistrations) {
try {
Map<String, Object> detail = this.getDetail(null, useRegistration.getSequenceNbr());
Map<String, Object> detail = this.getDetail(null, useRegistration.getSequenceNbr(), null);
String jsonString = JSONObject.toJSONString(detail);
JSONObject jsonObject = JSONObject.parseObject(jsonString);
FeignClientResult<AgencyUserModel> agencyUserModelFeignClientResult = Privilege.agencyUserClient.queryByUserId((String) detail.get("createUserId"));
......
......@@ -1939,30 +1939,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 查询所有的
Map<String , ESTaskDetailDto> esTaskDetailDtoMap = allESTaskDetailDtos.stream().collect(Collectors.toMap(ESTaskDetailDto::getId, Function.identity()));
// 只更新未完成状态
planTaskDetails.stream().filter(p-> PlanTaskDetailStatusEnum.NOTSTARTED.getValue().equals(p.getStatus())).forEach(planTaskDetail -> {
ESTaskDetailDto esTaskDetailDto = esTaskDetailDtoMap.get(planTaskDetail.getId());
planTaskDetails.stream().filter(p -> PlanTaskDetailStatusEnum.NOTSTARTED.getValue().equals(p.getStatus())).collect(Collectors.toList()).forEach(planTaskDetail -> {
ESTaskDetailDto esTaskDetailDto = esTaskDetailDtoMap.get(Objects.toString(planTaskDetail.getId()));
JSONObject appCheckInput = esTaskDetailDto.getAppCheckInput();
Map<String, List<Map<String, Object>>> mapList = (Map<String, List<Map<String, Object>>>) JSON.parse(appCheckInput.toJSONString());
List<AppCheckInputRespone> appCheckInputRespones = new ArrayList<>();
for (Map<String, Object> map : mapList.get("items")) {
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone();
BeanUtil.copyProperties(map, appCheckInputRespone);
InputItem inputItem = inputItemDao.getOne(Long.parseLong(map.get("checkInputId").toString()));
CheckInput checkInput = new CheckInput();
String itemType = String.valueOf(map.get("itemType"));
if (XJConstant.INPUT_ITEM_SELECT.equals(itemType)) {
paraseSelect(checkInput, String.valueOf(map.get("dataJson")));
appCheckInputRespone.setInputValue(checkInput.getInputValue());
} else if (XJConstant.INPUT_ITEM_NUMBER.equals(itemType)) {
appCheckInputRespone.setInputValue(inputItem.getDefaultValue());
} else if (XJConstant.INPUT_ITEM_TEXT.equals(itemType)) {
appCheckInputRespone.setInputValue(inputItem.getDefaultValue());
}
if (!mapList.isEmpty()) {
List<AppCheckInputRespone> appCheckInputRespones = new ArrayList<>();
for (Map<String, Object> map : mapList.get("items")) {
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone();
BeanUtil.copyProperties(map, appCheckInputRespone);
InputItem inputItem = inputItemDao.getOne(Long.parseLong(map.get("checkInputId").toString()));
CheckInput checkInput = new CheckInput();
String itemType = String.valueOf(map.get("itemType"));
if (XJConstant.INPUT_ITEM_SELECT.equals(itemType)) {
paraseSelect(checkInput, String.valueOf(map.get("dataJson")));
appCheckInputRespone.setInputValue(checkInput.getInputValue());
} else if (XJConstant.INPUT_ITEM_NUMBER.equals(itemType)) {
appCheckInputRespone.setInputValue(inputItem.getDefaultValue());
} else if (XJConstant.INPUT_ITEM_TEXT.equals(itemType)) {
appCheckInputRespone.setInputValue(inputItem.getDefaultValue());
}
appCheckInputRespone.setPointInputImgUrls(new ArrayList<>());
appCheckInputRespones.add(appCheckInputRespone);
appCheckInputRespone.setPointInputImgUrls(new ArrayList<>());
appCheckInputRespones.add(appCheckInputRespone);
}
appCheckInput.put("items", appCheckInputRespones);
}
appCheckInput.put("items", appCheckInputRespones);
esTaskDetailDto.setPointImgUrls(new ArrayList<>());
esTaskDetailDto.setAppCheckInput(appCheckInput);
esTaskDetailDto.setPointStatus(String.valueOf(PlanTaskDetailIsFinishEnum.FINISHED.getValue()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment