zqy
2025-04-21 ea840970331a78abc2389b37d836bbecc4e05cc6
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
package com.ruoyi.web.controller.zhang;
 
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfShareOther;
import com.ruoyi.domain.ZfShareData;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfClanService;
import com.ruoyi.service.ZfShareDataService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
import java.util.ArrayList;
import java.util.List;
 
 
@RestController
@RequestMapping("/zfShareData")
public class ZfShareDataController extends BaseController {
    @Resource
    private ZfShareDataService zfShareDataService;
 
    @Resource
    private ZInfoUserService zInfoUserService;
 
    @Resource
    private ZfClanService zfClanService;
 
    /**
     * 共享给了谁
     * @param zfShareData
     * @return
     */
    @GetMapping("/all")
    public List<ZfShareOther> listAll(ZfShareData zfShareData) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
 
        zfShareData.setUserId(userId.intValue());
 
        List<ZfShareData> zfShareData2 = zfShareDataService.selectList(zfShareData);
        List<ZfShareOther> zfShareOtherList = new ArrayList<>();
        for (ZfShareData zfShareData1 :zfShareData2){
            System.out.println("1111111111111111111111");
            ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getSharedId().longValue());
            ZfShareOther zfShareOther = new ZfShareOther();
            zfShareOther.setUserId(infoBysysId.getSysId().intValue());
            zfShareOther.setUserName(infoBysysId.getNickName());
            zfShareOther.setClanId(infoBysysId.getClanId());
            zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
            zfShareOtherList.add(zfShareOther);
        }
        return zfShareOtherList;
    }
    /**
     * 通过id查找
     */
 
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(zfShareDataService.getById(id));
    }
 
    /**
     * 新增共享
     */
//    @PreAuthorize("@ss.hasPermi('system:property:add')")
    @Log(title = "共享记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZfShareOther zfShareData) {
        return zfShareDataService.addData(zfShareData.getIds());
    }
 
    /**
     * 批量删除家庭大事件记录
     */
    @Log(title = "共享记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return zfShareDataService.deleteData(ids);
    }
 
    /**
     * 共享者 输入userid
     * @param
     * @return
     */
    @GetMapping("/come/{id}")
    public List<ZfShareOther> list(@PathVariable Long id) {
        List<ZfShareData> shareId = zfShareDataService.getShareId(id);
        List<ZfShareOther> zfShareOtherList = new ArrayList<>();
        for (ZfShareData zfShareData1 : shareId){
            System.out.println("1111111111111111111111");
            ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getUserId().longValue());
            ZfShareOther zfShareOther = new ZfShareOther();
            zfShareOther.setUserId(infoBysysId.getSysId().intValue());
            zfShareOther.setUserName(infoBysysId.getNickName());
            zfShareOther.setClanId(infoBysysId.getClanId());
            zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
            zfShareOtherList.add(zfShareOther);
        }
        return zfShareOtherList;
    }
    /**
     * 设置主账户 修改MasterAccount值
     */
    @Log(title = "共享记录", businessType = BusinessType.UPDATE)
    @PutMapping("/setAdminAccount")
    public AjaxResult edit(@RequestBody ZfShareData zfShareData) {
        return zfShareDataService.setAdmin(zfShareData.getUserId().longValue(),zfShareData.getMasterAccount().longValue());
    }
//
 
    /**
     * 设置为所有用户可以查看 传入userid
     */
    @Log(title = "共享记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit2(@RequestBody ZfShareData zfShareData) {
        return zfShareDataService.allUser(zfShareData.getUserId().longValue());
    }
//
}