| @@ -3,7 +3,7 @@ spring: | |||||
| include: rabbitMQ | include: rabbitMQ | ||||
| # JDBC | # JDBC | ||||
| datasource: | 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==) | username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) | ||||
| password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) | password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| @@ -3,7 +3,7 @@ spring: | |||||
| include: rabbitMQ | include: rabbitMQ | ||||
| # JDBC | # JDBC | ||||
| datasource: | 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==) | username: ENC(NUzgQOdJnCbVLKT6BaX0aw==) | ||||
| password: ENC(mvuoDRiu0jqYaKNRwwTuXZ6U7aoIaqsjdiPqTLgi/nY=) | password: ENC(mvuoDRiu0jqYaKNRwwTuXZ6U7aoIaqsjdiPqTLgi/nY=) | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| @@ -3,7 +3,7 @@ spring: | |||||
| include: rabbitMQ | include: rabbitMQ | ||||
| # JDBC | # JDBC | ||||
| datasource: | 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==) | username: ENC(Uc0AjgkytxHHCwZrmDASWg==) | ||||
| password: ENC(nV4Mi3bEbBx0Fj7uUyYH55eTaqsFMjKvmNzagicH4pc=) | password: ENC(nV4Mi3bEbBx0Fj7uUyYH55eTaqsFMjKvmNzagicH4pc=) | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| @@ -8,7 +8,10 @@ import com.iformall.domain.po.WxLevelConfig; | |||||
| public interface WxLevelConfigMapper extends CommonMapper<WxLevelConfig, Long> { | public interface WxLevelConfigMapper extends CommonMapper<WxLevelConfig, Long> { | ||||
| List<WxLevelConfig> findList(WxLevelConfig wxLevelConfig); | List<WxLevelConfig> findList(WxLevelConfig wxLevelConfig); | ||||
| int insertBatch(List<WxLevelConfig> list); | |||||
| int batchUpdate(List<WxLevelConfig> list); | |||||
| void deleteAll(@Param("tenantId")String tenantId); | void deleteAll(@Param("tenantId")String tenantId); | ||||
| @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -132,6 +133,7 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||||
| public void batchSave(String tenantId, List<WxLevelConfig> records) { | public void batchSave(String tenantId, List<WxLevelConfig> records) { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| wxLevelConfigMapper.deleteAll(tenantId); | wxLevelConfigMapper.deleteAll(tenantId); | ||||
| List<WxLevelConfig> levelConfigs = new ArrayList<>(); | |||||
| for(WxLevelConfig levelConfig: records) { | for(WxLevelConfig levelConfig: records) { | ||||
| if(levelConfig.getId() == null) { | if(levelConfig.getId() == null) { | ||||
| levelConfig.setId(idWorker.nextId()); | levelConfig.setId(idWorker.nextId()); | ||||
| @@ -141,22 +143,24 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||||
| levelConfig.setUpdateDate(new Date()); | levelConfig.setUpdateDate(new Date()); | ||||
| } | } | ||||
| levelConfig.setTenantId(tenantId); | levelConfig.setTenantId(tenantId); | ||||
| wxLevelConfigMapper.insertSelective(levelConfig); | |||||
| levelConfigs.add(levelConfig); | |||||
| } | } | ||||
| wxLevelConfigMapper.insertBatch(levelConfigs); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void batchUpdateCapabilities(String tenantId, List<WxLevelConfig> records) { | public void batchUpdateCapabilities(String tenantId, List<WxLevelConfig> records) { | ||||
| records.stream() | |||||
| .filter(l->l.getId() != null && l.getCount() != null) | |||||
| .forEach(l->{ | |||||
| l.setUpdateDate(new Date()); | |||||
| List<WxLevelConfig> levelConfigs = new ArrayList<WxLevelConfig>(); | |||||
| for(WxLevelConfig levelConfig: records) { | |||||
| if(levelConfig.getId() != null && levelConfig.getCount() != null) { | |||||
| levelConfig.setUpdateDate(new Date()); | |||||
| JSONObject jo = new JSONObject(); | 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 | @Override | ||||
| @@ -69,8 +69,40 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <insert id="insertBatch" parameterType="java.util.List"> | |||||
| insert into wx_level_config (id, tenant_id, points, level, description, create_date, update_date, | |||||
| discount_enable, capability) values | |||||
| <foreach collection="list" item="item" index="index" separator=","> | |||||
| (#{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}) | |||||
| </foreach> | |||||
| </insert> | |||||
| <update id="batchUpdate" parameterType="java.util.List"> | |||||
| <foreach collection="list" item="item" index="index" open="" close="" separator=";"> | |||||
| update wx_level_config | |||||
| <set> | |||||
| <if test=" null != item.tenantId ">`tenant_id` = #{item.tenantId},</if> | |||||
| <if test=" null != item.points ">`points` = #{item.points},</if> | |||||
| <if test=" null != item.level ">`level` = #{item.level},</if> | |||||
| <if test=" null != item.description ">`description` = #{item.description},</if> | |||||
| <if test=" null != item.updateDate ">`update_date` = #{item.updateDate},</if> | |||||
| <if test=" null != item.discountEnable ">`discount_enable` = #{item.discountEnable},</if> | |||||
| <if test=" null != item.capability ">`capability` = #{item.capability},</if> | |||||
| </set> | |||||
| where id = ${item.id} | |||||
| </foreach> | |||||
| </update> | |||||
| <delete id="deleteAll" parameterType="com.iformall.domain.po.WxLevelConfig"> | <delete id="deleteAll" parameterType="com.iformall.domain.po.WxLevelConfig"> | ||||
| delete from wx_level_config where `tenant_id` = #{tenantId}; | |||||
| delete from wx_level_config where `tenant_id` = #{tenantId}; | |||||
| </delete> | </delete> | ||||
| <select id="getLevel" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="String"> | <select id="getLevel" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="String"> | ||||