Browse Source

朝阳统计系统汇总

master
杨旭东 4 months ago
parent
commit
6e4f850b3e
29 changed files with 549 additions and 172 deletions
  1. +5
    -0
      .idea/jarRepositories.xml
  2. +1
    -1
      mztb/src/main/java/cc/smtweb/biz/mztb/web/MztbStartedListener.java
  3. +11
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/FillOut.java
  4. +14
    -1
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler.java
  5. +45
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillService.java
  6. +230
    -168
      mztb/src/main/java/cc/smtweb/biz/mztb/web/controller/MztbController.java
  7. +47
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/patch/Patch0_002.java
  8. +86
    -1
      mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillCard.js
  9. +2
    -1
      mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillList.js
  10. +27
    -0
      mztb/src/main/resources/upgrade/mztb/dmsql/patch_0.002.sql
  11. +27
    -0
      mztb/src/main/resources/upgrade/mztb/kbsql/patch_0.002.sql
  12. +27
    -0
      mztb/src/main/resources/upgrade/mztb/mysql/patch_0.002.sql
  13. +27
    -0
      mztb/src/main/resources/upgrade/mztb/stsql/patch_0.002.sql
  14. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/MztbStartedListener.class
  15. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/FillOut.class
  16. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/PartyInfo.class
  17. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataCustomHandler.class
  18. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler$PartyDataFillModelListHandler.class
  19. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler$PartyDataFillModelLoadHandler.class
  20. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler$PartyDataFillModelSaveHandler.class
  21. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler.class
  22. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillService.class
  23. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/domian/FillTask.class
  24. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/task/AddNewPartyAndAccountTask.class
  25. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/task/PushTask.class
  26. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/tool/DbUtil.class
  27. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/widgetManage/TaskMonthHandler$TaskMonthListHandler.class
  28. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/widgetManage/TaskMonthHandler$TaskMonthLoadHandler.class
  29. BIN
      mztb/target/classes/cc/smtweb/biz/mztb/web/widgetManage/TaskMonthHandler.class

+ 5
- 0
.idea/jarRepositories.xml View File

@@ -26,5 +26,10 @@
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://47.92.149.153:7000/repository/maven-public/" />
</remote-repository>
</component>
</project>

+ 1
- 1
mztb/src/main/java/cc/smtweb/biz/mztb/web/MztbStartedListener.java View File

@@ -14,7 +14,7 @@ public class MztbStartedListener implements IStartListener {

@Override
public double versionTo() {
return 0.001;
return 0.002;
}
@Override
public int order() {


+ 11
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/FillOut.java View File

@@ -97,4 +97,15 @@ public class FillOut extends DefaultEntity {
public void setReadTime(long fo_read_time) {
put("fo_read_time", fo_read_time);
}


/** 状态 */
public int getReadState() {
return getInt("fo_read_state");
}

/** 状态 */
public void setReadState(int fo_read_state) {
put("fo_read_state", fo_read_state);
}
}

+ 14
- 1
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler.java View File

@@ -33,6 +33,7 @@ public class PartyDataFillHandler {
@Override
public void readFromPage(SwMap pageData, SwMap filter) {
super.readFromPage(pageData, filter);
this.bean.setState(0);
if(bean.getType() == 2) {
yearEndPersons = readBeanFromPage(YEAR_END_PERSONS_DS_NAME, pageData, filter);// yearEndPersonsForm
}
@@ -170,7 +171,19 @@ public class PartyDataFillHandler {
temp.put("fo_type_text",anInt == 1 ? "月报": "年报");
temp.put("fo_task_text",temp.readString("fo_task").contains("99") ? temp.readString("fo_task").replace("99","年(年报)")
: String.format("%d年%02d月 (月报)",temp.readLong("fo_task") / 100, temp.readLong("fo_task") % 100));
temp.put("fo_state_text",temp.readInt("fo_state") == 0 ? "待确认" : temp.readInt("fo_state") == 1 ? "已确认" : "已推送");
String state = "待确认";
switch (temp.readInt("fo_state")){
case 1:
state = "已确认";
break;
case 2:
state = "已推送";
break;
case 3:
state = "已驳回";
break;
}
temp.put("fo_state_text", state);
});
}
}


+ 45
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillService.java View File

@@ -1,13 +1,25 @@
package cc.smtweb.biz.mztb.web.base.partyDataFill;

import cc.smtweb.biz.mztb.web.base.BusinessInfo;
import cc.smtweb.biz.mztb.web.base.FillOut;
import cc.smtweb.biz.mztb.web.base.FinanceInfo;
import cc.smtweb.biz.mztb.web.base.YearEndPersons;
import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.DictsCache;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.model.listcard.lcms.LCMsService;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
* Created by 1 at 2023-12-19 11:06:53
* 页面【[机构数据填报编辑]的服务类
@@ -57,4 +69,37 @@ public class PartyDataFillService extends LCMsService {
return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).checkRepetition(params, us));
}


