Browse Source

监督端-同步原始用户部门定时任务

dev-V1.0.5.1
niujiyi 2 months ago
parent
commit
b87177803a
  1. 18
      zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/mapper/SrzDeptMapper.java
  2. 12
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/SrzUserMapper.java
  3. 187
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/quartz/job/SrzDeptOriginalDataJob.java
  4. 187
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/quartz/job/SrzUserOriginalDataJob.java
  5. 11
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/ISrzDeptService.java
  6. 11
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/ISrzUserService.java
  7. 135
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/SrzDeptServiceImpl.java
  8. 132
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/SrzUserServiceImpl.java
  9. 133
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/SrzDeptMapper.xml
  10. 188
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/SrzUserMapper.xml

18
zdxt-modules/zdxt-enforcement-code-common/src/main/java/com/zdxt/enforcementcode/mapper/SrzDeptMapper.java

@ -14,4 +14,22 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
@Mapper @Mapper
public interface SrzDeptMapper extends BaseMapperPlus<SrzDept, SrzDeptVo> { public interface SrzDeptMapper extends BaseMapperPlus<SrzDept, SrzDeptVo> {
/**
* 新增市认证对接---组织机构信息
*
* @param srzDept 市认证对接---组织机构信息
* @return 结果
*/
int insertSrzDept(SrzDept srzDept);
/**
* 修改市认证对接---组织机构信息
*
* @param srzDept 市认证对接---组织机构信息
* @return 结果
*/
int updateSrzDept(SrzDept srzDept);
} }

12
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/SrzUserMapper.java

@ -11,5 +11,17 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
* @date 2026-05-06 * @date 2026-05-06
*/ */
public interface SrzUserMapper extends BaseMapperPlus<SrzUser, SrzUserVo> { public interface SrzUserMapper extends BaseMapperPlus<SrzUser, SrzUserVo> {
/**
* 更新用户信息
* @param srzUser
* @return
*/
int updateUser(SrzUser srzUser);
/**
* 新增用户信息
* @param srzUser
* @return
*/
int insertUser(SrzUser srzUser);
} }

187
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/quartz/job/SrzDeptOriginalDataJob.java

