导入商户
This commit is contained in:
parent
97b6fd0e3a
commit
bf67b50a63
|
|
@ -89,14 +89,14 @@ public class StoreImportDTO implements Serializable {
|
||||||
*/
|
*/
|
||||||
@DictFormat(dictType = "store_type", rewrite = true)
|
@DictFormat(dictType = "store_type", rewrite = true)
|
||||||
@ExcelProperty(value = "商户类型")
|
@ExcelProperty(value = "商户类型")
|
||||||
private Integer storeType;
|
private String storeType;
|
||||||
/**
|
/**
|
||||||
* 巡检频次
|
* 巡检频次
|
||||||
*/
|
*/
|
||||||
@DictFormat(dictType = "ins_fre", rewrite = true)
|
@DictFormat(dictType = "ins_fre", rewrite = true)
|
||||||
@Range(min = 1, max = 5, message = "巡检频次非法")
|
@Range(min = 1, max = 5, message = "巡检频次非法")
|
||||||
@ExcelProperty(value = "巡检频次")
|
@ExcelProperty(value = "巡检频次")
|
||||||
private Integer insFre;
|
private String insFre;
|
||||||
/**
|
/**
|
||||||
* 终端sn号
|
* 终端sn号
|
||||||
*/
|
*/
|
||||||
|
|
@ -127,14 +127,14 @@ public class StoreImportDTO implements Serializable {
|
||||||
@DictFormat(dictType = "terminal_source", rewrite = true)
|
@DictFormat(dictType = "terminal_source", rewrite = true)
|
||||||
@Range(min = 1, max = 3, message = "终端来源非法")
|
@Range(min = 1, max = 3, message = "终端来源非法")
|
||||||
@ExcelProperty(value = "终端来源")
|
@ExcelProperty(value = "终端来源")
|
||||||
private Integer terminalSource;
|
private String terminalSource;
|
||||||
/**
|
/**
|
||||||
* 终端类型
|
* 终端类型
|
||||||
*/
|
*/
|
||||||
@DictFormat(dictType = "terminal_type", rewrite = true)
|
@DictFormat(dictType = "terminal_type", rewrite = true)
|
||||||
@Range(min = 1, max = 9, message = "终端类型非法")
|
@Range(min = 1, max = 9, message = "终端类型非法")
|
||||||
@ExcelProperty(value = "终端类型")
|
@ExcelProperty(value = "终端类型")
|
||||||
private Integer terminalType;
|
private String terminalType;
|
||||||
/**
|
/**
|
||||||
* 终端型号
|
* 终端型号
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.chushang.inspection.terminal.po;
|
package com.chushang.inspection.terminal.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.chushang.common.mybatis.base.BaseEntity;
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -7,6 +10,8 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户导入临时表
|
* 商户导入临时表
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
|
|
@ -18,4 +23,186 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName(value = "st_store_import")
|
@TableName(value = "st_store_import")
|
||||||
public class StoreImport extends BaseEntity {
|
public class StoreImport extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@TableField(value = "task_id")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下级任务id
|
||||||
|
*/
|
||||||
|
@TableField(value = "lower_task_id")
|
||||||
|
private Long lowerTaskId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户编号
|
||||||
|
*/
|
||||||
|
@TableField(value = "store_no")
|
||||||
|
private String storeNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "store_name")
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户联系人
|
||||||
|
*/
|
||||||
|
@TableField(value = "store_contact")
|
||||||
|
private String storeContact;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户联系电话
|
||||||
|
*/
|
||||||
|
@TableField(value = "store_phone")
|
||||||
|
private String storePhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户地址
|
||||||
|
*/
|
||||||
|
@TableField(value = "store_address")
|
||||||
|
private String storeAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户特殊编号
|
||||||
|
*/
|
||||||
|
@TableField(value = "special_num")
|
||||||
|
private String specialNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "shop_name")
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建档日期
|
||||||
|
*/
|
||||||
|
@TableField(value = "register_time")
|
||||||
|
private Date registerTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "store_type")
|
||||||
|
private Integer storeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现有其他收单产品
|
||||||
|
*/
|
||||||
|
@TableField(value = "products")
|
||||||
|
private String products;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户提示工具
|
||||||
|
*/
|
||||||
|
@TableField(value = "tip_tool")
|
||||||
|
private String tipTool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巡检频次
|
||||||
|
*/
|
||||||
|
@TableField(value = "ins_fre")
|
||||||
|
private Integer insFre;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户经理
|
||||||
|
*/
|
||||||
|
@TableField(value = "account_manager")
|
||||||
|
private String accountManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经理电话
|
||||||
|
*/
|
||||||
|
@TableField(value = "account_phone")
|
||||||
|
private String accountPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册地址
|
||||||
|
*/
|
||||||
|
@TableField(value = "register_address")
|
||||||
|
private String registerAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
@TableField(value = "dept_id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@TableField(value = "user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 法人/负责人
|
||||||
|
*/
|
||||||
|
@TableField(value = "legal_name")
|
||||||
|
private String legalName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端sn号
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_sn")
|
||||||
|
private String terminalSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端编号
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_no")
|
||||||
|
private String terminalNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_type")
|
||||||
|
private Integer terminalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端型号
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_model")
|
||||||
|
private String terminalModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_version")
|
||||||
|
private String terminalVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端地址
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_address")
|
||||||
|
private String terminalAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端来源
|
||||||
|
*/
|
||||||
|
@TableField(value = "terminal_source")
|
||||||
|
private Integer terminalSource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常描述
|
||||||
|
*/
|
||||||
|
@TableField(value = "exception_description")
|
||||||
|
private Integer exceptionDescription;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
package com.chushang.inspection.terminal.query;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.chushang.common.mybatis.annotation.Condition;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户导入临时表
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/7/3 9:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class StoreImportQuery extends CommonParam {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@Condition(name = "task_id")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Condition(name = "create_time", type = Condition.ConditionType.between)
|
||||||
|
private List<LocalDateTime> createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下级任务id
|
||||||
|
*/
|
||||||
|
private Long lowerTaskId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户编号
|
||||||
|
*/
|
||||||
|
private String storeNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户名称
|
||||||
|
*/
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户联系人
|
||||||
|
*/
|
||||||
|
private String storeContact;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户联系电话
|
||||||
|
*/
|
||||||
|
private String storePhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户地址
|
||||||
|
*/
|
||||||
|
private String storeAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户特殊编号
|
||||||
|
*/
|
||||||
|
private String specialNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建档日期
|
||||||
|
*/
|
||||||
|
private Date registerTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户类型
|
||||||
|
*/
|
||||||
|
private Integer storeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现有其他收单产品
|
||||||
|
*/
|
||||||
|
private String products;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户提示工具
|
||||||
|
*/
|
||||||
|
private String tipTool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 巡检频次
|
||||||
|
*/
|
||||||
|
private Integer insFre;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户经理
|
||||||
|
*/
|
||||||
|
private String accountManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经理电话
|
||||||
|
*/
|
||||||
|
private String accountPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册地址
|
||||||
|
*/
|
||||||
|
private String registerAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 法人/负责人
|
||||||
|
*/
|
||||||
|
private String legalName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端sn号
|
||||||
|
*/
|
||||||
|
private String terminalSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端编号
|
||||||
|
*/
|
||||||
|
private String terminalNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端类型
|
||||||
|
*/
|
||||||
|
private Integer terminalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端型号
|
||||||
|
*/
|
||||||
|
private String terminalModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private String terminalVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端地址
|
||||||
|
*/
|
||||||
|
private String terminalAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端来源
|
||||||
|
*/
|
||||||
|
private Integer terminalSource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常描述
|
||||||
|
*/
|
||||||
|
private Integer exceptionDescription;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,34 @@
|
||||||
package com.chushang.inspection.terminal.controller;
|
package com.chushang.inspection.terminal.controller;
|
||||||
|
|
||||||
|
import com.chushang.common.core.exception.utils.AssertUtil;
|
||||||
|
import com.chushang.common.core.validator.Create;
|
||||||
|
import com.chushang.common.core.validator.Update;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.log.enums.BusinessType;
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.inspection.project.dto.ContractDTO;
|
||||||
|
import com.chushang.inspection.project.dto.ProjectDTO;
|
||||||
|
import com.chushang.inspection.project.dto.TaskExcelDTO;
|
||||||
import com.chushang.inspection.project.service.TbTemplateService;
|
import com.chushang.inspection.project.service.TbTemplateService;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import com.chushang.inspection.terminal.dto.StoreImportDTO;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.chushang.inspection.terminal.po.StoreImport;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import com.chushang.inspection.terminal.query.StoreImportQuery;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import com.chushang.inspection.terminal.query.StoreQuery;
|
||||||
|
import com.chushang.inspection.terminal.service.StoreImportService;
|
||||||
|
import com.chushang.inspection.terminal.service.StoreService;
|
||||||
|
import com.chushang.inspection.utils.BeanCopyUtils;
|
||||||
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
|
|
@ -18,8 +37,16 @@ import javax.annotation.Resource;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/store/import")
|
@RequestMapping(value = "/store/import")
|
||||||
public class StoreImportController {
|
public class StoreImportController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
TbTemplateService tbTemplateService;
|
TbTemplateService tbTemplateService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StoreImportService storeImportService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* todo
|
* todo
|
||||||
* 需要 以下接口
|
* 需要 以下接口
|
||||||
|
|
@ -31,15 +58,107 @@ public class StoreImportController {
|
||||||
* 6. store_import 转 store,template,template_ins 表, 转一条数据之后, 就需要同步清除, 避免数据重复
|
* 6. store_import 转 store,template,template_ins 表, 转一条数据之后, 就需要同步清除, 避免数据重复
|
||||||
* 7. 清除当前数据
|
* 7. 清除当前数据
|
||||||
*/
|
*/
|
||||||
@SysLog(value = "导入模板", businessType = BusinessType.DOWNLOAD)
|
@SysLog(value = "下载模板", businessType = BusinessType.DOWNLOAD)
|
||||||
@PostMapping("/down/template")
|
@PostMapping("/down/template")
|
||||||
// @RequiresPermissions("store:down:template")
|
@RequiresPermissions("store:import:template")
|
||||||
public AjaxResult downTemplate(@RequestParam(defaultValue = "store_template") String templateAlias,
|
public AjaxResult downTemplate(@RequestParam(defaultValue = "store_template") String templateAlias)
|
||||||
@RequestParam(defaultValue = "") Long taskId)
|
|
||||||
{
|
{
|
||||||
return AjaxResult.success(tbTemplateService.getByAlias(templateAlias, taskId));
|
return AjaxResult.success(tbTemplateService.getByAlias(templateAlias, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo 导入商户 read
|
// todo 导入商户 read
|
||||||
// todo 导入商户 save
|
// todo 导入商户 save
|
||||||
|
|
||||||
|
@SysLog(value = "导入", businessType = BusinessType.IMPORT)
|
||||||
|
@PostMapping("/import")
|
||||||
|
@RequiresPermissions("store:import:import")
|
||||||
|
public AjaxResult importStore(@RequestParam(defaultValue = "file") MultipartFile file)
|
||||||
|
{
|
||||||
|
List<StoreImportDTO> read = ExcelUtils.read(file, StoreImportDTO.class);
|
||||||
|
List<StoreImport> storeImportList = assembleEntity(read);
|
||||||
|
|
||||||
|
return AjaxResult.success(storeImportService.saveBatch(storeImportList));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<StoreImport> assembleEntity(List<StoreImportDTO> read){
|
||||||
|
List<StoreImport> storeImportList = Lists.newArrayList();
|
||||||
|
for (StoreImportDTO storeImportDTO: read){
|
||||||
|
StoreImport copy = BeanCopyUtils.copy(storeImportDTO, StoreImport.class);
|
||||||
|
copy.setDeptId(SecurityUtils.getDeptId());
|
||||||
|
storeImportList.add(copy);
|
||||||
|
}
|
||||||
|
return storeImportList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表确认导入查询
|
||||||
|
*
|
||||||
|
* @param query 条件
|
||||||
|
*/
|
||||||
|
@SysLog(value = "列表确认导入查询", businessType = BusinessType.QUERY)
|
||||||
|
@GetMapping("/page")
|
||||||
|
@RequiresPermissions("store:import:page")
|
||||||
|
public AjaxResult pageList(@Validated StoreImportQuery query) {
|
||||||
|
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||||
|
return AjaxResult.success(storeImportService.pageList(query,commonParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改 商户确认导入
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/update")
|
||||||
|
@RequiresPermissions("store:import:update")
|
||||||
|
@SysLog(value = "导入数据删除",businessType = BusinessType.UPDATE)
|
||||||
|
public AjaxResult update(@RequestBody @Validated(Update.class) StoreImportQuery query){
|
||||||
|
|
||||||
|
StoreImport storeImport = BeanCopyUtils.copy(query, StoreImport.class);
|
||||||
|
storeImport.setDeptId(SecurityUtils.getDeptId());
|
||||||
|
return AjaxResult.success(storeImportService.updateById(storeImport));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除导入数据
|
||||||
|
*/
|
||||||
|
@DeleteMapping(value = "/{ids}")
|
||||||
|
@RequiresPermissions("store:import:del")
|
||||||
|
@SysLog(value = "导入数据删除",businessType = BusinessType.DELETE)
|
||||||
|
public AjaxResult delProject( @PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(storeImportService.removeByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增导入数据
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/save")
|
||||||
|
@SysLog(value = "新增导入数据", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("store:import:save")
|
||||||
|
public AjaxResult save(@RequestBody @Validated(Create.class) StoreImportQuery query)
|
||||||
|
{
|
||||||
|
StoreImport storeImport = BeanCopyUtils.copy(query, StoreImport.class);
|
||||||
|
storeImport.setDeptId(SecurityUtils.getDeptId());
|
||||||
|
return AjaxResult.success(storeImportService.save(storeImport));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认导入数据
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/confirm/{ids}")
|
||||||
|
@SysLog(value = "确认导入数据", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("store:import:save")
|
||||||
|
public AjaxResult confimImport(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(storeImportService.confimImport(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
package com.chushang.inspection.terminal.mapper;
|
package com.chushang.inspection.terminal.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.chushang.datascope.annotation.DataScope;
|
||||||
import com.chushang.inspection.terminal.po.StoreImport;
|
import com.chushang.inspection.terminal.po.StoreImport;
|
||||||
|
import com.chushang.inspection.terminal.query.StoreQuery;
|
||||||
|
import com.chushang.inspection.terminal.query.TerminalQuery;
|
||||||
|
import com.chushang.inspection.terminal.vo.TerminalVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/7/3 9:52
|
* @date: 2024/7/3 9:52
|
||||||
*/
|
*/
|
||||||
public interface StoreImportMapper extends BaseMapper<StoreImport> {
|
public interface StoreImportMapper extends BaseMapper<StoreImport> {
|
||||||
|
|
||||||
|
@DataScope(deptAlias = "t")
|
||||||
|
List<TerminalVO> pageList(@Param("query") StoreQuery query,
|
||||||
|
Page<TerminalVO> page);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
package com.chushang.inspection.terminal.service;
|
package com.chushang.inspection.terminal.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.inspection.project.dto.ProjectDTO;
|
||||||
import com.chushang.inspection.terminal.po.StoreImport;
|
import com.chushang.inspection.terminal.po.StoreImport;
|
||||||
|
import com.chushang.inspection.terminal.query.StoreImportQuery;
|
||||||
|
import com.chushang.inspection.terminal.query.StoreQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/7/3 9:55
|
* @date: 2024/7/3 9:55
|
||||||
*/
|
*/
|
||||||
public interface StoreImportService extends IService<StoreImport> {
|
public interface StoreImportService extends IService<StoreImport> {
|
||||||
|
|
||||||
|
|
||||||
|
PageResult pageList(StoreImportQuery storeImport, CommonParam commonParam);
|
||||||
|
|
||||||
|
|
||||||
|
int confimImport(Long[] ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,39 @@
|
||||||
package com.chushang.inspection.terminal.service.impl;
|
package com.chushang.inspection.terminal.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chushang.common.core.util.StringUtils;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.common.mybatis.utils.WrapperUtils;
|
||||||
|
import com.chushang.inspection.project.dto.ProjectDTO;
|
||||||
|
import com.chushang.inspection.project.po.WrkProject;
|
||||||
import com.chushang.inspection.terminal.mapper.StoreImportMapper;
|
import com.chushang.inspection.terminal.mapper.StoreImportMapper;
|
||||||
|
import com.chushang.inspection.terminal.mapper.StoreMapper;
|
||||||
|
import com.chushang.inspection.terminal.mapper.TerminalInsMapper;
|
||||||
|
import com.chushang.inspection.terminal.mapper.TerminalMapper;
|
||||||
|
import com.chushang.inspection.terminal.po.Store;
|
||||||
import com.chushang.inspection.terminal.po.StoreImport;
|
import com.chushang.inspection.terminal.po.StoreImport;
|
||||||
|
import com.chushang.inspection.terminal.po.Terminal;
|
||||||
|
import com.chushang.inspection.terminal.po.TerminalIns;
|
||||||
|
import com.chushang.inspection.terminal.query.StoreImportQuery;
|
||||||
|
import com.chushang.inspection.terminal.query.StoreQuery;
|
||||||
import com.chushang.inspection.terminal.service.StoreImportService;
|
import com.chushang.inspection.terminal.service.StoreImportService;
|
||||||
|
import com.chushang.inspection.terminal.vo.StoreVO;
|
||||||
|
import com.chushang.inspection.terminal.vo.TerminalVO;
|
||||||
|
import com.chushang.inspection.utils.BeanCopyUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
|
|
@ -14,4 +42,53 @@ import org.springframework.stereotype.Service;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class StoreImportServiceImpl extends ServiceImpl<StoreImportMapper, StoreImport> implements StoreImportService {
|
public class StoreImportServiceImpl extends ServiceImpl<StoreImportMapper, StoreImport> implements StoreImportService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
TerminalMapper terminalMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
TerminalInsMapper terminalInsMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StoreMapper storeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult pageList(StoreImportQuery query, CommonParam commonParam) {
|
||||||
|
LambdaQueryWrapper<StoreImport> queryWrapper = WrapperUtils.builder(query, commonParam);
|
||||||
|
IPage<StoreImport> page = this.page(
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||||
|
queryWrapper
|
||||||
|
);
|
||||||
|
|
||||||
|
return new PageResult(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int confimImport(Long[] ids) {
|
||||||
|
int i = 0;
|
||||||
|
for (Long id : ids) {
|
||||||
|
i++;
|
||||||
|
StoreImport storeImport = getById(id);
|
||||||
|
if(ObjectUtil.isEmpty(storeImport)){
|
||||||
|
throw new RuntimeException("导入失败");
|
||||||
|
}
|
||||||
|
Store store = BeanCopyUtils.copy(storeImport, Store.class);
|
||||||
|
store.setStoreId(IdUtil.getSnowflake().nextId());
|
||||||
|
storeMapper.insert(store);
|
||||||
|
Terminal terminal = BeanCopyUtils.copy(storeImport, Terminal.class);
|
||||||
|
terminal.setStoreId(store.getStoreId());
|
||||||
|
terminalMapper.insert(terminal);
|
||||||
|
TerminalIns terminalIns = BeanCopyUtils.copy(storeImport, TerminalIns.class);
|
||||||
|
terminalIns.setTerminalId(terminal.getTerminalId());
|
||||||
|
terminalIns.setStoreId(store.getStoreId());
|
||||||
|
terminalInsMapper.insert(terminalIns);
|
||||||
|
baseMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: ${spring.cloud.nacos.server-addr}
|
server-addr: ${spring.cloud.nacos.server-addr}
|
||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
group: local
|
group: ${nacos.group}
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
config:
|
config:
|
||||||
server-addr: ${spring.cloud.nacos.server-addr}
|
server-addr: ${spring.cloud.nacos.server-addr}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue