|
@@ -41,23 +41,10 @@ public class BizProductionCompanyController extends BaseController
|
|
|
{
|
|
|
@Resource
|
|
|
private IBizProductionCompanyService bizCompanyService;
|
|
|
-// @Resource
|
|
|
-// private ISysUserService sysUserService;
|
|
|
-// @Resource
|
|
|
-// private IBizChannelService bizChannelService;
|
|
|
-// @Resource
|
|
|
-// private IBizCompanyContactorService bizCompanyContactorService;
|
|
|
-
|
|
|
-// @Resource
|
|
|
-// private IDictRegionService dictRegionService;
|
|
|
-
|
|
|
-// @Resource
|
|
|
-// private IBizCompanyFollowDetailService companyFollowDetailService;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 查询company列表
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('business:company:list')")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(BizProductionCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
|
|
|
{
|
|
@@ -68,156 +55,4 @@ public class BizProductionCompanyController extends BaseController
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出company列表
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('business:company:export')")
|
|
|
- @Log(title = "company", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, BizProductionCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
- setTenantId(bizCompany);
|
|
|
- List<BizProductionCompany> list = bizCompanyService.getList(bizCompany);
|
|
|
- ExcelUtil<BizProductionCompany> util = new ExcelUtil<BizProductionCompany>(BizProductionCompany.class);
|
|
|
- if (bizCompany.getColumns() != null && !bizCompany.getColumns().isEmpty()) {
|
|
|
- util.exportExcel(response, list, "company数据", "客户信息导出", bizCompany.getColumns().toArray(new String[0]));
|
|
|
- } else {
|
|
|
- util.exportExcel(response, list, "company数据", "客户信息导出");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Log(title = "客户管理", businessType = BusinessType.IMPORT)
|
|
|
- @PreAuthorize("@ss.hasPermi('system:company:import')")
|
|
|
- @PostMapping("/importData")
|
|
|
- public AjaxResult importData(MultipartFile file) throws Exception
|
|
|
- {
|
|
|
- ExcelUtil<BizProductionCompany> util = new ExcelUtil<>(BizProductionCompany.class);
|
|
|
- List<BizProductionCompany> companyList = util.importExcel(file.getInputStream());
|
|
|
- String operName = getUsername();
|
|
|
- String message = bizCompanyService.importCompany(companyList, operName, getTenantId() == null ? 0 : getTenantId());
|
|
|
- return success(message);
|
|
|
- }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 获取company详细信息
|
|
|
-// */
|
|
|
-// @PreAuthorize("@ss.hasPermi('business:company:query')")
|
|
|
-// @GetMapping(value = "/{id}")
|
|
|
-// public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
-// {
|
|
|
-// BizCompany bizCompany = new BizCompany();
|
|
|
-// bizCompany.setId(id);
|
|
|
-// List<BizCompany> bizCompanyList = bizCompanyService.getList(bizCompany);
|
|
|
-// bizCompany = bizCompanyList.size() > 0 ? bizCompanyList.get(0) : null;
|
|
|
-// if(bizCompany != null && bizCompany.getReferrerDataSource() != null) {
|
|
|
-// switch (bizCompany.getReferrerDataSource()) {
|
|
|
-// case "company":
|
|
|
-// BizCompany source = bizCompanyService.getById(bizCompany.getSourceId());
|
|
|
-// bizCompany.setSourceName(source != null ? source.getName() : "");
|
|
|
-// break;
|
|
|
-// case "employee":
|
|
|
-// SysUser sysUser = sysUserService.selectUserById(bizCompany.getSourceId());
|
|
|
-// bizCompany.setSourceName(sysUser != null ? sysUser.getNickName() : "");
|
|
|
-// break;
|
|
|
-// case "channel":
|
|
|
-// BizChannel channel = bizChannelService.getById(bizCompany.getSourceId());
|
|
|
-// bizCompany.setSourceName(channel != null ? channel.getName() : "");
|
|
|
-// break;
|
|
|
-// default:
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (bizCompany != null) {
|
|
|
-// BizCompanyContactor condition = new BizCompanyContactor();
|
|
|
-// condition.setCompanyId(bizCompany.getId());
|
|
|
-// bizCompany.setContactors(bizCompanyContactorService.getList(condition));
|
|
|
-// BizCompanyFollowDetail followDetail = new BizCompanyFollowDetail();
|
|
|
-// followDetail.setCompanyId(bizCompany.getId());
|
|
|
-// List<BizCompanyFollowDetail> followDetails = companyFollowDetailService.getList(followDetail);
|
|
|
-// bizCompany.setFollowDetails(followDetails);
|
|
|
-// }
|
|
|
-// return success(bizCompany);
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 新增company
|
|
|
-// */
|
|
|
-// @PreAuthorize("@ss.hasPermi('business:company:add')")
|
|
|
-// @Log(title = "company", businessType = BusinessType.INSERT)
|
|
|
-// @PostMapping
|
|
|
-// public AjaxResult add(@RequestBody BizCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
|
|
|
-// {
|
|
|
-// setTenantId(bizCompany);
|
|
|
-//
|
|
|
-// return bizCompanyService.save(bizCompany) ? success("保存成功", bizCompany) : error("保存失败");
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 修改company
|
|
|
-// */
|
|
|
-// @PreAuthorize("@ss.hasPermi('business:company:edit')")
|
|
|
-// @Log(title = "company", businessType = BusinessType.UPDATE)
|
|
|
-// @PutMapping
|
|
|
-// public AjaxResult edit(@RequestBody BizCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
|
|
|
-// {
|
|
|
-// setTenantId(bizCompany);
|
|
|
-// return bizCompanyService.updateById(bizCompany) ? success("保存成功", bizCompany) : error("保存失败");
|
|
|
-// }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除company
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('business:company:remove')")
|
|
|
- @Log(title = "company", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable List<Long> ids)
|
|
|
- {
|
|
|
- return toAjax(bizCompanyService.removeBatchByIds(ids));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出初始化客户模板
|
|
|
- * @param response
|
|
|
- */
|
|
|
- @PostMapping("/importTemplate")
|
|
|
- public void importTemplate(HttpServletResponse response)
|
|
|
- {
|
|
|
- ExcelUtil<BizCompany> util = new ExcelUtil<>(BizCompany.class);
|
|
|
- util.importTemplateExcel(response, "客户数据", StringUtils.EMPTY, new String[]{"name", "sourceCategoryName", "sourceName"});
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/setCompanyAdviser")
|
|
|
- @PreAuthorize("@ss.hasPermi('business:company:edit')")
|
|
|
- @Log(title = "company", businessType = BusinessType.UPDATE)
|
|
|
- public AjaxResult setCompanyAdviser(@RequestBody BizProductionCompany company) {
|
|
|
- List<Long> ids = company.getIds();
|
|
|
- Long adviserId = company.getAdviserId();
|
|
|
- BizProductionCompany conditions = new BizProductionCompany();
|
|
|
- conditions.setIds(ids);
|
|
|
- List<BizProductionCompany> companies = bizCompanyService.getList(conditions);
|
|
|
- companies.forEach(l -> l.setAdviserId(adviserId));
|
|
|
- return toAjax(bizCompanyService.updateBatchById(companies));
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/setCompanyLeader")
|
|
|
- @PreAuthorize("@ss.hasPermi('business:company:edit')")
|
|
|
- @Log(title = "company", businessType = BusinessType.UPDATE)
|
|
|
- public AjaxResult setCompanyLeader(@RequestBody BizProductionCompany company) {
|
|
|
- List<Long> ids = company.getIds();
|
|
|
- Long leaderId = company.getLeaderId();
|
|
|
- BizProductionCompany conditions = new BizProductionCompany();
|
|
|
- conditions.setIds(ids);
|
|
|
- List<BizProductionCompany> companies = bizCompanyService.getList(conditions);
|
|
|
- companies.forEach(l -> l.setLeaderId(leaderId));
|
|
|
- return toAjax(bizCompanyService.updateBatchById(companies));
|
|
|
- }
|
|
|
-//
|
|
|
-// @GetMapping(value = "/initArea")
|
|
|
-// @PreAuthorize("@ss.hasPermi('business:company:list')")
|
|
|
-// public AjaxResult initArea() throws IOException {
|
|
|
-// List<DictRegion> regions = JSONArray.parseArray(IOUtils.toString(BizCompanyServiceImpl.class.getResourceAsStream("/company/region.json"), Charset.forName("UTF-8")), DictRegion.class);
|
|
|
-// return toAjax(dictRegionService.saveBatch(regions));
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
}
|