|  |  |  | 
|---|
|  |  |  | import com.ld.igds.m.InoutManageUtil; | 
|---|
|  |  |  | import com.ld.igds.m.service.HContractManageService; | 
|---|
|  |  |  | import com.ld.igds.models.DicTrigger; | 
|---|
|  |  |  | import com.ld.igds.models.MContract; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 合同管理 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author: | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author: | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class ContractManagePR { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private HContractManageService service; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysDeptService sysDeptService; | 
|---|
|  |  |  | @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"); | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //设置计划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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取参数中分库编码 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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>(); | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 合同类型 | 
|---|
|  |  |  | * ${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, "代储合同")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 客户类型 | 
|---|
|  |  |  | * ${dorado.getDataProvider("contractManagePR#triggerCustomerType").getResult()} | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @DataProvider | 
|---|
|  |  |  | public List<DicTrigger> triggerCustomerType() { | 
|---|
|  |  |  | List<DicTrigger> list = new ArrayList<DicTrigger>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 客户类型 | 
|---|
|  |  |  | * ${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, "个人")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | list.add(new DicTrigger(InoutManageUtil.CUSTOMER_TYPE_1, "企业")); | 
|---|
|  |  |  | list.add(new DicTrigger(InoutManageUtil.CUSTOMER_TYPE_2, "个人")); | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 一致性类型 | 
|---|
|  |  |  | * ${dorado.getDataProvider("contractManagePR#triggerConsistency").getResult()} | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @DataProvider | 
|---|
|  |  |  | public List<DicTrigger> triggerConsistency() { | 
|---|
|  |  |  | List<DicTrigger> list = new ArrayList<DicTrigger>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * contractManagePR#pageContract | 
|---|
|  |  |  | * @param page | 
|---|
|  |  |  | * @param param | 
|---|
|  |  |  | * @throws Exception | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @DataProvider | 
|---|
|  |  |  | public void pageContract(Page<MContract> page, Map<String, Object> param) throws Exception { | 
|---|
|  |  |  | if (null == param) { | 
|---|
|  |  |  | param = new HashMap<String, Object>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | service.pageContract(page, param); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | list.add(new DicTrigger(InoutManageUtil.CONSISTENCY_1, "符合")); | 
|---|
|  |  |  | list.add(new DicTrigger(InoutManageUtil.CONSISTENCY_2, "不符合")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * contractManagePR#saveContract | 
|---|
|  |  |  | * @param data | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @DataResolver | 
|---|
|  |  |  | public void saveContract(MContract data) { | 
|---|
|  |  |  | service.saveContract(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * contractManagePR#delContract | 
|---|
|  |  |  | * @param data | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Expose | 
|---|
|  |  |  | public String delContract(MContract data) { | 
|---|
|  |  |  | return service.delContract(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|