|
@@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import com.cuidian.srm.baseCode.service.ISerialPatternService;
|
|
|
import com.cuidian.srm.cuspCode.entity.CuspCustomerProfile;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.jeecg.modules.system.service.ISysUserService;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -51,42 +52,43 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
|
|
|
|
- /**
|
|
|
+/**
|
|
|
* @Description: 供应商档案
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2024-11-07
|
|
|
+ * @Date: 2024-11-07
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
-@Api(tags="供应商档案")
|
|
|
+@Api(tags = "供应商档案")
|
|
|
@RestController
|
|
|
@RequestMapping("/cuspCode/cuspSupplierProfile")
|
|
|
@Slf4j
|
|
|
public class CuspSupplierProfileController {
|
|
|
- @Autowired
|
|
|
- private ICuspSupplierProfileService cuspSupplierProfileService;
|
|
|
- @Autowired
|
|
|
- private ICuspSupplierProfileManService cuspSupplierProfileManService;
|
|
|
- @Autowired
|
|
|
- private ICuspSupplierProfileQualificationService cuspSupplierProfileQualificationService;
|
|
|
- @Autowired
|
|
|
- private ISerialPatternService serialPatternService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param cuspSupplierProfile
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "供应商档案-分页列表查询")
|
|
|
- @ApiOperation(value="供应商档案-分页列表查询", notes="供应商档案-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<CuspSupplierProfile>> queryPageList(CuspSupplierProfile cuspSupplierProfile,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierProfileService cuspSupplierProfileService;
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierProfileManService cuspSupplierProfileManService;
|
|
|
+ @Autowired
|
|
|
+ private ICuspSupplierProfileQualificationService cuspSupplierProfileQualificationService;
|
|
|
+ @Autowired
|
|
|
+ private ISerialPatternService serialPatternService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param cuspSupplierProfile
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "供应商档案-分页列表查询")
|
|
|
+ @ApiOperation(value = "供应商档案-分页列表查询", notes = "供应商档案-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<CuspSupplierProfile>> queryPageList(CuspSupplierProfile cuspSupplierProfile,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
// 自定义查询规则
|
|
|
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
|
|
// 自定义多选的查询规则为:LIKE_WITH_OR
|
|
@@ -96,242 +98,272 @@ public class CuspSupplierProfileController {
|
|
|
customeRuleMap.put("originalFactory", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
customeRuleMap.put("temporarySupplier", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
customeRuleMap.put("evaluationLevel", QueryRuleEnum.LIKE_WITH_OR);
|
|
|
- QueryWrapper<CuspSupplierProfile> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierProfile, req.getParameterMap(),customeRuleMap);
|
|
|
- Page<CuspSupplierProfile> page = new Page<CuspSupplierProfile>(pageNo, pageSize);
|
|
|
- IPage<CuspSupplierProfile> pageList = cuspSupplierProfileService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param cuspSupplierProfilePage
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商档案-添加")
|
|
|
- @ApiOperation(value="供应商档案-添加", notes="供应商档案-添加")
|
|
|
+ QueryWrapper<CuspSupplierProfile> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierProfile, req.getParameterMap(), customeRuleMap);
|
|
|
+ Page<CuspSupplierProfile> page = new Page<CuspSupplierProfile>(pageNo, pageSize);
|
|
|
+ IPage<CuspSupplierProfile> pageList = cuspSupplierProfileService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param cuspSupplierProfilePage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商档案-添加")
|
|
|
+ @ApiOperation(value = "供应商档案-添加", notes = "供应商档案-添加")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_profile:add")
|
|
|
- @PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody CuspSupplierProfilePage cuspSupplierProfilePage) {
|
|
|
-
|
|
|
-
|
|
|
- String code = cuspSupplierProfilePage.getCode();
|
|
|
- if (StringUtils.isNotBlank(code)) {
|
|
|
-
|
|
|
- QueryWrapper<CuspSupplierProfile> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.eq("code", code);
|
|
|
- queryWrapper.eq("del_flag", "0");
|
|
|
-
|
|
|
- List<CuspSupplierProfile> list = cuspSupplierProfileService.list(queryWrapper);
|
|
|
- if (list.size() != 0) {
|
|
|
- return Result.error("供应商档案编码重复,请修改!");
|
|
|
- }
|
|
|
- } else {
|
|
|
-
|
|
|
- Result<String> result = serialPatternService.getNextSerial("cusp_supplier_profile", "code");
|
|
|
- if (!result.isSuccess()) {
|
|
|
- return result;
|
|
|
- }
|
|
|
- cuspSupplierProfilePage.setCode(result.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- CuspSupplierProfile cuspSupplierProfile = new CuspSupplierProfile();
|
|
|
- BeanUtils.copyProperties(cuspSupplierProfilePage, cuspSupplierProfile);
|
|
|
- cuspSupplierProfileService.saveMain(cuspSupplierProfile, cuspSupplierProfilePage.getCuspSupplierProfileManList(),cuspSupplierProfilePage.getCuspSupplierProfileQualificationList());
|
|
|
- return Result.OK("添加成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param cuspSupplierProfilePage
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商档案-编辑")
|
|
|
- @ApiOperation(value="供应商档案-编辑", notes="供应商档案-编辑")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody CuspSupplierProfilePage cuspSupplierProfilePage) {
|
|
|
+
|
|
|
+
|
|
|
+ String code = cuspSupplierProfilePage.getCode();
|
|
|
+ if (StringUtils.isNotBlank(code)) {
|
|
|
+
|
|
|
+ QueryWrapper<CuspSupplierProfile> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("code", code);
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+
|
|
|
+ List<CuspSupplierProfile> list = cuspSupplierProfileService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("供应商档案编码重复,请修改!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ Result<String> result = serialPatternService.getNextSerial("cusp_supplier_profile", "code");
|
|
|
+ if (!result.isSuccess()) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ cuspSupplierProfilePage.setCode(result.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ CuspSupplierProfile cuspSupplierProfile = new CuspSupplierProfile();
|
|
|
+ BeanUtils.copyProperties(cuspSupplierProfilePage, cuspSupplierProfile);
|
|
|
+ cuspSupplierProfileService.saveMain(cuspSupplierProfile, cuspSupplierProfilePage.getCuspSupplierProfileManList(), cuspSupplierProfilePage.getCuspSupplierProfileQualificationList());
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param cuspSupplierProfilePage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商档案-编辑")
|
|
|
+ @ApiOperation(value = "供应商档案-编辑", notes = "供应商档案-编辑")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_profile:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody CuspSupplierProfilePage cuspSupplierProfilePage) {
|
|
|
- CuspSupplierProfile cuspSupplierProfile = new CuspSupplierProfile();
|
|
|
- BeanUtils.copyProperties(cuspSupplierProfilePage, cuspSupplierProfile);
|
|
|
- CuspSupplierProfile cuspSupplierProfileEntity = cuspSupplierProfileService.getById(cuspSupplierProfile.getId());
|
|
|
- if(cuspSupplierProfileEntity==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
-
|
|
|
- String code = cuspSupplierProfile.getCode();
|
|
|
- QueryWrapper<CuspSupplierProfile> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.eq("code", code);
|
|
|
- queryWrapper.eq("del_flag", "0");
|
|
|
- queryWrapper.notIn("id", cuspSupplierProfile.getId());
|
|
|
-
|
|
|
- List<CuspSupplierProfile> list = cuspSupplierProfileService.list(queryWrapper);
|
|
|
- if (list.size() != 0) {
|
|
|
- return Result.error("供应商档案编码重复,请修改!");
|
|
|
- }
|
|
|
-
|
|
|
- cuspSupplierProfileService.updateMain(cuspSupplierProfile, cuspSupplierProfilePage.getCuspSupplierProfileManList(),cuspSupplierProfilePage.getCuspSupplierProfileQualificationList());
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商档案-通过id删除")
|
|
|
- @ApiOperation(value="供应商档案-通过id删除", notes="供应商档案-通过id删除")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody CuspSupplierProfilePage cuspSupplierProfilePage) {
|
|
|
+ CuspSupplierProfile cuspSupplierProfile = new CuspSupplierProfile();
|
|
|
+ BeanUtils.copyProperties(cuspSupplierProfilePage, cuspSupplierProfile);
|
|
|
+ CuspSupplierProfile cuspSupplierProfileEntity = cuspSupplierProfileService.getById(cuspSupplierProfile.getId());
|
|
|
+ if (cuspSupplierProfileEntity == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ String code = cuspSupplierProfile.getCode();
|
|
|
+ QueryWrapper<CuspSupplierProfile> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("code", code);
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+ queryWrapper.notIn("id", cuspSupplierProfile.getId());
|
|
|
+
|
|
|
+ List<CuspSupplierProfile> list = cuspSupplierProfileService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("供应商档案编码重复,请修改!");
|
|
|
+ }
|
|
|
+
|
|
|
+ cuspSupplierProfileService.updateMain(cuspSupplierProfile, cuspSupplierProfilePage.getCuspSupplierProfileManList(), cuspSupplierProfilePage.getCuspSupplierProfileQualificationList());
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商档案-通过id删除")
|
|
|
+ @ApiOperation(value = "供应商档案-通过id删除", notes = "供应商档案-通过id删除")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_profile:delete")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- cuspSupplierProfileService.delMain(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "供应商档案-批量删除")
|
|
|
- @ApiOperation(value="供应商档案-批量删除", notes="供应商档案-批量删除")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ cuspSupplierProfileService.delMain(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商档案-批量删除")
|
|
|
+ @ApiOperation(value = "供应商档案-批量删除", notes = "供应商档案-批量删除")
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_profile:deleteBatch")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.cuspSupplierProfileService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "供应商档案-通过id查询")
|
|
|
- @ApiOperation(value="供应商档案-通过id查询", notes="供应商档案-通过id查询")
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
- public Result<CuspSupplierProfile> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- CuspSupplierProfile cuspSupplierProfile = cuspSupplierProfileService.getById(id);
|
|
|
- if(cuspSupplierProfile==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(cuspSupplierProfile);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "供应商档案-联系人通过主表ID查询")
|
|
|
- @ApiOperation(value="供应商档案-联系人主表ID查询", notes="供应商档案-联系人-通主表ID查询")
|
|
|
- @GetMapping(value = "/queryCuspSupplierProfileManByMainId")
|
|
|
- public Result<List<CuspSupplierProfileMan>> queryCuspSupplierProfileManListByMainId(@RequestParam(name="id",required=true) String id) {
|
|
|
- List<CuspSupplierProfileMan> cuspSupplierProfileManList = cuspSupplierProfileManService.selectByMainId(id);
|
|
|
- return Result.OK(cuspSupplierProfileManList);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "供应商档案-资质信息通过主表ID查询")
|
|
|
- @ApiOperation(value="供应商档案-资质信息主表ID查询", notes="供应商档案-资质信息-通主表ID查询")
|
|
|
- @GetMapping(value = "/queryCuspSupplierProfileQualificationByMainId")
|
|
|
- public Result<List<CuspSupplierProfileQualification>> queryCuspSupplierProfileQualificationListByMainId(@RequestParam(name="id",required=true) String id) {
|
|
|
- List<CuspSupplierProfileQualification> cuspSupplierProfileQualificationList = cuspSupplierProfileQualificationService.selectByMainId(id);
|
|
|
- return Result.OK(cuspSupplierProfileQualificationList);
|
|
|
- }
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ this.cuspSupplierProfileService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "供应商档案-通过id查询")
|
|
|
+ @ApiOperation(value = "供应商档案-通过id查询", notes = "供应商档案-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<CuspSupplierProfile> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ CuspSupplierProfile cuspSupplierProfile = cuspSupplierProfileService.getById(id);
|
|
|
+ if (cuspSupplierProfile == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(cuspSupplierProfile);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id申请转正式
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商档案-通过id申请转正式")
|
|
|
+ @ApiOperation(value = "供应商档案-通过id申请转正式", notes = "供应商档案-通过id申请转正式")
|
|
|
+ @GetMapping(value = "/applyFor")
|
|
|
+ public Result<String> applyFor(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ return cuspSupplierProfileService.applyFor(Arrays.asList(ids.split(",")));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id审批
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "供应商档案-通过id审批")
|
|
|
+ @ApiOperation(value = "供应商档案-通过id审批", notes = "供应商档案-通过id审批")
|
|
|
+ @GetMapping(value = "/approveTemp")
|
|
|
+ public Result<String> approveTemp(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ return cuspSupplierProfileService.approveTemp(Arrays.asList(ids.split(",")));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "供应商档案-联系人通过主表ID查询")
|
|
|
+ @ApiOperation(value = "供应商档案-联系人主表ID查询", notes = "供应商档案-联系人-通主表ID查询")
|
|
|
+ @GetMapping(value = "/queryCuspSupplierProfileManByMainId")
|
|
|
+ public Result<List<CuspSupplierProfileMan>> queryCuspSupplierProfileManListByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ List<CuspSupplierProfileMan> cuspSupplierProfileManList = cuspSupplierProfileManService.selectByMainId(id);
|
|
|
+ return Result.OK(cuspSupplierProfileManList);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param cuspSupplierProfile
|
|
|
- */
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "供应商档案-资质信息通过主表ID查询")
|
|
|
+ @ApiOperation(value = "供应商档案-资质信息主表ID查询", notes = "供应商档案-资质信息-通主表ID查询")
|
|
|
+ @GetMapping(value = "/queryCuspSupplierProfileQualificationByMainId")
|
|
|
+ public Result<List<CuspSupplierProfileQualification>> queryCuspSupplierProfileQualificationListByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ List<CuspSupplierProfileQualification> cuspSupplierProfileQualificationList = cuspSupplierProfileQualificationService.selectByMainId(id);
|
|
|
+ return Result.OK(cuspSupplierProfileQualificationList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param cuspSupplierProfile
|
|
|
+ */
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_profile:exportXls")
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, CuspSupplierProfile cuspSupplierProfile) {
|
|
|
- // Step.1 组装查询条件查询数据
|
|
|
- QueryWrapper<CuspSupplierProfile> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierProfile, request.getParameterMap());
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
-
|
|
|
- //配置选中数据查询条件
|
|
|
- String selections = request.getParameter("selections");
|
|
|
- if(oConvertUtils.isNotEmpty(selections)) {
|
|
|
- List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
- queryWrapper.in("id",selectionList);
|
|
|
- }
|
|
|
- //Step.2 获取导出数据
|
|
|
- List<CuspSupplierProfile> cuspSupplierProfileList = cuspSupplierProfileService.list(queryWrapper);
|
|
|
-
|
|
|
- // Step.3 组装pageList
|
|
|
- List<CuspSupplierProfilePage> pageList = new ArrayList<CuspSupplierProfilePage>();
|
|
|
- for (CuspSupplierProfile main : cuspSupplierProfileList) {
|
|
|
- CuspSupplierProfilePage vo = new CuspSupplierProfilePage();
|
|
|
- BeanUtils.copyProperties(main, vo);
|
|
|
- List<CuspSupplierProfileMan> cuspSupplierProfileManList = cuspSupplierProfileManService.selectByMainId(main.getId());
|
|
|
- vo.setCuspSupplierProfileManList(cuspSupplierProfileManList);
|
|
|
- List<CuspSupplierProfileQualification> cuspSupplierProfileQualificationList = cuspSupplierProfileQualificationService.selectByMainId(main.getId());
|
|
|
- vo.setCuspSupplierProfileQualificationList(cuspSupplierProfileQualificationList);
|
|
|
- pageList.add(vo);
|
|
|
- }
|
|
|
-
|
|
|
- // Step.4 AutoPoi 导出Excel
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, "供应商档案列表");
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, CuspSupplierProfilePage.class);
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("供应商档案数据", "导出人:"+sysUser.getRealname(), "供应商档案"));
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
- return mv;
|
|
|
+ // Step.1 组装查询条件查询数据
|
|
|
+ QueryWrapper<CuspSupplierProfile> queryWrapper = QueryGenerator.initQueryWrapper(cuspSupplierProfile, request.getParameterMap());
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ //配置选中数据查询条件
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
+ if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+ queryWrapper.in("id", selectionList);
|
|
|
+ }
|
|
|
+ //Step.2 获取导出数据
|
|
|
+ List<CuspSupplierProfile> cuspSupplierProfileList = cuspSupplierProfileService.list(queryWrapper);
|
|
|
+
|
|
|
+ // Step.3 组装pageList
|
|
|
+ List<CuspSupplierProfilePage> pageList = new ArrayList<CuspSupplierProfilePage>();
|
|
|
+ for (CuspSupplierProfile main : cuspSupplierProfileList) {
|
|
|
+ CuspSupplierProfilePage vo = new CuspSupplierProfilePage();
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
|
+ List<CuspSupplierProfileMan> cuspSupplierProfileManList = cuspSupplierProfileManService.selectByMainId(main.getId());
|
|
|
+ vo.setCuspSupplierProfileManList(cuspSupplierProfileManList);
|
|
|
+ List<CuspSupplierProfileQualification> cuspSupplierProfileQualificationList = cuspSupplierProfileQualificationService.selectByMainId(main.getId());
|
|
|
+ vo.setCuspSupplierProfileQualificationList(cuspSupplierProfileQualificationList);
|
|
|
+ pageList.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Step.4 AutoPoi 导出Excel
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, "供应商档案列表");
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, CuspSupplierProfilePage.class);
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("供应商档案数据", "导出人:" + sysUser.getRealname(), "供应商档案"));
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
+ return mv;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequiresPermissions("cuspCode:cusp_supplier_profile:importExcel")
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
- MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
- Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
|
- for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
- // 获取上传文件对象
|
|
|
- MultipartFile file = entity.getValue();
|
|
|
- ImportParams params = new ImportParams();
|
|
|
- params.setTitleRows(2);
|
|
|
- params.setHeadRows(1);
|
|
|
- params.setNeedSave(true);
|
|
|
- try {
|
|
|
- List<CuspSupplierProfilePage> list = ExcelImportUtil.importExcel(file.getInputStream(), CuspSupplierProfilePage.class, params);
|
|
|
- for (CuspSupplierProfilePage page : list) {
|
|
|
- CuspSupplierProfile po = new CuspSupplierProfile();
|
|
|
- BeanUtils.copyProperties(page, po);
|
|
|
- cuspSupplierProfileService.saveMain(po, page.getCuspSupplierProfileManList(),page.getCuspSupplierProfileQualificationList());
|
|
|
- }
|
|
|
- return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- return Result.error("文件导入失败:"+e.getMessage());
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- file.getInputStream().close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return Result.OK("文件导入失败!");
|
|
|
+ MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
+ Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
|
+ for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
+ // 获取上传文件对象
|
|
|
+ MultipartFile file = entity.getValue();
|
|
|
+ ImportParams params = new ImportParams();
|
|
|
+ params.setTitleRows(2);
|
|
|
+ params.setHeadRows(1);
|
|
|
+ params.setNeedSave(true);
|
|
|
+ try {
|
|
|
+ List<CuspSupplierProfilePage> list = ExcelImportUtil.importExcel(file.getInputStream(), CuspSupplierProfilePage.class, params);
|
|
|
+ for (CuspSupplierProfilePage page : list) {
|
|
|
+ CuspSupplierProfile po = new CuspSupplierProfile();
|
|
|
+ BeanUtils.copyProperties(page, po);
|
|
|
+ cuspSupplierProfileService.saveMain(po, page.getCuspSupplierProfileManList(), page.getCuspSupplierProfileQualificationList());
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return Result.error("文件导入失败:" + e.getMessage());
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ file.getInputStream().close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入失败!");
|
|
|
}
|
|
|
|
|
|
}
|