|
@ -5,13 +5,19 @@ import com.example.demo.domain.entity.Detail; |
|
|
import com.example.demo.domain.vo.DetailVo; |
|
|
import com.example.demo.domain.vo.DetailVo; |
|
|
import com.example.demo.domain.vo.Page; |
|
|
import com.example.demo.domain.vo.Page; |
|
|
import com.example.demo.domain.vo.Result; |
|
|
import com.example.demo.domain.vo.Result; |
|
|
|
|
|
import com.example.demo.domain.vo.UserVo; |
|
|
import com.example.demo.serviceImpl.ConsumeServiceImpl; |
|
|
import com.example.demo.serviceImpl.ConsumeServiceImpl; |
|
|
|
|
|
import com.example.demo.serviceImpl.UserServiceImpl; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
|
|
|
import static java.lang.Integer.parseInt; |
|
|
|
|
|
|
|
|
@RestController |
|
|
@RestController |
|
|
@RequestMapping("/consume") |
|
|
@RequestMapping("/consume") |
|
|
//SpringMVC的,为当前类的所有处理器方法,添加路径映射的前缀 |
|
|
//SpringMVC的,为当前类的所有处理器方法,添加路径映射的前缀 |
|
@ -22,6 +28,9 @@ import org.springframework.web.bind.annotation.*; |
|
|
public class ConsumeController { |
|
|
public class ConsumeController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
ConsumeServiceImpl consumeService; |
|
|
ConsumeServiceImpl consumeService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
UserServiceImpl userService; |
|
|
|
|
|
|
|
|
@PostMapping("/add") |
|
|
@PostMapping("/add") |
|
|
// public Result add(@RequestParam("userId") Integer userId, @RequestBody Detail detail){ |
|
|
// public Result add(@RequestParam("userId") Integer userId, @RequestBody Detail detail){ |
|
|
public Result add(@RequestBody Detail detail) throws Exception { |
|
|
public Result add(@RequestBody Detail detail) throws Exception { |
|
@ -59,8 +68,16 @@ public class ConsumeController { |
|
|
|
|
|
|
|
|
@PostMapping("/getDeatil/{jwcode}") |
|
|
@PostMapping("/getDeatil/{jwcode}") |
|
|
public Result getDeatil(@PathVariable("jwcode") Integer jwcode){ |
|
|
public Result getDeatil(@PathVariable("jwcode") Integer jwcode){ |
|
|
|
|
|
|
|
|
return Result.success(consumeService.getDeatil(jwcode)); |
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
UserVo userVo=new UserVo(); |
|
|
|
|
|
userVo.setJwcode(jwcode.toString()); |
|
|
|
|
|
userService.search(userVo); |
|
|
|
|
|
System.out.println("======================"+userVo); |
|
|
|
|
|
return Result.success(consumeService.getDeatil(jwcode)); |
|
|
|
|
|
}catch (Exception e) { |
|
|
|
|
|
log.error(Arrays.toString(e.getStackTrace())); |
|
|
|
|
|
return Result.error(e.getMessage()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@PostMapping("/getProduct") |
|
|
@PostMapping("/getProduct") |
|
|