| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.xml.crypto.Data; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | |
| | | public void addHis(DefectiveProducts defective) { |
| | | DefectiveProductsHistory his=new DefectiveProductsHistory(); |
| | | his.setDeftId(defective.getId()); |
| | | his.setRecordTime(defective.getStartTime()); |
| | | his.setBadProduct(defective.getBadProduct()); |
| | | his.setRecordTime(defective.getRecordTime()); |
| | | his.setConfirmStatus(defective.getConfirmStatus()); |
| | | his.setNote(defective.getNote()); |
| | | his.setReceiverIds(defective.getReceiverIds()); |
| | | his.setReceiverNames(defective.getReceiverNames()); |
| | | his.setDelProduct(0); |
| | | his.setDelId(defective.getSenderId()); |
| | | his.setDelName(defective.getSenderName()); |
| | | his.setRestProduct(defective.getRestProduct()); |
| | | mapper.insert(his); |
| | | } |
| | | //记录处理记录 |
| | | public void updateDefective( DefectiveProducts defective,DefectiveProductsHistory defectiveHis, List<MultipartFile> multipartFileList) { |
| | | defectiveHis.setRecordTime(new Date()); |
| | | Date date=new Date(); |
| | | defectiveHis.setRecordTime(date); |
| | | String recordTime=ActionUtil.sdfwithFTP.format(date); |
| | | String delName = ActionUtil.getUser().getName(); |
| | | Integer delId =ActionUtil.getUser().getId().intValue(); |
| | | defectiveHis.setDelId(delId); |
| | | String time = ActionUtil.sdfwithday.format(defective.getStartTime()); |
| | | defectiveHis.setDelName(delName); |
| | | String record = ActionUtil.sdfwithFTP.format(defective.getRecordTime()); |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | if(multipartFileList!=null && multipartFileList.size()!=0){ |
| | | String defectiveDirSuffix = "defective" + File.separator + defective.getSenderName() + File.separator + time + File.separator+delName+File.separator; |
| | | String defectiveDirSuffix = "defective" + File.separator + defective.getSenderName() + File.separator+ record + File.separator |
| | | +delName+File.separator+recordTime+File.separator; |
| | | String feedbackDir = rootFile + defectiveDirSuffix; |
| | | File fileDir = new File(feedbackDir); |
| | | if (!fileDir.exists()) { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | defective.setFileUrl("doc_file" + File.separator + defectiveDirSuffix); |
| | | defectiveHis.setDelUrl(defectiveDirSuffix); |
| | | } |
| | | mapper.insert(defectiveHis); |
| | | } |