diff --git a/jcl-hrmorganization/dubbo.xml b/jcl-hrmorganization/dubbo.xml index 7d5c473..91080f2 100644 --- a/jcl-hrmorganization/dubbo.xml +++ b/jcl-hrmorganization/dubbo.xml @@ -4,4 +4,6 @@ + + \ No newline at end of file diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/build/libs/build.zip b/jcl-hrmorganization/secondev-jcl-hrmorganization/build/libs/build.zip deleted file mode 100644 index 5188649..0000000 Binary files a/jcl-hrmorganization/secondev-jcl-hrmorganization/build/libs/build.zip and /dev/null differ diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/build/libs/secondev-jcl-hrmorganization.jar b/jcl-hrmorganization/secondev-jcl-hrmorganization/build/libs/secondev-jcl-hrmorganization.jar deleted file mode 100644 index 73c6497..0000000 Binary files a/jcl-hrmorganization/secondev-jcl-hrmorganization/build/libs/secondev-jcl-hrmorganization.jar and /dev/null differ diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/build/tmp/jar/MANIFEST.MF b/jcl-hrmorganization/secondev-jcl-hrmorganization/build/tmp/jar/MANIFEST.MF deleted file mode 100644 index 4b24b87..0000000 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/build/tmp/jar/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -weaver-ecode-seconddev-id: com.weaver.secondev-jcl-hrmorganization -Implementation-Title: jcl-hrmorganization -Implementation-Version: 1.0.0 -Implementation-Vendor-Id: com.weaver.secondev - diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldByEmployee.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldByEmployee.java index 23f0081..d249116 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldByEmployee.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldByEmployee.java @@ -20,7 +20,7 @@ public class SynchronousFieldByEmployee implements EsbServerlessRpcRemoteInterfa EmployeeInformationService employeeInformationService; @Override public WeaResult> execute(Map params) { - List errorList = employeeInformationService.synchronousFieldByEmployee(new SimpleEmployee()); + List errorList = employeeInformationService.synchronousFieldByEmployee(new SimpleEmployee(1L)); if (errorList.size() > 0){ return WeaResult.fail(errorList.toString(),true); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldInitialization.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldInitialization.java index 7f5ea9f..57ef40c 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldInitialization.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SynchronousFieldInitialization.java @@ -20,7 +20,7 @@ public class SynchronousFieldInitialization implements EsbServerlessRpcRemoteIn EmployeeInformationService employeeInformationService; @Override public WeaResult> execute(Map params) { - List errorList = employeeInformationService.synchronousField(new SimpleEmployee()); + List errorList = employeeInformationService.synchronousField(new SimpleEmployee(1L)); if (errorList.size() > 0){ return WeaResult.fail(errorList.toString(),true); diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java index 25cc6b4..53842d1 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java @@ -4,12 +4,23 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.Gson; import com.weaver.common.base.entity.result.WeaResult; +import com.weaver.common.base.enumeration.result.WeaResultCodeEnum; +import com.weaver.common.form.auth.FormAuthenticationService; +import com.weaver.common.form.context.FormContext; +import com.weaver.common.form.context.FormContextParam; +import com.weaver.common.form.dto.auth.FormAuthenticationDto; import com.weaver.common.form.dto.form.FormTableDto; +import com.weaver.common.form.enums.auth.FormAuthenticationEnum; +import com.weaver.common.form.exception.FormException; import com.weaver.common.form.fieldmanage.service.FormFieldManageService; +import com.weaver.common.form.metadata.Form; import com.weaver.common.form.metadata.ModuleSource; import com.weaver.common.form.param.FieldManageParam; +import com.weaver.common.form.param.auth.FormAuthenticationParam; +import com.weaver.common.form.param.field.FormFieldParam; import com.weaver.common.form.physical.enums.FormTableType; import com.weaver.common.form.service.IdGeneratorService; +import com.weaver.common.i18n.label.SystemEnv; import com.weaver.form.controller.FormBaseController; import com.weaver.form.controller.manage.FormFieldManageController; import com.weaver.form.entity.FormFieldManageParam; @@ -22,10 +33,16 @@ import com.weaver.seconddev.jcl.organization.util.Constants; import com.weaver.seconddev.jcl.organization.util.DatabaseUtils; import com.weaver.teams.domain.user.SimpleEmployee; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StopWatch; import org.springframework.web.bind.annotation.RequestBody; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -45,6 +62,8 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic private IdGeneratorService idGeneratorService; @Autowired private FormFieldManageController fieldManageController; + @Autowired + private FormAuthenticationService formAuthenticationService; @Override public List> getInformation(Employee employee) { @@ -221,7 +240,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic sql = "select b.id formtableid,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id=?"; List> dataList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee_form_id)); List errorMessage = Lists.newArrayList(); - WeaResult> result = batchSaveInformation(employee_form_id,employeeFieldList,dataList,ModuleSource.ebuilderform,null,null); + WeaResult> result = batchSaveInformation(employee_form_id,employeeFieldList,dataList,ModuleSource.ebuilderform,null,null,employee); if (result.getCode() != 200){ errorMessage.add("员工信息表"+result.getMsg()); } @@ -229,14 +248,14 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic //保存人力资源-基本信息 Map customParam = Maps.newHashMap(); customParam.put("formId",personCustomfieldFormid); - WeaResult> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,null); + WeaResult> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,null,employee); if (result2.getCode() != 200){ errorMessage.add("人力资源基本信息自定义表"+result2.getMsg()); } //保存人力资源-个人信息 Map customParam2 = Maps.newHashMap(); customParam2.put("apiModule","hr"); - WeaResult> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,null,ModuleSource.hruserinfo,customParam2,null); + WeaResult> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,null,ModuleSource.hruserinfo,customParam2,null,employee); if (result3.getCode() != 200){ errorMessage.add("人力资源个人信息自定义表"+result3.getMsg()); } @@ -310,14 +329,14 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic //保存人力资源-基本信息 Map customParam = Maps.newHashMap(); customParam.put("formId",personCustomfieldFormid); - WeaResult> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,personCustomids); + WeaResult> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,personCustomids,employee); if (result2.getCode() != 200){ errorMessage.add("基本信息表"+result2.getMsg()); } //保存人力资源-个人信息 Map customParam2 = Maps.newHashMap(); customParam2.put("apiModule","hr"); - WeaResult> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,null,ModuleSource.hruserinfo,customParam2,personInfCustomIds); + WeaResult> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,null,ModuleSource.hruserinfo,customParam2,personInfCustomIds,employee); if (result3.getCode() != 200){ errorMessage.add("个人信息表"+result3.getMsg()); } @@ -384,7 +403,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic sql = "select b.id formtableid,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id=?"; List> dataList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee_form_id)); List errorMessage = Lists.newArrayList(); - WeaResult> result = batchSaveInformation(employee_form_id,employeeFieldList,dataList,ModuleSource.ebuilderform,null,deleteIds); + WeaResult> result = batchSaveInformation(employee_form_id,employeeFieldList,dataList,ModuleSource.ebuilderform,null,deleteIds,employee); if (result.getCode() != 200){ errorMessage.add("员工信息表"+result.getMsg()); } @@ -394,12 +413,38 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic @Override public List> getFieldList(FieldManageParam entity,SimpleEmployee employee) { + HashMap result = new HashMap(6); + WeaResult> wearesult =null; + try { + ModuleSource module = entity.getModule(); + Long formId = entity.getFormId(); + if (formId == null) { + result.put("actionMsg", SystemEnv.getHtmlLabelName(181389L, "formId不能为空。")); + wearesult = WeaResult.fail(result.toString(), true); + } else { + WeaResult authentication = formAuthenticationService.authentication(new FormAuthenticationParam(module, entity.getFormId(), FormAuthenticationEnum.FORM_FIELD_MANAGE_SELECT_LIST, (Map)null), employee); + if (!authentication.isStatus()) { + wearesult = WeaResult.fail(authentication.getMsg(), true); + } else { + if (entity.getNeedI18N() == null) { + entity.setNeedI18N(true); + } - // List> fieldList = (CommonUtils.getRealService(module.name(), "FormFieldManageService", FormFieldManageService.class)).getFormFieldJsonByFormId(entity, employee); - WeaResult> result = fieldManageController.getFormFieldList(entity); + List> fieldList = ((FormFieldManageService)fieldManageController.getRealService(module.name(), "FormFieldManageService", FormFieldManageService.class)).getFormFieldJsonByFormId(entity, employee); + result.put("data", fieldList); + wearesult = WeaResult.success(result); + } + } + } catch (FormException var8) { + log.error("getFormFieldList 异常:", var8); + wearesult = WeaResult.fail(SystemEnv.getHtmlLabelName(181391L, "获取批量编辑字段列表失败:") + var8.getMessage(), true); + } catch (Exception var9) { + log.error("getFormFieldList 异常2:", var9); + wearesult = WeaResult.fail(SystemEnv.getHtmlLabelName(181391L, "获取批量编辑字段列表失败:") + var9.getMessage(), true); + } Gson gson = new Gson(); - log.error("getFieldList :[{}]",gson.toJson(result)); - Map resultMap = result.getData(); + log.error("getFieldList :[{}]",gson.toJson(wearesult)); + Map resultMap = wearesult.getData(); return (List>)resultMap.get("data"); } @@ -409,8 +454,84 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic * @param entity * @return */ - public WeaResult> batchSaveFormField(FormFieldManageParam entity) { - return fieldManageController.batchSaveFormField(entity); + public WeaResult> batchSaveFormField(FormFieldManageParam entity,SimpleEmployee employee) { + HashMap result = new HashMap(16); + WeaResult> weaResult = null; + try { + + ModuleSource module = entity.getModule(); + List formFields = entity.getJsonObjList(); + StopWatch stopWatch = new StopWatch(); + Long formId = entity.getFormId(); + if (formId == null) { + result.put("actionMsg", SystemEnv.getHtmlLabelName(181369L, "数据不能为空。")); + return WeaResult.fail(result.toString(), true); + } else { + stopWatch.start(" batchSaveFormField controller start 0 "); + WeaResult authentication = this.formAuthenticationService.authentication(new FormAuthenticationParam(module, entity.getFormId(), FormAuthenticationEnum.FORM_FIELD_MANAGE_UPDATE, entity.getCustomParam()), employee); + stopWatch.stop(); + if (!authentication.isStatus()) { + return WeaResult.fail(authentication.getMsg(), true); + } else { + FormContextParam formContextParam = FormContext.get(formId); + formContextParam.setCostTime(new HashMap()); + if (entity.getNeedOldData() != null && entity.getNeedOldData()) { + formContextParam.setNeedOldData(true); + } + + stopWatch.start(" batchSaveFormField controller start 1 "); + FormFieldManageService realService = (FormFieldManageService)fieldManageController.getRealService(module.name(), "FormFieldManageService", FormFieldManageService.class); + stopWatch.stop(); + stopWatch.start(" batchSaveFormField controller start 2 batchSaveSubForm "); + if (CollectionUtils.isNotEmpty(entity.getForms()) || CollectionUtils.isNotEmpty(entity.getDelSubFormIds())) { + realService.batchSaveSubForm(entity.getForms(), entity.getDelSubFormIds(), formId, entity.getCustomParam(), employee); + } + + stopWatch.stop(); + stopWatch.start(" batchSaveFormField controller start 3 deleteFormTable"); + if (CollectionUtils.isNotEmpty(entity.getDelFormTableIdList())) { + realService.deleteFormTable(entity.getDelFormTableIdList(), employee); + } + + stopWatch.stop(); + stopWatch.start(" batchSaveFormField controller start 4 batchUpdateFormTable"); + if (CollectionUtils.isNotEmpty(entity.getFormTableList())) { + Map customParam = entity.getCustomParam(); + if (MapUtils.isEmpty((Map)customParam)) { + customParam = new HashMap(); + } + + ((Map)customParam).put("module", module); + realService.batchUpdateFormTable(entity.getFormTableList(), new Form(formId), (Map)customParam, employee); + } + + stopWatch.stop(); + stopWatch.start(" batchSaveFormField controller start 5 batchDeleteFormField"); + if (CollectionUtils.isNotEmpty(entity.getIds())) { + realService.batchDeleteFormField(entity.getIds(), employee); + } + + stopWatch.stop(); + stopWatch.start(" batchSaveFormField controller start 6 batchDeleteFormField"); + if (CollectionUtils.isNotEmpty(formFields)) { + realService.batchUpdateFromFieldNew(new FormFieldParam(module.name(), formFields, new ArrayList(), entity.getCustomParam()), employee); + } + + stopWatch.stop(); + result.put("formFields", formFields); + Map costTime = formContextParam.getCostTime(); + costTime.put(" batchSaveFormField controller ", stopWatch.prettyPrint().replaceAll("\n", "|")); + result.put("costTime", costTime); + return WeaResult.success(result); + } + } + } catch (FormException var12) { + log.error("batchSaveFormFieldNew 异常:", var12); + return WeaResult.fail(WeaResultCodeEnum.ERROR.getCode(), SystemEnv.getHtmlLabelName(181358L, "批量保存字段失败:") + var12.getMessage(), var12.data, true); + } catch (Exception var13) { + log.error("batchSaveFormFieldNew 异常2:", var13); + return WeaResult.fail(SystemEnv.getHtmlLabelName(181358L, "批量保存字段失败:") + var13.getMessage(), false); + } } public List getJsonObjList(List> list){ @@ -499,7 +620,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic * 批量保存 * @return */ - public WeaResult> batchSaveInformation(String formid,List> formFieldList,List> detailFormList,ModuleSource moduleSource,Map customParam,List ids){ + public WeaResult> batchSaveInformation(String formid,List> formFieldList,List> detailFormList,ModuleSource moduleSource,Map customParam,List ids,SimpleEmployee employee){ FormFieldManageParam saveEmployeeEntity = new FormFieldManageParam(); saveEmployeeEntity.setFormId(Long.valueOf(formid)); saveEmployeeEntity.setModule(moduleSource); @@ -532,7 +653,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic saveEmployeeEntity.setIds(ids); saveEmployeeEntity.setForms(forms); saveEmployeeEntity.setCustomParam(customParam); - WeaResult>result = batchSaveFormField(saveEmployeeEntity); + WeaResult>result = batchSaveFormField(saveEmployeeEntity,employee); Gson gson = new Gson(); log.error("batchSaveInformation result :[{}]",gson.toJson(result)); return result;