| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.acs.common.constant.CommonConstant; |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | |
| | | @OperationLog("Create Code") |
| | | @PostMapping("/code/save") |
| | | public R save(@RequestBody Code code) { |
| | | code.setData(Utils.zeroFill(code.getData(), CommonConstant.QR_CODE_LEN)); |
| | | code.setData(QrCodeCodecSupport.normalize(code.getData())); |
| | | code.setUuid("code".concat(code.getData())); |
| | | code.setCreateBy(getLoginUserId()); |
| | | code.setCreateTime(new Date()); |
| | |
| | | boolean cornerChanged = origin != null |
| | | && code.getCorner() != null |
| | | && !Objects.equals(origin.getCorner(), code.getCorner()); |
| | | code.setData(Utils.zeroFill(code.getData(), CommonConstant.QR_CODE_LEN)); |
| | | code.setData(QrCodeCodecSupport.normalize(code.getData())); |
| | | code.setUpdateBy(getLoginUserId()); |
| | | code.setUpdateTime(new Date()); |
| | | if (!codeService.updateById(code)) { |
| | |
| | | Date now = new Date(); Long userId = getLoginUserId(); |
| | | for (Map<String, Object> map : list) { |
| | | Code code = Cools.convert(map, Code.class); |
| | | code.setData(QrCodeCodecSupport.normalize(code.getData())); |
| | | if (null != codeService.getCacheByData(code.getData())) { |
| | | continue; |
| | | } |
| | | code.setData(Utils.zeroFill(code.getData(), CommonConstant.QR_CODE_LEN)); |
| | | code.setUuid("code".concat(code.getData())); |
| | | // code.setCorner(0); |
| | | code.setScale(GsonUtils.toJson(Cools.add("x", 1).add("y", 1))); |