张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
package com.thhy.materials.modules.biz.pipeplan.service.impl;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UserInfoUtils;
import com.thhy.materials.modules.biz.pipeplan.entity.TPipeInfo;
import com.thhy.materials.modules.biz.pipeplan.mapper.TPipeInfoMapper;
import com.thhy.materials.modules.biz.pipeplan.service.SegmentPrintService;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Service
public class SegmentPrintServiceImpl implements SegmentPrintService {
 
    @Resource
    private TPipeInfoMapper pipeInfoMapper;
 
    @Override
    public BasicResult printPlanList(Map<String, Object> values) {
        //登录人  分公司id
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        values.put("companyId",companyId);
        //  1 当天
        Integer typeTime = Integer.valueOf(values.get("typeTime").toString());
        if(typeTime==1){
            //当前日期  查询当天的数据
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            Date date = new Date();
            String format1 = format.format(date);
            values.put("newTime",format1);
        }
        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
        PageHelper.startPage(pageNum,pageSize);
        List<TPipeInfo> pipeInfos = pipeInfoMapper.printPlanList(values);
        PageInfo<TPipeInfo> tPipeInfoPageInfo = new PageInfo<>(pipeInfos);
        return BasicResult.success(tPipeInfoPageInfo);
    }
 
    @Override
    public BasicResult printRecord(Map<String, Object> values) {
        values.put("id","");
        //已打印管片id
        List<String> recordIds = (List<String>) values.get("recordIds");
        if(recordIds.size()>0){
            for (String recordId :recordIds ){
                HashMap<String, Object> hashMap = new HashMap<>();
                hashMap.put("id","");
                hashMap.put("pipeId",recordId);
                pipeInfoMapper.pipeRecordInsert(hashMap);
            }
            return BasicResult.success("打印成功");
        }else {
            return BasicResult.faild("11111","未选择打印信息","null");
        }
    }
 
    @Override
    public BasicResult printRecordList(Map<String, Object> values) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        values.put("companyId",companyId);
 
        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
 
        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
        PageHelper.startPage(pageNum,pageSize);
        List<TPipeInfo> pipeInfos = pipeInfoMapper.printRecordList(values);
        PageInfo<TPipeInfo> tPipeInfoPageInfo = new PageInfo<>(pipeInfos);
        return BasicResult.success(tPipeInfoPageInfo);
    }
}