测试kindEditer详解编程语言

这是一个测试kindEditer的工具类,一下是测试代码:

	@Override
	public Map<String, Object> create(Map<String, Object> param) throws Exception {
		Map<String, Object> m = new HashMap<>();
		String username = UserUtils.getUserInfo().getUsername();
		Map<String, Object> userMap = (Map<String, Object>)UserUtils.getExtendsUserInfo();
		List<String> dealerCodes = (List<String>)userMap.get("dealerCodes");
		String dealerCode = dealerCodes.size() > 0 ? dealerCodes.get(0) : null;
		
		String id = UUIDUtils.generateUUID();
		ProjectHeader ph = new ProjectHeader();
		BeanUtils.populate(ph, param);
		ph.setId(id);
		ph.setDealerCode(dealerCode);
		ph.setCreatedBy(username);
		ph.setCreatedTime(DateUtils.getNow(DateUtils.FORMAT_LONG));
		ph.setProjectStatus("01");
		ph.setIsRejected("");
		String vin=ph.getVin();
		String company=generateCompany(vin);
		ph.setCompany(company);
		int insertCount = projectHeaderMapper.insertSelective(ph);
		if(insertCount != 0){
			String paId = UUIDUtils.generateUUID();
			ProjectAction pa = new ProjectAction();
			pa.setId(paId);
			pa.setActionType("01");
			pa.setProgectHeaderGuid(id);
			pa.setCreatedBy(username);
			pa.setCreatedTime(DateUtils.getNow(DateUtils.FORMAT_LONG));
			projectHeaderMapper.insertProjectAction(pa);
			m.put("projectAction", pa);
		}
		m.put("id", id);
		m.put("projectCount", insertCount);
		m.put("projectHeader", ph);
		return m;
	}
	/**
	 * 
	 * @param vin
	 * @return
	 */
	private String generateCompany(String vin) {
		List<Map<String, Object>> mappingList=projectHeaderMapper.selectCompanyMapping();
		String str=vin.substring(4, 7);
		for(Map<String, Object> obj:mappingList) {
			if(obj.get(str)!=null) {
				return obj.get("company")+""; 
			}
		}
		return vin;
	}

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/16127.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论