| | |
| | | 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; |
| | |
| | | private PriSalesService priSalesService; |
| | | |
| | | @Autowired |
| | | private PriOnlineService priOnlineService; |
| | | private PriOnline2Service priOnline2Service; |
| | | |
| | | @Autowired |
| | | private PlanService planService; |
| | | |
| | | @Autowired |
| | | private PriQuoteBudgetService priQuoteBudgetService; |
| | | |
| | | @RequestMapping(value = "/priSales/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @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())); |
| | | |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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); |