huwhois 5 years ago
parent
commit
ab614765e0

+ 67 - 13
src/main/java/io/renren/modules/admin/controller/SignInfoController.java

@ -20,9 +20,18 @@ import org.springframework.web.bind.annotation.RequestMapping;
20 20
import org.springframework.web.bind.annotation.RequestParam;
21 21
import org.springframework.web.bind.annotation.RestController;
22 22
23
import io.renren.modules.admin.entity.AttendersEntity;
23 24
import io.renren.modules.admin.entity.ExcelEntity;
25
import io.renren.modules.admin.entity.MemberEntity;
26
import io.renren.modules.admin.entity.PaymentEntity;
27
import io.renren.modules.admin.entity.SignEntity;
24 28
import io.renren.modules.admin.entity.SignInfoEntity;
29
import io.renren.modules.admin.service.AttendersService;
30
import io.renren.modules.admin.service.MemberService;
31
import io.renren.modules.admin.service.PaymentService;
25 32
import io.renren.modules.admin.service.SignInfoService;
33
import io.renren.modules.admin.service.SignService;
34
import io.renren.modules.sys.controller.AbstractController;
26 35
import io.renren.common.utils.ExcelUtils;
27 36
import io.renren.common.utils.PageUtils;
28 37
import io.renren.common.utils.R;
@ -36,9 +45,17 @@ import io.renren.common.utils.R;
36 45
 */
37 46
@RestController
38 47
@RequestMapping("admin/signinfo")
39
public class SignInfoController {
48
public class SignInfoController extends AbstractController {
40 49
    @Autowired
41 50
    private SignInfoService signInfoService;
51
    @Autowired
52
    private MemberService memberService;
53
    @Autowired
54
    private AttendersService attendersService;
55
    @Autowired
56
    private SignService signService;
57
    @Autowired
58
    private PaymentService paymentService;
42 59
43 60
    /**
44 61
     * 列表
@ -129,17 +146,55 @@ public class SignInfoController {
129 146
        ExcelUtils.exportExcel(data, response.getOutputStream());
130 147
    }
131 148
132
133
    // /**
134
    //  * 保存
135
    //  */
136
    // @RequestMapping("/save")
137
    // @RequiresPermissions("admin:signinfo:save")
138
    // public R save(@RequestBody SignInfoEntity signInfo){
139
	// 	signInfoService.save(signInfo);
140
141
    //     return R.ok();
142
    // }
149
    /**
150
     * 保存
151
     */
152
    @RequestMapping("/save")
153
    @RequiresPermissions("admin:signinfo:save")
154
    public R save(@RequestBody SignInfoEntity signInfo){
155
        Date nowTime = new Date();
156
        MemberEntity member = new MemberEntity();
157
        member.setUsername(signInfo.getPhone());
158
        member.setPassword("123456");         // 默认密码
159
        member.setTruename(signInfo.getTruename());
160
        member.setOrganization(signInfo.getOrganization());
161
        member.setPosition(signInfo.getPosition());
162
        member.setJobTitle(signInfo.getJobTitle());
163
        member.setPhone(signInfo.getPhone());
164
        member.setEmail(signInfo.getEmail());
165
        member.setIsCheck(1);
166
        member.setCreateId(getUserId());
167
        memberService.saveMember(member);
168
169
        AttendersEntity attenders = new AttendersEntity();
170
        attenders.setMeetingId(signInfo.getMeetingId());
171
        attenders.setMemberId(member.getId());
172
        attenders.setName(member.getTruename());
173
        attenders.setTypeId(signInfo.getTypeId());
174
        attenders.setServicer(signInfo.getServicer());
175
        attenders.setNote(signInfo.getNote());
176
        attenders.setCreater(getUserId());
177
        attenders.setCreateTime(nowTime);
178
        attendersService.save(attenders);
179
180
        PaymentEntity payment = new PaymentEntity();
181
        payment.setMeetingId(signInfo.getMeetingId());
182
        payment.setAttendersId(attenders.getId());
183
        payment.setIsCheck(signInfo.getIsPay());
184
        paymentService.savePayment(payment);
185
186
        SignEntity sign = new SignEntity();
187
        sign.setMeetingId(signInfo.getMeetingId());
188
        sign.setAttendersId(attenders.getId());
189
        sign.setStatus(1);
190
        sign.setBadge(signInfo.getBadge());
191
        sign.setCreateTime(nowTime);
192
        sign.setLastTime(nowTime);
193
        sign.setFlag(1L);
194
		signService.save(sign);
195
196
        return R.ok();
197
    }
143 198
144 199
    // /**
145 200
    //  * 修改
@ -162,5 +217,4 @@ public class SignInfoController {
162 217
163 218
    //     return R.ok();
164 219
    // }
165
166 220
}

+ 8 - 1
src/main/java/io/renren/modules/admin/entity/SignInfoEntity.java

@ -52,6 +52,10 @@ public class SignInfoEntity implements Serializable {
52 52
	 * 电话
53 53
	 */
54 54
	private String phone;
55
	/**
56
	 * 电话
57
	 */
58
	private String email;
55 59
	/**
56 60
	 * 参会人员类型id
57 61
	 */
@ -84,5 +88,8 @@ public class SignInfoEntity implements Serializable {
84 88
	 * 最后签到时间
85 89
	 */
86 90
	private Date lastTime;
87
91
	/**
92
	 * 负责人
93
	 */
94
	private String note;
88 95
}

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

@ -16,5 +16,7 @@ import java.util.Map;
16 16
public interface PaymentService extends IService<PaymentEntity> {
17 17
18 18
    PageUtils queryPage(Map<String, Object> params);
19
20
	void savePayment(PaymentEntity payment);
19 21
}
20 22

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

@ -1,6 +1,9 @@
1 1
package io.renren.modules.admin.service.impl;
2 2
3 3
import org.springframework.stereotype.Service;
4
5
import java.text.SimpleDateFormat;
6
import java.util.Date;
4 7
import java.util.Map;
5 8
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 9
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -26,4 +29,14 @@ public class PaymentServiceImpl extends ServiceImpl<PaymentDao, PaymentEntity> i
26 29
        return new PageUtils(page);
27 30
    }
28 31
32
    @Override
33
    public void savePayment(PaymentEntity payment) {
34
        payment.setCreateTime(new Date());
35
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");
36
        String nowtime = sdf.format(new Date());
37
        // System.out.println(time);
38
        Integer fourRandom = Integer.valueOf((int)((Math.random()*9+1)*1000));
39
        payment.setOrderId("FY" + nowtime + fourRandom);
40
        this.save(payment);
41
    }
29 42
}