wangtao-1 hai 1 ano
pai
achega
6e1c651522

+ 3 - 0
tour-api/src/main/java/com/tour/api/service/impl/ApiAgentCenterServiceImpl.java

@@ -136,6 +136,9 @@ public class ApiAgentCenterServiceImpl implements ApiAgentCenterService {
         if (agent.getAmount().compareTo(agentWithdrawal.getAmount()) < 0) {
             throw new CustomException("提现金额超过可提现金额");
         }
+        agent.setAmount(agent.getAmount().subtract(agentWithdrawal.getAmount()));
+        agent.setWithdrawalAmount(agent.getWithdrawalAmount().add(agentWithdrawal.getAmount()));
+        agentService.updateAgent(agent);
         Boolean result = iAgentWithdrawalService.save(agentWithdrawal);
         return result;
     }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 6
tour-api/src/main/resources/application-dev.yml


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 18 - 62
tour-api/src/main/resources/application-prod.yml


+ 2 - 2
tour-api/src/main/resources/application.yml

@@ -19,7 +19,7 @@ project:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 8082
+  port: 8085
   servlet:
     # 应用的访问路径
     context-path: /
@@ -58,7 +58,7 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-    active: dev
+    active: prod
   # 文件上传
   servlet:
     multipart:

+ 1 - 0
tour-core/src/main/java/com/tour/system/controller/common/CommonController.java

@@ -80,6 +80,7 @@ public class CommonController {
         }
         catch (Exception e)
         {
+            e.printStackTrace();
             return Result.error(e.getMessage());
         }
 

+ 2 - 2
tour-core/src/main/resources/mapper/system/SysUserMapper.xml

@@ -203,9 +203,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			#{userId}
         </foreach>
  	</delete>
-	<select id="queryByAgentId" parameterType="String" resultMap="SysUserResult">
+	<select id="queryByAgentId" parameterType="Long" resultMap="SysUserResult">
 		<include refid="selectUserVo"/>
-		where u.agent_id = #{agentId} and status=0 and del_flag=0
+		where u.agent_id = #{agentId} and u.status=0 and u.del_flag=0
 	</select>
 
 </mapper>

+ 1 - 0
tour-module/src/main/java/com/tour/module/domain/Card.java

@@ -82,6 +82,7 @@ private static final long serialVersionUID=1L;
     /** 删除标识位: 0正常 1删除 */
     @TableLogic
     private Integer deleted;
+    private Long makeId;
 
     @TableField(exist = false)
     private Map<String, Object> params = new HashMap<>();

+ 6 - 0
tour-module/src/main/java/com/tour/module/mapper/CardMapper.java

@@ -2,6 +2,10 @@ package com.tour.module.mapper;
 
 import com.tour.module.domain.Card;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * 卡Mapper接口
@@ -11,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface CardMapper extends BaseMapper<Card> {
 
+
+    List<Card> selectByNum(@RequestParam("agentId") Long agentId,@RequestParam("num") Long num);
 }

+ 4 - 0
tour-module/src/main/java/com/tour/module/service/ICardService.java

@@ -2,6 +2,8 @@ package com.tour.module.service;
 
 import com.tour.module.domain.Card;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.bind.annotation.RequestParam;
+
 import java.util.List;
 
 /**
@@ -18,4 +20,6 @@ public interface ICardService extends IService<Card> {
      * @return 列表
      */
     List<Card> queryList(Card card);
+
+    List<Card> selectByNum( Long agentId, Long num);
 }

+ 1 - 1
tour-module/src/main/java/com/tour/module/service/IMakeCardAllocationService.java

@@ -19,5 +19,5 @@ public interface IMakeCardAllocationService extends IService<MakeCardAllocation>
      */
     List<MakeCardAllocation> queryList(MakeCardAllocation MakeCardAllocation);
 
-    void saveMakeCardAllocation(MakeCardAllocation MakeCardAllocation);
+    boolean saveMakeCardAllocation(List<MakeCardAllocation> list);
 }

+ 1 - 1
tour-module/src/main/java/com/tour/module/service/IMakeCardService.java

@@ -22,5 +22,5 @@ public interface IMakeCardService extends IService<MakeCard> {
     List<MakeCard> queryList(MakeCard markCard);
     List<MakeCard> getList(MakeCard markCard);
     MakeCardVo getInfo(Long id);
-    void makeCard(MakeCard markCard);
+    boolean makeCard(MakeCard markCard);
 }

+ 1 - 0
tour-module/src/main/java/com/tour/module/service/impl/AgentWithdrawalServiceImpl.java

@@ -99,6 +99,7 @@ public class AgentWithdrawalServiceImpl extends ServiceImpl<AgentWithdrawalMappe
             // 拒绝提现
             // 还原代理商账户余额
             agent.setAmount(agent.getAmount().add(agentWithdrawals.getAmount()));
+            agent.setWithdrawalAmount(agent.getWithdrawalAmount().subtract(agentWithdrawal.getAmount()));
             iAgentService.updateById(agent);
             this.updateById(agentWithdrawals);
         }

+ 4 - 0
tour-module/src/main/java/com/tour/module/service/impl/CardServiceImpl.java

