|
@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.huiju.welcome.common.base.BaseController;
|
7
|
7
|
import com.huiju.welcome.common.base.ResponseBean;
|
|
8
|
+import com.huiju.welcome.model.SysUser;
|
8
|
9
|
import com.huiju.welcome.model.TaCustomer;
|
9
|
10
|
import com.huiju.welcome.model.TaCustomerTransfer;
|
10
|
11
|
import com.huiju.welcome.model.TdGoodsType;
|
|
12
|
+import com.huiju.welcome.service.ISysUserService;
|
11
|
13
|
import com.huiju.welcome.service.ITaCustomerService;
|
12
|
14
|
import com.huiju.welcome.service.ITaCustomerTransferService;
|
13
|
15
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -17,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
17
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
18
|
20
|
import org.springframework.web.bind.annotation.*;
|
19
|
21
|
|
|
22
|
+import javax.servlet.http.HttpSession;
|
20
|
23
|
import java.time.LocalDateTime;
|
21
|
24
|
|
22
|
25
|
|
|
@@ -38,6 +41,8 @@ public class TaCustomerTransferController extends BaseController {
|
38
|
41
|
public ITaCustomerTransferService iTaCustomerTransferService;
|
39
|
42
|
@Autowired
|
40
|
43
|
public ITaCustomerService iTaCustomerService;
|
|
44
|
+ @Autowired
|
|
45
|
+ public ISysUserService iSysUserService;
|
41
|
46
|
|
42
|
47
|
|
43
|
48
|
/**
|
|
@@ -46,9 +51,22 @@ public class TaCustomerTransferController extends BaseController {
|
46
|
51
|
* @return
|
47
|
52
|
*/
|
48
|
53
|
@RequestMapping(value="/taCustomerTransfer/add",method= RequestMethod.POST)
|
49
|
|
- public ResponseBean tpShopImgAdd(@RequestBody TaCustomerTransfer taCustomerTransfer){
|
|
54
|
+ public ResponseBean tpShopImgAdd(@RequestBody TaCustomerTransfer taCustomerTransfer, HttpSession session){
|
50
|
55
|
ResponseBean responseBean = new ResponseBean();
|
51
|
56
|
try {
|
|
57
|
+ Integer formUserId = (Integer) session.getAttribute("token-id");
|
|
58
|
+ TaCustomer customer = iTaCustomerService.getById(taCustomerTransfer.getCustomerId());
|
|
59
|
+ SysUser toUser = iSysUserService.getById(taCustomerTransfer.getToUserId());
|
|
60
|
+ SysUser fromUser = iSysUserService.getById(formUserId);
|
|
61
|
+
|
|
62
|
+ taCustomerTransfer.setFromUserId(formUserId);
|
|
63
|
+ taCustomerTransfer.setFromUserName(fromUser.getUsername());
|
|
64
|
+ taCustomerTransfer.setCustomerId(taCustomerTransfer.getCustomerId());
|
|
65
|
+ taCustomerTransfer.setCustomerName(customer.getCustomerName());
|
|
66
|
+ taCustomerTransfer.setToUserId(taCustomerTransfer.getToUserId());
|
|
67
|
+ taCustomerTransfer.setToUserName(toUser.getUsername());
|
|
68
|
+
|
|
69
|
+
|
52
|
70
|
taCustomerTransfer.setTransferTime(LocalDateTime.now());
|
53
|
71
|
Boolean flag = iTaCustomerTransferService.save(taCustomerTransfer);
|
54
|
72
|
Boolean flagUpdate = false;
|
|
@@ -95,9 +113,22 @@ public class TaCustomerTransferController extends BaseController {
|
95
|
113
|
* @return
|
96
|
114
|
*/
|
97
|
115
|
@RequestMapping(value="/taCustomerTransfer/update",method= RequestMethod.PUT)
|
98
|
|
- public ResponseBean tpShopImgUpdate(@RequestBody TaCustomerTransfer taCustomerTransfer){
|
|
116
|
+ public ResponseBean tpShopImgUpdate(@RequestBody TaCustomerTransfer taCustomerTransfer, HttpSession session){
|
99
|
117
|
ResponseBean responseBean = new ResponseBean();
|
100
|
118
|
try {
|
|
119
|
+
|
|
120
|
+ Integer formUserId = (Integer) session.getAttribute("token-id");
|
|
121
|
+ TaCustomer customer = iTaCustomerService.getById(taCustomerTransfer.getCustomerId());
|
|
122
|
+ SysUser toUser = iSysUserService.getById(taCustomerTransfer.getToUserId());
|
|
123
|
+ SysUser fromUser = iSysUserService.getById(formUserId);
|
|
124
|
+
|
|
125
|
+ taCustomerTransfer.setFromUserId(formUserId);
|
|
126
|
+ taCustomerTransfer.setFromUserName(fromUser.getUsername());
|
|
127
|
+ taCustomerTransfer.setCustomerId(taCustomerTransfer.getCustomerId());
|
|
128
|
+ taCustomerTransfer.setCustomerName(customer.getCustomerName());
|
|
129
|
+ taCustomerTransfer.setToUserId(taCustomerTransfer.getToUserId());
|
|
130
|
+ taCustomerTransfer.setToUserName(toUser.getUsername());
|
|
131
|
+
|
101
|
132
|
if (iTaCustomerTransferService.updateById(taCustomerTransfer)){
|
102
|
133
|
responseBean.addSuccess("success");
|
103
|
134
|
}else {
|