| | |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | | content.append("添加了组织:").append(organization.getName()); |
| | | logUtils.saveOperationForManage(request, content.toString()); |
| | | content.append("添加了组织:").append(organization.getName()+";"); |
| | | logUtils.saveOperationForManage(request, content.toString(),Constants.INSERT_OPERATE_TYPE); |
| | | return organizationDTO; |
| | | } |
| | | |
| | |
| | | organizationDTO.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | | content.append("更新了组织:").append(organization.getName()).append(";"); |
| | | //更新对象转为Map |
| | | Map<String, Object> newParameters = JSONObject.parseObject(JSON.toJSONString(organizationUpdateForm), Map.class); |
| | | Map<String, Object> oldParameters = JSONObject.parseObject(JSON.toJSONString(existOrganization), Map.class); |
| | | Set<String> keys = organizationFormMap.keySet(); |
| | | for (String key : keys) { |
| | | String value = organizationFormMap.get(key); |
| | | if ("parentName".equals(key)) {//更新父组织特殊处理 |
| | | if (organizationUpdateForm.getParentId() != null) {//判断父组织是否进行了更新 |
| | | String oldParentName = "空"; |
| | | String newParentName = "空"; |
| | | if (!existOrganization.getParentId().equals(0)) { |
| | | oldParentName = organizationMapper.selectById(existOrganization.getParentId()).getName(); |
| | | } |
| | | if (!organization.getParentId().equals(0)) { |
| | | newParentName = organizationMapper.selectById(organization.getParentId()).getName(); |
| | | } |
| | | content.append(value + ":" + oldParentName + "->" + newParentName + ";"); |
| | | } |
| | | } else if ("expireTime".equals(key)) {//expireTime时间格式特殊处理 |
| | | if (organizationUpdateForm.getExpireTime() != null) { |
| | | Date oldExpireTime = existOrganization.getExpireTime(); |
| | | Date newExpireTime = organization.getExpireTime(); |
| | | String oldExpireTimeStr = DateUtils.dateToDateString(oldExpireTime, "yyyy-MM-dd"); |
| | | String newExpireTimeStr = DateUtils.dateToDateString(newExpireTime, "yyyy-MM-dd"); |
| | | content.append(value + ":" + oldExpireTimeStr + "->" + newExpireTimeStr + ";"); |
| | | } |
| | | } else {//处理其他属性 |
| | | if (newParameters.get(key) != null) { |
| | | String newValue = "空"; |
| | | String oldValue = "空"; |
| | | if (newParameters.get(key) != null && !newParameters.get(key).equals(" ")) { |
| | | newValue = String.valueOf(newParameters.get(key)); |
| | | } |
| | | if (oldParameters.get(key) != null && !oldParameters.get(key).equals(" ")) { |
| | | oldValue = String.valueOf(oldParameters.get(key)); |
| | | } |
| | | content.append(value + ":" + oldValue + "->" + newValue + ";"); |
| | | } |
| | | } |
| | | } |
| | | logUtils.saveOperationForManage(request, content.toString()); |
| | | insertUpdateLog(organizationUpdateForm,organization,existOrganization); |
| | | |
| | | return organizationDTO; |
| | | } |
| | |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | | content.append("删除了组织:").append(existOrganization.getName()); |
| | | content.append("删除了组织:").append(existOrganization.getName()+";"); |
| | | if(form.getDeleteChildren().equals(Constants.DELETE_CHILDREN_ORG)) |
| | | content.append("以及所有子组织"); |
| | | logUtils.saveOperationForManage(request, content.toString()); |
| | | content.append("以及所有子组织;"); |
| | | logUtils.saveOperationForManage(request, content.toString(),Constants.DELETE_OPERATE_TYPE); |
| | | |
| | | return dto; |
| | | } |
| | |
| | | return dto; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 将organization的address字段与provinceName cityName areaName进行拼接 |
| | | * @Param: [organization] |
| | |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2021/4/2 |
| | | */ |
| | | public void changeAddressByOrganization(Organization organization) { |
| | | private void changeAddressByOrganization(Organization organization) { |
| | | String provinceName = organization.getProvinceName(); |
| | | String cityName = organization.getCityName(); |
| | | String areaName = organization.getAreaName(); |
| | |
| | | |
| | | organization.setAddress(newAddress.toString()); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 将更新操作插入日志 |
| | | * @Param: [updateForm, newOrganization, oldOrganization] |
| | | * @return: void |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2021/4/8 |
| | | */ |
| | | private void insertUpdateLog(OrganizationUpdateForm updateForm,Organization newOrganization,Organization oldOrganization){ |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | StringBuilder content = new StringBuilder(); |
| | | content.append("修改了组织:").append(oldOrganization.getName()).append(";"); |
| | | //对象转为Map,获取对象更新前后的属性 |
| | | Map<String, Object> newParameters = JSONObject.parseObject(JSON.toJSONString(updateForm), Map.class); |
| | | Map<String, Object> oldParameters = JSONObject.parseObject(JSON.toJSONString(oldOrganization), Map.class); |
| | | //遍历配置文件中的Map,将属性转化为汉字 |
| | | Set<String> keys = organizationFormMap.keySet(); |
| | | for (String key : keys) { |
| | | String value = organizationFormMap.get(key);//属性对应的汉字 |
| | | if ("parentName".equals(key)) {//更新父组织特殊处理 |
| | | if (updateForm.getParentId() != null) {//判断父组织是否进行了更新 |
| | | String oldParentName = "空"; |
| | | String newParentName = "空"; |
| | | if (!oldOrganization.getParentId().equals(0)) { |
| | | oldParentName = organizationMapper.selectById(oldOrganization.getParentId()).getName(); |
| | | } |
| | | if (!newOrganization.getParentId().equals(0)) { |
| | | newParentName = organizationMapper.selectById(newOrganization.getParentId()).getName(); |
| | | } |
| | | content.append(value + ":" + oldParentName + "->" + newParentName + ";"); |
| | | } |
| | | } else if ("expireTime".equals(key)) {//expireTime时间格式特殊处理 |
| | | if (updateForm.getExpireTime() != null) { |
| | | Date oldExpireTime = oldOrganization.getExpireTime(); |
| | | Date newExpireTime = newOrganization.getExpireTime(); |
| | | String oldExpireTimeStr = DateUtils.dateToDateString(oldExpireTime, "yyyy-MM-dd"); |
| | | String newExpireTimeStr = DateUtils.dateToDateString(newExpireTime, "yyyy-MM-dd"); |
| | | content.append(value + ":" + oldExpireTimeStr + "->" + newExpireTimeStr + ";"); |
| | | } |
| | | } else {//处理其他属性 |
| | | if (newParameters.get(key) != null) { |
| | | String newValue = "空"; |
| | | String oldValue = "空"; |
| | | if (newParameters.get(key) != null && !newParameters.get(key).equals(" ")) { |
| | | newValue = String.valueOf(newParameters.get(key)); |
| | | } |
| | | if (oldParameters.get(key) != null && !oldParameters.get(key).equals(" ")) { |
| | | oldValue = String.valueOf(oldParameters.get(key)); |
| | | } |
| | | content.append(value + ":" + oldValue + "->" + newValue + ";"); |
| | | } |
| | | } |
| | | } |
| | | logUtils.saveOperationForManage(request, content.toString(),Constants.UPDATE_OPERATE_TYPE); |
| | | } |
| | | |
| | | |
| | | } |