对比新文件 |
| | |
| | | package com.gk.firework.Service.ServiceImpl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gk.firework.Domain.Exception.BusinessException; |
| | | import com.gk.firework.Domain.StandardLawList; |
| | | import com.gk.firework.Domain.UserInfo; |
| | | import com.gk.firework.Domain.Utils.Properties; |
| | | import com.gk.firework.Domain.Utils.StringUtils; |
| | | import com.gk.firework.Domain.Utils.UploadUtil; |
| | | import com.gk.firework.Mapper.StandardLawListMapper; |
| | | import com.gk.firework.Service.StandardLawListService; |
| | | import com.gk.firework.Service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | @Service("standardLawListService") |
| | | public class StandardLawListServiceImpl extends ServiceImpl<StandardLawListMapper, StandardLawList> implements StandardLawListService { |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | @Autowired |
| | | private StandardLawListMapper standardLawListMapper; |
| | | |
| | | /** |
| | | * @Description: 适用法律法规分页查询 |
| | | * @date 2021/5/8 13:54 |
| | | */ |
| | | @Override |
| | | public IPage selectPage(Page<StandardLawList> page, Map filter, UserInfo userInfo) { |
| | | |
| | | UserInfo user = userService.getById(userInfo.getId()); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | //菜单 |
| | | //可视权限 |
| | | { |
| | | params.put("enterprisenumber", user.getCompanynumber()); |
| | | params.put("province", user.getProvince()); |
| | | params.put("city", user.getCity()); |
| | | params.put("district", user.getArea()); |
| | | params.put("street", user.getTown()); |
| | | params.put("committee", user.getCommunity()); |
| | | } |
| | | |
| | | params.put("filterProvince", filter.get("province")); |
| | | params.put("filterCity", filter.get("city")); |
| | | params.put("filterDistrict", filter.get("district")); |
| | | params.put("filterStreet", filter.get("street")); |
| | | params.put("filterCommittee", filter.get("committee")); |
| | | params.put("safetysupervision", filter.get("safetysupervision")); |
| | | params.put("enterprisename", filter.get("enterprisename")); |
| | | //按法律法规标准查 |
| | | params.put("name", filter.get("name")); |
| | | List<StandardLawList> list = standardLawListMapper.selectPages(page,params); |
| | | return page.setRecords(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 新增法律法规清单 |
| | | * @date 2021/5/8 14:06 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void addStandardLawList(StandardLawList standardLawList, UserInfo userInfo) { |
| | | if (standardLawList.getFile() == null) { |
| | | throw new BusinessException("需要上传文件"); |
| | | } |
| | | |
| | | UserInfo user = userService.getById(userInfo.getId()); |
| | | standardLawList.setCreateby(user.getId()); |
| | | standardLawList.setCreatebyname(user.getUsername()); |
| | | standardLawList.setCreatetime(new Date()); |
| | | standardLawList.setValidflag(true); |
| | | standardLawList.setEnterprisenumber(user.getUsername()); |
| | | standardLawList.setEnterprisename(user.getUsername()); |
| | | |
| | | assert standardLawList.getFile() != null; |
| | | try { |
| | | String name = UploadUtil.uploadFile(standardLawList.getFile(), Properties.standardPath); |
| | | standardLawList.setFilename(standardLawList.getFile().getOriginalFilename()); |
| | | standardLawList.setUrl(Properties.standard + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException("上传文件失败"); |
| | | } |
| | | this.save(standardLawList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 修改法律法规清单 |
| | | * @date 2021/5/8 14:07 |
| | | */ |
| | | @Override |
| | | public void modStandardLawList(StandardLawList standardLawList, UserInfo user) { |
| | | standardLawList.setUpdateby(user.getId()); |
| | | standardLawList.setUpdatebyname(user.getUsername()); |
| | | standardLawList.setUpdatetime(new Date()); |
| | | |
| | | try { |
| | | if (standardLawList.getFile() != null) { |
| | | String name = UploadUtil.uploadFile(standardLawList.getFile(), Properties.standardPath); |
| | | standardLawList.setFilename(standardLawList.getFile().getOriginalFilename()); |
| | | standardLawList.setUrl(Properties.standard + name); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException("上传文件失败"); |
| | | } |
| | | this.updateById(standardLawList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 删除法律法规清单 |
| | | * @date 2021/5/8 14:11 |
| | | */ |
| | | @Override |
| | | public void delStandardLawList(Long id, UserInfo user) { |
| | | LambdaUpdateWrapper<StandardLawList> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.set(StandardLawList::getValidflag, false) |
| | | .set(StandardLawList::getUpdatetime, new Date()) |
| | | .set(StandardLawList::getUpdateby, user.getId()) |
| | | .set(StandardLawList::getUpdatebyname,user.getUsername()) |
| | | .eq(StandardLawList::getId, id); |
| | | this.update(updateWrapper); |
| | | } |
| | | } |