Browse Source

律师端代码

ldz 1 tháng trước cách đây
mục cha
commit
bc083ccb82

+ 4 - 4
alien-entity/src/main/java/shop/alien/mapper/LawyerUserMapper.java

@@ -112,25 +112,25 @@ Integer updateLawyerUser(LawyerUser user);
            "AS firstLevelScenarioId, " +
            "(SELECT GROUP_CONCAT(`name` SEPARATOR ',') FROM lawyer_legal_problem_scenario WHERE level = 1) " +
            "AS firstLevelScenario, " +
-           "b.expertise_area_info AS areaInfo " +
+//           "b.expertise_area_info AS areaInfo " +
            "FROM " +
            "lawyer_user user " +
            "LEFT JOIN law_firm firm ON firm.id = user.firm_id " +
            "LEFT JOIN lawyer_service_area area ON area.lawyer_user_id = user.id " +
            "LEFT JOIN lawyer_legal_problem_scenario a ON a.id = area.problem_scenario_id " +
-           "LEFT JOIN lawyer_expertise_area b ON b.id = user.specialty_fields " +
+//           "LEFT JOIN lawyer_expertise_area b ON b.id = user.specialty_fields " +
            "<where>" +
            "<if test='lawyerId != null'>user.id = #{lawyerId} AND </if>" +
            "firm.delete_flag = 0 AND " +
            "user.delete_flag = 0 AND " +
            "area.delete_flag = 0 AND " +
            "a.delete_flag = 0 AND " +
-           "b.delete_flag = 0" +
+//           "b.delete_flag = 0" +
            "</where>" +
            "GROUP BY " +
            "user.id, user.phone, user.`name`, user.firm_id, user.head_img, " +
            "user.personal_introduction, user.order_receiving_status, user.practice_start_date, " +
-           "firm.firm_name, firm.payment_account, b.expertise_area_info " +
+           "firm.firm_name, firm.payment_account " +
            "LIMIT 1 " +
            "</script>")
    LawyerUserVo selectInfo(@Param("lawyerId") Integer lawyerId);

+ 2 - 2
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerUserController.java

@@ -211,7 +211,7 @@ public class LawyerUserController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "律师ID", dataType = "Integer", paramType = "query", required = true)
     })
-    @PostMapping("/logOutLawyerUser")
+    @GetMapping("/logOutLawyerUser")
     public R<Map<String, Object>> logOutLawyerUser(@RequestParam(value = "id") Integer id) {
         log.info("LawyerUserController.logOutLawyerUser?id={}", id);
         return lawyerUserService.logOutLawyerUser(id);
@@ -267,7 +267,7 @@ public class LawyerUserController {
             @ApiImplicitParam(name = "certificationTime", value = "认证时间(从业时间??待确认)", dataType = "Data", paramType = "query"),
     })
     @PostMapping("/updateLawyerUser")
-    public R<LawyerUser> updateLawyerUser(@RequestBody LawyerUserVo lawyerUserVo) {
+    public R<LawyerUserVo> updateLawyerUser(@RequestBody LawyerUserVo lawyerUserVo) {
         log.info("LawyerUserController.updateLawyerUser?lawyerUserVo={}", lawyerUserVo);
         return lawyerUserService.updateLawyerUser(lawyerUserVo);
     }

+ 1 - 1
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawyerUserService.java

@@ -138,7 +138,7 @@ public interface LawyerUserService extends IService<LawyerUser> {
      * @param lawyerUserVo 律师用户信息VO
      * @return R<LawyerUser> 更新后的律师信息
      */
-    R<LawyerUser> updateLawyerUser(LawyerUserVo lawyerUserVo);
+    R<LawyerUserVo> updateLawyerUser(LawyerUserVo lawyerUserVo);
 
     /**
      * 通过手机号查询律师信息

+ 25 - 5
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserServiceImpl.java

@@ -22,6 +22,7 @@ import shop.alien.lawyer.service.LawyerUserSearchHistoryService;
 import shop.alien.lawyer.service.LawyerUserService;
 import shop.alien.mapper.LawFirmMapper;
 import shop.alien.mapper.LawyerConsultationOrderMapper;
+import shop.alien.mapper.LawyerServiceAreaMapper;
 import shop.alien.mapper.LawyerUserMapper;
 import shop.alien.util.common.ListToPage;
 
@@ -42,6 +43,7 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
 
     private final LawyerUserMapper lawyerUserMapper;
     private final LawyerServiceAreaService lawyerServiceAreaService;
+    private final LawyerServiceAreaMapper lawyerServiceAreaMapper;
     private final LawyerUserSearchHistoryService userSearchHistoryService;
     private final LawyerLegalProblemScenarioService lawyerLegalProblemScenarioService;
     private final LawyerConsultationOrderMapper lawyerConsultationOrderMapper;
@@ -527,7 +529,7 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
 
 
     @Override
-    public R<LawyerUser> updateLawyerUser(LawyerUserVo lawyerUserVo) {
+    public R<LawyerUserVo> updateLawyerUser(LawyerUserVo lawyerUserVo) {
         log.info("LawyerUserServiceImpl.updateLawyerUser?lawyerUserVo={}", lawyerUserVo);
 
         // 参数校验
@@ -545,12 +547,30 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
             return R.fail("修改律师信息失败");
         }
 
-//        lawFirmMapper.updateById(lawyerUser)
+        //更新法律场景部分
+        if(!lawyerUserVo.getFirstLevelScenarioId().isEmpty()){
+            lawyerServiceAreaMapper.delete(new QueryWrapper<LawyerServiceArea>().eq("lawyer_user_id", lawyerUserVo.getId()));
+            for (String id : lawyerUserVo.getFirstLevelScenarioId().split(",")) {
+                LawyerServiceArea lawyerServiceArea = new LawyerServiceArea();
+                lawyerServiceArea.setLawyerUserId(lawyerUserVo.getId());
+                lawyerServiceArea.setProblemScenarioId(Integer.valueOf(id));
+                lawyerServiceArea.setProblemScenarioId(Integer.valueOf(lawyerUserVo.getFirstLevelScenarioId()));
+                lawyerServiceArea.setCreatedTime(new Date());
+                lawyerServiceArea.setUpdatedTime(new Date());
+                lawyerServiceArea.setDeleteFlag(0);
+                lawyerServiceArea.setStatus(1);
+                int insertLawyerServiceAre =lawyerServiceAreaMapper.insert(lawyerServiceArea);
+                if (insertLawyerServiceAre <= 0) {
+                    log.warn("更新律师用户信息失败:更新数据库失败,律师ID={}", lawyerUserVo.getId());
+                    return R.fail("修改律师信息失败");
+                }
+            }
+        }
+
 
         // 查询更新后的律师信息
-        LawyerUser updatedLawyer = this.getById(lawyerUserVo.getId());
-        log.info("更新律师用户信息成功,律师ID={}", lawyerUserVo.getId());
-        return R.data(updatedLawyer);
+        LawyerUserVo res=lawyerUserMapper.selectInfo(lawyerUserVo.getId());
+        return R.data(res);
     }
 
     @Override