姜永辉 1 год назад
Родитель
Сommit
ce7c8e80a2

+ 21 - 0
src/main/java/com/dk/oauth/controller/CompanyController.java

@@ -48,6 +48,16 @@ public class CompanyController {
     }
 
     /**
+     * @desc   : 可以绑定微信的员工人数  人数上限
+     * @author : admin
+     * @date   : 2023/2/3 13:32
+     */
+    @PostMapping({"get_company_max_staff_num/{id}"})
+    public ResponseResultVO<?> getCompanyMaxStaffNum(@PathVariable Integer id) {
+        return companyService.getCompanyMaxStaffNum(id);
+    }
+
+    /**
      * @desc : 更新 被邀请人员的微信用户的cpid 加入公司
      * @author : 姜永辉
      * @date : 2023/1/9 10:49
@@ -59,6 +69,17 @@ public class CompanyController {
     }
 
     /**
+     * @desc : 更新 更新公司的当前人数
+     * @author : 姜永辉
+     * @date : 2023/1/9 10:49
+     */
+    @ApiOperation(value = "更新公司的当前人数", notes = "更新公司的当前人数")
+    @PostMapping(value = "/feign_update_company_cur_staff_num")
+    public ResponseResultVO<Boolean> updateCompanyCurStaffNum(@RequestBody Map<String,Object> map) {
+        return companyService.updateCompanyCurStaffNum(map);
+    }
+
+    /**
      * @desc : 选择公司更新微信用户的所在当前的公司
      * @author : 姜永辉
      * @date : 2023/1/9 10:49

+ 14 - 0
src/main/java/com/dk/oauth/entity/CompanyResponse.java

@@ -1,5 +1,7 @@
 package com.dk.oauth.entity;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -23,4 +25,16 @@ public class CompanyResponse {
     private String svcPort;
 
     private String gradeCode;
+    /**
+     * 人数上限 (可以绑定微信的员工人数)
+     */
+    @ApiModelProperty(value = "人数上限 (可以绑定微信的员工人数)")
+    private Integer maxStaffNum;
+
+
+    /**
+     * 当前人数 (当前绑定微信的员工人数)
+     */
+    @ApiModelProperty(value = "当前人数 (当前绑定微信的员工人数)")
+    private Integer curStaffNum;
 }

+ 1 - 1
src/main/java/com/dk/oauth/feign/service/OrgFeign.java

@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
  * @desc : MdmServerFeign
  * @date : 2024-038-10 10:56
  */
-@FeignClient(name = Constant.MDM_PREFIX + Constant.SERVER + "-dkic-b1" , path = Constant.MST_ORG, contextId = "org")
+@FeignClient(name = Constant.MDM_PREFIX + Constant.SERVER + "-dkic-b1" + "-jyh", path = Constant.MST_ORG, contextId = "org")
 public interface OrgFeign {
     /**
      * @desc : 注册商户时候插入部门--顶级

+ 2 - 0
src/main/java/com/dk/oauth/mapper/CompanyMapper.java

@@ -27,6 +27,8 @@ public interface CompanyMapper extends BaseMapper<Company> {
 
     Long countByCond(Company t);
 
+    int updateCompanyCurStaffNum(@Param("cpId") Integer cpId,@Param("curStaffNum") Integer curStaffNum);
+
     /**
      * @desc : 通过ID查询
      * @author : 洪旭东

+ 4 - 0
src/main/java/com/dk/oauth/service/ICompanyService.java

@@ -27,4 +27,8 @@ public interface ICompanyService  extends IService<Company> {
     ResponseResultVO selectByOpenId(String openid);
 
     ResponseResultVO saveMenuFrequency(MenuFrequency menuFrequency);
+
+    ResponseResultVO getCompanyMaxStaffNum(Integer id);
+
+    ResponseResultVO updateCompanyCurStaffNum(Map<String,Object> map);
 }

+ 30 - 0
src/main/java/com/dk/oauth/service/impl/CompanyServiceImpl.java

@@ -11,6 +11,7 @@ import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.entity.Company;
+import com.dk.oauth.entity.CompanyResponse;
 import com.dk.oauth.entity.MenuFrequency;
 import com.dk.oauth.entity.UserLogin;
 import com.dk.oauth.feign.service.OrgFeign;
@@ -71,6 +72,21 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
         return ResponseResultUtil.success(companyMapper.selectById(id));
     }
 
+
+    /**
+     * @desc : 可以绑定微信的员工人数  人数上限
+     * @author : admin
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO getCompanyMaxStaffNum(Integer id) {
+        Company company = companyMapper.selectById(id);
+        Map<String,Object> mp = new HashMap<>();
+        mp.put("maxStaffNum",company.getMaxStaffNum());
+        mp.put("curStaffNum",company.getCurStaffNum());
+        return ResponseResultUtil.success(mp);
+    }
+
     /**
      * @desc : 通过ID查询
      * @author : admin
@@ -98,6 +114,20 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     }
 
     /**
+     * @desc : 更新微信用的公司
+     * @author : admin
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ResponseResultVO updateCompanyCurStaffNum(Map<String, Object> map) {
+        Integer curStaffNum = Integer.valueOf(map.get("curStaffNum") + "");
+        Integer cpId = Integer.valueOf(map.get("cpId") + "");
+         companyMapper.updateCompanyCurStaffNum(cpId, curStaffNum);
+        return ResponseResultUtil.success(true);
+    }
+
+    /**
      * @desc : 选择公司更新微信用户的所在当前的公司
      * @author : admin
      * @date : 2023/2/3 13:32

+ 7 - 0
src/main/resources/mapper/CompanyMapper.xml

@@ -18,6 +18,8 @@
         <result column="svc_ip" property="svcIp"/>
         <result column="svc_port" property="svcPort"/>
         <result column="grade_code" property="gradeCode"/>
+        <result column="max_staff_num" property="maxStaffNum"/>
+        <result column="cur_staff_num" property="curStaffNum"/>
     </resultMap>
 
     <resultMap type="com.dk.oauth.entity.MenuFrequency" id="ResultMenuMap">
@@ -189,6 +191,11 @@
         </foreach>
     </sql>
 
+    <!--更新公司的当前人数-->
+    <update id="updateCompanyCurStaffNum">
+        update dkic_a.t_a_company t set cur_staff_num = cur_staff_num + #{curStaffNum} where t.cp_id = #{cpId}
+    </update>
+
     <!-- 获取商户的地址服务 -->
     <select id="selectServiceAllot" resultType="String">
         SELECT dkic_a.f_allot_service(#{gradeCode})