@ -0,0 +1,187 @@
package com.zdxt.enforcementcode.quartz.job;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zdxt.enforcementcode.service.ISrzDeptService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.service.ISysDictDataService;
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;
/**
* 同步市认证部门组织信息表原始数据
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class SrzDeptOriginalDataJob {
@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 ISrzDeptService srzDeptService;
@Autowired
private ISysDictDataService sysDictDataService;
public static Map<String,String> params = new HashMap<>();
private static final Logger log = LoggerFactory.getLogger(SrzDeptOriginalDataJob.class);
public void run(){
this.getData();
}
/** 同步部门数据 */
public void getData(){
List<SysDictDataVo> srz_item = sysDictDataService.selectDictDataByType("srz_item");
Map<String,String> map = srz_item.stream().collect(Collectors.toMap(SysDictDataVo::getDictLabel,SysDictDataVo::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);
System.out.println("====================== access_token ======================");
System.out.println(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 deptInfoJson = connect("/ebus/sfrzhqxglmk/sysPullOrg?token="+token+"&page="+page+"&pageSize="+pageSize+"&status=0");
JSONObject sourceObj = JSONObject.parseObject(deptInfoJson);
JSONObject tmpJsonObj = sourceObj.getJSONObject("data");
if(null==tmpJsonObj) {
log.info("=====================> tmpJsonObj 为空");
break;
}
JSONArray dataArr = tmpJsonObj.getJSONArray("data");
if (null == dataArr || dataArr.size()==0) { break; }
// 插入更新数据库
log.info("-------------------> 拉取到组织数量: {}", dataArr.size());
Map<String, Integer> resMap = srzDeptService.saveSrzDept(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();
}
}

187
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/quartz/job/SrzUserOriginalDataJob.java

@ -0,0 +1,187 @@
package com.zdxt.enforcementcode.quartz.job;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zdxt.enforcementcode.service.ISrzUserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.service.ISysDictDataService;
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;
/**
* 同步市认证用户组织信息原始数据
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class SrzUserOriginalDataJob {
@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 ISysDictDataService sysDictDataService;
public static Map<String,String> params = new HashMap<>();
private static final Logger log = LoggerFactory.getLogger(SrzUserOriginalDataJob.class);
public void run(){
this.getData();
}
/**
* 获取市认证用户原始数据
*/
public void getData(){
List<SysDictDataVo> srz_item = sysDictDataService.selectDictDataByType("srz_item");
Map<String,String> map = srz_item.stream().collect(Collectors.toMap(SysDictDataVo::getDictLabel,SysDictDataVo::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();
}
}

11
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/ISrzDeptService.java

@ -1,5 +1,6 @@
package com.zdxt.enforcementcode.service; package com.zdxt.enforcementcode.service;
import com.alibaba.fastjson.JSONArray;
import com.zdxt.enforcementcode.domain.vo.SrzDeptVo; import com.zdxt.enforcementcode.domain.vo.SrzDeptVo;
import com.zdxt.enforcementcode.domain.vo.SrzDeptMinVo; import com.zdxt.enforcementcode.domain.vo.SrzDeptMinVo;
import com.zdxt.enforcementcode.domain.bo.SrzDeptBo; import com.zdxt.enforcementcode.domain.bo.SrzDeptBo;
@ -8,6 +9,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 市认证对接---组织机构信息Service接口 * 市认证对接---组织机构信息Service接口
@ -73,4 +75,13 @@ public interface ISrzDeptService {
* @return 精简机构列表 * @return 精简机构列表
*/ */
List<SrzDeptMinVo> queryMinList(); List<SrzDeptMinVo> queryMinList();
/**
* 保存部门信息
*
* @param dataArr 部门信息
* @param token 访问令牌
* @return 保存结果
*/
Map<String, Integer> saveSrzDept(JSONArray dataArr, String token);
} }

11
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/ISrzUserService.java

@ -1,5 +1,6 @@
package com.zdxt.enforcementcode.service; package com.zdxt.enforcementcode.service;
import com.alibaba.fastjson.JSONArray;
import com.zdxt.enforcementcode.domain.vo.SrzUserVo; import com.zdxt.enforcementcode.domain.vo.SrzUserVo;
import com.zdxt.enforcementcode.domain.bo.SrzUserBo; import com.zdxt.enforcementcode.domain.bo.SrzUserBo;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -7,6 +8,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 市认证用户原始Service接口 * 市认证用户原始Service接口
@ -65,4 +67,13 @@ public interface ISrzUserService {
* @return 是否删除成功 * @return 是否删除成功
*/ */
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
/**
* 保存市认证用户原始信息
*
* @param dataArr 待保存的数据
* @param token token
* @return 保存结果
*/
Map<String, Integer> saveSrzUser(JSONArray dataArr, String token);
} }

135
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/SrzDeptServiceImpl.java

@ -1,5 +1,15 @@
package com.zdxt.enforcementcode.service.impl; package com.zdxt.enforcementcode.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections4.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.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zdxt.enforcementcode.domain.bo.SrzDeptBo; import com.zdxt.enforcementcode.domain.bo.SrzDeptBo;
import com.zdxt.enforcementcode.domain.vo.SrzDeptVo; import com.zdxt.enforcementcode.domain.vo.SrzDeptVo;
@ -17,6 +28,8 @@ import com.zdxt.enforcementcode.domain.SrzDept;
import com.zdxt.enforcementcode.mapper.SrzDeptMapper; import com.zdxt.enforcementcode.mapper.SrzDeptMapper;
import com.zdxt.enforcementcode.service.ISrzDeptService; import com.zdxt.enforcementcode.service.ISrzDeptService;
import java.security.MessageDigest;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Collection; import java.util.Collection;
@ -34,6 +47,13 @@ public class SrzDeptServiceImpl implements ISrzDeptService {
private final SrzDeptMapper baseMapper; private final SrzDeptMapper baseMapper;
@Value("${srnwg.url}")
private String znwgUrl;
@Value("${srnwg.paasId}")
private String paasId;
@Value("${srnwg.paasToken}")
private String paasToken;
/** /**
* 查询市认证对接---组织机构信息 * 查询市认证对接---组织机构信息
* *
@ -147,6 +167,12 @@ public class SrzDeptServiceImpl implements ISrzDeptService {
return baseMapper.updateById(update) > 0; return baseMapper.updateById(update) > 0;
} }
/**
* 修改市认证对接---组织机构信息
*
* @param vo 市认证对接---组织机构信息
* @return 是否修改成功
*/
@Override @Override
public Integer update(SrzDeptVo vo) { public Integer update(SrzDeptVo vo) {
SrzDept update = MapstructUtils.convert(vo, SrzDept.class); SrzDept update = MapstructUtils.convert(vo, SrzDept.class);
@ -195,4 +221,113 @@ public class SrzDeptServiceImpl implements ISrzDeptService {
return vo; return vo;
}).toList(); }).toList();
} }
/**
* 批量保存市认证对接---组织机构信息
*
* @param dataArr 数据列表
* @param token 登录token
* @return 保存结果
*/
@Override
public Map<String, Integer> saveSrzDept(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("organizationId"))) { continue; }
try {
// 返回每条拉取的成功情况
String taskId = jsonObject.getString("taskId");
String guid = jsonObject.getString("guid");
String params = "{\"token\":\"" + token + "\",\"data\":[{\"taskId\":\"" + taskId + "\",\"guid\":\""+ guid +"\",\"result\":\"SUCCESS\"}]}";
String doneStr = connect("/ebus/sfrzhqxglmk/sysDoneTorg", params);
JSONObject doneObj = JSONObject.parseObject(doneStr);
String done = doneObj.getString("success");
log.info("部门拉取完成结果 ========> {} :{}", taskId, done);
} catch (Exception e) {
log.info("部门数据下拉完成异常,异常任务id:{}",jsonObject.getString("taskId"));
e.printStackTrace();
}
SrzDept srzDept=JSONObject.parseObject(jsonObject.toString(),SrzDept.class);
if(srzDept==null)continue;
LambdaQueryWrapper<SrzDept> lqw = Wrappers.lambdaQuery();
lqw.eq(SrzDept::getOrganizationid, srzDept.getOrganizationid());
SrzDept temp=baseMapper.selectOne(lqw);
// SrzDept temp = baseMapper.selectSrzDeptById(srzDept.getOrganizationid());
srzDept.setNeedUpdate(0L);
if (null != temp && temp.getOrganizationid() != null) {
// 跟新数据库
int rowNum = baseMapper.updateSrzDept(srzDept);
updateNum += rowNum;
} else {
// 插入数据库
int rowNum = baseMapper.insertSrzDept(srzDept);
insertNum += rowNum;
}
}
Map<String, Integer> resMap = new HashedMap();
resMap.put("insertNum", insertNum);
resMap.put("updateNum", updateNum);
return resMap;
}
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();
}
} }

