whycxzp
2022-08-13 a1371a2912a6ef9b65354bb0d274be5fc3a21359
更新审批
3个文件已修改
50 ■■■■■ 已修改文件
src/main/java/com/whyc/pojo/Component.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ComponentService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetLinkService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/Component.java
@@ -1,11 +1,11 @@
package com.whyc.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import org.apache.ibatis.type.Alias;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@@ -48,6 +48,7 @@
    private Date    createDate;
    private Date updateDate;
    @ApiModelProperty(value = "是否可以表示",notes ="1可用,0不可用")
    @TableLogic(value = "1",delval = "0")
    private int status;
    @ApiModelProperty("工程图纸url")
src/main/java/com/whyc/service/ComponentService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
@@ -47,4 +48,9 @@
    public void insertBatch(List<Component> componentList) {
        mapper.insertBatchSomeColumn(componentList);
    }
    /**mybatis-plus逻辑删除*/
    public void deleteBatch(List<Integer> componentIdList) {
        mapper.deleteBatchIds(componentIdList);
    }
}
src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -244,24 +244,31 @@
                bomService.updateUrl(fileBomApprovingList);
            }
            else if(type.intValue() == EnumWorksheetType.Component.getType()){ //散装件
                //将散装件从审批表中转移到正式表
                List<Component> componentList = new LinkedList<>();
                List<ComponentApproving> approvingList = cAService.getListByMainId(link.getMainId());
                approvingList.forEach(approve->{
                    Component component = new Component();
                    component.setCategory(approve.getCategory());
                    component.setSubCode(approve.getSubCode());
                    component.setSubName(approve.getSubName());
                    component.setSubModel(approve.getSubModel());
                    component.setUnit(approve.getUnit());
                    component.setQuantity(approve.getQuantity());
                    component.setProducer(approve.getProducer());
                    component.setNotes(approve.getNotes());
                    component.setCreateDate(new Date());
                    component.setStatus(1);
                    componentList.add(component);
                });
                cService.insertBatch(componentList);
                List<Component> componentList = new LinkedList<>();
                //区分是新增还是删除
                Integer componentId = approvingList.get(0).getComponentId();
                if(componentId==null) { //新增
                    //将散装件从审批表中转移到正式表
                    approvingList.forEach(approve -> {
                        Component component = new Component();
                        component.setCategory(approve.getCategory());
                        component.setSubCode(approve.getSubCode());
                        component.setSubName(approve.getSubName());
                        component.setSubModel(approve.getSubModel());
                        component.setUnit(approve.getUnit());
                        component.setQuantity(approve.getQuantity());
                        component.setProducer(approve.getProducer());
                        component.setNotes(approve.getNotes());
                        component.setCreateDate(new Date());
                        component.setStatus(1);
                        componentList.add(component);
                    });
                    cService.insertBatch(componentList);
                }else{ //删除
                    List<Integer> componentIdList = approvingList.stream().map(ComponentApproving::getComponentId).collect(Collectors.toList());
                    cService.deleteBatch(componentIdList);
                }
                //更新散装件审批子表中type为完结
                cAService.endStatus(link.getMainId());
            }