Search in sources :

Example 6 with ServiceHall

use of com.itrus.portal.db.ServiceHall in project portal by ixinportal.

the class ServiceHallServiceImpl method getServiceHalls.

/**
 * 根据服务商ID,获取服务商的网点信息,根据优先级排序
 * @param id
 * @return
 * @throws Exception
 */
public List<ServiceHall> getServiceHalls(Long id) throws Exception {
    List<ServiceHall> serviceHalls = new ArrayList<>();
    ServiceHallExample example = new ServiceHallExample();
    ServiceHallExample.Criteria criteria = example.or();
    criteria.andServiceProviderEqualTo(id);
    example.setOrderByClause("priority ASC");
    serviceHalls = selectByExample(example);
    return serviceHalls;
}
Also used : ArrayList(java.util.ArrayList) ServiceHall(com.itrus.portal.db.ServiceHall) ServiceHallExample(com.itrus.portal.db.ServiceHallExample)

Example 7 with ServiceHall

use of com.itrus.portal.db.ServiceHall in project portal by ixinportal.

the class ServiceHallServiceImpl method selectByPrimaryKey.

public ServiceHall selectByPrimaryKey(Long id) {
    ServiceHallMapper mapper = sqlSession.getMapper(ServiceHallMapper.class);
    ServiceHall serviceHall = mapper.selectByPrimaryKey(id);
    return serviceHall;
}
Also used : ServiceHall(com.itrus.portal.db.ServiceHall) ServiceHallMapper(com.itrus.portal.db.ServiceHallMapper)

Example 8 with ServiceHall

use of com.itrus.portal.db.ServiceHall in project portal by ixinportal.

the class ServiceHallServiceImpl method saveByJsons.

public void saveByJsons(String serviceHalls, Long id) throws Exception {
    JsonNode jsonNodes = jsonTool.readTree(serviceHalls);
    for (JsonNode jsonNode : jsonNodes) {
        ServiceHall serviceHall = new ServiceHall();
        serviceHall = jsonTool.readValue(jsonNode, ServiceHall.class);
        // 当缺少必要参数的时候,跳过这个
        if (StringUtils.isBlank(serviceHall.getAddress()) || null == serviceHall.getPriority() || StringUtils.isBlank(serviceHall.getServiceHotLine()) || StringUtils.isBlank(serviceHall.getServiceTime())) {
            continue;
        }
        serviceHall.setServiceProvider(id);
        serviceHall.setModifyTime(new Date());
        if (null == serviceHall.getId()) {
            serviceHall.setCreateTime(new Date());
            insert(serviceHall);
        } else {
            updateByPrimaryKeySelective(serviceHall);
        }
    }
}
Also used : JsonNode(org.codehaus.jackson.JsonNode) ServiceHall(com.itrus.portal.db.ServiceHall) Date(java.util.Date)

Aggregations

ServiceHall (com.itrus.portal.db.ServiceHall)8 ServiceProvider (com.itrus.portal.db.ServiceProvider)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ArrayList (java.util.ArrayList)3 ExtraProduct (com.itrus.portal.db.ExtraProduct)2 ServiceHallExample (com.itrus.portal.db.ServiceHallExample)2 ServiceHallMapper (com.itrus.portal.db.ServiceHallMapper)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Enterprise (com.itrus.portal.db.Enterprise)1 ExtraBill (com.itrus.portal.db.ExtraBill)1 ExtraProductSpec (com.itrus.portal.db.ExtraProductSpec)1 UserInfo (com.itrus.portal.db.UserInfo)1 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 IOException (java.io.IOException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 HttpSession (javax.servlet.http.HttpSession)1