String province = request.getParameter("province");
String city = request.getParameter("city");
String county = request.getParameter("county");
Dictionary d0 = dictionaryDao.findByKindAndCode("province", province);
Dictionary d1 = dictionaryDao.findByKindAndCode("city", city);
Dictionary d2 = dictionaryDao.findByKindAndCode("county", county);
Organization o = null;
if (!StrUtil.isNullStr(organization)) {
o = organizationDao.getOrganizationById(Long.parseLong(organization));
}
User u = null;
if (!StrUtil.isNullStr(SJFRDB)) {
// u = userDao.findUser("username", new Object[]{SJFRDB});
u = userDao.findUserByUserName(SJFRDB);
u.setUsertype(User.USER_TYPE_MERCHANT);
}
if (!StrUtil.isNullStr(SJID) && !"0".equals(SJID)){
Merchant mr = merchantDao.getMerchantById(Integer.parseInt(SJID));
mr.setSJMC(SJMC);
mr.setSJLX(SJLX);
mr.setSFSHSM(SFSHSM);
mr.setYYKSSJ(YYKSSJ);
mr.setYYJSSJ(YYJSSJ);
mr.setSJFWXJ(SJFWXJ);
mr.setSJDZ(SJDZ);
mr.setSJDHHM(SJDHHM);
mr.setSJGSZCBH(SJGSZCBH);
if(o != null)mr.setOrganization(o);
if(o != null)mr.setAreaNode(o.getJGSZQY());
mr.setSJFRDB(u);
mr.setUser(rtUser);
mr.setRESERVATION01(RESERVATION01);
mr.setRESERVATION02(RESERVATION02);
mr.setRESERVATION03(RESERVATION03);
mr.setRESERVATION04(RESERVATION04);
mr.setRESERVATION05(RESERVATION05);
mr.setRESERVATION06(RESERVATION06);
mr.setDELETEFLAG("0");
mr.setProvince(d0 != null ? d0.getDETAIL():province);
mr.setCity(d1 != null ? d1.getDETAIL():city);
mr.setCounty(d2 != null ? d2.getDETAIL():county);
merchantDao.updateMerchant(mr);
u.setOrganizationid(mr.getID());
userDao.updateUser(u);
} else {
Merchant mr = new Merchant();
mr.setSJMC(SJMC);
mr.setSJLX(SJLX);
mr.setSFSHSM(SFSHSM);
mr.setYYKSSJ(YYKSSJ);
mr.setYYJSSJ(YYJSSJ);
mr.setSJFWXJ(SJFWXJ);
mr.setSJDZ(SJDZ);
mr.setSJDHHM(SJDHHM);
mr.setSJGSZCBH(SJGSZCBH);
if(o != null)mr.setOrganization(o);
if(o != null)mr.setAreaNode(o.getJGSZQY());
mr.setSJFRDB(u);
mr.setUser(rtUser);
mr.setSJTJSJ(new Date());
mr.setRESERVATION01(RESERVATION01);
mr.setRESERVATION02(RESERVATION02);
mr.setRESERVATION03(RESERVATION03);
mr.setRESERVATION04(RESERVATION04);
mr.setRESERVATION05(RESERVATION05);
mr.setRESERVATION06(RESERVATION06);
mr.setDELETEFLAG("0");
mr.setProvince(d0 != null ? d0.getDETAIL():province);
mr.setCity(d1 != null ? d1.getDETAIL():city);
mr.setCounty(d2 != null ? d2.getDETAIL():county);
merchantDao.createMerchant(mr);
u.setOrganizationid(mr.getID());