liujie
2023-08-02 b64d67ef01e81a857046f19dd556b4e4f0695e1c
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
package com.dsh.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsh.course.feignClient.course.CoursePackageClient;
import com.dsh.course.feignClient.course.model.QueryCoursePackageLists;
import com.dsh.guns.core.support.HttpKit;
import com.dsh.guns.modular.system.model.TStore;
import com.dsh.guns.modular.system.service.ICoursePackageService;
import com.dsh.guns.modular.system.service.IStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
 
/**
 * @author zhibing.pu
 * @Date 2023/8/1 11:51
 */
@Service
public class CoursePackageService implements ICoursePackageService {
 
    @Resource
    private CoursePackageClient coursePackageClient;
 
    @Autowired
    private IStoreService storeService;
 
 
 
 
 
    /**
     * 获取列表数据
     * @param provinceCode
     * @param cityCode
     * @param coursePackageTypeId
     * @param name
     * @param status
     * @param state
     * @return
     */
    @Override
    public Page<Map<String, Object>> queryCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, Integer storeId, String name, Integer status, Integer state) {
        QueryCoursePackageLists queryCoursePackageLists = new QueryCoursePackageLists();
        queryCoursePackageLists.setProvinceCode(provinceCode);
        queryCoursePackageLists.setCityCode(cityCode);
        queryCoursePackageLists.setCoursePackageTypeId(coursePackageTypeId);
        queryCoursePackageLists.setStoreId(storeId);
        queryCoursePackageLists.setName(name);
        queryCoursePackageLists.setState(state);
        queryCoursePackageLists.setStatus(status);
        HttpServletRequest request = HttpKit.getRequest();
        queryCoursePackageLists.setLimit(Integer.valueOf(request.getParameter("limit")));
        queryCoursePackageLists.setOffset(Integer.valueOf(request.getParameter("offset")));
        queryCoursePackageLists.setSort(request.getParameter("sort"));
        queryCoursePackageLists.setOrder(request.getParameter("order"));
        Page<Map<String, Object>> mapPage = coursePackageClient.queryCoursePackageLists(queryCoursePackageLists);
        List<Map<String, Object>> records = mapPage.getRecords();
        for (Map<String, Object> record : records) {
            TStore store = storeService.getById(Integer.valueOf(record.get("storeId").toString()));
            record.put("store", store.getName());
        }
        return mapPage;
    }
}