public R getData(@SwBody SwMap params, UserSession us){
SwMap swMap = new SwMap();

//1是月报 2 是年报
int type = params.readInt("type");
//年末数据
int year = params.readInt("year");

String sql ="select fo_id,fo_task\n" +
"from "+EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)+" a\n" +
"where a.fo_task = (select max(fo_task) from "+EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)+" where fo_party_id=?)\n" +
"and fo_party_id=? and fo_state <>-1";
FillOut fillOut = DbEngine.getInstance().queryEntity(sql, FillOut.class, us.getPartyId(),us.getPartyId());
BusinessInfo businessInfo = DbEngine.getInstance().findDao(BusinessInfo.class).queryEntityWhere("bi_fo_id=?",fillOut.getId());
if (EntityHelper.isEmpty(businessInfo)) throw new BizException("未查询到相关的业务信息!");
businessInfo.put("bi_type_text", DictsCache.getInstance().getItemName("tbBusinessType",businessInfo.getType()));
businessInfo.put("bi_property_text", DictsCache.getInstance().getItemName("tbNature",businessInfo.getProperty()));
businessInfo.put("bi_initiate_text", DictsCache.getInstance().getItemName("tbSubject",businessInfo.getInitiate()));
businessInfo.put("bi_execute_regimen_text", DictsCache.getInstance().getItemName("tbKJZD",businessInfo.getExecuteRegimen()));
swMap.put("businessInfo",businessInfo);
FinanceInfo financeInfo = DbEngine.getInstance().findDao(FinanceInfo.class).queryEntityWhere("fi_fo_id=?",fillOut.getId());
if (EntityHelper.isEmpty(financeInfo)) throw new BizException("未查询到相关的财务信息!");

swMap.put("financeInfo",financeInfo);
if (year == 1){
YearEndPersons yearEndPersons = DbEngine.getInstance().findDao(YearEndPersons.class).queryEntityWhere("yep_fo_id=?",fillOut.getId());
if (EntityHelper.isEmpty(yearEndPersons)) throw new BizException("未查询到相关的年末人数信息!");
swMap.put("yearEndPersons",yearEndPersons);
}
return R.success(swMap);
}

}

+ 230
- 168
mztb/src/main/java/cc/smtweb/biz/mztb/web/controller/MztbController.java View File

@@ -1,7 +1,6 @@
package cc.smtweb.biz.mztb.web.controller;

import cc.smtweb.biz.mztb.web.base.*;
import cc.smtweb.biz.mztb.web.tool.UtilPub;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
@@ -16,18 +15,16 @@ 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.*;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;

