Просмотр исходного кода

分配卡,保存代理的机构id

mingfu 1 месяц назад
Родитель
Сommit
9425f66c63

+ 3 - 3
ie-admin/src/main/java/com/ruoyi/web/controller/dz/DzCardsController.java

@@ -197,14 +197,14 @@ public class DzCardsController extends BaseController
             if (!sysUser.getUserTypeId().equals(agent.getParentId())) {
                 throw new ValidationException("只能分配给下级代理");
             }
-            dzCardsService.assignCard(sysUser.getUserTypeId(), agentId, ct, begin, end, location, examType, schoolId, days);
+            dzCardsService.assignCard(agent.getDeptId(), sysUser.getUserTypeId(), agentId, ct, begin, end, location, examType, schoolId, days);
         } else if(UserTypeEnum.Institution.getVal().equals(sysUser.getUserType())) { // 机构分配卡给自己的下级
             if (!sysUser.getDeptId().equals(agent.getDeptId())) {
                 throw new ValidationException("只能分配给下级代理");
             }
-            dzCardsService.assignCard(NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, ct, begin, end, location, examType, schoolId, days);
+            dzCardsService.assignCard(agent.getDeptId(), NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, ct, begin, end, location, examType, schoolId, days);
         } else { // 平台指定, TODO 暂只支持二级代理
-            dzCardsService.assignCard(NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, ct, begin, end, location, examType, schoolId, days);
+            dzCardsService.assignCard(agent.getDeptId(), NumberUtils.isPositive(agent.getParentId()) ? agent.getParentId() : agentId, agentId, ct, begin, end, location, examType, schoolId, days);
         }
         return AjaxResult.success();
     }

+ 1 - 1
ie-system/src/main/java/com/ruoyi/dz/service/IDzCardsService.java

@@ -85,7 +85,7 @@ public interface IDzCardsService
      * @param beginNo
      * @param endNo
      */
-    public void assignCard(Long agentId, Long leafAgentId, CardType cardType, String beginNo, String endNo, String location, ExamType examType, Long schoolId, Integer days);
+    public void assignCard(Long deptId, Long agentId, Long leafAgentId, CardType cardType, String beginNo, String endNo, String location, ExamType examType, Long schoolId, Integer days);
 
     /**
      * 开卡

+ 2 - 1
ie-system/src/main/java/com/ruoyi/dz/service/impl/DzCardsServiceImpl.java

@@ -238,7 +238,7 @@ public class DzCardsServiceImpl implements IDzCardsService
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void assignCard(Long agentId, Long leafAgentId, CardType cardType, String beginNo, String endNo, String location, ExamType examType, Long schoolId, Integer days) {
+    public void assignCard(Long deptId, Long agentId, Long leafAgentId, CardType cardType, String beginNo, String endNo, String location, ExamType examType, Long schoolId, Integer days) {
         CardCriteria cond = new CardCriteria();
         cond.setType(cardType.getVal());
         cond.setStartNo(beginNo);
@@ -256,6 +256,7 @@ public class DzCardsServiceImpl implements IDzCardsService
         newOpen.setCardType(cardType.getVal());
         newOpen.setStartNo(beginNo);
         newOpen.setEndNo(endNo);
+        newOpen.setDeptId(deptId);
         newOpen.setEndDate(DateUtils.addDays(DateUtils.getNowDate(), null == days ? 14 : days)); // TODO MF 卡默认有效期
         newOpen.setSchoolId(schoolId);
         newOpen.setLocation(location);