| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.api.config.Interceptor.UserHelper; |
| | | import com.moral.api.controller.LogController; |
| | | import com.moral.api.entity.*; |
| | | import com.moral.api.exception.BusinessException; |
| | | import com.moral.api.mapper.AllocationLogMapper; |
| | | import com.moral.api.mapper.AllocationMapper; |
| | | import com.moral.api.mapper.ResponsibilityUnitMapper; |
| | | import com.moral.api.mapper.SysDictDataMapper; |
| | | import com.moral.api.mapper.SysDictTypeMapper; |
| | | import com.moral.api.mapper.UserLogMapper; |
| | | import com.moral.api.mapper.UserMapper; |
| | | import com.moral.api.pojo.bean.BaseInvalidEntity; |
| | | import com.moral.api.pojo.dto.allocation.AllocationUnitViewDto; |
| | |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | | import com.moral.util.DateUtils; |
| | | import com.moral.util.WebUtils; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | |
| | | @Service |
| | |
| | | private SysDictTypeService sysDictTypeService; |
| | | @Autowired |
| | | private UserService userService; |
| | | @Autowired |
| | | private AllocationLogMapper allocationLogMapper; |
| | | |
| | | /** |
| | | * 根据字典类型获取字典数据 |
| | |
| | | return appAuthority; |
| | | } |
| | | |
| | | /** |
| | | * 修改责任单位 |
| | | * |
| | | * @param id |
| | | * @param unitId |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void updataUnit(Integer id, Integer unitId,Integer polluteType) { |
| | | AllocationLog allocationLog = new AllocationLog(); |
| | | //获取用户信息 |
| | | QxUser user = UserHelper.getCurrentUser(); |
| | | Allocation allocation = allocationMapper.selectById(id); |
| | | if (!ObjectUtils.isEmpty(unitId)){ |
| | | ResponsibilityUnit unitName1 = getUnitName(allocation.getUnitId()); |
| | | ResponsibilityUnit unitName2 = getUnitName(unitId); |
| | | allocation.setUnitId(unitId); |
| | | allocationLog.setContent(unitName1.getUnitName()+"----修改成----"+unitName2.getUnitName()); |
| | | |
| | | } |
| | | if (!ObjectUtils.isEmpty(polluteType)){ |
| | | SysDictData sysDictData1 = sysDictTypeService.listOne(Constants.WU_RAN_LEI_XING,allocation.getPolluteType().toString()); |
| | | SysDictData sysDictData2 = sysDictTypeService.listOne(Constants.WU_RAN_LEI_XING, polluteType.toString()); |
| | | allocation.setPolluteType(polluteType); |
| | | allocationLog.setPolluteType(sysDictData1.getDataValue()+"----修改成----"+sysDictData2.getDataValue()); |
| | | } |
| | | |
| | | allocationMapper.updateById(allocation); |
| | | //日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); |
| | | allocationLog.setAllocationNum(allocation.getAllocationNum()); |
| | | allocationLog.setIp(WebUtils.getIpAddr(request)); |
| | | allocationLog.setAccountId(user.getUserId()); |
| | | allocationLog.setAccount(user.getAccount()); |
| | | allocationLog.setUserName(user.getUserName()); |
| | | allocationLog.setCreateTime(new Date()); |
| | | allocationLogMapper.insert(allocationLog); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查看修改记录 |
| | | * |
| | | * @param allocationNum |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<AllocationLog> getLog(String allocationNum) { |
| | | LambdaQueryWrapper<AllocationLog> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(AllocationLog::getAllocationNum,allocationNum); |
| | | wrapper.orderByAsc(AllocationLog::getCreateTime); |
| | | List<AllocationLog> allocationLogs = allocationLogMapper.selectList(wrapper); |
| | | return allocationLogs; |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> unitResult() { |
| | | QxUser user = UserHelper.getCurrentUser(); |