@@ -46,179 +43,218 @@ public class MztbController {
public R pushWork(@RequestBody SwMap swMap) {
// addNewPartyAccount();
DbEngine instance = DbEngine.getInstance();
List<Map<String, Object>> updatePartyList = swMap.readListMap("data");
if (swMap.containsKey("isRet")){
String codes = swMap.readString("code");
if (codes.isEmpty()){
return R.error(2,"未获取到需要删除的统一社会信用代码!");
}
//先将所有需要删除的用户查出 然后根据id去删除其他相关表数据
List<String> codeList = Arrays.stream(codes.split(",")).collect(Collectors.toList());
List<String> code = new ArrayList<>();
codeList.forEach(temp->{
code.add("'"+temp+"'");
});
List<User> userList = instance.query("select * from " + EntityHelper.getSchemaTableName(User.ENTITY_NAME) + " where sur_nicky in (" + String.join(",",code) + ")", User.class);
if (userList.isEmpty()){
log.info("查询失败!");
return R.success();
}
List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
List<String> ids = new ArrayList<>();
userIds.forEach(temp->ids.add(temp+""));
AtomicInteger num = new AtomicInteger();
instance.doTrans(()->{
//单位信息表
instance.update("delete from " + EntityHelper.getSchemaTableName(PartyInfo.ENTITY_NAME) + " where pi_credit_code in (" + String.join(",",code) + ")");
//用户表
num.set(instance.findDao(User.class).batchDelete(userList));
});

if (updatePartyList == null || updatePartyList.size() < 1) {
log.info("请求携带需要更新的机构数据为空!");
return R.success();
}
log.debug("获取到数据:"+updatePartyList.size()+"条,准备处理机构数据。。。。。");

// 批量处理的数据
List<PartyInfo> partysUpdateList = new ArrayList<>();
List<PartyInfo> partysInsertList = new ArrayList<>();
List<Party> sysPartyList = new ArrayList<>();
List<User> userList = new ArrayList<>();
List<UserParty> userPartyList = new ArrayList<>();
List<Dept> deptList = new ArrayList<>();
List<UserRole> userRoleList = new ArrayList<>();
List<UserStatu> userStatuList = new ArrayList<>();

List<String> ptIdList = new ArrayList<>();

// 记录重复数据
List<PartyInfo> partysInsertListExist = new ArrayList<>();
List<Party> sysPartyListExist = new ArrayList<>();
List<User> userListExist = new ArrayList<>();
List<UserParty> userPartyListExist = new ArrayList<>();
List<Dept> deptListExist = new ArrayList<>();
List<String> ptIdListExist = new ArrayList<>();
List<UserRole> userRoleListExist = new ArrayList<>();
List<UserStatu> userStatuListExist = new ArrayList<>();

SwMap existPartyMap = new SwMap();
int insertIndex = 0;
// 使用社会信用代码 当做key 查询当前机构信息
Map<String, PartyInfo> partyInfoMap = instance.query(PartyInfo.class).stream().collect(Collectors.toMap(PartyInfo::getCreditCode, Function.identity()));
for (Map<String, Object> map : updatePartyList) {
PartyInfo partyInfo = new PartyInfo();
SwMap updatePartySwMap = new SwMap();
for (String key : map.keySet()) { // 注意民政端推送数据的字段和填报系统字段要一致
updatePartySwMap.put(key, map.get(key));
if (num.get() == codeList.size()){
log.info("删除成功!");
return R.success();
}else {
log.info("删除失败!");
List<User> users = instance.queryWhere(User.class, " sur_nicky in (" + codes + ")");
String retCodes = users.stream().map(User::getNicky).collect(Collectors.joining(","));
return R.error(3,retCodes);
}
// 将查询到的数据转为 填报系统机构表数据
partyInfo.getData().putAll(updatePartySwMap);
if (partyInfoMap.containsKey(map.get("pi_credit_code") + "")) { // 判断该机构是否存在
long piIdOld = partyInfoMap.get(map.get("pi_credit_code") + "").getId();
long sysPartyId = partyInfoMap.get(map.get("pi_credit_code") + "").getSysPartyId();
partyInfo.setId(piIdOld);
partyInfo.setSysPartyId(sysPartyId);
partysUpdateList.add(partyInfo);
} else { // 新增(包括 底层的party 填报系统的 partyInfo 默认的用户)
boolean existParty = existPartyMap.containsKey(map.get("pi_credit_code") + "");
if (existParty) {
// 包含就更新机构信息 ,系统机构信息没有可更改的内容故不处理
int index = existPartyMap.readInt(map.get("pi_credit_code") + "");
partysInsertListExist.add(partysInsertList.get(index));
userListExist.add(userList.get(index));
userPartyListExist.add(userPartyList.get(index));
sysPartyListExist.add(sysPartyList.get(index));
deptListExist.add(deptList.get(index));
userRoleListExist.add(userRoleList.get(index));
userStatuListExist.add(userStatuList.get(index));
ptIdListExist.add(ptIdList.get(index));

}else {
List<Map<String, Object>> updatePartyList = swMap.readListMap("data");

if (updatePartyList == null || updatePartyList.size() < 1) {
log.info("请求携带需要更新的机构数据为空!");
return R.success();
}
log.debug("获取到数据:"+updatePartyList.size()+"条,准备处理机构数据。。。。。");

// 批量处理的数据
List<PartyInfo> partysUpdateList = new ArrayList<>();
List<PartyInfo> partysInsertList = new ArrayList<>();
List<Party> sysPartyList = new ArrayList<>();
List<User> userList = new ArrayList<>();
List<UserParty> userPartyList = new ArrayList<>();
List<Dept> deptList = new ArrayList<>();
List<UserRole> userRoleList = new ArrayList<>();
List<UserStatu> userStatuList = new ArrayList<>();

List<String> ptIdList = new ArrayList<>();

// 记录重复数据
List<PartyInfo> partysInsertListExist = new ArrayList<>();
List<Party> sysPartyListExist = new ArrayList<>();
List<User> userListExist = new ArrayList<>();
List<UserParty> userPartyListExist = new ArrayList<>();
List<Dept> deptListExist = new ArrayList<>();
List<String> ptIdListExist = new ArrayList<>();
List<UserRole> userRoleListExist = new ArrayList<>();
List<UserStatu> userStatuListExist = new ArrayList<>();

SwMap existPartyMap = new SwMap();
int insertIndex = 0;
// 使用社会信用代码 当做key 查询当前机构信息
Map<String, PartyInfo> partyInfoMap = instance.query(PartyInfo.class).stream().collect(Collectors.toMap(PartyInfo::getCreditCode, Function.identity()));
for (Map<String, Object> map : updatePartyList) {
PartyInfo partyInfo = new PartyInfo();
SwMap updatePartySwMap = new SwMap();
for (String key : map.keySet()) { // 注意民政端推送数据的字段和填报系统字段要一致
updatePartySwMap.put(key, map.get(key));
}
partyInfo.setId(instance.nextId());
existPartyMap.put(map.get("pi_credit_code") + "", insertIndex);
insertIndex++;
// 将查询到的数据转为 填报系统机构表数据
partyInfo.getData().putAll(updatePartySwMap);
if (partyInfoMap.containsKey(map.get("pi_credit_code") + "")) { // 判断该机构是否存在
long piIdOld = partyInfoMap.get(map.get("pi_credit_code") + "").getId();
long sysPartyId = partyInfoMap.get(map.get("pi_credit_code") + "").getSysPartyId();
partyInfo.setId(piIdOld);
partyInfo.setSysPartyId(sysPartyId);
partysUpdateList.add(partyInfo);
} else { // 新增(包括 底层的party 填报系统的 partyInfo 默认的用户)
boolean existParty = existPartyMap.containsKey(map.get("pi_credit_code") + "");
if (existParty) {
// 包含就更新机构信息 ,系统机构信息没有可更改的内容故不处理
int index = existPartyMap.readInt(map.get("pi_credit_code") + "");
partysInsertListExist.add(partysInsertList.get(index));
userListExist.add(userList.get(index));
userPartyListExist.add(userPartyList.get(index));
sysPartyListExist.add(sysPartyList.get(index));
deptListExist.add(deptList.get(index));
userRoleListExist.add(userRoleList.get(index));
userStatuListExist.add(userStatuList.get(index));
ptIdListExist.add(ptIdList.get(index));
}
partyInfo.setId(instance.nextId());
existPartyMap.put(map.get("pi_credit_code") + "", insertIndex);
insertIndex++;

Party party = new Party(); // 底层机构表
party.init();
Party party = new Party(); // 底层机构表
party.init();
// long ptId = Long.parseLong(map.get("pi_id") + "");
// party.setId(ptId);
// party.setCode(ptId + "");
party.setId(partyInfo.getId());
party.setCode(partyInfo.getId() + "");
party.setName(partyInfo.getPartyName());
party.setType(101);
party.setAreaId(Long.parseLong(partyInfo.getAreaCode()));
party.setId(partyInfo.getId());
party.setCode(partyInfo.getId() + "");
party.setName(partyInfo.getPartyName());
party.setType(101);
party.setAreaId(Long.parseLong(partyInfo.getAreaCode()));
// partyInfo.setSysPartyId(ptId);
sysPartyList.add(party);
partysInsertList.add(partyInfo);
// 添加机构id
ptIdList.add(partyInfo.getId() + "");

User user = new User(); // 底层用户表
user.init();
long userId = instance.nextId();
user.setId(userId);
user.setCode(partyInfo.getCreditCode());
user.setName(partyInfo.getPartyName() + "-填报人员");
user.setNicky(partyInfo.getCreditCode());
user.setLevel(100);
user.setStatu(1);
sysPartyList.add(party);
partysInsertList.add(partyInfo);
// 添加机构id
ptIdList.add(partyInfo.getId() + "");
User user = new User(); // 底层用户表
user.init();
long userId = instance.nextId();
user.setId(userId);
user.setCode(partyInfo.getCreditCode());
user.setName(partyInfo.getPartyName() + "-填报人员");
user.setNicky(partyInfo.getCreditCode());
user.setLevel(100);
user.setStatu(1);
// user.setPwd("13217b04835b4cbceb55edb54a72deb4"); //默认密码 abc@123456
user.setPwd(DigestUtils.md5Hex(PWD_SALT + user.getId() + "abc@123456")); //默认密码 abc@123456
user.setPwdLevel(0);
userList.add(user);

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(partyInfo.getId());
dept.setStatu(0);
deptList.add(dept);

UserParty userParty = new UserParty(); //用户机构关联表
long userPartyId = instance.nextId();
userParty.setId(userPartyId);
userParty.setPartyId(partyInfo.getId());
userParty.setUserId(userId);
userParty.setDeptId(deptId); // 关联部门表
userPartyList.add(userParty);

UserRole userRole = new UserRole(); // 用户角色
userRole.setId(instance.nextId());
userRole.setSupId(userPartyId);
userRole.setRoleGroupId(927515588790587392L); // 角色组id todo 先写死 一般不会变
userRoleList.add(userRole);

UserStatu userStatu = new UserStatu(); // 用户登录状态
userStatu.init();
userStatu.setId(userId);
userStatuList.add(userStatu);
}
}
user.setPwd(DigestUtils.md5Hex(PWD_SALT + user.getId() + "abc@123456")); //默认密码 abc@123456
user.setPwdLevel(0);
userList.add(user);

// 删除重复新增的元素
partysInsertList.removeAll(partysInsertListExist);
sysPartyList.removeAll(sysPartyListExist);
userList.removeAll(userListExist);
userPartyList.removeAll(userPartyListExist);
deptList.removeAll(deptListExist);
userRoleList.removeAll(userRoleListExist);
userStatuList.removeAll(userStatuListExist);
ptIdList.removeAll(ptIdListExist);

log.debug("数据构建完成,向数据库写入数据");
instance.doTrans(() -> {
// 处理新增或者修改的数据
instance.findDao(PartyInfo.class).batchInsertEntity(partysInsertList);
instance.findDao(PartyInfo.class).batchUpdateEntity(partysUpdateList);
instance.findDao(Party.class).batchInsertEntity(sysPartyList);
instance.findDao(User.class).batchInsertEntity(userList);
instance.findDao(UserParty.class).batchInsertEntity(userPartyList);
instance.findDao(Dept.class).batchInsertEntity(deptList);
instance.findDao(UserRole.class).batchInsertEntity(userRoleList);
instance.findDao(UserStatu.class).batchInsertEntity(userStatuList);
log.debug("数据写入完成-----");

// 将新增的机构 加入角色组的 机构字段
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); // 角色组填报员
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(partyInfo.getId());
dept.setStatu(0);
deptList.add(dept);

UserParty userParty = new UserParty(); //用户机构关联表
long userPartyId = instance.nextId();
userParty.setId(userPartyId);
userParty.setPartyId(partyInfo.getId());
userParty.setUserId(userId);
userParty.setDeptId(deptId); // 关联部门表
userPartyList.add(userParty);

UserRole userRole = new UserRole(); // 用户角色
userRole.setId(instance.nextId());
userRole.setSupId(userPartyId);
userRole.setRoleGroupId(927515588790587392L); // 角色组id todo 先写死 一般不会变
userRoleList.add(userRole);

UserStatu userStatu = new UserStatu(); // 用户登录状态
userStatu.init();
userStatu.setId(userId);
userStatuList.add(userStatu);
}
}
// 将机构、用户信息放入缓存,或者刷新缓存

// 删除重复新增的元素
partysInsertList.removeAll(partysInsertListExist);
sysPartyList.removeAll(sysPartyListExist);
userList.removeAll(userListExist);
userPartyList.removeAll(userPartyListExist);
deptList.removeAll(deptListExist);
userRoleList.removeAll(userRoleListExist);
userStatuList.removeAll(userStatuListExist);
ptIdList.removeAll(ptIdListExist);

log.debug("数据构建完成,向数据库写入数据");
instance.doTrans(() -> {
// 处理新增或者修改的数据
instance.findDao(PartyInfo.class).batchInsertEntity(partysInsertList);
instance.findDao(PartyInfo.class).batchUpdateEntity(partysUpdateList);
instance.findDao(Party.class).batchInsertEntity(sysPartyList);
instance.findDao(User.class).batchInsertEntity(userList);
instance.findDao(UserParty.class).batchInsertEntity(userPartyList);
instance.findDao(Dept.class).batchInsertEntity(deptList);
instance.findDao(UserRole.class).batchInsertEntity(userRoleList);
instance.findDao(UserStatu.class).batchInsertEntity(userStatuList);
log.debug("数据写入完成-----");

// 将新增的机构 加入角色组的 机构字段
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().refresh();
PartyCache.getInstance().refresh();
// UserCache.getInstance().putList(userList);
UserCache.getInstance().refresh();
UserCache.getInstance().refresh();
// UserPartyCache.getInstance().putList(userPartyList);
UserPartyCache.getInstance().refresh();
UserPartyCache.getInstance().refresh();
// DeptCache.getInstance().putList(deptList);
DeptCache.getInstance().refresh();
DeptCache.getInstance().refresh();
// UserRoleCache.getInstance().putList(userRoleList);
UserRoleCache.getInstance().refresh();
UserRoleCache.getInstance().refresh();
// UserStatuCache.getInstance().putList(userStatuList);
UserStatuCache.getInstance().refresh();
RoleGroupCache.getInstance().refresh();
log.debug("机构缓存刷新完成!");
});
return R.success();
UserStatuCache.getInstance().refresh();
RoleGroupCache.getInstance().refresh();
log.debug("机构缓存刷新完成!");
});
return R.success();
}
}


@@ -230,18 +266,22 @@ public class MztbController {
String data = swMap.readString("data");
boolean rollBack = swMap.readBool("rollBack", false);
if (rollBack) {
String fillOutIds = swMap.readString("fillOutIds");
List<String> collect = Arrays.stream(fillOutIds.split(",")).collect(Collectors.toList());
if (StringUtil.isEmpty(fillOutIds)) return R.success();
instance.update("update " + EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)
+ " set fo_read_state = 1,fo_state = 1 where fo_id in (" + StringUtil.join(collect, ",") + ")");
List<String> successList = swMap.readListString("success");
List<String> errorList = swMap.readListString("error");
DbEngine.getInstance().doTrans(()->{
instance.update("update " + EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)
+ " set fo_read_state = 1,fo_state = 1 where fo_id in (" + StringUtil.join(errorList, ",") + ")");
instance.update("update " + EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)
+ " set fo_read_time = ?, fo_read_state = 0 ,fo_state = 2 where fo_id in (" + StringUtil.join(successList, ",") + ")", DateUtil.nowDateTimeLong());
});

return R.success();
}

