diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index 004b7cf79..40fcdb811 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -3,7 +3,7 @@ spring: include: rabbitMQ # JDBC datasource: - url: jdbc:mysql://202.165.179.86:3306/mallinkDev?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true + url: jdbc:mysql://202.165.179.86:3306/mallinkDev?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) type: com.alibaba.druid.pool.DruidDataSource diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml index 6191f87b1..e1838b8ee 100644 --- a/mallinkAdmin/src/main/resources/application-prod.yml +++ b/mallinkAdmin/src/main/resources/application-prod.yml @@ -3,7 +3,7 @@ spring: include: rabbitMQ # JDBC datasource: - url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true + url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowMultiQueries=true username: ENC(NUzgQOdJnCbVLKT6BaX0aw==) password: ENC(mvuoDRiu0jqYaKNRwwTuXZ6U7aoIaqsjdiPqTLgi/nY=) type: com.alibaba.druid.pool.DruidDataSource diff --git a/mallinkAdmin/src/main/resources/application-test.yml b/mallinkAdmin/src/main/resources/application-test.yml index 5c5226404..9508fdc07 100644 --- a/mallinkAdmin/src/main/resources/application-test.yml +++ b/mallinkAdmin/src/main/resources/application-test.yml @@ -3,7 +3,7 @@ spring: include: rabbitMQ # JDBC datasource: - url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallinkTest?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true + url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallinkTest?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowMultiQueries=true username: ENC(Uc0AjgkytxHHCwZrmDASWg==) password: ENC(nV4Mi3bEbBx0Fj7uUyYH55eTaqsFMjKvmNzagicH4pc=) type: com.alibaba.druid.pool.DruidDataSource diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigMapper.java index 54daa248a..145072641 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigMapper.java @@ -8,7 +8,10 @@ import com.iformall.domain.po.WxLevelConfig; public interface WxLevelConfigMapper extends CommonMapper { List findList(WxLevelConfig wxLevelConfig); - + + int insertBatch(List list); + + int batchUpdate(List list); void deleteAll(@Param("tenantId")String tenantId); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java index 918b8ad07..0659bae2f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.iformall.common.IdWorker; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -132,6 +133,7 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { public void batchSave(String tenantId, List records) { final IdWorker idWorker = IdWorker.get(); wxLevelConfigMapper.deleteAll(tenantId); + List levelConfigs = new ArrayList<>(); for(WxLevelConfig levelConfig: records) { if(levelConfig.getId() == null) { levelConfig.setId(idWorker.nextId()); @@ -141,22 +143,24 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { levelConfig.setUpdateDate(new Date()); } levelConfig.setTenantId(tenantId); - wxLevelConfigMapper.insertSelective(levelConfig); + levelConfigs.add(levelConfig); } + wxLevelConfigMapper.insertBatch(levelConfigs); } @Override public void batchUpdateCapabilities(String tenantId, List records) { - records.stream() - .filter(l->l.getId() != null && l.getCount() != null) - .forEach(l->{ - l.setUpdateDate(new Date()); + List levelConfigs = new ArrayList(); + for(WxLevelConfig levelConfig: records) { + if(levelConfig.getId() != null && levelConfig.getCount() != null) { + levelConfig.setUpdateDate(new Date()); JSONObject jo = new JSONObject(); - jo.put(CAPABILITY_SEND_CAR_COUPON,l.getCount()); - l.setCapability(jo.toJSONString()); - l.setUpdateDate(new Date()); - wxLevelConfigMapper.updateByPrimaryKeySelective(l); - }); + jo.put(CAPABILITY_SEND_CAR_COUPON,levelConfig.getCount()); + levelConfig.setCapability(jo.toJSONString()); + levelConfigs.add(levelConfig); + } + } + wxLevelConfigMapper.batchUpdate(levelConfigs); } @Override diff --git a/mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml b/mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml index a77b6a550..7d1a68fea 100644 --- a/mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml @@ -69,8 +69,40 @@ + + insert into wx_level_config (id, tenant_id, points, level, description, create_date, update_date, + discount_enable, capability) values + + (#{item.id,jdbcType=BIGINT}, + #{item.tenantId,jdbcType=VARCHAR}, + #{item.points,jdbcType=INTEGER}, + #{item.level,jdbcType=VARCHAR}, + #{item.description,jdbcType=VARCHAR}, + #{item.createDate,jdbcType=TIMESTAMP}, + #{item.updateDate,jdbcType=TIMESTAMP}, + #{item.discountEnable,jdbcType=SMALLINT}, + #{item.capability,jdbcType=VARCHAR}) + + + + + + update wx_level_config + + `tenant_id` = #{item.tenantId}, + `points` = #{item.points}, + `level` = #{item.level}, + `description` = #{item.description}, + `update_date` = #{item.updateDate}, + `discount_enable` = #{item.discountEnable}, + `capability` = #{item.capability}, + + where id = ${item.id} + + + - delete from wx_level_config where `tenant_id` = #{tenantId}; + delete from wx_level_config where `tenant_id` = #{tenantId};