中扬CRM客户关系管理系统
LSH
2023-09-12 a25d3c16f9f9be1a1b4774402d1907a28dab06fb
src/main/java/com/zy/crm/manager/controller/PriSalesController.java
@@ -12,14 +12,8 @@
import com.core.common.R;
import com.core.domain.KeyValueVo;
import com.zy.crm.common.web.BaseController;
import com.zy.crm.manager.entity.Item;
import com.zy.crm.manager.entity.Plan;
import com.zy.crm.manager.entity.PriOnline;
import com.zy.crm.manager.entity.PriSales;
import com.zy.crm.manager.service.ItemService;
import com.zy.crm.manager.service.PlanService;
import com.zy.crm.manager.service.PriOnlineService;
import com.zy.crm.manager.service.PriSalesService;
import com.zy.crm.manager.entity.*;
import com.zy.crm.manager.service.*;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +33,13 @@
    private PriSalesService priSalesService;
    @Autowired
    private PriOnlineService priOnlineService;
    private PriOnline2Service priOnline2Service;
    @Autowired
    private PlanService planService;
    @Autowired
    private PriQuoteBudgetService priQuoteBudgetService;
    @RequestMapping(value = "/priSales/{id}/auth")
    @ManagerAuth
@@ -101,15 +98,16 @@
    @RequestMapping(value = "/priSales/add/auth")
    @ManagerAuth(memo = "添加产品费用明细")
    public R add(@RequestBody Map<String,Object> map) {
        PriOnline priOnline = priOnlineService.selectById(Long.parseLong(map.get("priOnlineId").toString()));
        PriOnline2 priOnline2 = priOnline2Service.selectById(Long.parseLong(map.get("priOnlineId").toString()));
        PriSales priSales = new PriSales();
        priSales.setCreateTime(new Date());
        priSales.setTitle(map.get("title").toString());
        priSales.setTemplateName(priOnline.getTemplateName());
        priSales.setTemplateName(priOnline2.getTemplateName());
        priSales.setSheetData(map.get("sheetData").toString());
        priSales.setItemId(priOnline.getItemId());
        priSales.setOrderNum(priOnline.getOrderNum());
        priSales.setPriOnline2Id(Long.parseLong(map.get("priOnlineId").toString()));
        priSales.setItemId(priOnline2.getItemId());
        priSales.setOrderNum(priOnline2.getOrderNum());
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
        priSales.setInOrderNum(format.format(new Date()));
@@ -198,6 +196,12 @@
        if (Cools.isEmpty(ids)){
            return R.error();
        }
        for (Long id : ids){
            int  priQuoteBudget= priQuoteBudgetService.selectCount(new EntityWrapper<PriQuoteBudget>().eq("pri_sales_id", id));
            if (priQuoteBudget!=0){
                return R.error("存在关联的报价预算单,禁止删除!!!");
            }
        }
        priSalesService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
@@ -224,7 +228,7 @@
        for (PriSales priSales : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", priSales.getId());
            map.put("value", priSales.getInOrderNum() + "/" + priSales.getPlanId$() + "/" + priSales.getMemberId$());
            map.put("value", priSales.getInOrderNum() + "/" + priSales.getPlanId$() + "/" + priSales.getMemberId$()+"/" + priSales.getTemplateName());
            result.add(map);
        }
        return R.ok(result);