Browse Source

前端订单及扫码等

huwhois 4 years ago
parent
commit
b12c6f9e10

+ 0 - 7
src/main/java/io/renren/modules/admin/controller/MeetingController.java

82
    @RequiresPermissions("admin:meeting:info")
82
    @RequiresPermissions("admin:meeting:info")
83
    public R info(@PathVariable("id") Long id){
83
    public R info(@PathVariable("id") Long id){
84
		MeetingEntity meeting = meetingService.getById(id);
84
		MeetingEntity meeting = meetingService.getById(id);
85
        Long sId = meeting.getServiceId();
86
        if (sId == null || sId == 0) {
87
              meeting.setServiceName("");
88
        } else{
89
            EmployeeEntity employee = employeeService.getById(sId);
90
            meeting.setServiceName(employee.getTruename());
91
        }
92
        
85
        
93
        return R.ok().put("meeting", meeting);
86
        return R.ok().put("meeting", meeting);
94
    }
87
    }

+ 6 - 0
src/main/java/io/renren/modules/admin/dao/PaymentDao.java

39
39
40
    @Update("UPDATE payment SET `is_pay`=#{status} where id=#{id}")
40
    @Update("UPDATE payment SET `is_pay`=#{status} where id=#{id}")
41
    int updatePayStatus(Long id, Integer status);
41
    int updatePayStatus(Long id, Integer status);
42
43
    @Select("SELECT p.id, p.order_id orderId, p.is_pay isPay, p.pay_time payTime, a.name attendersName, a.organization, m.name_cn meetingName FROM payment p JOIN attenders a ON p.attenders_id=a.id JOIN meeting m ON p.meeting_id=m.id WHERE a.member_id=#{memberId};")
44
    List<Map<String, Object>> queryOrderListByMemberId(Long memberId);
45
46
    @Select("SELECT a.id attendersId, a.name attendersName, a.organization, a.position, p.is_pay isPay, m.id meetingId, m.name_cn meetingName, m.start_time startTime, m.end_time endTime FROM payment p JOIN attenders a ON p.attenders_id=a.id JOIN meeting m ON p.meeting_id=m.id where order_id=#{orderId};")
47
    Map<String, Object> queryOrderInfoByOrderId(String orderId);
42
}
48
}

+ 4 - 0
src/main/java/io/renren/modules/admin/service/PaymentService.java

41
    BigDecimal getTotalMoney(Long meetingId, String where);
41
    BigDecimal getTotalMoney(Long meetingId, String where);
42
42
43
	int updatePayStatus(Long id, Integer status);
43
	int updatePayStatus(Long id, Integer status);
44
45
	List<Map<String, Object>> queryOrderListByMemberId(Long memberId);
46
47
	Map<String, Object> queryOrderInfoByOrderId(String orderId);
44
}
48
}
45
49

+ 10 - 0
src/main/java/io/renren/modules/admin/service/impl/PaymentServiceImpl.java

81
    public int updatePayStatus(Long id, Integer status) {
81
    public int updatePayStatus(Long id, Integer status) {
82
       return baseMapper.updatePayStatus(id, status);
82
       return baseMapper.updatePayStatus(id, status);
83
    }
83
    }
84
85
    @Override
86
    public List<Map<String, Object>> queryOrderListByMemberId(Long memberId) {
87
        return baseMapper.queryOrderListByMemberId(memberId);
88
    }
89
90
    @Override
91
    public Map<String, Object> queryOrderInfoByOrderId(String orderId) {
92
        return baseMapper.queryOrderInfoByOrderId(orderId);
93
    }
84
}
94
}

+ 5 - 23
src/main/java/io/renren/modules/app/controller/AppOrderController.java

19

19

20
import io.renren.common.utils.R;
20
import io.renren.common.utils.R;
21
import io.renren.modules.admin.entity.AttendersEntity;
21
import io.renren.modules.admin.entity.AttendersEntity;
22
import io.renren.modules.admin.entity.MeetingEntity;
23
import io.renren.modules.admin.entity.PaymentEntity;
22
import io.renren.modules.admin.entity.PaymentEntity;
24
import io.renren.modules.admin.service.AttendersService;
23
import io.renren.modules.admin.service.AttendersService;
25
import io.renren.modules.admin.service.MeetingService;
26
import io.renren.modules.admin.service.PaymentService;
24
import io.renren.modules.admin.service.PaymentService;
27
import io.renren.modules.app.annotation.Login;
25
import io.renren.modules.app.annotation.Login;
28
import io.renren.modules.app.annotation.LoginUser;
26
import io.renren.modules.app.annotation.LoginUser;
29
import io.renren.modules.app.dao.UserDao;
30
import io.renren.modules.app.entity.UserEntity;
27
import io.renren.modules.app.entity.UserEntity;
31
import io.renren.modules.app.service.UserService;
32

