admin
2019-03-13 33b4ed2bbf28ec16b66e552680f56a691a4e908d
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
package com.yeshi.fanli.controller.admin;
 
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
 
import com.yeshi.fanli.dto.HongBao;
import com.yeshi.fanli.entity.bus.user.HongBaoManage;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
 
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.util.CycleDetectionStrategy;
 
@Controller
@RequestMapping("admin/new/api/v1/haobao")
public class HongBaoManageAdminController {
 
    @Resource
    private HongBaoManageService hongBaoManageService;
 
 
    @RequestMapping(value = "updateHongBaoManage", method = RequestMethod.POST)
    public void updateHongBaoManage(String map, PrintWriter out) {
        List<HongBaoManage> hongBaoManageList = hongBaoManageService.getHongBaoManage();
        Map<String, String> data = JsonUtil.parseData(map);
        for (HongBaoManage hbm : hongBaoManageList) {
            String key = hbm.getKey();
            boolean b = data.containsKey(key);
            if (b) {
                String value = data.get(key);
                hbm.setValue(value);
            }
        }
        hongBaoManageService.update(hongBaoManageList);
        out.print(JsonUtil.loadTrueResult("修改成功"));
    }
 
    @RequestMapping(value = "getHongBaoManage", method = RequestMethod.POST)
    public void getHongBaoManage(PrintWriter out) {
        List<HongBaoManage> hongBaoManageList = hongBaoManageService.getHongBaoManage();
        JSONObject data = new JSONObject();
        data.put("hongBaoManageList", hongBaoManageList);
        out.print(JsonUtil.loadTrueResult(data));
    }
 
 
}