|
@@ -3,11 +3,14 @@ package com.iotechn.unimall.admin.api.huiyuan.impl;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.iotechn.unimall.admin.api.huiyuan.ISalesSlipService;
|
|
|
+import com.iotechn.unimall.data.domain.MemberManagement;
|
|
|
import com.iotechn.unimall.data.domain.SalesSlip;
|
|
|
+import com.iotechn.unimall.data.mapper.MemberManagementMapper;
|
|
|
import com.iotechn.unimall.data.mapper.SalesSlipMapper;
|
|
|
import org.apache.ibatis.session.RowBounds;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
@@ -30,6 +33,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
public class SalesSlipServiceImpl implements ISalesSlipService {
|
|
|
@Autowired
|
|
|
private SalesSlipMapper salesSlipMapper;
|
|
|
+ @Autowired
|
|
|
+ private MemberManagementMapper memberManagementMapper;
|
|
|
|
|
|
@Override
|
|
|
public Boolean add(SalesSlip salesSlip, Long adminId) throws ServiceException {
|
|
@@ -37,6 +42,16 @@ public class SalesSlipServiceImpl implements ISalesSlipService {
|
|
|
salesSlip.setGmtCreate(now);
|
|
|
salesSlip.setGmtUpdate(now);
|
|
|
salesSlip.setAdminId(adminId);
|
|
|
+
|
|
|
+ List<MemberManagement> memberManagement =memberManagementMapper.selectList(new EntityWrapper<MemberManagement>().eq("phone",salesSlip.getRemark2())
|
|
|
+ .eq("user_name",salesSlip.getRemark1()));
|
|
|
+
|
|
|
+ if(!CollectionUtils.isEmpty(memberManagement)){
|
|
|
+ memberManagement.get(0).setLeiXiao(memberManagement.get(0).getLeiXiao()+salesSlip.getMoney());
|
|
|
+ memberManagement.get(0).setMoney(memberManagement.get(0).getMoney()-salesSlip.getMoney());
|
|
|
+ memberManagementMapper.updateById(memberManagement.get(0));
|
|
|
+ }
|
|
|
+
|
|
|
return salesSlipMapper.insert(salesSlip) > 0;
|
|
|
}
|
|
|
|