Search in sources :

Example 1 with Log

use of co.yixiang.modules.logging.aop.log.Log in project yshopmall by guchengwuyue.

the class SystemGroupDataController method create.

@NoRepeatSubmit
@Log("新增数据配置")
@ApiOperation(value = "新增数据配置")
@PostMapping(value = "/yxSystemGroupData")
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
@PreAuthorize("hasAnyRole('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE')")
public ResponseEntity create(@RequestBody String jsonStr) {
    JSONObject jsonObject = JSON.parseObject(jsonStr);
    if (ObjectUtil.isNotNull(jsonObject.get("name"))) {
        if (StrUtil.isEmpty(jsonObject.get("name").toString())) {
            throw new BadRequestException("名称必须填写");
        }
    }
    if (ObjectUtil.isNotNull(jsonObject.get("title"))) {
        if (StrUtil.isEmpty(jsonObject.get("title").toString())) {
            throw new BadRequestException("标题必须填写");
        }
    }
    if (ObjectUtil.isNotNull(jsonObject.get("info"))) {
        if (StrUtil.isEmpty(jsonObject.get("info").toString())) {
            throw new BadRequestException("简介必须填写");
        }
    }
    if (ObjectUtil.isNotNull(jsonObject.get("pic"))) {
        if (StrUtil.isEmpty(jsonObject.get("pic").toString())) {
            throw new BadRequestException("图片必须上传");
        }
    }
    YxSystemGroupData yxSystemGroupData = new YxSystemGroupData();
    yxSystemGroupData.setGroupName(jsonObject.get("groupName").toString());
    jsonObject.remove("groupName");
    yxSystemGroupData.setValue(jsonObject.toJSONString());
    yxSystemGroupData.setStatus(jsonObject.getInteger("status"));
    yxSystemGroupData.setSort(jsonObject.getInteger("sort"));
    return new ResponseEntity(yxSystemGroupDataService.save(yxSystemGroupData), HttpStatus.CREATED);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) JSONObject(com.alibaba.fastjson.JSONObject) BadRequestException(co.yixiang.exception.BadRequestException) YxSystemGroupData(co.yixiang.modules.shop.domain.YxSystemGroupData) Log(co.yixiang.modules.logging.aop.log.Log) CacheEvict(org.springframework.cache.annotation.CacheEvict) NoRepeatSubmit(co.yixiang.modules.aop.NoRepeatSubmit) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 2 with Log

use of co.yixiang.modules.logging.aop.log.Log in project yshopmall by guchengwuyue.

the class SystemGroupDataController method getYxSystemGroupDatas.

@Log("查询数据配置")
@ApiOperation(value = "查询数据配置")
@GetMapping(value = "/yxSystemGroupData")
@PreAuthorize("hasAnyRole('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_SELECT')")
public ResponseEntity getYxSystemGroupDatas(YxSystemGroupDataQueryCriteria criteria, Pageable pageable) {
    Sort sort = Sort.by(Sort.Direction.DESC, "sort");
    Pageable pageableT = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), sort);
    return new ResponseEntity(yxSystemGroupDataService.queryAll(criteria, pageableT), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Pageable(org.springframework.data.domain.Pageable) Sort(org.springframework.data.domain.Sort) Log(co.yixiang.modules.logging.aop.log.Log) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 3 with Log

use of co.yixiang.modules.logging.aop.log.Log in project yshopmall by guchengwuyue.

the class SystemStoreStaffController method create.

@NoRepeatSubmit
@PostMapping
@Log("新增门店店员")
@ApiOperation("新增门店店员")
@PreAuthorize("@el.check('yxSystemStoreStaff:add')")
public ResponseEntity<Object> create(@Validated @RequestBody YxSystemStoreStaff resources) {
    YxSystemStore systemStore = yxSystemStoreService.getOne(Wrappers.<YxSystemStore>lambdaQuery().eq(YxSystemStore::getId, resources.getStoreId()));
    resources.setStoreName(systemStore.getName());
    return new ResponseEntity<>(yxSystemStoreStaffService.save(resources), HttpStatus.CREATED);
}
Also used : YxSystemStore(co.yixiang.modules.shop.domain.YxSystemStore) ResponseEntity(org.springframework.http.ResponseEntity) Log(co.yixiang.modules.logging.aop.log.Log) NoRepeatSubmit(co.yixiang.modules.aop.NoRepeatSubmit) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 4 with Log

use of co.yixiang.modules.logging.aop.log.Log in project yshopmall by guchengwuyue.

the class AliPayController method toPayAsPc.

@Log("支付宝PC网页支付")
@ApiOperation("PC网页支付")
@PostMapping(value = "/toPayAsPC")
public ResponseEntity<String> toPayAsPc(@Validated @RequestBody TradeVo trade) throws Exception {
    AlipayConfig aliPay = alipayService.find();
    trade.setOutTradeNo(alipayUtils.getOrderCode());
    String payUrl = alipayService.toPayAsPc(aliPay, trade);
    return ResponseEntity.ok(payUrl);
}
Also used : AlipayConfig(co.yixiang.modules.tools.domain.AlipayConfig) Log(co.yixiang.modules.logging.aop.log.Log) ApiOperation(io.swagger.annotations.ApiOperation)

Example 5 with Log

use of co.yixiang.modules.logging.aop.log.Log in project yshopmall by guchengwuyue.

the class AliPayController method toPayAsWeb.

@Log("支付宝手机网页支付")
@ApiOperation("手机网页支付")
@PostMapping(value = "/toPayAsWeb")
public ResponseEntity<String> toPayAsWeb(@Validated @RequestBody TradeVo trade) throws Exception {
    AlipayConfig alipay = alipayService.find();
    trade.setOutTradeNo(alipayUtils.getOrderCode());
    String payUrl = alipayService.toPayAsWeb(alipay, trade);
    return ResponseEntity.ok(payUrl);
}
Also used : AlipayConfig(co.yixiang.modules.tools.domain.AlipayConfig) Log(co.yixiang.modules.logging.aop.log.Log) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

Log (co.yixiang.modules.logging.aop.log.Log)23 ApiOperation (io.swagger.annotations.ApiOperation)22 ResponseEntity (org.springframework.http.ResponseEntity)19 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)16 BadRequestException (co.yixiang.exception.BadRequestException)10 NoRepeatSubmit (co.yixiang.modules.aop.NoRepeatSubmit)7 ForbidSubmit (co.yixiang.modules.aop.ForbidSubmit)6 JSONObject (com.alibaba.fastjson.JSONObject)4 UserDto (co.yixiang.modules.system.service.dto.UserDto)3 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)3 CacheEvict (org.springframework.cache.annotation.CacheEvict)3 RSA (cn.hutool.crypto.asymmetric.RSA)2 YxSystemGroupData (co.yixiang.modules.shop.domain.YxSystemGroupData)2 YxSystemStore (co.yixiang.modules.shop.domain.YxSystemStore)2 Dept (co.yixiang.modules.system.domain.Dept)2 RoleDto (co.yixiang.modules.system.service.dto.RoleDto)2 AlipayConfig (co.yixiang.modules.tools.domain.AlipayConfig)2 HashMap (java.util.HashMap)2 Pageable (org.springframework.data.domain.Pageable)2 Sort (org.springframework.data.domain.Sort)2