Pu Zhibing
6 天以前 f2530067b6cd16a87b76190cf524d2ed75bf9592
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TSystemPriceController.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.base.tips.ErrorTip;
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.SinataUtil;
@@ -42,6 +43,9 @@
    @Autowired
    private ITServerCarmodelService tServerCarmodelService;
    @Autowired
    private ShiroExtUtil shiroExtUtil;
@@ -59,13 +63,13 @@
    @RequestMapping("/small")
    public String small(Model model) {
        //跨城小件物流
        TSystemPrice one = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 5).eq("companyId", ShiroKit.getUser().getObjectId()));
        TSystemPrice one = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 5).eq("companyId", shiroExtUtil.getUser().getObjectId()));
        if (SinataUtil.isNotEmpty(one)){
            JSONObject json1 = JSONObject.fromObject(one.getContent());
            model.addAttribute("json1",json1);
        }
        //同城小件物流
        TSystemPrice two = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", ShiroKit.getUser().getObjectId()));
        TSystemPrice two = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", shiroExtUtil.getUser().getObjectId()));
        if (SinataUtil.isNotEmpty(two)){
            JSONObject json2 = JSONObject.fromObject(two.getContent());
            model.addAttribute("json2",json2);
@@ -79,7 +83,7 @@
    @RequestMapping("/tSystemPrice_add")
    public String tSystemPriceAdd(Model model) {
        //查询所有专车车型
        List<TSystemPrice> tSystemPrices = tSystemPriceService.selectList(new EntityWrapper<TSystemPrice>().eq("type", 1).eq("companyId", ShiroKit.getUser().getObjectId()).ne("state", 3));
        List<TSystemPrice> tSystemPrices = tSystemPriceService.selectList(new EntityWrapper<TSystemPrice>().eq("type", 1).eq("companyId", shiroExtUtil.getUser().getObjectId()).ne("state", 3));
        List<TServerCarmodel> modelList = tServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1));
        List<TServerCarmodel> serverCarmodels = new ArrayList<>();
        for(TServerCarmodel tsc : modelList){
@@ -138,7 +142,7 @@
    @ResponseBody
    public Object list(String name,Integer state) {
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
        page.setRecords(tSystemPriceService.getSpecialPriceList(page,ShiroKit.getUser().getObjectId(),name,state));
        page.setRecords(tSystemPriceService.getSpecialPriceList(page,shiroExtUtil.getUser().getObjectId(),name,state));
        return super.packForBT(page);
    }
@@ -152,13 +156,13 @@
        int count = tSystemPriceService.selectCount(new EntityWrapper<TSystemPrice>()
                .eq("type", 1)
                .eq("serverCarModelId", tSystemPrice.getServerCarModelId())
                .eq("companyId",ShiroKit.getUser().getObjectId())
                .eq("companyId",shiroExtUtil.getUser().getObjectId())
                .last(" and not FIND_IN_SET(state,'3')"));
        if (count > 0){
            TServerCarmodel one = tServerCarmodelService.selectById(tSystemPrice.getServerCarModelId());
            return new ErrorTip(500, "【"+one.getName()+"】已存在,请重新选择");
        }
        tSystemPrice.setCompanyId(ShiroKit.getUser().getObjectId());
        tSystemPrice.setCompanyId(shiroExtUtil.getUser().getObjectId());
        tSystemPrice.setType(1);
        tSystemPrice.setState(1);
        tSystemPriceService.insert(tSystemPrice);
@@ -177,7 +181,7 @@
            int count = tSystemPriceService.selectCount(new EntityWrapper<TSystemPrice>()
                    .eq("type", 1)
                    .eq("serverCarModelId", tSystemPrice.getServerCarModelId())
                    .eq("companyId",ShiroKit.getUser().getObjectId())
                    .eq("companyId",shiroExtUtil.getUser().getObjectId())
                    .last(" and not FIND_IN_SET(state,'3')"));
            if (count > 0){
                TServerCarmodel one = tServerCarmodelService.selectById(tSystemPrice.getServerCarModelId());
@@ -213,7 +217,7 @@
    @ResponseBody
    public Object smallSubmit(String json1,String json2) {
        //跨城小件物流
        TSystemPrice one = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 5).eq("companyId", ShiroKit.getUser().getObjectId()));
        TSystemPrice one = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 5).eq("companyId", shiroExtUtil.getUser().getObjectId()));
        if (SinataUtil.isNotEmpty(one)){
            one.setContent(json1);
            tSystemPriceService.updateById(one);
@@ -221,12 +225,12 @@
            one = new TSystemPrice();
            one.setState(1);
            one.setType(5);
            one.setCompanyId(ShiroKit.getUser().getObjectId());
            one.setCompanyId(shiroExtUtil.getUser().getObjectId());
            one.setContent(json1);
            tSystemPriceService.insert(one);
        }
        //同城小件物流
        TSystemPrice two = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", ShiroKit.getUser().getObjectId()));
        TSystemPrice two = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", shiroExtUtil.getUser().getObjectId()));
        if (SinataUtil.isNotEmpty(two)){
            two.setContent(json2);
            tSystemPriceService.updateById(two);
@@ -234,7 +238,7 @@
            two = new TSystemPrice();
            two.setState(1);
            two.setType(4);
            two.setCompanyId(ShiroKit.getUser().getObjectId());
            two.setCompanyId(shiroExtUtil.getUser().getObjectId());
            two.setContent(json2);
            tSystemPriceService.insert(two);
        }