#
mrzhssss
2022-04-06 682822438b89a99787be856f2af2a39b996c6361
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package zy.cloud.wms.manager.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import org.springframework.beans.factory.annotation.Autowired;
import zy.cloud.wms.manager.entity.Item;
import zy.cloud.wms.manager.mapper.ItemReportMapper;
import zy.cloud.wms.manager.entity.ItemReport;
import zy.cloud.wms.manager.service.ItemReportService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import zy.cloud.wms.manager.service.ItemService;
 
import java.util.Date;
 
@Service("itemReportService")
public class ItemReportServiceImpl extends ServiceImpl<ItemReportMapper, ItemReport> implements ItemReportService {
    @Autowired
    private ItemService itemService;
 
    /**
     * 初始化生成report
     * @param report
     * @param userId
     */
    @Override
    public void init(ItemReport report, Long userId) {
        /**
         * 控管与参数初始化
         */
        Date now = new Date();
        Item id = itemService.selectOne(new EntityWrapper<Item>()
                .eq("id", report.getItemId()));
        if (Cools.isEmpty(id)) {
            throw new CoolException("找不到该项目,请联系管理员");
        }
        report.setItemName(id.getName());
 
 
        /**
         * 如果前端返回原因,表示有异常,将状态设置为true
         */
        if (report.getDeliverReason() == null || report.getDeliverReason().equals("")) {
            report.setDeliverIssue(false);
        }else {
            report.setDeliverIssue(true);
        }
 
        if (report.getQualityReason() == null || report.getQualityReason().equals("")) {
            report.setQualityIssue(false);
        }else {
            report.setQualityIssue(true);
        }
 
        if (report.getDesignReason() == null || report.getDesignReason().equals("")) {
            report.setDesignIssue(false);
        }else {
            report.setDesignIssue(true);
        }
 
        if (report.getInstallReason() == null || report.getInstallReason().equals("")) {
            report.setInstallIssue(false);
        }else {
            report.setInstallIssue(true);
        }
        report.setUpdateTime(now);
        report.setUpdateBy(userId);
        report.setCreateTime(now);
        report.setCreateBy(userId);
        insert(report);
    }
}