2022-02-25 19:41:22 +08:00
|
|
|
package com.engine.salary.cmd.TaxAgent;
|
|
|
|
|
|
|
|
|
|
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTable;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
|
import com.engine.common.biz.AbstractCommonCommand;
|
|
|
|
|
import com.engine.common.entity.BizLogContext;
|
|
|
|
|
import com.engine.core.interceptor.CommandContext;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.PageIdConst;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class TaxAgentListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
|
|
|
|
|
|
public TaxAgentListCmd(Map<String, Object> params, User user) {
|
|
|
|
|
this.user = user;
|
|
|
|
|
this.params = params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BizLogContext getLogContext() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> execute(CommandContext commandContext) {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
String pageID = "a4f85287-e3f9-4275-ab18-7d06e54y6rj8";
|
|
|
|
|
String pageUid = pageID + "_" + user.getUID();
|
|
|
|
|
String pageSize = PageIdConst.getPageSize(pageID, user.getUID());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String fileds = "id, name, description, create_time, update_time, creator, delete_type, tenant_key";
|
|
|
|
|
String fromSql = "FROM hrsa_tax_agent";
|
|
|
|
|
String sqlWhere = makeSqlWhere(params);
|
|
|
|
|
WeaTable table = new WeaTable();
|
|
|
|
|
table.setPageUID(pageUid);
|
|
|
|
|
table.setPageID(pageID);
|
|
|
|
|
table.setPagesize(pageSize);
|
|
|
|
|
table.setBackfields(fileds);
|
|
|
|
|
table.setSqlform(fromSql);
|
|
|
|
|
table.setSqlwhere(sqlWhere);
|
|
|
|
|
table.setSqlorderby("id desc");
|
|
|
|
|
table.setSqlprimarykey("id");
|
|
|
|
|
table.setSqlisdistinct("false");
|
|
|
|
|
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE));
|
2022-03-01 10:28:40 +08:00
|
|
|
table.getColumns().add(new WeaTableColumn("40%", "个税扣缴义务人名称", "name", ""));
|
2022-02-25 19:41:22 +08:00
|
|
|
table.getColumns().add(new WeaTableColumn("40%", "备注", "description", ""));
|
|
|
|
|
|
|
|
|
|
//设置check是否可用
|
|
|
|
|
table.setCheckboxList(null);
|
|
|
|
|
table.setCheckboxpopedom(null);
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
result.success();
|
|
|
|
|
apidatas = result.getResultMap();
|
|
|
|
|
return apidatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* sql条件
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String makeSqlWhere(Map<String, Object> params) {
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
2022-03-01 14:13:02 +08:00
|
|
|
StringBuilder sqlWhere = new StringBuilder("where delete_Type = 0");
|
2022-02-25 19:41:22 +08:00
|
|
|
Collection<String> ids = (Collection<String>) params.get("ids");
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ids)) {
|
|
|
|
|
sqlWhere.append(" AND id in (").append(String.join(",", ids)).append(")");
|
|
|
|
|
}
|
|
|
|
|
//模糊查询
|
|
|
|
|
String name = (String) params.get("name");
|
|
|
|
|
if (StringUtils.isNotBlank(name)) {
|
|
|
|
|
if ("mysql".equalsIgnoreCase(rs.getDBType())) {
|
2022-03-01 13:45:01 +08:00
|
|
|
sqlWhere.append(" AND name like '%").append(name).append("%') ");
|
2022-02-25 19:41:22 +08:00
|
|
|
} else if ("sqlserver".equalsIgnoreCase(rs.getDBType())) {
|
|
|
|
|
sqlWhere.append(" AND name like CONCAT('%',").append(name).append(",'%') ");
|
|
|
|
|
} else if ("oracle".equalsIgnoreCase(rs.getDBType())) {
|
|
|
|
|
sqlWhere.append(" AND name like '%'||").append(name).append("||'%' ");
|
|
|
|
|
} else {
|
|
|
|
|
sqlWhere.append(" AND name like '%'").append(name).append("'%' ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sqlWhere.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|