org.redis.shop.test.InitData.java Source code

Java tutorial

Introduction

Here is the source code for org.redis.shop.test.InitData.java

Source

package org.redis.shop.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import javax.annotation.Resource;

import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.redis.shop.entity.Address;
import org.redis.shop.entity.Area;
import org.redis.shop.entity.Category;
import org.redis.shop.entity.CategoryWeight;
import org.redis.shop.entity.Center;
import org.redis.shop.entity.CenterOutLibRecord;
import org.redis.shop.entity.CityzenForespeak;
import org.redis.shop.entity.CityzenForespeakItem;
import org.redis.shop.entity.Collection;
import org.redis.shop.entity.Dispatch;
import org.redis.shop.entity.Driver;
import org.redis.shop.entity.Enterprise;
import org.redis.shop.entity.EnterpriseCollection;
import org.redis.shop.entity.Forespeak;
import org.redis.shop.entity.ForespeakItem;
import org.redis.shop.entity.GPS;
import org.redis.shop.entity.GPSRecord;
import org.redis.shop.entity.Honsty;
import org.redis.shop.entity.Loadometer;
import org.redis.shop.entity.PlateformScale;
import org.redis.shop.entity.Price;
import org.redis.shop.entity.Recycle;
import org.redis.shop.entity.Report;
import org.redis.shop.entity.Role;
import org.redis.shop.entity.RoleResource;
import org.redis.shop.entity.SaleInfo;
import org.redis.shop.entity.Scale;
import org.redis.shop.entity.Site;
import org.redis.shop.entity.Stock;
import org.redis.shop.entity.StockRemoval;
import org.redis.shop.entity.Supervision;
import org.redis.shop.entity.Tag;
import org.redis.shop.entity.Task;
import org.redis.shop.entity.Transaction;
import org.redis.shop.entity.Transport;
import org.redis.shop.entity.User;
import org.redis.shop.entity.UserRole;
import org.redis.shop.entity.Vechile;
import org.redis.shop.entity.Vedio;
import org.redis.shop.entity.VedioAddress;
import org.redis.shop.enums.Enum_Company;
import org.redis.shop.enums.Enum_Honsty;
import org.redis.shop.enums.Enum_Response;
import org.redis.shop.enums.Enum_Running;
import org.redis.shop.enums.Enum_TagType;
import org.redis.shop.enums.Enum_Transaction;
import org.redis.shop.enums.Enum_TransactionProperty;
import org.redis.shop.enums.Enum_Use;
import org.redis.shop.enums.Enum_Vechile;
import org.redis.shop.enums.Enum_forespeak_comments;
import org.redis.shop.enums.Enum_sale;
import org.redis.shop.service.AddressService;
import org.redis.shop.service.AreaService;
import org.redis.shop.service.CategoryService;
import org.redis.shop.service.CategoryWeightService;
import org.redis.shop.service.CenterOutLibRecordService;
import org.redis.shop.service.CenterService;
import org.redis.shop.service.CityzenForespeakItemService;
import org.redis.shop.service.CityzenForespeakService;
import org.redis.shop.service.CollectionService;
import org.redis.shop.service.DispatchService;
import org.redis.shop.service.DriverService;
import org.redis.shop.service.EnterpriseCollectionService;
import org.redis.shop.service.EnterpriseService;
import org.redis.shop.service.ForeSpeakService;
import org.redis.shop.service.ForespeakItemService;
import org.redis.shop.service.GPSRecordService;
import org.redis.shop.service.GPSService;
import org.redis.shop.service.HonstyService;
import org.redis.shop.service.LoadometerService;
import org.redis.shop.service.PlateformScaleService;
import org.redis.shop.service.PopulationService;
import org.redis.shop.service.PriceService;
import org.redis.shop.service.RecycleService;
import org.redis.shop.service.ReportService;
import org.redis.shop.service.ResourceService;
import org.redis.shop.service.RoleResourceService;
import org.redis.shop.service.RoleService;
import org.redis.shop.service.SaleInfoService;
import org.redis.shop.service.ScaleService;
import org.redis.shop.service.SiteService;
import org.redis.shop.service.StockRemovalService;
import org.redis.shop.service.StockService;
import org.redis.shop.service.SupervisionService;
import org.redis.shop.service.TagService;
import org.redis.shop.service.TaskService;
import org.redis.shop.service.TransactionService;
import org.redis.shop.service.TransportService;
import org.redis.shop.service.UserRoleService;
import org.redis.shop.service.UserService;
import org.redis.shop.service.VechileService;
import org.redis.shop.service.VedioAddressService;
import org.redis.shop.service.VedioService;
import org.redis.shop.util.DataUtil;
import org.redis.shop.util.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@ContextConfiguration("classpath:applicationContext.xml")
public class InitData extends AbstractJUnit4SpringContextTests {

    @Resource
    private UserService userService;
    @Resource
    private CategoryWeightService categoryWeightService;
    @Resource
    private UserRoleService userRoleService;
    @Resource
    private RoleService roleService;
    @Resource
    private RoleResourceService roleResourceService;
    @Resource
    private ResourceService resourceService;
    @Resource
    private CenterService centerService;
    @Resource
    private LoadometerService loadometerService;
    @Resource
    private TaskService taskService;
    @Resource
    private SiteService siteService;
    @Resource
    private ScaleService scaleService;
    @Resource
    private PlateformScaleService plateformScaleService;
    @Resource
    private RecycleService recycleService;
    @Resource
    private ReportService reportService;
    @Resource
    private CategoryService categoryService;
    @Resource
    private GPSService gPSService;
    @Resource
    private VechileService vechileService;
    @Resource
    private VedioService vedioService;
    @Resource
    private TagService tagService;
    @Resource
    private DispatchService dispatchService;
    @Resource
    private SupervisionService supervisionService;
    @Resource
    private AreaService areaService;
    @Resource
    private PopulationService populationService;
    @Resource
    private TransactionService transactionService;
    @Resource
    private PriceService priceService;
    @Resource
    private HonstyService honstyService;
    @Resource
    private GPSRecordService gPSRecordService;
    @Resource
    private VedioAddressService vedioAddressService;
    @Autowired
    private CenterOutLibRecordService centerOutLibRecordService;
    @Autowired
    private AddressService addressService;
    @Autowired
    private TransportService transportService;
    @Resource
    private CityzenForespeakService cityzenForespeakService;
    @Resource
    private ForeSpeakService foreSpeakService;
    @Resource
    private StockService stockService;
    @Resource
    private CityzenForespeakItemService cityzenForespeakItemService;
    @Resource
    private CollectionService collectionService;
    @Resource
    private ForespeakItemService foresspeakItemService;
    @Resource
    private DriverService driverService;
    @Resource
    private SaleInfoService saleInfoService;
    @Resource
    private EnterpriseCollectionService enterpriseCollectionService;
    @Resource
    private EnterpriseService enterpriseService;
    @Resource
    private StockRemovalService stockRemovalService;

