李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
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
package com.chinaztt.mes.plan.service.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaztt.mes.plan.dto.CustomerOrderForJointStockCompanyDTO;
import com.chinaztt.mes.plan.dto.OrderParamDTO;
import com.chinaztt.mes.plan.entity.CustomerOrderForJointStockCompany;
import com.chinaztt.mes.plan.entity.OrderParam;
import com.chinaztt.mes.plan.mapper.CustomerOrderForJointStockCompanyMapper;
import com.chinaztt.mes.plan.mapper.OrderParamMapper;
import com.chinaztt.mes.plan.service.CustomerOrderForJointStockCompanyService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * @Description : 客户订单明细表(股份公司)
 * @ClassName : CustomerOrderForJointStockCompanyServiceImpl
 * @Author : user
 * @Date: 2022-08-16  15:22
 */
@Slf4j
@Service
@AllArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CustomerOrderForJointStockCompanyServiceImpl extends ServiceImpl<CustomerOrderForJointStockCompanyMapper, CustomerOrderForJointStockCompany> implements CustomerOrderForJointStockCompanyService{
    private OrderParamMapper orderParamMapper;
 
    @Override
    public IPage getCustomerOrderPage(Page page, QueryWrapper<CustomerOrderForJointStockCompany> planCustomerOrder, String type) {
        IPage iPage = baseMapper.getCustomerOrderPage(page, planCustomerOrder, type);
        return iPage;
    }
 
    @Override
    public CustomerOrderForJointStockCompanyDTO getCustomerOrderById(Long id) {
        CustomerOrderForJointStockCompany newCustomerOrder = baseMapper.selectById(id);
        CustomerOrderForJointStockCompanyDTO customerOrderDTO = new CustomerOrderForJointStockCompanyDTO();
        BeanUtils.copyProperties(newCustomerOrder, customerOrderDTO);
 
        //获取字段和列名
        List<OrderParamDTO> orderParamList = orderParamMapper.getAllOrder();
        customerOrderDTO.setOrderParamList(orderParamList);
        //拼接crosstab所需要的验证数据
        OrderParam orderParam = orderParamMapper.getParam();
        //获取客户订单和绑定的订单参数
        JSONObject customerOrderList = baseMapper.getCustomerOrderById(id, orderParam);
        customerOrderDTO.setCustomerOrderList(customerOrderList);
        List<JSONObject> list = new ArrayList<>();
        customerOrderDTO.setCustomerOrderAttachmentList(list);
 
 
        return customerOrderDTO;
    }
}