Blame view

src/main/java/com/huaheng/api/U8/Service/DeptAPIService.java 3 KB
pengcheng authored
1
package com.huaheng.api.U8.Service;
2
3
4


import com.huaheng.api.U8.domain.ICSDepartmentModel;
zengbo authored
5
6
import com.huaheng.api.general.Controller.BasicDataApi;
import com.huaheng.api.general.service.BasicDataApiService;
7
import com.huaheng.framework.web.domain.AjaxResult;
8
9
10
11
12
import com.huaheng.pc.general.company.domain.WarehouseCompany;
import com.huaheng.pc.general.company.mapper.WarehouseCompanyMapperAuto;
import com.huaheng.pc.system.dept.domain.Dept;
import com.huaheng.pc.system.dept.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.stereotype.Service;
14
15
16
17
18
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
19
20

@Service
tangying authored
21
public class DeptAPIService {
22
23
24
25
26
27
    @Autowired
    IDeptService iDeptService;

    @Resource
    private WarehouseCompanyMapperAuto warehouseCompanyMapperAuto;
zengbo authored
28
    @Autowired
zengbo authored
29
    BasicDataApiService basicDataApiService;
zengbo authored
30
31
32
    @Transactional
    public AjaxResult ICSDepartment(ICSDepartmentModel ICSDepartment) {
pengcheng authored
33
34
35
36
37
38
//        WarehouseCompany warehouseCompany = new WarehouseCompany();
//        warehouseCompany.setCompanyCode(ICSDepartment.getCompanyCode());
//        List<WarehouseCompany> list = warehouseCompanyMapperAuto.selectListEntityByEqual(warehouseCompany);
//        if (list == null || list.size() == 0) {
//            return AjaxResult.error("系统中没有该货主:" + warehouseCompany.toString() + "  信息,请先录入货主信息!");
//        }
zengbo authored
39
40
41
42
43
        Dept dept = new Dept();
        dept.setCode(ICSDepartment.getcDepCode());
        dept.setDeptName(ICSDepartment.getcDepName());
        dept.setCreateTime(new Date());
        dept.setUpdateTime(new Date());
zengbo authored
44
        AjaxResult ajaxResult = basicDataApiService.dept(dept);
zengbo authored
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
        return ajaxResult;

//        int result = 0
//        判断部门中是否有该部门,如果没有则新增,有则更新
//        if (iDeptService.selectDepts(ICSDepartment.getcDepCode()) == null) {
//            Dept dept = new Dept();
//            dept.setCode(ICSDepartment.getcDepCode());
//            dept.setDeptName(ICSDepartment.getcDepName());
//            dept.setCreateTime(new Date());
//            dept.setUpdateTime(new Date());
//            result = iDeptService.insertDepts(dept);
//            if (result < 1) {
//                throw new ServiceException("新增部门档案失败!");
//            } else {
//                return AjaxResult.success("新增部门档案成功");
//            }
//        } else {
//            Dept dept = new Dept();
//            dept.setCode(ICSDepartment.getcDepCode());
//            dept.setDeptName(ICSDepartment.getcDepName());
//            dept.setUpdateTime(new Date());
//            result = iDeptService.insertDepts(dept);
//            if (result < 1) {
//                throw new ServiceException("更新部门档案失败!");
//            }else {
//                return AjaxResult.success("更新部门档案成功");
//            }
//        }
74
75
    }
}