132
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/SrzUserServiceImpl.java

@ -1,5 +1,16 @@
package com.zdxt.enforcementcode.service.impl; package com.zdxt.enforcementcode.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.commons.collections4.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.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,6 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zdxt.enforcementcode.domain.bo.SrzUserBo; import com.zdxt.enforcementcode.domain.bo.SrzUserBo;
import com.zdxt.enforcementcode.domain.vo.SrzUserVo; import com.zdxt.enforcementcode.domain.vo.SrzUserVo;
@ -16,6 +28,8 @@ import com.zdxt.enforcementcode.domain.SrzUser;
import com.zdxt.enforcementcode.mapper.SrzUserMapper; import com.zdxt.enforcementcode.mapper.SrzUserMapper;
import com.zdxt.enforcementcode.service.ISrzUserService; import com.zdxt.enforcementcode.service.ISrzUserService;
import java.security.MessageDigest;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Collection; import java.util.Collection;
@ -33,6 +47,13 @@ public class SrzUserServiceImpl implements ISrzUserService {
private final SrzUserMapper baseMapper; private final SrzUserMapper baseMapper;
@Value("${srnwg.url}")
private String znwgUrl;
@Value("${srnwg.paasId}")
private String paasId;
@Value("${srnwg.paasToken}")
private String paasToken;
/** /**
* 查询市认证用户原始 * 查询市认证用户原始
* *
@ -192,4 +213,115 @@ public class SrzUserServiceImpl implements ISrzUserService {
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;
} }
/**
* 批量保存市认证用户原始
*
* @param dataArr 数据集合
* @param token 登录token
* @return 保存结果
*/
@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("用户拉取完成结果 ========> {} :{}", taskId, done);
} catch (Exception e) {
log.info("用户数据下拉完成异常,异常任务id:{}", jsonObject.getString("taskId"));
e.printStackTrace();
}
SrzUser srzUser=JSONObject.parseObject(jsonObject.toString(),SrzUser.class);
if(srzUser==null)continue;
LambdaQueryWrapper<SrzUser> lqw = new LambdaQueryWrapper<>();
lqw.eq(SrzUser::getUserid, srzUser.getUserid());
SrzUser temp = baseMapper.selectOne(lqw);
//SrzUser temp = baseMapper.selectUserByPrimaryKey(srzUser.getUserid());
srzUser.setNeedUpdate(0L);
if (null != temp && temp.getOrganizationid() != null) {
// 跟新数据库
LambdaUpdateWrapper<SrzUser> luw = new LambdaUpdateWrapper<>();
int rowNum = baseMapper.updateUser(srzUser);
updateNum += rowNum;
} else {
// 插入数据库
int rowNum = baseMapper.insertUser(srzUser);
insertNum += rowNum;
}
}
Map<String, Integer> resMap = new HashedMap();
resMap.put("insertNum", insertNum);
resMap.put("updateNum", updateNum);
return resMap;
}
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();
}
} }

