4 changed files with 99 additions and 0 deletions
@ -0,0 +1,36 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.service.DemoService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 移动端接口-评论模块 |
|||
* |
|||
* @Author WJP |
|||
* @Date 2019/9/9 09:45 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("demo") |
|||
public class DemoController { |
|||
|
|||
@Autowired |
|||
private DemoService demoService; |
|||
|
|||
/** |
|||
* 事务 |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping("seata") |
|||
public Result demo(Map<String, Object> map) { |
|||
return demoService.demo(map); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* Demo |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/6/5 14:10 |
|||
*/ |
|||
public interface DemoService { |
|||
|
|||
/** |
|||
* 测试分布式事务 |
|||
* |
|||
* @param map |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author rongchao |
|||
* @since 2020-01-09 |
|||
*/ |
|||
Result demo(Map<String, Object> map); |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.ScanSwitchDTO; |
|||
import com.elink.esua.epdc.feign.DemoFeignClient; |
|||
import com.elink.esua.epdc.service.DemoService; |
|||
import com.elink.esua.epdc.service.ScanSwitchService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/11 9:40 |
|||
*/ |
|||
@Service |
|||
public class DemoServiceImpl implements DemoService { |
|||
|
|||
@Autowired |
|||
private ScanSwitchService scanSwitchService; |
|||
|
|||
@Autowired |
|||
private DemoFeignClient demoFeignClient; |
|||
|
|||
@Override |
|||
public Result demo(Map<String, Object> map) { |
|||
ScanSwitchDTO dto = new ScanSwitchDTO(); |
|||
dto.setId("54185412da2bea73804fc1de69827e18"); |
|||
dto.setMaintainInfo(map.get("username").toString()); |
|||
scanSwitchService.update(dto); |
|||
demoFeignClient.seata(map.get("username").toString(), Integer.parseInt(map.get("age").toString())); |
|||
return new Result(); |
|||
} |
|||
} |
Loading…
Reference in new issue