From 26574047ac19087a7f8dc310ddc44dc24fc9b851 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 17 Mar 2021 20:26:38 +0800
Subject: [PATCH] Merge branch 'score_shop' of http://120.27.238.55:7000/r/beauty-erp into score_shop

---
 zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java                               |   10 +--
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java     |   36 +++++++----
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java |    2 
 zq-erp/src/main/java/com/matrix/biz/service/impl/BizUserServiceImpl.java            |   11 +--
 zq-erp/src/main/java/com/matrix/biz/dao/BizUserDao.java                             |   16 +---
 zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java   |   64 ---------------------
 zq-erp/src/main/java/com/matrix/biz/service/BizUserService.java                     |   20 ++----
 zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml           |    4 
 8 files changed, 46 insertions(+), 117 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java b/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java
index 8c94ca2..0fa5868 100644
--- a/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java
+++ b/zq-erp/src/main/java/com/matrix/biz/bean/BizUser.java
@@ -27,7 +27,7 @@
     /**
      * 主键
      */
-    private String  userId;
+    private Long  userId;
 
 
     /**
@@ -236,15 +236,13 @@
         this.companyId = companyId;
     }
 
-    public void setToken(String token) {
-        this.token=userId;
-    }
 
-    public String getUserId() {
+
+    public Long getUserId() {
         return userId;
     }
 
-    public void setUserId(String userId) {
+    public void setUserId(Long userId) {
         this.userId=userId;
     }
 
diff --git a/zq-erp/src/main/java/com/matrix/biz/dao/BizUserDao.java b/zq-erp/src/main/java/com/matrix/biz/dao/BizUserDao.java
index b87fbc8..40eeda0 100644
--- a/zq-erp/src/main/java/com/matrix/biz/dao/BizUserDao.java
+++ b/zq-erp/src/main/java/com/matrix/biz/dao/BizUserDao.java
@@ -22,9 +22,9 @@
 	
 	public int updateByModel(@Param("record") BizUser bizUser);
 	
-	public int deleteByIds(@Param("list") List<String> list);
+	public int deleteByIds(@Param("list") List<Long> list);
 	
-	public int deleteById(String userId);
+	public int deleteById(Long userId);
 
 	public int deleteByModel(@Param("record") BizUser bizUser);
 	
@@ -34,18 +34,12 @@
 	
 	public int selectTotalRecord(@Param("record") BizUser bizUser);
 	
-	public BizUser  selectById(String userId);
+	public BizUser  selectById(Long userId);
 	
-	public BizUser  selectForUpdate(String userId);
+	public BizUser  selectForUpdate(Long userId);
 
 	public BizUser findByOpenId(@Param("openId") String openId);
 
-	/**
-	 * 批量设置销售员
-	 * @param list
-	 * @param status
-	 * @return
-	 */
-	int  updateSalesByIds(@Param("list") List<String> list, @Param("status") Integer status);
+
 
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/biz/service/BizUserService.java b/zq-erp/src/main/java/com/matrix/biz/service/BizUserService.java
index 5f10819..7aa2b0f 100644
--- a/zq-erp/src/main/java/com/matrix/biz/service/BizUserService.java
+++ b/zq-erp/src/main/java/com/matrix/biz/service/BizUserService.java
@@ -2,7 +2,6 @@
 
 import com.matrix.biz.bean.BizUser;
 import com.matrix.core.pojo.PaginationVO;
-import com.matrix.core.web.BaseServices;
 
 import java.util.List;
 
@@ -11,7 +10,7 @@
  * @author jyy
  * @date 2019-05-31 10:03
  */
