|
@@ -1,35 +1,23 @@
|
|
package com.pj.tb_enterprise;
|
|
package com.pj.tb_enterprise;
|
|
|
|
|
|
-import java.io.FileOutputStream;
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
-import java.time.format.DateTimeFormatter;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
-import com.alibaba.excel.EasyExcel;
|
|
|
|
-import com.alibaba.excel.event.AnalysisEventListener;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
|
|
+import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
import com.pj.api.consts.FeignFactory;
|
|
import com.pj.api.consts.FeignFactory;
|
|
import com.pj.api.dto.DistrictDTO;
|
|
import com.pj.api.dto.DistrictDTO;
|
|
-import com.pj.api.dto.EnterpriseDto;
|
|
|
|
-import com.pj.common.core.exception.ServiceException;
|
|
|
|
|
|
+import com.pj.api.dto.EnterpriseAuditDto;
|
|
import com.pj.current.dto.APPLoginUserInfo;
|
|
import com.pj.current.dto.APPLoginUserInfo;
|
|
import com.pj.current.satoken.StpAPPUserUtil;
|
|
import com.pj.current.satoken.StpAPPUserUtil;
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
import com.pj.enummj.DeleteStatus;
|
|
import com.pj.enummj.DeleteStatus;
|
|
-import com.pj.enummj.JudgeStatus;
|
|
|
|
import com.pj.enummj.People;
|
|
import com.pj.enummj.People;
|
|
-import com.pj.tb_enterprise.param.EnterpriseParam;
|
|
|
|
|
|
+import com.pj.tb_enterprise.dto.EnterpriseDto;
|
|
import com.pj.tb_enterprise.vo.OrdersVo;
|
|
import com.pj.tb_enterprise.vo.OrdersVo;
|
|
import com.pj.tb_order.TbOrder;
|
|
import com.pj.tb_order.TbOrder;
|
|
import com.pj.tb_order.TbOrderMapper;
|
|
import com.pj.tb_order.TbOrderMapper;
|
|
import com.pj.utils.sg.AjaxError;
|
|
import com.pj.utils.sg.AjaxError;
|
|
-import com.pj.utils.sg.AjaxJson;
|
|
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
@@ -38,12 +26,18 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.swing.filechooser.FileSystemView;
|
|
import javax.swing.filechooser.FileSystemView;
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -65,6 +59,13 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
|
|
*/
|
|
*/
|
|
@Autowired
|
|
@Autowired
|
|
AdminInterface adminInterface;
|
|
AdminInterface adminInterface;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 远程调用
|
|
|
|
+ */
|
|
|
|
+ @Autowired
|
|
|
|
+ private LevelOneServerInterface levelOneServerInterface;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 订单表mapper
|
|
* 订单表mapper
|
|
*/
|
|
*/
|
|
@@ -81,9 +82,8 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
|
|
* 增
|
|
* 增
|
|
*/
|
|
*/
|
|
void add(TbEnterprise t) {
|
|
void add(TbEnterprise t) {
|
|
- List<DistrictDTO>districtDTOS= FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
|
|
|
|
- t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining()))
|
|
|
|
- .setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
|
|
|
|
|
|
+ List<DistrictDTO> districtDTOS = FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
|
|
|
|
+ t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining())).setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
|
|
save(t);
|
|
save(t);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -98,9 +98,8 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
|
|
* 改
|
|
* 改
|
|
*/
|
|
*/
|
|
void update(TbEnterprise t) {
|
|
void update(TbEnterprise t) {
|
|
- List<DistrictDTO>districtDTOS= FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
|
|
|
|
- t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining()))
|
|
|
|
- .setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
|
|
|
|
|
|
+ List<DistrictDTO> districtDTOS = FeignFactory.adminInterface.getDistrictList(t.getAddressIds());
|
|
|
|
+ t.setAddress(districtDTOS.stream().map(DistrictDTO::getDistrict).collect(Collectors.joining())).setCreateTime(new Date()).setCreateName(StpUserUtil.getPCLoginInfo().getLoginName());
|
|
updateById(t);
|
|
updateById(t);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -120,251 +119,250 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public int isLock(TbEnterpriseDto tbEnterpriseDto) {
|
|
|
|
- // 获取当前登录用户id
|
|
|
|
- Long loginId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
- // 根据id获取商户
|
|
|
|
- TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
|
|
|
|
- // 如果商户不存在则抛出异常
|
|
|
|
- if(Objects.isNull(tbEnterprise)){
|
|
|
|
- throw new RuntimeException("该商户不存在");
|
|
|
|
- }
|
|
|
|
- BeanUtils.copyProperties(tbEnterpriseDto,tbEnterprise);
|
|
|
|
- // 写入更新者id
|
|
|
|
- tbEnterprise.setUpdateBy(String.valueOf(loginId));
|
|
|
|
- // 更新商户锁定状态
|
|
|
|
- int line = tbEnterpriseMapper.updateById(tbEnterprise);
|
|
|
|
- //获取商户锁定状态
|
|
|
|
- int isLock = tbEnterprise.getIsLock();
|
|
|
|
- // 如果商户被锁住则禁止app端登录
|
|
|
|
- adminInterface.isLock(String.valueOf(tbEnterprise.getId()), People.PEOPLE_TYPE_TWO.getCode(),isLock);
|
|
|
|
-
|
|
|
|
- return line;
|
|
|
|
- }
|
|
|
|
|
|
+ public int isLock(TbEnterpriseDto tbEnterpriseDto) {
|
|
|
|
+ // 获取当前登录用户id
|
|
|
|
+ Long loginId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
+ // 根据id获取商户
|
|
|
|
+ TbEnterprise tbEnterprise = tbEnterpriseMapper.selectById(tbEnterpriseDto.getId());
|
|
|
|
+ // 如果商户不存在则抛出异常
|
|
|
|
+ if (Objects.isNull(tbEnterprise)) {
|
|
|
|
+ throw new RuntimeException("该商户不存在");
|
|
|
|
+ }
|
|
|
|
+ BeanUtils.copyProperties(tbEnterpriseDto, tbEnterprise);
|
|
|
|
+ // 写入更新者id
|
|
|
|
+ tbEnterprise.setUpdateBy(String.valueOf(loginId));
|
|
|
|
+ // 更新商户锁定状态
|
|
|
|
+ int line = tbEnterpriseMapper.updateById(tbEnterprise);
|
|
|
|
+ //获取商户锁定状态
|
|
|
|
+ int isLock = tbEnterprise.getIsLock();
|
|
|
|
+ // 如果商户被锁住则禁止app端登录
|
|
|
|
+ adminInterface.isLock(String.valueOf(tbEnterprise.getId()), People.PEOPLE_TYPE_TWO.getCode(), isLock);
|
|
|
|
+
|
|
|
|
+ return line;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public TbEnterprise selectByCreateBy() {
|
|
|
|
+ return tbEnterpriseMapper.selectByCreateBy("" + StpAPPUserUtil.getAPPLoginInfo().getLoginId());
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商家认证
|
|
* 商家认证
|
|
*
|
|
*
|
|
- * @param enterpriseParam
|
|
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- boolean identification(EnterpriseParam enterpriseParam) {
|
|
|
|
-
|
|
|
|
- //手机号去重
|
|
|
|
- String linkPhone = enterpriseParam.getLinkPhone();
|
|
|
|
- if(tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getIdCard,linkPhone).eq(TbEnterprise::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
|
|
|
|
- throw new RuntimeException("当前手机号已被认证!");
|
|
|
|
- //身份证号去重
|
|
|
|
- String contact = enterpriseParam.getCorporateIdCard();
|
|
|
|
- if(tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getContact,contact).eq(TbEnterprise::getDeleteStatus,DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
|
|
|
|
- throw new RuntimeException("当前身份证号已被认证!");
|
|
|
|
- //判断是否重复提交
|
|
|
|
- APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
|
|
|
|
- if(appLoginInfo == null || appLoginInfo.getLoginId() == null)
|
|
|
|
- throw new RuntimeException("当前登录账号信息已失效!");
|
|
|
|
- //重复提交验证处理
|
|
|
|
- methodEnterpriseService.againApply(appLoginInfo.getFk());
|
|
|
|
- //开始保存商家信息
|
|
|
|
- TbEnterprise tbEnterprise = new TbEnterprise();
|
|
|
|
- //保存基本信息
|
|
|
|
- tbEnterprise.setName(enterpriseParam.getName());
|
|
|
|
- tbEnterprise.setNationality("China");
|
|
|
|
- tbEnterprise.setLegalPerson(enterpriseParam.getCorporateName());
|
|
|
|
- tbEnterprise.setIdCard(enterpriseParam.getCorporateIdCard());
|
|
|
|
- tbEnterprise.setContact(enterpriseParam.getLinkPhone());
|
|
|
|
- tbEnterprise.setBusinessLicense(enterpriseParam.getBusinessLicense());
|
|
|
|
- tbEnterprise.setBankName(enterpriseParam.getBankName());
|
|
|
|
- tbEnterprise.setBankAccount(enterpriseParam.getBankAccount());
|
|
|
|
- tbEnterprise.setBankNo(enterpriseParam.getBankNo());
|
|
|
|
- tbEnterprise.setDutyParagraph(enterpriseParam.getDutyParagraph());
|
|
|
|
- //默认待审核
|
|
|
|
- tbEnterprise.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode());
|
|
|
|
-
|
|
|
|
- //注册/认证时间
|
|
|
|
- tbEnterprise.setRegisterTime(new Date());
|
|
|
|
- //创建时间
|
|
|
|
- tbEnterprise.setCreateTime(new Date());
|
|
|
|
- //删除状态:启用
|
|
|
|
- tbEnterprise.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
|
-
|
|
|
|
- // 保存商家信息
|
|
|
|
- int insert = tbEnterpriseMapper.insert(tbEnterprise);
|
|
|
|
- return insert == 1;
|
|
|
|
|
|
+ boolean identification(EnterpriseDto dto) {
|
|
|
|
+ TbEnterprise enterprise = tbEnterpriseMapper.selectByCreateBy("" + StpAPPUserUtil.getAPPLoginInfo().getLoginId());
|
|
|
|
+ dto.setJudgeStatus(0);
|
|
|
|
+ String contact = enterprise != null ? enterprise.getContact() : "";
|
|
|
|
+ String idCard = enterprise != null ? enterprise.getIdCard() : "";
|
|
|
|
+ //手机号查重
|
|
|
|
+ if (!contact.equals(dto.getContact()) && tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getContact, dto.getContact()).eq(TbEnterprise::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0) {
|
|
|
|
+ throw new RuntimeException("当前手机号已被认证!");
|
|
|
|
+ }
|
|
|
|
+ //身份证号查重
|
|
|
|
+ if (!idCard.equals(dto.getIdCard()) && tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(TbEnterprise::getIdCard, dto.getIdCard()).eq(TbEnterprise::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0) {
|
|
|
|
+ throw new RuntimeException("当前身份证号已被认证!");
|
|
|
|
+ }
|
|
|
|
+ if (enterprise == null) {
|
|
|
|
+ enterprise = new TbEnterprise();
|
|
|
|
+ BeanUtils.copyProperties(dto, enterprise);
|
|
|
|
+ enterprise.setCreateTime(new Date());
|
|
|
|
+ enterprise.setCreateBy("" + StpAPPUserUtil.getAPPLoginInfo().getLoginId());
|
|
|
|
+ enterprise.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
|
+ return save(enterprise);
|
|
|
|
+ }
|
|
|
|
+ dto.setId(enterprise.getId());
|
|
|
|
+ BeanUtils.copyProperties(dto, enterprise);
|
|
|
|
+ return updateById(enterprise);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 管理一级市场的贸易订单。
|
|
|
|
+ * 列表(主要展示字段:订单号、下单时间、商品名称、图片、价格、购买的边民组、订单状态、物流信息)、
|
|
|
|
+ * 确认退货/退款;
|
|
|
|
+ * 物流状态 SoMap soMap
|
|
|
|
+ */
|
|
|
|
+ public List<OrdersVo> manageLevelOneOrders(SoMap so, String keyword) {
|
|
|
|
+
|
|
|
|
+ //获取当前登录用户
|
|
|
|
+ APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
|
|
|
|
+ if (appLoginInfo == null || appLoginInfo.getLoginId() == null)
|
|
|
|
+ throw new RuntimeException("当前登陆用户信息已失效!");
|
|
|
|
+ Long fk = appLoginInfo.getFk();
|
|
|
|
+ //仅能查询自己的订单
|
|
|
|
+ so.put("buyUserId", fk);
|
|
|
|
+ so.put("deleteStatus", DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
|
+ so.put("keyword", keyword);
|
|
|
|
+
|
|
|
|
+ List<TbOrder> tbOrders = tbOrderMapper.getList(so);
|
|
|
|
+ //执行数据封装
|
|
|
|
+ List<OrdersVo> ordersVos = methodEnterpriseService.orderListChangeVo(appLoginInfo, tbOrders);
|
|
|
|
+ return ordersVos;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
- /** 管理一级市场的贸易订单。
|
|
|
|
- * 列表(主要展示字段:订单号、下单时间、商品名称、图片、价格、购买的边民组、订单状态、物流信息)、
|
|
|
|
- * 确认退货/退款;
|
|
|
|
- * 物流状态 SoMap soMap
|
|
|
|
- */
|
|
|
|
- public List<OrdersVo> manageLevelOneOrders(SoMap so,String keyword){
|
|
|
|
-
|
|
|
|
- //获取当前登录用户
|
|
|
|
- APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
|
|
|
|
- if(appLoginInfo == null || appLoginInfo.getLoginId() == null)throw new RuntimeException("当前登陆用户信息已失效!");
|
|
|
|
- Long fk = appLoginInfo.getFk();
|
|
|
|
- //仅能查询自己的订单
|
|
|
|
- so.put("buyUserId",fk);
|
|
|
|
- so.put("deleteStatus",DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
|
- so.put("keyword",keyword);
|
|
|
|
-
|
|
|
|
- List<TbOrder> tbOrders = tbOrderMapper.getList(so);
|
|
|
|
- //执行数据封装
|
|
|
|
- List<OrdersVo> ordersVos = methodEnterpriseService.orderListChangeVo(appLoginInfo,tbOrders);
|
|
|
|
- return ordersVos;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 导入
|
|
|
|
- * @param file excel文件
|
|
|
|
- * @return
|
|
|
|
- * @throws IOException
|
|
|
|
- */
|
|
|
|
- public String importData(MultipartFile file) throws IOException {
|
|
|
|
- System.out.println("\n开始执行文件上传....\n");
|
|
|
|
-
|
|
|
|
- //判空
|
|
|
|
- if(file.isEmpty()) return "文件为空,无法执行上传...";
|
|
|
|
- //获取文件上传数据
|
|
|
|
- HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream());
|
|
|
|
- //获取第一页sheet
|
|
|
|
- HSSFSheet sheet = wb.getSheetAt(0);
|
|
|
|
- //定义计数器
|
|
|
|
- int count = 0;
|
|
|
|
- //定义行对象
|
|
|
|
- HSSFRow row = null;
|
|
|
|
- //解析数据封装到集合
|
|
|
|
- count = methodEnterpriseService.importMethod(row, sheet, count);
|
|
|
|
- wb.close();
|
|
|
|
- System.out.println("\n文件上传完成,共上传 " + count + "条 " + "数据...\n");
|
|
|
|
- return "上传完成,共上传" + count + "条" + "数据。";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 导出 excel文件
|
|
|
|
- * @param keyword
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public String outportExcel(String keyword,String filepath) throws IOException {
|
|
|
|
- System.out.println("\n开始执行文件导出....\n");
|
|
|
|
- //导出的文件的路径
|
|
|
|
- if(filepath == null || filepath.trim().equals("")){
|
|
|
|
- // 获取当前用户的桌面路径
|
|
|
|
- FileSystemView fileSystemView = FileSystemView.getFileSystemView();
|
|
|
|
- filepath = fileSystemView.getHomeDirectory().getPath();
|
|
|
|
- }
|
|
|
|
- filepath = filepath + "\\商家数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
|
|
|
|
- //根据需求查询数据
|
|
|
|
- List<TbEnterprise> selectedList = tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(StringUtils.isNoneBlank(keyword), TbEnterprise::getName, keyword));
|
|
|
|
- if(selectedList.size() == 0)return "没有可导出的数据。";
|
|
|
|
- //建立excel对象封装数据
|
|
|
|
- HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
|
- //创建excel表格右下角的sheet页名称
|
|
|
|
- HSSFSheet sheet = workbook.createSheet("1");
|
|
|
|
- //创建表头
|
|
|
|
- HSSFRow row = sheet.createRow(0);
|
|
|
|
- row.createCell(0).setCellValue("序号");
|
|
|
|
- row.createCell(1).setCellValue("名称");
|
|
|
|
- row.createCell(2).setCellValue("国别");
|
|
|
|
- row.createCell(3).setCellValue("商户分类");
|
|
|
|
- row.createCell(4).setCellValue("法人");
|
|
|
|
- row.createCell(5).setCellValue("身份证号");
|
|
|
|
- row.createCell(6).setCellValue("手机号码");
|
|
|
|
- row.createCell(7).setCellValue("营业执照");
|
|
|
|
- row.createCell(8).setCellValue("所在铺位");
|
|
|
|
- row.createCell(9).setCellValue("所在铺位名称");
|
|
|
|
- row.createCell(10).setCellValue("银行编号");
|
|
|
|
- row.createCell(11).setCellValue("银行名称");
|
|
|
|
- row.createCell(12).setCellValue("银行账号");
|
|
|
|
- row.createCell(13).setCellValue("银行税号");
|
|
|
|
- row.createCell(14).setCellValue("地址ID集合");
|
|
|
|
- row.createCell(15).setCellValue("地址");
|
|
|
|
- row.createCell(16).setCellValue("agreement");
|
|
|
|
- row.createCell(17).setCellValue("judge_status");
|
|
|
|
- row.createCell(18).setCellValue("judge_content");
|
|
|
|
- row.createCell(19).setCellValue("judge_time");
|
|
|
|
- row.createCell(20).setCellValue("注册时间");
|
|
|
|
- row.createCell(21).setCellValue("人物编号");
|
|
|
|
- row.createCell(22).setCellValue("创建时间");
|
|
|
|
- row.createCell(23).setCellValue("创建人编号");
|
|
|
|
- row.createCell(24).setCellValue("创建人名称");
|
|
|
|
- row.createCell(25).setCellValue("更新时间");
|
|
|
|
- row.createCell(26).setCellValue("更新人编号");
|
|
|
|
- row.createCell(27).setCellValue("更新人名称");
|
|
|
|
- row.createCell(28).setCellValue("删除状态");
|
|
|
|
-
|
|
|
|
- //定义计数器
|
|
|
|
- int count = 0;
|
|
|
|
- //遍历集合
|
|
|
|
- for (int i = 0; i < selectedList.size(); i++) {
|
|
|
|
- HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
|
|
- sheetRow.createCell(0).setCellValue(i + 1);
|
|
|
|
- sheetRow.createCell(1).setCellValue((selectedList.get(i).getName() + "").equals("null")? "": selectedList.get(i).getName() + "");
|
|
|
|
- sheetRow.createCell(2).setCellValue((selectedList.get(i).getNationality() + "").equals("null")? "": selectedList.get(i).getNationality() + "");
|
|
|
|
- sheetRow.createCell(3).setCellValue((selectedList.get(i).getType() + "").equals("null")? "": selectedList.get(i).getType() + "");
|
|
|
|
- sheetRow.createCell(4).setCellValue((selectedList.get(i).getLegalPerson() + "").equals("null")? "": selectedList.get(i).getLegalPerson() + "");
|
|
|
|
- sheetRow.createCell(5).setCellValue((selectedList.get(i).getIdCard() + "").equals("null")? "": selectedList.get(i).getIdCard() + "");
|
|
|
|
- sheetRow.createCell(6).setCellValue((selectedList.get(i).getContact() + "").equals("null")? "": selectedList.get(i).getContact() + "");
|
|
|
|
- sheetRow.createCell(7).setCellValue((selectedList.get(i).getBusinessLicense() + "").equals("null")? "": selectedList.get(i).getBusinessLicense() + "");
|
|
|
|
- sheetRow.createCell(8).setCellValue((selectedList.get(i).getShopId() + "" ).equals("null")? "": selectedList.get(i).getShopId() + "");
|
|
|
|
- sheetRow.createCell(9).setCellValue((selectedList.get(i).getShopName() + "").equals("null")? "": selectedList.get(i).getShopName() + "");
|
|
|
|
- sheetRow.createCell(10).setCellValue((selectedList.get(i).getBankNo() + "").equals("null")? "": selectedList.get(i).getBankNo() + "");
|
|
|
|
- sheetRow.createCell(11).setCellValue((selectedList.get(i).getBankName() + "").equals("null")? "": selectedList.get(i).getBankName() + "");
|
|
|
|
- sheetRow.createCell(12).setCellValue((selectedList.get(i).getBankAccount() + "").equals("null")? "": selectedList.get(i).getBankAccount() + "");
|
|
|
|
- sheetRow.createCell(13).setCellValue((selectedList.get(i).getDutyParagraph() + "").equals("null")? "": selectedList.get(i).getDutyParagraph() + "");
|
|
|
|
- sheetRow.createCell(14).setCellValue((selectedList.get(i).getAddressIds() + "").equals("null")? "": selectedList.get(i).getAddressIds() + "");
|
|
|
|
- sheetRow.createCell(15).setCellValue((selectedList.get(i).getAddress() + "").equals("null")? "": selectedList.get(i).getAddress() + "");
|
|
|
|
- sheetRow.createCell(16).setCellValue((selectedList.get(i).getAgreement() + "").equals("null")? "": selectedList.get(i).getAgreement() + "");
|
|
|
|
- sheetRow.createCell(17).setCellValue((selectedList.get(i).getJudgeStatus() + "").equals("null")? "": selectedList.get(i).getJudgeStatus() + "");
|
|
|
|
- sheetRow.createCell(18).setCellValue((selectedList.get(i).getJudgeContent() + "").equals("null")? "": selectedList.get(i).getJudgeContent() + "");
|
|
|
|
- sheetRow.createCell(19).setCellValue((selectedList.get(i).getJudgeTime() + "").equals("null")? "": selectedList.get(i).getJudgeTime() + "");
|
|
|
|
- sheetRow.createCell(20).setCellValue((selectedList.get(i).getRegisterTime() + "").equals("null")? "": selectedList.get(i).getRegisterTime() + "");
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 导入
|
|
|
|
+ *
|
|
|
|
+ * @param file excel文件
|
|
|
|
+ * @return
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
|
|
+ public String importData(MultipartFile file) throws IOException {
|
|
|
|
+ System.out.println("\n开始执行文件上传....\n");
|
|
|
|
+
|
|
|
|
+ //判空
|
|
|
|
+ if (file.isEmpty()) return "文件为空,无法执行上传...";
|
|
|
|
+ //获取文件上传数据
|
|
|
|
+ HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream());
|
|
|
|
+ //获取第一页sheet
|
|
|
|
+ HSSFSheet sheet = wb.getSheetAt(0);
|
|
|
|
+ //定义计数器
|
|
|
|
+ int count = 0;
|
|
|
|
+ //定义行对象
|
|
|
|
+ HSSFRow row = null;
|
|
|
|
+ //解析数据封装到集合
|
|
|
|
+ count = methodEnterpriseService.importMethod(row, sheet, count);
|
|
|
|
+ wb.close();
|
|
|
|
+ System.out.println("\n文件上传完成,共上传 " + count + "条 " + "数据...\n");
|
|
|
|
+ return "上传完成,共上传" + count + "条" + "数据。";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导出 excel文件
|
|
|
|
+ *
|
|
|
|
+ * @param keyword
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String outportExcel(String keyword, String filepath) throws IOException {
|
|
|
|
+ System.out.println("\n开始执行文件导出....\n");
|
|
|
|
+ //导出的文件的路径
|
|
|
|
+ if (filepath == null || filepath.trim().equals("")) {
|
|
|
|
+ // 获取当前用户的桌面路径
|
|
|
|
+ FileSystemView fileSystemView = FileSystemView.getFileSystemView();
|
|
|
|
+ filepath = fileSystemView.getHomeDirectory().getPath();
|
|
|
|
+ }
|
|
|
|
+ filepath = filepath + "\\商家数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
|
|
|
|
+ //根据需求查询数据
|
|
|
|
+ List<TbEnterprise> selectedList = tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(StringUtils.isNoneBlank(keyword), TbEnterprise::getName, keyword));
|
|
|
|
+ if (selectedList.size() == 0) return "没有可导出的数据。";
|
|
|
|
+ //建立excel对象封装数据
|
|
|
|
+ HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
|
+ //创建excel表格右下角的sheet页名称
|
|
|
|
+ HSSFSheet sheet = workbook.createSheet("1");
|
|
|
|
+ //创建表头
|
|
|
|
+ HSSFRow row = sheet.createRow(0);
|
|
|
|
+ row.createCell(0).setCellValue("序号");
|
|
|
|
+ row.createCell(1).setCellValue("名称");
|
|
|
|
+ row.createCell(2).setCellValue("国别");
|
|
|
|
+ row.createCell(3).setCellValue("商户分类");
|
|
|
|
+ row.createCell(4).setCellValue("法人");
|
|
|
|
+ row.createCell(5).setCellValue("身份证号");
|
|
|
|
+ row.createCell(6).setCellValue("手机号码");
|
|
|
|
+ row.createCell(7).setCellValue("营业执照");
|
|
|
|
+ row.createCell(8).setCellValue("所在铺位");
|
|
|
|
+ row.createCell(9).setCellValue("所在铺位名称");
|
|
|
|
+ row.createCell(10).setCellValue("银行编号");
|
|
|
|
+ row.createCell(11).setCellValue("银行名称");
|
|
|
|
+ row.createCell(12).setCellValue("银行账号");
|
|
|
|
+ row.createCell(13).setCellValue("银行税号");
|
|
|
|
+ row.createCell(14).setCellValue("地址ID集合");
|
|
|
|
+ row.createCell(15).setCellValue("地址");
|
|
|
|
+ row.createCell(16).setCellValue("agreement");
|
|
|
|
+ row.createCell(17).setCellValue("judge_status");
|
|
|
|
+ row.createCell(18).setCellValue("judge_content");
|
|
|
|
+ row.createCell(19).setCellValue("judge_time");
|
|
|
|
+ row.createCell(20).setCellValue("注册时间");
|
|
|
|
+ row.createCell(21).setCellValue("人物编号");
|
|
|
|
+ row.createCell(22).setCellValue("创建时间");
|
|
|
|
+ row.createCell(23).setCellValue("创建人编号");
|
|
|
|
+ row.createCell(24).setCellValue("创建人名称");
|
|
|
|
+ row.createCell(25).setCellValue("更新时间");
|
|
|
|
+ row.createCell(26).setCellValue("更新人编号");
|
|
|
|
+ row.createCell(27).setCellValue("更新人名称");
|
|
|
|
+ row.createCell(28).setCellValue("删除状态");
|
|
|
|
+
|
|
|
|
+ //定义计数器
|
|
|
|
+ int count = 0;
|
|
|
|
+ //遍历集合
|
|
|
|
+ for (int i = 0; i < selectedList.size(); i++) {
|
|
|
|
+ HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
|
|
|
|
+ sheetRow.createCell(0).setCellValue(i + 1);
|
|
|
|
+ sheetRow.createCell(1).setCellValue((selectedList.get(i).getName() + "").equals("null") ? "" : selectedList.get(i).getName() + "");
|
|
|
|
+ sheetRow.createCell(2).setCellValue((selectedList.get(i).getNationality() + "").equals("null") ? "" : selectedList.get(i).getNationality() + "");
|
|
|
|
+ sheetRow.createCell(3).setCellValue((selectedList.get(i).getType() + "").equals("null") ? "" : selectedList.get(i).getType() + "");
|
|
|
|
+ sheetRow.createCell(4).setCellValue((selectedList.get(i).getLegalPerson() + "").equals("null") ? "" : selectedList.get(i).getLegalPerson() + "");
|
|
|
|
+ sheetRow.createCell(5).setCellValue((selectedList.get(i).getIdCard() + "").equals("null") ? "" : selectedList.get(i).getIdCard() + "");
|
|
|
|
+ sheetRow.createCell(6).setCellValue((selectedList.get(i).getContact() + "").equals("null") ? "" : selectedList.get(i).getContact() + "");
|
|
|
|
+ sheetRow.createCell(7).setCellValue((selectedList.get(i).getBusinessLicense() + "").equals("null") ? "" : selectedList.get(i).getBusinessLicense() + "");
|
|
|
|
+ sheetRow.createCell(8).setCellValue((selectedList.get(i).getShopId() + "").equals("null") ? "" : selectedList.get(i).getShopId() + "");
|
|
|
|
+ sheetRow.createCell(9).setCellValue((selectedList.get(i).getShopName() + "").equals("null") ? "" : selectedList.get(i).getShopName() + "");
|
|
|
|
+ sheetRow.createCell(10).setCellValue((selectedList.get(i).getBankNo() + "").equals("null") ? "" : selectedList.get(i).getBankNo() + "");
|
|
|
|
+ sheetRow.createCell(11).setCellValue((selectedList.get(i).getBankName() + "").equals("null") ? "" : selectedList.get(i).getBankName() + "");
|
|
|
|
+ sheetRow.createCell(12).setCellValue((selectedList.get(i).getBankAccount() + "").equals("null") ? "" : selectedList.get(i).getBankAccount() + "");
|
|
|
|
+ sheetRow.createCell(13).setCellValue((selectedList.get(i).getDutyParagraph() + "").equals("null") ? "" : selectedList.get(i).getDutyParagraph() + "");
|
|
|
|
+ sheetRow.createCell(14).setCellValue((selectedList.get(i).getAddressIds() + "").equals("null") ? "" : selectedList.get(i).getAddressIds() + "");
|
|
|
|
+ sheetRow.createCell(15).setCellValue((selectedList.get(i).getAddress() + "").equals("null") ? "" : selectedList.get(i).getAddress() + "");
|
|
|
|
+ sheetRow.createCell(16).setCellValue((selectedList.get(i).getAgreement() + "").equals("null") ? "" : selectedList.get(i).getAgreement() + "");
|
|
|
|
+ sheetRow.createCell(17).setCellValue((selectedList.get(i).getJudgeStatus() + "").equals("null") ? "" : selectedList.get(i).getJudgeStatus() + "");
|
|
|
|
+ sheetRow.createCell(18).setCellValue((selectedList.get(i).getJudgeContent() + "").equals("null") ? "" : selectedList.get(i).getJudgeContent() + "");
|
|
|
|
+ sheetRow.createCell(19).setCellValue((selectedList.get(i).getJudgeTime() + "").equals("null") ? "" : selectedList.get(i).getJudgeTime() + "");
|
|
|
|
+ sheetRow.createCell(20).setCellValue((selectedList.get(i).getRegisterTime() + "").equals("null") ? "" : selectedList.get(i).getRegisterTime() + "");
|
|
// sheetRow.createCell(21).setCellValue((selectedList.get(i).getPersonId() + "").equals("null")? "": selectedList.get(i).getPersonId() + "");
|
|
// sheetRow.createCell(21).setCellValue((selectedList.get(i).getPersonId() + "").equals("null")? "": selectedList.get(i).getPersonId() + "");
|
|
- sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null")? "": selectedList.get(i).getCreateTime() + "");
|
|
|
|
- sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null")? "": selectedList.get(i).getCreateBy() + "");
|
|
|
|
- sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null")? "": selectedList.get(i).getCreateName() + "");
|
|
|
|
- sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null")? "": selectedList.get(i).getUpdateTime() + "");
|
|
|
|
- sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
|
|
|
|
- sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
|
|
|
|
- sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
|
|
|
|
- count += 1;
|
|
|
|
- }
|
|
|
|
- //建立输出流,输出文件
|
|
|
|
- FileOutputStream fos = new FileOutputStream(filepath);
|
|
|
|
-
|
|
|
|
- workbook.write(fos);
|
|
|
|
- fos.flush();
|
|
|
|
- //关闭输出流
|
|
|
|
- fos.close();
|
|
|
|
- workbook.close();
|
|
|
|
- System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
|
|
|
|
- return "数据导出完成!共导出 " + count + " 条数据。";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /** 远程调用方法 注册身份为互市区商家时调用*/
|
|
|
|
- public boolean enterpriseDto(EnterpriseDto enterpriseDto){
|
|
|
|
- TbEnterprise tbEnterprise = new TbEnterprise();
|
|
|
|
- BeanUtils.copyProperties(enterpriseDto,tbEnterprise);
|
|
|
|
- boolean save = this.save(tbEnterprise);
|
|
|
|
- return save;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void audit(Long id, Integer judgeStatus, String judgeContent) {
|
|
|
|
|
|
+ sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null") ? "" : selectedList.get(i).getCreateTime() + "");
|
|
|
|
+ sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null") ? "" : selectedList.get(i).getCreateBy() + "");
|
|
|
|
+ sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null") ? "" : selectedList.get(i).getCreateName() + "");
|
|
|
|
+ sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null") ? "" : selectedList.get(i).getUpdateTime() + "");
|
|
|
|
+ sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null") ? "" : selectedList.get(i).getUpdateBy() + "");
|
|
|
|
+ sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null") ? "" : selectedList.get(i).getUpdateName() + "");
|
|
|
|
+ sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null") ? "" : selectedList.get(i).getDeleteStatus() + "");
|
|
|
|
+ count += 1;
|
|
|
|
+ }
|
|
|
|
+ //建立输出流,输出文件
|
|
|
|
+ FileOutputStream fos = new FileOutputStream(filepath);
|
|
|
|
+
|
|
|
|
+ workbook.write(fos);
|
|
|
|
+ fos.flush();
|
|
|
|
+ //关闭输出流
|
|
|
|
+ fos.close();
|
|
|
|
+ workbook.close();
|
|
|
|
+ System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
|
|
|
|
+ return "数据导出完成!共导出 " + count + " 条数据。";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 远程调用方法 注册身份为互市区商家时调用
|
|
|
|
+ */
|
|
|
|
+ public boolean enterpriseDto(com.pj.api.dto.EnterpriseDto enterpriseDto) {
|
|
|
|
+ TbEnterprise tbEnterprise = new TbEnterprise();
|
|
|
|
+ BeanUtils.copyProperties(enterpriseDto, tbEnterprise);
|
|
|
|
+ boolean save = this.save(tbEnterprise);
|
|
|
|
+ return save;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Transactional
|
|
|
|
+ public boolean audit(Long id, Integer judgeStatus, String judgeContent) {
|
|
TbEnterprise tbEnterprise = this.getById(id);
|
|
TbEnterprise tbEnterprise = this.getById(id);
|
|
if (tbEnterprise == null) {
|
|
if (tbEnterprise == null) {
|
|
throw new AjaxError("商户不存在");
|
|
throw new AjaxError("商户不存在");
|
|
}
|
|
}
|
|
String name = StpUserUtil.getLoginName();
|
|
String name = StpUserUtil.getLoginName();
|
|
- tbEnterprise.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date())
|
|
|
|
- .setJudgeBy(name);
|
|
|
|
|
|
+ tbEnterprise.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date()).setJudgeBy(name);
|
|
this.updateById(tbEnterprise);
|
|
this.updateById(tbEnterprise);
|
|
|
|
+ if (judgeStatus == 1) {
|
|
|
|
+ EnterpriseAuditDto auditDto = new EnterpriseAuditDto();
|
|
|
|
+ auditDto.setAuth("1");
|
|
|
|
+ auditDto.setFkId(id);
|
|
|
|
+ auditDto.setId(Long.parseLong(tbEnterprise.getCreateBy()));
|
|
|
|
+ return levelOneServerInterface.audit(auditDto);
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 批量审核
|
|
* 批量审核
|
|
|
|
+ *
|
|
* @param ids
|
|
* @param ids
|
|
* @param judgeStatus
|
|
* @param judgeStatus
|
|
* @param judgeContent
|
|
* @param judgeContent
|
|
@@ -376,18 +374,19 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
|
|
List<TbEnterprise> list = listByIds(ids);
|
|
List<TbEnterprise> list = listByIds(ids);
|
|
String name = StpUserUtil.getLoginName();
|
|
String name = StpUserUtil.getLoginName();
|
|
list.forEach(tbEnterprise -> {
|
|
list.forEach(tbEnterprise -> {
|
|
- tbEnterprise.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date())
|
|
|
|
- .setJudgeBy(name);
|
|
|
|
|
|
+ tbEnterprise.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date()).setJudgeBy(name);
|
|
});
|
|
});
|
|
this.updateBatchById(list);
|
|
this.updateBatchById(list);
|
|
}
|
|
}
|
|
|
|
|
|
- /** 远程调用:根据ID获取一级市场商户 */
|
|
|
|
- EnterpriseDto getEnterpriseById(Long id) {
|
|
|
|
- TbEnterprise enterprise = tbEnterpriseMapper.selectById(id);
|
|
|
|
- EnterpriseDto enterpriseDto = new EnterpriseDto();
|
|
|
|
- BeanUtils.copyProperties(enterprise,enterpriseDto);
|
|
|
|
- return enterpriseDto;
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 远程调用:根据ID获取一级市场商户
|
|
|
|
+ */
|
|
|
|
+ com.pj.api.dto.EnterpriseDto getEnterpriseById(Long id) {
|
|
|
|
+ TbEnterprise enterprise = tbEnterpriseMapper.selectById(id);
|
|
|
|
+ com.pj.api.dto.EnterpriseDto enterpriseDto = new com.pj.api.dto.EnterpriseDto();
|
|
|
|
+ BeanUtils.copyProperties(enterprise, enterpriseDto);
|
|
|
|
+ return enterpriseDto;
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|