Browse Source

attenders

huwhois 5 years ago
parent
commit
fd54b596de

+ 57 - 1
src/main/java/io/renren/modules/admin/controller/AttendersController.java

@ -29,6 +29,7 @@ import io.renren.modules.admin.service.AttendersService;
29 29
import io.renren.common.utils.ExcelUtils;
30 30
import io.renren.common.utils.PageUtils;
31 31
import io.renren.common.utils.R;
32
import io.renren.modules.sys.controller.AbstractController;
32 33

33 34
/**
34 35
 * 
@ -39,7 +40,7 @@ import io.renren.common.utils.R;
39 40
 */
40 41
@RestController
41 42
@RequestMapping("admin/attenders")
42
public class AttendersController {
43
public class AttendersController extends AbstractController  {
43 44
    @Autowired
44 45
    private AttendersService attendersService;
45 46

@ -71,6 +72,8 @@ public class AttendersController {
71 72
    @RequestMapping("/save")
72 73
    @RequiresPermissions("admin:attenders:save")
73 74
    public R save(@RequestBody AttendersEntity attenders) {
75
        attenders.setCreateTime(new Date());
76
        attenders.setCreater(getUserId());
74 77
        attendersService.save(attenders);
75 78

76 79
        return R.ok();
@ -82,6 +85,8 @@ public class AttendersController {
82 85
    @RequestMapping("/update")
83 86
    @RequiresPermissions("admin:attenders:update")
84 87
    public R update(@RequestBody AttendersEntity attenders) {
88
        attenders.setModifyTime(new Date());
89
        attenders.setModifier(getUserId());
85 90
        attendersService.updateById(attenders);
86 91

87 92
        return R.ok();
@ -98,6 +103,57 @@ public class AttendersController {
98 103
        return R.ok();
99 104
    }
100 105

106
    /**
107
     * 改变参会意向
108
     * @param column
109
     * @param value
110
     * @param id
111
     */
112
    public R intention(Long id, Integer intention) {
113
         int result = changeColumnValue("intention", intention, id);
114
        if (result == 1) {
115
            return R.ok();
116
        }
117
        return R.error();
118
    }
119

120
     /**
121
     * 是否需要订酒店
122
     * @param column
123
     * @param value
124
     * @param id
125
     */
126
    public R room(Long id, Integer intention) {
127
        int result = changeColumnValue("room", intention, id);
128
       if (result == 1) {
129
           return R.ok();
130
       }
131
       return R.error();
132
   }
133

134
    /**
135
     * 是否需要接送
136
     * @param column
137
     * @param value
138
     * @param id
139
     */
140
    public R transfer(Long id, Integer intention) {
141
        int result = changeColumnValue("transfer", intention, id);
142
       if (result == 1) {
143
           return R.ok();
144
       }
145
       return R.error();
146
   }
147

148
    /**
149
     * 改变单个字段值
150
     * @param params
151
     * @return
152
     */
153
    public int changeColumnValue(String column, Integer value, Long id) {
154
        return attendersService.changeColumnValue(column, value, id);
155
    }
156

101 157
    /**
102 158
     * 根据name模糊查询
103 159
     */

+ 4 - 0
src/main/java/io/renren/modules/admin/dao/AttendersDao.java

@ -8,6 +8,7 @@ import java.util.Map;
8 8
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9 9
import org.apache.ibatis.annotations.Mapper;
10 10
import org.apache.ibatis.annotations.Select;
11
import org.apache.ibatis.annotations.Update;
11 12

12 13
/**
13 14
 * 
@ -35,4 +36,7 @@ public interface AttendersDao extends BaseMapper<AttendersEntity> {
35 36

36 37
    @Select("SELECT a.id,m.truename,m.organization,m.position,m.job_title as jobTitle,m.phone,m.email,m.officephone,a.type_id typeId,(select t.name from types_of_attenders t where t.id=a.type_id) as typeName FROM attenders a JOIN member m ON a.member_id=m.id where a.is_del=0 AND a.id=#{aid}")
37 38
    Map<String, Object> getMapById(Long aid);
39

40
    @Update("UPDATE attenders set #{column}=#{value} WHERE id=#{id}")
41
    int changeColumnValue(String column, Integer value, Long id);
38 42
}

+ 2 - 0
src/main/java/io/renren/modules/admin/service/AttendersService.java

@ -45,5 +45,7 @@ public interface AttendersService extends IService<AttendersEntity> {
45 45
     * @return
46 46
     */
47 47
    List<Map<String, Object>> getMapList(Long meetingId);
48

49
	int changeColumnValue(String column, Integer value, Long id);
48 50
}
49 51


+ 5 - 0
src/main/java/io/renren/modules/admin/service/impl/AttendersServiceImpl.java

@ -76,4 +76,9 @@ public class AttendersServiceImpl extends ServiceImpl<AttendersDao, AttendersEnt
76 76
    public List<Map<String, Object>> getMapList(Long meetingId) {
77 77
        return baseMapper.getMapList(meetingId);
78 78
    }
79

80
    @Override
81
    public int changeColumnValue(String column, Integer value, Long id) {
82
        return baseMapper.changeColumnValue(column, value,id);
83
    }
79 84
}

+ 6 - 2
src/main/java/io/renren/modules/admin/service/impl/PaymentServiceImpl.java

@ -35,8 +35,12 @@ public class PaymentServiceImpl extends ServiceImpl<PaymentDao, PaymentEntity> i
35 35
    public PageUtils myQueryPage(Map<String, Object> params) {
36 36
        Long meetingId = Long.valueOf(params.get("meetingId").toString());
37 37
        String key = (String) params.get("key");
38
        int page = Integer.valueOf((String) params.get("page"));
39
        int limit = Integer.valueOf((String) params.get("limit"));
38
39
        int page = params.containsKey("page") ? Integer.valueOf((String) params.get("page")) - 1 : 0;
40
        if (page < 0) {
41
            page = 0;
42
        }
43
        int limit = params.containsKey("limit") ? Integer.valueOf((String) params.get("limit")) : 10;
40 44
        List<Map<String, Object>> list = baseMapper.myQueryPage(meetingId, key, key, page, limit); 
41 45
        int total = baseMapper.myQueryPageCounts(meetingId, key, key);
42 46

+ 8 - 39
src/main/java/io/renren/modules/sys/controller/FileManagerController.java

@ -84,50 +84,19 @@ public class FileManagerController {
84 84
    }
85 85
86 86
    @PostMapping("/uploadfile")
87
    public R uploadFile(@RequestParam(value = "upload_file") MultipartFile file,
88
            @RequestParam(value = "activepath") String activepath,
89
            @RequestParam(value = "useoldname") Integer useoldname) throws IOException {
90
        // 根据相对路径转化为真实路径
91
        // String rootpath =
92
        // request.getSession().getServletContext().getRealPath(File.separator);//
93
        // 获得web应用的绝对路径
94
        // File createFile = new File(rootpath + "../data/upload/");
95
        String useUploadPath; // 文件上传使用的目录
96
        System.out.println(activepath);
97
        if (activepath != null && !activepath.equals("")) {
98
            // 上传到指定目录
99
            useUploadPath = activepath + "/";
100
        } else {
101
            // 使用配置文件中的指定上传目录下的 documents
102
            useUploadPath = uploadFolder + "/documents/";
103
        }
104
105
        // System.out.println(useUploadPath);
106
        String picDir = dataPath + useUploadPath; // 文件绝对路径
107
108
        File createFile = new File(picDir);
109
        if (!createFile.exists()) {// 判断文件是否存在如果不存在则自动创建文件夹
110
            createFile.mkdir();
111
        }
87
    public R uploadFile(@RequestParam(value = "upload_file") MultipartFile file, HttpServletRequest request) throws IOException {
88
        
89
        String useUploadPath = "/documents/"; // 文件上传使用的目录
90
      
112 91
        // System.out.println(picDir);
113 92
        String fileOldName = file.getOriginalFilename();
114 93
        // 上传的图片只允许是 png、jpg 或 gif 中的格式
115 94
        if (fileOldName.contains(".pdf") || fileOldName.contains(".doc") || fileOldName.contains(".docx")) {
116
            String newFilename = "";
117
            if (useoldname == 1) {
118
                newFilename = fileOldName;
119
            } else {
120
                String uuid = UUID.randomUUID().toString().replace("-", "");// 随机生成一个唯一性的id 文件不重名
121
                String suffix = fileOldName.substring(fileOldName.lastIndexOf(".") + 1);
122
                newFilename = uuid + "." + suffix;
123
            }
124
            File f = new File(picDir + newFilename);
125
            if (f.exists()) {// 上传的文件已经存在,则提示用户重新上传 apk 或者重命名
126
                return R.error("上传的文件已经存在,则提示用户重新上传 apk 或者重命名");
127
            } else {
128
                file.transferTo(f); // 将上传的文件写入到系统中
129
                return R.ok().put("filename", useUploadPath + newFilename);
95
            Map<String, Object> resultSave = saveFile(file, useUploadPath, true);
96
            if ((Integer) resultSave.get("status") != 0) {
97
                return R.error((String) resultSave.get("msg"));
130 98
            }
99
            return R.ok(resultSave);
131 100
        } else {
132 101
            return R.error("上传文件失败");
133 102
        }