package com.ld.igds.m.view;
|
|
import com.bstek.bdf2.core.model.DefaultDept;
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.DataResolver;
|
import com.bstek.dorado.annotation.Expose;
|
import com.bstek.dorado.data.provider.Page;
|
import com.ld.igds.m.InoutManageUtil;
|
import com.ld.igds.m.service.HContractManageService;
|
import com.ld.igds.models.DicTrigger;
|
import com.ld.igds.models.InoutContract;
|
import com.ld.igds.sys.service.SysDeptService;
|
import com.ld.igds.util.ContextUtil;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 合同管理
|
*
|
* @author:
|
*/
|
@Component
|
public class ContractManagePR {
|
|
@Autowired
|
private HContractManageService service;
|
@Autowired
|
private SysDeptService sysDeptService;
|
|
/**
|
* contractManagePR#getContractTitle 获取合同title
|
*
|
* @param
|
* @return
|
*/
|
@DataProvider
|
public Map<String, Object> getContractTitle(Map<String, Object> param) {
|
Map<String, Object> result = new HashMap<String, Object>();
|
//获取参数中报表类型
|
String type = (String) param.get("type");
|
|
//设置计划title
|
String title = "合同";
|
if (InoutManageUtil.CONTRACT_TYPE_1.equals(type)) {
|
title = "销售" + title;
|
}
|
if (InoutManageUtil.CONTRACT_TYPE_2.equals(type)) {
|
title = "采购" + title;
|
}
|
if (InoutManageUtil.CONTRACT_TYPE_3.equals(type)) {
|
title = "轮换" + title;
|
}
|
|
//获取参数中分库编码
|
String deptId = (String) param.get("deptId");
|
if (StringUtils.isEmpty(deptId)) {
|
deptId = ContextUtil.subDeptId(null);
|
}
|
//获取分库编码对应的分库名称
|
String deptName = "";
|
List<DefaultDept> defaultDepts = sysDeptService.loadUserDepts(ContextUtil.getLoginUserName());
|
for (DefaultDept defaultDept : defaultDepts) {
|
if (defaultDept.getId().equals(deptId)) {
|
deptName = defaultDept.getName();
|
}
|
}
|
|
if (StringUtils.isNotEmpty(deptName)) {
|
title = deptName + " - " + title;
|
}
|
result.put("title", title);
|
return result;
|
}
|
|
/**
|
* 合同类型
|
* ${dorado.getDataProvider("contractManagePR#triggerContractType").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerContractType() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
list.add(new DicTrigger(InoutManageUtil.CONTRACT_TYPE_1, "销售合同"));
|
list.add(new DicTrigger(InoutManageUtil.CONTRACT_TYPE_2, "采购合同"));
|
list.add(new DicTrigger(InoutManageUtil.CONTRACT_TYPE_3, "代储合同"));
|
|
return list;
|
}
|
|
/**
|
* 客户类型
|
* ${dorado.getDataProvider("contractManagePR#triggerCustomerType").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerCustomerType() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
|
list.add(new DicTrigger(InoutManageUtil.CUSTOMER_TYPE_1, "企业"));
|
list.add(new DicTrigger(InoutManageUtil.CUSTOMER_TYPE_2, "个人"));
|
|
return list;
|
}
|
|
/**
|
* 一致性类型
|
* ${dorado.getDataProvider("contractManagePR#triggerConsistency").getResult()}
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<DicTrigger> triggerConsistency() {
|
List<DicTrigger> list = new ArrayList<DicTrigger>();
|
|
list.add(new DicTrigger(InoutManageUtil.CONSISTENCY_1, "符合"));
|
list.add(new DicTrigger(InoutManageUtil.CONSISTENCY_2, "不符合"));
|
|
return list;
|
}
|
|
/**
|
* contractManagePR#pageContract
|
*
|
* @param page
|
* @param param
|
* @throws Exception
|
*/
|
@DataProvider
|
public void pageContract(Page<InoutContract> page, Map<String, Object> param) throws Exception {
|
if (null == param) {
|
param = new HashMap<String, Object>();
|
}
|
service.pageContract(page, param);
|
}
|
|
/**
|
* contractManagePR#saveContract
|
*
|
* @param data
|
*/
|
@DataResolver
|
public void saveContract(InoutContract data) {
|
service.saveContract(data);
|
}
|
|
/**
|
* contractManagePR#delContract
|
*
|
* @param data
|
* @return
|
*/
|
@Expose
|
public String delContract(InoutContract data) {
|
return service.delContract(data);
|
}
|
}
|