123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- /**
- *
- */
- package com.kingdee.shr.customer.gtiit.rpt;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.springframework.ui.ModelMap;
- import com.kingdee.bos.BOSException;
- import com.kingdee.bos.Context;
- import com.kingdee.eas.framework.CoreBaseInfo;
- import com.kingdee.eas.util.app.DbUtil;
- import com.kingdee.jdbc.rowset.IRowSet;
- import com.kingdee.shr.base.syssetting.context.SHRContext;
- import com.kingdee.shr.base.syssetting.exception.SHRWebException;
- import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
- import com.kingdee.shr.base.syssetting.web.handler.DEPCustomBillEditHandler;
- /**
- * @author ISSUSER 工资单薪酬项目新增保存校验
- */
- public class AddSalaryEditHandler extends DEPCustomBillEditHandler {
- Context ctx = SHRContext.getInstance().getContext();
- @Override
- public String saveAction(HttpServletRequest request, HttpServletResponse response, ModelMap modeMap)
- throws SHRWebException {
- CoreBaseInfo model = (CoreBaseInfo) request.getAttribute("dynamic_model");
- String depidentifying = model.getString("depidentifying");
- List<String> columnList = getColumn();
- List<String> list = getFiled();
- List<String> determineFieldsList = determineFields();
- if (list.contains(depidentifying)) {
- // 判断是否是中文环境
- if (ctx.getLocale().toString().equalsIgnoreCase("zh_CN")
- || ctx.getLocale().toString().equalsIgnoreCase("l2")
- || ctx.getLocale().toString().equalsIgnoreCase("L2")) {
- throw new ShrWebBizException("该dep标识已经在单据中存在");
- } else {
- throw new ShrWebBizException("The dep identifier already exists in the document");
- }
- }
- // String depFile = "cf" + depidentifying.toLowerCase();
- // if (!columnList.contains(depFile) && !columnList.contains(depFile + "_l1")) {
- // // 判断是否是中文环境
- // if (ctx.getLocale().toString().equalsIgnoreCase("zh_CN")
- // || ctx.getLocale().toString().equalsIgnoreCase("l2")
- // || ctx.getLocale().toString().equalsIgnoreCase("L2")) {
- // throw new ShrWebBizException("dep里面没有该字段,请先在dep里面创建字段");
- // } else {
- // throw new ShrWebBizException(
- // "This field is not available in the dep. Please create a field in the dep first");
- // }
- // }
- if (determineFieldsList.contains(depidentifying.toLowerCase())) {
- if (ctx.getLocale().toString().equalsIgnoreCase("zh_CN")
- || ctx.getLocale().toString().equalsIgnoreCase("l2")
- || ctx.getLocale().toString().equalsIgnoreCase("L2")) {
- throw new ShrWebBizException("dep已存在该字段标识");
- } else {
- throw new ShrWebBizException("The field identifier already exists in dep");
- }
- }
- return super.saveAction(request, response, modeMap);
- }
- /**
- * 查询工资单薪酬项目新增单据里面的 dep字段
- */
- public List<String> getFiled() {
- List<String> list = new ArrayList<>();
- String sql = "select* from CT_CUS_AddSalaryproject";
- try {
- IRowSet rs = DbUtil.executeQuery(ctx, sql);
- while (rs.next()) {
- list.add(rs.getString("cfdepidentifying"));
- }
- } catch (BOSException e) {
- e.printStackTrace();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return list;
- }
- /**
- * 查询工资单套打里面的所有字段
- *
- */
- public List<String> getColumn() {
- List<String> list = new ArrayList<>();
- String sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CT_SAL_WagesChromatography'";
- try {
- IRowSet rs = DbUtil.executeQuery(ctx, sql);
- while (rs.next()) {
- // 转换为小写
- list.add(rs.getString("COLUMN_NAME").toLowerCase());
- }
- } catch (BOSException e) {
- e.printStackTrace();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return list;
- }
- /***
- * 存储已经定死的字段
- */
- public List<String> determineFields() {
- List<String> filedList = new ArrayList<>();
- filedList.add("ynssd");
- filedList.add("yfzj");
- filedList.add("deductionsfortaxRMB");
- filedList.add("deductionsfortax");
- filedList.add("Note");
- filedList.add("DeductionafterTax");
- filedList.add("PaymentafterTax");
- filedList.add("SalaryAdvance");
- filedList.add("UtilityCost");
- filedList.add("Rent");
- filedList.add("GrossSalary");
- filedList.add("rentorutility");
- filedList.add("Utilityfee");
- filedList.add("OtherDeduction");
- filedList.add("OtherRefund");
- filedList.add("UnpaidLeaveDeduction");
- filedList.add("UGSubsidyUG");
- filedList.add("AdmissionSubsidy");
- filedList.add("TaxableOtherBenefit");
- filedList.add("TaxableCommercial");
- filedList.add("TotalDeductionBeforeTax");
- filedList.add("DeductionBeforeTax");
- filedList.add("TotalAllowance");
- filedList.add("TeachersDayAllowance");
- filedList.add("TutoringAllowance2");
- filedList.add("TutoringAllowance");
- filedList.add("GrossWage2");
- filedList.add("DailyWage");
- filedList.add("leaveallowance");
- filedList.add("severancepay");
- filedList.add("annualleave");
- filedList.add("ERHousing");
- filedList.add("ERMedicalins");
- filedList.add("ERSocialins");
- filedList.add("TotalTax");
- filedList.add("SeveranceTax");
- filedList.add("NonResident");
- filedList.add("BonusTax1");
- filedList.add("AnnualBonus2");
- filedList.add("ForeignerAnnual");
- filedList.add("AnnualBonus1");
- filedList.add("Specialexpense");
- filedList.add("TaxableItem");
- filedList.add("PensionAllowance");
- filedList.add("HouseAllowance");
- filedList.add("CommunicationAllowance");
- filedList.add("OTPayment");
- filedList.add("HolidayOTPayment");
- filedList.add("TaxExemption");
- filedList.add("shifanetPayment");
- filedList.add("netPaymentnumber");
- filedList.add("socialinsuranceplanRMB");
- filedList.add("socialinsuranceplanRMBCode");
- filedList.add("IndividualIncomeTaxRMB");
- filedList.add("IndividualIncomeTaxRMBCode");
- filedList.add("HousingfundRMB");
- filedList.add("HousingfundRMBCode");
- filedList.add("MedicalinsuranceRMB");
- filedList.add("MedicalinsuranceRMBCode");
- filedList.add("SocialinsuranceRMB");
- filedList.add("SocialinsuranceRMBCode");
- filedList.add("SubsidyRMB");
- filedList.add("SubsidyRMBCode");
- filedList.add("WeekendOTPaymentRMB");
- filedList.add("WeekendOTPaymentRMBCode");
- filedList.add("WorkdayOTPaymentRMB");
- filedList.add("WorkdayOTPaymentRMBCode");
- filedList.add("PositionAllowanceRMB");
- filedList.add("PositionAllowanceRMBCode");
- filedList.add("netpaymentRMB");
- filedList.add("netpaymentRMBCode");
- filedList.add("YTDtaxRMB");
- filedList.add("YTDtaxRMBCode");
- filedList.add("YTDgrossRMB");
- filedList.add("YTDgrossRMBCode");
- filedList.add("HourlyRateRMB");
- filedList.add("HourlyRateRMBCode");
- filedList.add("ServiceTaxRMB");
- filedList.add("ServiceTaxRMBCode");
- filedList.add("PaymentbeforeRMB");
- filedList.add("PaymentbeforeRMBCode");
- filedList.add("GrossWageRMB");
- filedList.add("GrossWageRMBCode");
- filedList.add("MonthRMB");
- filedList.add("MonthRMBCode");
- filedList.add("paymentcurrency");
- filedList.add("insuranceplanCode");
- filedList.add("insuranceplan");
- filedList.add("insuranceplanId");
- filedList.add("individualIncomeTax");
- filedList.add("individualIncomeTaxCode");
- filedList.add("individualIncomeTaxId");
- filedList.add("housingfund");
- filedList.add("housingfundCode");
- filedList.add("housingfundId");
- filedList.add("medicalCode");
- filedList.add("medicalId");
- filedList.add("medical");
- filedList.add("socialinsurance");
- filedList.add("socialinsuranceCode");
- filedList.add("socialinsuranceId");
- filedList.add("subsidyId");
- filedList.add("subsidyCode");
- filedList.add("subsidyamount");
- filedList.add("weekendOTPaymentId");
- filedList.add("weekendOTPaymentCode");
- filedList.add("weekendOTPayment");
- filedList.add("workdayOTPaymentCode");
- filedList.add("workdayOTPaymentId");
- filedList.add("workdayOTPayment");
- filedList.add("allowanceCode");
- filedList.add("allowanceId");
- filedList.add("allowancecmount");
- filedList.add("settlementcyle");
- filedList.add("Nationalits");
- filedList.add("cuueryName");
- filedList.add("currencyId");
- filedList.add("MonthlysalaryCode");
- filedList.add("GrossWageCode");
- filedList.add("PaymentbeforeCode");
- filedList.add("grossincomeCode");
- filedList.add("ServiceTaxCode");
- filedList.add("YTDtaxCode");
- filedList.add("netpaymentCode");
- filedList.add("HourlyRateCode");
- filedList.add("WorkingHoursCode");
- filedList.add("AttendanceCode");
- filedList.add("department");
- filedList.add("peronid");
- filedList.add("Attendancecount");
- filedList.add("WorkingHourscount");
- filedList.add("WorkingHours");
- filedList.add("HourlyRateamount");
- filedList.add("HourlyRate");
- filedList.add("netpaymentamount");
- filedList.add("YTDnetpayment");
- filedList.add("YTDtaxamount");
- filedList.add("YTDtax");
- filedList.add("grossincome");
- filedList.add("ytdgrossincome");
- filedList.add("ServiceTaxamount");
- filedList.add("ServiceTax");
- filedList.add("beforeamcount");
- filedList.add("PaymentbeforeTax");
- filedList.add("grossamount");
- filedList.add("GrossWage");
- filedList.add("amount");
- filedList.add("Monthlysalary");
- filedList.add("Nationali");
- filedList.add("Attendancedays");
- // 将list元素都转换成小写
- List<String> lowerCaseList = filedList.stream().map(String::toLowerCase).collect(Collectors.toList());
- return lowerCaseList;
- }
- }
|