package com.product.org.admin.service;
|
|
import com.product.org.admin.config.CmnConst;
|
import com.product.org.admin.config.SystemCode;
|
import java.util.Date;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import com.alibaba.druid.util.StringUtils;
|
import com.product.core.dao.BaseDao;
|
import com.product.core.entity.DataTableEntity;
|
import com.product.core.entity.FieldSetEntity;
|
import com.product.core.exception.BaseException;
|
import com.product.core.permission.PermissionService;
|
import com.product.core.service.support.AbstractBaseService;
|
import com.product.core.service.support.QueryFilterService;
|
import com.product.core.spring.context.SpringMVCContextHolder;
|
import com.product.core.transfer.Transactional;
|
import com.product.org.admin.service.idel.IProxyApprovalService;
|
import com.product.util.BaseUtil;
|
|
/**
|
*
|
* Copyright LX-BASE
|
*
|
* @Title: ProxyApprovalService
|
* @Project: LX-BASE-SERVER
|
* @Date: 2020年5月29日 上午10:59:54
|
* @Author: 郑盟
|
* @Description:流程代理配置,对应流程代理表
|
*/
|
@Component
|
public class ProxyApprovalService extends AbstractBaseService implements IProxyApprovalService {
|
@Autowired
|
public BaseDao baseDao;
|
@Autowired
|
PermissionService permissionService;
|
@Autowired
|
public QueryFilterService queryFilterService;
|
|
/**
|
* 流程审批代理列表查询 @param cpage @param pagesize @return @throws BaseException
|
* DataTableEntity @throws
|
*/
|
public DataTableEntity listApproval(FieldSetEntity fs) throws BaseException {
|
//郑盟 2020年12月22日 下午18:34
|
String dataFilter = permissionService.getDataFilter(CmnConst.ORG_LEVEL_UUID);
|
String queryFilter="";
|
if (!BaseUtil.dataTableIsEmpty(fs.getSubDataTable("systemSeniorQueryString"))) {
|
if (!StringUtils.isEmpty(dataFilter)) {
|
queryFilter =" and"+queryFilterService.getQueryFilter(fs);
|
}else {
|
queryFilter =queryFilterService.getQueryFilter(fs);
|
}
|
}
|
return baseDao.listTable(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL, dataFilter+queryFilter, new Object[] {},new Object[] {}, null, fs.getInteger("pagesize"), fs.getInteger("cpage"));
|
|
|
}
|
|
public FieldSetEntity findApproval(FieldSetEntity fs) throws BaseException {
|
return baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL, "uuid=? ",
|
new String[] { fs.getString("uuid") }, false);
|
|
}
|
|
/**
|
* 根据UUID删除流程审批代理
|
*
|
* @return
|
* @throws BaseException
|
*/
|
@Transactional
|
public boolean deleteApprovalList(FieldSetEntity fs) throws BaseException {
|
return baseDao.delete(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL, " uuid=?", new String[] { fs.getString("uuid") });
|
}
|
|
@Transactional
|
public String addApprovalList(FieldSetEntity fs) throws BaseException {
|
// 设置时区值
|
String Org_level_code = SpringMVCContextHolder.getCurrentUser().getOrg_level_code();
|
FieldSetEntity org_levels = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", "org_level_code=?",
|
new String[] { Org_level_code }, false);
|
FieldSetEntity company_time_zone = baseDao.getFieldSetEntityByFilter("product_sys_company_time_zone",
|
"org_level_uuid=?", new String[] { org_levels.getString("uuid") }, false);
|
if (company_time_zone == null) {
|
throw new BaseException(SystemCode.SYSTEM_TIME_ZONE_ERROR.getValue(),
|
SystemCode.SYSTEM_TIME_ZONE_ERROR.getText());
|
}
|
FieldSetEntity zone = baseDao.getFieldSetEntityByFilter("product_common_time_zone", " uuid=?",
|
new String[] { company_time_zone.getString("zone_uuid") }, false);
|
fs.setValue("effective_end_zone", zone.getString("utc_time_zone"));
|
fs.setValue("effective_start_zone", zone.getString("utc_time_zone"));
|
String org_level_uuid = fs.getString("org_level_uuid");
|
//郑盟 2020年12月17日 下午16:05
|
if (StringUtils.isEmpty(org_level_uuid)) {
|
fs.setValue("org_level_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());
|
}
|
fs.setValue(CmnConst.CREATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
|
fs.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
|
return baseDao.add(fs);
|
}
|
|
@Transactional
|
public boolean updateApprovalList(FieldSetEntity fs) throws BaseException {
|
fs.setValue(CmnConst.UPDATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
|
fs.setValue(CmnConst.UPDATED_UTC_DATETIME, new Date());
|
return baseDao.update(fs);
|
}
|
|
public FieldSetEntity findApprovalType(FieldSetEntity fs) throws BaseException {
|
FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL_TYPE,
|
fs.getString("uuid"), false);
|
return baseDao.listInternationDataTable(fieldSetEntity, null);
|
|
}
|
|
@Transactional
|
public String addApprovalType(FieldSetEntity fs) throws BaseException {
|
fs.setValue(CmnConst.CREATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
|
fs.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
|
return baseDao.add(fs);
|
|
}
|
public DataTableEntity listApprovalType(FieldSetEntity fs) throws BaseException {
|
DataTableEntity listTable = baseDao.listTable(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL_TYPE);
|
baseDao.listTable(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL_TYPE, null, null, null, null, fs.getInteger("cpage"),
|
fs.getInteger("pagesize"));
|
if (null != listTable) {
|
return baseDao.listInternationDataTable(listTable, null);
|
}
|
return null;
|
}
|
|
/**
|
* 根据UUID删除流程审批类型代理
|
*
|
* @return
|
* @throws BaseException
|
*/
|
@Transactional
|
public boolean deleteApprovalType(FieldSetEntity fs) throws BaseException {
|
return baseDao.delete(CmnConst.PRODUCT_SYS_FLOW_PROXY_APPROVAL_TYPE, "uuid=?",
|
new String[] { fs.getString("uuid") });
|
}
|
|
}
|