huwhois 5 vuotta sitten
vanhempi
commit
01869f4494

+ 0 - 1
src/main/java/io/renren/common/utils/ExcelUtils.java

@ -1,7 +1,6 @@
1 1
package io.renren.common.utils;
2 2
3 3
import javax.servlet.http.HttpServletResponse;
4
import java.awt.*;
5 4
import java.io.OutputStream;
6 5
import java.util.List;
7 6

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

@ -50,7 +50,7 @@ public class AttendersController {
50 50
    @RequiresPermissions("admin:attenders:list")
51 51
    public R list(@RequestParam Map<String, Object> params) {
52 52
        PageUtils page = attendersService.queryPage(params);
53

53
        
54 54
        return R.ok().put("page", page);
55 55
    }
56 56


+ 9 - 3
src/main/java/io/renren/modules/admin/dao/AttendersDao.java

@ -18,6 +18,15 @@ import org.apache.ibatis.annotations.Select;
18 18
 */
19 19
@Mapper
20 20
public interface AttendersDao extends BaseMapper<AttendersEntity> {
21
    // @Select("SELECT a.id, m.truename, m.organization, a.intention, a.room, a.transfer, a.note, a.modify_time, a.servicer, e.truename as servicerName, a.type_id, (select t.name from types_of_attenders t WHERE t.id=a.type_id) as typeName, (SELECT p.is_ispay FROM  payment p WHERE p.attenders.id=a.id) as  isPay  FROM attenders a JOIN member m ON a.member_id=m.id LEFT JOIN employee e ON e.id=a.servicer  WHERE a.is_del=0 AND a.meeting_id=#{meetingId} AND () limit #{page},#{limit};")
22
    // List<Map<String, Object>> getMapList(Long meetingId, String truename, String organization, String servicerName, int page, int limit);
23

24
    // @Select("SELECT count(*) ")
25
    // int getCounts(Long meetingId, String truename, String organization, String servicerName);
26

27
    @Select("SELECT a.id, m.truename, m.organization, m.position, m.job_title as jobTitle, m.phone, m.email, (select t.name from types_of_attenders t where t.id=a.type_id) as typeName, (SELECT p.is_ispay FROM  payment p WHERE p.attenders.id=a.id) as isPay  FROM attenders a JOIN member m ON a.member_id=m.id WHERE a.is_del=0 AND a.meeting_id=#{meetingId}")
28
    List<Map<String, Object>> getMapList(Long meetingId);
29

21 30
    @Select("SELECT a.id as aid,a.meeting_id,m.name_cn FROM attenders a JOIN meeting m ON a.meeting_id=m.id WHERE a.member_id=#{memberId} ORDER BY a.id;")
22 31
    List<Map<String, Object>> getMeetingListByMemberId(Long memberId);
23 32

@ -26,7 +35,4 @@ public interface AttendersDao extends BaseMapper<AttendersEntity> {
26 35

27 36
    @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}")
28 37
    Map<String, Object> getMapById(Long aid);
29

30
    @Select("SELECT a.id,m.truename,m.organization,m.position,m.job_title as jobTitle,m.phone,m.email,(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.meeting_id=#{meetingId}")
31
    List<Map<String, Object>> getMapList(Long meetingId);
32 38
}

+ 2 - 2
src/main/java/io/renren/modules/admin/entity/AttendersEntity.java

@ -44,11 +44,11 @@ public class AttendersEntity implements Serializable {
44 44
	/**
45 45
	 * 职位
46 46
	 */
47
	private Long positionId;
47
	private String position;
48 48
	/**
49 49
	 * 职称
50 50
	 */
51
	private Long jobTitle;
51
	private String jobTitle;
52 52
	/**
53 53
	 * 电话
54 54
	 */

+ 27 - 1
src/main/java/io/renren/modules/admin/service/impl/AttendersServiceImpl.java

@ -3,6 +3,8 @@ package io.renren.modules.admin.service.impl;
3 3
import org.apache.commons.lang.StringUtils;
4 4
import org.springframework.stereotype.Service;
5 5

6
import java.util.ArrayList;
7
import java.util.HashMap;
6 8
import java.util.List;
7 9
import java.util.Map;
8 10
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -15,7 +17,6 @@ import io.renren.modules.admin.dao.AttendersDao;
15 17
import io.renren.modules.admin.entity.AttendersEntity;
16 18
import io.renren.modules.admin.service.AttendersService;
17 19

18

19 20
@Service("attendersService")
20 21
public class AttendersServiceImpl extends ServiceImpl<AttendersDao, AttendersEntity> implements AttendersService {
21 22

@ -28,9 +29,34 @@ public class AttendersServiceImpl extends ServiceImpl<AttendersDao, AttendersEnt
28 29
                .like(StringUtils.isNotBlank(name),"name",name)
29 30
        );
30 31

32
        List<AttendersEntity> theList = page.getRecords();
33
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
34
        for (AttendersEntity attenders : theList) {
35
            Map<String, Object> map = new HashMap<String, Object>();
36
            Long aid = attenders.getId();
37
            map.put("id", aid);
38
            map.put("id", aid);
39
            map.put("id", aid);
40
            map.put("id", aid);
41
            map.put("id", aid);
42
            map.put("id", aid);
43
            map.put("id", aid);
44
        }
45

46

31 47
        return new PageUtils(page);
32 48
    }
33 49

50
    // @Override
51
    // public PageUtils myQueryPage(Map<String, Object> params) {
52
        
53
    //     List<Map<String, Object>> list = baseMapper.getMapList();
54

55

56

57
    //     return new PageUtils();
58
    // }
59

34 60
    @Override
35 61
    public List<Map<String, Object>> getMeetingListByMemberId(Long memberId){
36 62
        return baseMapper.getMeetingListByMemberId(memberId);

+ 0 - 1
src/main/java/io/renren/modules/admin/service/impl/MemberServiceImpl.java

@ -1,7 +1,6 @@
1 1
package io.renren.modules.admin.service.impl;
2 2
3 3
import java.util.ArrayList;
4
import java.util.Arrays;
5 4
import java.util.Date;
6 5
import java.util.HashMap;
7 6
import java.util.List;

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

@ -42,59 +42,42 @@ public class FileManagerController {
42 42
    @PostMapping("/uploadimg")
43 43
    public R uploadImage(@RequestParam(value = "upload_file") MultipartFile file, HttpServletRequest request)
44 44
            throws IOException {
45
        boolean isthumb = false;
45
        boolean isThumb = false;
46 46
        String thumb = request.getParameter("isthumb");
47 47
        if (thumb != null && thumb != "" && thumb.equals("1")) {
48
            isthumb = true;
48
            isThumb = true;
49 49
        }
50 50
        // 根据相对路径转化为真实路径
51 51
        // String rootpath =
52 52
        // request.getSession().getServletContext().getRealPath(File.separator);//
53 53
        // 获得web应用的绝对路径
54 54
        // File createFile = new File(rootpath + "../data/upload/");
55
        String useUploadPath; // 文件上传使用的目录
56 55
        String activePath = request.getParameter("activepath");
57
        if (activePath != null && activePath.equals("")) {
58
            // 上传到指定目录
59
            useUploadPath = activePath + "/";
60
        } else {
61
            // 使用配置文件中的指定上传目录与当前年月新建文件夹
62
            LocalDateTime ldt = LocalDateTime.now();
63
            String today = ldt.format(DateTimeFormatter.BASIC_ISO_DATE);
64
            useUploadPath = uploadFolder + "/" + today + "/";
65
        }
66
67
        // System.out.println(useUploadPath);
68
        String picDir = dataPath + useUploadPath; // 文件绝对路径
69
70
        File createFile = new File(picDir);
71
        if (!createFile.exists()) {// 判断文件是否存在如果不存在则自动创建文件夹
72
            createFile.mkdir();
73
        }
74
        // System.out.println(picDir);
75
        String fileOldName = file.getOriginalFilename();
76 56
        // 上传的图片只允许是 png、jpg 或 gif 中的格式
77 57
        if (file.getOriginalFilename().contains(".png") || file.getOriginalFilename().contains(".jpg")
78
                || file.getOriginalFilename().contains(".gif")) {
79
            String uuid = UUID.randomUUID().toString().replace("-", "");// 随机生成一个唯一性的id 文件不重名
80
            String suffix = fileOldName.substring(fileOldName.lastIndexOf(".") + 1);
81
            String newFilename = uuid + "." + suffix;
82
            File f = new File(picDir + newFilename);
83
            if (f.exists()) {// 上传的文件已经存在,则提示用户重新上传 apk 或者重命名
84
                return R.error("上传的文件已经存在,则提示用户重新上传 apk 或者重命名");
85
            } else {
86
                Map<String, Object> result = new HashMap<String, Object>();
58
            || file.getOriginalFilename().contains(".gif")) {
59
            Map<String, Object> resultSave = saveFile(file, activePath, false);
60
            
61
            if (Integer.valueOf((String) resultSave.get("status")) != 0) {
62
                return R.error((String) resultSave.get("msg"));
63
            }
87 64
88
                file.transferTo(f); // 将上传的文件写入到系统中
89
                if (isthumb) {
90
                    String thumbFilaname = uuid + "_200." + suffix;
91
                    Thumbnails.of(picDir + newFilename).width(200).toFile(picDir + thumbFilaname);
92
                    result.put("thumb", useUploadPath + thumbFilaname);
93
                }
94
                result.put("picname", useUploadPath + newFilename);
65
            String filename = (String) resultSave.get("filename");
95 66
96
                return R.ok(result);
67
            Map<String, Object> result = new HashMap<String, Object>();
68
69
            result.put("picname", filename);
70
            if (isThumb) {
71
                int dot = filename.lastIndexOf(".");
72
                if ((dot >-1) && (dot < (filename.length()))) {
73
                    String suffix = filename.substring(dot + 1);
74
                    String thumbFilaname = filename.substring(0, dot)+ "_200." + suffix; 
75
                    Thumbnails.of(dataPath + filename).width(200).toFile(dataPath + filename);
76
                    result.put("thumb", thumbFilaname);
77
                }
97 78
            }
79
            
80
            return R.ok(result);
98 81
        } else {
99 82
            return R.error("上传文件失败");
100 83
        }
@ -342,4 +325,61 @@ public class FileManagerController {
342 325
        }
343 326
        return list;
344 327
    }
328
329
    
330
331
    private Map<String, Object> saveFile(MultipartFile file) {
332
        return saveFile(file, "", false);   // 使用当前年月日目录,uuid新文件名
333
    }
334
335
    private Map<String, Object> saveFile(MultipartFile file, String desDir, 
336
        Boolean useOldname) {
337
        Map<String, Object> result = new HashMap<String, Object>();
338
        if (!file.isEmpty()) {
339
            try {
340
                String useUploadPath = "";
341
                if (desDir != null && !desDir.equals("")) {
342
                    useUploadPath = desDir + "/";
343
                } else {
344
                    // 使用配置文件中的指定上传目录与当前年月新建目录
345
                    LocalDateTime ldt = LocalDateTime.now();
346
                    String today = ldt.format(DateTimeFormatter.BASIC_ISO_DATE);
347
                    useUploadPath = uploadFolder + "/" + today + "/";
348
                }
349
                String absolutePath = dataPath + useUploadPath; // 目录绝对路径
350
351
                // 判断目录是否存在, 如果不存在则自动创建目录
352
                File createFile = new File(absolutePath);
353
                if (!createFile.exists()) {
354
                    createFile.mkdir();
355
                }
356
357
                String newFilename = "";
358
                String fileOldName = file.getOriginalFilename();
359
                String suffix = fileOldName.substring(fileOldName.lastIndexOf(".") + 1);
360
                if (useOldname) {
361
                    newFilename = fileOldName;
362
                } else {
363
                    String uuid = UUID.randomUUID().toString().replace("-", "");// 随机生成一个唯一性的id 文件不重名
364
                    newFilename = uuid + "." + suffix;
365
                }
366
367
                File f = new File(absolutePath + newFilename);
368
                if (f.exists()) {
369
                    result.put("status", 1);  // 上传的文件已经存在,则提示用户重新上传图片或者重命名
370
                    result.put("msg", "上传的文件已经存在,则提示用户重新上传图片或者重命名");  // 上传的文件已经存在,则提示用户重新上传图片或者重命名
371
                } else {
372
                    file.transferTo(f); // 将上传的文件写入到系统中
373
                    result.put("status", 0);
374
                    result.put("filename", useUploadPath + newFilename);
375
                }
376
            } catch (Exception e) {
377
                e.printStackTrace();
378
                result.put("status", 2);
379
                result.put("msg", e.getMessage());
380
            }
381
        }
382
383
        return result;
384
    }
345 385
}