支付
This commit is contained in:
27
zhwl-business/zhwl-store/pom.xml
Normal file
27
zhwl-business/zhwl-store/pom.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.zhwl</groupId>
|
||||
<artifactId>zhwl-business</artifactId>
|
||||
<version>3.8.7</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>zhwl-store</artifactId>
|
||||
<description>店铺基本信息模块</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zhwl</groupId>
|
||||
<artifactId>zhwl-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zhwl</groupId>
|
||||
<artifactId>zhwl-message</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@@ -0,0 +1,57 @@
|
||||
package com.zhwl.store;
|
||||
|
||||
import com.zhwl.common.exception.ServiceException;
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import com.zhwl.store.mapper.ZdyStoreBaseInfoMapper;
|
||||
import com.zhwl.system.mapper.SysDeptMapper;
|
||||
import com.zhwl.system.mapper.SysUserMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺信息manager
|
||||
*
|
||||
* @author song_xiaowei
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ZdyStoreBaseInfoManager {
|
||||
|
||||
private final ZdyStoreBaseInfoMapper zdyStoreBaseInfoMapper;
|
||||
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
private final SysDeptMapper sysDeptMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteZdyStoreBaseInfoByIds(Long[] ids) {
|
||||
List<ZdyStoreBaseInfo> zdyStoreBaseInfos = zdyStoreBaseInfoMapper.selectZdyStoreBaseInfoByIds(ids);
|
||||
if (CollectionUtils.isEmpty(zdyStoreBaseInfos)) {
|
||||
throw new ServiceException("店铺信息不存在");
|
||||
}
|
||||
List<Long> deptIds = zdyStoreBaseInfos.stream()
|
||||
.map(ZdyStoreBaseInfo::getDeptId)
|
||||
.collect(Collectors.toList());
|
||||
// 删除店铺下所有账号
|
||||
sysUserMapper.deleteUserByDeptIds(deptIds);
|
||||
// 删除部门信息
|
||||
sysDeptMapper.deleteDeptByIds(deptIds);
|
||||
// 删除店铺
|
||||
return zdyStoreBaseInfoMapper.deleteZdyStoreBaseInfoByIds(ids);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteZdyStoreBaseInfoByIds(Long[] ids, List<Long> deptIds) {
|
||||
// 删除店铺下所有账号
|
||||
sysUserMapper.deleteUserByDeptIds(deptIds);
|
||||
// 删除部门信息
|
||||
sysDeptMapper.deleteDeptByIds(deptIds);
|
||||
// 删除店铺
|
||||
zdyStoreBaseInfoMapper.deleteZdyStoreBaseInfoByIds(ids);
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.zhwl.store.annotation;
|
||||
|
||||
import com.zhwl.system.enums.OrgTypeEnum;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 店铺信息信息注解
|
||||
*
|
||||
* @author song_xiaowei
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ZdyStore {
|
||||
|
||||
OrgTypeEnum orgType();
|
||||
}
|
@@ -0,0 +1,193 @@
|
||||
package com.zhwl.store.controller;
|
||||
|
||||
import com.zhwl.common.annotation.Log;
|
||||
import com.zhwl.common.annotation.SelectDictText;
|
||||
import com.zhwl.common.core.controller.BaseController;
|
||||
import com.zhwl.common.core.domain.AjaxResult;
|
||||
import com.zhwl.common.core.page.TableDataInfo;
|
||||
import com.zhwl.common.enums.BusinessType;
|
||||
import com.zhwl.common.utils.poi.ExcelUtil;
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import com.zhwl.store.service.IZdyStoreBaseInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 核心模块-店铺基本信息Controller
|
||||
*
|
||||
* @author song_xiaowei
|
||||
* @date 2024-12-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/store/info")
|
||||
@RequiredArgsConstructor
|
||||
public class ZdyStoreBaseInfoController extends BaseController {
|
||||
|
||||
private final IZdyStoreBaseInfoService zdyStoreBaseInfoService;
|
||||
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:info:list')")
|
||||
@GetMapping("/list")
|
||||
@SelectDictText
|
||||
public TableDataInfo list(ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
startPage();
|
||||
List<ZdyStoreBaseInfo> list = zdyStoreBaseInfoService.selectZdyStoreBaseInfoList(zdyStoreBaseInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出核心模块-店铺基本信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:info:export')")
|
||||
@Log(title = "核心模块-店铺基本信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
List<ZdyStoreBaseInfo> list = zdyStoreBaseInfoService.selectZdyStoreBaseInfoList(zdyStoreBaseInfo);
|
||||
ExcelUtil<ZdyStoreBaseInfo> util = new ExcelUtil<>(ZdyStoreBaseInfo.class);
|
||||
util.exportExcel(response, list, "核心模块-店铺基本信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取核心模块-店铺基本信息详细信息
|
||||
*/
|
||||
@GetMapping(value = {"/{id}", ""})
|
||||
@SelectDictText
|
||||
public AjaxResult getInfo(@PathVariable(value = "id", required = false) Long id) {
|
||||
return success(zdyStoreBaseInfoService.selectZdyStoreBaseInfoById(id, getLoginUser().getUser()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增店铺
|
||||
*/
|
||||
@Log(title = "核心模块-店铺基本信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody String param) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = zdyStoreBaseInfoService.insertZdyStoreBaseInfo(param, getLoginUser());
|
||||
return success(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改核心模块-店铺基本信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:info:edit')")
|
||||
@Log(title = "核心模块-店铺基本信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
public AjaxResult edit(@PathVariable("id") Long id, @RequestBody String param) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = zdyStoreBaseInfoService.updateZdyStoreBaseInfo(id, param);
|
||||
return success(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改核心模块-店铺基本信息
|
||||
*/
|
||||
@Log(title = "核心模块-店铺基本信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/withReview/{id}")
|
||||
public AjaxResult editWithReview(@PathVariable("id") Long id, @RequestBody String param) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = zdyStoreBaseInfoService.updateZdyStoreBaseInfoWithReview(id, param);
|
||||
return success(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除核心模块-店铺基本信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:info:remove')")
|
||||
@Log(title = "核心模块-店铺基本信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(zdyStoreBaseInfoService.deleteZdyStoreBaseInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*
|
||||
* @param param 店铺注册信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody String param) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = zdyStoreBaseInfoService.register(param);
|
||||
return success(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核注册
|
||||
*
|
||||
* @param zdyStoreBaseInfo 店铺信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:info:register:audit')")
|
||||
@PutMapping("/audit")
|
||||
public AjaxResult registerAudit(@RequestBody ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
zdyStoreBaseInfoService.registerAudit(zdyStoreBaseInfo, getUserId());
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:grounding:up')")
|
||||
@PostMapping("/grounding/up/{id}")
|
||||
public AjaxResult groundingUp(@PathVariable("id") Long id) {
|
||||
zdyStoreBaseInfoService.storeGroundingUp(id);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:grounding:down')")
|
||||
@PostMapping("/grounding/down/{id}")
|
||||
public AjaxResult groundingDown(@PathVariable("id") Long id) {
|
||||
zdyStoreBaseInfoService.storeGroundingDown(id);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* (管理员)上架
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:manager:grounding:up')")
|
||||
@PostMapping("/grounding/manager/up/{id}")
|
||||
public AjaxResult managerUpStoreGrounding(@PathVariable("id") Long id) {
|
||||
zdyStoreBaseInfoService.managerUpStoreGrounding(id);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* (管理员)下架
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @return 结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:manager:grounding:down')")
|
||||
@PostMapping("/grounding/manager/down/{id}")
|
||||
public AjaxResult managerDownStoreGrounding(@PathVariable("id") Long id) {
|
||||
zdyStoreBaseInfoService.managerDownStoreGrounding(id);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改店铺标志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('store:info:edit:flags')")
|
||||
@Log(title = "核心模块-店铺基本信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/flags")
|
||||
public AjaxResult editFlags(@RequestBody ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
zdyStoreBaseInfoService.editFlags(zdyStoreBaseInfo);
|
||||
return success();
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.zhwl.business.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.zhwl.common.annotation.Excel;
|
||||
import com.zhwl.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* huifustore对象 huifu_sotre
|
||||
*
|
||||
* @author mocehng
|
||||
* @date 2025-07-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class HuifuSotre extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 店铺id */
|
||||
@Excel(name = "店铺id")
|
||||
private Long storeId;
|
||||
|
||||
/** 汇付id */
|
||||
@Excel(name = "汇付id")
|
||||
private Long huifuId;
|
||||
|
||||
/** 收款比例 */
|
||||
@Excel(name = "收款比例")
|
||||
private Long percentage;
|
||||
|
||||
}
|
@@ -0,0 +1,222 @@
|
||||
package com.zhwl.store.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhwl.common.annotation.CompareField;
|
||||
import com.zhwl.common.annotation.Dict;
|
||||
import com.zhwl.common.annotation.Excel;
|
||||
import com.zhwl.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 核心模块-店铺基本信息对象 zdy_store_base_info
|
||||
*
|
||||
* @author song_xiaowei
|
||||
* @date 2024-12-25
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ZdyStoreBaseInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@Excel(name = "店铺名称")
|
||||
@NotBlank(message = "店铺名称不能为空")
|
||||
@CompareField
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Excel(name = "联系电话")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 营业开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "营业开始时间", dateFormat = "HH:mm")
|
||||
private LocalTime businessStartHours;
|
||||
|
||||
/**
|
||||
* 营业结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "营业结束时间", width = 30, dateFormat = "HH:mm")
|
||||
private LocalTime businessEndHours;
|
||||
|
||||
/**
|
||||
* 每周特定营业日期
|
||||
*/
|
||||
@Excel(name = "每周特定营业日期")
|
||||
private String businessDaysOnWeekly;
|
||||
|
||||
/**
|
||||
* 店铺地址
|
||||
*/
|
||||
@Excel(name = "店铺地址")
|
||||
@NotNull(message = "店铺地址不能为空")
|
||||
@CompareField
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Excel(name = "纬度")
|
||||
@NotNull(message = "店铺地址纬度不能为空")
|
||||
private BigDecimal latitude;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Excel(name = "经度")
|
||||
@NotNull(message = "店铺地址经度不能为空")
|
||||
private BigDecimal longitude;
|
||||
|
||||
/**
|
||||
* 门店图片
|
||||
*/
|
||||
@Excel(name = "门店图片")
|
||||
private String images;
|
||||
|
||||
/**
|
||||
* 轮播图片
|
||||
*/
|
||||
@Excel(name = "轮播图片")
|
||||
private String carouselImage;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@Excel(name = "联系人")
|
||||
private String contactName;
|
||||
|
||||
/**
|
||||
* 店铺注册类型(字典store_register_type)
|
||||
* 店铺管理员role key
|
||||
*/
|
||||
@Excel(name = "店铺注册类型", readConverterExp = "字典store_register_type")
|
||||
@Dict(dictType = "store_register_type")
|
||||
@NotBlank(message = "店铺类型不能为空")
|
||||
@CompareField
|
||||
private String registerType;
|
||||
|
||||
/**
|
||||
* 法人姓名
|
||||
*/
|
||||
@Excel(name = "法人姓名")
|
||||
@CompareField
|
||||
private String legalPersonName;
|
||||
|
||||
/**
|
||||
* 法人联系方式
|
||||
*/
|
||||
@Excel(name = "法人联系方式")
|
||||
@CompareField
|
||||
private String legalPersonPhone;
|
||||
|
||||
/**
|
||||
* 门头图片
|
||||
*/
|
||||
@Excel(name = "门头图片")
|
||||
@CompareField
|
||||
@NotBlank(message = "门头图片不能为空")
|
||||
private String facadeImages;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
@Excel(name = "营业执照")
|
||||
@CompareField
|
||||
@NotBlank(message = "营业执照不能为空")
|
||||
private String businessLicense;
|
||||
|
||||
/**
|
||||
* (法人身份证)身份证人像面
|
||||
*/
|
||||
@Excel(name = "(法人身份证)身份证人像面")
|
||||
@CompareField
|
||||
@NotBlank(message = "(法人身份证)身份证人像面不能为空")
|
||||
private String legalPersonIdCardFront;
|
||||
|
||||
/**
|
||||
* (法人身份证)身份证国徽面
|
||||
*/
|
||||
@Excel(name = "(法人身份证)身份证国徽面")
|
||||
@CompareField
|
||||
@NotBlank(message = "(法人身份证)身份证国徽面不能为空")
|
||||
private String legalPersonIdCardBack;
|
||||
|
||||
/**
|
||||
* 注册状态(字典store_register_audit_status)
|
||||
*/
|
||||
@Excel(name = "注册状态", readConverterExp = "字典store_register_audit_status")
|
||||
@Dict(dictType = "store_register_audit_status")
|
||||
private String registerAuditStatus;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime registerAuditTime;
|
||||
|
||||
/**
|
||||
* 审核驳回原因
|
||||
*/
|
||||
@Excel(name = "审核驳回原因")
|
||||
private String registerAuditRejectionDesc;
|
||||
|
||||
/**
|
||||
* 审核人id
|
||||
*/
|
||||
private Long registerAuditorId;
|
||||
|
||||
/**
|
||||
* 店铺上下架状态(字典grounding_status)
|
||||
*/
|
||||
@Excel(name = "店铺上下架状态", readConverterExp = "grounding_status")
|
||||
@Dict(dictType = "grounding_status")
|
||||
private String groundingStatus;
|
||||
|
||||
/**
|
||||
* 店铺上下架状态数组
|
||||
*/
|
||||
private String[] groundingStatusArray;
|
||||
|
||||
/**
|
||||
* 店铺标志
|
||||
*/
|
||||
@Excel(name = "店铺标志")
|
||||
private String flags;
|
||||
|
||||
/**
|
||||
* 最后更新注册信息时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "最后更新注册信息时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastUpdatedRegistrationTime;
|
||||
|
||||
/**
|
||||
* 管理员id
|
||||
*/
|
||||
private Long adminId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.zhwl.store.domain.dto;
|
||||
|
||||
import com.zhwl.common.annotation.Register;
|
||||
import com.zhwl.common.core.domain.BaseEntity;
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author song_xiaowei
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class BaseStoreInfoDTO extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 店铺基本信息
|
||||
*/
|
||||
@NotNull(message = "店铺基本信息不能为空")
|
||||
private ZdyStoreBaseInfo baseInfo;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long storeId;
|
||||
|
||||
/**
|
||||
* 手机号验证码
|
||||
*/
|
||||
private String verificationCode;
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.zhwl.store.domain.dto;
|
||||
|
||||
import com.zhwl.common.annotation.Register;
|
||||
import com.zhwl.common.xss.Xss;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 店铺注册对象
|
||||
*
|
||||
* @author song_xiaowei
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class RegisterZdyStoreBaseInfoDTO extends BaseStoreInfoDTO {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Xss(message = "用户账号不能包含脚本字符", groups = Register.class)
|
||||
@NotBlank(message = "用户账号不能为空", groups = Register.class)
|
||||
@Size(max = 30, message = "用户账号长度不能超过30个字符", groups = Register.class)
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
@NotBlank(message = "用户密码不能为空", groups = Register.class)
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "商户号不能为空", groups = Register.class)
|
||||
private Long huifuId;
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package com.zhwl.store.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 注册状态(字典store_register_audit_status)
|
||||
*
|
||||
* @author 宋晓伟
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum StoreRegisterAuditStatusEnum {
|
||||
|
||||
/**
|
||||
* 待完善
|
||||
*/
|
||||
NEEDS_COMPLETION,
|
||||
/**
|
||||
* 待审核
|
||||
*/
|
||||
PENDING,
|
||||
/**
|
||||
* 已通过
|
||||
*/
|
||||
APPROVED,
|
||||
/**
|
||||
* 已驳回
|
||||
*/
|
||||
REJECTED
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package com.zhwl.store.factory;
|
||||
|
||||
import com.zhwl.common.exception.ServiceException;
|
||||
import com.zhwl.store.annotation.ZdyStore;
|
||||
import com.zhwl.store.domain.dto.BaseStoreInfoDTO;
|
||||
import com.zhwl.system.enums.OrgTypeEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.aop.framework.AopProxyUtils;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 店铺信息工厂
|
||||
*
|
||||
* @author song_xiaowei
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ZdyStoreFactory {
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
private final EnumMap<OrgTypeEnum, Class<? extends BaseStoreInfoDTO>> zdyStoreMap = new EnumMap<>(OrgTypeEnum.class);
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
Map<String, Object> beansWithAnnotation = applicationContext.getBeansWithAnnotation(ZdyStore.class);
|
||||
beansWithAnnotation.forEach((name, bean) -> {
|
||||
Class<?> clazz = AopProxyUtils.ultimateTargetClass(bean);
|
||||
ZdyStore zdyStore = clazz.getDeclaredAnnotation(ZdyStore.class);
|
||||
// Ensure the class is assignable to BaseStoreInfoDTO
|
||||
if (BaseStoreInfoDTO.class.isAssignableFrom(bean.getClass())) {
|
||||
Class<? extends BaseStoreInfoDTO> storeClass = clazz.asSubclass(BaseStoreInfoDTO.class);
|
||||
zdyStoreMap.put(zdyStore.orgType(), storeClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实现类bean
|
||||
*
|
||||
* @param moduleName 模块名称
|
||||
* @return 服务接口实现类
|
||||
*/
|
||||
public Class<? extends BaseStoreInfoDTO> getBean(OrgTypeEnum moduleName) {
|
||||
return Optional.ofNullable(zdyStoreMap.get(moduleName)).orElseThrow(() -> new ServiceException("未找到模块:" + moduleName));
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package com.zhwl.store.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhwl.business.domain.HuifuSotre;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* huifustoreMapper接口
|
||||
*
|
||||
* @author mocehng
|
||||
* @date 2025-07-01
|
||||
*/
|
||||
@Repository
|
||||
public interface HuifuSotreMapper {
|
||||
/**
|
||||
* 查询huifustore
|
||||
*
|
||||
* @param id huifustore主键
|
||||
* @return huifustore
|
||||
*/
|
||||
HuifuSotre selectHuifuSotreById(Long id);
|
||||
|
||||
/**
|
||||
* 查询huifustore列表
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return huifustore集合
|
||||
*/
|
||||
List<HuifuSotre> selectHuifuSotreList(HuifuSotre huifuSotre);
|
||||
|
||||
/**
|
||||
* 新增huifustore
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return 结果
|
||||
*/
|
||||
int insertHuifuSotre(HuifuSotre huifuSotre);
|
||||
|
||||
/**
|
||||
* 修改huifustore
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return 结果
|
||||
*/
|
||||
int updateHuifuSotre(HuifuSotre huifuSotre);
|
||||
|
||||
/**
|
||||
* 删除huifustore
|
||||
*
|
||||
* @param id huifustore主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteHuifuSotreById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除huifustore
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteHuifuSotreByIds(Long[] ids);
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package com.zhwl.store.mapper;
|
||||
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 核心模块-店铺基本信息Mapper接口
|
||||
*
|
||||
* @author song_xiaowei
|
||||
* @date 2024-12-25
|
||||
*/
|
||||
@Repository
|
||||
public interface ZdyStoreBaseInfoMapper {
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息
|
||||
*
|
||||
* @param id 核心模块-店铺基本信息主键
|
||||
* @return 核心模块-店铺基本信息
|
||||
*/
|
||||
ZdyStoreBaseInfo selectZdyStoreBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息列表
|
||||
*
|
||||
* @param zdyStoreBaseInfo 核心模块-店铺基本信息
|
||||
* @return 核心模块-店铺基本信息集合
|
||||
*/
|
||||
List<ZdyStoreBaseInfo> selectZdyStoreBaseInfoList(ZdyStoreBaseInfo zdyStoreBaseInfo);
|
||||
|
||||
/**
|
||||
* 新增核心模块-店铺基本信息
|
||||
*
|
||||
* @param zdyStoreBaseInfo 核心模块-店铺基本信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertZdyStoreBaseInfo(ZdyStoreBaseInfo zdyStoreBaseInfo);
|
||||
|
||||
/**
|
||||
* 修改核心模块-店铺基本信息
|
||||
*
|
||||
* @param zdyStoreBaseInfo 核心模块-店铺基本信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateZdyStoreBaseInfo(ZdyStoreBaseInfo zdyStoreBaseInfo);
|
||||
|
||||
/**
|
||||
* 删除核心模块-店铺基本信息
|
||||
*
|
||||
* @param id 核心模块-店铺基本信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteZdyStoreBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除核心模块-店铺基本信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteZdyStoreBaseInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 检查店铺名称是否唯一
|
||||
*
|
||||
* @param zdyStoreBaseInfo 店铺信息
|
||||
* @return 结果
|
||||
*/
|
||||
int checkNameUnique(ZdyStoreBaseInfo zdyStoreBaseInfo);
|
||||
|
||||
/**
|
||||
* 根据店铺id集合查询店铺信息
|
||||
*
|
||||
* @param ids id集合
|
||||
* @return 店铺信息集合
|
||||
*/
|
||||
List<ZdyStoreBaseInfo> selectZdyStoreBaseInfoByIds(Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据店铺管理员id和店铺类型查询店铺信息
|
||||
*
|
||||
* @param queryInfo 查询信息
|
||||
* @return 店铺信息
|
||||
*/
|
||||
ZdyStoreBaseInfo getByAdminIdAndRegisterType(ZdyStoreBaseInfo queryInfo);
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
package com.zhwl.store.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhwl.business.domain .HuifuSotre;
|
||||
|
||||
/**
|
||||
* huifustoreService接口
|
||||
*
|
||||
* @author mocehng
|
||||
* @date 2025-07-01
|
||||
*/
|
||||
public interface IHuifuSotreService {
|
||||
/**
|
||||
* 查询huifustore
|
||||
*
|
||||
* @param id huifustore主键
|
||||
* @return huifustore
|
||||
*/
|
||||
HuifuSotre selectHuifuSotreById(Long id);
|
||||
|
||||
/**
|
||||
* 查询huifustore列表
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return huifustore集合
|
||||
*/
|
||||
List<HuifuSotre> selectHuifuSotreList(HuifuSotre huifuSotre);
|
||||
|
||||
/**
|
||||
* 新增huifustore
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return 结果
|
||||
*/
|
||||
int insertHuifuSotre(HuifuSotre huifuSotre);
|
||||
|
||||
/**
|
||||
* 修改huifustore
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return 结果
|
||||
*/
|
||||
int updateHuifuSotre(HuifuSotre huifuSotre);
|
||||
|
||||
/**
|
||||
* 批量删除huifustore
|
||||
*
|
||||
* @param ids 需要删除的huifustore主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteHuifuSotreByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除huifustore信息
|
||||
*
|
||||
* @param id huifustore主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteHuifuSotreById(Long id);
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
package com.zhwl.store.service;
|
||||
|
||||
import com.zhwl.common.core.domain.entity.SysUser;
|
||||
import com.zhwl.common.core.domain.model.LoginUser;
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import com.zhwl.store.domain.dto.BaseStoreInfoDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 核心模块-店铺基本信息Service接口
|
||||
*
|
||||
* @author song_xiaowei
|
||||
* @date 2024-12-25
|
||||
*/
|
||||
public interface IZdyStoreBaseInfoService {
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息
|
||||
*
|
||||
* @param id 核心模块-店铺基本信息主键
|
||||
* @param user
|
||||
* @return 核心模块-店铺基本信息
|
||||
*/
|
||||
BaseStoreInfoDTO selectZdyStoreBaseInfoById(Long id, SysUser user);
|
||||
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息列表
|
||||
*
|
||||
* @param zdyStoreBaseInfo 核心模块-店铺基本信息
|
||||
* @return 核心模块-店铺基本信息集合
|
||||
*/
|
||||
List<ZdyStoreBaseInfo> selectZdyStoreBaseInfoList(ZdyStoreBaseInfo zdyStoreBaseInfo);
|
||||
|
||||
/**
|
||||
* 批量删除核心模块-店铺基本信息
|
||||
*
|
||||
* @param ids 需要删除的核心模块-店铺基本信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteZdyStoreBaseInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 修改核心模块-店铺基本信息
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @param param 店铺信息
|
||||
*/
|
||||
ZdyStoreBaseInfo updateZdyStoreBaseInfo(Long id, String param);
|
||||
|
||||
/**
|
||||
* 修改核心模块-店铺基本信息中需要审核的内容
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @param param 店铺信息
|
||||
*/
|
||||
ZdyStoreBaseInfo updateZdyStoreBaseInfoWithReview(Long id, String param);
|
||||
|
||||
/**
|
||||
* 注册店铺
|
||||
*
|
||||
* @param param 店铺信息
|
||||
*/
|
||||
ZdyStoreBaseInfo register(String param);
|
||||
|
||||
/**
|
||||
* 审核注册店铺
|
||||
*
|
||||
* @param zdyStoreBaseInfo 审核信息
|
||||
* @param userId 审核人id
|
||||
*/
|
||||
void registerAudit(ZdyStoreBaseInfo zdyStoreBaseInfo, Long userId);
|
||||
|
||||
/**
|
||||
* 新增核心模块-店铺基本信息
|
||||
* 由于后台管理员创建时,店铺信息为空,所以此方法仅供后台管理员创建店铺使用。并且管理员角色信息已在后台创建时选择,所以此处店铺类型不可修改
|
||||
*
|
||||
* @param param 核心模块-店铺基本信息
|
||||
* @param loginUser 管理员id
|
||||
*/
|
||||
ZdyStoreBaseInfo insertZdyStoreBaseInfo(String param, LoginUser loginUser);
|
||||
|
||||
/**
|
||||
* 上架店铺
|
||||
*
|
||||
* @param id 店铺id
|
||||
*/
|
||||
void storeGroundingUp(Long id);
|
||||
|
||||
/**
|
||||
* 下架店铺
|
||||
*
|
||||
* @param id 店铺id
|
||||
*/
|
||||
void storeGroundingDown(Long id);
|
||||
|
||||
/**
|
||||
* 修改店铺标志
|
||||
*
|
||||
* @param zdyStoreBaseInfo 店铺信息
|
||||
*/
|
||||
void editFlags(ZdyStoreBaseInfo zdyStoreBaseInfo);
|
||||
|
||||
void managerUpStoreGrounding(Long id);
|
||||
|
||||
void managerDownStoreGrounding(Long id);
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.zhwl.store.service;
|
||||
|
||||
import com.zhwl.store.domain.dto.BaseStoreInfoDTO;
|
||||
|
||||
/**
|
||||
* 核心模块-店铺基本信息Service接口
|
||||
*
|
||||
* @author song_xiaowei
|
||||
* @date 2024-12-25
|
||||
*/
|
||||
public interface IZdyStoreInfoService {
|
||||
|
||||
/**
|
||||
* 判断需要审核的信息是否修改
|
||||
*
|
||||
* @param baseStoreInfo 店铺信息
|
||||
* @return 是否修改
|
||||
*/
|
||||
default boolean hasAuditInfoChanged(BaseStoreInfoDTO baseStoreInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺信息
|
||||
*
|
||||
* @param baseStoreInfo 店铺信息
|
||||
*/
|
||||
void updateStoreInfoByStoreId(BaseStoreInfoDTO baseStoreInfo);
|
||||
|
||||
/**
|
||||
* 注册店铺
|
||||
*
|
||||
* @param baseStoreInfo 店铺信息
|
||||
*/
|
||||
void register(BaseStoreInfoDTO baseStoreInfo);
|
||||
|
||||
/**
|
||||
* 根据店铺id查询店铺信息
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @return 店铺信息
|
||||
*/
|
||||
BaseStoreInfoDTO getByStoreId(Long storeId);
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package com.zhwl.store.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhwl.store.mapper.HuifuSotreMapper;
|
||||
import com.zhwl.store.service.IHuifuSotreService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.zhwl.business.domain.HuifuSotre;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* huifustoreService业务层处理
|
||||
*
|
||||
* @author mocehng
|
||||
* @date 2025-07-01
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class HuifuSotreServiceImpl implements IHuifuSotreService {
|
||||
|
||||
private final HuifuSotreMapper huifuSotreMapper;
|
||||
|
||||
/**
|
||||
* 查询huifustore
|
||||
*
|
||||
* @param id huifustore主键
|
||||
* @return huifustore
|
||||
*/
|
||||
@Override
|
||||
public HuifuSotre selectHuifuSotreById(Long id) {
|
||||
return huifuSotreMapper.selectHuifuSotreById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询huifustore列表
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return huifustore
|
||||
*/
|
||||
@Override
|
||||
public List<HuifuSotre> selectHuifuSotreList(HuifuSotre huifuSotre) {
|
||||
return huifuSotreMapper.selectHuifuSotreList(huifuSotre);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增huifustore
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertHuifuSotre(HuifuSotre huifuSotre) {
|
||||
return huifuSotreMapper.insertHuifuSotre(huifuSotre);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改huifustore
|
||||
*
|
||||
* @param huifuSotre huifustore
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateHuifuSotre(HuifuSotre huifuSotre) {
|
||||
return huifuSotreMapper.updateHuifuSotre(huifuSotre);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除huifustore
|
||||
*
|
||||
* @param ids 需要删除的huifustore主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteHuifuSotreByIds(Long[] ids) {
|
||||
return huifuSotreMapper.deleteHuifuSotreByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除huifustore信息
|
||||
*
|
||||
* @param id huifustore主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteHuifuSotreById(Long id) {
|
||||
return huifuSotreMapper.deleteHuifuSotreById(id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package com.zhwl.store.service.impl;
|
||||
|
||||
import com.zhwl.common.core.domain.entity.SysUser;
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import com.zhwl.store.enums.StoreRegisterAuditStatusEnum;
|
||||
import com.zhwl.store.mapper.ZdyStoreBaseInfoMapper;
|
||||
import com.zhwl.system.service.ParentSysStoreInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.zhwl.common.constant.Constants.NO;
|
||||
|
||||
/**
|
||||
* 获取店铺信息接口实现类
|
||||
*
|
||||
* @author song_xiaowei
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StoreInfoServiceImpl implements ParentSysStoreInfoService {
|
||||
|
||||
private final ZdyStoreBaseInfoMapper zdyStoreBaseInfoMapper;
|
||||
|
||||
@Override
|
||||
public void initStoreInfo(SysUser user, String roleKey) {
|
||||
ZdyStoreBaseInfo queryInfo = new ZdyStoreBaseInfo();
|
||||
queryInfo.setAdminId(user.getUserId());
|
||||
queryInfo.setRegisterType(roleKey);
|
||||
queryInfo.setDelFlag(NO);
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = zdyStoreBaseInfoMapper.getByAdminIdAndRegisterType(queryInfo);
|
||||
if (Objects.isNull(zdyStoreBaseInfo)) {
|
||||
user.setStoreRegisterAuditStatus(StoreRegisterAuditStatusEnum.NEEDS_COMPLETION.name());
|
||||
} else {
|
||||
user.setStoreRegisterAuditStatus(zdyStoreBaseInfo.getRegisterAuditStatus());
|
||||
user.setStoreId(zdyStoreBaseInfo.getId());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,755 @@
|
||||
package com.zhwl.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.zhwl.business.domain.HuifuSotre;
|
||||
import com.zhwl.common.annotation.Register;
|
||||
import com.zhwl.common.constant.UserConstants;
|
||||
import com.zhwl.common.core.domain.entity.SysDept;
|
||||
import com.zhwl.common.core.domain.entity.SysRole;
|
||||
import com.zhwl.common.core.domain.entity.SysUser;
|
||||
import com.zhwl.common.core.domain.model.LoginUser;
|
||||
import com.zhwl.common.enums.GroundingEnum;
|
||||
import com.zhwl.common.enums.VerificationCodeTypeEnum;
|
||||
import com.zhwl.common.exception.ServiceException;
|
||||
import com.zhwl.common.factory.ZdyModuleFactory;
|
||||
import com.zhwl.common.service.ICommonService;
|
||||
import com.zhwl.common.utils.ObjectCompareFieldUtils;
|
||||
import com.zhwl.common.utils.bean.BeanValidators;
|
||||
import com.zhwl.framework.web.service.TokenService;
|
||||
import com.zhwl.message.domain.dto.MessageSendDTO;
|
||||
import com.zhwl.message.enums.MessageCategoryEnum;
|
||||
import com.zhwl.message.service.IMessageSendService;
|
||||
import com.zhwl.store.ZdyStoreBaseInfoManager;
|
||||
import com.zhwl.store.domain.ZdyStoreBaseInfo;
|
||||
import com.zhwl.store.domain.dto.BaseStoreInfoDTO;
|
||||
import com.zhwl.store.domain.dto.RegisterZdyStoreBaseInfoDTO;
|
||||
import com.zhwl.store.enums.StoreRegisterAuditStatusEnum;
|
||||
import com.zhwl.store.factory.ZdyStoreFactory;
|
||||
import com.zhwl.store.mapper.ZdyStoreBaseInfoMapper;
|
||||
import com.zhwl.store.service.IHuifuSotreService;
|
||||
import com.zhwl.store.service.IZdyStoreBaseInfoService;
|
||||
import com.zhwl.store.service.IZdyStoreInfoService;
|
||||
import com.zhwl.system.domain.SysUserRole;
|
||||
import com.zhwl.system.enums.OrgTypeEnum;
|
||||
import com.zhwl.system.enums.RegistrationSourceEnum;
|
||||
import com.zhwl.system.enums.SysConfigKeyEnum;
|
||||
import com.zhwl.system.enums.SysManagerRoleEnum;
|
||||
import com.zhwl.system.manager.SysDeptManager;
|
||||
import com.zhwl.system.mapper.SysDeptMapper;
|
||||
import com.zhwl.system.mapper.SysRoleMapper;
|
||||
import com.zhwl.system.mapper.SysUserMapper;
|
||||
import com.zhwl.system.mapper.SysUserRoleMapper;
|
||||
import com.zhwl.system.service.ISysConfigService;
|
||||
import com.zhwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import javax.validation.Validator;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static com.zhwl.common.constant.UserConstants.DEPT_NORMAL;
|
||||
import static com.zhwl.common.constant.UserConstants.DEPT_ORDER_DEFAULT;
|
||||
import static com.zhwl.common.utils.DictUtils.SEPARATOR;
|
||||
|
||||
/**
|
||||
* 核心模块-店铺基本信息Service业务层处理
|
||||
*
|
||||
* @author song_xiaowei
|
||||
* @date 2024-12-25
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ZdyStoreBaseInfoServiceImpl implements IZdyStoreBaseInfoService {
|
||||
|
||||
private final ZdyStoreBaseInfoMapper zdyStoreBaseInfoMapper;
|
||||
|
||||
private final ZdyStoreFactory zdyStoreFactory;
|
||||
|
||||
private final ZdyModuleFactory zdyModuleFactory;
|
||||
|
||||
private final ISysConfigService sysConfigService;
|
||||
|
||||
private final ICommonService commonService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
private final Validator validator;
|
||||
|
||||
private final IMessageSendService messageSendService;
|
||||
|
||||
private final SysDeptManager sysDeptManager;
|
||||
|
||||
private final SysDeptMapper sysDeptMapper;
|
||||
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
private final SysRoleMapper sysRoleMapper;
|
||||
|
||||
private final SysUserRoleMapper sysUserRoleMapper;
|
||||
|
||||
private final ZdyStoreBaseInfoManager storeBaseInfoManager;
|
||||
|
||||
private final TokenService tokenService;
|
||||
private final IHuifuSotreService huifuSotreService;
|
||||
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息
|
||||
*
|
||||
* @param id 核心模块-店铺基本信息主键
|
||||
* @param user 当前用户
|
||||
* @return 核心模块-店铺基本信息
|
||||
*/
|
||||
@Override
|
||||
public BaseStoreInfoDTO selectZdyStoreBaseInfoById(Long id, SysUser user) {
|
||||
if (Objects.isNull(id)) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = new ZdyStoreBaseInfo();
|
||||
Optional.ofNullable(user.getRoles())
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(SysRole::getRoleKey)
|
||||
.map(SysManagerRoleEnum::getByRoleKey)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(sysManagerRoleEnum -> Optional
|
||||
.ofNullable(sysManagerRoleEnum.getOrgType())
|
||||
.map(OrgTypeEnum::isStore)
|
||||
.orElse(false))
|
||||
.findFirst()
|
||||
.ifPresent(sysManagerRoleEnum -> zdyStoreBaseInfo
|
||||
.setRegisterType(sysManagerRoleEnum.getRoleKey()));
|
||||
zdyStoreBaseInfo.setRegisterAuditStatus(StoreRegisterAuditStatusEnum.NEEDS_COMPLETION.name());
|
||||
BaseStoreInfoDTO baseStoreInfoDTO = new BaseStoreInfoDTO();
|
||||
baseStoreInfoDTO.setBaseInfo(zdyStoreBaseInfo);
|
||||
return baseStoreInfoDTO;
|
||||
}
|
||||
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = Optional.ofNullable(zdyStoreBaseInfoMapper.selectZdyStoreBaseInfoById(id))
|
||||
.orElseThrow(() -> new ServiceException("店铺信息不存在"));
|
||||
BaseStoreInfoDTO baseStoreInfoDTO = null;
|
||||
// 查询子服务下对应的差异字段
|
||||
SysManagerRoleEnum roleEnum = SysManagerRoleEnum.getByRoleKey(zdyStoreBaseInfo.getRegisterType());
|
||||
IZdyStoreInfoService subService = getSubService(roleEnum);
|
||||
if (Objects.nonNull(subService)) {
|
||||
baseStoreInfoDTO = subService.getByStoreId(id);
|
||||
}
|
||||
if (Objects.isNull(baseStoreInfoDTO)) {
|
||||
baseStoreInfoDTO = new BaseStoreInfoDTO();
|
||||
}
|
||||
baseStoreInfoDTO.setBaseInfo(zdyStoreBaseInfo);
|
||||
return baseStoreInfoDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询核心模块-店铺基本信息列表
|
||||
*
|
||||
* @param zdyStoreBaseInfo 核心模块-店铺基本信息
|
||||
* @return 核心模块-店铺基本信息
|
||||
*/
|
||||
@Override
|
||||
public List<ZdyStoreBaseInfo> selectZdyStoreBaseInfoList(ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
String groundingStatus = zdyStoreBaseInfo.getGroundingStatus();
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(groundingStatus) && groundingStatus.contains(SEPARATOR)) {
|
||||
zdyStoreBaseInfo.setGroundingStatusArray(groundingStatus.split(SEPARATOR));
|
||||
}
|
||||
return zdyStoreBaseInfoMapper.selectZdyStoreBaseInfoList(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除核心模块-店铺基本信息
|
||||
*
|
||||
* @param ids 需要删除的核心模块-店铺基本信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteZdyStoreBaseInfoByIds(Long[] ids) {
|
||||
return storeBaseInfoManager.deleteZdyStoreBaseInfoByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ZdyStoreBaseInfo updateZdyStoreBaseInfo(Long id, String param) {
|
||||
return updateZdyStoreBaseInfo(id, param, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ZdyStoreBaseInfo updateZdyStoreBaseInfoWithReview(Long id, String param) {
|
||||
return updateZdyStoreBaseInfo(id, param, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ZdyStoreBaseInfo register(String param) {
|
||||
log.info("注册店铺入参:{}", param);
|
||||
// 校验系统是否允许注册
|
||||
validateRegisterEnabled();
|
||||
// 解析并校验注册请求参数
|
||||
RegisterZdyStoreBaseInfoDTO registerBody = parseAndValidateRegisterBody(param);
|
||||
// 提取角色,动态分发模块逻辑
|
||||
SysManagerRoleEnum roleEnum = extractRole(registerBody);
|
||||
BaseStoreInfoDTO baseStoreInfoDTO = parseAndValidateModuleSpecificInfo(param, roleEnum);
|
||||
ZdyStoreBaseInfo baseInfo = baseStoreInfoDTO.getBaseInfo();
|
||||
// 校验店铺名称唯一性和验证码
|
||||
checkNameUnique(baseInfo);
|
||||
// 校验手机验证码
|
||||
checkVerificationCode(baseInfo.getLegalPersonPhone(), baseStoreInfoDTO.getVerificationCode());
|
||||
// 注册店铺部门
|
||||
SysDept sysDept = registerDept(baseInfo, Objects.requireNonNull(roleEnum.getOrgType()));
|
||||
// 注册店铺管理员
|
||||
SysUser sysUser = registerUser(registerBody, sysDept);
|
||||
// 设置初始化数据
|
||||
initStoreInfo(baseInfo);
|
||||
// 保存注册店铺信息
|
||||
saveStoreInfo(baseInfo, sysUser);
|
||||
// 子服务特定的注册逻辑
|
||||
IZdyStoreInfoService subService = getSubService(roleEnum);
|
||||
|
||||
if (Objects.nonNull(subService)) {
|
||||
baseStoreInfoDTO.setStoreId(baseInfo.getId());
|
||||
subService.register(baseStoreInfoDTO);
|
||||
}
|
||||
return baseInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void registerAudit(ZdyStoreBaseInfo zdyStoreBaseInfo, Long userId) {
|
||||
zdyStoreBaseInfo.setRegisterAuditorId(userId);
|
||||
zdyStoreBaseInfo.setRegisterAuditTime(LocalDateTime.now());
|
||||
//若审核通过发送短信
|
||||
if (Objects.equals(zdyStoreBaseInfo.getRegisterAuditStatus(), StoreRegisterAuditStatusEnum.APPROVED.name())) {
|
||||
//自动上架
|
||||
zdyStoreBaseInfo.setGroundingStatus(GroundingEnum.UP.getCode());
|
||||
zdyStoreBaseInfoMapper.updateZdyStoreBaseInfo(zdyStoreBaseInfo);
|
||||
ZdyStoreBaseInfo old = zdyStoreBaseInfoMapper.selectZdyStoreBaseInfoById(zdyStoreBaseInfo.getId());
|
||||
handleApprovedRegistration(old);
|
||||
} else {
|
||||
zdyStoreBaseInfoMapper.updateZdyStoreBaseInfo(zdyStoreBaseInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理审核通过注册逻辑
|
||||
*
|
||||
* @param zdyStoreBaseInfo 审核通过信息
|
||||
*/
|
||||
private void handleApprovedRegistration(ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
Long userId = zdyStoreBaseInfo.getAdminId();
|
||||
String roleKey = zdyStoreBaseInfo.getRegisterType();
|
||||
int hasRole = sysRoleMapper.hasRoleByRoleKey(zdyStoreBaseInfo.getAdminId(), roleKey);
|
||||
if (hasRole == 0) {
|
||||
// 未关联角色插入绑定用户和角色
|
||||
insertUserRole(userId, roleKey);
|
||||
}
|
||||
//发送短信
|
||||
sendRegistrationSuccessSms(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入用户和角色关联关系
|
||||
*
|
||||
* @param userId 店铺管理员用户id
|
||||
* @param roleKey 角色key
|
||||
*/
|
||||
private void insertUserRole(Long userId, String roleKey) {
|
||||
SysRole sysRole = Optional.ofNullable(sysRoleMapper.getByRoleKey(roleKey))
|
||||
.orElseThrow(() -> new ServiceException("未找到角色信息"));
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setRoleId(sysRole.getRoleId());
|
||||
sysUserRole.setUserId(userId);
|
||||
sysUserRoleMapper.batchUserRole(Collections.singletonList(sysUserRole));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ZdyStoreBaseInfo insertZdyStoreBaseInfo(String param, LoginUser loginUser) {
|
||||
log.info("注册店铺新增入参:{}", param);
|
||||
// 解析注册请求参数
|
||||
RegisterZdyStoreBaseInfoDTO registerBody = parseRegisterBody(param);
|
||||
// 提取角色,动态分发模块逻辑
|
||||
SysManagerRoleEnum roleEnum = extractRole(registerBody);
|
||||
BaseStoreInfoDTO baseStoreInfoDTO = parseAndValidateModuleSpecificInfo(param, roleEnum);
|
||||
ZdyStoreBaseInfo baseInfo = baseStoreInfoDTO.getBaseInfo();
|
||||
// 校验店铺名称唯一性和验证码
|
||||
checkNameUnique(baseInfo);
|
||||
// 校验手机验证码
|
||||
checkVerificationCode(baseInfo.getLegalPersonPhone(), baseStoreInfoDTO.getVerificationCode());
|
||||
// 注册店铺部门
|
||||
SysDept sysDept = registerDept(baseInfo, Objects.requireNonNull(roleEnum.getOrgType()));
|
||||
// 更新管理员的部门id
|
||||
SysUser sysUser = updateRegisterUserDept(loginUser, sysDept);
|
||||
// 设置初始化数据
|
||||
initStoreInfo(baseInfo);
|
||||
// 保存注册店铺信息
|
||||
saveStoreInfo(baseInfo, sysUser);
|
||||
|
||||
// 子服务特定的注册逻辑
|
||||
IZdyStoreInfoService subService = getSubService(roleEnum);
|
||||
if (Objects.nonNull(subService)) {
|
||||
baseStoreInfoDTO.setStoreId(baseInfo.getId());
|
||||
subService.register(baseStoreInfoDTO);
|
||||
}
|
||||
// 保存汇付id
|
||||
JSONObject parse = JSONObject.parse(param).getJSONObject("baseInfo");
|
||||
|
||||
HuifuSotre huifuSotre = new HuifuSotre();
|
||||
huifuSotre.setHuifuId(parse.getLong("huifuId"));
|
||||
huifuSotre.setStoreId(baseInfo.getId());
|
||||
huifuSotre.setPercentage(100L);
|
||||
huifuSotreService.insertHuifuSotre(huifuSotre);
|
||||
return baseInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeGroundingUp(Long id) {
|
||||
validateStoreCanBeGrounded(id);
|
||||
updateGroundingStatus(id, GroundingEnum.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeGroundingDown(Long id) {
|
||||
validateStoreCanBeGrounded(id);
|
||||
updateGroundingStatus(id, GroundingEnum.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editFlags(ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
ZdyStoreBaseInfo updateInfo = new ZdyStoreBaseInfo();
|
||||
updateInfo.setId(zdyStoreBaseInfo.getId());
|
||||
updateInfo.setFlags(zdyStoreBaseInfo.getFlags());
|
||||
zdyStoreBaseInfoMapper.updateZdyStoreBaseInfo(updateInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void managerUpStoreGrounding(Long id) {
|
||||
updateGroundingStatus(id, GroundingEnum.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void managerDownStoreGrounding(Long id) {
|
||||
updateGroundingStatus(id, GroundingEnum.MANAGER_DOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新管理员的部门id
|
||||
*
|
||||
* @param loginUser 管理员id
|
||||
* @param sysDept 店铺部门
|
||||
* @return 管理员信息
|
||||
*/
|
||||
private SysUser updateRegisterUserDept(LoginUser loginUser, SysDept sysDept) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(loginUser.getUserId());
|
||||
sysUser.setDeptId(sysDept.getDeptId());
|
||||
sysUserMapper.updateUser(sysUser);
|
||||
// 刷新登录缓存中的信息
|
||||
loginUser.setDeptId(sysDept.getDeptId());
|
||||
SysUser loginSysUser = loginUser.getUser();
|
||||
SysUser newSysUser = sysUserMapper.selectUserByUserName(loginSysUser.getUserName());
|
||||
loginUser.setUser(newSysUser);
|
||||
tokenService.refreshToken(loginUser);
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param zdyStoreBaseInfo 店铺信息
|
||||
*/
|
||||
private void sendRegistrationSuccessSms(ZdyStoreBaseInfo zdyStoreBaseInfo) {
|
||||
String sendSmsEnable = sysConfigService.selectConfigByKey(SysConfigKeyEnum.SMS_SEND_REGISTER_SUCCESS);
|
||||
if (Boolean.parseBoolean(sendSmsEnable)) {
|
||||
// 注册事务同步器,在事务提交后执行
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
// 发送短信
|
||||
MessageSendDTO messageSendDTO = new MessageSendDTO();
|
||||
messageSendDTO.setPhone(zdyStoreBaseInfo.getLegalPersonPhone());
|
||||
messageSendDTO.setCategory(MessageCategoryEnum.REGISTER_USER_SUCCESS.getCode());
|
||||
LinkedHashMap<String, String> args = new LinkedHashMap<>();
|
||||
args.put("store_name", zdyStoreBaseInfo.getName());
|
||||
messageSendDTO.setArgs(args);
|
||||
messageSendService.sendMessage(messageSendDTO);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化店铺信息
|
||||
*
|
||||
* @param baseInfo 店铺信息
|
||||
*/
|
||||
private void initStoreInfo(ZdyStoreBaseInfo baseInfo) {
|
||||
initStoreAuditStatus(baseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化店铺审核状态
|
||||
*
|
||||
* @param baseInfo 店铺信息
|
||||
*/
|
||||
private void initStoreAuditStatus(ZdyStoreBaseInfo baseInfo) {
|
||||
// 检查审核是否开启
|
||||
if (isStoreRegisterAuditEnabled()) {
|
||||
// 审核中
|
||||
baseInfo.setRegisterAuditStatus(StoreRegisterAuditStatusEnum.PENDING.name());
|
||||
} else {
|
||||
// 调用自动通过和上架的方法
|
||||
autoApproveAndGroundStore(baseInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用自动通过和上架
|
||||
*
|
||||
* @param baseInfo 店铺信息
|
||||
*/
|
||||
private void autoApproveAndGroundStore(ZdyStoreBaseInfo baseInfo) {
|
||||
// 自动通过
|
||||
baseInfo.setRegisterAuditStatus(StoreRegisterAuditStatusEnum.APPROVED.name());
|
||||
// 自动上架
|
||||
baseInfo.setGroundingStatus(GroundingEnum.UP.getCode());
|
||||
// 设置审核时间
|
||||
baseInfo.setRegisterAuditTime(LocalDateTime.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查店铺注册审核是否开启
|
||||
*
|
||||
* @return true/false
|
||||
*/
|
||||
private boolean isStoreRegisterAuditEnabled() {
|
||||
String enableAudit = sysConfigService.selectConfigByKey(SysConfigKeyEnum.STORE_REGISTER_AUDIT_ENABLE);
|
||||
return Boolean.parseBoolean(enableAudit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码,若手机号没发生改变,不校验验证码
|
||||
*
|
||||
* @param legalPersonPhone 法人手机号
|
||||
* @param oldLegalPersonPhone 法人原手机号
|
||||
* @param verificationCode 手机验证码
|
||||
*/
|
||||
private void checkVerificationCode(String legalPersonPhone, String oldLegalPersonPhone, String verificationCode) {
|
||||
if (Objects.equals(legalPersonPhone, oldLegalPersonPhone)) {
|
||||
return;
|
||||
}
|
||||
checkVerificationCode(legalPersonPhone, verificationCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
* @param legalPersonPhone 法人手机号
|
||||
* @param verificationCode 手机验证码
|
||||
*/
|
||||
private void checkVerificationCode(String legalPersonPhone, String verificationCode) {
|
||||
commonService.checkVerificationCode(VerificationCodeTypeEnum.REGISTER.getCode(), legalPersonPhone,
|
||||
verificationCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取角色枚举
|
||||
*
|
||||
* @param registerBody 注册请求参数
|
||||
* @return 角色枚举
|
||||
*/
|
||||
protected SysManagerRoleEnum extractRole(BaseStoreInfoDTO registerBody) {
|
||||
ZdyStoreBaseInfo baseInfo = registerBody.getBaseInfo();
|
||||
SysManagerRoleEnum roleEnum = SysManagerRoleEnum.getByRoleKey(baseInfo.getRegisterType());
|
||||
return Optional.ofNullable(roleEnum).orElseThrow(() -> new ServiceException("注册类型错误!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验注册是否开启
|
||||
*/
|
||||
private void validateRegisterEnabled() {
|
||||
String enableRegisterUser = sysConfigService.selectConfigByKey(SysConfigKeyEnum.SYS_ACCOUNT_REGISTER_USER);
|
||||
if (!Boolean.parseBoolean(enableRegisterUser)) {
|
||||
throw new ServiceException("当前系统没有开启注册功能!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析并校验注册请求参数
|
||||
*
|
||||
* @param param 注册请求参数字符串
|
||||
* @return 注册请求参数
|
||||
*/
|
||||
private RegisterZdyStoreBaseInfoDTO parseAndValidateRegisterBody(String param) {
|
||||
RegisterZdyStoreBaseInfoDTO registerBody = parseRegisterBody(param);
|
||||
validateRegisterBody(registerBody);
|
||||
return registerBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析注册请求参数
|
||||
*
|
||||
* @param param 注册请求参数字符串
|
||||
* @return 注册请求参数
|
||||
*/
|
||||
private RegisterZdyStoreBaseInfoDTO parseRegisterBody(String param) {
|
||||
return JSONObject.parseObject(param, RegisterZdyStoreBaseInfoDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验注册请求参数
|
||||
*
|
||||
* @param registerBody 注册请求参数
|
||||
*/
|
||||
private void validateRegisterBody(RegisterZdyStoreBaseInfoDTO registerBody) {
|
||||
BeanValidators.validateWithException(validator, registerBody, Register.class);
|
||||
checkStoreBaseInfoNotNull(registerBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验店铺信息是否为空
|
||||
*
|
||||
* @param baseStoreInfo 店铺基础信息
|
||||
*/
|
||||
private void checkStoreBaseInfoNotNull(BaseStoreInfoDTO baseStoreInfo) {
|
||||
if (Objects.isNull(baseStoreInfo.getBaseInfo())) {
|
||||
throw new ServiceException("店铺信息不能为空!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子服务
|
||||
*
|
||||
* @param roleEnum 角色枚举
|
||||
* @return 子服务
|
||||
*/
|
||||
private IZdyStoreInfoService getSubService(SysManagerRoleEnum roleEnum) {
|
||||
return zdyModuleFactory.getBean(roleEnum.getModuleName(), IZdyStoreInfoService.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析并校验注册请求参数中的店铺所有信息
|
||||
*
|
||||
* @param param 注册请求参数字符串
|
||||
* @param roleEnum 角色枚举
|
||||
* @return 店铺所有信息
|
||||
*/
|
||||
private BaseStoreInfoDTO parseAndValidateModuleSpecificInfo(String param, SysManagerRoleEnum roleEnum) {
|
||||
Class<? extends BaseStoreInfoDTO> clazz = zdyStoreFactory.getBean(roleEnum.getOrgType());
|
||||
BaseStoreInfoDTO baseStoreInfoDTO = JSONObject.parseObject(param, clazz);
|
||||
BeanValidators.validateWithException(validator, baseStoreInfoDTO);
|
||||
return baseStoreInfoDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册店铺部门
|
||||
*
|
||||
* @param baseInfo 店铺信息
|
||||
* @param orgType 组织类型
|
||||
* @return 店铺部门
|
||||
*/
|
||||
private SysDept registerDept(ZdyStoreBaseInfo baseInfo, OrgTypeEnum orgType) {
|
||||
Long operatingCompanyDeptId = sysDeptManager.getFirstOperatingCompany();
|
||||
SysDept sysDept = new SysDept();
|
||||
sysDept.setDeptName(baseInfo.getName());
|
||||
sysDept.setOrgType(orgType.getValue());
|
||||
sysDept.setOrderNum(DEPT_ORDER_DEFAULT);
|
||||
sysDept.setParentId(operatingCompanyDeptId);
|
||||
sysDept.setStatus(DEPT_NORMAL);
|
||||
sysDeptManager.insertDept(sysDept);
|
||||
return sysDept;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册店铺管理员
|
||||
*
|
||||
* @param registerBody 注册请求参数
|
||||
* @param sysDept 店铺部门
|
||||
* @return 店铺管理员
|
||||
*/
|
||||
private SysUser registerUser(RegisterZdyStoreBaseInfoDTO registerBody, SysDept sysDept) {
|
||||
ZdyStoreBaseInfo baseInfo = registerBody.getBaseInfo();
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(registerBody.getUserName());
|
||||
if (!sysUserService.checkUserNameUnique(sysUser)) {
|
||||
throw new ServiceException("账号名称已存在");
|
||||
}
|
||||
sysUser.setNickName(baseInfo.getName());
|
||||
sysUser.setPassword(registerBody.getPassword());
|
||||
sysUser.setStatus(UserConstants.NORMAL);
|
||||
sysUser.setRegistrationSource(RegistrationSourceEnum.SELF.name());
|
||||
sysUser.setDeptId(sysDept.getDeptId());
|
||||
sysUserService.insertUser(sysUser);
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存店铺信息
|
||||
*
|
||||
* @param baseInfo 店铺基本信息
|
||||
* @param sysUser 店铺管理员
|
||||
*/
|
||||
private void saveStoreInfo(ZdyStoreBaseInfo baseInfo, SysUser sysUser) {
|
||||
baseInfo.setCreateBy(sysUser.getUserId().toString());
|
||||
baseInfo.setAdminId(sysUser.getUserId());
|
||||
baseInfo.setDeptId(sysUser.getDeptId());
|
||||
baseInfo.setLastUpdatedRegistrationTime(LocalDateTime.now());
|
||||
zdyStoreBaseInfoMapper.insertZdyStoreBaseInfo(baseInfo);
|
||||
// 如果审核已通过
|
||||
if (Objects.equals(baseInfo.getRegisterAuditStatus(), StoreRegisterAuditStatusEnum.APPROVED.name())) {
|
||||
handleApprovedRegistration(baseInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺信息
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @param param 更新参数
|
||||
* @param withReview 是否需要审核
|
||||
*/
|
||||
private ZdyStoreBaseInfo updateZdyStoreBaseInfo(Long id, String param, boolean withReview) {
|
||||
ZdyStoreBaseInfo oldStoreBaseInfo = Optional.ofNullable(zdyStoreBaseInfoMapper.selectZdyStoreBaseInfoById(id))
|
||||
.orElseThrow(() -> new ServiceException("未查询到店铺信息"));
|
||||
SysManagerRoleEnum sysManagerRoleEnum = SysManagerRoleEnum.getByRoleKey(oldStoreBaseInfo.getRegisterType());
|
||||
IZdyStoreInfoService subService = zdyModuleFactory.getBean(sysManagerRoleEnum.getModuleName(),
|
||||
IZdyStoreInfoService.class);
|
||||
BaseStoreInfoDTO baseStoreInfoDTO = parseBaseStoreInfoDTO(param, sysManagerRoleEnum.getOrgType());
|
||||
ZdyStoreBaseInfo baseStoreInfo = baseStoreInfoDTO.getBaseInfo();
|
||||
baseStoreInfo.setId(id);
|
||||
// 是否需要审核
|
||||
if (withReview) {
|
||||
if (Objects.equals(oldStoreBaseInfo.getRegisterAuditStatus(), StoreRegisterAuditStatusEnum.PENDING.name())) {
|
||||
throw new ServiceException("修改失败,店铺信息已在审核中,请等待审核结果");
|
||||
}
|
||||
// 审核是否开启,并且信息是否发生修改
|
||||
if (isStoreRegisterAuditEnabled()) {
|
||||
if (hasAuditInfoChanged(baseStoreInfoDTO, oldStoreBaseInfo, subService)) {
|
||||
// 校验手机验证码
|
||||
checkVerificationCode(baseStoreInfo.getLegalPersonPhone(), oldStoreBaseInfo.getLegalPersonPhone(),
|
||||
baseStoreInfoDTO.getVerificationCode());
|
||||
baseStoreInfo.setRegisterAuditStatus(StoreRegisterAuditStatusEnum.PENDING.name());
|
||||
} else {
|
||||
throw new ServiceException("修改失败,店铺信息未发生变化,请检查并重新提交");
|
||||
}
|
||||
} else {
|
||||
// 校验手机验证码
|
||||
checkVerificationCode(baseStoreInfo.getLegalPersonPhone(), oldStoreBaseInfo.getLegalPersonPhone(),
|
||||
baseStoreInfoDTO.getVerificationCode());
|
||||
// 调用自动通过和上架的方法
|
||||
autoApproveAndGroundStore(baseStoreInfo);
|
||||
// 处理审核通过注册逻辑
|
||||
baseStoreInfo.setAdminId(oldStoreBaseInfo.getAdminId());
|
||||
handleApprovedRegistration(baseStoreInfo);
|
||||
}
|
||||
}
|
||||
baseStoreInfo.setLastUpdatedRegistrationTime(LocalDateTime.now());
|
||||
zdyStoreBaseInfoMapper.updateZdyStoreBaseInfo(baseStoreInfo);
|
||||
|
||||
if (Objects.nonNull(subService)) {
|
||||
baseStoreInfoDTO.setStoreId(id);
|
||||
subService.updateStoreInfoByStoreId(baseStoreInfoDTO);
|
||||
}
|
||||
return baseStoreInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断店铺需要审核的信息是否发生改变
|
||||
*
|
||||
* @param baseStoreInfo 更新参数
|
||||
* @param oldStoreBaseInfo 旧数据
|
||||
* @param subService 子模块服务实现类
|
||||
* @return 是否需要审核
|
||||
*/
|
||||
private boolean hasAuditInfoChanged(BaseStoreInfoDTO baseStoreInfo, ZdyStoreBaseInfo oldStoreBaseInfo,
|
||||
IZdyStoreInfoService subService) {
|
||||
ZdyStoreBaseInfo newStoreBaseInfo = baseStoreInfo.getBaseInfo();
|
||||
// 检查店铺名称是否发生改变
|
||||
boolean isNameChanged = !Objects.equals(newStoreBaseInfo.getName(), oldStoreBaseInfo.getName());
|
||||
// 检查店铺名称是否改变
|
||||
if (isNameChanged) {
|
||||
checkNameUnique(newStoreBaseInfo);
|
||||
// 更新店铺部门
|
||||
updateStoreDept(oldStoreBaseInfo.getDeptId(), newStoreBaseInfo.getName());
|
||||
}
|
||||
// 比对店铺其他需要审核的信息是否发生改变
|
||||
boolean hasBaseInfoChanged = ObjectCompareFieldUtils.hasChanges(newStoreBaseInfo, oldStoreBaseInfo);
|
||||
// 如果基础信息发生改变且名称没有重复,则返回 true
|
||||
if (hasBaseInfoChanged) {
|
||||
return true;
|
||||
}
|
||||
// 比对店铺子模块信息是否发生改变
|
||||
return Objects.nonNull(subService) && subService.hasAuditInfoChanged(baseStoreInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺部门
|
||||
*
|
||||
* @param deptId 部门id
|
||||
* @param name 部门名称
|
||||
*/
|
||||
private void updateStoreDept(Long deptId, String name) {
|
||||
SysDept sysDept = new SysDept();
|
||||
sysDept.setDeptId(deptId);
|
||||
sysDept.setDeptName(name);
|
||||
sysDeptMapper.updateDept(sysDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查店铺名称是否唯一
|
||||
*
|
||||
* @param zdyStoreBaseInfo 店铺信息
|
||||
* @throws ServiceException 店铺名称已经存在
|
||||
*/
|
||||
private void checkNameUnique(ZdyStoreBaseInfo zdyStoreBaseInfo) throws ServiceException {
|
||||
int result = zdyStoreBaseInfoMapper.checkNameUnique(zdyStoreBaseInfo);
|
||||
if (result != 0) {
|
||||
throw new ServiceException("店铺名称已经存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析店铺基本信息
|
||||
*
|
||||
* @param param 参数
|
||||
* @param orgType 组织类型
|
||||
* @return 店铺基本信息
|
||||
*/
|
||||
private BaseStoreInfoDTO parseBaseStoreInfoDTO(String param, OrgTypeEnum orgType) {
|
||||
Class<? extends BaseStoreInfoDTO> clazz = zdyStoreFactory.getBean(orgType);
|
||||
BaseStoreInfoDTO baseStoreInfo = JSONObject.parseObject(param, clazz);
|
||||
checkStoreBaseInfoNotNull(baseStoreInfo);
|
||||
return baseStoreInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺上下架状态
|
||||
*
|
||||
* @param id 店铺id
|
||||
* @param groundingEnum 上下架状态
|
||||
*/
|
||||
private void updateGroundingStatus(Long id, GroundingEnum groundingEnum) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = new ZdyStoreBaseInfo();
|
||||
zdyStoreBaseInfo.setId(id);
|
||||
zdyStoreBaseInfo.setGroundingStatus(groundingEnum.getCode());
|
||||
zdyStoreBaseInfoMapper.updateZdyStoreBaseInfo(zdyStoreBaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验店铺是否可以被上架
|
||||
*
|
||||
* @param id 店铺ID
|
||||
* @throws ServiceException 如果店铺不存在或已被管理员下架
|
||||
*/
|
||||
private void validateStoreCanBeGrounded(Long id) {
|
||||
ZdyStoreBaseInfo zdyStoreBaseInfo = Optional.ofNullable(zdyStoreBaseInfoMapper.selectZdyStoreBaseInfoById(id))
|
||||
.orElseThrow(() -> new ServiceException("店铺不存在!"));
|
||||
if (Objects.equals(zdyStoreBaseInfo.getGroundingStatus(), GroundingEnum.MANAGER_DOWN.getCode())) {
|
||||
throw new ServiceException("操作失败,店铺已被管理员下架!");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhwl.store.mapper.HuifuSotreMapper">
|
||||
|
||||
<resultMap type="HuifuSotre" id="HuifuSotreResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="storeId" column="storeId"/>
|
||||
<result property="huifuId" column="huifuId"/>
|
||||
<result property="percentage" column="percentage"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHuifuSotreVo">
|
||||
select id, storeId, huifuId, percentage
|
||||
from huifu_sotre
|
||||
</sql>
|
||||
|
||||
<select id="selectHuifuSotreList" parameterType="HuifuSotre" resultMap="HuifuSotreResult">
|
||||
<include refid="selectHuifuSotreVo"/>
|
||||
<where>
|
||||
<if test="storeId != null ">
|
||||
and storeId = #{storeId}
|
||||
</if>
|
||||
<if test="huifuId != null ">
|
||||
and huifuId = #{huifuId}
|
||||
</if>
|
||||
<if test="percentage != null ">
|
||||
and percentage = #{percentage}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHuifuSotreById" parameterType="Long"
|
||||
resultMap="HuifuSotreResult">
|
||||
<include refid="selectHuifuSotreVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertHuifuSotre" parameterType="HuifuSotre" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into huifu_sotre
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">storeId,
|
||||
</if>
|
||||
<if test="huifuId != null">huifuId,
|
||||
</if>
|
||||
<if test="percentage != null">percentage,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},
|
||||
</if>
|
||||
<if test="huifuId != null">#{huifuId},
|
||||
</if>
|
||||
<if test="percentage != null">#{percentage},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateHuifuSotre" parameterType="HuifuSotre">
|
||||
update huifu_sotre
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="storeId != null">storeId =
|
||||
#{storeId},
|
||||
</if>
|
||||
<if test="huifuId != null">huifuId =
|
||||
#{huifuId},
|
||||
</if>
|
||||
<if test="percentage != null">percentage =
|
||||
#{percentage},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHuifuSotreById" parameterType="Long">
|
||||
delete from huifu_sotre where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHuifuSotreByIds" parameterType="String">
|
||||
delete from huifu_sotre where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@@ -0,0 +1,468 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhwl.store.mapper.ZdyStoreBaseInfoMapper">
|
||||
|
||||
<resultMap type="ZdyStoreBaseInfo" id="ZdyStoreBaseInfoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
<result property="businessStartHours" column="business_start_hours"/>
|
||||
<result property="businessEndHours" column="business_end_hours"/>
|
||||
<result property="businessDaysOnWeekly" column="business_days_on_weekly"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="latitude" column="latitude"/>
|
||||
<result property="longitude" column="longitude"/>
|
||||
<result property="images" column="images"/>
|
||||
<result property="carouselImage" column="carousel_image"/>
|
||||
<result property="contactName" column="contact_name"/>
|
||||
<result property="registerType" column="register_type"/>
|
||||
<result property="legalPersonName" column="legal_person_name"/>
|
||||
<result property="legalPersonPhone" column="legal_person_phone"/>
|
||||
<result property="facadeImages" column="facade_images"/>
|
||||
<result property="businessLicense" column="business_license"/>
|
||||
<result property="legalPersonIdCardFront" column="legal_person_id_card_front"/>
|
||||
<result property="legalPersonIdCardBack" column="legal_person_id_card_back"/>
|
||||
<result property="registerAuditStatus" column="register_audit_status"/>
|
||||
<result property="registerAuditTime" column="register_audit_time"/>
|
||||
<result property="registerAuditRejectionDesc" column="register_audit_rejection_desc"/>
|
||||
<result property="registerAuditorId" column="register_auditor_id"/>
|
||||
<result property="groundingStatus" column="grounding_status"/>
|
||||
<result property="flags" column="flags"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="lastUpdatedRegistrationTime" column="last_updated_registration_time"/>
|
||||
<result property="adminId" column="admin_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectZdyStoreBaseInfoVo">
|
||||
select id,
|
||||
name,
|
||||
contact_phone,
|
||||
business_start_hours,
|
||||
business_end_hours,
|
||||
business_days_on_weekly,
|
||||
address,
|
||||
latitude,
|
||||
longitude,
|
||||
images,
|
||||
carousel_image,
|
||||
contact_name,
|
||||
register_type,
|
||||
legal_person_name,
|
||||
legal_person_phone,
|
||||
facade_images,
|
||||
business_license,
|
||||
legal_person_id_card_front,
|
||||
legal_person_id_card_back,
|
||||
register_audit_status,
|
||||
register_audit_time,
|
||||
register_audit_rejection_desc,
|
||||
register_auditor_id,
|
||||
grounding_status,
|
||||
flags,
|
||||
dept_id,
|
||||
last_updated_registration_time,
|
||||
admin_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
del_flag
|
||||
from zdy_store_base_info
|
||||
</sql>
|
||||
|
||||
<select id="selectZdyStoreBaseInfoList" parameterType="ZdyStoreBaseInfo" resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="name != null and name != ''">
|
||||
and name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">
|
||||
and contact_phone = #{contactPhone}
|
||||
</if>
|
||||
<if test="businessStartHours != null ">
|
||||
and business_start_hours = #{businessStartHours}
|
||||
</if>
|
||||
<if test="businessEndHours != null ">
|
||||
and business_end_hours = #{businessEndHours}
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null and businessDaysOnWeekly != ''">
|
||||
and business_days_on_weekly = #{businessDaysOnWeekly}
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
and address = #{address}
|
||||
</if>
|
||||
<if test="latitude != null ">
|
||||
and latitude = #{latitude}
|
||||
</if>
|
||||
<if test="longitude != null ">
|
||||
and longitude = #{longitude}
|
||||
</if>
|
||||
<if test="images != null and images != ''">
|
||||
and images = #{images}
|
||||
</if>
|
||||
<if test="carouselImage != null and carouselImage != ''">
|
||||
and carousel_image = #{carouselImage}
|
||||
</if>
|
||||
<if test="contactName != null and contactName != ''">
|
||||
and contact_name = #{contactName}
|
||||
</if>
|
||||
<if test="registerType != null and registerType != ''">
|
||||
and register_type = #{registerType}
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">
|
||||
and legal_person_name like concat('%', #{legalPersonName}, '%')
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">
|
||||
and legal_person_phone = #{legalPersonPhone}
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">
|
||||
and facade_images = #{facadeImages}
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">
|
||||
and business_license = #{businessLicense}
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null and legalPersonIdCardFront != ''">
|
||||
and legal_person_id_card_front = #{legalPersonIdCardFront}
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null and legalPersonIdCardBack != ''">
|
||||
and legal_person_id_card_back = #{legalPersonIdCardBack}
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">
|
||||
and register_audit_status = #{registerAuditStatus}
|
||||
</if>
|
||||
<if test="registerAuditTime != null ">
|
||||
and register_audit_time = #{registerAuditTime}
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null and registerAuditRejectionDesc != ''">
|
||||
and register_audit_rejection_desc = #{registerAuditRejectionDesc}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="groundingStatusArray != null and groundingStatusArray.length != 0">
|
||||
and grounding_status in
|
||||
<foreach item="groundingStatus" collection="groundingStatusArray" open="(" separator="," close=")">
|
||||
#{groundingStatus}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="groundingStatus != null and groundingStatus != ''">
|
||||
and grounding_status = #{groundingStatus}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="flags != null and flags != ''">
|
||||
and flags = #{flags}
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
and dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null ">
|
||||
and last_updated_registration_time = #{lastUpdatedRegistrationTime}
|
||||
</if>
|
||||
<if test="adminId != null ">
|
||||
and admin_id = #{adminId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectZdyStoreBaseInfoById" parameterType="Long"
|
||||
resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertZdyStoreBaseInfo" parameterType="ZdyStoreBaseInfo" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into zdy_store_base_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">contact_phone,
|
||||
</if>
|
||||
<if test="businessStartHours != null">business_start_hours,
|
||||
</if>
|
||||
<if test="businessEndHours != null">business_end_hours,
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null">business_days_on_weekly,
|
||||
</if>
|
||||
<if test="address != null and address != ''">address,
|
||||
</if>
|
||||
<if test="latitude != null">latitude,
|
||||
</if>
|
||||
<if test="longitude != null">longitude,
|
||||
</if>
|
||||
<if test="images != null">images,
|
||||
</if>
|
||||
<if test="carouselImage != null">carousel_image,
|
||||
</if>
|
||||
<if test="contactName != null">contact_name,
|
||||
</if>
|
||||
<if test="registerType != null">register_type,
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">legal_person_name,
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">legal_person_phone,
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">facade_images,
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">business_license,
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null">legal_person_id_card_front,
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null">legal_person_id_card_back,
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">register_audit_status,
|
||||
</if>
|
||||
<if test="registerAuditTime != null">register_audit_time,
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null">register_audit_rejection_desc,
|
||||
</if>
|
||||
<if test="registerAuditorId != null">register_auditor_id,
|
||||
</if>
|
||||
<if test="groundingStatus != null">grounding_status,
|
||||
</if>
|
||||
<if test="flags != null">flags,
|
||||
</if>
|
||||
<if test="deptId != null">dept_id,
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null">last_updated_registration_time,
|
||||
</if>
|
||||
<if test="adminId != null">admin_id,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">update_time,
|
||||
</if>
|
||||
<if test="remark != null">remark,
|
||||
</if>
|
||||
<if test="delFlag != null">del_flag,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">#{contactPhone},
|
||||
</if>
|
||||
<if test="businessStartHours != null">#{businessStartHours},
|
||||
</if>
|
||||
<if test="businessEndHours != null">#{businessEndHours},
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null">#{businessDaysOnWeekly},
|
||||
</if>
|
||||
<if test="address != null and address != ''">#{address},
|
||||
</if>
|
||||
<if test="latitude != null">#{latitude},
|
||||
</if>
|
||||
<if test="longitude != null">#{longitude},
|
||||
</if>
|
||||
<if test="images != null">#{images},
|
||||
</if>
|
||||
<if test="carouselImage != null">#{carouselImage},
|
||||
</if>
|
||||
<if test="contactName != null">#{contactName},
|
||||
</if>
|
||||
<if test="registerType != null">#{registerType},
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">#{legalPersonName},
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">#{legalPersonPhone},
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">#{facadeImages},
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">#{businessLicense},
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null">#{legalPersonIdCardFront},
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null">#{legalPersonIdCardBack},
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">#{registerAuditStatus},
|
||||
</if>
|
||||
<if test="registerAuditTime != null">#{registerAuditTime},
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null">#{registerAuditRejectionDesc},
|
||||
</if>
|
||||
<if test="registerAuditorId != null">#{registerAuditorId},
|
||||
</if>
|
||||
<if test="groundingStatus != null">#{groundingStatus},
|
||||
</if>
|
||||
<if test="flags != null">#{flags},
|
||||
</if>
|
||||
<if test="deptId != null">#{deptId},
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null">#{lastUpdatedRegistrationTime},
|
||||
</if>
|
||||
<if test="adminId != null">#{adminId},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">#{remark},
|
||||
</if>
|
||||
<if test="delFlag != null">#{delFlag},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateZdyStoreBaseInfo" parameterType="ZdyStoreBaseInfo">
|
||||
update zdy_store_base_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name =
|
||||
#{name},
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">contact_phone =
|
||||
#{contactPhone},
|
||||
</if>
|
||||
<if test="businessStartHours != null">business_start_hours =
|
||||
#{businessStartHours},
|
||||
</if>
|
||||
<if test="businessEndHours != null">business_end_hours =
|
||||
#{businessEndHours},
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null">business_days_on_weekly =
|
||||
#{businessDaysOnWeekly},
|
||||
</if>
|
||||
<if test="address != null and address != ''">address =
|
||||
#{address},
|
||||
</if>
|
||||
<if test="latitude != null">latitude =
|
||||
#{latitude},
|
||||
</if>
|
||||
<if test="longitude != null">longitude =
|
||||
#{longitude},
|
||||
</if>
|
||||
<if test="images != null">images =
|
||||
#{images},
|
||||
</if>
|
||||
<if test="carouselImage != null">carousel_image =
|
||||
#{carouselImage},
|
||||
</if>
|
||||
<if test="contactName != null">contact_name =
|
||||
#{contactName},
|
||||
</if>
|
||||
<if test="registerType != null">register_type =
|
||||
#{registerType},
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">legal_person_name =
|
||||
#{legalPersonName},
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">legal_person_phone =
|
||||
#{legalPersonPhone},
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">facade_images =
|
||||
#{facadeImages},
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">business_license =
|
||||
#{businessLicense},
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null">legal_person_id_card_front =
|
||||
#{legalPersonIdCardFront},
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null">legal_person_id_card_back =
|
||||
#{legalPersonIdCardBack},
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">register_audit_status =
|
||||
#{registerAuditStatus},
|
||||
</if>
|
||||
<if test="registerAuditTime != null">register_audit_time =
|
||||
#{registerAuditTime},
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null">register_audit_rejection_desc =
|
||||
#{registerAuditRejectionDesc},
|
||||
</if>
|
||||
<if test="registerAuditorId != null">register_auditor_id =
|
||||
#{registerAuditorId},
|
||||
</if>
|
||||
<if test="groundingStatus != null">grounding_status =
|
||||
#{groundingStatus},
|
||||
</if>
|
||||
<if test="flags != null">flags =
|
||||
#{flags},
|
||||
</if>
|
||||
<if test="deptId != null">dept_id =
|
||||
#{deptId},
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null">last_updated_registration_time =
|
||||
#{lastUpdatedRegistrationTime},
|
||||
</if>
|
||||
<if test="adminId != null">admin_id =
|
||||
#{adminId},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">remark =
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="delFlag != null">del_flag =
|
||||
#{delFlag},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteZdyStoreBaseInfoById" parameterType="Long">
|
||||
update zdy_store_base_info
|
||||
set del_flag = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteZdyStoreBaseInfoByIds">
|
||||
update zdy_store_base_info
|
||||
set del_flag = 1
|
||||
where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="checkNameUnique" parameterType="ZdyStoreBaseInfo" resultType="java.lang.Integer">
|
||||
select exists(
|
||||
select 1 from zdy_store_base_info where name = #{name} and del_flag = 0
|
||||
<if test="id != null">
|
||||
and id != #{id}
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getByAdminIdAndRegisterType" parameterType="ZdyStoreBaseInfo" resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
where admin_id = #{adminId}
|
||||
and register_type = #{registerType}
|
||||
and del_flag = #{delFlag}
|
||||
</select>
|
||||
|
||||
<select id="selectZdyStoreBaseInfoByIds" resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhwl.store.mapper.HuifuSotreMapper">
|
||||
|
||||
<resultMap type="HuifuSotre" id="HuifuSotreResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="storeId" column="storeId"/>
|
||||
<result property="huifuId" column="huifuId"/>
|
||||
<result property="percentage" column="percentage"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHuifuSotreVo">
|
||||
select id, storeId, huifuId, percentage
|
||||
from huifu_sotre
|
||||
</sql>
|
||||
|
||||
<select id="selectHuifuSotreList" parameterType="HuifuSotre" resultMap="HuifuSotreResult">
|
||||
<include refid="selectHuifuSotreVo"/>
|
||||
<where>
|
||||
<if test="storeId != null ">
|
||||
and storeId = #{storeId}
|
||||
</if>
|
||||
<if test="huifuId != null ">
|
||||
and huifuId = #{huifuId}
|
||||
</if>
|
||||
<if test="percentage != null ">
|
||||
and percentage = #{percentage}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHuifuSotreById" parameterType="Long"
|
||||
resultMap="HuifuSotreResult">
|
||||
<include refid="selectHuifuSotreVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertHuifuSotre" parameterType="HuifuSotre" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into huifu_sotre
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">storeId,
|
||||
</if>
|
||||
<if test="huifuId != null">huifuId,
|
||||
</if>
|
||||
<if test="percentage != null">percentage,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},
|
||||
</if>
|
||||
<if test="huifuId != null">#{huifuId},
|
||||
</if>
|
||||
<if test="percentage != null">#{percentage},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateHuifuSotre" parameterType="HuifuSotre">
|
||||
update huifu_sotre
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="storeId != null">storeId =
|
||||
#{storeId},
|
||||
</if>
|
||||
<if test="huifuId != null">huifuId =
|
||||
#{huifuId},
|
||||
</if>
|
||||
<if test="percentage != null">percentage =
|
||||
#{percentage},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHuifuSotreById" parameterType="Long">
|
||||
delete from huifu_sotre where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHuifuSotreByIds" parameterType="String">
|
||||
delete from huifu_sotre where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@@ -0,0 +1,468 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhwl.store.mapper.ZdyStoreBaseInfoMapper">
|
||||
|
||||
<resultMap type="ZdyStoreBaseInfo" id="ZdyStoreBaseInfoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
<result property="businessStartHours" column="business_start_hours"/>
|
||||
<result property="businessEndHours" column="business_end_hours"/>
|
||||
<result property="businessDaysOnWeekly" column="business_days_on_weekly"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="latitude" column="latitude"/>
|
||||
<result property="longitude" column="longitude"/>
|
||||
<result property="images" column="images"/>
|
||||
<result property="carouselImage" column="carousel_image"/>
|
||||
<result property="contactName" column="contact_name"/>
|
||||
<result property="registerType" column="register_type"/>
|
||||
<result property="legalPersonName" column="legal_person_name"/>
|
||||
<result property="legalPersonPhone" column="legal_person_phone"/>
|
||||
<result property="facadeImages" column="facade_images"/>
|
||||
<result property="businessLicense" column="business_license"/>
|
||||
<result property="legalPersonIdCardFront" column="legal_person_id_card_front"/>
|
||||
<result property="legalPersonIdCardBack" column="legal_person_id_card_back"/>
|
||||
<result property="registerAuditStatus" column="register_audit_status"/>
|
||||
<result property="registerAuditTime" column="register_audit_time"/>
|
||||
<result property="registerAuditRejectionDesc" column="register_audit_rejection_desc"/>
|
||||
<result property="registerAuditorId" column="register_auditor_id"/>
|
||||
<result property="groundingStatus" column="grounding_status"/>
|
||||
<result property="flags" column="flags"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="lastUpdatedRegistrationTime" column="last_updated_registration_time"/>
|
||||
<result property="adminId" column="admin_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectZdyStoreBaseInfoVo">
|
||||
select id,
|
||||
name,
|
||||
contact_phone,
|
||||
business_start_hours,
|
||||
business_end_hours,
|
||||
business_days_on_weekly,
|
||||
address,
|
||||
latitude,
|
||||
longitude,
|
||||
images,
|
||||
carousel_image,
|
||||
contact_name,
|
||||
register_type,
|
||||
legal_person_name,
|
||||
legal_person_phone,
|
||||
facade_images,
|
||||
business_license,
|
||||
legal_person_id_card_front,
|
||||
legal_person_id_card_back,
|
||||
register_audit_status,
|
||||
register_audit_time,
|
||||
register_audit_rejection_desc,
|
||||
register_auditor_id,
|
||||
grounding_status,
|
||||
flags,
|
||||
dept_id,
|
||||
last_updated_registration_time,
|
||||
admin_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
del_flag
|
||||
from zdy_store_base_info
|
||||
</sql>
|
||||
|
||||
<select id="selectZdyStoreBaseInfoList" parameterType="ZdyStoreBaseInfo" resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="name != null and name != ''">
|
||||
and name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">
|
||||
and contact_phone = #{contactPhone}
|
||||
</if>
|
||||
<if test="businessStartHours != null ">
|
||||
and business_start_hours = #{businessStartHours}
|
||||
</if>
|
||||
<if test="businessEndHours != null ">
|
||||
and business_end_hours = #{businessEndHours}
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null and businessDaysOnWeekly != ''">
|
||||
and business_days_on_weekly = #{businessDaysOnWeekly}
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
and address = #{address}
|
||||
</if>
|
||||
<if test="latitude != null ">
|
||||
and latitude = #{latitude}
|
||||
</if>
|
||||
<if test="longitude != null ">
|
||||
and longitude = #{longitude}
|
||||
</if>
|
||||
<if test="images != null and images != ''">
|
||||
and images = #{images}
|
||||
</if>
|
||||
<if test="carouselImage != null and carouselImage != ''">
|
||||
and carousel_image = #{carouselImage}
|
||||
</if>
|
||||
<if test="contactName != null and contactName != ''">
|
||||
and contact_name = #{contactName}
|
||||
</if>
|
||||
<if test="registerType != null and registerType != ''">
|
||||
and register_type = #{registerType}
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">
|
||||
and legal_person_name like concat('%', #{legalPersonName}, '%')
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">
|
||||
and legal_person_phone = #{legalPersonPhone}
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">
|
||||
and facade_images = #{facadeImages}
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">
|
||||
and business_license = #{businessLicense}
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null and legalPersonIdCardFront != ''">
|
||||
and legal_person_id_card_front = #{legalPersonIdCardFront}
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null and legalPersonIdCardBack != ''">
|
||||
and legal_person_id_card_back = #{legalPersonIdCardBack}
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">
|
||||
and register_audit_status = #{registerAuditStatus}
|
||||
</if>
|
||||
<if test="registerAuditTime != null ">
|
||||
and register_audit_time = #{registerAuditTime}
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null and registerAuditRejectionDesc != ''">
|
||||
and register_audit_rejection_desc = #{registerAuditRejectionDesc}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="groundingStatusArray != null and groundingStatusArray.length != 0">
|
||||
and grounding_status in
|
||||
<foreach item="groundingStatus" collection="groundingStatusArray" open="(" separator="," close=")">
|
||||
#{groundingStatus}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="groundingStatus != null and groundingStatus != ''">
|
||||
and grounding_status = #{groundingStatus}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="flags != null and flags != ''">
|
||||
and flags = #{flags}
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
and dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null ">
|
||||
and last_updated_registration_time = #{lastUpdatedRegistrationTime}
|
||||
</if>
|
||||
<if test="adminId != null ">
|
||||
and admin_id = #{adminId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectZdyStoreBaseInfoById" parameterType="Long"
|
||||
resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertZdyStoreBaseInfo" parameterType="ZdyStoreBaseInfo" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into zdy_store_base_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">contact_phone,
|
||||
</if>
|
||||
<if test="businessStartHours != null">business_start_hours,
|
||||
</if>
|
||||
<if test="businessEndHours != null">business_end_hours,
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null">business_days_on_weekly,
|
||||
</if>
|
||||
<if test="address != null and address != ''">address,
|
||||
</if>
|
||||
<if test="latitude != null">latitude,
|
||||
</if>
|
||||
<if test="longitude != null">longitude,
|
||||
</if>
|
||||
<if test="images != null">images,
|
||||
</if>
|
||||
<if test="carouselImage != null">carousel_image,
|
||||
</if>
|
||||
<if test="contactName != null">contact_name,
|
||||
</if>
|
||||
<if test="registerType != null">register_type,
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">legal_person_name,
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">legal_person_phone,
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">facade_images,
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">business_license,
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null">legal_person_id_card_front,
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null">legal_person_id_card_back,
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">register_audit_status,
|
||||
</if>
|
||||
<if test="registerAuditTime != null">register_audit_time,
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null">register_audit_rejection_desc,
|
||||
</if>
|
||||
<if test="registerAuditorId != null">register_auditor_id,
|
||||
</if>
|
||||
<if test="groundingStatus != null">grounding_status,
|
||||
</if>
|
||||
<if test="flags != null">flags,
|
||||
</if>
|
||||
<if test="deptId != null">dept_id,
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null">last_updated_registration_time,
|
||||
</if>
|
||||
<if test="adminId != null">admin_id,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">update_time,
|
||||
</if>
|
||||
<if test="remark != null">remark,
|
||||
</if>
|
||||
<if test="delFlag != null">del_flag,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">#{contactPhone},
|
||||
</if>
|
||||
<if test="businessStartHours != null">#{businessStartHours},
|
||||
</if>
|
||||
<if test="businessEndHours != null">#{businessEndHours},
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null">#{businessDaysOnWeekly},
|
||||
</if>
|
||||
<if test="address != null and address != ''">#{address},
|
||||
</if>
|
||||
<if test="latitude != null">#{latitude},
|
||||
</if>
|
||||
<if test="longitude != null">#{longitude},
|
||||
</if>
|
||||
<if test="images != null">#{images},
|
||||
</if>
|
||||
<if test="carouselImage != null">#{carouselImage},
|
||||
</if>
|
||||
<if test="contactName != null">#{contactName},
|
||||
</if>
|
||||
<if test="registerType != null">#{registerType},
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">#{legalPersonName},
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">#{legalPersonPhone},
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">#{facadeImages},
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">#{businessLicense},
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null">#{legalPersonIdCardFront},
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null">#{legalPersonIdCardBack},
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">#{registerAuditStatus},
|
||||
</if>
|
||||
<if test="registerAuditTime != null">#{registerAuditTime},
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null">#{registerAuditRejectionDesc},
|
||||
</if>
|
||||
<if test="registerAuditorId != null">#{registerAuditorId},
|
||||
</if>
|
||||
<if test="groundingStatus != null">#{groundingStatus},
|
||||
</if>
|
||||
<if test="flags != null">#{flags},
|
||||
</if>
|
||||
<if test="deptId != null">#{deptId},
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null">#{lastUpdatedRegistrationTime},
|
||||
</if>
|
||||
<if test="adminId != null">#{adminId},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">#{remark},
|
||||
</if>
|
||||
<if test="delFlag != null">#{delFlag},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateZdyStoreBaseInfo" parameterType="ZdyStoreBaseInfo">
|
||||
update zdy_store_base_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name =
|
||||
#{name},
|
||||
</if>
|
||||
<if test="contactPhone != null and contactPhone != ''">contact_phone =
|
||||
#{contactPhone},
|
||||
</if>
|
||||
<if test="businessStartHours != null">business_start_hours =
|
||||
#{businessStartHours},
|
||||
</if>
|
||||
<if test="businessEndHours != null">business_end_hours =
|
||||
#{businessEndHours},
|
||||
</if>
|
||||
<if test="businessDaysOnWeekly != null">business_days_on_weekly =
|
||||
#{businessDaysOnWeekly},
|
||||
</if>
|
||||
<if test="address != null and address != ''">address =
|
||||
#{address},
|
||||
</if>
|
||||
<if test="latitude != null">latitude =
|
||||
#{latitude},
|
||||
</if>
|
||||
<if test="longitude != null">longitude =
|
||||
#{longitude},
|
||||
</if>
|
||||
<if test="images != null">images =
|
||||
#{images},
|
||||
</if>
|
||||
<if test="carouselImage != null">carousel_image =
|
||||
#{carouselImage},
|
||||
</if>
|
||||
<if test="contactName != null">contact_name =
|
||||
#{contactName},
|
||||
</if>
|
||||
<if test="registerType != null">register_type =
|
||||
#{registerType},
|
||||
</if>
|
||||
<if test="legalPersonName != null and legalPersonName != ''">legal_person_name =
|
||||
#{legalPersonName},
|
||||
</if>
|
||||
<if test="legalPersonPhone != null and legalPersonPhone != ''">legal_person_phone =
|
||||
#{legalPersonPhone},
|
||||
</if>
|
||||
<if test="facadeImages != null and facadeImages != ''">facade_images =
|
||||
#{facadeImages},
|
||||
</if>
|
||||
<if test="businessLicense != null and businessLicense != ''">business_license =
|
||||
#{businessLicense},
|
||||
</if>
|
||||
<if test="legalPersonIdCardFront != null">legal_person_id_card_front =
|
||||
#{legalPersonIdCardFront},
|
||||
</if>
|
||||
<if test="legalPersonIdCardBack != null">legal_person_id_card_back =
|
||||
#{legalPersonIdCardBack},
|
||||
</if>
|
||||
<if test="registerAuditStatus != null and registerAuditStatus != ''">register_audit_status =
|
||||
#{registerAuditStatus},
|
||||
</if>
|
||||
<if test="registerAuditTime != null">register_audit_time =
|
||||
#{registerAuditTime},
|
||||
</if>
|
||||
<if test="registerAuditRejectionDesc != null">register_audit_rejection_desc =
|
||||
#{registerAuditRejectionDesc},
|
||||
</if>
|
||||
<if test="registerAuditorId != null">register_auditor_id =
|
||||
#{registerAuditorId},
|
||||
</if>
|
||||
<if test="groundingStatus != null">grounding_status =
|
||||
#{groundingStatus},
|
||||
</if>
|
||||
<if test="flags != null">flags =
|
||||
#{flags},
|
||||
</if>
|
||||
<if test="deptId != null">dept_id =
|
||||
#{deptId},
|
||||
</if>
|
||||
<if test="lastUpdatedRegistrationTime != null">last_updated_registration_time =
|
||||
#{lastUpdatedRegistrationTime},
|
||||
</if>
|
||||
<if test="adminId != null">admin_id =
|
||||
#{adminId},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">remark =
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="delFlag != null">del_flag =
|
||||
#{delFlag},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteZdyStoreBaseInfoById" parameterType="Long">
|
||||
update zdy_store_base_info
|
||||
set del_flag = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteZdyStoreBaseInfoByIds">
|
||||
update zdy_store_base_info
|
||||
set del_flag = 1
|
||||
where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="checkNameUnique" parameterType="ZdyStoreBaseInfo" resultType="java.lang.Integer">
|
||||
select exists(
|
||||
select 1 from zdy_store_base_info where name = #{name} and del_flag = 0
|
||||
<if test="id != null">
|
||||
and id != #{id}
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getByAdminIdAndRegisterType" parameterType="ZdyStoreBaseInfo" resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
where admin_id = #{adminId}
|
||||
and register_type = #{registerType}
|
||||
and del_flag = #{delFlag}
|
||||
</select>
|
||||
|
||||
<select id="selectZdyStoreBaseInfoByIds" resultMap="ZdyStoreBaseInfoResult">
|
||||
<include refid="selectZdyStoreBaseInfoVo"/>
|
||||
where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user