소스 검색

校验当前机构不能重复填报已填报的数据,修改机构信息后,将机构信息推送到前置库

pull/1/head
yulin 10 달 전
부모
커밋
a35f8de291
9개의 변경된 파일149개의 추가작업 그리고 18개의 파일을 삭제
  1. +11
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataCustomHandler.java
  2. +4
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillService.java
  3. +76
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyInfo/PartyInfoHandler.java
  4. +29
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyInfo/PartyInfoService.java
  5. +10
    -2
      mztb/src/main/java/cc/smtweb/biz/mztb/web/task/AddNewPartyAndAccountTask.java
  6. +1
    -1
      mztb/src/main/java/cc/smtweb/biz/mztb/web/task/PushTask.java
  7. +0
    -1
      mztb/src/main/java/cc/smtweb/biz/mztb/web/tool/DbUtil.java
  8. +8
    -7
      mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillCard.js
  9. +10
    -7
      mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillList.js

+ 11
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataCustomHandler.java 파일 보기

@@ -41,4 +41,15 @@ public class PartyDataCustomHandler extends AbstractHandler {
public R pushData(SwMap params, UserSession us) {
return null;
}

public R checkRepetition(SwMap params, UserSession us) {
DbEngine instance = DbEngine.getInstance();
Integer cur_party_id = instance.queryInt("select count(*) from "+EntityHelper.getSchemaTableName(FillOut.ENTITY_NAME)
+" where fo_party_id = ? and fo_state != -1 and fo_task = ?"
, us.getPartyId(),params.readLong("task"));
if(cur_party_id != 0) {
return R.error("当前机构已有该任务的填报数据:"+params.readString("task_text"));
}
return R.success();
}
}

+ 4
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyDataFill/PartyDataFillService.java 파일 보기

@@ -52,5 +52,9 @@ public class PartyDataFillService extends LCMsService {
public R pushData(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).pushData(params, us));
}
// 检查当前机构是否有重复任务
public R checkRepetition(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_CUSTOM, handler -> ((PartyDataCustomHandler) handler).checkRepetition(params, us));
}

}

+ 76
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyInfo/PartyInfoHandler.java 파일 보기

@@ -0,0 +1,76 @@
package cc.smtweb.biz.mztb.web.base.partyInfo;

import cc.smtweb.biz.mztb.web.base.DbSourceConfig;
import cc.smtweb.biz.mztb.web.tool.DbUtil;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.system.bpm.web.engine.model.common.ModelSaveHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;
import java.util.StringJoiner;

public class PartyInfoHandler extends ModelSaveHandler {
private final static Logger logger = LoggerFactory.getLogger(PartyInfoHandler.class);
@Override
protected void doSave() {
super.doSave();
// 将修改的机构数据推送到前置库
DbEngine instance = DbEngine.getInstance();
DbSourceConfig dbSourceConfig = instance.findDao(DbSourceConfig.class).queryEntityWhere("dsc_use_state = 0");
Connection connection = null;
try {
connection = DriverManager.getConnection(dbSourceConfig.getWholeUrl(), dbSourceConfig.getUsername(), dbSourceConfig.getPassword());
}catch (SQLException sqlException) {
logger.debug("创建 Connection Exception:",sqlException);
}
DbUtil dbUtil = new DbUtil(connection);
SwMap swmap = this.bean.getData();
// 处理前置库和本系统 机构表不同的字段
swmap.put("state","0");
swmap.put("wr_time", DateUtil.nowDateTimeLong());
swmap.put("wr_aspect",1);
swmap.put("id",instance.nextId());
String sql = buildInsertSql(swmap);
logger.info("====向前置库推送数据的sql==== :{}",sql);
try {
boolean insert = dbUtil.insert(sql);
if(!insert) logger.info("推送机构信息失败!!!!");
} catch (SQLException e) {
logger.debug("修改机构信息后,向前置库推送机构信息失败:",e);
}

}
private String buildInsertSql(SwMap entity) {
entity.remove("_def_table_name");
entity.remove("pi_update_at");
entity.remove("pi_update_at_text");
entity.remove("pi_national_economy_type_text");
entity.remove("pi_change_time_text");
entity.remove("pi_reg_time_text");
entity.remove("pi_reg_dept_text");
entity.remove("pi_change_type_text");
entity.remove("pi_party_type_text");
entity.remove("_status");
entity.remove("pi_sys_party_id");
StringJoiner key = new StringJoiner(",");
StringJoiner value = new StringJoiner(",");
StringBuilder sql = new StringBuilder();
sql.append(" insert into ").append("pre_party_info").append(" (");
for (Map.Entry<String, Object> entry : entity.entrySet()) {
key.add(entry.getKey());
value.add("'"+entry.getValue()+"'");
}
sql.append(key);
sql.append(") values (");
sql.append(value);
sql.append(")");

return sql.toString();
}
}

