he2802 2 vuotta sitten
vanhempi
commit
29314b4e8d

+ 1 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/distribution/DistributionSellerController.java

@@ -125,7 +125,7 @@ public class DistributionSellerController extends BaseController {
     public AjaxResult<DistributionSellerVo> getInfo()
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        DistributionSellerVo vo = iDistributionSellerService.queryById(loginUser.getUser().getSellerId());
+        DistributionSellerVo vo = iDistributionSellerService.findDetail(loginUser.getUser().getSellerId());
         vo.setSelfNull();
         return AjaxResult.success(vo);
     }

+ 11 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/DistributionSellerServiceImpl.java

@@ -167,6 +167,9 @@ public class DistributionSellerServiceImpl extends ServiceImpl<DistributionSelle
         if(Validator.isEmpty(seller)){
             throw new CustomException("该手机号未注册");
         }
+        if(Validator.isEmpty(seller.getSellerId())){
+            throw new CustomException("非业务员无法操作");
+        }
         return iSysUserService.update(null,
                 new LambdaUpdateWrapper<SysUser>()
                         .set(SysUser::getPassword,SecurityUtils.encryptPassword(bo.getPwd()))
@@ -226,6 +229,9 @@ public class DistributionSellerServiceImpl extends ServiceImpl<DistributionSelle
         {
             throw new BaseException("登录信息错误");
         }
+        if(Validator.isEmpty(sysUser.getSellerId())){
+            throw new CustomException("非业务员无法登录");
+        }
         DistributionSeller seller = getOne(new LambdaQueryWrapper<DistributionSeller>()
                 .eq(DistributionSeller::getSellerId, sysUser.getSellerId()));
         LoginUser loginSeller = new LoginUser();
@@ -302,6 +308,11 @@ public class DistributionSellerServiceImpl extends ServiceImpl<DistributionSelle
         return baseMapper.findList(bo);
     }
 
+    @Override
+    public DistributionSellerVo findDetail(Long sellerId) {
+        return baseMapper.findDetail(sellerId);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/mapper/DistributionSellerMapper.java

@@ -19,4 +19,6 @@ public interface DistributionSellerMapper extends BaseMapper<DistributionSeller>
     List<DistributionSellerVo> getSellerListByTenant(DistributionSellerQuery query);
 
     List<DistributionSellerVo> findList(DistributionSellerQueryBo bo);
+
+    DistributionSellerVo findDetail(Long sellerId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionSellerService.java

@@ -37,6 +37,8 @@ public interface IDistributionSellerService extends IService<DistributionSeller>
 
 	List<DistributionSellerVo> findList(DistributionSellerQueryBo bo);
 
+	DistributionSellerVo findDetail(Long sellerId);
+
 	/**
 	 * 根据新增业务对象插入分销业务员
 	 * @param bo 分销业务员新增业务对象

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionCashWithdrawalServiceImpl.java

@@ -132,7 +132,7 @@ public class DistributionCashWithdrawalServiceImpl extends ServiceImpl<Distribut
         cashLogAddBo.setSellerId(add.getSellerId());
         cashLogAddBo.setOldNum(oldCash);
         cashLogAddBo.setNewNum(newCash);
-        cashLogAddBo.setDiffNum(bo.getCash());
+        cashLogAddBo.setDiffNum(bo.getCash().negate());
         cashLogAddBo.setRelatedSn(cw_no);
         cashLogAddBo.setType(2L);
         iDistributionCashLogService.insertByAddBo(cashLogAddBo);

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/vo/DistributionSellerVo.java

@@ -93,4 +93,6 @@ public class DistributionSellerVo {
 	private String phonenumber;
 	@ApiModelProperty("身份证")
 	private String idCard;
+	@ApiModelProperty("头像")
+	private String avatar;
 }

+ 16 - 0
zhongzheng-system/src/main/resources/mapper/modules/distribution/DistributionSellerMapper.xml

@@ -29,6 +29,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="shareCode" column="share_code"/>
         <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
         <result property="phonenumber" column="phonenumber"/>
+        <result property="avatar" column="avatar"/>
+        <result property="cash" column="cash"/>
+        <result property="usedCash" column="used_cash"/>
+        <result property="freezeCash" column="freeze_cash"/>
     </resultMap>
 
 
@@ -62,4 +66,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             s.seller_id DESC
     </select>
 
+    <select id="findDetail" parameterType="Long" resultMap="DistributionSellerVoResult">
+        SELECT
+            s.*,
+            u.id_card,
+            u.phonenumber,
+            u.avatar
+        FROM
+            distribution_seller s
+                LEFT JOIN sys_user u ON s.seller_id = u.seller_id
+        WHERE s.seller_id = #{sellerId}
+    </select>
+
 </mapper>