    @Test
    public void aa_addUser() {
        List<Address> addresses = new ArrayList<>();
        Address address = new Address();
        address.setProvince("??");
        address.setCity("?");
        address.setDistrict("");
        address.setInfo("19202");
        address.setLongitude(120.541715);
        address.setLatitude(31.281199);
        String addressId = (String) addressService.save(address);

        User user = new User();
        user.setCreateDate(new Date());
        user.setEmail("491298212@qq.com");
        user.setLastTime(new Date());
        user.setMobile("15995790836");
        user.setPassed(true);
        user.setUserNum("00001");
        user.setPassword("202cb962ac59075b964b07152d234b70");
        user.setName("jack");
        user.setAddress(addressService.get("id", addressId));
        addresses.add(addressService.get("id", addressId));
        user.setAddresses(addresses);
        user.setQq("491298212");
        user.setRealName("killer-jack");
        user.setThisTime(new Date());
        userService.save(user);

        Role role = new Role();
        role.setCreateDate(new Date());
        role.setRoleName("admin");
        role.setCreator("jack");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(user);
        userRole.setRole(role);
        userRoleService.save(userRole);

        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
        resource.setResourcesAuthority("ROLE_MAIN");
        resource.setResourcesName("?");
        resource.setUrl("/mainFrame");
        resourceService.save(resource);

        RoleResource roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);
    }

    //??
    @Test
    public void ab_addNewMenu() {
        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();

        resource.setResourcesAuthority("ROLE_MAP");
        resource.setResourcesName("??");
        resource.setUrl("/getMap");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_PRICE");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_PRICE_RELEASE");
        resource.setUrl("/price/price_release");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_PRICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_PRICE_SITUATION");
        resource.setUrl("/price/price_list_quotation");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_PRICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_FORESPEAK");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_FORESPEAK_HANDLE");
        resource.setUrl("/forespeak/handle");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_FORESPEAK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_FORESPEAK_LAUNCH");
        resource.setUrl("/forespeak/forespeak_apply");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_FORESPEAK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_FORESPEAK_HISTORY");
        resource.setUrl("/forespeak/history");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_FORESPEAK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_FORESPEAK_DISPATCH_HANDLE");
        resource.setUrl("/dispatch/forespeakhandle");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_TRANSACTION");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_TRANSACTION_IN");
        resource.setUrl("/center/showCenterBuyInRecordPage");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_TRANSACTION"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_TRANSACTION_OUT");
        resource.setUrl("/center/showCenterSaleOutRecordPage");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_TRANSACTION"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_TRANSACTION_SITE");
        resource.setUrl("/site/resource_library_manager");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_TRANSACTION"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_TRANSACTION_CENTER");
        resource.setUrl("/center/resource_library_manager");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_TRANSACTION"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STOCK");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STOCK_IN");
        resource.setUrl("/center/resource_library");
        //         resource.setUrl("/recycle/in_repertory");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STOCK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STOCK_OUT");
        resource.setUrl("/center/resource_library_out");
        //         resource.setUrl("/transaction_manager/out_repertory");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STOCK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STOCK_INFO");
        resource.setUrl("/stock/info");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STOCK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_STOCK_SITE");
        resource.setUrl("/stock/site");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STOCK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_STOCK_CENTER");
        resource.setUrl("/stock/center");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STOCK"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_VIDEO");
        resource.setUrl("/monitor/vedioAddressListShow");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_MONEY");
        resource.setUrl("/system/money");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_ACCOUNT");
        resource.setUrl("/self_manager");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_HONSTY");
        resource.setUrl("/center/center_honsty");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_DISPATCH");
        resource.setUrl("/dispatch/center_dispatch_list");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_SYSTEM");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_SYSTEM_USER");
        resource.setUrl("/user_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_SYSTEM"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("???");
        resource.setResourcesAuthority("ROLE_SYSTEM_AUTHORITY");
        resource.setUrl("#");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_SYSTEM"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("??");
        resource.setResourcesAuthority("ROLE_ADMIN_MANAGER");
        resource.setUrl("/admin_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_SYSTEM_AUTHORITY"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_MANAGER");
        resource.setUrl("/role/role_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_SYSTEM_AUTHORITY"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("???");
        resource.setResourcesAuthority("ROLE_AUTHORITY_MANAGER");
        resource.setUrl("/resource/resource_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_SYSTEM_AUTHORITY"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("??");
        resource.setResourcesAuthority("ROLE_AUTO_NUM");
        resource.setUrl("/center/automatic_storage_parameter");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_SYSTEM"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("??");
        resource.setResourcesAuthority("ROLE_CATEGORY");
        resource.setUrl("/category/category_list");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_DEVICE");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_LOADOMETER");
        resource.setUrl("/loadometer_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("???");
        resource.setResourcesAuthority("ROLE_SCALE");
        resource.setUrl("/scale_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("???");
        resource.setResourcesAuthority("ROLE_PLATEFORM_SCALE");
        resource.setUrl("/plateform_scale_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("GPS?");
        resource.setResourcesAuthority("ROLE_GPS");
        resource.setUrl("/GPS_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_VECHILE");
        resource.setUrl("/vechile_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_VIDEO_DEVICE");
        resource.setUrl("/vedio_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("??");
        resource.setResourcesAuthority("ROLE_TAG");
        resource.setUrl("/tag_list");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_DEVICE"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_VIDEO_MONITOR");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_VIDEO_SITE");
        //         resource.setUrl("/system/videosite");
        resource.setUrl("/monitor/vedioAddressListShowSite");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_VIDEO_MONITOR"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_VIDEO_CENTER");
        resource.setUrl("/monitor/vedioAddressListShowCenter");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_VIDEO_MONITOR"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_VIDEO_DISPATCH");
        resource.setUrl("/monitor/vedioAddressListShowDispatch");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_VIDEO_MONITOR"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("???");
        resource.setResourcesAuthority("ROLE_LIST");
        resource.setUrl("/sytem/list");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_DATA_OUTPUT");
        resource.setUrl("/");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("???");
        resource.setResourcesAuthority("ROLE_STATISTICS");
        resource.setUrl("#");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STATISTICS_DATA");
        resource.setUrl("#");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STATISTICS"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_STATISTICS_RECYCLE");
        resource.setUrl("/report/recycleReport");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STATISTICS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STATISTICS_TRANSPORT");
        resource.setUrl("/report/vechileReport");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STATISTICS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_STATISTICS_DEAL");
        resource.setUrl("/report/processingReport");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STATISTICS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("??");
        resource.setResourcesAuthority("ROLE_ANALYSIS_DATA");
        resource.setUrl("#");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_STATISTICS"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("??");
        resource.setResourcesAuthority("ROLE_ANALYSIS_RECYCLE");
        resource.setUrl("/report/dataAnalysisReport");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_ANALYSIS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_FORECAST_RECYCLE");
        resource.setUrl("/report/recycling_quantity_forecast");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_ANALYSIS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_EFFICIENCY_TRANSPORT");
        resource.setUrl("/report/collectionEfficiency");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_ANALYSIS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_EFFICIENCY_DEAL");
        resource.setUrl("/report/efficiency");
        resource.setParentResource(resourceService.get("resourcesAuthority", "ROLE_ANALYSIS_DATA"));
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("");
        resource.setResourcesAuthority("ROLE_CITYZEN_FORESPEAK");
        resource.setUrl("/");
        resourceService.save(resource);

        resource = new org.redis.shop.entity.Resource();
        resource.setResourcesName("?");
        resource.setResourcesAuthority("ROLE_CITYZEN_TRANSACTION");
        resource.setUrl("/");
        resourceService.save(resource);

    }

    @Test
    public void ac_addAdminRole() {
        RoleResource roleResource = roleResourceService.getAll().get(0);
        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MAIN");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_MAP");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_SYSTEM");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_SYSTEM_USER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_SYSTEM_AUTHORITY");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ADMIN_MANAGER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_MANAGER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_AUTHORITY_MANAGER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_AUTO_NUM");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_CATEGORY");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_DEVICE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_LOADOMETER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_SCALE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_PLATEFORM_SCALE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_GPS");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VECHILE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO_DEVICE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TAG");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO_MONITOR");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO_SITE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO_CENTER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO_DISPATCH");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION_SITE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION_CENTER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_LIST");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_SITE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_CENTER");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_DATA_OUTPUT");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STATISTICS");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STATISTICS_DATA");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STATISTICS_RECYCLE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STATISTICS_TRANSPORT");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STATISTICS_DEAL");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ANALYSIS_DATA");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ANALYSIS_RECYCLE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_FORECAST_RECYCLE");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_EFFICIENCY_TRANSPORT");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_EFFICIENCY_DEAL");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ACCOUNT");
        roleResource.setResource(resource);
        roleResourceService.save(roleResource);
    }
    /*
    @Test
    public void addMenuResource() {
       org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
       RoleResource roleResource = roleResourceService.getAll().get(0);
       resource.setResourcesAuthority("ROLE_MAP");
       resource.setResourcesName("");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       roleResource = roleResourceService.getAll().get(0);
       resource.setResourcesAuthority("ROLE_MAP_SHOW");
       resource.setResourcesName("");
       resource.setUrl("/getMap");
       resource.setParentResource(resourceService.get("resourcesName", ""));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_CATEGORY");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_CATEGORY_MANAGER");
       resource.setUrl("/category/category_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_DEVICE");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_LOADOMETER");
       resource.setUrl("/loadometer_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("???");
       resource.setResourcesAuthority("ROLE_SCALE");
       resource.setUrl("/scale_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("???");
       resource.setResourcesAuthority("ROLE_PLATEFORM_SCALE");
       resource.setUrl("/plateform_scale_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("GPS?");
       resource.setResourcesAuthority("ROLE_GPS");
       resource.setUrl("/GPS_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_VECHILE");
       resource.setUrl("/vechile_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_VEDIO");
       resource.setUrl("/vedio_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_TAG");
       resource.setUrl("/tag_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_TRADE");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_SITE");
       resource.setUrl("#");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_RECYCLE");
       resource.setUrl("/recycle/recycle_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_PRICE_SITE");
       resource.setUrl("/price/price_list_site");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("");
       resource.setResourcesAuthority("ROLE_FORESPEAK");
       resource.setUrl("/forespeak/forespeak_apply");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_FORESPEAK_SITE");
       resource.setUrl("/forespeak/forespeak_list_site");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_FORESPEAK_CITYZEN");
       resource.setUrl("/forespeak/cityzenForespeak_list");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_TRANSACTION_SITE");
       resource.setUrl("/site/resource_library");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_TRANSACTION_SITEMANAGER");
       resource.setUrl("/site/resource_library_manager");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("");
       resource.setResourcesAuthority("ROLE_HONISTY_SITE");
       resource.setUrl("/site/site_honsty");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_CENTER");
       resource.setUrl("#");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_PRICE");
       resource.setUrl("/price/price_list_center");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_FORESPEAK_CENTER");
       resource.setUrl("/forespeak/forespeak_list_center");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_AUTO_NUM");
       resource.setUrl("/center/automatic_storage_parameter");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_PROBLEM_INTO_STOCK");
       resource.setUrl("/center/resource_problem");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_INTO_STOCK");
       resource.setUrl("/center/resource_library");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_TRANSACTION_CENTER");
       resource.setUrl("/center/resource_library_manager");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_HONSTY");
       resource.setUrl("/center/center_honsty");
       resource.setParentResource(resourceService.get("resourcesName",
        "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("");
       resource.setResourcesAuthority("ROLE_DISPATCH");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("");
       resource.setResourcesAuthority("ROLE_CALL_CENTER");
       resource.setUrl("/dispatch/cityzen_dispatch_list");
       resource.setParentResource(resourceService.get("resourcesName", ""));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_CENTER_DISPATCH");
       resource.setUrl("/dispatch/center_dispatch_list");
       resource.setParentResource(resourceService.get("resourcesName", ""));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_MONITOR");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?GPS?");
       resource.setResourcesAuthority("ROLE_READ_GPS");
       resource.setUrl("");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("");
       resource.setResourcesAuthority("ROLE_VECHILE_MONITOR");
       resource.setUrl("");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("");
       resource.setResourcesAuthority("ROLE_VEDIO_MONITOR");
       resource.setUrl("/monitor/vedioAddressListShow");
       resource.setParentResource(resourceService.get("resourcesName",
        "??"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??/?");
       resource.setResourcesAuthority("ROLE_STATISTICS");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_TRADE_AREASTATISTICS");
       resource.setUrl("/report/dayReport");
       resource.setParentResource(resourceService.get("resourcesName",
        "??/?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_TRADE_SITESTATISTICS");
       resource.setUrl("/report/siteReport");
       resource.setParentResource(resourceService.get("resourcesName",
        "??/?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_TRADE_VECHILESTATISTICS");
       resource.setUrl("/report/vechileReport");
       resource.setParentResource(resourceService.get("resourcesName",
        "??/?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?/?");
       resource.setResourcesAuthority("ROLE_RECYCLE_DATAANALYSISSTATISTICS");
       resource.setUrl("/report/dataAnalysisReport");
       resource.setParentResource(resourceService.get("resourcesName",
        "??/?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_SYSTEM");
       resource.setUrl("#");
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_USER_MANAGER");
       resource.setUrl("/user_list");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("???");
       resource.setResourcesAuthority("ROLE_UNIT");
       resource.setUrl("#");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_SITE_MANAGER");
       resource.setUrl("/site/site_list");
       resource.setParentResource(resourceService.get("resourcesName", "???"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_CENTER_MANAGER");
       resource.setUrl("/center/center_list");
       resource.setParentResource(resourceService.get("resourcesName", "???"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_DISPATCH_MANAGER");
       resource.setUrl("/dispatch/dispatch_list");
       resource.setParentResource(resourceService.get("resourcesName", "???"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_POPULATION");
       resource.setUrl("/population/population_list");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("???");
       resource.setResourcesAuthority("ROLE_AUTHORITY");
       resource.setUrl("#");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("??");
       resource.setResourcesAuthority("ROLE_ADMIN_MANAGER");
       resource.setUrl("/admin_list");
       resource.setParentResource(resourceService.get("resourcesName", "???"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_MANAGER");
       resource.setUrl("/role/role_list");
       resource.setParentResource(resourceService.get("resourcesName", "???"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("???");
       resource.setResourcesAuthority("ROLE_AUTHORITY_MANAGER");
       resource.setUrl("/resource/resource_list");
       resource.setParentResource(resourceService.get("resourcesName", "???"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_SELF");
       resource.setUrl("/self_manager");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_PASSWORD");
       resource.setUrl("/password_manager");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_OPERATION");
       resource.setUrl("/operation_manager");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
       resource = new org.redis.shop.entity.Resource();
       resource.setResourcesName("?");
       resource.setResourcesAuthority("ROLE_VERSION");
       resource.setUrl("/system_version");
       resource.setParentResource(resourceService.get("resourcesName", "?"));
       resourceService.save(resource);
       roleResource.setResource(resource);
       roleResourceService.save(roleResource);
        
           
           
       System.out.println("---------------------??????---------------------------");
       *//**
          * ?
          */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_PRICECONTROL");
    resource.setUrl("#");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_PRICEDISSEMINATION");
    resource.setUrl("/price/price_list_site");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?site"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_PRICECONTROL"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * 
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("");
    resource.setResourcesAuthority("ROLE_PRICEINFORMATION");
    resource.setUrl("/forespeak/forespeak_apply");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_PRICECONTROL"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_BOOKINGMANAGEMENT");
    resource.setUrl("#");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * 
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("");
    resource.setResourcesAuthority("ROLE_CHECKAPPOINTMENT");
    resource.setUrl("/forespeak/forespeak_list_site");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_BOOKINGMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_BOOKINGHISTORY");
    resource.setUrl("/forespeak/forespeak_list_site");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_BOOKINGMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_DEALMANAGEMENT");
    resource.setUrl("/site/resource_library");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_INVENTORYMANAGEMENT");
    resource.setUrl("#");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_STOCKMANAGEMENT");
    resource.setUrl("/forespeak/cityzenForespeak_list");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_INVENTORYMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_STOCKREMOVALMANAGEMENT");
    resource.setUrl("/site/resource_library");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_INVENTORYMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_STOCKINFORMATION");
    resource.setUrl("");// 
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_INVENTORYMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * 
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("");
    resource.setResourcesAuthority("ROLE_VIDEOSURVEILLANCE");
    resource.setUrl("");// 
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ??
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("??");
    resource.setResourcesAuthority("ROLE_SITEINFORMATIONMANAGEMENT");
    resource.setUrl("#");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ??
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("??");
    resource.setResourcesAuthority("ROLE_PERSONAGEINFORMATIONMANAGEMENT");
    resource.setUrl("/self_manager");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_SITEINFORMATIONMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * ?
       */
    /*
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_PERSONAGEINFORMATIONMODIFICATION");
    resource.setUrl("/password_manager");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_SITEINFORMATIONMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * 
       */
    /*
    // ?
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_PRICEMANAGEMENT1");
    resource.setUrl("#");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_PRICERELEASED");
    resource.setUrl("/price/price_list_center");
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_PRICEMANAGEMENT1"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("");
    resource.setResourcesAuthority("ROLE_AUTONUM");
    resource.setUrl("/center/automatic_storage_parameter");
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_PRICEMANAGEMENT1"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    // ?
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_FORESPEAKCENTER1");
    resource.setUrl("#");
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("");
    resource.setResourcesAuthority("ROLE_CHECKTOMAKEANAPPOINTMENT");
    resource.setUrl("/forespeak/forespeak_list_center");
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_FORESPEAKCENTER1"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_HISTORYTOMAKEANAPPOINTMENT");
    resource.setUrl("/forespeak/forespeak_list_center");
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_FORESPEAKCENTER1"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
    *//**
       * 
       */

    /*
        
    * ?
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_TRANSACTIONMANAGEMENT");
    resource.setUrl("/forespeak/forespeak_list_center");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
    * ?
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_CINVENTORYMANAGEMENT");
    resource.setUrl("#");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
    * ?
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_CSTOCKMANAGEMENT");
    resource.setUrl("/center/resource_library");
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_CINVENTORYMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
    * ?
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_CSTOCKINFORMATION");
    resource.setUrl("");// 
    // resource.setParentResource(resourceService.get("resourcesName",
    // "?"));
    resource.setParentResource(resourceService.get("resourcesAuthority",
       "ROLE_CINVENTORYMANAGEMENT"));
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("?");
    resource.setResourcesAuthority("ROLE_INTEGRITY_MANAGEMENT");
    resource.setUrl("/center/center_honsty");
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("");
    resource.setResourcesAuthority("ROLE_VEDIOMONITOR1");
    resource.setUrl("");
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
    resource = new org.redis.shop.entity.Resource();
    resource.setResourcesName("??");
    resource.setResourcesAuthority("ROLE_INFORMATION_MANAGEMENT");
    resource.setUrl("/self_manager");
    resourceService.save(resource);
    //      roleResource.setResource(resource);
    //      roleResourceService.save(roleResource);
        
        
        
        
        
        
        
    *//**
       * 
       *//*
              
          resource = new org.redis.shop.entity.Resource();
          resource.setResourcesName("?");
          resource.setResourcesAuthority("ROLE_CALLCENTER");
          resource.setUrl("/dispatch/cityzen_dispatch_list");
          // resource.setParentResource(resourceService.get("resourcesName",
          // ""));
          resourceService.save(resource);
          //      roleResource.setResource(resource);
          //      roleResourceService.save(roleResource);
              
          resource = new org.redis.shop.entity.Resource();
          resource.setResourcesName("");
          resource.setResourcesAuthority("ROLE_CENTERDISPATCH");
          resource.setUrl("/dispatch/center_dispatch_list");
          // resource.setParentResource(resourceService.get("resourcesName",
          // ""));
          resourceService.save(resource);
          //      roleResource.setResource(resource);
          //      roleResourceService.save(roleResource);
              
          resource = new org.redis.shop.entity.Resource();
          resource.setResourcesName("");
          resource.setResourcesAuthority("ROLE_VEDIOMONITOR");
          resource.setUrl("");
          // resource.setParentResource(resourceService.get("resourcesName",
          // "??"));
          resourceService.save(resource);
          //      roleResource.setResource(resource);
          //      roleResourceService.save(roleResource);
              
          resource = new org.redis.shop.entity.Resource();
          resource.setResourcesName("??");
          resource.setResourcesAuthority("ROLE_SELFACCOUNT");
          resource.setUrl("/self_manager");
          // resource.setParentResource(resourceService.get("resourcesName",
          // "?"));
          resourceService.save(resource);
          //      roleResource.setResource(resource);
          //      roleResourceService.save(roleResource);
              
          }*/

    @Test
    public void ad_addCenterRole() {
        User user = new User();
        user.setCreateDate(new Date());
        user.setEmail("491298211@qq.com");
        user.setLastTime(new Date());
        user.setMobile("15995732311");
        user.setPassed(true);
        user.setUserNum("00003");
        user.setPassword(MD5.getMD5("123"));
        user.setName("c2");
        user.setQq("491298215");
        user.setRealName("killer-jack2");
        user.setThisTime(new Date());
        userService.save(user);

        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("491298213@qq.com");
        user.setLastTime(new Date());
        user.setMobile("15995790831");
        user.setPassed(true);
        user.setUserNum("00002");
        user.setPassword(MD5.getMD5("123"));
        user.setName("c1");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        Role role = new Role();
        role.setCreateDate(new Date());
        role.setRoleName("center");
        role.setCreator("jack");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(userService.getByUserName("c1"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("c2"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MAIN");
        RoleResource roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MAP");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_PRICE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_PRICE_RELEASE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_PRICE_SITUATION");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK_HANDLE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK_HISTORY");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION_IN");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION_OUT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_IN");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_OUT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_INFO");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_HONSTY");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MONEY");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_ACCOUNT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

    }

    @Test
    public void ae_addSiteRole() {
        User user = new User();
        user.setCreateDate(new Date());
        user.setEmail("491214510@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13989790835");
        user.setPassed(true);
        user.setUserNum("00008");
        user.setPassword(MD5.getMD5("123"));
        user.setName("s1");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("49112231@qq.com");
        user.setLastTime(new Date());
        user.setMobile("12919790831");
        user.setPassed(true);
        user.setUserNum("00009");
        user.setPassword(MD5.getMD5("123"));
        user.setName("s2");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("4911223451@qq.com");
        user.setLastTime(new Date());
        user.setMobile("12919790836");
        user.setPassed(true);
        user.setUserNum("00010");
        user.setPassword(MD5.getMD5("123"));
        user.setName("s3");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("4911228931@qq.com");
        user.setLastTime(new Date());
        user.setMobile("12919790832");
        user.setPassed(true);
        user.setUserNum("00011");
        user.setPassword(MD5.getMD5("123"));
        user.setName("s4");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        Role role = new Role();
        role.setCreateDate(new Date());
        role.setRoleName("site");
        role.setCreator("jack");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(userService.getByUserName("s1"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("s2"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("s3"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("s4"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MAIN");
        RoleResource roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_MAP");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_PRICE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_PRICE_RELEASE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_PRICE_SITUATION");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK_HANDLE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK_LAUNCH");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION_IN");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_TRANSACTION_OUT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_IN");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_OUT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_STOCK_INFO");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_MONEY");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ACCOUNT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);
    }

    @Test
    public void af_addDispatchRole() {
        User user = new User();
        user.setCreateDate(new Date());
        user.setEmail("4912qweq510@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13989ec0835");
        user.setPassed(true);
        user.setUserNum("000011");
        user.setPassword(MD5.getMD5("123"));
        user.setName("d1");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("4912dweq510@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13sc9ec0835");
        user.setPassed(true);
        user.setUserNum("000012");
        user.setPassword(MD5.getMD5("123"));
        user.setName("d2");
        user.setQq("491298212");
        user.setRealName("killer-jack1");
        user.setThisTime(new Date());
        userService.save(user);

        Role role = new Role();
        role.setCreateDate(new Date());
        role.setRoleName("dispatch");
        role.setCreator("jack");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(userService.getByUserName("d1"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("d2"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MAIN");
        RoleResource roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_FORESPEAK_DISPATCH_HANDLE");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_DISPATCH");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_VIDEO");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ACCOUNT");
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

    }

    /**
     * 
     */
    @Test
    public void ag_addResidentRole() {
        List<Address> addresses = new ArrayList<>();
        Address address = new Address();
        address.setProvince("??");
        address.setCity("?");
        address.setDistrict("");
        address.setInfo("19202");
        address.setLongitude(120.541715);
        address.setLatitude(31.281199);
        String addressId = (String) addressService.save(address);

        User user = new User();
        user.setCreateDate(new Date());
        user.setEmail("66666@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13140995776");
        user.setPassed(true);
        user.setUserNum("0000111");
        user.setPassword(MD5.getMD5("123"));
        user.setName("r1");
        user.setQq("345949244");
        user.setAddress(addressService.get(addressId));
        addresses.add(addressService.get(addressId));
        user.setAddresses(addresses);
        user.setRealName("");
        user.setThisTime(new Date());
        userService.save(user);

        address.setLongitude(120.581852);
        address.setLatitude(31.286607);
        addressId = (String) addressService.save(address);
        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("777778@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13140995777");
        user.setPassed(true);
        user.setAddress(addressService.get(addressId));
        addresses.clear();
        addresses.add(addressService.get(addressId));
        user.setAddresses(addresses);
        user.setUserNum("0000112");
        user.setPassword(MD5.getMD5("123"));
        user.setName("r2");
        user.setQq("3459492443");
        user.setRealName("");
        user.setThisTime(new Date());
        userService.save(user);

        address.setLongitude(120.583073);
        address.setLatitude(31.304689);
        addressId = (String) addressService.save(address);
        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("777779@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13141099578");
        user.setPassed(true);
        user.setAddress(addressService.get(addressId));
        addresses.clear();
        addresses.add(addressService.get(addressId));
        user.setAddresses(addresses);
        user.setUserNum("0000113");
        user.setPassword(MD5.getMD5("123"));
        user.setName("r3");
        user.setQq("3459492442");
        user.setRealName("");
        user.setThisTime(new Date());
        userService.save(user);

        address.setLongitude(120.54901);
        address.setLatitude(31.285805);
        addressId = (String) addressService.save(address);
        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("777771@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13142099578");
        user.setPassed(true);
        user.setUserNum("0000115");
        user.setAddress(addressService.get(addressId));
        addresses.clear();
        addresses.add(addressService.get(addressId));
        user.setAddresses(addresses);
        user.setPassword(MD5.getMD5("123"));
        user.setName("r4");
        user.setQq("3459492441");
        user.setRealName("");
        user.setThisTime(new Date());
        userService.save(user);

        address.setLongitude(120.54132);
        address.setLatitude(31.280991);
        addressId = (String) addressService.save(address);
        user = new User();
        user.setCreateDate(new Date());
        user.setEmail("777770@qq.com");
        user.setLastTime(new Date());
        user.setMobile("13145099578");
        user.setPassed(true);
        user.setUserNum("0000116");
        user.setAddress(addressService.get(addressId));
        addresses.clear();
        addresses.add(addressService.get(addressId));
        user.setAddresses(addresses);
        user.setPassword(MD5.getMD5("123"));
        user.setName("r5");
        user.setQq("3459492445");
        user.setRealName("");
        user.setThisTime(new Date());
        userService.save(user);

        Role role = new Role();
        role.setCreateDate(new Date());
        role.setRoleName("resident");
        role.setCreator("jack");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(userService.getByUserName("r1"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("r2"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("r3"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("r4"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        userRole = new UserRole();
        userRole.setUser(userService.getByUserName("r5"));
        userRole.setRole(role);
        userRoleService.save(userRole);

        org.redis.shop.entity.Resource resource = new org.redis.shop.entity.Resource();
        resource = resourceService.get("resourcesAuthority", "ROLE_MAIN");
        RoleResource roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_CITYZEN_FORESPEAK");
        roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_CITYZEN_TRANSACTION");
        roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

        resource = resourceService.get("resourcesAuthority", "ROLE_ACCOUNT");
        roleResource = new RoleResource();
        roleResource.setResource(resource);
        roleResource.setRole(role);
        roleResourceService.save(roleResource);

    }

    @Test
    public void ah_addCenter() {
        Center center = new Center();
        center.setAddress("??");
        center.setCenterNum("FJ-001");
        center.setCategory(Enum_Company.GT);
        center.setCreateDate(new Date());
        center.setCreator("jack");
        center.setMaterial("xxx");
        center.setName("????");
        center.setPhone("05112-65333333");
        center.setProvince("??");
        center.setCity("?");
        center.setReferValue(0.1f);
        center.setRegion("");
        center.setStreet("?");
        center.setUpdateDate(new Date());
        center.setUser(userService.get("name", "c1"));
        center.setCenterNum("74110");
        center.setLongitude(120.741966);
        center.setLatitude(31.255928);
        centerService.save(center);

        center = new Center();
        center.setAddress("??1");
        center.setCenterNum("FJ-002");
        center.setCategory(Enum_Company.GT);
        center.setCreateDate(new Date());
        center.setCreator("jack");
        center.setMaterial("xxx1");
        center.setName("????1");
        center.setPhone("05112-65333333");
        center.setProvince("??");
        center.setCity("?");
        center.setReferValue(0.1f);
        center.setRegion("?");
        center.setStreet("?1");
        center.setUpdateDate(new Date());
        center.setUser(userService.get("name", "c2"));
        center.setCenterNum("74120");
        center.setLongitude(120.521486);
        center.setLatitude(31.324064);
        centerService.save(center);
    }

    @Test
    public void ai_addLoadometer() {
        Loadometer loadometer = new Loadometer();
        loadometer.setCenter(centerService.get("user.name", "c1"));
        loadometer.setCreateDate(new Date());
        loadometer.setCreator("jack");
        loadometer.setLoadometerNum("DB-001");
        loadometer.setState(Enum_Use.IU);
        loadometer.setUpdateDate(new Date());
        loadometer.setModelType("aaa");
        loadometerService.save(loadometer);

        loadometer = new Loadometer();
        loadometer.setCenter(centerService.get("user.name", "c2"));
        loadometer.setCreateDate(new Date());
        loadometer.setCreator("jack");
        loadometer.setLoadometerNum("DB-002");
        loadometer.setState(Enum_Use.IU);
        loadometer.setModelType("aaa");
        loadometer.setUpdateDate(new Date());
        loadometerService.save(loadometer);
        for (int i = 3; i < 15; i++) {
            loadometer = new Loadometer();
            if (i % 2 == 0) {
                loadometer.setCenter(centerService.get("user.name", "c1"));
            } else {
                loadometer.setCenter(centerService.get("user.name", "c2"));
            }

            loadometer.setCreateDate(new Date());
            loadometer.setCreator("jack");
            loadometer.setLoadometerNum("DB-00" + i);
            loadometer.setState(Enum_Use.RP);
            loadometer.setModelType("aaa");
            loadometer.setUpdateDate(new Date());
            loadometerService.save(loadometer);
        }
    }

    @Test
    public void aj_addSite() {
        Site site = new Site();
        site.setCategory(Enum_Company.GT);
        site.setSiteNum("HS-001");
        site.setCity("?");
        site.setAddress("?");
        site.setCenter(centerService.getAll().get(0));
        site.setCreateDate(new Date());
        site.setCreator("jack");
        site.setMaterial("xxxx");
        site.setName("");
        site.setPhone("18888888888");
        site.setProvince("??");
        site.setRegion("?");
        site.setUpdateDate(new Date());
        site.setUser(userService.getByUserName("s1"));
        site.setLongitude(120.591338);
        site.setLatitude(31.297408);
        siteService.save(site);

        site = new Site();
        site.setCategory(Enum_Company.GT);
        site.setSiteNum("HS-002");
        site.setCity("?");
        site.setAddress("?1");
        site.setCenter(centerService.getAll().get(0));
        site.setCreateDate(new Date());
        site.setCreator("jack");
        site.setMaterial("xxxx");
        site.setName("1");
        site.setPhone("18888888882");
        site.setProvince("??");
        site.setRegion("?");
        site.setUpdateDate(new Date());
        site.setUser(userService.getByUserName("s2"));
        site.setLongitude(120.582858);
        site.setLatitude(31.289878);
        siteService.save(site);

        site = new Site();
        site.setCategory(Enum_Company.GT);
        site.setSiteNum("HS-003");
        site.setCity("?");
        site.setAddress("?2");
        site.setCenter(centerService.getAll().get(0));
        site.setCreateDate(new Date());
        site.setCreator("jack");
        site.setMaterial("xxxx");
        site.setName("2");
        site.setPhone("18888888883");
        site.setProvince("??");
        site.setRegion("?");
        site.setUpdateDate(new Date());
        site.setUser(userService.getByUserName("s3"));
        site.setLongitude(120.541823);
        site.setLatitude(31.281176);
        siteService.save(site);

        site = new Site();
        site.setCategory(Enum_Company.GT);
        site.setSiteNum("HS-004");
        site.setCity("?");
        site.setAddress("?3");
        site.setCenter(centerService.getAll().get(0));
        site.setCreateDate(new Date());
        site.setCreator("jack");
        site.setMaterial("xxxx");
        site.setName("3");
        site.setPhone("18888888884");
        site.setProvince("??");
        site.setRegion("?");
        site.setUpdateDate(new Date());
        site.setUser(userService.getByUserName("s4"));
        site.setLongitude(120.570102);
        site.setLatitude(31.311569);
        siteService.save(site);
    }

    @Test
    public void ak_addScale() {
        Scale scale = null;
        scale = new Scale();
        scale.setAccuracy("?");
        scale.setArea(100);
        scale.setBattery("");
        scale.setCapacity("?");
        scale.setCreateDate(new Date());
        scale.setCreator("jack");
        scale.setLength(1);
        scale.setMeasurement("");
        scale.setModelType("xxxx");
        scale.setPower("220V");
        scale.setScaleNum("TB-0001");
        scale.setScreen("563D");
        scale.setSite(siteService.get("name", ""));
        scale.setSize("100");
        scale.setState(Enum_Use.OU);
        scale.setUpdateDate(new Date());
        scale.setPurchaseDate(new Date());
        scaleService.save(scale);

        scale = new Scale();
        scale.setAccuracy("?");
        scale.setArea(100);
        scale.setBattery("");
        scale.setCapacity("?");
        scale.setCreateDate(new Date());
        scale.setCreator("jack");
        scale.setLength(1);
        scale.setMeasurement("");
        scale.setModelType("xxxx");
        scale.setPower("220V");
        scale.setScaleNum("TB-0002");
        scale.setScreen("563D");
        scale.setSite(siteService.get("name", ""));
        scale.setSize("100");
        scale.setState(Enum_Use.IU);
        scale.setUpdateDate(new Date());
        scale.setPurchaseDate(new Date());
        scaleService.save(scale);

        for (int i = 3; i < 25; i++) {
            scale = new Scale();
            scale.setAccuracy("?");
            scale.setArea(100);
            scale.setBattery("");
            scale.setCapacity("?");
            scale.setCreateDate(new Date());
            scale.setCreator("jack");
            scale.setLength(1);
            scale.setMeasurement("");
            scale.setModelType("xxxx");
            scale.setPower("220V");
            scale.setPurchaseDate(new Date());
            scale.setScaleNum("TB-000" + i);
            scale.setScreen("563D");
            if (i % 2 == 0) {
                scale.setSite(siteService.get("name", ""));
            } else {
                scale.setSite(siteService.get("name", "1"));
            }
            scale.setSize("100");
            scale.setState(Enum_Use.RP);
            scale.setUpdateDate(new Date());
            scaleService.save(scale);
        }
    }

    @Test
    public void al_addPlateformScale() {
        PlateformScale scale = null;
        scale = new PlateformScale();
        scale.setCreateDate(new Date());
        scale.setCreator("jack");
        scale.setModelType("xxxx");
        scale.setPlateformScaleNum("TB-0001");
        scale.setSupplier("?");
        scale.setSupplierContact("0512-88888888");
        scale.setSite(siteService.get("name", ""));
        scale.setState(Enum_Use.IU);
        scale.setUpdateDate(new Date());
        scale.setPurchaseDate(new Date());
        plateformScaleService.save(scale);

        scale = new PlateformScale();
        scale.setCreateDate(new Date());
        scale.setCreator("jack");
        scale.setModelType("xxxx");
        scale.setPlateformScaleNum("TB-0002");
        scale.setSupplier("?");
        scale.setSupplierContact("0512-88888888");
        scale.setSite(siteService.get("name", ""));
        scale.setState(Enum_Use.OU);
        scale.setUpdateDate(new Date());
        scale.setPurchaseDate(new Date());
        plateformScaleService.save(scale);

        for (int i = 3; i < 24; i++) {
            scale = new PlateformScale();
            scale.setCreateDate(new Date());
            scale.setCreator("jack");
            scale.setModelType("xxxx");
            scale.setPlateformScaleNum("TB-000" + i);
            scale.setSupplier("?");
            scale.setSupplierContact("0512-88888888");
            if (i % 2 == 0) {
                scale.setSite(siteService.get("name", ""));
            } else {
                scale.setSite(siteService.get("name", "1"));
            }
            scale.setState(Enum_Use.OU);
            scale.setUpdateDate(new Date());
            scale.setPurchaseDate(new Date());
            plateformScaleService.save(scale);
        }
    }

    @Test
    public void am_addDispatch() {

        Dispatch dispatch = new Dispatch();
        dispatch.setAddress("?");
        dispatch.setCity("?");
        dispatch.setProvince("??");
        dispatch.setCreateDate(new Date());
        dispatch.setCreator("jack");
        dispatch.setName("1");
        dispatch.setPhone("88888888888");
        dispatch.setRegion("");
        dispatch.setDispatchNum("D110");
        dispatch.setUpdateDate(new Date());
        dispatch.setUser(userService.get("name", "d1"));
        dispatchService.save(dispatch);

        dispatch = new Dispatch();
        dispatch.setAddress("?");
        dispatch.setCity("?");
        dispatch.setProvince("??");
        dispatch.setCreateDate(new Date());
        dispatch.setCreator("jack");
        dispatch.setName("");
        dispatch.setPhone("88888888888");
        dispatch.setRegion("");
        dispatch.setDispatchNum("D120");
        dispatch.setUpdateDate(new Date());
        dispatch.setUser(userService.get("name", "d2"));
        dispatchService.save(dispatch);
    }

    @Test
    public void an_addVechile() {
        Vechile vechile = null;
        for (int i = 1; i < 26; i++) {
            vechile = new Vechile();
            vechile.setCreateDate(new Date());
            vechile.setCreator("jack");
            vechile.setLoadWeight(3000f);
            vechile.setUpdateDate(new Date());
            vechile.setVechileNum("CH-000" + i);
            vechile.setWeight(3000);
            vechile.setPhone("123456789" + i);
            vechile.setLicense("?E" + DataUtil.getRandm(1000, 9999) + i);
            vechile.setDriver("cwj");
            if (i % 2 == 0) {
                vechile.setCenter(centerService.get("user.name", "c1"));
                vechile.setCategory(Enum_Vechile.V);
                vechile.setState(Enum_Use.IU);
                vechile.setMileage(100000.0);
                vechile.setRunState(Enum_Running.D);
            } else {
                vechile.setMileage(50000.0);
                vechile.setCenter(centerService.get("user.name", "c2"));
                vechile.setCategory(Enum_Vechile.T);
                vechile.setState(Enum_Use.OU);
                vechile.setRunState(Enum_Running.S);
            }
            vechileService.save(vechile);
            //         vechile.setDriver(null);
        }
        for (int i = 1; i < 15; i++) {
            vechile = new Vechile();
            vechile.setCreateDate(new Date());
            vechile.setCreator("jack");
            vechile.setLoadWeight(3000f);
            vechile.setUpdateDate(new Date());
            vechile.setVechileNum("CH-021" + i);
            vechile.setWeight(3000);
            vechile.setPhone("122453749" + i);
            vechile.setDriver("cwj");
            vechile.setLicense("?B" + DataUtil.getRandm(1000, 9999) + i);
            if (i % 2 == 0) {
                vechile.setCenter(centerService.get("user.name", "c1"));
                vechile.setCategory(Enum_Vechile.V);
                vechile.setState(Enum_Use.OU);
                vechile.setMileage(120000.0);
                vechile.setRunState(Enum_Running.D);
            } else {
                vechile.setMileage(50000.0);
                vechile.setCenter(centerService.get("user.name", "c2"));
                vechile.setCategory(Enum_Vechile.T);
                vechile.setState(Enum_Use.IU);
                vechile.setRunState(Enum_Running.S);
            }
            vechileService.save(vechile);
        }
    }

    /*@Test
    public void ao_addDriver(){
       Driver driver;
       Center center;
       Vechile vechile;
       for(int i=0;i<5;i++){
     driver = new Driver();
     center = new Center();
     vechile = new Vechile();
     center = centerService.getByStringProperty(centerService.getAll(),"name","c1");
     vechile = vechileService.getByStringProperty(vechileService.getAll(),"vechileNum","CH-000"+i);
     driver.setCenter(center);
     driver.setVechile(vechile);
     driver.setName(""+i);
     driver.setPhone("13333033033");
     driver.setLicense("123456789987654321");
     driverService.save(driver);
       }
       for(int i=0;i<5;i++){
     driver = new Driver();
     center = new Center();
     vechile = new Vechile();
     center = centerService.getByStringProperty(centerService.getAll(),"name","c2");
     vechile = vechileService.getByStringProperty(vechileService.getAll(),"vechileNum","CH-0001"+i);
     driver.setCenter(center);
     driver.setVechile(vechile);
     driver.setName("?"+i);
     driver.setPhone("18888888888");
     driver.setLicense("123456789987654321");
     driverService.save(driver);
       }
        
    }
        
    */
    @Test
    public void ap_addGps() {
        GPS gps = null;
        for (int i = 1; i < 26; i++) {
            gps = new GPS();
            gps.setCreateDate(new Date());
            gps.setCreator("jack");
            gps.setGpsNum("GPS-000" + i);
            gps.setIp("127.0.0." + i);
            gps.setModelType("XXXX");
            gps.setPurchaseDate(new Date());
            gps.setUpdateDate(new Date());
            gps.setVechile(vechileService.get("vechileNum", "CH-000" + i));
            if (i % 2 == 0) {
                gps.setState(Enum_Use.IU);
                gps.setCenter(centerService.get("user.name", "c1"));
            } else {
                gps.setState(Enum_Use.OU);
                gps.setSite(siteService.get("user.name", "s1"));
            }
            gPSService.save(gps);
        }
    }

    @Test
    public void aq_addVedio() {
        Vedio vedio = null;
        for (int i = 1; i < 26; i++) {
            vedio = new Vedio();
            vedio.setVedioNum("SP-000" + i);
            vedio.setCreateDate(new Date());
            vedio.setCreator("jack");
            vedio.setModelType("");
            vedio.setPurchaseDate(new Date());
            vedio.setSupplier("");
            vedio.setSupplierContact("0512-88888888");
            vedio.setUpdateDate(new Date());
            if (i % 2 == 0) {
                vedio.setState(Enum_Use.IU);
                vedio.setSite(siteService.get("user.name", "s1"));
            } else {
                vedio.setState(Enum_Use.OU);
                vedio.setCenter(centerService.get("user.name", "c1"));
            }
            vedioService.save(vedio);
        }
    }

    @Test
    public void ar_addCategory() {
        Category category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setLevel(0);
        category.setImage("fzl.png");
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(0));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(0));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(0));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setLevel(0);
        category.setImage("fsl.png");
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(0));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("PVC");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setLevel(0);
        category.setImage("fjs.png");
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("??");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "?").get(1));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("202");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("202");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "202"));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("304");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("304");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "304"));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setLevel(0);
        category.setImage("fyw.png");
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(2));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setLevel(0);
        category.setImage("fjd.png");
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("?");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", "?"));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setLevel(0);
        category.setImage("qt.png");
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.get("name", ""));
        category.setLevel(1);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(1));
        category.setLevel(2);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(2));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(2));
        category.setLevel(3);
        categoryService.save(category);

        category = new Category();
        category.setName("");
        category.setCreateDate(new Date());
        category.setCreator("jack");
        category.setUpdateDate(new Date());
        category.setParentCategory(categoryService.getList("name", "").get(2));
        category.setLevel(3);
        categoryService.save(category);
    }

    @Test
    public void as_addRecycle() {
        Date date = new Date();
        String sdate = new SimpleDateFormat("yyyy-MM-dd").format(date);
        for (int i = 0; i < 9; i++) {
            Recycle recycle = new Recycle();
            recycle.setCategory(categoryService.getList("name", "").get(0));
            recycle.setScale(scaleService.get("scaleNum", "TB-0001"));
            recycle.setSite(siteService.get("name", ""));
            recycle.setPrice(10f + DataUtil.getRandm(1, 9));
            recycle.setWeight(10f + DataUtil.getRandm(1, 9));
            recycle.setDistrict("?");
            try {
                date = new SimpleDateFormat("yyyy-MM-dd HH:mm")
                        .parse(sdate.substring(0, sdate.length() - 1) + i + " 08:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            recycle.setCollectTime(date);
            recycleService.save(recycle);
        }
        for (int i = 0; i < 10; i++) {
            Recycle recycle = new Recycle();
            recycle.setCategory(categoryService.get("name", ""));
            recycle.setScale(scaleService.get("scaleNum", "TB-0001"));
            recycle.setSite(siteService.get("name", ""));
            recycle.setPrice(15f + DataUtil.getRandm(1, 9));
            recycle.setWeight(20f + DataUtil.getRandm(1, 9));
            recycle.setDistrict("");
            try {
                date = new SimpleDateFormat("yyyy-MM-dd HH:mm")
                        .parse(sdate.substring(0, sdate.length() - 1) + i + " 08:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            recycle.setCollectTime(date);
            recycleService.save(recycle);
        }
        for (int i = 0; i < 11; i++) {
            Recycle recycle = new Recycle();
            recycle.setCategory(categoryService.get("name", "?"));
            recycle.setScale(scaleService.get("scaleNum", "TB-0001"));
            recycle.setSite(siteService.get("name", ""));
            recycle.setPrice(15f + DataUtil.getRandm(1, 9));
            recycle.setWeight(20f + DataUtil.getRandm(1, 9));
            recycle.setDistrict("?");
            try {
                date = new SimpleDateFormat("yyyy-MM-dd HH:mm")
                        .parse(sdate.substring(0, sdate.length() - 1) + i + " 08:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            recycle.setCollectTime(date);
            recycleService.save(recycle);
        }
        for (int i = 0; i < 12; i++) {
            Recycle recycle = new Recycle();
            recycle.setCategory(categoryService.getList("name", "").get(1));
            recycle.setScale(scaleService.get("scaleNum", "TB-0001"));
            recycle.setSite(siteService.get("name", "1"));
            recycle.setPrice(15f + DataUtil.getRandm(1, 9));
            recycle.setWeight(20f + DataUtil.getRandm(1, 9));
            recycle.setDistrict("?");
            try {
                date = new SimpleDateFormat("yyyy-MM-dd HH:mm")
                        .parse(sdate.substring(0, sdate.length() - 1) + i + " 08:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            recycle.setCollectTime(date);
            recycleService.save(recycle);
        }
    }

    @Test
    public void at_addReport() {
        Report report = new Report();
        report.setName("");
        reportService.save(report);

        report.setName("?");
        reportService.save(report);

        report.setName("");
        reportService.save(report);

        report.setName("?");
        reportService.save(report);

        report.setName("?");
        reportService.save(report);

        report.setName("");
        reportService.save(report);

        report.setName("");
        reportService.save(report);

        report.setName("");
        reportService.save(report);

        report.setName("");
        reportService.save(report);

        List<Site> sites = new ArrayList<Site>();
        sites = siteService.getAll();
        for (Site site : sites) {
            report.setName(site.getName());
            report.setType(1.00);
            reportService.save(report);
        }

        report.setName("CH-0001");
        report.setType(2.00);
        reportService.save(report);

        report.setName("CH-0002");
        report.setType(2.00);
        reportService.save(report);

        report.setName("CH-0003");
        report.setType(2.00);
        reportService.save(report);
    }

    @Test
    public void au_addSupervision() {
        Supervision supervision = new Supervision();
        supervision.setAddress("?");
        supervision.setCity("?");
        supervision.setCreateDate(new Date());
        supervision.setCreator("jack");
        supervision.setName("");
        supervision.setPhone("xxxxxxxxxxx");
        supervision.setProvince("??");
        supervision.setRegion("");
        supervision.setStreet("??");
        supervision.setUpdateDate(new Date());
        supervisionService.save(supervision);

        User user = userService.get("name", "jack");
        user.setSupervision(supervisionService.get("name", ""));
        userService.update(user);
    }

    @Test
    public void av_addCategoryWeight() {
        CategoryWeight categoryWeight = new CategoryWeight();
        categoryWeight.setName("");
        categoryWeightService.save(categoryWeight);

        categoryWeight.setName("");
        categoryWeightService.save(categoryWeight);

        categoryWeight.setName("");
        categoryWeightService.save(categoryWeight);

        categoryWeight.setName("");
        categoryWeightService.save(categoryWeight);

        categoryWeight.setName("");
        categoryWeightService.save(categoryWeight);

    }

    @Test
    public void ay_addPrice() throws Exception {
        List<Center> centers = centerService.getAll();
        //      List<Center> centers1 = centerService.getByProperty(
        //            centerService.getAll(), "name", "????");

        List<Category> categorys = categoryService.getByBasicProperty(categoryService.getAll(), "level", 2);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = sdf.parse("2014-11-01");

        Date today = new Date();
        today = sdf.parse(sdf.format(today));

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(parse);
        long time1 = calendar.getTimeInMillis();
        calendar.setTime(today);
        long time2 = calendar.getTimeInMillis();
        long betweenDays = (time2 - time1) / (1000 * 3600 * 24);

        GregorianCalendar cal = new GregorianCalendar();
        List<Price> prices = new ArrayList<Price>();
        for (int i = 0; i <= betweenDays; i++) {
            for (Center center : centers) {

                for (Category category : categorys) {
                    cal.setTime(parse);
                    cal.add(Calendar.DATE, i);
                    Date dateNow = cal.getTime();

                    Price price = new Price();
                    price.setCreateDate(dateNow);
                    price.setUpdateDate(dateNow);
                    price.setCreator("jack");
                    price.setSite(null);
                    price.setUnit("?");
                    price.setCenter(center);
                    price.setCategory(category);
                    price.setIsNewest("0");
                    if (i == betweenDays) {

                        price.setIsNewest("1");
                    }
                    price.setIsGuidencePrice("1");//?
                    price.setPrice(DataUtil.getRandm(100, 500));
                    prices.add(price);
                    //               priceService.save(price);
                }
            }
        }
        priceService.save(prices);

        centers = centerService.getByProperty(centerService.getAll(), "name",
                "????1");
        for (int i = 0; i <= 10; i++) {
            for (Category category : categorys) {
                Price price = new Price();
                price.setCreateDate(new Date());
                price.setUpdateDate(new Date());
                price.setCreator("jack");
                price.setSite(null);
                price.setUnit("?");
                price.setCenter(centers.get(0));
                price.setIsGuidencePrice("1");//?
                price.setCategory(category);
                price.setIsNewest("0");
                price.setPrice(DataUtil.getRandm(100, 500));
                priceService.save(price);
            }
        }

        List<Category> list = categoryService.getByBasicProperty(categoryService.getAll(), "level", 1);
        List<Site> sites = siteService.getAll();
        for (Site site : sites) {
            for (Category category : list) {
                Price price = new Price();
                price.setCreateDate(new Date());
                price.setUpdateDate(new Date());
                price.setCreator("jack");
                price.setSite(site);
                price.setUnit("?");
                price.setCenter(null);
                price.setCategory(category);
                price.setIsNewest("1");
                price.setIsGuidencePrice("1");//?
                price.setPrice(DataUtil.getRandm(100, 500));
                priceService.save(price);
            }
        }

    }

    @Test
    public void az_addHonsty() {
        Honsty honsty = new Honsty();
        Center center = new Center();
        Center center1 = new Center();
        Site site = new Site();
        Site site1 = new Site();
        site = siteService.get("name", "");
        site1 = siteService.get("name", "1");
        center = centerService.get("name", "????");
        center1 = centerService.get("name", "????1");
        for (int i = 0; i < 10; i++) {
            if (i % 3 == 0) {
                honsty.setCenter(center);
                honsty.setSite(site);
                honsty.setHonsty(Enum_Honsty.ZC);
                honsty.setUpdateDate(new Date());
                honstyService.save(honsty);
            } else if (i % 3 == 1) {
                honsty.setCenter(center1);
                honsty.setSite(site);
                honsty.setHonsty(Enum_Honsty.B);
                honsty.setUpdateDate(new Date());
                honstyService.save(honsty);
            } else {
                honsty.setCenter(center1);
                honsty.setSite(site1);
                honsty.setHonsty(Enum_Honsty.ZC);
                honsty.setUpdateDate(new Date());
                honstyService.save(honsty);
            }
        }
    }

    @Test
    public void ba_addGpsRecord() {
        GPSRecord gpsRecord = new GPSRecord();
        Date laterDate = new Date();
        Calendar calendar = Calendar.getInstance();
        gpsRecord.setCreator("jack");
        gpsRecord.setSpeed(10);

        for (int i = 0; i < 10; i++) {
            gpsRecord.setGps(gPSService.get("gpsNum", "GPS-000" + (i + 1)));
            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();

            gpsRecord.setLatitude(Double.parseDouble("31.31" + DataUtil.getRandm(0, 99) + "79"));
            gpsRecord.setLongitude(Double.parseDouble("120.6" + DataUtil.getRandm(0, 99) + "92"));
            gpsRecord.setTime(laterDate);
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.31" + DataUtil.getRandm(0, 99) + "19"));
            gpsRecord.setLongitude(Double.parseDouble("120.5" + DataUtil.getRandm(0, 99) + "768"));
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.30" + DataUtil.getRandm(0, 99) + "44"));
            gpsRecord.setLongitude(Double.parseDouble("120.5" + DataUtil.getRandm(0, 99) + "493"));
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.30" + DataUtil.getRandm(0, 99) + "66"));
            gpsRecord.setLongitude(Double.parseDouble("120.6" + DataUtil.getRandm(0, 99) + "806"));
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.30" + DataUtil.getRandm(0, 99) + "02"));
            gpsRecord.setLongitude(Double.parseDouble("120.6" + DataUtil.getRandm(0, 99) + "519"));
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.31" + DataUtil.getRandm(0, 99) + "96"));
            gpsRecord.setLongitude(Double.parseDouble("120.6" + DataUtil.getRandm(0, 99) + "494"));
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.31" + DataUtil.getRandm(0, 99) + "17"));
            gpsRecord.setLongitude(Double.parseDouble("120.6" + DataUtil.getRandm(0, 99) + "848"));
            gPSRecordService.save(gpsRecord);

            calendar.setTime(laterDate);
            calendar.add(Calendar.MINUTE, 15);
            laterDate = calendar.getTime();
            gpsRecord.setTime(laterDate);

            gpsRecord.setLatitude(Double.parseDouble("31.28" + DataUtil.getRandm(0, 99) + "64"));
            gpsRecord.setLongitude(Double.parseDouble("120.5" + DataUtil.getRandm(0, 99) + "691"));
            gPSRecordService.save(gpsRecord);
        }

    }

    /*
     * ?
     */
    @Test
    public void bb_addVedioAddresses() {
        Site site = siteService.getAll().get(0);
        System.out.println(site.getName());
        Center center = centerService.getAll().get(1);
        System.out.println(center.getName());
        Dispatch dispatch = dispatchService.getAll().get(0);
        System.out.println(dispatch.getName());

        for (int i = 0; i < 50; i++) {
            VedioAddress va = new VedioAddress();
            va.setAddress("http://www.shipin1" + i + ".com");
            if (i % 2 == 0) {
                va.setCenter(center);
                String region = center.getRegion();
                Area area = areaService.get("district", region);
                va.setDistrict(area);
            } else {
                va.setSite(site);
                String region = site.getRegion();
                Area area = areaService.get("district", region);
                va.setDistrict(area);
            }
            vedioAddressService.save(va);
        }

        for (int i = 0; i < 50; i++) {
            VedioAddress va = new VedioAddress();
            va.setAddress("http://www.shi1pin1" + i + i + ".com");
            va.setDispatch(dispatch);
            String region = dispatch.getRegion();
            Area area = areaService.get("district", region);
            va.setDistrict(area);
            vedioAddressService.save(va);
        }
    }

    //   @Test
    //   public void bc_addTagAndTransaction1() throws ParseException{
    //      PlateformScale plateformScale = plateformScaleService.get("plateformScaleNum", "TB-0001");
    //      List<Category> categories = categoryService.getAll();
    //      categories = categoryService.getByPropertyNotNull(categories, "parentCategory");
    //      List<Vechile> vechiles = vechileService.getAll();
    //      List<Site> sites = siteService.getAll();
    //      List<Center> centers = centerService.getAll();
    //      List<Tag> tags = new ArrayList<Tag>();
    //      List<Transaction> transactions = new ArrayList<Transaction>();
    //      
    //      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    //      Date before = sdf.parse("2015-01-01");
    //      Date today = sdf.parse(sdf.format(new Date()));
    //      Calendar calendar = Calendar.getInstance();
    //      calendar.setTime(before);
    //      long beforeTime = calendar.getTimeInMillis();
    //      calendar.setTime(today);
    //      long todayTime = calendar.getTimeInMillis();
    //      long betweenDays=(todayTime-beforeTime)/(1000*3600*24);
    //      GregorianCalendar cal = new GregorianCalendar();
    //      Tag tag = null;
    //      Transaction transaction = null;
    //      for(int i = 0; i <= betweenDays; i++){
    //         
    //         cal.setTime(before);
    //         cal.add(Calendar.DATE, i);
    //         Date dateNow = cal.getTime();
    //         for(Category c : categories){
    //            for(Center center : centers){
    //               for(Site site : sites){
    //                  
    //                  tag = new Tag();
    //                  tag.setTime(dateNow);
    //                  tag.setWeight(DataUtil.getRandm(1000, 2800));
    //                  tag.setPrice(DataUtil.getRandm(1000, 2800));
    //                  tag.setType(Enum_TagType.R);
    //                  tag.setCategory(c);
    //                  tag.setTagNum(UUID.randomUUID().toString().replace("-", ""));
    //                  tag.setVechile(vechiles.get(0));
    //                  tag.setPlateformScale(plateformScale);
    ////                  tagService.save(tag);
    //                  tags.add(tag);
    //                  transaction = new Transaction();
    //                  transaction.setTag(tag);
    //                  transaction.setPrice(tag.getPrice());
    //                  transaction.setResourceType(Enum_ResourceToCenter.SITE);
    //                  transaction.setTotalPrice(tag.getPrice() * tag.getWeight());
    //                  transaction.setState(Enum_Transaction.IT);
    //                  transaction.setInTime(dateNow);
    //                  transaction.setOutTime(dateNow);
    //                  transaction.setVechile(vechiles.get(0));
    //                  transaction.setCenter(center);
    //                  transaction.setSite(site);
    //                  transactions.add(transaction);
    //               }
    //            }
    //         }
    //      }
    //      tagService.save(tags);
    //      transactionService.save(transactions);
    //   }

    @Test
    public void bc_addTagAndTransaction() throws ParseException {
        Tag tag = null;
        Transaction transaction = null;
        Category category1 = categoryService.getList("name", "?").get(1);
        Category category2 = categoryService.getList("name", "").get(0);
        Category category3 = categoryService.getList("name", "").get(0);
        Category category4 = categoryService.getList("name", "").get(1);
        Category category5 = categoryService.getList("name", "?").get(0);
        PlateformScale plateformScale = plateformScaleService.get("plateformScaleNum", "TB-0001");
        Vechile vechile1 = vechileService.get("vechileNum", "CH-0001");
        Vechile vechile2 = vechileService.get("vechileNum", "CH-0002");
        Vechile vechile3 = vechileService.get("vechileNum", "CH-0003");
        Vechile vechile4 = vechileService.get("vechileNum", "CH-0004");
        Vechile vechile5 = vechileService.get("vechileNum", "CH-0005");
        Site site1 = siteService.get("user.name", "s1");
        Center center1 = centerService.get("user.name", "c1");
        Site site2 = siteService.get("user.name", "s2");
        Center center2 = centerService.get("user.name", "c2");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date before = sdf.parse("2015-01-01");
        Date today = sdf.parse(sdf.format(new Date()));
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(before);
        long beforeTime = calendar.getTimeInMillis();
        calendar.setTime(today);
        long todayTime = calendar.getTimeInMillis();
        long betweenDays = (todayTime - beforeTime) / (1000 * 3600 * 24);
        GregorianCalendar cal = new GregorianCalendar();
        float weight1 = 1000f;
        float weight2 = 2000f;
        float weight3 = 3000f;
        float weight4 = 2500f;
        float weight5 = 2800f;
        for (int i = 0; i <= betweenDays; i++) {
            cal.setTime(before);
            cal.add(Calendar.DATE, i);
            Date dateNow = cal.getTime();
            List<Tag> tags = new ArrayList<>();
            if (i % 5 == 0) {
                tag = new Tag();
                tag.setTime(dateNow);
                tag.setWeight(weight1);
                tag.setPrice(10f);
                tag.setType(Enum_TagType.WR);
                tag.setCategory(category1);
                tag.setTagNum("RFID-1" + i);
                tag.setVechile(vechileService.get("vechileNum", "CH-0001"));
                tag.setPlateformScale(plateformScale);
                //            String tagId = (String) tagService.save(tag);
                tags.add(tag);
                transaction = new Transaction();
                transaction.setTags(tags);
                transaction.setPrice(tag.getPrice());
                transaction.setTotalPrice(tag.getPrice() * tag.getWeight());
                transaction.setState(Enum_Transaction.IT);
                transaction.setInTime(dateNow);
                transaction.setOutTime(dateNow);
                transaction.setVechile(vechile1);
                transaction.setTransactionProperty(Enum_TransactionProperty.HAO);
                if (i % 2 == 0) {
                    transaction.setCenter(center1);
                    transaction.setSite(site1);
                } else {
                    transaction.setCenter(center2);
                    transaction.setSite(site2);
                }
                tagService.save(tag);
                transactionService.save(transaction);
                tag.setTransaction(transaction);
                tagService.update(tag);
            } else if (i % 5 == 1) {
                tag = new Tag();
                tag.setTime(dateNow);
                tag.setVechile(vechileService.get("vechileNum", "CH-0002"));
                tag.setWeight(weight2);
                tag.setPrice(10f);
                tag.setType(Enum_TagType.WR);
                tag.setCategory(category2);
                tag.setTagNum("RFID-2" + i);
                tag.setPlateformScale(plateformScale);
                //            String tagId = (String) tagService.save(tag);
                tags.add(tag);
                transaction = new Transaction();
                transaction.setTags(tags);
                transaction.setPrice(tag.getPrice());
                transaction.setTotalPrice(tag.getPrice() * tag.getWeight());
                transaction.setState(Enum_Transaction.IT);
                transaction.setInTime(dateNow);
                transaction.setOutTime(dateNow);
                transaction.setVechile(vechile2);
                transaction.setTransactionProperty(Enum_TransactionProperty.HAO);
                if (i % 2 == 0) {
                    transaction.setCenter(center1);
                    transaction.setSite(site1);
                } else {
                    transaction.setCenter(center2);
                    transaction.setSite(site2);
                }
                tagService.save(tag);
                transactionService.save(transaction);
                tag.setTransaction(transaction);
                tagService.update(tag);
            } else if (i % 5 == 2) {
                tag = new Tag();
                tag.setTime(dateNow);
                tag.setWeight(weight3);
                tag.setPrice(10f);
                tag.setVechile(vechileService.get("vechileNum", "CH-0003"));
                tag.setType(Enum_TagType.AR);
                tag.setCategory(category3);
                tag.setTagNum("RFID-3" + i);
                tag.setPlateformScale(plateformScale);
                //            String tagId = (String) tagService.save(tag);
                tags.add(tag);
                transaction = new Transaction();
                transaction.setTags(tags);
                transaction.setPrice(tag.getPrice());

                transaction.setTotalPrice(tag.getPrice() * tag.getWeight());
                transaction.setState(Enum_Transaction.IT);
                transaction.setInTime(dateNow);
                transaction.setOutTime(dateNow);
                transaction.setVechile(vechile3);
                transaction.setTransactionProperty(Enum_TransactionProperty.HAO);
                if (i % 2 == 0) {
                    transaction.setCenter(center1);
                    transaction.setSite(site1);
                } else {
                    transaction.setCenter(center2);
                    transaction.setSite(site2);
                }
                tagService.save(tag);
                transactionService.save(transaction);
                tag.setTransaction(transaction);
                tagService.update(tag);
            } else if (i % 5 == 3) {
                tag = new Tag();
                tag.setTime(dateNow);
                tag.setWeight(weight4);
                tag.setPrice(10f);
                tag.setType(Enum_TagType.AR);
                tag.setCategory(category4);
                tag.setVechile(vechileService.get("vechileNum", "CH-0004"));
                tag.setTagNum("RFID-4" + i);
                tag.setPlateformScale(plateformScale);
                //            String tagId = (String) tagService.save(tag);
                tags.add(tag);
                transaction = new Transaction();
                transaction.setTags(tags);
                transaction.setPrice(tag.getPrice());
                transaction.setTotalPrice(tag.getPrice() * tag.getWeight());
                transaction.setState(Enum_Transaction.IT);
                transaction.setInTime(dateNow);
                transaction.setOutTime(dateNow);
                transaction.setVechile(vechile4);
                transaction.setTransactionProperty(Enum_TransactionProperty.HAO);
                if (i % 2 == 0) {
                    transaction.setCenter(center1);
                    transaction.setSite(site1);
                } else {
                    transaction.setCenter(center2);
                    transaction.setSite(site2);
                }
                tagService.save(tag);
                transactionService.save(transaction);
                tag.setTransaction(transaction);
                tagService.update(tag);
            } else {
                tag = new Tag();
                tag.setTime(dateNow);
                tag.setWeight(weight5);
                tag.setPrice(10f);
                tag.setType(Enum_TagType.WR);
                tag.setCategory(category5);
                tag.setVechile(vechileService.get("vechileNum", "CH-0005"));
                tag.setTagNum("RFID-5" + i);
                tag.setPlateformScale(plateformScale);
                //            String tagId = (String) tagService.save(tag);
                tags.add(tag);
                transaction = new Transaction();
                transaction.setTags(tags);
                transaction.setPrice(tag.getPrice());
                transaction.setTotalPrice(tag.getPrice() * tag.getWeight());
                transaction.setState(Enum_Transaction.IT);
                transaction.setInTime(dateNow);
                transaction.setOutTime(dateNow);
                transaction.setVechile(vechile5);
                transaction.setTransactionProperty(Enum_TransactionProperty.HAO);
                if (i % 2 == 0) {
                    transaction.setCenter(center1);
                    transaction.setSite(site1);
                } else {
                    transaction.setCenter(center2);
                    transaction.setSite(site2);
                }
                tagService.save(tag);
                transactionService.save(transaction);
                tag.setTransaction(transaction);
                tagService.update(tag);
            }
            weight1 += 3f;
            weight2 += 2f;
            weight3 += 2.5f;
            weight4 += 1.5f;
            weight5 += 1.7f;
        }
        /*List<Transaction> transactions = new ArrayList<Transaction>();
        transactions = transactionService.getAll();
        for(Transaction t : transactions){
           if(t.getTags()!=null&&t.getTags().size()!=0){
        for(Tag tt : t.getTags()){
           if(tt.getCategory()!=null){
              if(tt.getCategory().getParentCategory()!=null){
                 if(tt.getCategory().getParentCategory().getParentCategory()!=null){
                    if(tt.getCategory().getParentCategory().getParentCategory().getParentCategory()!=null){
                       t.setCategoryName(tt.getCategory().getParentCategory().getParentCategory().getParentCategory().getName());
                    }else{
                       t.setCategoryName(tt.getCategory().getParentCategory().getParentCategory().getName());
                    }
                 }else{
                    t.setCategoryName(tt.getCategory().getParentCategory().getName());
                 }
              }else{
                 t.setCategoryName(tt.getCategory().getName());
              }
           }
           transactionService.update(t);
        }
           }
        }*/
    }

    @Test
    public void bd_addCenterOutLibRecords() {
        Center center = centerService.getAll().get(0);
        Tag tag = tagService.getAll().get(0);
        CenterOutLibRecord colr = new CenterOutLibRecord();
        for (int i = 0; i < 200; i++) {

            colr.setTag(tag);
            colr.setCenter(center);
            colr.setPrice(12.5f);
            colr.setTargetEnterprise("?" + i);
            colr.setTotalPrice(25f);
            colr.setTradingTime(new Date());
            centerOutLibRecordService.save(colr);
        }
    }

    @Test
    public void be_addCityzenForespeak() {
        List<Site> list = siteService.getAll();
        List<User> users = userService.getAll();
        List<User> rUsers = new ArrayList<>();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.HOUR_OF_DAY, 2);
        Date laterHourDate = calendar.getTime();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_MONTH, 1);
        Date laterDayDate = calendar.getTime();
        for (User u : users) {
            if (u.getName().contains("r")) {
                rUsers.add(u);
            }

        }
        Area area = areaService.getAll().get(93);
        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < 3; j++) {
                CityzenForespeak c = new CityzenForespeak();
                c.setSite(list.get(i));
                //            c.setUser(rUsers.get(j));
                c.setName(list.get(i).getCreator());
                c.setPhone(list.get(i).getPhone());
                c.setDistrict(area.getDistrict());
                c.setAddress("?" + i + "3" + j + "?");
                c.setDays(5);
                c.setRemark("????out");
                c.setCategoryInfo("C=P=12W=345");
                c.setForespeakTime(laterHourDate);
                c.setCreateTime(laterHourDate);
                c.setResponseTime(laterHourDate);
                c.setLongitude(Double.parseDouble("120.56" + j + i + "92"));
                c.setLatitude(Double.parseDouble("31.29" + j + i + "83"));
                if (j == 1) {
                    c.setState(Enum_Response.WR);
                } else {
                    c.setState(Enum_Response.AC);
                }
                c.setComments(Enum_forespeak_comments.G);
                c.setUser(rUsers.get(j));
                cityzenForespeakService.save(c);
            }
            for (int j = 0; j < 3; j++) {
                CityzenForespeak c = new CityzenForespeak();
                c.setSite(list.get(i));
                //            c.setUser(rUsers.get(j));
                c.setName(list.get(i).getCreator());
                c.setPhone(list.get(i).getPhone());
                c.setDistrict(area.getDistrict());
                c.setAddress("?" + i + "3" + j + "?");
                c.setDays(5);
                c.setRemark("????out");
                c.setCategoryInfo("C=P=12W=345");
                c.setForespeakTime(laterDayDate);
                c.setResponseTime(laterDayDate);
                c.setLongitude(Double.parseDouble("120.54" + j + i + "32"));
                c.setLatitude(Double.parseDouble("31.28" + j + i + "27"));
                if (j == 1) {
                    c.setState(Enum_Response.AR);
                } else {
                    c.setState(Enum_Response.AC);
                }
                c.setComments(Enum_forespeak_comments.G);
                c.setCreateTime(laterHourDate);
                c.setUser(rUsers.get(j));
                cityzenForespeakService.save(c);
            }
        }
    }

    @SuppressWarnings("deprecation")
    @Test
    public void bf_addForespeak() {
        List<Site> list = siteService.getAll();
        List<Center> centerList = centerService.getAll();
        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < centerList.size(); j++) {
                Forespeak f = new Forespeak();
                f.setCenter(centerList.get(j));
                f.setSite(list.get(i));
                f.setForespeakInfo("C=P=12" + j + "W=32" + j);
                f.setDistance(i * 5 + j * 5);
                f.setCollectTime(new Date(new Date().getDate() - j));
                f.setResponseTime(new Date(new Date().getDate() - i));
                f.setCollectTime(new Date());
                f.setState(Enum_Response.WR);
                f.setForespeakTime(new Date());
                foreSpeakService.save(f);
            }
        }
    }

    @Test
    public void bg_addStock() {
        Stock stock = new Stock();
        stock.setSite(siteService.get("user.name", "s1"));
        stock.setWeight(2000f);
        stock.setCategory(categoryService.get("name", ""));
        stockService.save(stock);

        stock.setWeight(1000f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(1000f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(9000f);
        stock.setCategory(categoryService.get("name", ""));
        stockService.save(stock);

        stock.setWeight(2000f);
        stock.setCategory(categoryService.getList("name", "?").get(0));
        stockService.save(stock);

        stock.setWeight(3000f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(4000f);
        stock.setCategory(categoryService.getList("name", "?").get(0));
        stockService.save(stock);

        stock.setWeight(300f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(300f);
        stock.setCategory(categoryService.getList("name", "").get(1));
        stockService.save(stock);

        Center center = centerService
                .getByProperty(centerService.getAll(), "name", "????").get(0);
        stock.setSite(null);
        stock.setCenter(center);
        stock.setCategory(categoryService.get("name", ""));
        stock.setWeight(12000f);
        stockService.save(stock);

        stock.setWeight(11000f);
        stock.setCategory(categoryService.get("name", ""));
        stockService.save(stock);

        stock.setWeight(25000f);
        stock.setCategory(categoryService.get("name", ""));
        stockService.save(stock);

        stock.setWeight(11000f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(5000f);
        stock.setCategory(categoryService.getList("name", "").get(1));
        stockService.save(stock);

        stock.setWeight(3000f);
        stock.setCategory(categoryService.getList("name", "?").get(1));
        stockService.save(stock);

        stock.setWeight(4000f);
        stock.setCategory(categoryService.getList("name", "").get(1));
        stockService.save(stock);

        stock.setWeight(4000f);
        stock.setCategory(categoryService.getList("name", "").get(1));
        stockService.save(stock);

        stock.setWeight(1000f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(3500f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(2500f);
        stock.setCategory(categoryService.get("name", ""));
        stockService.save(stock);

        stock.setWeight(5000f);
        stock.setCategory(categoryService.getList("name", "?").get(1));
        stockService.save(stock);

        stock.setWeight(6000f);
        stock.setCategory(categoryService.getList("name", "").get(0));
        stockService.save(stock);

        stock.setWeight(7000f);
        stock.setCategory(categoryService.getList("name", "?").get(1));
        stockService.save(stock);

        stock.setWeight(7000f);
        stock.setCategory(categoryService.getList("name", "202").get(0));
        stockService.save(stock);

        stock.setWeight(6000f);
        stock.setCategory(categoryService.getList("name", "?").get(0));
        stockService.save(stock);

        stock.setWeight(5000f);
        stock.setCategory(categoryService.getList("name", "?").get(0));
        stockService.save(stock);
    }

    @Test
    public void bh_addCityzenForeSpeakItem() {
        List<Category> categoryList = categoryService.getByBasicProperty(categoryService.getAll(), "level", 1);
        List<Category> ca = new ArrayList<Category>();
        for (Category c : categoryList) {
            if (c.getParentCategory() != null) {
                ca.add(c);
            }
        }
        List<CityzenForespeak> cityzenForespeakList = cityzenForespeakService.getAll();
        for (int i = 0; i < cityzenForespeakList.size(); i++) {
            for (int j = 0; j < ca.size(); j++) {
                CityzenForespeakItem c = new CityzenForespeakItem();
                c.setCategory(ca.get(j));
                c.setCityzenForespeak(cityzenForespeakList.get(i));
                c.setPhoto("0512-00221" + j + i);
                c.setPrice(2 * (j + 3));
                c.setWeight(15 * (i + 3 + j));
                cityzenForespeakItemService.save(c);
            }
        }
    }

    @Test
    public void bi_addAddresses() {
        User user = userService.get("name", "r1");
        Address address = null;
        for (int i = 0; i < 5; i++) {

            address = new Address();
            address.setCity("?");
            address.setDistrict("?");
            address.setInfo("" + (i + 1) + "?");
            address.setLatitude(Double.parseDouble("31.28" + i + "261"));
            address.setLongitude(Double.parseDouble("120.56" + i + "341"));
            address.setProvince("??");
            address.setUser(user);

            addressService.save(address);
        }
        user.setAddress(address);
        userService.update(user);
    }

    @Test
    public void bj_addCollection() {

        List<Category> categories = categoryService.getAll();
        categories = categoryService.getByProperty(categories, "level", 1);

        List<Price> prices = priceService.getAll();

        List<Site> sites = siteService.getAll();
        User user = userService.get("name", "r1");

        for (int i = 0; i < 50; i++) {
            Collection c = new Collection();
            c.setDate(new Date());
            c.setCategory(categories.get(DataUtil.getRandm(0, categories.size() - 1)));
            c.setUser(user);
            collectionService.save(c);
        }
    }

    @Test
    public void bk_addForespeakItem() {
        List<Category> categories = categoryService.getByBasicProperty(categoryService.getAll(), "level", 2);
        categories = categoryService.getByPropertyNotNull(categories, "parentCategory");

        List<Forespeak> forespeaks = foreSpeakService.getAll();
        //      forespeaks = foreSpeakService.getByProperty(forespeaks, "site.user.name", "s1");
        for (Forespeak forespeak : forespeaks) {
            for (int i = 0; i < categories.size(); i++) {

                ForespeakItem fi = new ForespeakItem();
                fi.setCategory(categories.get(i));
                fi.setForespeak(forespeak);
                fi.setPhoto("");
                fi.setPrice(DataUtil.getRandm(200, 20000));
                fi.setWeight(DataUtil.getRandm(10, 100));
                foresspeakItemService.save(fi);
            }
        }
    }

    @Test
    public void bl_addDriver() {
        Driver driver = new Driver();
        for (int i = 0; i < 40; i++) {
            driver = new Driver();
            if (i == 0) {
                driver.setNum("AT000");
                driver.setName("cwj");
                driver.setLicense("02011512221" + i);
                driver.setVechile(vechileService.getAll().get(0));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c1").get(0));
            } else if (i == 1) {
                driver.setNum("AT001" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512222" + i);
                driver.setVechile(vechileService.getAll().get(1));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c1").get(0));
            } else if (i == 2) {
                driver.setNum("AT002" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512223" + i);
                driver.setVechile(vechileService.getAll().get(2));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c1").get(0));
            } else if (i == 3) {
                driver.setNum("AT003" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512224" + i);
                driver.setVechile(vechileService.getAll().get(3));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c2").get(0));
            } else if (i == 4) {
                driver.setNum("AT004" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512225" + i);
                driver.setVechile(vechileService.getAll().get(4));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c2").get(0));
            } else if (i == 5) {
                driver.setNum("AT005" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512226" + i);
                driver.setVechile(vechileService.getAll().get(5));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c2").get(0));
            } else if (i == 6) {
                driver.setNum("AT006" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512227" + i);
                driver.setVechile(vechileService.getAll().get(6));
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c2").get(0));
            } else {
                driver.setNum("AT007" + i);
                driver.setName("cwj" + i);
                driver.setLicense("02011512228" + i);
                driver.setCenter(centerService.getByProperty(centerService.getAll(), "user.name", "c2").get(0));
            }
            driver.setPhone("1365623485" + i);
            driverService.save(driver);
        }
    }

    @Test
    public void bm_addSaleInfo() throws Exception {
        List<Category> categories = categoryService.getByBasicProperty(categoryService.getAll(), "level", 3);
        categories = categoryService.getByPropertyNotNull(categories, "parentCategory");
        User user = userService.get("name", "c1");
        Center center = centerService.get("user.userId", user.getUserId());

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = sdf.parse("2015-11-01");

        Date today = new Date();
        today = sdf.parse(sdf.format(today));

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(parse);
        long time1 = calendar.getTimeInMillis();
        calendar.setTime(today);
        long time2 = calendar.getTimeInMillis();
        long betweenDays = (time2 - time1) / (1000 * 3600 * 24);

        GregorianCalendar cal = new GregorianCalendar();
        List<SaleInfo> saleInfos = new ArrayList<SaleInfo>();
        for (int i = 0; i <= betweenDays; i++) {
            cal.setTime(parse);
            cal.add(Calendar.DATE, i);
            Date dateNow = cal.getTime();
            cal.add(Calendar.DAY_OF_MONTH, 7);
            Date endDate = cal.getTime();

            for (Category category : categories) {
                SaleInfo si = new SaleInfo();
                si.setCategory(category);
                si.setCenter(center);
                si.setStartDate(dateNow);
                si.setPerson("cwj");
                si.setPhone("123456789");
                si.setEndDate(endDate);
                si.setTitle("?" + category.getName());
                si.setPrice(DataUtil.getRandm(20, 25));
                si.setWeight((double) DataUtil.getRandm(200, 209));
                System.out.println(si.getPrice());
                System.out.println(si.getWeight());
                si.setUnit("?");
                si.setState(Enum_sale.D);
                si.setOutTime(dateNow);
                //            saleInfoService.save(si);
                saleInfos.add(si);
            }
        }
        saleInfoService.save(saleInfos);
    }

    @Test
    public void bo_addEnterprise() {
        List<User> users = userService.getAll();
        List<Address> addresses = new ArrayList<>();
        Address address = new Address();
        address.setProvince("??");
        address.setCity("?");
        address.setDistrict("");
        address.setInfo("204?10204");
        address.setLongitude(120.341715);
        address.setLatitude(31.381199);
        String addressId = (String) addressService.save(address);

        User user = new User();
        user.setEmail("526140051@qq.com");
        user.setLastTime(new Date());
        user.setMobile("36925814710");
        user.setPassed(true);
        user.setUserNum("123249");
        user.setPassword(MD5.getMD5("123"));
        user.setName("m1");
        user.setAddress(addressService.get("id", addressId));
        addresses.add(addressService.get("id", addressId));
        user.setAddresses(addresses);
        user.setQq("491298215");
        user.setRealName("killer-m1");
        user.setThisTime(new Date());
        user.setCreateDate(new Date());
        userService.save(user);

        Role role = new Role();
        role.setCreateDate(new Date());
        role.setCreator("jack");
        role.setRoleName("company");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(user);
        userRole.setRole(role);
        userRoleService.save(userRole);

        for (int i = 14; i < users.size(); i++) {
            Enterprise enterprise = new Enterprise();
            enterprise.setAddress("204?10" + i + "");
            enterprise.setCorporation("zxj");
            enterprise.setName("??" + i);
            enterprise.setPhone("139119931" + i);
            enterprise.setUser(users.get(i));
            enterpriseService.save(enterprise);
        }
    }

    @Test
    public void bp_addEnterprise() {
        List<User> users = userService.getAll();
        for (int i = 14; i < users.size(); i++) {
            Enterprise enterprise = new Enterprise();
            enterprise.setAddress("204?10" + i + "");
            enterprise.setCorporation("zxj");
            enterprise.setName("??" + i);
            enterprise.setPhone("139119931" + i);
            enterprise.setUser(users.get(i));
            enterpriseService.save(enterprise);
        }
    }

    @Test
    public void bq_addEnterpriseCollection() {
        List<SaleInfo> saleInfo = saleInfoService.getAll();
        List<Enterprise> enterprises = enterpriseService.getAll();

        for (int j = 0; j < enterprises.size(); j++) {
            for (int i = 0; i < saleInfo.size(); i += 20) {
                EnterpriseCollection enterpriseCollection = new EnterpriseCollection();
                enterpriseCollection.setEnterprise(enterprises.get(j));
                enterpriseCollection.setEnterpriseSaleInfo(saleInfo.get(i));
                enterpriseCollectionService.save(enterpriseCollection);
            }
        }
    }

    @Test
    public void br_addStockRemoval() {
        List<Category> categories = categoryService.getByProperty(categoryService.getAll(), "level", 3);
        List<Center> centers = centerService.getAll();
        List<Enterprise> enterprises = enterpriseService.getAll();

        GregorianCalendar cal = new GregorianCalendar();

        for (int i = 0; i < categories.size(); i++) {
            cal.setTime(new Date());
            cal.add(Calendar.DATE, 0 - i);
            for (int j = 0; j < centers.size(); j++) {
                for (int k = 0; k < enterprises.size(); k++) {
                    StockRemoval stockRemoval = new StockRemoval();
                    stockRemoval.setCategory(categories.get(i));
                    stockRemoval.setCenter(centers.get(j));
                    stockRemoval.setEnterprise(enterprises.get(k));
                    stockRemoval.setInTime(cal.getTime());
                    stockRemoval.setOutTime(cal.getTime());
                    stockRemoval.setPrice(i * j * k + 1);
                    stockRemoval.setWeight((i * j * k + 1) * 2);
                    stockRemoval.setState(Enum_Transaction.CL);
                    stockRemovalService.save(stockRemoval);
                }
            }
        }

    }

    @Test
    public void bs_addTransport() {
        Tag tag1 = tagService.get("tagNum", "RFID-10");
        Tag tag2 = tagService.get("tagNum", "RFID-21");
        List<Vechile> vechiles = vechileService.getAll();
        Transport transport = new Transport();
        List<Transport> transports = new ArrayList<>();
        for (Vechile vechile : vechiles) {
            transport = new Transport();
            transport.setTag(tag1);
            transport.setVechile(vechile);
            transports.add(transport);
        }
        for (Vechile vechile : vechiles) {
            transport = new Transport();
            transport.setTag(tag2);
            transport.setVechile(vechile);
            transports.add(transport);
        }
        transportService.save(transports);
    }

    @Test
    public void bt_addProducerUser() {
        Address address = new Address();
        address.setCity("?");
        address.setDistrict("");
        address.setInfo("2401");
        address.setLatitude(31.303301);
        address.setLongitude(120.584036);
        address.setProvince("??");
        List<Address> list = new ArrayList<Address>();
        String addressId = (String) addressService.save(address);
        list.add(addressService.get("id", addressId));
        User user = new User();
        user.setAddress(addressService.get("id", addressId));
        user.setAddresses(list);
        user.setCode("0031284");
        user.setCreateDate(new Date());
        user.setCreator("jack_mmlt");
        user.setEmail("462598754@163.com");
        user.setForespeakCount(0);
        user.setLastTime(new Date());
        user.setMobile("23656234854");
        user.setName("mmlt");
        user.setPassed(true);
        user.setPassword(MD5.getMD5("123"));
        user.setQq("462598754");
        user.setRealName("");
        user.setSupervision(null);
        user.setThisTime(new Date());
        user.setUserNum("mmltcl");
        userService.save(user);
        Role role = new Role();
        role.setCreateDate(new Date());
        role.setRoleName("producer");
        role.setCreator("jack");
        roleService.save(role);

        UserRole userRole = new UserRole();
        userRole.setUser(user);
        userRole.setRole(role);
        userRoleService.save(userRole);
    }

    @Test
    public void bu_addTask() {
        List<Site> sites = siteService.getAll();
        List<Vechile> vechiles = vechileService.getAll();
        List<Task> tasks = new ArrayList<>();
        for (int i = 0; i < sites.size(); i++) {
            Task task = new Task();
            task.setVechile(vechiles.get(i));
            task.setSite(sites.get(i));
            task.setCreateTime(new Date());
            task.setCreator("jack");
            task.setTaskNum("TASK_NUM_00" + i);
            task.setGoTime(new Date());
            tasks.add(task);
        }
        taskService.save(tasks);
    }
}