futian.liu
2023-12-22 fd95223d9703b9c038ed3c782474c885052dda08
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package com.consum.base.controller;
 
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Map;
 
import javax.annotation.Resource;
 
import org.apache.commons.compress.utils.Lists;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.consum.base.BaseController;
import com.consum.base.core.utils.CommonUtil;
import com.consum.base.core.utils.MapUtils;
import com.consum.base.pojo.LWarehouseFlowParam;
import com.consum.base.pojo.response.WarehouseFlowVO;
import com.consum.base.service.LWarehouseFlowService;
import com.consum.model.po.FinSysTenantUser;
import com.iplatform.model.po.S_user_core;
import com.walker.db.page.GenericPager;
import com.walker.web.ResponseValue;
 
import cn.hutool.core.util.ReflectUtil;
import io.swagger.annotations.Api;
 
/**
 * @ClassName lWarehouseFlowController
 * @Date 2023/10/27
 * @Description
 * @Version 1.0
 **/
@Api(value = "仓库流水", tags = "仓库流水")
@RestController
@RequestMapping("/pc/warehouse/flow")
public class LWarehouseFlowController extends BaseController {
 
    @Resource
    private LWarehouseFlowService lWarehouseFlowServiceImpl;
 
    @GetMapping("/list")
    public ResponseValue queryFormProcureList() {
        LWarehouseFlowParam param = CommonUtil.getObjFromReq(LWarehouseFlowParam.class);
        LWarehouseFlowParam param2 = new LWarehouseFlowParam();
        CommonUtil.copyProperties(param, param2);
        param = param2;
 
        S_user_core currentUser = this.getCurrentUser();
        if (currentUser == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        GenericPager<Map<String, Object>> genericPager = lWarehouseFlowServiceImpl.queryBusinessFlow(param);
        ArrayList<WarehouseFlowVO> result = Lists.newArrayList();
        genericPager.getDatas().forEach(map -> {
            WarehouseFlowVO warehouseFlowVO =
                MapUtils.convertMapToObj(MapUtils.toReplaceKeyLow(map), WarehouseFlowVO.class);
            result.add(warehouseFlowVO);
        });
        try {
            Field fieldDatas = GenericPager.class.getDeclaredField("datas");
            ReflectUtil.setFieldValue(genericPager, fieldDatas, result);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
 
        return ResponseValue.success(genericPager);
    }
 
    @GetMapping("/detail/list")
    public ResponseValue queryFormProcureList1() {
        LWarehouseFlowParam param = CommonUtil.getObjFromReq(LWarehouseFlowParam.class);
        LWarehouseFlowParam param2 = new LWarehouseFlowParam();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        S_user_core currentUser = this.getCurrentUser();
        if (currentUser == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        GenericPager<Map<String, Object>> genericPager = lWarehouseFlowServiceImpl.queryBusinessFlow(param);
        return ResponseValue.success(genericPager);
    }
 
    @GetMapping("/getTaiZhangList")
    public ResponseValue getTaiZhangList() {
        S_user_core currentUser = this.getCurrentUser();
        if (currentUser == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        LWarehouseFlowParam param = CommonUtil.getObjFromReq(LWarehouseFlowParam.class);
        LWarehouseFlowParam param2 = new LWarehouseFlowParam();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        /*当前登录人只能看到自己机构下的列表*/
        FinSysTenantUser sysInfo = this.getSysInfo();
        String tenantId = sysInfo.getTenantId();
        Long paramAgencyId = param.getAgencyId();
        if (paramAgencyId == null || !paramAgencyId.toString().startsWith(tenantId)) {
            param.setAgencyId(Long.valueOf(tenantId));
        }
        GenericPager<Map<String, Object>> genericPager = lWarehouseFlowServiceImpl.queryTaiZhangList(param);
        return ResponseValue.success(genericPager);
    }
 
    /**
     * 部门台账
     *
     * @return
     */
    @GetMapping("/getDeptTaiZhangList")
    public ResponseValue getDeptTaiZhangList() {
        S_user_core currentUser = this.getCurrentUser();
        if (currentUser == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        LWarehouseFlowParam param = CommonUtil.getObjFromReq(LWarehouseFlowParam.class);
        LWarehouseFlowParam param2 = new LWarehouseFlowParam();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        /*当前登录人只能看到自己机构下的列表*/
        FinSysTenantUser sysInfo = this.getSysInfo();
        String tenantId = sysInfo.getTenantId();
        Long paramAgencyId = param.getAgencyId();
        if (paramAgencyId == null || !paramAgencyId.toString().startsWith(tenantId)) {
            param.setAgencyId(Long.valueOf(tenantId));
        }
        GenericPager<Map<String, Object>> genericPager = lWarehouseFlowServiceImpl.queryDeptTaiZhangList(param);
        return ResponseValue.success(genericPager);
    }
 
}