-public interface BizUserService extends BaseServices<BizUser> {
+public interface BizUserService  {
 	
 	/**
 	 * 新增
@@ -33,15 +32,12 @@
 	 */
 	public int modifyByModel(BizUser bizUser);
 	
-	/**
-	 * 批量删除
-	 */
-	public int remove(List<String> list);
+
 
 	/**
 	 * 根据id删除
 	 */
-	public int removeById(String userId);
+	public int removeById(Long userId);
 	
 	/**
 	 * 根据对象删除
@@ -62,11 +58,8 @@
 	 * 统计记录数
 	 */
 	public int  findTotal(BizUser bizUser);
-	
-	/**
-	 * 根据id查询
-	 */
-	public BizUser  findById(String userId);
+
+	public int remove(List<Long> list);
 
    	
 	/**
@@ -74,7 +67,8 @@
 	 */
 
 	public BizUser findByOpenId(String openId);
-	
+
+	public BizUser  findById(Long userId);
 	/**
 	 * 保存用户信息
 	 */
diff --git a/zq-erp/src/main/java/com/matrix/biz/service/impl/BizUserServiceImpl.java b/zq-erp/src/main/java/com/matrix/biz/service/impl/BizUserServiceImpl.java
index b9333da..f2d62d6 100644
--- a/zq-erp/src/main/java/com/matrix/biz/service/impl/BizUserServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/biz/service/impl/BizUserServiceImpl.java
@@ -36,7 +36,6 @@
 		bizUser.setUserIsAuthorize(AppConstance.IS_NOT_AUTHORIZE);
 		bizUser.setCreateBy(AppConstance.USER_TYPE_ADMIN);
 		bizUser.setUpdateBy(AppConstance.USER_TYPE_ADMIN);
-		bizUser.setUserId(UUIDUtil.getRandomID());
 		return bizUserDao.insert(bizUser);
 		
 	}
@@ -90,14 +89,14 @@
 	
 	
 	@Override
-	public int remove(List<String> list){
-	
+	public int remove(List<Long> list){
+
 		return bizUserDao.deleteByIds(list);
-	
+
 	}
 
 	@Override
-	public int removeById(String userId){
+	public int removeById(Long userId){
 	
 		return bizUserDao.deleteById(userId);
 	
@@ -133,7 +132,7 @@
 	}
 	
 	@Override
-	public BizUser  findById(String userId){
+	public BizUser  findById(Long userId){
 	
 		return bizUserDao.selectById(userId);
 	
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java
index 186022e..0c49bd4 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopBizUserScoreAction.java
@@ -42,73 +42,9 @@
     public static final String BEV = "ShopBizUserScore_BEV";
 
 
-    /**
-     * 进入积分兑换界面
-     */
-    @SaveRequestToken
-    @RequestMapping(value = "/intoExchangePage")
-    public ModelAndView exchangeScore(String userId) {
-        BizUser bizUser = new BizUser();
-        ModelAndView modelAndView = new ModelAndView("admin/shop/user-score-exchange");
-        if (StringUtils.isNotBlank(userId)) {
-            bizUser = bizUserService.findById(userId);
-            if (bizUser.getCurrentScore() == null) {
-                bizUser.setCurrentScore(0);
-            }
-        }
-        modelAndView.addObject("obj", bizUser);
-        return modelAndView;
-    }
 
 
-    /**
-     * 兑换积分
-     */
-    @Transactional(rollbackFor = Exception.class)
-    @RemoveRequestToken
-    @RequestMapping(value = "/exchangeScore")
-    public @ResponseBody
-    AjaxResult exchangeScore(ExchangeScorePOJO pojo) {
-        //校验参数中用户ID和用户兑换积分是否有效
-        if (pojo == null || StringUtils.isBlank(pojo.getUserId())
-                || pojo.getScore() == null || pojo.getScore() == 0) {
-            return new AjaxResult(AjaxResult.STATUS_FAIL, "提交参数有误!");
-        }
-        //兑换积分用户信息
-        BizUser bizUser = bizUserService.findById(pojo.getUserId());
-        if (bizUser == null) {
-            return new AjaxResult(AjaxResult.STATUS_FAIL, "没有查询到相应用户!");
-        }
-        if (bizUser.getCurrentScore() == null) {
-            bizUser.setCurrentScore(0);
-        }
-        //如果兑换积分大于用户当前积分
-        if (pojo.getScore() > bizUser.getCurrentScore()) {
-            return new AjaxResult(AjaxResult.STATUS_FAIL, "兑换积分大于用户当前积分!");
-        }
-        //剩余积分 = 当前积分 - 兑换积分
-        Integer remainScore = bizUser.getCurrentScore() - pojo.getScore();
-        //当前操作用户信息
-        SysUsers loginUser = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
-        //修改用户剩余积分
-        BizUser updateModel = new BizUser();
-        updateModel.setUserId(bizUser.getUserId());
-        updateModel.setCurrentScore(remainScore);
-        updateModel.setUpdateBy(loginUser.getSuName());
-        updateModel.setUpdateTime(new Date());
-        bizUserService.modifyByModel(updateModel);
-        //添加积分兑换记录
-        ShopScoreExchange insertExchange = new ShopScoreExchange();
-        insertExchange.setCreateBy(loginUser.getSuName());
-        insertExchange.setUpdateBy(loginUser.getSuName());
-        insertExchange.setUserId(bizUser.getOpenId());
-        insertExchange.setExchangeScore(pojo.getScore());
-        insertExchange.setOperateId(loginUser.getSuId());
-        insertExchange.setRemark(pojo.getRemarks());
-        shopScoreExchangeDao.insert(insertExchange);
 
-        return new AjaxResult(AjaxResult.STATUS_SUCCESS, "兑换成功!");
-    }
 
 
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
index a24b205..cf48b9f 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxSalesmanAction.java
@@ -40,6 +40,7 @@
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.File;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -141,40 +142,47 @@
     }
 
 
-    @ApiOperation(value = "绑定下级客户,当客户点击分销员分销的产品时调用", notes = "传入参数invitationId 必须 分销员openId 例: {invitationId:openId}")
+    @ApiOperation(value = "绑定下级客户,当客户点击分销员分销的产品时调用", notes = "传入参数invitationId 必须 分销员userId例: {invitationId:userId}")
     @ApiResponses({
             @ApiResponse(code = 200, message = "ok", response = Map.class)
     })
     @PostMapping(value = "/bindingParentSalesman")
     public AjaxResult bindingParentSalesman(@RequestBody Map<String,String> param) {
         String invitationId = param.get("invitationId");
+
+
         if (StringUtils.isBlank(invitationId)) {
             return AjaxResult.buildFailInstance("请求参数错误");
         }
-
+        BizUser invitationUser = bizUserDao.selectById(Long.parseLong(invitationId));
+        if (invitationUser==null) {
+            return AjaxResult.buildFailInstance("请求参数错误");
+        }
 
         BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class);
-        if(invitationId.equals(loginUser.getOpenId())){
-            return AjaxResult.buildFailInstance("不能绑定自己");
+        if(invitationId.equals(loginUser.getUserId())){
+            return AjaxResult.buildSuccessInstance("不能绑定自己");
         }
-        if(loginUser.getIsSales()==null || loginUser.getIsSales()==2){
-            return AjaxResult.buildFailInstance("只有分销员才能绑定客户");
-        }
-        loginUser = bizUserDao.selectById(loginUser.getUserId());
-        if (loginUser.getIsSales() == null || loginUser.getIsSales() == BizUser.NOT_SALES) {
-            if (StringUtils.isBlank(loginUser.getParentOpenId())) {
 
+        loginUser = bizUserDao.selectById(loginUser.getUserId());
+        if(loginUser.getIsSales()==1){
+            return AjaxResult.buildSuccessInstance("只有非分销员才能被绑定成客户");
+        }else{
+            if (StringUtils.isBlank(loginUser.getParentOpenId())) {
                 Map<String, Object> updateParam = new HashMap<>();
                 updateParam.put("userId", loginUser.getUserId());
-                updateParam.put("parentOpenId", invitationId);
+                updateParam.put("parentOpenId", invitationUser.getOpenId());
+                updateParam.put("bindingParentTime",new Date());
                 bizUserDao.updateByMap(updateParam);
                 return AjaxResult.buildSuccessInstance("绑定成功");
             } else {
                 return AjaxResult.buildSuccessInstance("已经存在上级");
             }
-        } else {
-            return AjaxResult.buildSuccessInstance("分销员不能被绑定");
         }
+
+
+
+
     }
 
 
@@ -281,7 +289,7 @@
         BusParameterSettings applyCondition = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_CONDITION, loginUser.getCompanyId());
         switch (applyCondition.getParamValue()){
             case FenxiaoSettingConstant.FX_APPLY_CONDITION_WTJ:
-                applyConditionInfo.setCondition("无条件");
+                applyConditionInfo.setCondition("您已满足申请条件");
                 break;
             case FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP:
                 applyConditionInfo.setCondition("消费指定产品确认收货");
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java
index d9b4764..3aad1e8 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShareProductAction.java
@@ -314,7 +314,7 @@
         g = b2Img.createGraphics();
         g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1));
         g.drawImage(qrcordImgBuf, 320, 550, 140, 140, null);
-        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
         //标题
         g.setColor(new Color(0xF10D0A0A, true));
         Font font = new Font("微软雅黑", Font.PLAIN, 24);
diff --git a/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml b/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
index a98565f..9e7fba3 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanApplyDao.xml
@@ -184,8 +184,8 @@
 
 	) AS djsRevenue,
 
-	( SELECT count( * ) FROM shop_salesman_order c WHERE c.user_id = a.open_id AND c.sales_user_id = #{openId} and revenue_type =1 ) AS salesorderCount,
-	( SELECT count( * ) FROM shop_salesman_order c WHERE c.user_id = a.open_id AND c.sales_user_id = #{openId} and revenue_type =2 ) AS invitationOrderCount,
+	( SELECT count( * ) FROM shop_salesman_order c WHERE  c.sales_user_id = #{openId} and revenue_type =1 ) AS salesorderCount,
+	( SELECT count( * ) FROM shop_salesman_order c WHERE  c.sales_user_id = #{openId} and revenue_type =2 ) AS invitationOrderCount,
 	(select count(*) from biz_user where parent_open_id=#{openId} and is_sales=1) as invitationCount,
 	(select count(*) from biz_user where parent_open_id=#{openId} and is_sales=2) as customerCount
 	from biz_user a where

--
Gitblit v1.9.1