133
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/SrzDeptMapper.xml

@ -3,4 +3,137 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zdxt.enforcementcode.mapper.SrzDeptMapper"> <mapper namespace="com.zdxt.enforcementcode.mapper.SrzDeptMapper">
<insert id="insertSrzDept" parameterType="com.zdxt.enforcementcode.domain.SrzDept">
insert into srz_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="organizationId != null and organizationId != ''">organizationId,</if>
<if test="name != null and name != ''">name,</if>
<if test="code != null and code != ''">code,</if>
<if test="effectOn != null and effectOn != ''">effectOn,</if>
<if test="taskId != null and taskId != ''">taskId,</if>
<if test="zzDisplayPath != null and zzDisplayPath != ''">zzDisplayPath,</if>
<if test="zzIsLeaf != null and zzIsLeaf != ''">zzIsLeaf,</if>
<if test="isDeleted != null and isDeleted != ''">isDeleted,</if>
<if test="isDisabled != null and isDisabled != ''">isDisabled,</if>
<if test="systemId != null and systemId != ''">systemId,</if>
<if test="zzLevel != null and zzLevel != ''">zzLevel,</if>
<if test="parentId != null and parentId != ''">parentId,</if>
<if test="sequence != null and sequence != ''">sequence,</if>
<if test="createAt != null and createAt != ''">createAt,</if>
<if test="updateAt != null and updateAt != ''">updateAt,</if>
<if test="guid != null and guid != ''">guid,</if>
<if test="isMappingUnit != null and isMappingUnit != ''">isMappingUnit,</if>
<if test="mappingUnitParentId != null and mappingUnitParentId != ''">mappingUnitParentId,</if>
<if test="srzUnitId != null and srzUnitId != ''">srzUnitId,</if>
<if test="simpleName != null and simpleName != ''">simpleName,</if>
<if test="isStatutoryOrg != null and isStatutoryOrg != ''">isStatutoryOrg,</if>
<if test="isActive != null and isActive != ''">isActive,</if>
<if test="unitStatusCode != null and unitStatusCode != ''">unitStatusCode,</if>
<if test="unitStatus != null and unitStatus != ''">unitStatus,</if>
<if test="unitType != null and unitType != ''">unitType,</if>
<if test="xzqhCode != null and xzqhCode != ''">xzqhCode,</if>
<if test="xzqh != null and xzqh != ''">xzqh,</if>
<if test="isCGManager != null and isCGManager != ''">isCGManager,</if>
<if test="isBureauOffice != null and isBureauOffice != ''">isBureauOffice,</if>
<if test="unitTypeCode != null and unitTypeCode != ''">unitTypeCode,</if>
<if test="dwxzCode != null and dwxzCode != ''">dwxzCode,</if>
<if test="dwxz != null and dwxz != ''">dwxz,</if>
<if test="unitSysTypeCode != null and unitSysTypeCode != ''">unitSysTypeCode,</if>
<if test="unitSysType != null and unitSysType != ''">unitSysType,</if>
<if test="dwxtlbms != null and dwxtlbms != ''">dwxtlbms,</if>
<if test="unitLevelCode != null and unitLevelCode != ''">unitLevelCode,</if>
<if test="unitLevel != null and unitLevel != ''">unitLevel,</if>
<if test="creditcode != null and creditcode != ''">creditcode,</if>
<if test="description != null and description != ''">description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="organizationId != null and organizationId != ''">#{organizationId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="effectOn != null and effectOn != ''">#{effectOn},</if>
<if test="taskId != null and taskId != ''">#{taskId},</if>
<if test="zzDisplayPath != null and zzDisplayPath != ''">#{zzDisplayPath},</if>
<if test="zzIsLeaf != null and zzIsLeaf != ''">#{zzIsLeaf},</if>
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if>
<if test="isDisabled != null and isDisabled != ''">#{isDisabled},</if>
<if test="systemId != null and systemId != ''">#{systemId},</if>
<if test="zzLevel != null and zzLevel != ''">#{zzLevel},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="sequence != null and sequence != ''">#{sequence},</if>
<if test="createAt != null and createAt != ''">#{createAt},</if>
<if test="updateAt != null and updateAt != ''">#{updateAt},</if>
<if test="guid != null and guid != ''">#{guid},</if>
<if test="isMappingUnit != null and isMappingUnit != ''">#{isMappingUnit},</if>
<if test="mappingUnitParentId != null and mappingUnitParentId != ''">#{mappingUnitParentId},</if>
<if test="srzUnitId != null and srzUnitId != ''">#{srzUnitId},</if>
<if test="simpleName != null and simpleName != ''">#{simpleName},</if>
<if test="isStatutoryOrg != null and isStatutoryOrg != ''">#{isStatutoryOrg},</if>
<if test="isActive != null and isActive != ''">#{isActive},</if>
<if test="unitStatusCode != null and unitStatusCode != ''">#{unitStatusCode},</if>
<if test="unitStatus != null and unitStatus != ''">#{unitStatus},</if>
<if test="unitType != null and unitType != ''">#{unitType},</if>
<if test="xzqhCode != null and xzqhCode != ''">#{xzqhCode},</if>
<if test="xzqh != null and xzqh != ''">#{xzqh},</if>
<if test="isCGManager != null and isCGManager != ''">#{isCGManager},</if>
<if test="isBureauOffice != null and isBureauOffice != ''">#{isBureauOffice},</if>
<if test="unitTypeCode != null and unitTypeCode != ''">#{unitTypeCode},</if>
<if test="dwxzCode != null and dwxzCode != ''">#{dwxzCode},</if>
<if test="dwxz != null and dwxz != ''">#{dwxz},</if>
<if test="unitSysTypeCode != null and unitSysTypeCode != ''">#{unitSysTypeCode},</if>
<if test="unitSysType != null and unitSysType != ''">#{unitSysType},</if>
<if test="dwxtlbms != null and dwxtlbms != ''">#{dwxtlbms},</if>
<if test="unitLevelCode != null and unitLevelCode != ''">#{unitLevelCode},</if>
<if test="unitLevel != null and unitLevel != ''">#{unitLevel},</if>
<if test="creditcode != null and creditcode != ''">#{creditcode},</if>
<if test="description != null and description != ''">#{description},</if>
</trim>
</insert>
<update id="updateSrzDept" parameterType="com.zdxt.enforcementcode.domain.SrzDept">
update srz_dept
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="code != null and code != ''">code = #{code},</if>
<if test="effectOn != null and effectOn != ''">effectOn = #{effectOn},</if>
<if test="taskId != null and taskId != ''">taskId = #{taskId},</if>
<if test="zzDisplayPath != null and zzDisplayPath != ''">zzDisplayPath = #{zzDisplayPath},</if>
<if test="zzIsLeaf != null and zzIsLeaf != ''">zzIsLeaf = #{zzIsLeaf},</if>
<if test="isDeleted != null and isDeleted != ''">isDeleted = #{isDeleted},</if>
<if test="isDisabled != null and isDisabled != ''">isDisabled = #{isDisabled},</if>
<if test="systemId != null and systemId != ''">systemId = #{systemId},</if>
<if test="zzLevel != null and zzLevel != ''">zzLevel = #{zzLevel},</if>
<if test="parentId != null and parentId != ''">parentId = #{parentId},</if>
<if test="sequence != null and sequence != ''">sequence = #{sequence},</if>
<if test="createAt != null and createAt != ''">createAt = #{createAt},</if>
<if test="updateAt != null and updateAt != ''">updateAt = #{updateAt},</if>
<if test="guid != null and guid != ''">guid = #{guid},</if>
<if test="isMappingUnit != null and isMappingUnit != ''">isMappingUnit = #{isMappingUnit},</if>
<if test="mappingUnitParentId != null and mappingUnitParentId != ''">mappingUnitParentId = #{mappingUnitParentId},</if>
<if test="srzUnitId != null and srzUnitId != ''">srzUnitId = #{srzUnitId},</if>
<if test="simpleName != null and simpleName != ''">simpleName = #{simpleName},</if>
<if test="isStatutoryOrg != null and isStatutoryOrg != ''">isStatutoryOrg = #{isStatutoryOrg},</if>
<if test="isActive != null and isActive != ''">isActive = #{isActive},</if>
<if test="unitStatusCode != null and unitStatusCode != ''">unitStatusCode = #{unitStatusCode},</if>
<if test="unitStatus != null and unitStatus != ''">unitStatus = #{unitStatus},</if>
<if test="unitType != null and unitType != ''">unitType = #{unitType},</if>
<if test="xzqhCode != null and xzqhCode != ''">xzqhCode = #{xzqhCode},</if>
<if test="xzqh != null and xzqh != ''">xzqh = #{xzqh},</if>
<if test="isCGManager != null and isCGManager != ''">isCGManager = #{isCGManager},</if>
<if test="isBureauOffice != null and isBureauOffice != ''">isBureauOffice = #{isBureauOffice},</if>
<if test="unitTypeCode != null and unitTypeCode != ''">unitTypeCode = #{unitTypeCode},</if>
<if test="dwxzCode != null and dwxzCode != ''">dwxzCode = #{dwxzCode},</if>
<if test="dwxz != null and dwxz != ''">dwxz = #{dwxz},</if>
<if test="unitSysTypeCode != null and unitSysTypeCode != ''">unitSysTypeCode = #{unitSysTypeCode},</if>
<if test="unitSysType != null and unitSysType != ''">unitSysType = #{unitSysType},</if>
<if test="dwxtlbms != null and dwxtlbms != ''">dwxtlbms = #{dwxtlbms},</if>
<if test="unitLevelCode != null and unitLevelCode != ''">unitLevelCode = #{unitLevelCode},</if>
<if test="unitLevel != null and unitLevel != ''">unitLevel = #{unitLevel},</if>
<if test="creditcode != null and creditcode != ''">creditcode = #{creditcode},</if>
<if test="description != null and description != ''">description=#{description},</if>
<if test="needUpdate != null and needUpdate != ''">need_update=#{needUpdate},</if>
</trim>
where organizationId = #{organizationId}
</update>
</mapper> </mapper>

188
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/SrzUserMapper.xml

@ -3,4 +3,192 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zdxt.enforcementcode.mapper.SrzUserMapper"> <mapper namespace="com.zdxt.enforcementcode.mapper.SrzUserMapper">
<!-- 安全动态更新:只更新非空字段 -->
<update id="updateUser" parameterType="com.zdxt.enforcementcode.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>
<!-- 安全动态插入:只更新非空字段 -->
<insert id="insertUser" parameterType="com.zdxt.enforcementcode.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>
</mapper> </mapper>

Loading…
Cancel
Save