From 6908d8eaf3641a09e35cdf2424b1c917778e9855 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 5 Jul 2024 09:51:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=2050MB?= =?UTF-8?q?=20=E8=BF=9B=E8=A1=8C=E4=B8=80=E6=AC=A1=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 12 +++++++++++- src/main/resources/application.yml | 7 ++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b83d222..7425e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,11 @@ -/target/ +### IDEA ### +/target/**/* +/log/* +.idea/* +*.iml +*/target/* +*/*.iml +/.gradle/ +/application.pid +/target/* +**.jar \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d784451..9ef5971 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -59,18 +59,19 @@ logging: file: # 切记,该文件表示正在产出日志的日志文件。并不会打包,当文件大于max-file-size,会根据file-name-pattern格式打包 # 名称为log/cashier-client.log文件夹会在项目根目录下,打包后会在启动包同目录下;名称为/log/cashier-client.log的文件夹会在项目所在磁盘的跟目录下 - name: log/cashierService.log + name: wx.log logback: rollingpolicy: # 单文件的大小,默认10M, 超过之后打包成一个日志文件 - max-file-size: 10MB + max-file-size: 50MB # 日志保存的天数 max-history: 30 # 打包文件格式,默认: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,书写格式为:文件路径/文件名.%i.文件后缀,其中%i不可省去,否则无日志显示 # 例如: 日期为:2021/11/5 ,则打包文件之后为: log/ota.2021-11-05.0.gz,0表示日志的第一部分,后续就是,1,2,3... # 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件 # 如下面的例子,打包之后为: log/2021-11/cashier-client.2020-11-5.0.log,这是一个日志文件 - file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log +# file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log + file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log.gz #阿里云相关配置 aliyun: keyid: LTAI5tPdEfYSZcqHbjCrtPRD From b236cac065247d1c70879e33083800bd487716c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E9=B9=8F=E8=BE=89?= <18322780655@163.com> Date: Fri, 5 Jul 2024 10:05:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=80=97=E6=9D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/TbUserShopMsgMapper.java | 21 ++++----- .../cashierservice/entity/TbUserShopMsg.java | 12 ++++- .../cashierservice/service/LoginService.java | 10 +---- .../generator-mapper/generatorConfig.xml | 2 +- .../resources/mapper/TbUserShopMsgMapper.xml | 45 ++++++++++++------- 5 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java index c6f5a8a..425981a 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java @@ -1,36 +1,31 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Component; -/** -* @author Administrator -* @description 针对表【tb_user_shop_msg】的数据库操作Mapper -* @createDate 2024-06-28 09:55:30 -* @Entity com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg -*/ @Component @Mapper public interface TbUserShopMsgMapper { - int deleteByPrimaryKey(Integer shopId); - - int deleteByPrimaryKey(Long id); + int deleteByPrimaryKey(Integer id); int insert(TbUserShopMsg record); int insertSelective(TbUserShopMsg record); - TbUserShopMsg selectByPrimaryKey(Integer shopId); - TbUserShopMsg selectByPrimaryKey(Long id); + TbUserShopMsg selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(TbUserShopMsg record); int updateByPrimaryKey(TbUserShopMsg record); + @Select("select * from tb_user_shop_msg where shop_id=#{shopId}") TbUserShopMsg selectByShopId(@Param("shopId") String shopId); -} + + + TbUserShopMsg selectByShopIdAndOpenId(@Param("shopId") Integer shopId,@Param("openId") String openId); +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java index 22c4663..e1bedc8 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java @@ -4,6 +4,8 @@ import java.io.Serializable; import java.util.Date; public class TbUserShopMsg implements Serializable { + private Integer id; + private Integer shopId; private String openId; @@ -18,6 +20,14 @@ public class TbUserShopMsg implements Serializable { private static final long serialVersionUID = 1L; + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public Integer getShopId() { return shopId; } @@ -65,4 +75,4 @@ public class TbUserShopMsg implements Serializable { public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } -} +} \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java index a36fb42..3f87abb 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java @@ -65,22 +65,16 @@ public class LoginService { public Result wxBusinessLogin(String openId,String shopId){ - TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByPrimaryKey(Integer.valueOf(shopId)); + TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId),openId); if(Objects.isNull(shopMsg)){ shopMsg=new TbUserShopMsg(); - shopMsg.setShopId(Integer.valueOf(shopId)); shopMsg.setOpenId(openId); shopMsg.setCreateTime(new Date()); shopMsg.setStatus("1"); - - tbUserShopMsgMapper.insert(shopMsg); - }else { - shopMsg.setOpenId(openId); - shopMsg.setUpdateTime(new Date()); - tbUserShopMsgMapper.updateByPrimaryKey(shopMsg); } + // 为商家绑定openid if (shopOpenIdMapper.countByOpenId(openId) == null) { TbShopOpenId shopOpenId = new TbShopOpenId(); diff --git a/src/main/resources/generator-mapper/generatorConfig.xml b/src/main/resources/generator-mapper/generatorConfig.xml index a6c8bea..007174a 100644 --- a/src/main/resources/generator-mapper/generatorConfig.xml +++ b/src/main/resources/generator-mapper/generatorConfig.xml @@ -52,7 +52,7 @@ -
diff --git a/src/main/resources/mapper/TbUserShopMsgMapper.xml b/src/main/resources/mapper/TbUserShopMsgMapper.xml index 25fdc4c..3220910 100644 --- a/src/main/resources/mapper/TbUserShopMsgMapper.xml +++ b/src/main/resources/mapper/TbUserShopMsgMapper.xml @@ -2,7 +2,8 @@ - + + @@ -10,29 +11,32 @@ - shop_id, open_id, remark, status, create_time, update_time + id, shop_id, open_id, remark, status, create_time, update_time delete from tb_user_shop_msg - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} - insert into tb_user_shop_msg (shop_id, open_id, remark, - status, create_time, update_time - ) - values (#{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} - ) + insert into tb_user_shop_msg (id, shop_id, open_id, + remark, status, create_time, + update_time) + values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, + #{remark,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}) insert into tb_user_shop_msg + + id, + shop_id, @@ -53,6 +57,9 @@ + + #{id,jdbcType=INTEGER}, + #{shopId,jdbcType=INTEGER}, @@ -76,6 +83,9 @@ update tb_user_shop_msg + + shop_id = #{shopId,jdbcType=INTEGER}, + open_id = #{openId,jdbcType=VARCHAR}, @@ -92,15 +102,20 @@ update_time = #{updateTime,jdbcType=TIMESTAMP}, - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} update tb_user_shop_msg - set open_id = #{openId,jdbcType=VARCHAR}, + set shop_id = #{shopId,jdbcType=INTEGER}, + open_id = #{openId,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} - + + + \ No newline at end of file From fd465c9fe75c2280b2e06ed7d3103b0dc58a2c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E9=B9=8F=E8=BE=89?= <18322780655@163.com> Date: Fri, 5 Jul 2024 10:13:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=80=97=E6=9D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/TbUserShopMsgMapper.java | 2 + .../cashierservice/entity/TbUserShopMsg.java | 12 ++++- .../cashierservice/service/LoginService.java | 10 +---- .../resources/mapper/TbUserShopMsgMapper.xml | 45 ++++++++++++------- 4 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java index c6f5a8a..d65a62d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java @@ -32,5 +32,7 @@ public interface TbUserShopMsgMapper { @Select("select * from tb_user_shop_msg where shop_id=#{shopId}") TbUserShopMsg selectByShopId(@Param("shopId") String shopId); + + TbUserShopMsg selectByShopIdAndOpenId(@Param("shopId") Integer shopId,@Param("openId") String openId); } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java index 22c4663..e1bedc8 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java @@ -4,6 +4,8 @@ import java.io.Serializable; import java.util.Date; public class TbUserShopMsg implements Serializable { + private Integer id; + private Integer shopId; private String openId; @@ -18,6 +20,14 @@ public class TbUserShopMsg implements Serializable { private static final long serialVersionUID = 1L; + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public Integer getShopId() { return shopId; } @@ -65,4 +75,4 @@ public class TbUserShopMsg implements Serializable { public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } -} +} \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java index a36fb42..3f87abb 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java @@ -65,22 +65,16 @@ public class LoginService { public Result wxBusinessLogin(String openId,String shopId){ - TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByPrimaryKey(Integer.valueOf(shopId)); + TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId),openId); if(Objects.isNull(shopMsg)){ shopMsg=new TbUserShopMsg(); - shopMsg.setShopId(Integer.valueOf(shopId)); shopMsg.setOpenId(openId); shopMsg.setCreateTime(new Date()); shopMsg.setStatus("1"); - - tbUserShopMsgMapper.insert(shopMsg); - }else { - shopMsg.setOpenId(openId); - shopMsg.setUpdateTime(new Date()); - tbUserShopMsgMapper.updateByPrimaryKey(shopMsg); } + // 为商家绑定openid if (shopOpenIdMapper.countByOpenId(openId) == null) { TbShopOpenId shopOpenId = new TbShopOpenId(); diff --git a/src/main/resources/mapper/TbUserShopMsgMapper.xml b/src/main/resources/mapper/TbUserShopMsgMapper.xml index 25fdc4c..3220910 100644 --- a/src/main/resources/mapper/TbUserShopMsgMapper.xml +++ b/src/main/resources/mapper/TbUserShopMsgMapper.xml @@ -2,7 +2,8 @@ - + + @@ -10,29 +11,32 @@ - shop_id, open_id, remark, status, create_time, update_time + id, shop_id, open_id, remark, status, create_time, update_time delete from tb_user_shop_msg - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} - insert into tb_user_shop_msg (shop_id, open_id, remark, - status, create_time, update_time - ) - values (#{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} - ) + insert into tb_user_shop_msg (id, shop_id, open_id, + remark, status, create_time, + update_time) + values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, + #{remark,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}) insert into tb_user_shop_msg + + id, + shop_id, @@ -53,6 +57,9 @@ + + #{id,jdbcType=INTEGER}, + #{shopId,jdbcType=INTEGER}, @@ -76,6 +83,9 @@ update tb_user_shop_msg + + shop_id = #{shopId,jdbcType=INTEGER}, + open_id = #{openId,jdbcType=VARCHAR}, @@ -92,15 +102,20 @@ update_time = #{updateTime,jdbcType=TIMESTAMP}, - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} update tb_user_shop_msg - set open_id = #{openId,jdbcType=VARCHAR}, + set shop_id = #{shopId,jdbcType=INTEGER}, + open_id = #{openId,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} - + + + \ No newline at end of file