// 查询已确认还未推送和未成功 并且为指定任务月的填报数据
List<String> fillOutList = instance.queryStringList(
"select fo_id from " + EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)
+ " where fo_state = 1 and fo_read_state != 0 and fo_task in (" + data + ") ");
+ " where fo_state = 1 and fo_read_state =-1 and fo_task in (" + data + ") ");
if (fillOutList.size() == 0) {
log.info("未找到还未推送的数据");
return R.success();
@@ -255,9 +295,31 @@ public class MztbController {

List<SwMap> query = instance.query(sql, SwMap.class);

instance.update("update " + EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)
+ " set fo_read_time = ?, fo_read_state = 0 ,fo_state = 2 where fo_id in (" + StringUtil.join(fillOutList, ",") + ")", DateUtil.nowDateTimeLong());
return R.success(query);
}

@PostMapping("/dataReject")
@ResponseBody
public R dataRejectWorker(@RequestBody SwMap swMap) {
DbEngine instance = DbEngine.getInstance();
List<String> data = swMap.readListString("data");
String sql ="update "+EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)+" set fo_state=3,fo_read_state=-1 where fo_id in ("+String.join(",",data)+")";
int update = instance.update(sql);
if (data.size() != update){
List<FillOut> fillOuts = instance.findDao(FillOut.class).queryWhere(" fo_id in (" + String.join(",", data) + ")");
List<String> errorList = new ArrayList<>();
for (FillOut fillOut : fillOuts) {
if (fillOut.getState() == 2 && fillOut.getReadState() == 0){
errorList.add(fillOut.getId()+"");
}
}
return R.error(1,String.join(",",errorList));
}else {
return R.success();
}
}




}

