whyclxw
2024-07-23 f171f23316d432f01a05d577d4fb4a4c54e53d81
不良品录入
3个文件已修改
29 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/DefectiveProductsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/DefectiveProductsHistoryService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/DefectiveProductsService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/DefectiveProductsController.java
@@ -34,7 +34,7 @@
    @ApiOperation("处理不良品")
    @PostMapping("updateDefective")
    public Response updateDefective(@RequestBody DefectiveProductsHistory defectiveHis) throws IOException, MessagingException {
    public Response updateDefective(@RequestBody DefectiveProductsHistory defectiveHis) {
        return service.updateDefective(defectiveHis);
    }
}
src/main/java/com/whyc/service/DefectiveProductsHistoryService.java
@@ -7,6 +7,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class DefectiveProductsHistoryService {
@@ -25,4 +27,9 @@
        his.setReceiverNames(defective.getReceiverNames());
        mapper.insert(his);
    }
    //记录处理记录
    public void updateDefective(DefectiveProductsHistory defectiveHis) {
        defectiveHis.setRecordTime(new Date());
        mapper.insert(defectiveHis);
    }
}
src/main/java/com/whyc/service/DefectiveProductsService.java
@@ -1,6 +1,8 @@
package com.whyc.service;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.DefectiveDto;
@@ -11,11 +13,11 @@
import com.whyc.pojo.DefectiveProducts;
import com.whyc.pojo.DefectiveProductsHistory;
import com.whyc.pojo.DocUser;
import com.whyc.pojo.ProductHistory;
import com.whyc.util.ActionUtil;
import com.whyc.util.CommonUtil;
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 javax.annotation.Resource;
@@ -42,8 +44,11 @@
    private DefectiveProductsHistoryService defectiveHisService;
    //录入不良品信息
    public Response addDefective(DefectiveProducts defective, List<MultipartFile> multipartFileList) throws IOException {
        //初次录入状态为0
        defective.setConfirmStatus(0);
        Date date = new Date();
        //压缩包的路径及格式为: doc_file/defective/username_time.zip
        String username = ActionUtil.getUser().getName();
@@ -128,7 +133,20 @@
    }
    //处理不良品
    @Transactional
    public Response updateDefective(DefectiveProductsHistory defectiveHis) {
        //修改当前表记录
        UpdateWrapper wrapper=new UpdateWrapper();
        wrapper.set("receiver_ids",defectiveHis.getReceiverIds());
        wrapper.set("receiver_names",defectiveHis.getReceiverNames());
        wrapper.set("confirm_status",defectiveHis.getConfirmStatus());
        wrapper.set("bad_product",defectiveHis.getBadProduct());
        wrapper.set("note",defectiveHis.getNote());
        wrapper.set("id",defectiveHis.getDeftId());
        mapper.update(null,wrapper);
        //记录处理记录
        defectiveHisService.updateDefective(defectiveHis);
        return new Response().set(1,true);
    }
}