大件运输联网系统后端代码
guoshilong
2022-12-14 ada898412517f7259ffe19ee57fcc4b47e511550
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.application.service.impl;
 
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.application.entity.*;
import org.springblade.modules.application.service.*;
import org.springblade.modules.application.vo.ApplicationVO;
import org.springblade.modules.application.mapper.ApplicationMapper;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.application.wrapper.ApplicationWrapper;
import org.springblade.modules.enterprise.wrapper.EnterpriseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.transaction.annotation.Transactional;
 
/**
 * 申请表 服务实现类
 *
 * @author BladeX
 * @since 2022-12-13
 */
@Service
@AllArgsConstructor
public class ApplicationServiceImpl extends BaseServiceImpl<ApplicationMapper, ApplicationEntity> implements IApplicationService {
    private final IBasicInfoService basicInfoService;
    private final IPlanService planService;
    private final ISchemeService schemeService;
    private final IGoodsService goodsService;
    private final ICarService carService;
 
    @Override
    public IPage<ApplicationVO> selectApplicationPage(IPage<ApplicationVO> page, ApplicationVO application) {
        return page.setRecords(baseMapper.selectApplicationPage(page, application));
    }
 
    @Transactional
    @Override
    public Boolean saveVo(ApplicationEntity application, BasicInfoEntity basicInfoEntity, CarEntity carEntity, PlanEntity planEntity, SchemeEntity schemeEntity, GoodsEntity goodsEntity) {
        boolean save = super.save(application);
 
        basicInfoEntity.setApplicationId(application.getId().toString());
        boolean b = basicInfoService.save(basicInfoEntity);
 
        planEntity.setApplicationId(application.getId().toString());
        boolean p = planService.save(planEntity);
 
        schemeEntity.setApplicationId(application.getId().toString());
        boolean s = schemeService.save(schemeEntity);
 
        goodsEntity.setApplicationId(application.getId().toString());
        boolean g = goodsService.save(goodsEntity);
 
        carEntity.setApplicationId(application.getId().toString());
        boolean c = carService.save(carEntity);
 
        return b&&p&&s&&g&&c&&save;
    }
 
    @Override
    public ApplicationVO getVo(ApplicationEntity application) {
        ApplicationVO applicationVO = ApplicationWrapper.build().entityVO(application);
        String applicationId = applicationVO.getId().toString();
 
        applicationVO.setBasicInfoEntity(basicInfoService.getOne(Condition.getQueryWrapper(new BasicInfoEntity(applicationId))));
        applicationVO.setSchemeEntity(schemeService.getOne(Condition.getQueryWrapper(new SchemeEntity(applicationId))));
        applicationVO.setPlanEntity(planService.getOne(Condition.getQueryWrapper(new PlanEntity(applicationId))));
        applicationVO.setCarEntity(carService.getOne(Condition.getQueryWrapper(new CarEntity(applicationId))));
        applicationVO.setBasicInfoEntity(basicInfoService.getOne(Condition.getQueryWrapper(new BasicInfoEntity(applicationId))));
 
        GoodsEntity goods = goodsService.getOne(Condition.getQueryWrapper(new GoodsEntity(applicationId)));
        applicationVO.setGoodsEntity(goods);
        applicationVO.setGoodsEntity(goods);
        return applicationVO;
    }
 
    @Override
    @Transactional
    public Boolean updateVoById(ApplicationEntity application, BasicInfoEntity basicInfoEntity, CarEntity carEntity, PlanEntity planEntity, SchemeEntity schemeEntity, GoodsEntity goodsEntity) {
//        basicInfoEntity.setId(application.getBasicInfoId());
//        carEntity.setId(application.getCarId());
//        planEntity.setId(Long.parseLong(application.getPlanId()));
//        schemeEntity.setId(Long.parseLong(application.getSchemeId()));
//        goodsEntity.setId(application.getGoodsId());
 
        boolean b = basicInfoService.updateById(basicInfoEntity);
        boolean c = carService.updateById(carEntity);
        boolean p = planService.updateById(planEntity);
        boolean s = schemeService.updateById(schemeEntity);
        boolean g = goodsService.updateById(goodsEntity);
        boolean update = super.updateById(application);
        return  b&&p&&s&&g&&c&&update;
    }
 
}