+ 47
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/patch/Patch0_002.java View File

@@ -0,0 +1,47 @@
package cc.smtweb.biz.mztb.web.patch;

import cc.smtweb.framework.core.annotation.SwPatch;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.patch.IPatch;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.EncodedResource;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;


/**
*
*/
@SwPatch
public class Patch0_002 implements IPatch {
@Override
public double version() {
return 0.002;
}

@Override
public String versionDesc() {
return "";
}

@Override
public void upgradeDb() {

}

@Override
public List<EncodedResource> scriptFiles() {
List<EncodedResource> files = new ArrayList<>();
String dbType = DbEngine.getInstance().getDbType();
EncodedResource resource = new EncodedResource(new ClassPathResource("upgrade/mztb/"+dbType+"/patch_0.002.sql"), StandardCharsets.UTF_8);
files.add(resource);
return files;
}

@Override
public void upgrade() {

}
}

+ 86
- 1
mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillCard.js View File

@@ -12,7 +12,89 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillCard", {

};

$lifecycle.onLoad = () => {
$lifecycle.onLoad =async () => {
if ($params.$fromAction === 'button:add' && $params.outOldData === "1"){
const rt = await $$http.post("mztb/partyDataFill/getData", {
year: $params.year
}).then((res)=>{
if (res.code === 0){
let businessForm = res.data.businessInfo;
$model.businessForm.data.form.bi_type = businessForm.bi_type
$model.businessForm.data.form.bi_type_text = businessForm.bi_type_text
$model.businessForm.data.form.bi_property = businessForm.bi_property
$model.businessForm.data.form.bi_property_text = businessForm.bi_property_text
$model.businessForm.data.form.bi_initiate = businessForm.bi_initiate
$model.businessForm.data.form.bi_initiate_text = businessForm.bi_initiate_text
$model.businessForm.data.form.bi_isolate = businessForm.bi_isolate
$model.businessForm.data.form.bi_medical_card = businessForm.bi_medical_card
$model.businessForm.data.form.bi_medical_code = businessForm.bi_medical_code
$model.businessForm.data.form.bi_year_end_employee_number = businessForm.bi_year_end_employee_number
$model.businessForm.data.form.bi_year_end_emp_miss = businessForm.bi_year_end_emp_miss
$model.businessForm.data.form.bi_year_end_medic = businessForm.bi_year_end_medic
$model.businessForm.data.form.bi_year_end_zk = businessForm.bi_year_end_zk
$model.businessForm.data.form.bi_year_end_bk = businessForm.bi_year_end_bk
$model.businessForm.data.form.bi_assistant = businessForm.bi_assistant
$model.businessForm.data.form.bi_engineer = businessForm.bi_engineer
$model.businessForm.data.form.bi_thirty_five = businessForm.bi_thirty_five
$model.businessForm.data.form.bi_forty_five = businessForm.bi_forty_five
$model.businessForm.data.form.bi_fifty_five = businessForm.bi_fifty_five
$model.businessForm.data.form.bi_fifty_five_above = businessForm.bi_fifty_five_above
$model.businessForm.data.form.bi_party_manage_sp = businessForm.bi_party_manage_sp
$model.businessForm.data.form.bi_sp_nursing_assistant = businessForm.bi_sp_nursing_assistant
$model.businessForm.data.form.bi_party_manage = businessForm.bi_party_manage
$model.businessForm.data.form.bi_execute_regimen = businessForm.bi_execute_regimen
$model.businessForm.data.form.bi_execute_regimen_text = businessForm.bi_execute_regimen_text

let financeInfo = res.data.financeInfo;
debugger
$model.financeForm.data.form.fi_stock = financeInfo.fi_stock
// $model.financeForm.data.form.fi_stock_text = changeMoney(financeInfo.fi_stock)
$model.financeForm.data.form.fi_fixed_assets= financeInfo.fi_fixed_assets
$model.financeForm.data.form.fi_property_total= financeInfo.fi_property_total
$model.financeForm.data.form.fi_liabilities_total= financeInfo.fi_liabilities_total
$model.financeForm.data.form.fi_year_income_total= financeInfo.fi_year_income_total
$model.financeForm.data.form.fi_yit_donation= financeInfo.fi_yit_donation
$model.financeForm.data.form.fi_yit_subsidy= financeInfo.fi_yit_subsidy
$model.financeForm.data.form.fi_yit_membershiop_fees= financeInfo.fi_yit_membershiop_fees
$model.financeForm.data.form.fi_year_sum_fee= financeInfo.fi_year_sum_fee
$model.financeForm.data.form.fi_ysf_business_fee= financeInfo.fi_ysf_business_fee
$model.financeForm.data.form.fi_bf_staff_costs= financeInfo.fi_bf_staff_costs
$model.financeForm.data.form.fi_bf_every_day_fee= financeInfo.fi_bf_every_day_fee
$model.financeForm.data.form.fi_bf_assets= financeInfo.fi_bf_assets
$model.financeForm.data.form.fi_bf_tax= financeInfo.fi_bf_tax
$model.financeForm.data.form.fi_ysf_menage_fee= financeInfo.fi_ysf_menage_fee
$model.financeForm.data.form.fi_mf_staff_costs= financeInfo.fi_mf_staff_costs
$model.financeForm.data.form.fi_mf_every_day_fee= financeInfo.fi_mf_every_day_fee
$model.financeForm.data.form.fi_mf_assets= financeInfo.fi_mf_assets
$model.financeForm.data.form.fi_mf_tax= financeInfo.fi_mf_tax
$model.financeForm.data.form.fi_change_in_not_assets= financeInfo.fi_change_in_not_assets

if ($params.year ==1){
debugger
let yearEndPersons = res.data.yearEndPersons;
$model.yearEndPersonsForm.data.form.yep_ye_bed= yearEndPersons.yep_ye_bed
$model.yearEndPersonsForm.data.form.yep_ye_nurse_bed= yearEndPersons.yep_ye_nurse_bed
$model.yearEndPersonsForm.data.form.yep_ye_zrts= yearEndPersons.yep_ye_zrts
$model.yearEndPersonsForm.data.form.yep_ye_number= yearEndPersons.yep_ye_number
$model.yearEndPersonsForm.data.form.yep_ye_miss_num= yearEndPersons.yep_ye_miss_num
$model.yearEndPersonsForm.data.form.yep_ye_other_num= yearEndPersons.yep_ye_other_num
$model.yearEndPersonsForm.data.form.yep_ye_poverty= yearEndPersons.yep_ye_poverty
$model.yearEndPersonsForm.data.form.yep_ye_old_man= yearEndPersons.yep_ye_old_man
$model.yearEndPersonsForm.data.form.yep_ye_young= yearEndPersons.yep_ye_young
$model.yearEndPersonsForm.data.form.yep_ye_child= yearEndPersons.yep_ye_child
$model.yearEndPersonsForm.data.form.yep_ye_intact= yearEndPersons.yep_ye_intact
$model.yearEndPersonsForm.data.form.yep_ye_part_disability= yearEndPersons.yep_ye_part_disability
$model.yearEndPersonsForm.data.form.yep_ye_disability= yearEndPersons.yep_ye_disability
$model.yearEndPersonsForm.data.form.yep_outpatient_service= yearEndPersons.yep_outpatient_service
$model.yearEndPersonsForm.data.form.yep_foster_children= yearEndPersons.yep_foster_children
$model.yearEndPersonsForm.data.form.yep_acreage= yearEndPersons.yep_acreage
$model.yearEndPersonsForm.data.form.yep_unit_credit_code= yearEndPersons.yep_unit_credit_code
$model.yearEndPersonsForm.data.form.yep_unit_name= yearEndPersons.yep_unit_name
}

}
})
}
if (!$params.id) {
$model.card.setFormVal("fo_type", Number($params.type))
$model.card.setFormVal("fo_task", Number($params.type) === 2 ? Number($params.task + "99") : Number($params.task)) //如果是年报 年份后面添加标识 99
@@ -27,6 +109,9 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillCard", {
$refs.yearEnd.hide()
}
}
const changeMoney = (data) => {
return Number.parseInt(data) / 100;
}

// 聚合数据集操作
Object.assign($engine, {


+ 2
- 1
mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillList.js View File

@@ -34,7 +34,8 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillList", {
, task: $model.ds_1.data.form.task
, type: $model.ds_1.data.form.month
, task_text: $model.ds_1.data.form.task_text
, outOldData: $model.ds_1.data.form.outOldData
, outOldData: $model.ds_1.data.form.outOldData,
year : $model.ds_1.data.form.year
})
}



+ 27
- 0
mztb/src/main/resources/upgrade/mztb/dmsql/patch_0.002.sql
File diff suppressed because it is too large
View File


+ 27
- 0
mztb/src/main/resources/upgrade/mztb/kbsql/patch_0.002.sql
File diff suppressed because it is too large
View File


+ 27
- 0
mztb/src/main/resources/upgrade/mztb/mysql/patch_0.002.sql
File diff suppressed because it is too large
View File


+ 27
- 0
mztb/src/main/resources/upgrade/mztb/stsql/patch_0.002.sql
File diff suppressed because it is too large
View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/MztbStartedListener.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/FillOut.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/PartyInfo.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataCustomHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler$PartyDataFillModelListHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler$PartyDataFillModelLoadHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler$PartyDataFillModelSaveHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillService.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/domian/FillTask.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/task/AddNewPartyAndAccountTask.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/task/PushTask.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/tool/DbUtil.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/widgetManage/TaskMonthHandler$TaskMonthListHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/widgetManage/TaskMonthHandler$TaskMonthLoadHandler.class View File


BIN
mztb/target/classes/cc/smtweb/biz/mztb/web/widgetManage/TaskMonthHandler.class View File


Loading…
Cancel
Save