首页 > 其他分享 >实战:第三章:更新数据只能是下月修改,当月不能修改

实战:第三章:更新数据只能是下月修改,当月不能修改

时间:2023-02-17 16:59:10浏览次数:44  
标签:实战 merchants 第三章 String RedisUtils commissionMerchants getCommission 修改 id

第一种:可以利用缓存,commissionMerchantsBean是传入的参数对象

 //将合作对象更改后,应该在下个月份才生效
                //根据merchants_id查询tst_commission_merchants表获取import_partner_employee_id
                CommissionMerchantsBean merchantsBean = commissionDaoC.getCommissionMerchants(commissionMerchantsBean);
                //获取缓存中的生效时间
                String effectTimeImport = RedisUtils.getKey("effectTimeImport:" + commissionMerchants.getCommission_merchants_id());
                String effectTimeRelation = RedisUtils.getKey("effectTimeRelation:" + commissionMerchants.getCommission_merchants_id());
                if(tst.project.utils.StringUtils.isEmpty(effectTimeImport)){
                    //如果为空,设置缓存
                    RedisUtils.setKey("effectTimeImport:" + commissionMerchants.getCommission_merchants_id(),String.valueOf(TimeUtils.dateToStr(nextMonthStartTimes,"yyyy-MM")));
                }
                //重新获取
                String effectTimeImport2 = RedisUtils.getKey("effectTimeImport:" + commissionMerchants.getCommission_merchants_id());
                //导入的生效日期不等于当月的则将传入的import_partner_employee_id设置为库中原来的数据
                if(effectTimeImport2.compareTo(TimeUtils.dateToStr(new Date(),"yyyy-MM")) != 0){
                    //如果不为空,且缓存中的日期是几个月前的设置下月为生效日期
                    RedisUtils.setKey("effectTimeImport:" + commissionMerchants.getCommission_merchants_id(),String.valueOf(TimeUtils.dateToStr(nextMonthStartTimes,"yyyy-MM")));
                    //设置导入合作对象员工id为原来的数据
                    String importPartnerEmployeeId = merchantsBean.getImport_partner_employee_id();
                    commissionMerchantsBean.setImport_partner_employee_id(importPartnerEmployeeId);
                }
                if(tst.project.utils.StringUtils.isEmpty(effectTimeRelation)){
                    //如果为空,设置缓存
                    RedisUtils.setKey("effectTimeRelation:" + commissionMerchants.getCommission_merchants_id(),String.valueOf(TimeUtils.dateToStr(nextMonthStartTimes,"yyyy-MM")));
                }
                //重新获取

更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/120583692

标签:实战,merchants,第三章,String,RedisUtils,commissionMerchants,getCommission,修改,id
From: https://www.cnblogs.com/wangchuanxinshi/p/17130741.html

相关文章

  • #yyds干货盘点 react笔记之学习之修改log组件
    前言我是歌谣我有个兄弟巅峰的时候排名c站总榜19叫前端小歌谣曾经我花了三年的时间创作了他现在我要用五年的时间超越他今天又是接近兄弟的一天人生难免坎坷大不了从......
  • 基于第三方组件主题修改
    调用修改主题方法,通常结合localStorage来使用updateTheme("theme");方法调用,通过root设置变量+手动注入页面lessimport{setThemeColor}from"@/utils/t......
  • ABAP开发:获取当前时间前n个小时做过修改的数据
    1.问题描述OA设置每隔1小时从SAP同步采购订单,由于没做筛选每次同步SAP全部数据,响应报文太大导致OA系统卡顿。2.解决办法采购订单抬头(ekko)表,有个字段叫"LASTCHANGEDAT......
  • Eclipse中如何修改SVN的地址
    在SVN服务端的IP更改后,客户端SVN的连接地址可以在Eclipse中进行修改,方法如下:首先:在Eclipse中选择Windows->ShowView->others就会出现【SVN资源库/SVNRepositories】,选......
  • vue2 - vue.set 添加属性与修改属性,修改数组的注意事项
    1.vue.set添加属性与修改属性Vue.set(target,propertyName/index,value)vm.$set(target,propertyName/index,value)<divid="root"><buttonv-on:click="addAttr">点击......
  • Maven本地仓库修改
    阿里云镜像 <mirror><id>nexus-aliyun</id><mirrorOf>central</mirrorOf><name>Nexusaliyun</name><url>http://maven.aliyun.com/......
  • vue项目打包后,自由修改配置如接口地址等
    背景描述:项目打包后,如果想更换接口域名或者项目名称,就需要再次打包。但是这样子操作有点耗费时间。如果把这些配置写到一个文件中,然后在index.html文件中引入使用,这样子......
  • linux脚本禁止修改排查
    问题描述同事发过来一个脚本,说怎么修改都修改不了保存提示:warning:Changingareaedonlyfile//orOperationnotpermitted提示没权限,不过我都是root了问题......
  • 读Java实战(第二版)笔记12_重构、测试和调试
    1. 设计模式1.1. 对设计经验的归纳总结1.2. 一种可重用的蓝图1.3. Java5引入了for-each循环1.3.1. 替代了很多显式使用迭代器的情形1.4. Java7推出的菱形操......
  • 修改hosts解决emby媒体刮削不到图片
    由于DNS国内在解析TheMovieDb无法连接到最快的服务器基本搜刮不到媒体图片首先确保片源勾选了TheMovieDb幸好TheMovieDb为了全球访问快在各地都有分流的CDN服务器......