| | |
| | | import doumeemes.core.model.PageData; |
| | | import doumeemes.core.model.PageWrap; |
| | | import doumeemes.core.utils.Constants; |
| | | import doumeemes.core.utils.excel.EasyExcelUtil; |
| | | import doumeemes.dao.ext.dto.DeviceImportDTO; |
| | | import doumeemes.dao.ext.dto.QueryDeviceExtDTO; |
| | | import doumeemes.dao.ext.dto.QueryUserDeviceExtDTO; |
| | | import doumeemes.dao.ext.dto.SalaryParamImportDTO; |
| | | import doumeemes.dao.ext.vo.DeviceExtListVO; |
| | | import doumeemes.service.ext.DeviceExtService; |
| | | import doumeemes.dao.ext.DeviceExtMapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import doumeemes.service.ext.UserDeviceExtService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | List<DeviceExtListVO> result = deviceExtMapper.getListByCondition(dto); |
| | | return result; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void importPlans(MultipartFile file) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!Constants.equalsInteger(user.getType(),Constants.USERTYPE.COM)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,您无权限进行该操作!"); |
| | | } |
| | | //解析excel |
| | | List<DeviceImportDTO> plansList = EasyExcelUtil.importExcel(file, 1, 1, DeviceImportDTO.class); |
| | | if(plansList == null || plansList.size()==0){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "导入数据内容有误!"); |
| | | } |
| | | |
| | | plansList.forEach(s->{ |
| | | |
| | | if (StringUtils.isBlank(s.getDeviceName()) |
| | | || s.getDeviceName().length() > 50 |
| | | || StringUtils.isBlank(s.getDepartName()) |
| | | || StringUtils.isBlank(s.getProcedureName()) |
| | | || StringUtils.isBlank(s.getProduceWarehouseLocationName()) |
| | | || StringUtils.isBlank(s.getFinishWarehouseLocationName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"导入数据内容有误"); |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |