Commit cd2c72bb by jinxin

通讯录成员转移接口开发

parent 44728780
...@@ -124,6 +124,18 @@ public class StaffDTO implements Serializable { ...@@ -124,6 +124,18 @@ public class StaffDTO implements Serializable {
* 是否授权 0否1是 * 是否授权 0否1是
*/ */
private Integer authorizedFlag; private Integer authorizedFlag;
/**
* 企微激活码
*/
private String activeCode;
public String getActiveCode() {
return activeCode;
}
public void setActiveCode(String activeCode) {
this.activeCode = activeCode;
}
public Integer getAuthorizedFlag() { public Integer getAuthorizedFlag() {
// 如果员工有qr_code,则代表已经授权 // 如果员工有qr_code,则代表已经授权
......
...@@ -329,5 +329,5 @@ public interface StaffApiService { ...@@ -329,5 +329,5 @@ public interface StaffApiService {
/** /**
* 转移员工许可 * 转移员工许可
*/ */
ServiceResponse<Integer> batchTransferLicense(List<TransferActiveCodeQDTO> transferActiveCodeQOList,String wxEnterpriseId); com.gic.api.base.commons.ServiceResponse<Integer> batchTransferLicense(List<TransferActiveCodeQDTO> transferActiveCodeQOList,String wxEnterpriseId);
} }
...@@ -168,7 +168,7 @@ public interface StaffMapper { ...@@ -168,7 +168,7 @@ public interface StaffMapper {
*/ */
Integer getOccupyNum(); Integer getOccupyNum();
StaffDTO getStaffInfoByWxOpenUserId(@Param("wxOpenUseId") String wxOpenUseId); TabHaobanStaff getStaffInfoByWxOpenUserId(@Param("wxOpenUseId") String wxOpenUseId);
/** /**
* 通过wxOpenUserId更新企业成员许可信息 * 通过wxOpenUserId更新企业成员许可信息
*/ */
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
...@@ -935,15 +936,25 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -935,15 +936,25 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
@Override @Override
public ServiceResponse<Integer> batchTransferLicense(List<TransferActiveCodeQDTO> transferActiveCodeQOList,String wxEnterpriseId) { public com.gic.api.base.commons.ServiceResponse<Integer> batchTransferLicense(List<TransferActiveCodeQDTO> transferActiveCodeQOList,String wxEnterpriseId) {
WxEnterpriseDTO wxEnterpriseDTO = this.wxEnterpriseService.selectById(wxEnterpriseId); WxEnterpriseDTO wxEnterpriseDTO = this.wxEnterpriseService.selectById(wxEnterpriseId);
String openCorpid = wxEnterpriseDTO.getOpenCorpid(); String openCorpid = wxEnterpriseDTO.getOpenCorpid();
String serviceCorpid = config.getCorpid(); String serviceCorpid = config.getCorpid();
List<AccountTransferUserDTO> accountTransferUserDTOList = JSONArray.parseArray(JSONObject.toJSONString(transferActiveCodeQOList), AccountTransferUserDTO.class);
List<AccountTransferUserDTO> accountTransferUserDTOList = JSONArray.parseArray(transferActiveCodeQOList.toString(), AccountTransferUserDTO.class); com.gic.api.base.commons.ServiceResponse<List<AccountTransferUserDTO>> listServiceResponse = qywxOrderApiService.batchTransferLicense(serviceCorpid, openCorpid, accountTransferUserDTOList);
if (Constant.SUCCESS.equals(listServiceResponse.getCode())){
qywxOrderApiService.batchTransferLicense(serviceCorpid, openCorpid, accountTransferUserDTOList); //企微转移成功,好办staff表对应更新
transferActiveCodeQOList.stream().forEach(a->{
return null; //先查询转移成员的许可信息
TabHaobanStaff staffDTO = staffMapper.getStaffInfoByWxOpenUserId(a.getHandover_userid());
//置空转移成员的许可信息
staffMapper.updateStaffInfoByWxOpenUserId(a.getHandover_userid(),null,null,null);
//更新接收成员的许可信息
staffMapper.updateStaffInfoByWxOpenUserId(a.getTakeover_userid(),staffDTO.getActiveTime(),staffDTO.getExpireTime(), staffDTO.getActiveCode());
});
return com.gic.api.base.commons.ServiceResponse.success();
}
return com.gic.api.base.commons.ServiceResponse.failure(listServiceResponse.getCode(),listServiceResponse.getMessage());
} }
} }
...@@ -604,11 +604,11 @@ ...@@ -604,11 +604,11 @@
</update> </update>
<select id="getOccupyNum" resultType="java.lang.Integer"> <select id="getOccupyNum" resultType="java.lang.Integer">
SELECT count(*) FROM tab_haoban_staff WHERE status_flag=0 and expire_time is not null SELECT count(*) FROM tab_haoban_staff WHERE a.status_flag = 0 and a.update_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and a.active_status = 1
</select> </select>
<select id="getStaffInfoByWxOpenUserId" resultType="com.gic.haoban.manage.api.dto.StaffDTO"> <select id="getStaffInfoByWxOpenUserId" resultMap="BaseResultMap">
SELECT * FROM tab_haoban_staff WHERE wx_open_user_id = #{wxOpenUseId} SELECT <include refid="Base_Column_List" /> FROM tab_haoban_staff WHERE wx_open_user_id = #{wxOpenUseId}
</select> </select>
<update id="updateStaffInfoByWxOpenUserId"> <update id="updateStaffInfoByWxOpenUserId">
......
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.qdto.TransferActiveCodeQDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.hm.HmPageApiService; import com.gic.haoban.manage.api.service.hm.HmPageApiService;
import com.gic.haoban.manage.service.service.WxEnterpriseActiveDataService; import com.gic.haoban.manage.service.service.WxEnterpriseActiveDataService;
import org.junit.Test; import org.junit.Test;
...@@ -6,6 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -6,6 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
/** /**
* @description: * @description:
* @Author: wenhua * @Author: wenhua
...@@ -17,9 +23,21 @@ public class WxEnterpriseActiveDataServiceTest { ...@@ -17,9 +23,21 @@ public class WxEnterpriseActiveDataServiceTest {
@Autowired @Autowired
private WxEnterpriseActiveDataService wxEnterpriseActiveDataService; private WxEnterpriseActiveDataService wxEnterpriseActiveDataService;
@Autowired
private StaffApiService staffApiService;
@Test @Test
public void test(){ public void test(){
Integer integer = wxEnterpriseActiveDataService.saveOrUpdate("ca66a01b79474c40b3e7c7f93daf1a3b"); Integer integer = wxEnterpriseActiveDataService.saveOrUpdate("ca66a01b79474c40b3e7c7f93daf1a3b");
System.out.println(integer); System.out.println(integer);
} }
@Test
public void test1(){
List<TransferActiveCodeQDTO> transferActiveCodeQOList = new ArrayList<>();
TransferActiveCodeQDTO transferActiveCodeQDTO = new TransferActiveCodeQDTO();
transferActiveCodeQDTO.setHandover_userid("wo59NLDQAAD_2Dpx951BGjVRLSAdhjcA");
transferActiveCodeQDTO.setTakeover_userid("wo59NLDQAA-mkaCEYRl6Lj0ifFurH1PQ");
transferActiveCodeQOList.add(transferActiveCodeQDTO);
ServiceResponse<Integer> integerServiceResponse = staffApiService.batchTransferLicense(transferActiveCodeQOList,"ca66a01b79474c40b3e7c7f93daf1a3b");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment