| | |
| | | package com.vci.plugins.controller; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientBusinessObjectOperation; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.query.data.KV; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.plugins.dto.AuditTaskDTO; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | |
| | | @PostMapping("/create") |
| | | public BaseResult createByPrincipal(@RequestBody AuditTaskDTO auditTaskDTO) { |
| | | VciBaseUtil.alertNotNull(auditTaskDTO.getProcessreviewoid(), "工艺评审主键", auditTaskDTO.getPrincipal(), "负责人"); |
| | | ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation(); |
| | | List<ClientBusinessObject> createList = new ArrayList<>(); |
| | | // BusinessObjectOperation operation = new BusinessObjectOperation(); |
| | | List<BusinessObject> createList = new ArrayList<>(); |
| | | List<String> principalList = VciBaseUtil.str2List(auditTaskDTO.getPrincipal()); |
| | | List<List<String>> oracleIn = WebUtil.switchListForOracleIn(principalList); |
| | | try { |
| | |
| | | "where us.pluid in " + principalStr; |
| | | KV[][] kvs = platformClientUtil.getQueryService().queryBySql(sql); |
| | | for (int index = 0; index < kvs.length; index++) { |
| | | ClientBusinessObject cbo = operation.initBusinessObject("audittask"); |
| | | BusinessObject cbo = platformClientUtil.getBOFService().initBusinessObject("audittask"); |
| | | copyAttribute(cbo, auditTaskDTO); |
| | | cbo.setAttributeValue("principal", "PLUSERNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | cbo.setAttributeValue("departmentname","PLNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | ObjectTool.setBOAttributeValue(cbo, "principal", "PLUSERNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | ObjectTool.setBOAttributeValue(cbo,"departmentname","PLNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | createList.add(cbo); |
| | | } |
| | | } catch ( PLException vciError) { |
| | | vciError.printStackTrace(); |
| | | } |
| | | }); |
| | | operation.batchSaveCreateBuinessObject(createList.toArray(new ClientBusinessObject[0])); |
| | | |
| | | platformClientUtil.getBOFService().batchCreateBusinessObject(createList.toArray(new BusinessObject[0]),false,false); |
| | | } catch ( PLException vciError) { |
| | | vciError.printStackTrace(); |
| | | return BaseResult.fail("创建评审任务失败"); |
| | |
| | | * @param cbo 评审任务业务类型对象 |
| | | * @param auditTaskDTO 评审任务页面传输对象 |
| | | */ |
| | | private void copyAttribute(ClientBusinessObject cbo, AuditTaskDTO auditTaskDTO) { |
| | | private void copyAttribute(BusinessObject cbo, AuditTaskDTO auditTaskDTO) { |
| | | setAttribute(cbo, "assigner", StringUtils.isBlank(auditTaskDTO.getAssigner())? WebUtil.getCurrentUserId(): auditTaskDTO.getAssigner()); |
| | | setAttribute(cbo, "principal", auditTaskDTO.getPrincipal()); |
| | | setAttribute(cbo, "departmentName", auditTaskDTO.getDepartmentname()); |
| | |
| | | * @param attributeName 字段名 |
| | | * @param attributeValue 字段值 |
| | | */ |
| | | private void setAttribute(ClientBusinessObject cbo, String attributeName, String attributeValue) { |
| | | try { |
| | | if (StringUtils.isNotBlank(attributeValue)) { |
| | | cbo.setAttributeValue(attributeName, attributeValue); |
| | | } |
| | | } catch (PLException vciError) { |
| | | vciError.printStackTrace(); |
| | | private void setAttribute(BusinessObject cbo, String attributeName, String attributeValue) { |
| | | if (StringUtils.isNotBlank(attributeValue)) { |
| | | ObjectTool.setBOAttributeValue(cbo, attributeName, attributeValue); |
| | | } |
| | | } |
| | | } |