@@ -47,4 +47,8 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements IC
         }
         return this.list(lqw);
     }
+
+    public  List<Card> selectByNum( Long agentId, Long num){
+        return baseMapper.selectByNum(agentId, num);
+    }
 }

+ 22 - 5
tour-module/src/main/java/com/tour/module/service/impl/MakeCardAllocationServiceImpl.java

@@ -1,18 +1,20 @@
 package com.tour.module.service.impl;
 
 import com.tour.module.domain.Agent;
+import com.tour.module.domain.Card;
 import com.tour.module.service.IAgentService;
+import com.tour.module.service.ICardService;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.tour.module.mapper.MakeCardAllocationMapper;
 import com.tour.module.domain.MakeCardAllocation;
 import com.tour.module.service.IMakeCardAllocationService;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.Objects;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * 制卡分配情况Service业务层处理
@@ -25,7 +27,8 @@ public class MakeCardAllocationServiceImpl extends ServiceImpl<MakeCardAllocatio
 
     @Resource
     private IAgentService iAgentService;
-
+    @Resource
+    ICardService iCardService;
     @Override
     public List<MakeCardAllocation> queryList(MakeCardAllocation makeCardAllocation) {
         List<MakeCardAllocation> list = baseMapper.queryList(makeCardAllocation);
@@ -39,7 +42,21 @@ public class MakeCardAllocationServiceImpl extends ServiceImpl<MakeCardAllocatio
     }
 
     @Override
-    public void saveMakeCardAllocation(MakeCardAllocation MakeCardAllocation) {
-
+    public boolean saveMakeCardAllocation(List<MakeCardAllocation> list) {
+        AtomicBoolean result= new AtomicBoolean(false);
+        if(!CollectionUtils.isEmpty(list)){
+            this.saveBatch(list);
+            list.forEach(i-> {
+              List<Card>  cards=  iCardService.selectByNum(1L,i.getNum());
+                if(!CollectionUtils.isEmpty(cards)){
+                    cards.forEach(item ->{
+                        item.setAgentId(i.getAgentId());
+                    });
+                    result.set(iCardService.updateBatchById(cards));
+                }
+            });
+            return result.get();
+        }
+        return false;
     }
 }

+ 5 - 4
tour-module/src/main/java/com/tour/module/service/impl/MakeCardServiceImpl.java

@@ -69,7 +69,7 @@ public class MakeCardServiceImpl extends ServiceImpl<MakeCardMapper, MakeCard> i
     }
 
     @Override
-    public void makeCard(MakeCard markCard) {
+    public boolean makeCard(MakeCard markCard) {
         int result = baseMapper.insert(markCard);
         Long cardNo =null;
         List<Card> list = new ArrayList<>();
@@ -82,12 +82,13 @@ public class MakeCardServiceImpl extends ServiceImpl<MakeCardMapper, MakeCard> i
                 card.setAgentId(1L);
                 card.setType(markCard.getCardType());
                 card.setStatus("0");
+                card.setMakeId(markCard.getId());
                 list.add(card);
             }
             redisCache.setCacheObject("card_num",cardNo);
-            iCardService.saveBatch(list);
+          return   iCardService.saveBatch(list);
         }
-
+        return  false;
     }
 
   private Long getNo(){
@@ -95,7 +96,7 @@ public class MakeCardServiceImpl extends ServiceImpl<MakeCardMapper, MakeCard> i
      if(cardNo==null){
             cardNo=100000000101L;
      }
-     return cardNo;
+     return cardNo+1;
   }
 
 }

+ 5 - 1
tour-module/src/main/resources/mapper/module/CardMapper.xml

@@ -17,6 +17,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="createBy"    column="create_by"    />
     </resultMap>
-
+    <select id="selectByNum" resultType="com.tour.module.domain.Card">
+        SELECT * FROM tour_card WHERE agent_id = #{agentId} and deleted = 0
+        order by id
+         limit #{num}
+    </select>
 
 </mapper>

+ 1 - 1
tour-oms/src/main/java/com/tour/web/controller/MakeCardAllocationController.java

@@ -76,7 +76,7 @@ public class MakeCardAllocationController extends BaseController {
     @Log(title = "制卡分配情况" , businessType = BusinessType.INSERT)
     @PostMapping
     public Result add(@RequestBody List<MakeCardAllocation> list) {
-        return toAjax(iMakeCardAllocationService.saveBatch(list) ? 1 : 0);
+        return toAjax(iMakeCardAllocationService.saveMakeCardAllocation(list) ? 1 : 0);
     }
 
     /**

+ 1 - 1
tour-oms/src/main/java/com/tour/web/controller/MakeCardController.java

@@ -57,7 +57,7 @@ public class MakeCardController extends BaseController {
     @Log(title = "制卡" , businessType = BusinessType.INSERT)
     @PostMapping
     public Result add(@RequestBody MakeCard markCard) {
-        return toAjax(iMarkCardService.save(markCard) ? 1 : 0);
+        return toAjax(iMarkCardService.makeCard(markCard) ? 1 : 0);
     }
 
     /**