dev-discount
袁野 2 years ago
parent 2650933acb
commit 24832dbdf1
  1. 3
      hai-bweb/src/main/java/com/bweb/controller/BsMsgController.java
  2. 9
      hai-bweb/src/main/java/com/bweb/controller/BsProductConfigController.java
  3. 103
      hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/CommonController.java
  5. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  6. 7
      hai-service/src/main/java/com/hai/config/ThirdProductConfig.java
  7. 2
      hai-service/src/main/java/com/hai/entity/BsProductDiscount.java
  8. 4
      hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java
  9. 22
      hai-service/src/main/java/com/hai/service/BsMsgService.java
  10. 21
      hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java
  11. 48
      hai-service/src/main/java/com/hai/service/impl/BsMsgServiceImpl.java

@ -91,9 +91,6 @@ public class BsMsgController {
bsMsg.setOpId(userInfoModel.getSecUser().getId());
bsMsg.setOpName(userInfoModel.getSecUser().getUserName());
bsMsg.setMsgType(2);
bsMsg.setStatus(1);
bsMsg.setCreateTime(new Date());
bsMsg.setUpdateTime(new Date());
bsMsgService.insertMsg(bsMsg , null);
return ResponseMsgUtil.success("新增成功");

@ -83,7 +83,15 @@ public class BsProductConfigController {
BsProductConfigModel bsProductConfigModel = new BsProductConfigModel();
listMap = new HashMap<>();
listMap.put("returnType", 2);
//1:星巴克 2:肯德基 3:充值产品 4 卡券 5 在线加油
if (list.getProductType() == 1 || list.getProductType() == 2 || list.getProductType() == 3) {
listMap.put("productType", "5");
} else if( list.getProductType() == 4) {
listMap.put("productType", "1");
} else if( list.getProductType() == 5) {
listMap.put("productType", "2");
}
listMap.put("sourceId", list.getId());
BeanUtils.copyProperties(list, bsProductConfigModel);
bsProductConfigModel.setIntegralDiscount(bsConfigService.getProductDiscountByMap(listMap).getDiscount());
@ -110,7 +118,6 @@ public class BsProductConfigController {
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (object == null ||
object.getBigDecimal("discount") == null ||
object.getInteger("productType") == null ||
object.getJSONArray("productPlatform") == null ||
object.getJSONArray("payType") == null

@ -0,0 +1,103 @@
package com.cweb.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.BsMsg;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.BsMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author sum1dream
*/
@Controller
@RequestMapping(value = "/bsMsg")
@Api(value = "站内信")
public class BsMsgController {
Logger log = LoggerFactory.getLogger(BsMsgController.class);
@Resource
private BsMsgService bsMsgService;
@Autowired
private UserCenter userCenter;
@RequestMapping(value = "/getMsgByList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询站内信列表")
public ResponseData getMsgByList(
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "jumpType", required = false) Integer jumpType,
@RequestParam(value = "msgType", required = false) Integer msgType,
@RequestParam(value = "title", required = false) String title,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request
) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>(5);
map.put("type", type);
map.put("jumpType", jumpType);
map.put("msgType", msgType);
map.put("title", title);
map.put("companyId" , userInfoModel.getBsCompany().getId());
PageHelper.startPage(pageNum,pageSize);
List<BsMsg> list = bsMsgService.getMsgByList(map);
return ResponseMsgUtil.success(new PageInfo<>(list));
} catch (Exception e) {
log.error("BsMsgController --> getMsgByList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/checkMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查看站内信")
public ResponseData checkMsg(@RequestParam(value = "msgId", required = false) Long msgId, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.error("HighOrderController -> addOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -398,7 +398,7 @@ public class CommonController {
return ResponseMsgUtil.success(integralNum);
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
log.error("CommonController -> getRebateIntegral() error!", e);
return ResponseMsgUtil.exception(e);
}
}

File diff suppressed because one or more lines are too long

@ -63,7 +63,14 @@ public class ThirdProductConfig {
JSONObject object = new JSONObject();
Map<String, Object> listMap = new HashMap<>();
//1:星巴克 2:肯德基 3:充值产品 4 卡券 5 在线加油
if (productType == 1 || productType == 2 || productType == 3) {
listMap.put("productType", "5");
} else if( productType == 4) {
listMap.put("productType", "1");
} else if( productType == 5) {
listMap.put("productType", "2");
}
listMap.put("returnType", 1);
listMap.put("sourceId", productConfig.getId());
listMap.put("platformId", platformId);

@ -20,7 +20,7 @@ public class BsProductDiscount implements Serializable {
private Long id;
/**
* 1:卡券 2:团油 3话费 4:优惠券包
* 1:卡券 2:团油 3话费 4:优惠券包 5第三方产品
*/
private Integer productType;

@ -12,7 +12,9 @@ import java.util.Objects;
public enum ApiProductTypeEnum {
type1(1, "星巴克"),
type2(2, "肯德基"),
type3(3, "第三方产品")
type3(3, "第三方产品"),
type4(4, "卡券"),
type5(5, "在线加油")
;
private Integer type;

@ -1,6 +1,7 @@
package com.hai.service;
import com.hai.entity.BsMsg;
import com.hai.entity.BsMsgUser;
import com.hai.entity.HighUser;
import java.util.List;
@ -55,4 +56,25 @@ public interface BsMsgService {
*/
List<BsMsg> getMsgByList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name checkMsg
* @Description // 查看信息
* @Date 13:52 2022/10/13
* @Param [userId, msgId]
* @Return void
*/
void checkMsg(HighUser user, Long msgId);
/**
* @Author Sum1Dream
* @Name findMsgUserById
* @Description // 查询用户是否为查看内容
* @Date 13:55 2022/10/13
* @Param [userId, msgId]
* @Return com.hai.entity.BsMsgUser
*/
List<BsMsgUser> findMsgUserById(Long userId , Long msgId);
}

@ -209,7 +209,6 @@ public class ApiProductServiceImpl implements ApiProductService {
// 产品配置
BsProductConfig productConfig;
productConfig = new BsProductConfig();
productConfig.setProductId(object.getLong("productType"));
productConfig.setCompanyId(object.getLong("companyId"));
productConfig.setCreateTime(new Date());
productConfig.setDiscount(object.getBigDecimal("discount"));
@ -217,20 +216,34 @@ public class ApiProductServiceImpl implements ApiProductService {
productConfig.setOperatorId(object.getLong("operatorId"));
productConfig.setOperatorName(object.getString("operatorName"));
productConfig.setUpdateTime(new Date());
productConfig.setProductName(ApiProductTypeEnum.getNameByType(object.getInteger("productType")));
productConfig.setProductType(object.getInteger("productType"));
// 生成实体
JSONObject postObject = new JSONObject();
//1:星巴克 2:肯德基 3:充值产品 4 卡券 5 在线加油
if (object.getInteger("productType") == 1 || object.getInteger("productType") == 2 || object.getInteger("productType") == 3) {
postObject.put("productType", 5);
productConfig.setProductId(object.getLong("productType"));
} else if( object.getInteger("productType") == 4) {
postObject.put("productType", 1);
productConfig.setProductId(object.getLong("productId"));
} else if( object.getInteger("productType") == 5) {
postObject.put("productType", 2);
productConfig.setProductId(object.getLong("productType"));
}
productConfigMapper.insert(productConfig);
JSONObject postObject = new JSONObject();
// 配置折扣比例 支付方式 相关参数
postObject.put("payType", object.getJSONArray("payType"));
postObject.put("integralDiscount", object.getBigDecimal("integralDiscount"));
postObject.put("productPlatform", object.getJSONArray("productPlatform"));
postObject.put("operatorId", object.getLong("operatorId"));
postObject.put("operatorName", object.getString("operatorName"));
postObject.put("sourceId", productConfig.getId());
postObject.put("productType", 5);
// 配置支付方式
commonService.configPayType(postObject);

@ -2,10 +2,7 @@ package com.hai.service.impl;
import com.hai.dao.BsMsgMapper;
import com.hai.dao.BsMsgUserMapper;
import com.hai.entity.BsMsg;
import com.hai.entity.BsMsgExample;
import com.hai.entity.BsMsgUser;
import com.hai.entity.HighUser;
import com.hai.entity.*;
import com.hai.service.BsMsgService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
@ -34,6 +31,10 @@ public class BsMsgServiceImpl implements BsMsgService {
@Transactional
public void insertMsg(BsMsg bsMsg , HighUser user) {
bsMsg.setStatus(1);
bsMsg.setCreateTime(new Date());
bsMsg.setUpdateTime(new Date());
bsMsgMapper.insert(bsMsg);
if (bsMsg.getMsgType()==1){
BsMsgUser bsMsgUser = new BsMsgUser();
@ -87,4 +88,43 @@ public class BsMsgServiceImpl implements BsMsgService {
return bsMsgMapper.selectByExample(example);
}
@Override
public void checkMsg(HighUser user, Long msgId) {
// 查询用户相关站内信内容
List<BsMsgUser> list = findMsgUserById(user.getId() , msgId);
BsMsgUser bsMsgUser = new BsMsgUser();
// 判读是否有呢日
if (list.size()>0) {
bsMsgUser = list.get(0);
// 判断当前内容是否已经查看过了
if (!bsMsgUser.getWhereCheck()) {
bsMsgUser.setWhereCheck(true);
bsMsgUser.setCheckTime(new Date());
}
bsMsgUser.setUpdateTime(new Date());
bsMsgUserMapper.updateByPrimaryKey(bsMsgUser);
} else {
bsMsgUser.setUserId(user.getId());
bsMsgUser.setMsgId(msgId);
bsMsgUser.setUserName(user.getName());
bsMsgUser.setUserPhone(user.getPhone());
bsMsgUser.setWhereCheck(true);
bsMsgUser.setCheckTime(new Date());
bsMsgUser.setCreateTime(new Date());
bsMsgUser.setUpdateTime(new Date());
bsMsgUserMapper.insert(bsMsgUser);
}
}
@Override
public List<BsMsgUser> findMsgUserById(Long userId, Long msgId) {
BsMsgUserExample example = new BsMsgUserExample();
BsMsgUserExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId).andMsgIdEqualTo(msgId);
return bsMsgUserMapper.selectByExample(example);
}
}

Loading…
Cancel
Save