28

33
/**
29
/**
34
 * @author chenshun
30
 * @author chenshun
41
    @Autowired
37
    @Autowired
42
    private AttendersService attendersService;
38
    private AttendersService attendersService;
43
    @Autowired
39
    @Autowired
44
    private UserService userService;
45
    @Autowired
46
    private PaymentService paymentService;
40
    private PaymentService paymentService;
47
    
41
    
48
    /**
42
    /**
51
    @Login
45
    @Login
52
    @GetMapping("/list")
46
    @GetMapping("/list")
53
    public R orderList(@RequestAttribute("userId") Integer userId){
47
    public R orderList(@RequestAttribute("userId") Integer userId){
54
        System.out.println(userId);
55
        Long memberId = Long.valueOf(userId);
48
        Long memberId = Long.valueOf(userId);
56

49

57
        List<Map<String, Object>> orderList = userService.queryOrderList(memberId);        
50
        List<Map<String, Object>> orderList = paymentService.queryOrderListByMemberId(memberId);        
58

51

59
        return R.ok().put("orderList", orderList);
52
        return R.ok().put("orderList", orderList);
60
    }
53
    }
128
        return R.ok();
121
        return R.ok();
129
    }
122
    }
130

123

131
    @GetMapping("/infobyaid/{aid}")
132
    public R infoByAttendersId(@PathVariable("aid") Long aid){
133
        System.out.println(aid);
134
        Map<String, Object> orderInfo = userService.queryOrderInfoByAttendersId(aid);
124
    @GetMapping("/infobyorderid/{orderId}")
125
    public R infoByAttendersId(@PathVariable("orderId") String orderId){
126
        Map<String, Object> orderInfo = paymentService.queryOrderInfoByOrderId(orderId);
127

135
        return R.ok().put("orderInfo", orderInfo);
128
        return R.ok().put("orderInfo", orderInfo);
136
    }
129
    }
137

130

138
    // /**
139
    //  * 修改
140
    //  */
141
    // @Login
142
    // @PostMapping("/update")
143
    // public R update(@RequestBody AttendersEntity attenders){
144
	// 	attendersService.updateById(attenders);
145

146
    //     return R.ok();
147
    // }
148

149
    // /**
131
    // /**
150
    //  * 删除
132
    //  * 删除
151
    //  */
133
    //  */

+ 0 - 2
src/main/java/io/renren/modules/app/controller/AppTestController.java

10
10
11
import io.renren.common.utils.R;
11
import io.renren.common.utils.R;
12
import io.renren.modules.app.annotation.Login;
12
import io.renren.modules.app.annotation.Login;
13
import io.renren.modules.app.annotation.LoginUser;
14
import io.renren.modules.app.entity.UserEntity;
15
import io.swagger.annotations.Api;
13
import io.swagger.annotations.Api;
16
import io.swagger.annotations.ApiOperation;
14
import io.swagger.annotations.ApiOperation;
17
15

+ 3 - 5
src/main/java/io/renren/modules/app/controller/QRCodeTest.java

69
		String imgpath = "/kexiu/webdata/data/qcode";
69
		String imgpath = "/kexiu/webdata/data/qcode";
70
                String rpath = "www.ekexiu.com/data/qcode/";
70
                String rpath = "www.ekexiu.com/data/qcode/";
71
		String imgurl = "";
71
		String imgurl = "";