+ 29
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/base/partyInfo/PartyInfoService.java 파일 보기

@@ -0,0 +1,29 @@
package cc.smtweb.biz.mztb.web.base.partyInfo;

import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.normal.LCNormalService;

/**
* Created by 1 at 2024-01-09 10:57:49
* 页面【[机构信息编辑]的服务类
*/
@SwService
public class PartyInfoService extends LCNormalService {
//public final static String TYPE_DEMO = "demo";
@Override
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_MODEL_SAVE:return new PartyInfoHandler();
}
return super.createHandler(type);
}

/* demo
//自定义
public R demo(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_DEMO, handler -> ((DemoHandler)handler).demo());
}
*/

}

+ 10
- 2
mztb/src/main/java/cc/smtweb/biz/mztb/web/task/AddNewPartyAndAccountTask.java 파일 보기

@@ -17,6 +17,8 @@ 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 org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.*;
import java.util.ArrayList;
@@ -29,6 +31,7 @@ import java.util.stream.Collectors;
* 拉取前置库推送的机构信息 执行新增或修改 操作
*/
public class AddNewPartyAndAccountTask extends BaseJob {
private static final Logger logger = LoggerFactory.getLogger(AddNewPartyAndAccountTask.class);
private static final String PWD_SALT = "goodpj";

@Override
@@ -67,8 +70,10 @@ public class AddNewPartyAndAccountTask extends BaseJob {
try {
connection = DriverManager.getConnection(dbSourceConfig.getWholeUrl(), dbSourceConfig.getUsername(), dbSourceConfig.getPassword());
DbUtil dbUtil = new DbUtil(connection);
resultSet = dbUtil.dbHandSql("select * from pre_party_info where state = 0 order by wr_time", "query"); // 查询未读取的机构信息,时间升序 先推送的先读取。
// 查询未读取并且是民政端(wr_aspect =0)推送的机构信息,时间升序 先推送的先读取。
resultSet = dbUtil.dbHandSql("select * from pre_party_info where state = 0 and wr_aspect = 0 order by wr_time", "query");
if (resultSet == null) return null;
logger.info("select * from pre_party_info where state = 0 and wr_aspect = 1 order by wr_time; 查询到结果,继续执行......");

while (resultSet.next()) {
PartyInfo partyInfo = new PartyInfo();
@@ -174,7 +179,10 @@ public class AddNewPartyAndAccountTask extends BaseJob {
ptIdList.removeAll(ptIdListExist);

// 读取完成后 修改前置库推送数据的状态,再进行本系统数据入库处理
dbUtil.update("update pre_party_info set state = 1 , rd_time = " + DateUtil.nowDateTimeNumber() + " where state = 0");
int updateNum = dbUtil.update("update pre_party_info set state = 1, rd_time = " + DateUtil.nowDateTimeNumber() + " where state = 0 and wr_aspect = 0");
logger.info("修改前置库机构读取状态数量:{}",updateNum);
logger.info("========开始处理新增或者修改的机构信息=========");


instance.doTrans(() -> {
// 处理新增或者修改的数据


+ 1
- 1
mztb/src/main/java/cc/smtweb/biz/mztb/web/task/PushTask.java 파일 보기

@@ -31,7 +31,7 @@ public class PushTask extends BaseJob {
value.add("'"+entry.getValue()+"'");
}
sql.append(key);
sql.append(") value (");
sql.append(") values (");
sql.append(value);
sql.append(")");



+ 0
- 1
mztb/src/main/java/cc/smtweb/biz/mztb/web/tool/DbUtil.java 파일 보기

@@ -86,7 +86,6 @@ public class DbUtil {
* @throws SQLException sql执行异常
*/
public Statement getStatement() throws SQLException {
connection.setAutoCommit(false);
Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);


+ 8
- 7
mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillCard.js 파일 보기

@@ -77,11 +77,10 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillCard", {
, "fi_taxes", "fi_sell_cost", "fi_manage_cost", "fi_mc_taxes"
, "fi_mc_travel", "fi_finance_cost", "fi_fc_interests", "fi_asset_loss"
, "fi_fair_value_chanage", "fi_income_from_investment", "fi_operating_profit", "fi_nonbusiness_income"
, "fi_ni_public_subsidy", "fi_base_pay", "fi_payable_money_year", "fi_yit_donation"
, "fi_yit_membershiop_fees", "fi_year_sum_fee", "fi_ysf_business_fee", "fi_bf_staff_costs"
, "fi_bf_every_day_fee", "fi_mf_assets", "fi_bf_tax", "fi_ysf_menage_fee"
, "fi_ni_public_subsidy", "fi_base_pay", "fi_payable_money_year"
, "fi_mf_assets", "fi_bf_tax", "fi_ysf_menage_fee"
, "fi_mf_staff_costs", "fi_mf_every_day_fee", "fi_mf_assets", "fi_mf_tax"
, "fi_change_in_not_assets"]
, "fi_change_in_not_assets","fi_yit_enterpricse","fi_yit_business"]
})
}
const threeHide = () => { // 编制部门登记禁用
@@ -91,12 +90,13 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillCard", {
, "fi_taxes", "fi_sell_cost", "fi_manage_cost", "fi_mc_taxes"
, "fi_mc_travel", "fi_finance_cost", "fi_fc_interests", "fi_asset_loss"
, "fi_fair_value_chanage", "fi_income_from_investment", "fi_operating_profit", "fi_nonbusiness_income"
, "fi_ni_public_subsidy", "fi_base_pay", "fi_payable_money_year", "fi_yit_enterpricse"
, "fi_yit_business", "fi_payable_money_year", "fi_year_expend", "fi_ycs_salary", "fi_ye_commodity_service"
, "fi_ni_public_subsidy", "fi_base_pay", "fi_payable_money_year", ""
, "fi_payable_money_year", "fi_year_expend", "fi_ycs_salary", "fi_ye_commodity_service"
, "fi_cs_heating_fee", "fi_cs_travel_expense", "fi_cs_go_abroad", "fi_cs_service_fee"
, "fi_cs_expend", "fi_cs_weal", "fi_ycs_personage_family_fee", "fi_pff_fuxue"
, "fi_pff_living_subsidy", "fi_pff_relief", "fi_pff_student_grent", "fi_pff_subsidy"
, "fi_ycs_operating_expense", "fi_sell_fee", "fi_taxes"]
, "fi_year_sum_fee", "fi_ysf_business_fee", "fi_bf_staff_costs","fi_bf_every_day_fee"
, "fi_ycs_operating_expense", "fi_sell_fee", "fi_taxes","fi_yit_donation","fi_yit_membershiop_fees"]
})
}
const oneHide = () => { // 市场监管部门登记禁用
@@ -115,6 +115,7 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillCard", {
})
}


const loadPageCard = () => {
// $api.loadCard()
}


+ 10
- 7
mztb/src/main/resources/static/event/mztb/base/partyDataFill/partyDataFillList.js 파일 보기

@@ -21,18 +21,21 @@ window.$swEvent.setup("mztb.base.partyDataFill.partyDataFillList", {
task_text = data.text;
type = data.task.includes("99") ? 2 : 1;
}
const toPageEdit = () =>{
if($model.ds_1.data.form.task === undefined) {
const toPageEdit = async () => {
if ($model.ds_1.data.form.task === undefined) {
$$message.notify.warning("请选择任务")
return false
}
// 检查当前机构是否重复推送
const rt = await $$http.post("mztb/partyDataFill/checkRepetition", {task: $model.ds_1.data.form.task,task_text : $model.ds_1.data.form.task_text})
$api.closeDialog("tb_dialog")
$api.toPage("mztb.partyDataFillCard",{
$api.toPage("mztb.partyDataFillCard", {
$fromAction: 'button:add'
,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 })
, 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
})
}

const selectHide =(data) => {


불러오는 중...
취소
저장