admin
2019-09-28 1a2892aa45de9de5d8f145062938102144eaa6fe
解决华为并发问题
3个文件已修改
15 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/DeviceTokenHWMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceTokenHWMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenHWServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/DeviceTokenHWMapper.java
@@ -30,6 +30,8 @@
    Long selectCount(@Param("versionList") List<Integer> versionList);
    List<DeviceTokenHW> selectByDevice(String device);
    List<DeviceTokenHW> selectByDeviceForUpdate(String device);
    int bindUidByDevice(@Param("uid") Long uid, @Param("device") String device);
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceTokenHWMapper.xml
@@ -71,6 +71,15 @@
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_hw where dh_device = #{0}
    </select>
    <select id="selectByDeviceForUpdate" resultMap="BaseResultMap"
        parameterType="java.lang.String" useCache="false" flushCache="true">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_hw where dh_device = #{0} for update
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_uid_devicetoken_hw where dh_id = #{id,jdbcType=BIGINT}
    </delete>
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenHWServiceImpl.java
@@ -6,6 +6,7 @@
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.push.DeviceTokenHWMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -30,6 +31,7 @@
        return count == null ? 0 : count;
    }
    @Transactional
    @Override
    public void addDeviceToken(String token, String device, Long uid, int version) {
        if (StringUtil.isNullOrEmpty(device))
@@ -38,7 +40,7 @@
        if (uid != null && uid == 0)
            uid = null;
        List<DeviceTokenHW> list = deviceTokenHWMapper.selectByDevice(device);
        List<DeviceTokenHW> list = deviceTokenHWMapper.selectByDeviceForUpdate(device);
        if (list == null || list.size() == 0) {
            DeviceTokenHW deviceTokenHW = new DeviceTokenHW();
            deviceTokenHW.setDevice(device);