| | |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.FileUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | |
| | | String senderName = ActionUtil.getUser().getName(); |
| | | Integer senderId =ActionUtil.getUser().getId().intValue(); |
| | | defective.setSenderId(senderId); |
| | | defective.setSenderName(senderName); |
| | | Date date=new Date(); |
| | | defective.setRecordTime(date); |
| | | defective.setRestProduct(defective.getBadProduct()); |
| | | if(defective.getStartTime()==null){ |
| | | //保存 |
| | | defective.setStartTime(new Date()); |
| | | defective.setStartTime(date); |
| | | } |
| | | String time = ActionUtil.sdfwithday.format(defective.getStartTime()); |
| | | //String feedbackZipPath = "defective" + File.separator + username + "_" + time+".zip"; |
| | | String recordtime = ActionUtil.sdfwithFTP.format(defective.getRecordTime()); |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | if(multipartFileList!=null && multipartFileList.size()!=0){ |
| | | String defectiveDirSuffix = "defective" + File.separator + senderName + File.separator + time + File.separator; |
| | | String defectiveDirSuffix = "defective" + File.separator + senderName + File.separator+ recordtime + File.separator; |
| | | String feedbackDir = rootFile + defectiveDirSuffix; |
| | | File fileDir = new File(feedbackDir); |
| | | if (!fileDir.exists()) { |
| | |
| | | multipartFile.transferTo(file); |
| | | } |
| | | //ZipUtils.toZip(fileList,new FileOutputStream(new File(rootFile+feedbackZipPath))); |
| | | defective.setFileUrl("doc_file" + File.separator + defectiveDirSuffix); |
| | | defective.setFileUrl(defectiveDirSuffix); |
| | | } |
| | | |
| | | |
| | |
| | | public Response getDefectiveLimit(DefectiveDto defectiveDto) { |
| | | PageHelper.startPage(defectiveDto.getPageCurr(),defectiveDto.getPageSize()); |
| | | List<DefectiveProducts> list=mapper.getDefectiveLimit(defectiveDto); |
| | | String rootFile = CommonUtil.getRootFile();//主路径 |
| | | for (DefectiveProducts defective:list) { |
| | | String filePath=defective.getFileUrl(); |
| | | String startTimeEx=ActionUtil.sdfwithday.format(defective.getStartTime()); |
| | | defective.setStartTimeEx(startTimeEx); |
| | | if(filePath!=null&&!filePath.isEmpty()){ |
| | | defective.setFileUrl("doc_file"+File.separator+filePath); |
| | | defective.setNameList(FileUtil.getFileNameWithOutDirectory(rootFile+filePath)); |
| | | |
| | | } |
| | | List<DefectiveProductsHistory> hisList=defective.getHisList(); |
| | | if(hisList!=null&&hisList.size()>0){ |
| | | for (DefectiveProductsHistory his:defective.getHisList()) { |
| | | String hisDelPath=his.getDelUrl(); |
| | | if(hisDelPath!=null&&!hisDelPath.isEmpty()){ |
| | | his.setDelUrl("doc_file"+File.separator+hisDelPath); |
| | | his.setHisNameList(FileUtil.getFileNameWithOutDirectory(rootFile+hisDelPath)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"不良品首页推送"); |
| | | } |
| | |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.set("receiver_ids",defectiveHis.getReceiverIds()); |
| | | wrapper.set("receiver_names",defectiveHis.getReceiverNames()); |
| | | wrapper.set("bad_product",defectiveHis.getBadProduct()); |
| | | if(defectiveHis.getBadProduct()==0){ |
| | | int resProduct=defective.getRestProduct()-defectiveHis.getDelProduct(); |
| | | wrapper.set("rest_product",resProduct); |
| | | if(resProduct==0){ |
| | | defectiveHis.setConfirmStatus(2);//不良品数量为0结束 |
| | | }else { |
| | | defectiveHis.setConfirmStatus(1); |
| | |
| | | wrapper.set("note",defectiveHis.getNote()); |
| | | wrapper.eq("id",defectiveHis.getDeftId()); |
| | | mapper.update(null,wrapper); |
| | | |
| | | //记录处理记录 |
| | | defectiveHisService.updateDefective(defective,defectiveHis,multipartFileList); |
| | | |
| | |
| | | wrapper.set("confirm_status",3);//归档 |
| | | wrapper.set("receiver_ids",""); |
| | | wrapper.set("receiver_names",""); |
| | | wrapper.set("bad_product",0); |
| | | wrapper.set("rest_product",0); |
| | | wrapper.set("note",""); |
| | | wrapper.eq("id",deftId); |
| | | mapper.update(null,wrapper); |
| | |
| | | defectiveHis.setDeftId(deftId); |
| | | defectiveHis.setDelId(ActionUtil.getUser().getId().intValue()); |
| | | defectiveHis.setConfirmStatus(3); |
| | | defectiveHis.setBadProduct(0); |
| | | defectiveHis.setDelId(ActionUtil.getUser().getId().intValue()); |
| | | defectiveHis.setDelProduct(0); |
| | | defectiveHis.setDelName(ActionUtil.getUser().getName()); |
| | | defectiveHisService.stopDefective(defectiveHis); |
| | | return new Response().set(1,true); |
| | | } |