17 changed files with 1550 additions and 138 deletions
@ -0,0 +1,184 @@ |
|||
//package com.zdxt.app.task;
|
|||
//
|
|||
//import cn.hutool.core.map.MapUtil;
|
|||
//import com.alibaba.fastjson.JSONArray;
|
|||
//import com.alibaba.fastjson.JSONObject;
|
|||
//import com.zdxt.auth.feign.UserApi;
|
|||
//import com.zdxt.auth.project.system.dept.service.IDeptService;
|
|||
//import com.zdxt.auth.project.system.dict.service.IDictDataService;
|
|||
//import com.zdxt.auth.project.system.user.service.IUserService;
|
|||
//import com.zdxt.domain.auth.DictData;
|
|||
//import org.apache.http.HttpEntity;
|
|||
//import org.apache.http.client.methods.CloseableHttpResponse;
|
|||
//import org.apache.http.client.methods.HttpPost;
|
|||
//import org.apache.http.entity.StringEntity;
|
|||
//import org.apache.http.impl.client.CloseableHttpClient;
|
|||
//import org.apache.http.impl.client.HttpClientBuilder;
|
|||
//import org.apache.http.util.EntityUtils;
|
|||
//import org.slf4j.Logger;
|
|||
//import org.slf4j.LoggerFactory;
|
|||
//import org.springframework.beans.factory.annotation.Autowired;
|
|||
//import org.springframework.beans.factory.annotation.Value;
|
|||
//import org.springframework.stereotype.Component;
|
|||
//
|
|||
//import java.nio.charset.StandardCharsets;
|
|||
//import java.security.MessageDigest;
|
|||
//import java.util.*;
|
|||
//import java.util.stream.Collectors;
|
|||
//
|
|||
//
|
|||
///**
|
|||
// * @Author: kylin
|
|||
// * @Date: 2024/5/9 2:58 下午
|
|||
// * @Version: 1.0
|
|||
// * @Desc: TODO
|
|||
// */
|
|||
//@Component("synUserInfoTask")
|
|||
//public class SynUserInfoTask_bak {
|
|||
//
|
|||
// @Value("${srnwg.systemCode}")
|
|||
// private String systemCode;
|
|||
// @Value("${srnwg.integrationKey}")
|
|||
// private String integrationKey;
|
|||
// @Value("${srnwg.url}")
|
|||
// private String znwgUrl;
|
|||
// @Value("${srnwg.paasId}")
|
|||
// private String paasId;
|
|||
// @Value("${srnwg.paasToken}")
|
|||
// private String paasToken;
|
|||
//
|
|||
// @Autowired private UserApi userApi;
|
|||
// @Autowired private IUserService userService;
|
|||
// @Autowired private IDeptService deptService;
|
|||
// @Autowired
|
|||
// private IDictDataService iDictDataService;
|
|||
//
|
|||
// public static Map<String,String> params = new HashMap<>();
|
|||
//
|
|||
// private static final Logger log = LoggerFactory.getLogger(SynUserInfoTask_bak.class);
|
|||
//
|
|||
//
|
|||
// public void run(){
|
|||
// this.userInfo();
|
|||
// }
|
|||
//
|
|||
// /** 同步用户数据 */
|
|||
// public void userInfo(){
|
|||
// List<DictData> srz_item = iDictDataService.selectDictDataByType("srz_item");
|
|||
// Map<String,String> map = srz_item.stream().collect(Collectors.toMap(DictData::getDictLabel,DictData::getDictValue));
|
|||
//
|
|||
// if(MapUtil.isNotEmpty(map)){
|
|||
// params = map;
|
|||
// }
|
|||
// String token = "";
|
|||
// String destroyTken = "";
|
|||
// try {
|
|||
// // 获取 access_token
|
|||
// String tokenJson = connect("/ebus/sfrzhqxglmk/sysPullLogin?systemCode="+systemCode+"&integrationKey="+integrationKey);
|
|||
// JSONObject tokenObj = JSONObject.parseObject(tokenJson);
|
|||
// log.info("====================== access_token ======================");
|
|||
// log.info("获取市认证令牌:{}",tokenObj);
|
|||
// System.out.println("====================== access_token ======================");
|
|||
// token = tokenObj.getString("data");
|
|||
//
|
|||
// // 获取 用户信息
|
|||
// int page = 0;
|
|||
// int pageSize = 500;
|
|||
// List<Map<String, Integer>> sumMap = new ArrayList<>();
|
|||
// while (true) {
|
|||
// String userInfoJson = connect("/ebus/sfrzhqxglmk/sysPullTacc?token="+token+"&page="+page+"&pageSize="+pageSize+"&status=0");
|
|||
// JSONObject sourceObj = JSONObject.parseObject(userInfoJson);
|
|||
// JSONObject tmpJsonObj = sourceObj.getJSONObject("data");
|
|||
// if(null==tmpJsonObj) {
|
|||
// log.info("=====================> tmpJsonObj 为空");
|
|||
// break;
|
|||
// }
|
|||
// JSONArray dataArr = tmpJsonObj.getJSONArray("data");
|
|||
// log.info("市认证过来的用户信息---> : {}", tmpJsonObj);
|
|||
// if (null == dataArr || dataArr.size()==0) { break; }
|
|||
// Map<String, Integer> resMap = userService.addSrzUser(dataArr, token);
|
|||
// sumMap.add(resMap);
|
|||
// page++;
|
|||
// }
|
|||
//
|
|||
// int insertNum = 0;
|
|||
// int updateNum = 0;
|
|||
// for (Map<String, Integer> item : sumMap) {
|
|||
// insertNum += item.get("insertNum");
|
|||
// updateNum += item.get("updateNum");
|
|||
// }
|
|||
// log.info("新增用户数量 : {} / 更新用户数量 : {}", insertNum, updateNum);
|
|||
//
|
|||
// // 注销token
|
|||
// destroyTken = connect("/ebus/sfrzhqxglmk/sysPullLogout?token="+token);
|
|||
// System.out.println("====================== destroyTken ======================");
|
|||
// System.out.println(destroyTken);
|
|||
// System.out.println("====================== destroyTken ======================");
|
|||
// } catch (Exception e) {
|
|||
// e.printStackTrace();
|
|||
// }
|
|||
// }
|
|||
//
|
|||
// private String connect(String apiPath) {
|
|||
// //各种参数
|
|||
//
|
|||
// try {
|
|||
//// String params = "{\"uid\":\"5b07b3de672c4e999c4b04f4\"}"; //请求接⼝的参数
|
|||
// String params = ""; //请求接⼝的参数
|
|||
//
|
|||
// long now = new Date().getTime();
|
|||
// String timestamp = Long.toString((long) Math.floor(now / 1000));
|
|||
// String nonce = Long.toHexString(now) + "-" + Long.toHexString((long) Math.floor(Math.random() * 0xFFFFFF));
|
|||
// String signature = toSHA256(timestamp + paasToken + nonce + timestamp);
|
|||
//
|
|||
//
|
|||
// //创建CloseableHttpClient
|
|||
// CloseableHttpClient client = HttpClientBuilder.create().build();
|
|||
// HttpPost httpPost = new HttpPost(znwgUrl + apiPath);
|
|||
// httpPost.setHeader("x-tif-paasid", paasId);
|
|||
// httpPost.setHeader("x-tif-timestamp", timestamp);
|
|||
// httpPost.setHeader("x-tif-signature", signature);
|
|||
// httpPost.setHeader("x-tif-nonce", nonce);
|
|||
// httpPost.setHeader("Content-Type", "application/json");
|
|||
// httpPost.setHeader("Cache-Control", "no-cache");
|
|||
// HttpEntity entity = new StringEntity(params);
|
|||
//
|
|||
//
|
|||
// httpPost.setEntity(entity);
|
|||
//
|
|||
// CloseableHttpResponse response = client.execute(httpPost);
|
|||
//
|
|||
// return EntityUtils.toString(response.getEntity());
|
|||
// } catch (Exception e) {
|
|||
// e.printStackTrace();
|
|||
// }
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// private String toSHA256(String str) throws Exception {
|
|||
// MessageDigest messageDigest;
|
|||
// String encodeStr = "";
|
|||
// try {
|
|||
// messageDigest = MessageDigest.getInstance("SHA-256");
|
|||
// messageDigest.update(str.getBytes(StandardCharsets.UTF_8));
|
|||
// encodeStr = byte2Hex(messageDigest.digest());
|
|||
// } catch (Exception e) {
|
|||
// throw e;
|
|||
// }
|
|||
// return encodeStr;
|
|||
// }
|
|||
//
|
|||
// // byte转换成16进制
|
|||
// private String byte2Hex(byte[] bytes) {
|
|||
// StringBuffer stringBuffer = new StringBuffer();
|
|||
// String temp = null;
|
|||
// for (int i = 0; i < bytes.length; i++) {
|
|||
// temp = Integer.toHexString(bytes[i] & 0xFF);
|
|||
// if (temp.length() == 1) {
|
|||
// stringBuffer.append("0");
|
|||
// }
|
|||
// stringBuffer.append(temp);
|
|||
// }
|
|||
// return stringBuffer.toString();
|
|||
// }
|
|||
//}
|
|||
@ -0,0 +1,538 @@ |
|||
package com.zdxt.code.domain; |
|||
|
|||
/** |
|||
* 市认证对接---组织机构信息对象 srz_dept |
|||
* |
|||
* @author ruoyi |
|||
* @date 2025-08-06 |
|||
*/ |
|||
public class SrzUser |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private String ryztCode; |
|||
private String mobileNumber; |
|||
private String zcgzld; |
|||
private String gldw; |
|||
private String updateAt; |
|||
private String zwjcCode; |
|||
private String effectOn; |
|||
private String zwjc; |
|||
private String organizationId; |
|||
private String province; |
|||
private String isDisabled; |
|||
private String certificateTypeIdCode; |
|||
private String jrfs; |
|||
private String spareNumber; |
|||
private String positionname; |
|||
private String pylxcode; |
|||
private String jbcc; |
|||
private String contractEndTime; |
|||
private String sequence; |
|||
private String genderCode; |
|||
private String zwwxMobile; |
|||
private String district; |
|||
private String guid; |
|||
private String certificateTypeId; |
|||
private String contractStartTime; |
|||
private String rylydw; |
|||
private String telephoneNumber; |
|||
private String gender; |
|||
private String city; |
|||
private String jbccCode; |
|||
private String rylb; |
|||
private String hometownCode; |
|||
private String units; |
|||
private String srzUserid; |
|||
private String createAt; |
|||
private String engName; |
|||
private String isDeleted; |
|||
private String jrfscode; |
|||
private String email; |
|||
private String zwbsCode; |
|||
private String dwzyld; |
|||
private String pylx; |
|||
private String systemId; |
|||
private String rylbCode; |
|||
private String hometown; |
|||
private String photo; |
|||
private String glzrr; |
|||
private String userId; |
|||
private String zwwxId; |
|||
private String ryzt; |
|||
private String certificateNumber; |
|||
private String zwbs; |
|||
private String faxNumber; |
|||
private String fullname; |
|||
private String isMappingPerson; |
|||
private String taskId; |
|||
private String username; |
|||
|
|||
private int needUpdate; |
|||
|
|||
public String getRyztCode() { |
|||
return ryztCode; |
|||
} |
|||
|
|||
public void setRyztCode(String ryztCode) { |
|||
this.ryztCode = ryztCode; |
|||
} |
|||
|
|||
public String getMobileNumber() { |
|||
return mobileNumber; |
|||
} |
|||
|
|||
public void setMobileNumber(String mobileNumber) { |
|||
this.mobileNumber = mobileNumber; |
|||
} |
|||
|
|||
public String getZcgzld() { |
|||
return zcgzld; |
|||
} |
|||
|
|||
public void setZcgzld(String zcgzld) { |
|||
this.zcgzld = zcgzld; |
|||
} |
|||
|
|||
public String getGldw() { |
|||
return gldw; |
|||
} |
|||
|
|||
public void setGldw(String gldw) { |
|||
this.gldw = gldw; |
|||
} |
|||
|
|||
public String getUpdateAt() { |
|||
return updateAt; |
|||
} |
|||
|
|||
public void setUpdateAt(String updateAt) { |
|||
this.updateAt = updateAt; |
|||
} |
|||
|
|||
public String getZwjcCode() { |
|||
return zwjcCode; |
|||
} |
|||
|
|||
public void setZwjcCode(String zwjcCode) { |
|||
this.zwjcCode = zwjcCode; |
|||
} |
|||
|
|||
public String getEffectOn() { |
|||
return effectOn; |
|||
} |
|||
|
|||
public void setEffectOn(String effectOn) { |
|||
this.effectOn = effectOn; |
|||
} |
|||
|
|||
public String getZwjc() { |
|||
return zwjc; |
|||
} |
|||
|
|||
public void setZwjc(String zwjc) { |
|||
this.zwjc = zwjc; |
|||
} |
|||
|
|||
public String getOrganizationId() { |
|||
return organizationId; |
|||
} |
|||
|
|||
public void setOrganizationId(String organizationId) { |
|||
this.organizationId = organizationId; |
|||
} |
|||
|
|||
public String getProvince() { |
|||
return province; |
|||
} |
|||
|
|||
public void setProvince(String province) { |
|||
this.province = province; |
|||
} |
|||
|
|||
public String getIsDisabled() { |
|||
return isDisabled; |
|||
} |
|||
|
|||
public void setIsDisabled(String isDisabled) { |
|||
this.isDisabled = isDisabled; |
|||
} |
|||
|
|||
public String getCertificateTypeIdCode() { |
|||
return certificateTypeIdCode; |
|||
} |
|||
|
|||
public void setCertificateTypeIdCode(String certificateTypeIdCode) { |
|||
this.certificateTypeIdCode = certificateTypeIdCode; |
|||
} |
|||
|
|||
public String getJrfs() { |
|||
return jrfs; |
|||
} |
|||
|
|||
public void setJrfs(String jrfs) { |
|||
this.jrfs = jrfs; |
|||
} |
|||
|
|||
public String getSpareNumber() { |
|||
return spareNumber; |
|||
} |
|||
|
|||
public void setSpareNumber(String spareNumber) { |
|||
this.spareNumber = spareNumber; |
|||
} |
|||
|
|||
public String getPositionname() { |
|||
return positionname; |
|||
} |
|||
|
|||
public void setPositionname(String positionname) { |
|||
this.positionname = positionname; |
|||
} |
|||
|
|||
public String getPylxcode() { |
|||
return pylxcode; |
|||
} |
|||
|
|||
public void setPylxcode(String pylxcode) { |
|||
this.pylxcode = pylxcode; |
|||
} |
|||
|
|||
public String getJbcc() { |
|||
return jbcc; |
|||
} |
|||
|
|||
public void setJbcc(String jbcc) { |
|||
this.jbcc = jbcc; |
|||
} |
|||
|
|||
public String getContractEndTime() { |
|||
return contractEndTime; |
|||
} |
|||
|
|||
public void setContractEndTime(String contractEndTime) { |
|||
this.contractEndTime = contractEndTime; |
|||
} |
|||
|
|||
public String getSequence() { |
|||
return sequence; |
|||
} |
|||
|
|||
public void setSequence(String sequence) { |
|||
this.sequence = sequence; |
|||
} |
|||
|
|||
public String getGenderCode() { |
|||
return genderCode; |
|||
} |
|||
|
|||
public void setGenderCode(String genderCode) { |
|||
this.genderCode = genderCode; |
|||
} |
|||
|
|||
public String getZwwxMobile() { |
|||
return zwwxMobile; |
|||
} |
|||
|
|||
public void setZwwxMobile(String zwwxMobile) { |
|||
this.zwwxMobile = zwwxMobile; |
|||
} |
|||
|
|||
public String getDistrict() { |
|||
return district; |
|||
} |
|||
|
|||
public void setDistrict(String district) { |
|||
this.district = district; |
|||
} |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public String getCertificateTypeId() { |
|||
return certificateTypeId; |
|||
} |
|||
|
|||
public void setCertificateTypeId(String certificateTypeId) { |
|||
this.certificateTypeId = certificateTypeId; |
|||
} |
|||
|
|||
public String getContractStartTime() { |
|||
return contractStartTime; |
|||
} |
|||
|
|||
public void setContractStartTime(String contractStartTime) { |
|||
this.contractStartTime = contractStartTime; |
|||
} |
|||
|
|||
public String getRylydw() { |
|||
return rylydw; |
|||
} |
|||
|
|||
public void setRylydw(String rylydw) { |
|||
this.rylydw = rylydw; |
|||
} |
|||
|
|||
public String getTelephoneNumber() { |
|||
return telephoneNumber; |
|||
} |
|||
|
|||
public void setTelephoneNumber(String telephoneNumber) { |
|||
this.telephoneNumber = telephoneNumber; |
|||
} |
|||
|
|||
public String getGender() { |
|||
return gender; |
|||
} |
|||
|
|||
public void setGender(String gender) { |
|||
this.gender = gender; |
|||
} |
|||
|
|||
public String getCity() { |
|||
return city; |
|||
} |
|||
|
|||
public void setCity(String city) { |
|||
this.city = city; |
|||
} |
|||
|
|||
public String getJbccCode() { |
|||
return jbccCode; |
|||
} |
|||
|
|||
public void setJbccCode(String jbccCode) { |
|||
this.jbccCode = jbccCode; |
|||
} |
|||
|
|||
public String getRylb() { |
|||
return rylb; |
|||
} |
|||
|
|||
public void setRylb(String rylb) { |
|||
this.rylb = rylb; |
|||
} |
|||
|
|||
public String getHometownCode() { |
|||
return hometownCode; |
|||
} |
|||
|
|||
public void setHometownCode(String hometownCode) { |
|||
this.hometownCode = hometownCode; |
|||
} |
|||
|
|||
public String getUnits() { |
|||
return units; |
|||
} |
|||
|
|||
public void setUnits(String units) { |
|||
this.units = units; |
|||
} |
|||
|
|||
public String getSrzUserid() { |
|||
return srzUserid; |
|||
} |
|||
|
|||
public void setSrzUserid(String srzUserid) { |
|||
this.srzUserid = srzUserid; |
|||
} |
|||
|
|||
public String getCreateAt() { |
|||
return createAt; |
|||
} |
|||
|
|||
public void setCreateAt(String createAt) { |
|||
this.createAt = createAt; |
|||
} |
|||
|
|||
public String getEngName() { |
|||
return engName; |
|||
} |
|||
|
|||
public void setEngName(String engName) { |
|||
this.engName = engName; |
|||
} |
|||
|
|||
public String getIsDeleted() { |
|||
return isDeleted; |
|||
} |
|||
|
|||
public void setIsDeleted(String isDeleted) { |
|||
this.isDeleted = isDeleted; |
|||
} |
|||
|
|||
public String getJrfscode() { |
|||
return jrfscode; |
|||
} |
|||
|
|||
public void setJrfscode(String jrfscode) { |
|||
this.jrfscode = jrfscode; |
|||
} |
|||
|
|||
public String getEmail() { |
|||
return email; |
|||
} |
|||
|
|||
public void setEmail(String email) { |
|||
this.email = email; |
|||
} |
|||
|
|||
public String getZwbsCode() { |
|||
return zwbsCode; |
|||
} |
|||
|
|||
public void setZwbsCode(String zwbsCode) { |
|||
this.zwbsCode = zwbsCode; |
|||
} |
|||
|
|||
public String getDwzyld() { |
|||
return dwzyld; |
|||
} |
|||
|
|||
public void setDwzyld(String dwzyld) { |
|||
this.dwzyld = dwzyld; |
|||
} |
|||
|
|||
public String getPylx() { |
|||
return pylx; |
|||
} |
|||
|
|||
public void setPylx(String pylx) { |
|||
this.pylx = pylx; |
|||
} |
|||
|
|||
public String getSystemId() { |
|||
return systemId; |
|||
} |
|||
|
|||
public void setSystemId(String systemId) { |
|||
this.systemId = systemId; |
|||
} |
|||
|
|||
public String getRylbCode() { |
|||
return rylbCode; |
|||
} |
|||
|
|||
public void setRylbCode(String rylbCode) { |
|||
this.rylbCode = rylbCode; |
|||
} |
|||
|
|||
public String getHometown() { |
|||
return hometown; |
|||
} |
|||
|
|||
public void setHometown(String hometown) { |
|||
this.hometown = hometown; |
|||
} |
|||
|
|||
public String getPhoto() { |
|||
return photo; |
|||
} |
|||
|
|||
public void setPhoto(String photo) { |
|||
this.photo = photo; |
|||
} |
|||
|
|||
public String getGlzrr() { |
|||
return glzrr; |
|||
} |
|||
|
|||
public void setGlzrr(String glzrr) { |
|||
this.glzrr = glzrr; |
|||
} |
|||
|
|||
public String getUserId() { |
|||
return userId; |
|||
} |
|||
|
|||
public void setUserId(String userId) { |
|||
this.userId = userId; |
|||
} |
|||
|
|||
public String getZwwxId() { |
|||
return zwwxId; |
|||
} |
|||
|
|||
public void setZwwxId(String zwwxId) { |
|||
this.zwwxId = zwwxId; |
|||
} |
|||
|
|||
public String getRyzt() { |
|||
return ryzt; |
|||
} |
|||
|
|||
public void setRyzt(String ryzt) { |
|||
this.ryzt = ryzt; |
|||
} |
|||
|
|||
public String getCertificateNumber() { |
|||
return certificateNumber; |
|||
} |
|||
|
|||
public void setCertificateNumber(String certificateNumber) { |
|||
this.certificateNumber = certificateNumber; |
|||
} |
|||
|
|||
public String getZwbs() { |
|||
return zwbs; |
|||
} |
|||
|
|||
public void setZwbs(String zwbs) { |
|||
this.zwbs = zwbs; |
|||
} |
|||
|
|||
public String getFaxNumber() { |
|||
return faxNumber; |
|||
} |
|||
|
|||
public void setFaxNumber(String faxNumber) { |
|||
this.faxNumber = faxNumber; |
|||
} |
|||
|
|||
public String getFullname() { |
|||
return fullname; |
|||
} |
|||
|
|||
public void setFullname(String fullname) { |
|||
this.fullname = fullname; |
|||
} |
|||
|
|||
public String getIsMappingPerson() { |
|||
return isMappingPerson; |
|||
} |
|||
|
|||
public void setIsMappingPerson(String isMappingPerson) { |
|||
this.isMappingPerson = isMappingPerson; |
|||
} |
|||
|
|||
public String getTaskId() { |
|||
return taskId; |
|||
} |
|||
|
|||
public void setTaskId(String taskId) { |
|||
this.taskId = taskId; |
|||
} |
|||
|
|||
public String getUsername() { |
|||
return username; |
|||
} |
|||
|
|||
public void setUsername(String username) { |
|||
this.username = username; |
|||
} |
|||
|
|||
public int getNeedUpdate() { |
|||
return needUpdate; |
|||
} |
|||
|
|||
public void setNeedUpdate(int needUpdate) { |
|||
this.needUpdate = needUpdate; |
|||
} |
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,25 @@ |
|||
package com.zdxt.code.mapper; |
|||
|
|||
|
|||
import com.zdxt.code.domain.SrzUser; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 市认证对接---组织机构信息Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2025-08-06 |
|||
*/ |
|||
@Repository |
|||
public interface SrzUserMapper |
|||
{ |
|||
public int insertUser(SrzUser srzUser); |
|||
|
|||
public int updateUser(SrzUser srzUser); |
|||
|
|||
public SrzUser selectUserByPrimaryKey(String userId); |
|||
|
|||
public List<SrzUser> selectUserByNeedUpdate(); |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
package com.zdxt.code.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.zdxt.code.domain.SrzUser; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 市认证对接---组织机构信息Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2025-08-06 |
|||
*/ |
|||
public interface ISrzUserService |
|||
{ |
|||
|
|||
/** |
|||
* 新增市认证对接---组织机构信息 |
|||
* |
|||
* @param srzUser 市认证对接---组织机构信息 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSrzUser(SrzUser srzUser); |
|||
|
|||
/** |
|||
* 修改市认证对接---组织机构信息 |
|||
* |
|||
* @param srzUser 市认证对接---组织机构信息 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSrzUser(SrzUser srzUser); |
|||
|
|||
public Map<String, Integer> saveSrzUser(JSONArray dataArr, String token); |
|||
|
|||
public List<SrzUser> selectUserByNeedUpdate(); |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,175 @@ |
|||
package com.zdxt.code.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.zdxt.auth.common.utils.StringUtils; |
|||
import com.zdxt.code.domain.SrzDept; |
|||
import com.zdxt.code.domain.SrzUser; |
|||
import com.zdxt.code.mapper.SrzUserMapper; |
|||
import com.zdxt.code.service.ISrzUserService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections.map.HashedMap; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClientBuilder; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.security.MessageDigest; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 市认证对接---组织机构信息Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2025-08-06 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class SrzUserServiceImpl implements ISrzUserService |
|||
{ |
|||
@Autowired |
|||
private SrzUserMapper srzUserMapper; |
|||
|
|||
@Value("${srnwg.url}") |
|||
private String znwgUrl; |
|||
@Value("${srnwg.paasId}") |
|||
private String paasId; |
|||
@Value("${srnwg.paasToken}") |
|||
private String paasToken; |
|||
|
|||
|
|||
/** |
|||
* 新增市认证对接---组织机构信息 |
|||
* |
|||
* @param srzUser 市认证对接---组织机构信息 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertSrzUser(SrzUser srzUser) |
|||
{ |
|||
return srzUserMapper.insertUser(srzUser); |
|||
} |
|||
|
|||
/** |
|||
* 修改市认证对接---组织机构信息 |
|||
* |
|||
* @param srzUser 市认证对接---组织机构信息 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateSrzUser(SrzUser srzUser) |
|||
{ |
|||
return srzUserMapper.updateUser(srzUser); |
|||
} |
|||
|
|||
@Override |
|||
public Map<String, Integer> saveSrzUser(JSONArray dataArr, String token) { |
|||
int insertNum = 0; |
|||
int updateNum = 0; |
|||
for (int i = 0; i < dataArr.size(); i++) { |
|||
JSONObject jsonObject = dataArr.getJSONObject(i); |
|||
if (StringUtils.isEmpty(jsonObject.getString("userId"))) { continue; } |
|||
try { |
|||
// 返回每条拉取的成功情况
|
|||
String taskId = jsonObject.getString("taskId"); |
|||
String params = "{\"token\":\"" + token + "\",\"data\":[{\"taskId\":\"" + taskId + "\",\"result\":\"SUCCESS\"}]}"; |
|||
String doneStr = connect("/ebus/sfrzhqxglmk/sysDoneTacc", params); |
|||
JSONObject doneObj = JSONObject.parseObject(doneStr); |
|||
String done = doneObj.getString("success"); |
|||
log.info("用户拉取完成结果 ========> :{}", done); |
|||
} catch (Exception e) { |
|||
log.info("用户数据下拉完成异常,异常任务id:{}", jsonObject.getString("taskId")); |
|||
e.printStackTrace(); |
|||
} |
|||
SrzUser srzUser=JSONObject.parseObject(jsonObject.toString(),SrzUser.class); |
|||
if(srzUser==null)continue; |
|||
|
|||
SrzUser temp = srzUserMapper.selectUserByPrimaryKey(srzUser.getUserId()); |
|||
srzUser.setNeedUpdate(0); |
|||
if (null != temp && temp.getOrganizationId() != null) { |
|||
// 跟新数据库
|
|||
int rowNum = srzUserMapper.updateUser(srzUser); |
|||
updateNum += rowNum; |
|||
} else { |
|||
// 插入数据库
|
|||
int rowNum = srzUserMapper.insertUser(srzUser); |
|||
insertNum += rowNum; |
|||
} |
|||
} |
|||
Map<String, Integer> resMap = new HashedMap(); |
|||
resMap.put("insertNum", insertNum); |
|||
resMap.put("updateNum", updateNum); |
|||
return resMap; |
|||
} |
|||
|
|||
public List<SrzUser> selectUserByNeedUpdate() { |
|||
return srzUserMapper.selectUserByNeedUpdate(); |
|||
} |
|||
|
|||
private String connect(String apiPath, String params) { |
|||
//各种参数
|
|||
|
|||
try { |
|||
long now = new Date().getTime(); |
|||
String timestamp = Long.toString((long) Math.floor(now / 1000)); |
|||
String nonce = Long.toHexString(now) + "-" + Long.toHexString((long) Math.floor(Math.random() * 0xFFFFFF)); |
|||
String signature = toSHA256(timestamp + paasToken + nonce + timestamp); |
|||
|
|||
//创建CloseableHttpClient
|
|||
CloseableHttpClient client = HttpClientBuilder.create().build(); |
|||
HttpPost httpPost = new HttpPost(znwgUrl + apiPath); |
|||
httpPost.setHeader("x-tif-paasid", paasId); |
|||
httpPost.setHeader("x-tif-timestamp", timestamp); |
|||
httpPost.setHeader("x-tif-signature", signature); |
|||
httpPost.setHeader("x-tif-nonce", nonce); |
|||
httpPost.setHeader("Content-Type", "application/json"); |
|||
httpPost.setHeader("Cache-Control", "no-cache"); |
|||
HttpEntity entity = new StringEntity(params); |
|||
|
|||
|
|||
httpPost.setEntity(entity); |
|||
|
|||
CloseableHttpResponse response = client.execute(httpPost); |
|||
|
|||
return EntityUtils.toString(response.getEntity()); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
private String toSHA256(String str) throws Exception { |
|||
MessageDigest messageDigest; |
|||
String encodeStr = ""; |
|||
try { |
|||
messageDigest = MessageDigest.getInstance("SHA-256"); |
|||
messageDigest.update(str.getBytes("UTF-8")); |
|||
encodeStr = byte2Hex(messageDigest.digest()); |
|||
} catch (Exception e) { |
|||
throw e; |
|||
} |
|||
return encodeStr; |
|||
} |
|||
|
|||
// byte转换成16进制
|
|||
private String byte2Hex(byte[] bytes) { |
|||
StringBuffer stringBuffer = new StringBuffer(); |
|||
String temp = null; |
|||
for (int i = 0; i < bytes.length; i++) { |
|||
temp = Integer.toHexString(bytes[i] & 0xFF); |
|||
if (temp.length() == 1) { |
|||
stringBuffer.append("0"); |
|||
} |
|||
stringBuffer.append(temp); |
|||
} |
|||
return stringBuffer.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,181 @@ |
|||
package com.zdxt.code.task; |
|||
|
|||
import cn.hutool.core.map.MapUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.zdxt.auth.project.system.dict.service.IDictDataService; |
|||
import com.zdxt.code.service.ISrzUserService; |
|||
import com.zdxt.domain.auth.DictData; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClientBuilder; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.security.MessageDigest; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
|
|||
/** |
|||
* 市认证组织信息表原始数据对接 |
|||
*/ |
|||
@Component("srzUserOriginalDataTask") |
|||
public class SrzUserOriginalDataTask { |
|||
|
|||
@Value("${srnwg.systemCode}") |
|||
private String systemCode; |
|||
@Value("${srnwg.integrationKey}") |
|||
private String integrationKey; |
|||
@Value("${srnwg.url}") |
|||
private String znwgUrl; |
|||
@Value("${srnwg.paasId}") |
|||
private String paasId; |
|||
@Value("${srnwg.paasToken}") |
|||
private String paasToken; |
|||
|
|||
@Autowired private ISrzUserService srzUserService; |
|||
@Autowired |
|||
private IDictDataService iDictDataService; |
|||
|
|||
public static Map<String,String> params = new HashMap<>(); |
|||
|
|||
private static final Logger log = LoggerFactory.getLogger(SrzUserOriginalDataTask.class); |
|||
|
|||
|
|||
public void run(){ |
|||
this.getData(); |
|||
} |
|||
|
|||
/** 同步部门数据 */ |
|||
public void getData(){ |
|||
List<DictData> srz_item = iDictDataService.selectDictDataByType("srz_item"); |
|||
Map<String,String> map = srz_item.stream().collect(Collectors.toMap(DictData::getDictLabel,DictData::getDictValue)); |
|||
|
|||
if(MapUtil.isNotEmpty(map)){ |
|||
params = map; |
|||
} |
|||
String token = ""; |
|||
String destroyTken = ""; |
|||
try { |
|||
// 获取 access_token
|
|||
String tokenJson = connect("/ebus/sfrzhqxglmk/sysPullLogin?systemCode="+systemCode+"&integrationKey="+integrationKey); |
|||
JSONObject tokenObj = JSONObject.parseObject(tokenJson); |
|||
log.info("====================== access_token ======================"); |
|||
log.info("获取市认证令牌:{}",tokenObj); |
|||
System.out.println("====================== access_token ======================"); |
|||
token = tokenObj.getString("data"); |
|||
|
|||
// 获取 用户信息
|
|||
int page = 0; |
|||
int pageSize = 500; |
|||
List<Map<String, Integer>> sumMap = new ArrayList<>(); |
|||
|
|||
int insertNum = 0; |
|||
int updateNum = 0; |
|||
page = 0; |
|||
while (true) { |
|||
String userInfoJson = connect("/ebus/sfrzhqxglmk/sysPullTacc?token="+token+"&page="+page+"&pageSize="+pageSize+"&status=0"); |
|||
JSONObject sourceObj = JSONObject.parseObject(userInfoJson); |
|||
JSONObject tmpJsonObj = sourceObj.getJSONObject("data"); |
|||
if(null==tmpJsonObj) { |
|||
log.info("=====================> tmpJsonObj 为空"); |
|||
break; |
|||
} |
|||
JSONArray dataArr = tmpJsonObj.getJSONArray("data"); |
|||
log.info("市认证过来的用户数量---> : {}", tmpJsonObj.get("'total'")); |
|||
if (null == dataArr || dataArr.size()==0) { break; } |
|||
Map<String, Integer> resMap = srzUserService.saveSrzUser(dataArr, token); |
|||
sumMap.add(resMap); |
|||
page++; |
|||
} |
|||
|
|||
insertNum = 0; |
|||
updateNum = 0; |
|||
for (Map<String, Integer> item : sumMap) { |
|||
insertNum += item.get("insertNum"); |
|||
updateNum += item.get("updateNum"); |
|||
} |
|||
log.info("新增用户数量 : {} / 更新用户数量 : {}", insertNum, updateNum); |
|||
|
|||
// 注销token
|
|||
destroyTken = connect("/ebus/sfrzhqxglmk/sysPullLogout?token="+token); |
|||
System.out.println("====================== destroyTken ======================"); |
|||
System.out.println(destroyTken); |
|||
System.out.println("====================== destroyTken ======================"); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
private String connect(String apiPath) { |
|||
//各种参数
|
|||
|
|||
try { |
|||
String params = ""; //请求接⼝的参数
|
|||
|
|||
long now = new Date().getTime(); |
|||
String timestamp = Long.toString((long) Math.floor(now / 1000)); |
|||
String nonce = Long.toHexString(now) + "-" + Long.toHexString((long) Math.floor(Math.random() * 0xFFFFFF)); |
|||
String signature = toSHA256(timestamp + paasToken + nonce + timestamp); |
|||
|
|||
|
|||
//创建CloseableHttpClient
|
|||
CloseableHttpClient client = HttpClientBuilder.create().build(); |
|||
HttpPost httpPost = new HttpPost(znwgUrl + apiPath); |
|||
httpPost.setHeader("x-tif-paasid", paasId); |
|||
httpPost.setHeader("x-tif-timestamp", timestamp); |
|||
httpPost.setHeader("x-tif-signature", signature); |
|||
httpPost.setHeader("x-tif-nonce", nonce); |
|||
httpPost.setHeader("Content-Type", "application/json"); |
|||
httpPost.setHeader("Cache-Control", "no-cache"); |
|||
HttpEntity entity = new StringEntity(params); |
|||
|
|||
|
|||
httpPost.setEntity(entity); |
|||
|
|||
CloseableHttpResponse response = client.execute(httpPost); |
|||
|
|||
return EntityUtils.toString(response.getEntity()); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
|
|||
|
|||
private String toSHA256(String str) throws Exception { |
|||
MessageDigest messageDigest; |
|||
String encodeStr = ""; |
|||
try { |
|||
messageDigest = MessageDigest.getInstance("SHA-256"); |
|||
messageDigest.update(str.getBytes("UTF-8")); |
|||
encodeStr = byte2Hex(messageDigest.digest()); |
|||
} catch (Exception e) { |
|||
throw e; |
|||
} |
|||
return encodeStr; |
|||
} |
|||
|
|||
// byte转换成16进制
|
|||
private String byte2Hex(byte[] bytes) { |
|||
StringBuffer stringBuffer = new StringBuffer(); |
|||
String temp = null; |
|||
for (int i = 0; i < bytes.length; i++) { |
|||
temp = Integer.toHexString(bytes[i] & 0xFF); |
|||
if (temp.length() == 1) { |
|||
stringBuffer.append("0"); |
|||
} |
|||
stringBuffer.append(temp); |
|||
} |
|||
return stringBuffer.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,281 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zdxt.code.mapper.SrzUserMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="com.zdxt.code.domain.SrzUser"> |
|||
<id column="guid" property="guid"/> |
|||
<result column="ryztCode" property="ryztCode"/> |
|||
<result column="mobileNumber" property="mobileNumber"/> |
|||
<result column="zcgzld" property="zcgzld"/> |
|||
<result column="gldw" property="gldw"/> |
|||
<result column="updateAt" property="updateAt"/> |
|||
<result column="zwjcCode" property="zwjcCode"/> |
|||
<result column="effectOn" property="effectOn"/> |
|||
<result column="zwjc" property="zwjc"/> |
|||
<result column="organizationId" property="organizationId"/> |
|||
<result column="province" property="province"/> |
|||
<result column="isDisabled" property="isDisabled"/> |
|||
<result column="certificateTypeIdCode" property="certificateTypeIdCode"/> |
|||
<result column="jrfs" property="jrfs"/> |
|||
<result column="spareNumber" property="spareNumber"/> |
|||
<result column="positionname" property="positionname"/> |
|||
<result column="pylxcode" property="pylxcode"/> |
|||
<result column="jbcc" property="jbcc"/> |
|||
<result column="contractEndTime" property="contractEndTime"/> |
|||
<result column="sequence" property="sequence"/> |
|||
<result column="genderCode" property="genderCode"/> |
|||
<result column="zwwxMobile" property="zwwxMobile"/> |
|||
<result column="district" property="district"/> |
|||
<result column="certificateTypeId" property="certificateTypeId"/> |
|||
<result column="contractStartTime" property="contractStartTime"/> |
|||
<result column="rylydw" property="rylydw"/> |
|||
<result column="telephoneNumber" property="telephoneNumber"/> |
|||
<result column="gender" property="gender"/> |
|||
<result column="city" property="city"/> |
|||
<result column="jbccCode" property="jbccCode"/> |
|||
<result column="rylb" property="rylb"/> |
|||
<result column="hometownCode" property="hometownCode"/> |
|||
<result column="units" property="units"/> |
|||
<result column="srzUserid" property="srzUserid"/> |
|||
<result column="createAt" property="createAt"/> |
|||
<result column="engName" property="engName"/> |
|||
<result column="isDeleted" property="isDeleted"/> |
|||
<result column="jrfscode" property="jrfscode"/> |
|||
<result column="email" property="email"/> |
|||
<result column="zwbsCode" property="zwbsCode"/> |
|||
<result column="dwzyld" property="dwzyld"/> |
|||
<result column="pylx" property="pylx"/> |
|||
<result column="systemId" property="systemId"/> |
|||
<result column="rylbCode" property="rylbCode"/> |
|||
<result column="hometown" property="hometown"/> |
|||
<result column="photo" property="photo"/> |
|||
<result column="glzrr" property="glzrr"/> |
|||
<result column="userId" property="userId"/> |
|||
<result column="zwwxId" property="zwwxId"/> |
|||
<result column="ryzt" property="ryzt"/> |
|||
<result column="certificateNumber" property="certificateNumber"/> |
|||
<result column="zwbs" property="zwbs"/> |
|||
<result column="faxNumber" property="faxNumber"/> |
|||
<result column="fullname" property="fullname"/> |
|||
<result column="isMappingPerson" property="isMappingPerson"/> |
|||
<result column="taskId" property="taskId"/> |
|||
<result column="username" property="username"/> |
|||
<result column="need_update" property="needUpdate"/> |
|||
</resultMap> |
|||
|
|||
<sql id="Base_Column_List"> |
|||
guid, ryztCode, mobileNumber, zcgzld, gldw, updateAt, zwjcCode, effectOn, zwjc, |
|||
organizationId, province, isDisabled, certificateTypeIdCode, jrfs, spareNumber, positionname, pylxcode, jbcc, |
|||
contractEndTime, sequence, genderCode, zwwxMobile, district, certificateTypeId, contractStartTime, rylydw, telephoneNumber, |
|||
gender, city, jbccCode, rylb, hometownCode, units, srzUserid, createAt, engName, |
|||
isDeleted, jrfscode, email, zwbsCode, dwzyld, pylx, systemId, rylbCode, hometown, |
|||
photo, glzrr, userId, zwwxId, ryzt, certificateNumber, zwbs, faxNumber, fullname, |
|||
isMappingPerson, taskId, username, need_update |
|||
</sql> |
|||
|
|||
<!-- 安全动态插入:只更新非空字段 --> |
|||
<insert id="insertUser" parameterType="com.zdxt.code.domain.SrzUser"> |
|||
INSERT INTO srz_user |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null and guid != ''">guid,</if> |
|||
<if test="ryztCode != null and ryztCode != ''">ryztCode,</if> |
|||
<if test="mobileNumber != null and mobileNumber != ''">mobileNumber,</if> |
|||
<if test="zcgzld != null and zcgzld != ''">zcgzld,</if> |
|||
<if test="gldw != null and gldw != ''">gldw,</if> |
|||
<if test="updateAt != null and updateAt != ''">updateAt,</if> |
|||
<if test="zwjcCode != null and zwjcCode != ''">zwjcCode,</if> |
|||
<if test="effectOn != null and effectOn != ''">effectOn,</if> |
|||
<if test="zwjc != null and zwjc != ''">zwjc,</if> |
|||
<if test="organizationId != null and organizationId != ''">organizationId,</if> |
|||
<if test="province != null and province != ''">province,</if> |
|||
<if test="isDisabled != null and isDisabled != ''">isDisabled,</if> |
|||
<if test="certificateTypeIdCode != null and certificateTypeIdCode != ''">certificateTypeIdCode,</if> |
|||
<if test="jrfs != null and jrfs != ''">jrfs,</if> |
|||
<if test="spareNumber != null and spareNumber != ''">spareNumber,</if> |
|||
<if test="positionname != null and positionname != ''">positionname,</if> |
|||
<if test="pylxcode != null and pylxcode != ''">pylxcode,</if> |
|||
<if test="jbcc != null and jbcc != ''">jbcc,</if> |
|||
<if test="contractEndTime != null and contractEndTime != ''">contractEndTime,</if> |
|||
<if test="sequence != null and sequence != ''">sequence,</if> |
|||
<if test="genderCode != null and genderCode != ''">genderCode,</if> |
|||
<if test="zwwxMobile != null and zwwxMobile != ''">zwwxMobile,</if> |
|||
<if test="district != null and district != ''">district,</if> |
|||
<if test="certificateTypeId != null and certificateTypeId != ''">certificateTypeId,</if> |
|||
<if test="contractStartTime != null and contractStartTime != ''">contractStartTime,</if> |
|||
<if test="rylydw != null and rylydw != ''">rylydw,</if> |
|||
<if test="telephoneNumber != null and telephoneNumber != ''">telephoneNumber,</if> |
|||
<if test="gender != null and gender != ''">gender,</if> |
|||
<if test="city != null and city != ''">city,</if> |
|||
<if test="jbccCode != null and jbccCode != ''">jbccCode,</if> |
|||
<if test="rylb != null and rylb != ''">rylb,</if> |
|||
<if test="hometownCode != null and hometownCode != ''">hometownCode,</if> |
|||
<if test="units != null and units != ''">units,</if> |
|||
<if test="srzUserid != null and srzUserid != ''">srzUserid,</if> |
|||
<if test="createAt != null and createAt != ''">createAt,</if> |
|||
<if test="engName != null and engName != ''">engName,</if> |
|||
<if test="isDeleted != null and isDeleted != ''">isDeleted,</if> |
|||
<if test="jrfscode != null and jrfscode != ''">jrfscode,</if> |
|||
<if test="email != null and email != ''">email,</if> |
|||
<if test="zwbsCode != null and zwbsCode != ''">zwbsCode,</if> |
|||
<if test="dwzyld != null and dwzyld != ''">dwzyld,</if> |
|||
<if test="pylx != null and pylx != ''">pylx,</if> |
|||
<if test="systemId != null and systemId != ''">systemId,</if> |
|||
<if test="rylbCode != null and rylbCode != ''">rylbCode,</if> |
|||
<if test="hometown != null and hometown != ''">hometown,</if> |
|||
<if test="photo != null and photo != ''">photo,</if> |
|||
<if test="glzrr != null and glzrr != ''">glzrr,</if> |
|||
<if test="userId != null and userId != ''">userId,</if> |
|||
<if test="zwwxId != null and zwwxId != ''">zwwxId,</if> |
|||
<if test="ryzt != null and ryzt != ''">ryzt,</if> |
|||
<if test="certificateNumber != null and certificateNumber != ''">certificateNumber,</if> |
|||
<if test="zwbs != null and zwbs != ''">zwbs,</if> |
|||
<if test="faxNumber != null and faxNumber != ''">faxNumber,</if> |
|||
<if test="fullname != null and fullname != ''">fullname,</if> |
|||
<if test="isMappingPerson != null and isMappingPerson != ''">isMappingPerson,</if> |
|||
<if test="taskId != null and taskId != ''">taskId,</if> |
|||
<if test="username != null and username != ''">username,</if> |
|||
</trim> |
|||
<trim prefix="VALUES (" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null and guid != ''">#{guid},</if> |
|||
<if test="ryztCode != null and ryztCode != ''">#{ryztCode},</if> |
|||
<if test="mobileNumber != null and mobileNumber != ''">#{mobileNumber},</if> |
|||
<if test="zcgzld != null and zcgzld != ''">#{zcgzld},</if> |
|||
<if test="gldw != null and gldw != ''">#{gldw},</if> |
|||
<if test="updateAt != null and updateAt != ''">#{updateAt},</if> |
|||
<if test="zwjcCode != null and zwjcCode != ''">#{zwjcCode},</if> |
|||
<if test="effectOn != null and effectOn != ''">#{effectOn},</if> |
|||
<if test="zwjc != null and zwjc != ''">#{zwjc},</if> |
|||
<if test="organizationId != null and organizationId != ''">#{organizationId},</if> |
|||
<if test="province != null and province != ''">#{province},</if> |
|||
<if test="isDisabled != null and isDisabled != ''">#{isDisabled},</if> |
|||
<if test="certificateTypeIdCode != null and certificateTypeIdCode != ''">#{certificateTypeIdCode},</if> |
|||
<if test="jrfs != null and jrfs != ''">#{jrfs},</if> |
|||
<if test="spareNumber != null and spareNumber != ''">#{spareNumber},</if> |
|||
<if test="positionname != null and positionname != ''">#{positionname},</if> |
|||
<if test="pylxcode != null and pylxcode != ''">#{pylxcode},</if> |
|||
<if test="jbcc != null and jbcc != ''">#{jbcc},</if> |
|||
<if test="contractEndTime != null and contractEndTime != ''">#{contractEndTime},</if> |
|||
<if test="sequence != null and sequence != ''">#{sequence},</if> |
|||
<if test="genderCode != null and genderCode != ''">#{genderCode},</if> |
|||
<if test="zwwxMobile != null and zwwxMobile != ''">#{zwwxMobile},</if> |
|||
<if test="district != null and district != ''">#{district},</if> |
|||
<if test="certificateTypeId != null and certificateTypeId != ''">#{certificateTypeId},</if> |
|||
<if test="contractStartTime != null and contractStartTime != ''">#{contractStartTime},</if> |
|||
<if test="rylydw != null and rylydw != ''">#{rylydw},</if> |
|||
<if test="telephoneNumber != null and telephoneNumber != ''">#{telephoneNumber},</if> |
|||
<if test="gender != null and gender != ''">#{gender},</if> |
|||
<if test="city != null and city != ''">#{city},</if> |
|||
<if test="jbccCode != null and jbccCode != ''">#{jbccCode},</if> |
|||
<if test="rylb != null and rylb != ''">#{rylb},</if> |
|||
<if test="hometownCode != null and hometownCode != ''">#{hometownCode},</if> |
|||
<if test="units != null and units != ''">#{units},</if> |
|||
<if test="srzUserid != null and srzUserid != ''">#{srzUserid},</if> |
|||
<if test="createAt != null and createAt != ''">#{createAt},</if> |
|||
<if test="engName != null and engName != ''">#{engName},</if> |
|||
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if> |
|||
<if test="jrfscode != null and jrfscode != ''">#{jrfscode},</if> |
|||
<if test="email != null and email != ''">#{email},</if> |
|||
<if test="zwbsCode != null and zwbsCode != ''">#{zwbsCode},</if> |
|||
<if test="dwzyld != null and dwzyld != ''">#{dwzyld},</if> |
|||
<if test="pylx != null and pylx != ''">#{pylx},</if> |
|||
<if test="systemId != null and systemId != ''">#{systemId},</if> |
|||
<if test="rylbCode != null and rylbCode != ''">#{rylbCode},</if> |
|||
<if test="hometown != null and hometown != ''">#{hometown},</if> |
|||
<if test="photo != null and photo != ''">#{photo},</if> |
|||
<if test="glzrr != null and glzrr != ''">#{glzrr},</if> |
|||
<if test="userId != null and userId != ''">#{userId},</if> |
|||
<if test="zwwxId != null and zwwxId != ''">#{zwwxId},</if> |
|||
<if test="ryzt != null and ryzt != ''">#{ryzt},</if> |
|||
<if test="certificateNumber != null and certificateNumber != ''">#{certificateNumber},</if> |
|||
<if test="zwbs != null and zwbs != ''">#{zwbs},</if> |
|||
<if test="faxNumber != null and faxNumber != ''">#{faxNumber},</if> |
|||
<if test="fullname != null and fullname != ''">#{fullname},</if> |
|||
<if test="isMappingPerson != null and isMappingPerson != ''">#{isMappingPerson},</if> |
|||
<if test="taskId != null and taskId != ''">#{taskId},</if> |
|||
<if test="username != null and username != ''">#{username},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<!-- 安全动态更新:只更新非空字段 --> |
|||
<update id="updateUser" parameterType="com.zdxt.code.domain.SrzUser"> |
|||
UPDATE srz_user |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="ryztCode != null and ryztCode != ''">ryztCode = #{ryztCode},</if> |
|||
<if test="mobileNumber != null and mobileNumber != ''">mobileNumber = #{mobileNumber},</if> |
|||
<if test="zcgzld != null and zcgzld != ''">zcgzld = #{zcgzld},</if> |
|||
<if test="gldw != null and gldw != ''">gldw = #{gldw},</if> |
|||
<if test="updateAt != null and updateAt != ''">updateAt = #{updateAt},</if> |
|||
<if test="zwjcCode != null and zwjcCode != ''">zwjcCode = #{zwjcCode},</if> |
|||
<if test="effectOn != null and effectOn != ''">effectOn = #{effectOn},</if> |
|||
<if test="zwjc != null and zwjc != ''">zwjc = #{zwjc},</if> |
|||
<if test="organizationId != null and organizationId != ''">organizationId = #{organizationId},</if> |
|||
<if test="province != null and province != ''">province = #{province},</if> |
|||
<if test="isDisabled != null and isDisabled != ''">isDisabled = #{isDisabled},</if> |
|||
<if test="certificateTypeIdCode != null and certificateTypeIdCode != ''">certificateTypeIdCode = #{certificateTypeIdCode},</if> |
|||
<if test="jrfs != null and jrfs != ''">jrfs = #{jrfs},</if> |
|||
<if test="spareNumber != null and spareNumber != ''">spareNumber = #{spareNumber},</if> |
|||
<if test="positionname != null and positionname != ''">positionname = #{positionname},</if> |
|||
<if test="pylxcode != null and pylxcode != ''">pylxcode = #{pylxcode},</if> |
|||
<if test="jbcc != null and jbcc != ''">jbcc = #{jbcc},</if> |
|||
<if test="contractEndTime != null and contractEndTime != ''">contractEndTime = #{contractEndTime},</if> |
|||
<if test="sequence != null and sequence != ''">sequence = #{sequence},</if> |
|||
<if test="genderCode != null and genderCode != ''">genderCode = #{genderCode},</if> |
|||
<if test="zwwxMobile != null and zwwxMobile != ''">zwwxMobile = #{zwwxMobile},</if> |
|||
<if test="district != null and district != ''">district = #{district},</if> |
|||
<if test="certificateTypeId != null and certificateTypeId != ''">certificateTypeId = #{certificateTypeId},</if> |
|||
<if test="contractStartTime != null and contractStartTime != ''">contractStartTime = #{contractStartTime},</if> |
|||
<if test="rylydw != null and rylydw != ''">rylydw = #{rylydw},</if> |
|||
<if test="telephoneNumber != null and telephoneNumber != ''">telephoneNumber = #{telephoneNumber},</if> |
|||
<if test="gender != null and gender != ''">gender = #{gender},</if> |
|||
<if test="city != null and city != ''">city = #{city},</if> |
|||
<if test="jbccCode != null and jbccCode != ''">jbccCode = #{jbccCode},</if> |
|||
<if test="rylb != null and rylb != ''">rylb = #{rylb},</if> |
|||
<if test="hometownCode != null and hometownCode != ''">hometownCode = #{hometownCode},</if> |
|||
<if test="units != null and units != ''">units = #{units},</if> |
|||
<if test="srzUserid != null and srzUserid != ''">srzUserid = #{srzUserid},</if> |
|||
<if test="createAt != null and createAt != ''">createAt = #{createAt},</if> |
|||
<if test="engName != null and engName != ''">engName = #{engName},</if> |
|||
<if test="isDeleted != null and isDeleted != ''">isDeleted = #{isDeleted},</if> |
|||
<if test="jrfscode != null and jrfscode != ''">jrfscode = #{jrfscode},</if> |
|||
<if test="email != null and email != ''">email = #{email},</if> |
|||
<if test="zwbsCode != null and zwbsCode != ''">zwbsCode = #{zwbsCode},</if> |
|||
<if test="dwzyld != null and dwzyld != ''">dwzyld = #{dwzyld},</if> |
|||
<if test="pylx != null and pylx != ''">pylx = #{pylx},</if> |
|||
<if test="systemId != null and systemId != ''">systemId = #{systemId},</if> |
|||
<if test="rylbCode != null and rylbCode != ''">rylbCode = #{rylbCode},</if> |
|||
<if test="hometown != null and hometown != ''">hometown = #{hometown},</if> |
|||
<if test="photo != null and photo != ''">photo = #{photo},</if> |
|||
<if test="glzrr != null and glzrr != ''">glzrr = #{glzrr},</if> |
|||
<if test="userId != null and userId != ''">userId = #{userId},</if> |
|||
<if test="zwwxId != null and zwwxId != ''">zwwxId = #{zwwxId},</if> |
|||
<if test="ryzt != null and ryzt != ''">ryzt = #{ryzt},</if> |
|||
<if test="certificateNumber != null and certificateNumber != ''">certificateNumber = #{certificateNumber},</if> |
|||
<if test="zwbs != null and zwbs != ''">zwbs = #{zwbs},</if> |
|||
<if test="faxNumber != null and faxNumber != ''">faxNumber = #{faxNumber},</if> |
|||
<if test="fullname != null and fullname != ''">fullname = #{fullname},</if> |
|||
<if test="isMappingPerson != null and isMappingPerson != ''">isMappingPerson = #{isMappingPerson},</if> |
|||
<if test="taskId != null and taskId != ''">taskId = #{taskId},</if> |
|||
<if test="username != null and username != ''">username = #{username},</if> |
|||
<if test="needUpdate != null">need_update = #{needUpdate},</if> |
|||
</trim> |
|||
WHERE userId = #{userId} |
|||
</update> |
|||
|
|||
<!-- 根据主键查询 --> |
|||
<select id="selectUserByPrimaryKey" resultMap="BaseResultMap"> |
|||
SELECT |
|||
<include refid="Base_Column_List"/> |
|||
FROM srz_user |
|||
WHERE userId = #{userId} |
|||
</select> |
|||
|
|||
<!-- 需要更新的数据查出前500条(need_update=0) --> |
|||
<select id="selectUserByNeedUpdate" resultMap="BaseResultMap"> |
|||
SELECT |
|||
<include refid="Base_Column_List"/> |
|||
FROM srz_user |
|||
WHERE need_update = 0 limit 500 |
|||
</select> |
|||
</mapper> |
|||
Loading…
Reference in new issue