Przeglądaj źródła

前端订单及扫码等

huwhois 4 lat temu
rodzic
commit
b12c6f9e10

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

@ -82,13 +82,6 @@ public class MeetingController {
82 82
    @RequiresPermissions("admin:meeting:info")
83 83
    public R info(@PathVariable("id") Long id){
84 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 86
        return R.ok().put("meeting", meeting);
94 87
    }

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

@ -39,4 +39,10 @@ public interface PaymentDao extends BaseMapper<PaymentEntity> {
39 39
40 40
    @Update("UPDATE payment SET `is_pay`=#{status} where id=#{id}")
41 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,5 +41,9 @@ public interface PaymentService extends IService<PaymentEntity> {
41 41
    BigDecimal getTotalMoney(Long meetingId, String where);
42 42
43 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,4 +81,14 @@ public class PaymentServiceImpl extends ServiceImpl<PaymentDao, PaymentEntity> i
81 81
    public int updatePayStatus(Long id, Integer status) {
82 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,16 +19,12 @@ import org.springframework.web.bind.annotation.PathVariable;
19 19

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

33 29
/**
34 30
 * @author chenshun
@ -41,8 +37,6 @@ public class AppOrderController {
41 37
    @Autowired
42 38
    private AttendersService attendersService;
43 39
    @Autowired
44
    private UserService userService;
45
    @Autowired
46 40
    private PaymentService paymentService;
47 41
    
48 42
    /**
@ -51,10 +45,9 @@ public class AppOrderController {
51 45
    @Login
52 46
    @GetMapping("/list")
53 47
    public R orderList(@RequestAttribute("userId") Integer userId){
54
        System.out.println(userId);
55 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 52
        return R.ok().put("orderList", orderList);
60 53
    }
@ -128,24 +121,13 @@ public class AppOrderController {
128 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 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,8 +10,6 @@ package io.renren.modules.app.controller;
10 10
11 11
import io.renren.common.utils.R;
12 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 13
import io.swagger.annotations.Api;
16 14
import io.swagger.annotations.ApiOperation;
17 15

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

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

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

@ -14,9 +14,8 @@ import org.springframework.web.bind.annotation.RestController;
14 14
15 15
import io.renren.common.utils.R;
16 16
import io.renren.modules.admin.entity.SignEntity;
17
import io.renren.modules.admin.service.PaymentService;
17 18
import io.renren.modules.admin.service.SignService;
18
import io.renren.modules.app.service.UserService;
19
20 19
21 20
22 21
/**
@ -32,34 +31,40 @@ public class Sign {
32 31
    @Autowired
33 32
    private SignService signService;
34 33
    @Autowired
35
    private UserService userService;
34
    private PaymentService paymentService;
36 35
    /**
37 36
     * 保存
38 37
     */
39 38
    @PostMapping("/signin")
40 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 64
        SignEntity sEntity =  signService.getOne(
43 65
            new QueryWrapper<SignEntity>().eq("attenders_id", attendersId)
44 66
        );
45 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 68
            SignEntity signEntity = new SignEntity();
64 69
            signEntity.setAttendersId(attendersId);
65 70
            signEntity.setMeetingId(Long.valueOf(orderInfo.get("meetingId").toString()));

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

@ -56,20 +56,6 @@ public class UserController {
56 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,7 +8,6 @@
8 8
9 9
package io.renren.modules.app.dao;
10 10
11
import java.util.List;
12 11
import java.util.Map;
13 12
14 13
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -24,12 +23,6 @@ import org.apache.ibatis.annotations.Update;
24 23
 */
25 24
@Mapper
26 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 26
    @Update("UPDATE member SET `password`=#{password}, `salt`=#{salt} WHERE `id`=#{id}")
34 27
    int updatePassWord(Long id, String password, String salt);
35 28
}

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

@ -37,12 +37,6 @@ public interface UserService extends IService<UserEntity> {
37 37
	 */
38 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,11 +64,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
64 64
		
65 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 68
	@Override
74 69
	public Map<String, Object> queryOrderInfoByAttendersId(Long attendersId) {

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

@ -3,7 +3,7 @@ spring:
3 3
        type: com.alibaba.druid.pool.DruidDataSource
4 4
        druid:
5 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 7
            username: root
8 8
            password: root001
9 9
            initial-size: 10
@ -53,4 +53,4 @@ file:
53 53
    uploadFolder: /uploads
54 54
## 前台访问地址
55 55
url:
56
    qrcode: http://192.168.3.233/qrcode/webmeeting.html?attendersId=
56
    qrcode: http://192.168.3.233/qrcode/webmeeting.html?orderId=