72
                try{
72
		try{
73
		     String file = qRCodeUtils.encode(text, null, imgpath, false);
73
		     String file = qRCodeUtils.encode(text, null, imgpath, false);
74
		     imgurl = rpath+file;
74
		     imgurl = rpath+file;
75
		}catch(Exception e){
75
		}catch(Exception e){
81
	@Login
81
	@Login
82
	@GetMapping("qrcode.jpg")
82
	@GetMapping("qrcode.jpg")
83
    @ApiOperation("获取二维码图片")
83
    @ApiOperation("获取二维码图片")
84
    public void  getCodeImg(HttpServletResponse response, String attenders_id)throws IOException {
84
    public void  getCodeImg(HttpServletResponse response, String orderId)throws IOException {
85
        response.setHeader("Cache-Control", "no-store, no-cache");
85
        response.setHeader("Cache-Control", "no-store, no-cache");
86
		response.setContentType("image/jpeg");
86
		response.setContentType("image/jpeg");
87
87
88
		//获取图片验证码
88
		//获取图片验证码
89
		// BufferedImage image = qRCodeUtils.encode(text);
90
		String text = qrcodeurl + attenders_id;
89
		String text = qrcodeurl + orderId;
91
		ServletOutputStream out = response.getOutputStream();
90
		ServletOutputStream out = response.getOutputStream();
92
		// ImageIO.write(image, "jpg", out);
93
		try{
91
		try{
94
			qRCodeUtils.encode(text, out);
92
			qRCodeUtils.encode(text, out);
95
			IOUtils.closeQuietly(out);
93
			IOUtils.closeQuietly(out);

+ 26 - 21
src/main/java/io/renren/modules/app/controller/Sign.java

14
14
15
import io.renren.common.utils.R;
15
import io.renren.common.utils.R;
16
import io.renren.modules.admin.entity.SignEntity;
16
import io.renren.modules.admin.entity.SignEntity;
17
import io.renren.modules.admin.service.PaymentService;
17
import io.renren.modules.admin.service.SignService;
18
import io.renren.modules.admin.service.SignService;
18
import io.renren.modules.app.service.UserService;
19
20
19
21
20
22
/**
21
/**
32
    @Autowired
31
    @Autowired
33
    private SignService signService;
32
    private SignService signService;
34
    @Autowired
33
    @Autowired
35
    private UserService userService;
34
    private PaymentService paymentService;
36
    /**
35
    /**
37
     * 保存
36
     * 保存
38
     */
37
     */
39
    @PostMapping("/signin")
38
    @PostMapping("/signin")
40
    public R save(@RequestParam Map<String, Object> params){
39
    public R save(@RequestParam Map<String, Object> params){
41
        Long attendersId = Long.valueOf(params.get("attendersId").toString());
40
        String orderId = (String) params.get("orderId");
41
42
        Map<String, Object> orderInfo = paymentService.queryOrderInfoByOrderId(orderId);
43
44
        if (Integer.valueOf(orderInfo.get("isPay").toString()) == 0) {
45
            return R.error(1, "未缴费");
46
        }
47
        
48
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
49
        try {
50
            Date dateStart = simpleDateFormat.parse(orderInfo.get("startTime").toString());
51
            long startTime = dateStart.getTime();
52
            Date dateEnd = simpleDateFormat.parse(orderInfo.get("endTime").toString());
53
            long endTime = dateEnd.getTime();
54
            long nowtime = System.currentTimeMillis();
55
            if (nowtime < startTime || nowtime > endTime) {
56
                return R.error(2, "非会期");
57
            }
58
        } catch (Exception e) {
59
            return R.error();
60
        }
61
        
62
        Long attendersId = Long.valueOf(orderInfo.get("attendersId").toString());
63
42
        SignEntity sEntity =  signService.getOne(
64
        SignEntity sEntity =  signService.getOne(
43
            new QueryWrapper<SignEntity>().eq("attenders_id", attendersId)
65
            new QueryWrapper<SignEntity>().eq("attenders_id", attendersId)
44
        );
66
        );
45
        if (sEntity == null) {
67
        if (sEntity == null) {
46
            Map<String, Object> orderInfo = userService.queryOrderInfoByAttendersId(attendersId);
47
            if (Integer.valueOf(orderInfo.get("isCheck").toString()) == 0) {
48
                return R.error(1, "签到未成功");
49
            }
50
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
51
            try {
52
                Date dateStart = simpleDateFormat.parse(orderInfo.get("startTime").toString());
53
                long startTime = dateStart.getTime();
54
                Date dateEnd = simpleDateFormat.parse(orderInfo.get("endTime").toString());
55
                long endTime = dateEnd.getTime();
56
                long nowtime = System.currentTimeMillis();
57
                if (nowtime < startTime || nowtime > endTime) {
58
                    return R.error(2, "签到未成功");
59
                }
60
            } catch (Exception e) {
61
                return R.error();
62
            }
63
            SignEntity signEntity = new SignEntity();
68
            SignEntity signEntity = new SignEntity();
64
            signEntity.setAttendersId(attendersId);
69
            signEntity.setAttendersId(attendersId);
65
            signEntity.setMeetingId(Long.valueOf(orderInfo.get("meetingId").toString()));
70
            signEntity.setMeetingId(Long.valueOf(orderInfo.get("meetingId").toString()));

+ 0 - 14
src/main/java/io/renren/modules/app/controller/UserController.java

56
        return R.ok();
56
        return R.ok();
57
    }
57
    }
58
58
59
    /**
60
     * 订单列表
61
     */
62
    @Login
63
    @GetMapping("/orderlist")
64
    @ApiOperation("获取订单列表")
65
    public R orderList(@RequestAttribute("userId") Integer userId){
66
        // System.out.println(userId);
67
        Long memberId = Long.valueOf(userId);        
68
69
        List<Map<String, Object>> orderList = userService.queryOrderList(memberId);        
70
71
        return R.ok().put("orderList", orderList);
72
    }
73
    /**
59
    /**
74
     * 重置密码
60
     * 重置密码
75
     */
61
     */

+ 0 - 7
src/main/java/io/renren/modules/app/dao/UserDao.java

8
8
9
package io.renren.modules.app.dao;
9
package io.renren.modules.app.dao;
10
10
11
import java.util.List;
12
import java.util.Map;
11
import java.util.Map;
13
12
14
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
13
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
24
 */
23
 */
25
@Mapper
24
@Mapper
26
public interface UserDao extends BaseMapper<UserEntity> {
25
public interface UserDao extends BaseMapper<UserEntity> {
27
    @Select("select p.id, p.order_id orderId, mem.truename, mem.organization, p.pay_time payTime,p.is_pay isPay,(select m.name_cn from meeting as m where m.id=p.meeting_id) as meetingName from attenders join payment p on attenders.id=p.attenders_id join member mem on mem.id=attenders.member_id where attenders.member_id=#{memberId};")
28
    List<Map<String, Object>> queryOrderList(Long memberId);
29
30
    @Select("select mem.truename, mem.organization, mem.position, (select m.name_cn from meeting as m where m.id=a.meeting_id) as meetingName, (select m.start_time from meeting as m where m.id=a.meeting_id) as startTime,(select m.end_time from meeting as m where m.id=a.meeting_id) as endTime,(select p.is_pay from payment as p where p.attenders_id = a.id) as IsPay from attenders a join member mem on mem.id=a.member_id where a.id = #{attendersId};")
31
    Map<String, Object> queryOrderInfoByAttendersId(Long attendersId);
32
33
    @Update("UPDATE member SET `password`=#{password}, `salt`=#{salt} WHERE `id`=#{id}")
26
    @Update("UPDATE member SET `password`=#{password}, `salt`=#{salt} WHERE `id`=#{id}")
34
    int updatePassWord(Long id, String password, String salt);
27
    int updatePassWord(Long id, String password, String salt);
35
}
28
}

+ 0 - 6
src/main/java/io/renren/modules/app/service/UserService.java

37
	 */
37
	 */
38
	public void saveUser(UserEntity user);
38
	public void saveUser(UserEntity user);
39
39
40
	/**
41
	 * 根据用户id 获取订单信息
42
	 * @param memberId
43
	 */
44
	List<Map<String, Object>> queryOrderList(Long memberId);
45
46
	/**
40
	/**
47
	 * 
41
	 * 
48
	 */
42
	 */

+ 0 - 5
src/main/java/io/renren/modules/app/service/impl/UserServiceImpl.java

64
		
64
		
65
		return baseMapper.updatePassWord(id, password, salt);
65
		return baseMapper.updatePassWord(id, password, salt);
66
	}
66
	}
67
	
68
	@Override
69
	public List<Map<String, Object>> queryOrderList(Long memberId) {
70
		return baseMapper.queryOrderList(memberId);
71
	}
72
67
73
	@Override
68
	@Override
74
	public Map<String, Object> queryOrderInfoByAttendersId(Long attendersId) {
69
	public Map<String, Object> queryOrderInfoByAttendersId(Long attendersId) {

+ 2 - 2
src/main/resources/application-dev.yml

3
        type: com.alibaba.druid.pool.DruidDataSource
3
        type: com.alibaba.druid.pool.DruidDataSource
4
        druid:
4
        druid:
5
            driver-class-name: com.mysql.cj.jdbc.Driver
5
            driver-class-name: com.mysql.cj.jdbc.Driver
6
            url: jdbc:mysql://localhost:3306/meeting?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false
6
            url: jdbc:mysql://192.168.3.233:3306/meeting?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false
7
            username: root
7
            username: root
8
            password: root001
8
            password: root001
9
            initial-size: 10
9
            initial-size: 10
53
    uploadFolder: /uploads
53
    uploadFolder: /uploads
54
## 前台访问地址
54
## 前台访问地址
55
url:
55
url:
56
    qrcode: http://192.168.3.233/qrcode/webmeeting.html?attendersId=
56
    qrcode: http://192.168.3.233/qrcode/webmeeting.html?orderId=