mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package com.panzhihua.service_community.service.impl;
 
import com.panzhihua.common.model.vos.common.ComActEasyPhotoHandlerVo;
import com.panzhihua.service_community.entity.ComActEasyPhotoHandler;
import com.panzhihua.service_community.dao.ComActEasyPhotoHandlerMapper;
import com.panzhihua.service_community.service.ComActEasyPhotoHandlerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import com.panzhihua.common.model.dtos.common.*;
import com.panzhihua.common.model.vos.R;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
import java.util.Date;
import java.util.List;
 
/**
 * title: 随手拍、微心愿处理人绑定表表服务实现类
 * <p>
 * projectName 成都呐喊信息技术有限公司-智慧社区项目
 * <p>
 * description: 随手拍、微心愿处理人绑定表表服务实现类
 *
 * @author lyq
 * @date 2022-03-01 13:45:11
 */
@Service("comActEasyPhotoHandlerService")
public class ComActEasyPhotoHandlerServiceImpl extends ServiceImpl<ComActEasyPhotoHandlerMapper, ComActEasyPhotoHandler> implements ComActEasyPhotoHandlerService {
 
    /**
     * description  queryByPage  分页查询
     *
     * @param comActEasyPhotoHandler 请求参数
     * @return 分页查询列表数据
     * @author lyq
     * @date 2022-03-01 13:45:11
     */
    @Override
    public R queryByPage(PageComActEasyPhotoHandlerDto comActEasyPhotoHandler) {
        return R.ok(this.baseMapper.queryAllByLimit(comActEasyPhotoHandler, new Page(comActEasyPhotoHandler.getPageNum(), comActEasyPhotoHandler.getPageSize())));
    }
 
    /**
     * description  insert  新增数据
     *
     * @param comActEasyPhotoHandler 请求参数
     * @return 新增结果
     * @author lyq
     * @date 2022-03-01 13:45:11
     */
    @Override
    public R insert(AddComActEasyPhotoHandlerDto comActEasyPhotoHandler) {
        ComActEasyPhotoHandler entity = new ComActEasyPhotoHandler();
        BeanUtils.copyProperties(comActEasyPhotoHandler, entity);
        if (this.baseMapper.insert(entity) > 0) {
            return R.ok();
        }
        return R.fail("添加失败");
    }
 
    /**
     * description  update  修改数据
     *
     * @param editDto 请求参数
     * @return 修改结果
     * @author lyq
     * @date 2022-03-01 13:45:11
     */
    @Override
    public R update(EditComActEasyPhotoHandlerDto editDto) {
        ComActEasyPhotoHandler entity = this.baseMapper.selectById(editDto.getId());
        if (entity == null) {
            return R.fail("未查询到该记录");
        }
        BeanUtils.copyProperties(editDto, entity);
        if (this.baseMapper.updateById(entity) > 0) {
            return R.ok();
        }
        return R.fail("修改失败");
    }
 
    /**
     * description  deleteById  通过主键删除数据
     *
     * @param id 主键id
     * @return 删除结果
     * @author lyq
     * @date 2022-03-01 13:45:11
     */
    @Override
    public R deleteById(Long id) {
        if (this.baseMapper.deleteById(id) > 0) {
            return R.ok();
        }
        return R.fail("删除失败");
    }
 
    /**
     * description  detailById  查询详情
     *
     * @param id 主键id
     * @return 详情数据
     * @author lyq
     * @date 2022-03-01 13:45:11
     */
    @Override
    public R detailById(Long id) {
        return R.ok(this.baseMapper.queryById(id));
    }
 
    /**
     * description  queryByPage  查询列表
     *
     * @param comActEasyPhotoHandler 请求参数
     * @return 列表数据
     * @author lyq
     * @date 2022-03-01 13:45:11
     */
    @Override
    public R queryByList(PageComActEasyPhotoHandlerDto comActEasyPhotoHandler) {
        return R.ok(this.baseMapper.queryAllByList(comActEasyPhotoHandler));
    }
 
    /**
     * 添加随手拍、微心愿处理关联记录
     * @param communityId   社区id
     * @param userId    用户id
     * @param serviceId 业务id
     * @param type  人员类型(1.后台用户 2.党员 3.志愿者 4.社工 5.四长四员)
     * @param serviceType   业务类型(1.随手拍 2.微心愿)
     */
    @Override
    public void addHandleRecord(Long communityId, Long userId, Long serviceId, Integer type, Integer serviceType,Long sponsorId) {
        ComActEasyPhotoHandler easyPhotoHandler = new ComActEasyPhotoHandler();
        easyPhotoHandler.setCommunityId(communityId);
        easyPhotoHandler.setStatus(ComActEasyPhotoHandler.Status.DZX);
        easyPhotoHandler.setCreateTime(new Date());
        easyPhotoHandler.setUserId(userId);
        easyPhotoHandler.setSenderId(sponsorId);
        easyPhotoHandler.setServiceId(serviceId);
        easyPhotoHandler.setType(type);
        easyPhotoHandler.setServiceType(serviceType);
        this.baseMapper.insert(easyPhotoHandler);
    }
 
    /**
     * 获取处理记录
     * @param serviceId
     * @param serviceType
     * @return
     */
    @Override
    public List<ComActEasyPhotoHandlerVo> selectHandleRecord(Long serviceId, Integer serviceType) {
        return this.baseMapper.selectHandleRecord(serviceId, serviceType);
    }
}