Commit 7aa95d79 by liuyang

2024-07-15 业务账期维护变更

parent 45ffe828
......@@ -72,6 +72,8 @@ public class ServiceHGCB002 extends ServiceEPBase {
}
HGCBTools.HgCb002.select(params);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次数据同步成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
}
......
......@@ -59,6 +59,8 @@ public class ServiceHGCB003 extends ServiceEPBase {
throw new PlatException(String.format("公司[%s]上月会计期[%s]为开账状态,数据同步失败!", hgcw001Last.getCompanyCode(), hgcw001Last.getAccountPeriod()));
}
HGCBTools.HgCb003.select(params);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次数据同步成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
}
......
......@@ -93,7 +93,7 @@ public class ServiceHGCB004 extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次数据同步成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "数据同步失败");
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
}
return inInfo;
}
......
package com.baosight.hggp.hg.cw.service;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cb.domain.HGCB001;
import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cw.domain.HGCW001;
import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.hg.sb.domain.HGSB001;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
/**
* @author yukang
......@@ -39,9 +37,8 @@ public class ServiceHGCW001 extends ServiceBase {
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "初始化")
@OperationLogAnnotation(operModul = "业务账期维护",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo,new HGCW001());
try {
......@@ -67,17 +64,16 @@ public class ServiceHGCW001 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "查询",operDesc = "查询")
@OperationLogAnnotation(operModul = "业务账期维护",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
if (!roleCompanyCode.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGCW001.FIELD_COMPANY_CODES,roleCompanyCode);
}
try {
inInfo = super.query(inInfo, HGCW001.QUERY, new HGCW001());
}
catch (Exception e) {
}catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
......@@ -89,24 +85,30 @@ public class ServiceHGCW001 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "保存",operDesc = "保存")
@OperationLogAnnotation(operModul = "业务账期维护",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(i));
HGCW001.setAccountPeriod(DateUtils.formatShort(HGCW001.getAccountPeriod()));
HGCW001.setAccountPeriodDateStart(DateUtils.formatShort(HGCW001.getAccountPeriodDateStart()));
HGCW001.setAccountPeriodDateEnd(DateUtils.formatShort(HGCW001.getAccountPeriodDateEnd()));
if (HGCW001.getId() == null || HGCW001.getId() == 0) {
this.add(HGCW001);
for (Map resultRow : resultRows) {
HGCW001 hgcw001 = new HGCW001();
hgcw001.fromMap(resultRow);
hgcw001.setAccountPeriod(DateUtils.formatShort(hgcw001.getAccountPeriod()));
hgcw001.setAccountPeriodDateStart(DateUtils.formatShort(hgcw001.getAccountPeriodDateStart()));
hgcw001.setAccountPeriodDateEnd(DateUtils.formatShort(hgcw001.getAccountPeriodDateEnd()));
if (hgcw001.getId() == null || hgcw001.getId() == 0) {
Map paramMap = new HashMap<>();
paramMap.put(HGCW001.FIELD_COMPANY_CODE,hgcw001.getCompanyCode());
paramMap.put(HGCW001.FIELD_ACCOUNT_PERIOD,hgcw001.getAccountPeriod());
HGCW001 cw001 =HGCWTools.HgCw001.getByCondition(paramMap); //获取当月业务账期
if (cw001 != null) {
throw new PlatException(String.format("公司[%s]会计期[%s]已存在,保存失败!",hgcw001.getCompanyCode(),hgcw001.getAccountPeriod()));
}
this.add(hgcw001);
} else {
this.modify(HGCW001);
this.modify(hgcw001);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
......@@ -118,11 +120,20 @@ public class ServiceHGCW001 extends ServiceBase {
/**
* 新增操作
*
* @param HGCW001
* @param hgcw001
* @return
*/
public void add(HGCW001 HGCW001) {
DaoUtils.insert("HGCW001.insert", HGCW001);
public void add(HGCW001 hgcw001) {
DaoUtils.insert(HGCW001.INSERT, hgcw001);
HGCB001 hgcb001 = new HGCB001();
BeanUtils.copyProperties(hgcw001,hgcb001);
HGCB001 cb001 = HGCBTools.HgCb001.select(new HashMap<String,String>(){{
put(HGCB001.FIELD_ACCOUNT_PERIOD,hgcw001.getAccountPeriod());
put(HGCB001.FIELD_COMPANY_CODE,hgcw001.getCompanyCode());
}});
if (cb001 == null) {
DaoUtils.insert(HGCB001.INSERT, hgcb001); //同步添加会计期维护
}
}
/**
......@@ -141,18 +152,27 @@ public class ServiceHGCW001 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "新增",operDesc = "新增")
@OperationLogAnnotation(operModul = "业务账期维护",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(i));
DaoUtils.insert("HGCW001.insert", HGCW001);
for (Map resultRow : resultRows) {
HGCW001 hgcw001 = new HGCW001();
hgcw001.fromMap(resultRow);
Map paramMap = new HashMap<>();
paramMap.put(HGCW001.FIELD_COMPANY_CODE,hgcw001.getCompanyCode());
paramMap.put(HGCW001.FIELD_ACCOUNT_PERIOD,hgcw001.getAccountPeriod());
HGCW001 hgcw0011 =HGCWTools.HgCw001.getByCondition(paramMap); //获取当月业务账期
if (hgcw0011 == null) {
throw new PlatException(String.format("公司[%s]会计期[%s]已存在",hgcw001.getCompanyCode(),hgcw001.getAccountPeriod()));
}
//HGCW001 hgcw001Last =HGCWTools.HgCw001.getByCondition(paramMap); //获取上月业务账期
DaoUtils.insert(HGCW001.INSERT, hgcw001);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
......@@ -167,15 +187,16 @@ public class ServiceHGCW001 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "修改",operDesc = "修改")
@OperationLogAnnotation(operModul = "业务账期维护",operType = "修改",operDesc = "修改")
@Override
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(i));
HGCW001.setAccountPeriod(DateUtils.formatShort(HGCW001.getAccountPeriod()));
DaoUtils.update("HGCW001.update", HGCW001);
for (Map resultRow : resultRows) {
HGCW001 hgcw001 = new HGCW001();
hgcw001.fromMap(resultRow);
hgcw001.setAccountPeriod(DateUtils.formatShort(hgcw001.getAccountPeriod()));
DaoUtils.update(HGCW001.UPDATE, hgcw001);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -192,14 +213,24 @@ public class ServiceHGCW001 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "账期维护",operType = "删除",operDesc = "删除")
@OperationLogAnnotation(operModul = "业务账期维护",operType = "删除",operDesc = "删除")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
DaoUtils.update("HGCW001.delete", resultRows.get(i));
for (Map resultRow : resultRows) {
if (resultRow.get(HGCW001.FIELD_ACCOUNT_PERIOD_STATUS).equals(0)){
throw new PlatException(String.format("公司[%s]会计期[%s]为关账状态,不能删除",resultRow.get(HGCW001.FIELD_COMPANY_CODE),resultRow.get(HGCW001.FIELD_ACCOUNT_PERIOD)));
}
Map paramMap = new HashMap<>();
paramMap.put(HGCW001.FIELD_COMPANY_CODE,resultRow.get(HGCW001.FIELD_COMPANY_CODE));
paramMap.put(HGCW001.FIELD_ACCOUNT_PERIOD,resultRow.get(HGCW001.FIELD_ACCOUNT_PERIOD));
HGCB001 hgcb001 = HGCBTools.HgCb001.select(paramMap);
if (hgcb001 != null && hgcb001.getAccountPeriodStatus() == 0) {
throw new PlatException(String.format("公司[%s]会计期[%s]为关账,不能删除",resultRow.get(HGCW001.FIELD_COMPANY_CODE),resultRow.get(HGCW001.FIELD_ACCOUNT_PERIOD)));
}
DaoUtils.update("HGCW001.delete", resultRow);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
......@@ -217,26 +248,46 @@ public class ServiceHGCW001 extends ServiceBase {
public EiInfo switchRow(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
HGCW001 HGCW001 = new HGCW001();
HGCW001.fromMap(resultRows.get(0));
HGCW001 hgcw001 = new HGCW001();
hgcw001.fromMap(resultRows.get(0));
Integer accountPeriodStatus = HGCW001.getAccountPeriodStatus();
Map paramMap = new HashMap<>();
paramMap.put(HGCW001.FIELD_COMPANY_CODE,hgcw001.getCompanyCode());
paramMap.put(HGCW001.FIELD_ACCOUNT_PERIOD,hgcw001.getAccountPeriod());
Integer accountPeriodStatus = hgcw001.getAccountPeriodStatus();
if (accountPeriodStatus == 1) {
//开账 - 做关账
HGCW001.setAccountPeriodStatus(0);
DaoUtils.update("HGCW001.updateSwitchRow", HGCW001);
} else if (accountPeriodStatus == 0) {
//开账 - 做关账 0
HGCW001 cw001 = HGCWTools.HgCw001.getAccountPeriodStart(hgcw001.getCompanyCode(), hgcw001.getAccountYear(), hgcw001.getAccountPeriod(), 1);
if (cw001 != null) {
throw new PlatException("关账失败,业务账期不能跨月关账!");
}
// 查询会计期是否为开账状态
HGCB001 hgcb001 = HGCBTools.HgCb001.select(paramMap);
//先找是否已经有开账的记录
int switchRowNum = dao.count("HGCW001.getSwitchRowNum", HGCW001);
if (switchRowNum > 0) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!已经有一个会计期为开账状态!");
return inInfo;
//int switchRowNum = dao.count("HGCW001.getSwitchRowNum", hgcw001);
if (hgcb001 == null) {
throw new PlatException(String.format("公司[%s]会计期[%s]会计期维护为空,业务账期关账失败!", hgcw001.getCompanyCode(),hgcw001.getAccountPeriod()));
}
HGCW001.setAccountPeriodStatus(1);
DaoUtils.update("HGCW001.updateSwitchRow", HGCW001);
if (hgcb001.getAccountPeriodStatus() == 0) {
throw new PlatException(String.format("公司[%s]会计期[%s]会计期维护为关账状态,业务账期关账失败!", hgcb001.getCompanyCode(),hgcw001.getAccountPeriod()));
}
//检查数据
HGCWTools.HgCw001.checkAllData(hgcw001);
hgcw001.setAccountPeriodStatus(0); //关账
DaoUtils.update("HGCW001.updateSwitchRow", hgcw001);
} else if (accountPeriodStatus == 0) {
//关账 - 做开账 1
HGCW001 cw001 = HGCWTools.HgCw001.getAccountPeriodEnd(hgcw001.getCompanyCode(), hgcw001.getAccountYear(), hgcw001.getAccountPeriod(), 0);
if (cw001 != null) {
throw new PlatException("开账失败,业务账期不能跨月开账!");
}
hgcw001.setAccountPeriodStatus(1); //开账
DaoUtils.update("HGCW001.updateSwitchRow", hgcw001);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据操作成功!");
} catch (Exception e) {
......@@ -245,4 +296,18 @@ public class ServiceHGCW001 extends ServiceBase {
return inInfo;
}
/**
* 查询上月的会计期
*/
public EiInfo queryLast(EiInfo inInfo) {
try {
Map paramMap =EiInfoUtils.getFirstRow(inInfo);
HGCWTools.HgCw001.getaccountPeriodDateStart(inInfo,paramMap);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "查询上月的会计期失败");
}
return inInfo;
}
}
......@@ -38,6 +38,39 @@
-->
<sqlMap namespace="HGCW012">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
SETTLEMENT_NUMBER as "settlementNumber", <!-- 来源单号 -->
BILL_TYBE as "billTybe", <!-- 票据类型 -->
BILL_NUMBER as "billNumber", <!-- 发票号 -->
BILL_STATE as "billState", <!-- 开票状态 -->
SIGNING_DATE as "signingDate", <!-- 开票日期 -->
PARTY_A as "partyA", <!-- 供应商名称 -->
REVIEW_STATUS as "reviewStatus", <!-- 审批状态 -->
TAX_POINTS as "taxPoints", <!-- 税率 -->
THIS_SETTLEMENT_TAX as "thisSettlementTax", <!-- 税额 -->
THIS_SETTLEMENT_AMOUNT as "thisSettlementAmount", <!-- 不含税金额 -->
TOTAL_CONTRACT_PRICE_INCLUDING as "totalContractPriceIncluding", <!-- 发票总额 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
REMAINING_AMOUNT as "remainingAmount", <!-- 剩余开票/收票金额 -->
RECEIVE_DATE as "receiveDate", <!-- 收票日期 -->
CONTRACT_TYPE as "contractType", <!-- 合同类型;1.采购收货2.劳务3.租赁 -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货大类 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
RECEIVE_WEIGHT as "receiveWeight" <!-- 收货重量 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
......@@ -137,37 +170,7 @@
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cw.domain.HGCW012">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
SETTLEMENT_NUMBER as "settlementNumber", <!-- 来源单号 -->
BILL_TYBE as "billTybe", <!-- 票据类型 -->
BILL_NUMBER as "billNumber", <!-- 发票号 -->
BILL_STATE as "billState", <!-- 开票状态 -->
SIGNING_DATE as "signingDate", <!-- 开票日期 -->
PARTY_A as "partyA", <!-- 供应商名称 -->
REVIEW_STATUS as "reviewStatus", <!-- 审批状态 -->
TAX_POINTS as "taxPoints", <!-- 税率 -->
THIS_SETTLEMENT_TAX as "thisSettlementTax", <!-- 税额 -->
THIS_SETTLEMENT_AMOUNT as "thisSettlementAmount", <!-- 不含税金额 -->
TOTAL_CONTRACT_PRICE_INCLUDING as "totalContractPriceIncluding", <!-- 发票总额 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
REMAINING_AMOUNT as "remainingAmount", <!-- 剩余开票/收票金额 -->
RECEIVE_DATE as "receiveDate", <!-- 收票日期 -->
CONTRACT_TYPE as "contractType", <!-- 合同类型;1.采购收货2.劳务3.租赁 -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货大类 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
RECEIVE_WEIGHT as "receiveWeight" <!-- 收货重量 -->
<include refid="column" />
FROM ${hggpSchema}.HGCW012 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
......@@ -360,4 +363,36 @@
ID = #id#
</update>
<select id="queryCheckList" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.cw.domain.HGCW012">
SELECT
<include refid="column" />
FROM ${hggpSchema}.HGCW012 WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ SIGNING_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ SIGNING_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(SIGNING_DATE,6) = #billDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="submitStatus">
REVIEW_STATUS = #submitStatus#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
</sqlMap>
......@@ -317,6 +317,12 @@
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ DEPOSIT_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ DEPOSIT_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(DEPOSIT_DATE,6) = #billDate#
</isNotEmpty>
......
......@@ -444,6 +444,18 @@
PROCESS_NAME as "processName", <!-- 工序名称 -->
PROCESS_ORDER as "processOrder" <!-- 加工顺序 -->
FROM ${hggpSchema}.HGKC003 WHERE 1=1 AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ DEPOSIT_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ DEPOSIT_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(DEPOSIT_DATE,6) = #billDate#
</isNotEmpty>
......
......@@ -293,7 +293,19 @@
<select id="queryCheckList" parameterClass="HashMap" resultClass="HGKC004">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGKC004 WHERE 1=1
FROM ${hggpSchema}.HGKC004 WHERE 1=1 AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ RECEIPT_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ RECEIPT_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(RECEIPT_DATE,6) = #billDate#
</isNotEmpty>
......
......@@ -311,6 +311,18 @@
SOURCE_CODE as "sourceCode", <!-- 数据来源编号 -->
SOURCE as "source" <!-- 数据来源 -->
FROM ${hggpSchema}.HGKC006 WHERE 1=1 and DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ OTHER_ENTER_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ OTHER_ENTER_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(OTHER_ENTER_DATE,6) = #billDate#
</isNotEmpty>
......
......@@ -307,6 +307,18 @@
SOURCE_CODE as "sourceCode", <!-- 数据来源编号 -->
SOURCE as "source" <!-- 数据来源 -->
FROM ${hggpSchema}.HGKC007 WHERE 1=1 and DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ OTHER_OUT_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ OTHER_OUT_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(OTHER_OUT_DATE,6) = #billDate#
</isNotEmpty>
......
......@@ -211,7 +211,19 @@
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
RECEIVE_TYPE as "receiveType" <!-- 领料单类型 0:正常,1:退库 -->
FROM ${hggpSchema}.HGKC008 WHERE 1=1
FROM ${hggpSchema}.HGKC008 WHERE 1=1 and DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateStart">
<![CDATA[ RECEIPT_DATE >= #accountPeriodDateStart# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodDateEnd">
<![CDATA[ RECEIPT_DATE <= #accountPeriodDateEnd# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billDate">
LEFT(RECEIPT_DATE,6) = #billDate#
</isNotEmpty>
......
......@@ -3,12 +3,15 @@
*/
package com.baosight.hggp.util;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* jdk8中新增的日期处理类,更安全、更精确也更明确
......@@ -36,9 +39,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return
*/
public static String getYesMonth(String date) {
LocalDate endLocalDate = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE);
return getYesMonth(date,DateTimeFormatter.ISO_LOCAL_DATE);
}
public static String getYesMonth(String date,DateTimeFormatter dateTimeFormatter) {
LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter);
endLocalDate = endLocalDate.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
return endLocalDate.format(dateTimeFormatter);
}
/**
* 获取下个月的1号日期
*
* @param date 2023-09-06 or 20230906
* @return
*/
public static String getPlusYesMonth(String date,DateTimeFormatter dateTimeFormatter) {
LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter);
endLocalDate = endLocalDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(dateTimeFormatter);
}
/**
......@@ -68,6 +86,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return LocalDate.now().minusDays(1).format(DATE);
}
/**
* 获取后一天日期字符串(yyyy-MM-dd)
*
* @return
*/
public static String yesterdayEnd(String date,Integer day) {
return LocalDate.parse(date).minusDays(day).format(DATE);
}
/**
* 获取日期字符串(yyyy-MM-dd)
*
* @return
......
$(function() {
$(function () {
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
// 查询
$("#QUERY").on("click", function () {
query();
});
$("#SWITCH").on("click", function () {
switchRow();
});
IPLATUI.EFGrid.result = {
IPLATUI.EFGrid = {
"result":{
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
{
field: "accountPeriod",
title: "会计期",
editor:function (container, options) {
var input = $('<input name="' + options.field + '"/>');
input.appendTo(container);
input.kendoDatePicker({
start: "year",
depth: "year",
format: "yyyy-MM",
value:currDate(options.model.accountYear)
});
//resultGrid.setCellValue(options,'accountPeriod',accountPeriod)
}
}
],
exportGrid: {
/**
* 导出前的事件
*
* @param gridInstance kendoGrid 对象
* @return {boolean} 是否执行导出的逻辑
*/
beforeExport: function (gridInstance) {
var validator1 = IPLAT.Validator({
id: "inqu"
});
// 点击按钮后校验
if (!validator1.validate()) {
var errorMsg = validator1.errors().toString();
var errs = errorMsg.split(',');
IPLAT.alert({
message: '<b>错误:<br>' + errs.join('<br>') + '</b>',
okFn: function (e) {
},
title: '错误'
});
return false;
}
return true;
},
// exportFileName: "result", // 默认值和 blockId 相同
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "业务账期维护_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function (grid) {
$("#SWITCH").on("click", function () {
switchRow();
});
grid.dataSource.bind("change",function(e){
var item = e.items[0];
/* if(e.field == "accountYear"){
let accountPeriod = currMonth(item.accountYear);
resultGrid.setCellValue(item,'accountPeriod',accountPeriod)
//loadChange(grid,e,"accountPeriod");
}else */
if(e.field == "accountPeriod"){
let accountPeriod = dateFormate(item.accountPeriod,"yyyy-MM-dd")
let accountPeriodDateStart = queryLast(item.companyCode,accountPeriod);
resultGrid.setCellValue(item,'accountYear',accountPeriod.substring(0,4));
resultGrid.setCellValue(item,'accountPeriodDateStart',dateFormate(new Date(accountPeriodDateStart),"yyyyMMdd"));
loadChange(grid,e,"accountPeriodDateEnd");
}
})
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
......@@ -33,30 +98,29 @@ $(function() {
},
}
}
window.document.addEventListener("keyup",function (event) {
downKeyUp();
/*window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
})*/
});
$(window).load(function () {
// 查
query();
});
/**
* 查询
*/
let query = function () {
var query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
......@@ -153,8 +217,8 @@ function deleteFunc() {
let flag = true;
$.each(rows, function(index, item) {
let accountPeriodStatus= item.get("accountPeriodStatus");
if(accountPeriodStatus === "1"){
message("选中的第"+(index+1)+"行记录为账状态,不能删除!");
if(accountPeriodStatus === "0"){
message("选中的第"+(index+1)+"行记录为账状态,不能删除!");
flag = false;
return false;
}
......@@ -207,3 +271,26 @@ function switchRow() {
});
}
function queryLast(companyCode,accountPeriod) {
let accountPeriodDateStart = "";
let info = new EiInfo();
info.set("inqu_status-0-companyCode", companyCode);
info.set("inqu_status-0-accountPeriod", accountPeriod);
if(isBlank(info.get("inqu_status-0-companyCode"))){
message("公司名称不能为空!");
return;
}
if(isBlank(info.get("inqu_status-0-accountPeriod"))){
message("会计期不能为空!");
return;
}
EiCommunicator.send("HGCW001", "queryLast", info, {
onSuccess: function (ei) {
accountPeriodDateStart = ei.get("accountPeriodDateStart");
},
onFail: function (ei) {
IPLAT.alert(ei.getMsg());
}
},{async: false});
return accountPeriodDateStart;
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
</head>
<EF:EFPage title="账期维护">
<EF:EFPage title="业务账期维护">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
......@@ -30,16 +30,15 @@
filter="contains" readonly="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="accountYear" cname="会计年度" width="100" align="center" start="decade" depth="decade"
<EF:EFColumn ename="accountYear" cname="会计年度" enable="false" width="100" align="center" start="decade" depth="decade"
editType="date" dateFormat="yyyy" parseFormats="['yyyy']" required="true"/>
<EF:EFColumn ename="accountPeriod" cname="会计期" width="100" align="center" start="year" depth="year"
<EF:EFColumn ename="accountPeriod" cname="会计期" readonly="true" width="100" align="center" start="year" depth="year"
editType="date" dateFormat="yyyy-MM" parseFormats="['yyyyMM']" required="true"/>
<EF:EFComboColumn ename="accountPeriodStatus" cname="会计期状态" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="0">
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.accountPeriodStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="accountPeriodDateStart" cname="账期开始日期" width="100" align="center"
<EF:EFColumn ename="accountPeriodDateStart" cname="账期开始日期" enable="false" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="accountPeriodDateEnd" cname="账期结束日期" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
......
......@@ -269,14 +269,26 @@ function currShortDate() {
*
* @returns {string}
*/
function currShortMonth() {
const date = new Date();
function currShortMonth(getYear) {
const date = new Date(getYear);
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份从0开始,需要加1
return year + (month < 10 ? '0' + month : month);
}
/**
* 当前月份 YYYYMM
*
* @returns {string}
*/
function currMonth(getYear) {
const date = new Date(getYear);
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份从0开始,需要加1
return year + '-' + (month < 10 ? '0' + month : month);
}
/**
* cookie 操作
*
* @param c_name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment