|
@@ -5,20 +5,22 @@ import cc.smtweb.biz.mztb.web.base.PartyInfo; |
|
|
import cc.smtweb.biz.mztb.web.tool.DbUtil; |
|
|
import cc.smtweb.biz.mztb.web.tool.DbUtil; |
|
|
import cc.smtweb.framework.core.common.SwMap; |
|
|
import cc.smtweb.framework.core.common.SwMap; |
|
|
import cc.smtweb.framework.core.db.DbEngine; |
|
|
import cc.smtweb.framework.core.db.DbEngine; |
|
|
import cc.smtweb.framework.core.exception.BizException; |
|
|
|
|
|
|
|
|
import cc.smtweb.framework.core.db.EntityHelper; |
|
|
import cc.smtweb.framework.core.util.DateUtil; |
|
|
import cc.smtweb.framework.core.util.DateUtil; |
|
|
|
|
|
import cc.smtweb.framework.core.util.RandomUtil; |
|
|
import cc.smtweb.system.bpm.web.sys.base.job.BaseJob; |
|
|
import cc.smtweb.system.bpm.web.sys.base.job.BaseJob; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.sys.user.dept.Dept; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.sys.user.dept.DeptCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.Party; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.Party; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.sys.user.role.group.RoleGroup; |
|
|
|
|
|
import cc.smtweb.system.bpm.web.sys.user.role.group.RoleGroupCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.User; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.User; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserParty; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserParty; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserPartyCache; |
|
|
import cc.smtweb.system.bpm.web.sys.user.user.UserPartyCache; |
|
|
import com.alibaba.druid.pool.DruidPooledConnection; |
|
|
|
|
|
import com.alibaba.druid.proxy.jdbc.ConnectionProxy; |
|
|
|
|
|
import lombok.SneakyThrows; |
|
|
|
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils; |
|
|
|
|
|
|
|
|
import java.lang.invoke.SwitchPoint; |
|
|
|
|
|
import java.sql.*; |
|
|
import java.sql.*; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@@ -27,6 +29,7 @@ import java.util.function.Function; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
|
|
|
private static final String PWD_SALT = "goodpj"; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected String work() { |
|
|
protected String work() { |
|
@@ -41,12 +44,16 @@ public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
List<Party> sysPartyList = new ArrayList<>(); |
|
|
List<Party> sysPartyList = new ArrayList<>(); |
|
|
List<User> userList = new ArrayList<>(); |
|
|
List<User> userList = new ArrayList<>(); |
|
|
List<UserParty> userPartyList = new ArrayList<>(); |
|
|
List<UserParty> userPartyList = new ArrayList<>(); |
|
|
|
|
|
List<Dept> deptList = new ArrayList<>(); |
|
|
|
|
|
List<String> ptIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// 记录重复数据 |
|
|
// 记录重复数据 |
|
|
List<PartyInfo> partysInsertListExist = new ArrayList<>(); |
|
|
List<PartyInfo> partysInsertListExist = new ArrayList<>(); |
|
|
List<Party> sysPartyListExist = new ArrayList<>(); |
|
|
List<Party> sysPartyListExist = new ArrayList<>(); |
|
|
List<User> userListExist = new ArrayList<>(); |
|
|
List<User> userListExist = new ArrayList<>(); |
|
|
List<UserParty> userPartyListExist = new ArrayList<>(); |
|
|
List<UserParty> userPartyListExist = new ArrayList<>(); |
|
|
|
|
|
List<Dept> deptListExist = new ArrayList<>(); |
|
|
|
|
|
List<String> ptIdListExist = new ArrayList<>(); |
|
|
|
|
|
|
|
|
SwMap existPartyMap = new SwMap(); |
|
|
SwMap existPartyMap = new SwMap(); |
|
|
int insertIndex = 0; |
|
|
int insertIndex = 0; |
|
@@ -84,6 +91,8 @@ public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
userListExist.add(userList.get(index)); |
|
|
userListExist.add(userList.get(index)); |
|
|
userPartyListExist.add(userPartyList.get(index)); |
|
|
userPartyListExist.add(userPartyList.get(index)); |
|
|
sysPartyListExist.add(sysPartyList.get(index)); |
|
|
sysPartyListExist.add(sysPartyList.get(index)); |
|
|
|
|
|
deptListExist.add(deptList.get(index)); |
|
|
|
|
|
ptIdListExist.add(ptIdList.get(index)); |
|
|
} |
|
|
} |
|
|
existPartyMap.put(resultSet.getString("pi_credit_code"), insertIndex); |
|
|
existPartyMap.put(resultSet.getString("pi_credit_code"), insertIndex); |
|
|
insertIndex++; |
|
|
insertIndex++; |
|
@@ -97,6 +106,8 @@ public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
partyInfo.setSysPartyId(ptId); |
|
|
partyInfo.setSysPartyId(ptId); |
|
|
sysPartyList.add(party); |
|
|
sysPartyList.add(party); |
|
|
partysInsertList.add(partyInfo); |
|
|
partysInsertList.add(partyInfo); |
|
|
|
|
|
// 添加机构id |
|
|
|
|
|
ptIdList.add(ptId + ""); |
|
|
|
|
|
|
|
|
User user = new User(); // 底层用户表 |
|
|
User user = new User(); // 底层用户表 |
|
|
user.init(); |
|
|
user.init(); |
|
@@ -107,17 +118,27 @@ public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
user.setNicky(partyInfo.getCreditCode()); |
|
|
user.setNicky(partyInfo.getCreditCode()); |
|
|
user.setLevel(100); |
|
|
user.setLevel(100); |
|
|
user.setStatu(1); |
|
|
user.setStatu(1); |
|
|
user.setPwd("13217b04835b4cbceb55edb54a72deb4"); //默认密码 abc@123456 |
|
|
|
|
|
|
|
|
// user.setPwd("13217b04835b4cbceb55edb54a72deb4"); //默认密码 abc@123456 |
|
|
|
|
|
user.setPwd(DigestUtils.md5Hex(PWD_SALT + user.getId() + "abc@123456")); //默认密码 abc@123456 |
|
|
user.setPwdLevel(0); |
|
|
user.setPwdLevel(0); |
|
|
userList.add(user); |
|
|
userList.add(user); |
|
|
|
|
|
|
|
|
// todo 添加部门 |
|
|
|
|
|
|
|
|
Dept dept = new Dept();// 添加部门 |
|
|
|
|
|
dept.init(); |
|
|
|
|
|
long deptId = instance.nextId(); |
|
|
|
|
|
dept.setId(deptId); |
|
|
|
|
|
dept.setCode(RandomUtil.randomString(8)); |
|
|
|
|
|
dept.setName("填报部门"); |
|
|
|
|
|
dept.setType("100"); |
|
|
|
|
|
dept.setPtId(ptId); |
|
|
|
|
|
dept.setStatu(0); |
|
|
|
|
|
deptList.add(dept); |
|
|
|
|
|
|
|
|
UserParty userParty = new UserParty(); //用户机构关联表 |
|
|
UserParty userParty = new UserParty(); //用户机构关联表 |
|
|
userParty.setId(instance.nextId()); |
|
|
userParty.setId(instance.nextId()); |
|
|
userParty.setPartyId(ptId); |
|
|
userParty.setPartyId(ptId); |
|
|
userParty.setUserId(userId); |
|
|
userParty.setUserId(userId); |
|
|
userParty.setDeptId(869944043285516288L); // 关联部门表 |
|
|
|
|
|
|
|
|
userParty.setDeptId(deptId); // 关联部门表 |
|
|
userPartyList.add(userParty); |
|
|
userPartyList.add(userParty); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@@ -127,6 +148,8 @@ public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
sysPartyList.removeAll(sysPartyListExist); |
|
|
sysPartyList.removeAll(sysPartyListExist); |
|
|
userList.removeAll(userListExist); |
|
|
userList.removeAll(userListExist); |
|
|
userPartyList.removeAll(userPartyListExist); |
|
|
userPartyList.removeAll(userPartyListExist); |
|
|
|
|
|
deptList.removeAll(deptListExist); |
|
|
|
|
|
ptIdList.removeAll(ptIdListExist); |
|
|
|
|
|
|
|
|
// 读取完成后 修改前置库推送数据的状态,再进行本系统数据入库处理 |
|
|
// 读取完成后 修改前置库推送数据的状态,再进行本系统数据入库处理 |
|
|
dbUtil.update("update pre_party_info set state = 1 , rd_time = " + DateUtil.nowDateTimeNumber() + " where state = 0"); |
|
|
dbUtil.update("update pre_party_info set state = 1 , rd_time = " + DateUtil.nowDateTimeNumber() + " where state = 0"); |
|
@@ -138,10 +161,19 @@ public class AddNewPartyAndAccountTask extends BaseJob { |
|
|
instance.findDao(Party.class).batchInsertEntity(sysPartyList); |
|
|
instance.findDao(Party.class).batchInsertEntity(sysPartyList); |
|
|
instance.findDao(User.class).batchInsertEntity(userList); |
|
|
instance.findDao(User.class).batchInsertEntity(userList); |
|
|
instance.findDao(UserParty.class).batchInsertEntity(userPartyList); |
|
|
instance.findDao(UserParty.class).batchInsertEntity(userPartyList); |
|
|
// 将机构、用户信息放入缓存 |
|
|
|
|
|
|
|
|
instance.findDao(Dept.class).batchInsertEntity(deptList); |
|
|
|
|
|
|
|
|
|
|
|
// 将新增的机构 加入角色组的 机构字段 |
|
|
|
|
|
if (ptIdList.size() > 0) { |
|
|
|
|
|
instance.update("UPDATE " + EntityHelper.getSchemaTableName(RoleGroup.ENTITY_NAME) |
|
|
|
|
|
+ " SET srg_party_id = CONCAT(srg_party_id,',' ,'" + String.join(",", ptIdList) + "') where srg_id = ? ", 927515588790587392L); // 角色组填报员 |
|
|
|
|
|
} |
|
|
|
|
|
// 将机构、用户信息放入缓存,或者刷新缓存 |
|
|
PartyCache.getInstance().putList(sysPartyList); |
|
|
PartyCache.getInstance().putList(sysPartyList); |
|
|
UserCache.getInstance().putList(userList); |
|
|
UserCache.getInstance().putList(userList); |
|
|
UserPartyCache.getInstance().putList(userPartyList); |
|
|
UserPartyCache.getInstance().putList(userPartyList); |
|
|
|
|
|
DeptCache.getInstance().putList(deptList); |
|
|
|
|
|
RoleGroupCache.getInstance().refresh(); |
|
|
}); |
|
|
}); |
|
|
} catch (SQLException e) { |
|
|
} catch (SQLException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|