Authored by wangshusheng

修改

... ... @@ -16,7 +16,7 @@ public interface CutDownPriceUserRecordMapper {
CutDownPriceUserRecord selectCutDownPriceUserRecord(@Param("userId") Integer userId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn);
CutDownPriceUserRecord selectCutDownPriceUserRecordById(@Param("userId") Integer userId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId);
CutDownPriceUserRecord selectCutDownPriceUserRecordById(@Param("cutRecordId") Integer cutRecordId);
List<CutDownPriceUserRecord> selectCutDownPriceUserRecordList(@Param("userId") Integer userId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn);
... ...
... ... @@ -11,6 +11,10 @@ public class CutDownPriceProductHelpUser {
private Integer productSkn;
private Integer cutRecordId;
private BigDecimal cutPrice;
private String userName;
private String userImgUrl;
private String helpUserName;
private String helpUserImgUrl;
public Integer getId() {
return id;
... ... @@ -75,4 +79,36 @@ public class CutDownPriceProductHelpUser {
public void setCutRecordId(Integer cutRecordId) {
this.cutRecordId = cutRecordId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserImgUrl() {
return userImgUrl;
}
public void setUserImgUrl(String userImgUrl) {
this.userImgUrl = userImgUrl;
}
public String getHelpUserName() {
return helpUserName;
}
public void setHelpUserName(String helpUserName) {
this.helpUserName = helpUserName;
}
public String getHelpUserImgUrl() {
return helpUserImgUrl;
}
public void setHelpUserImgUrl(String helpUserImgUrl) {
this.helpUserImgUrl = helpUserImgUrl;
}
}
... ...
... ... @@ -10,9 +10,13 @@
<result column="cut_record_id" property="cutRecordId" jdbcType="INTEGER" />
<result column="cut_price" property="cutPrice" jdbcType="DECIMAL" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="userName" property="userName" jdbcType="VARCHAR" />
<result column="userImgUrl" property="userImgUrl" jdbcType="VARCHAR" />
<result column="helpUserName" property="helpUserName" jdbcType="VARCHAR" />
<result column="helpUserImgUrl" property="helpUserImgUrl" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time
id, user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time, userName, userImgUrl, helpUserName, helpUserImgUrl
</sql>
<select id="selectHelpInfo" resultMap="BaseResultMap">
... ... @@ -26,9 +30,9 @@
</select>
<insert id="addHelpUserInfo" parameterType="com.yoho.activity.dal.model.CutDownPriceProductHelpUser">
insert into cutdown_price_help_user (user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time)
insert into cutdown_price_help_user (user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time, userName, userImgUrl, helpUserName, helpUserImgUrl)
values (#{userId,jdbcType=INTEGER}, #{helpUserId,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{productSkn,jdbcType=INTEGER},
#{cutRecordId,jdbcType=INTEGER}, #{cutPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}
#{cutRecordId,jdbcType=INTEGER}, #{cutPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userImgUrl,jdbcType=VARCHAR}, #{helpUserName,jdbcType=VARCHAR}, #{helpUserImgUrl,jdbcType=VARCHAR}
)
</insert>
... ...
... ... @@ -55,10 +55,7 @@
select
<include refid="Base_Column_List" />
from cutdown_price_user_record
where activity_id = #{activityId,jdbcType=INTEGER}
and user_id = #{userId,jdbcType=INTEGER}
and product_skn = #{productSkn,jdbcType=INTEGER}
and id = #{cutRecordId,jdbcType=INTEGER}
where id = #{cutRecordId,jdbcType=INTEGER}
</select>
<select id="selectCutDownPriceUserRecordList" resultMap="BaseResultMap">
... ...
... ... @@ -106,7 +106,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
}
CutDownPriceUserRecord record = null;
if(cutRecordId!=null){
record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecordById(userId, activityId, productSkn, cutRecordId);
record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecordById(cutRecordId);
}else{
record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecord(userId, activityId, productSkn);
}
... ... @@ -166,7 +166,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
}
CutDownPriceUserRecord record = null;
if(cutRecordId!=null){
record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecordById(userId, activityId, productSkn, cutRecordId);
record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecordById(cutRecordId);
}else{
record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecord(userId, activityId, productSkn);
}
... ... @@ -346,6 +346,10 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
Integer userId = cutPriceHelpUserRequestBO.getUserId();
Integer helpUserId = cutPriceHelpUserRequestBO.getHelpUserId();
String userName = cutPriceHelpUserRequestBO.getUserName();
String userImgUrl = cutPriceHelpUserRequestBO.getUserImgUrl();
String helpUserName = cutPriceHelpUserRequestBO.getHelpUserName();
String helpUserImgUrl = cutPriceHelpUserRequestBO.getHelpUserImgUrl();
// 每位用户每天最多可以帮好友砍3次价
if(!SYSTEM_HELP_ID.equals(helpUserId)){
... ... @@ -399,21 +403,14 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
helpUser.setCutPrice(cutPrice);
helpUser.setCreateTime(DateUtils.getCurrentTimeSecond());
helpUser.setCutRecordId(recordDb.getId());
helpUser.setHelpUserImgUrl(helpUserImgUrl);
helpUser.setHelpUserName(helpUserName);
helpUser.setUserName(userName);
helpUser.setUserImgUrl(userImgUrl);
// 插入好友帮砍记录表
cutPriceUserHelpMapper.addHelpUserInfo(helpUser);
// 修改用户发起砍价记录表中的帮砍次数
cutDownPriceUserRecordMapper.updateCutDownHelpCount(userId, activityId, productSkn, recordDb.getId());
String userImageUrl = null;
String helpUserImageUrl = null;
try{
// 调uid查询用户头像
String userIdStr = userId.toString()+","+helpUserId.toString();
UserInfoRspBO[] userInfoBoArray = invokeUicGetUserInfo(userIdStr);
userImageUrl = buildUserImage(userId, userInfoBoArray);
helpUserImageUrl = buildUserImage(helpUserId, userInfoBoArray);
}catch(Exception e){
}
CutDownPriceProductHelpUserBo systemCreateBo = null;
// 用户帮忙砍价后,自动发起砍价活动,系统帮助砍价除外
... ... @@ -439,9 +436,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
// 构建返回对象,app弹窗展示
CutDownPriceProductHelpUserBo bo = new CutDownPriceProductHelpUserBo();
bo.setUserImgUrl(userImageUrl);
bo.setUserImgUrl(userImgUrl);
bo.setCutPrice(cutPrice);
bo.setHelpUserImgUrl(helpUserImageUrl);
bo.setHelpUserImgUrl(helpUserImgUrl);
if(systemCreateBo!=null){
bo.setSystemCutPrice(systemCreateBo.getCutPrice());
}
... ... @@ -462,24 +459,17 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
helpUser.setCutPrice(cutPrice);
helpUser.setCreateTime(DateUtils.getCurrentTimeSecond());
helpUser.setCutRecordId(record.getId());
helpUser.setHelpUserImgUrl(SYSTEM_HELP_IMAGE);
helpUser.setHelpUserName(SYSTEM_HELP_NAME);
// 插入好友帮砍记录表
cutPriceUserHelpMapper.addHelpUserInfo(helpUser);
// 修改用户发起砍价记录表中的帮砍次数
cutDownPriceUserRecordMapper.updateCutDownHelpCount(userId, activityId, productSkn, record.getId());
String userImageUrl = null;
try{
// 调uid查询用户头像
UserInfoRspBO[] userInfoBoArray = invokeUicGetUserInfo(userId.toString());
userImageUrl = buildUserImage(userId, userInfoBoArray);
}catch(Exception e){
}
// 清理缓存,用户帮砍记录列表、商品详情页
clearCache(activityId, productSkn, userId, record.getId());
CutDownPriceProductHelpUserBo bo = new CutDownPriceProductHelpUserBo();
bo.setUserImgUrl(userImageUrl);
bo.setCutPrice(cutPrice);
return bo;
}
... ... @@ -513,18 +503,15 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
int num = cutDownPriceUserRecordMapper.addCutDownUserRecord(record);
// 系统帮助砍第一次价
BigDecimal cutPrice = new BigDecimal(0);
String userImageUrl = null;
try{
logger.info(" system start addHelpUserInfo, userId is {}, activityId is {}, productSkn is {}", userId, activityId, productSkn);
CutDownPriceProductHelpUserBo help = addSystemHelpUserInfo(convertCutDownPriceProductSystemHelpUser(cutPriceHelpUserRequestBO), activityBo, cutDownPriceProductBo, record);
cutPrice = help.getCutPrice();
userImageUrl = help.getUserImgUrl();
}catch(Exception e){
logger.warn(" system addHelpUserInfo failed, userId is {}, activityId is {}, productSkn is {}, exception is {}", userId, activityId, productSkn, e);
}
CutDownPriceProductHelpUserBo bo = new CutDownPriceProductHelpUserBo();
bo.setUserImgUrl(userImageUrl);
bo.setCutPrice(cutPrice);
return bo;
}
... ... @@ -610,20 +597,20 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
uids = sb.toString().substring(0, sb.toString().length()-1);
}
UserInfoRspBO[] userInfoBoArray = invokeUicGetUserInfo(uids);
// UserInfoRspBO[] userInfoBoArray = invokeUicGetUserInfo(uids);
for (CutDownPriceProductHelpUserBo helpUserBo : helpUserBos){
if(helpUserBo.getHelpUserId().equals(SYSTEM_HELP_ID)) {
helpUserBo.setHelpUserImgUrl(SYSTEM_HELP_IMAGE);
helpUserBo.setHelpUserName(SYSTEM_HELP_NAME);
continue;
}
for (UserInfoRspBO userInfoRspBO : userInfoBoArray){
if (helpUserBo.getHelpUserId().equals(userInfoRspBO.getUid())){
helpUserBo.setHelpUserImgUrl(userInfoRspBO.getHeadIco());
helpUserBo.setHelpUserName(userInfoRspBO.getNickName());
break;
}
}
// for (UserInfoRspBO userInfoRspBO : userInfoBoArray){
// if (helpUserBo.getHelpUserId().equals(userInfoRspBO.getUid())){
// helpUserBo.setHelpUserImgUrl(userInfoRspBO.getHeadIco());
// helpUserBo.setHelpUserName(userInfoRspBO.getNickName());
// break;
// }
// }
}
}
... ...