36 changed files with 800 additions and 172 deletions
@ -0,0 +1,103 @@ |
|||||
|
package com.qs.serve.modules.biz.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.biz.entity.BizVisit; |
||||
|
import com.qs.serve.modules.biz.service.BizVisitService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 业务 拜访日志 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("biz/visit") |
||||
|
public class BizVisitController { |
||||
|
|
||||
|
private BizVisitService bizVisitService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('biz:visit:query')") |
||||
|
public R<PageVo<BizVisit>> getPage(BizVisit param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BizVisit> visitWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BizVisit> list = bizVisitService.list(visitWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('biz:visit:query')") |
||||
|
public R<BizVisit> getById(@PathVariable("id") String id){ |
||||
|
BizVisit bizVisit = bizVisitService.getById(id); |
||||
|
return R.ok(bizVisit); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('biz:visit:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid BizVisit param){ |
||||
|
boolean result = bizVisitService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('biz:visit:insert')") |
||||
|
public R<?> save(@RequestBody @Valid BizVisit param){ |
||||
|
boolean result = bizVisitService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('biz:visit:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") Long id){ |
||||
|
boolean result = bizVisitService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,139 @@ |
|||||
|
package com.qs.serve.modules.biz.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.modules.biz.entity.BizVisit; |
||||
|
import com.qs.serve.modules.biz.service.BizVisitService; |
||||
|
import com.qs.serve.modules.sys.entity.SysUser; |
||||
|
import com.qs.serve.modules.sys.service.SysUserService; |
||||
|
import com.qs.serve.modules.wx.entity.WxUser; |
||||
|
import com.qs.serve.modules.wx.service.WxUserService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API业务 拜访日志 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/api/visit") |
||||
|
public class BizVisitApi { |
||||
|
|
||||
|
private BizVisitService bizVisitService; |
||||
|
private WxUserService wxUserService; |
||||
|
private SysUserService sysUserService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
public R<PageVo<BizVisit>> getPage(BizVisit param){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.byEmptyList(); |
||||
|
} |
||||
|
String userId = wxUser.getSysUserId(); |
||||
|
param.setVisitorId(userId); |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BizVisit> visitWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BizVisit> list = bizVisitService.list(visitWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
public R<BizVisit> getById(@PathVariable("id") String id){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
String userId = wxUser.getSysUserId(); |
||||
|
BizVisit bizVisit = bizVisitService.getById(id); |
||||
|
if(!bizVisit.getVisitorId().equals(userId)){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
return R.ok(bizVisit); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
public R<?> updateById(@RequestBody @Valid BizVisit param){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
String userId = wxUser.getSysUserId(); |
||||
|
BizVisit bizVisit = bizVisitService.getById(param.getId()); |
||||
|
if(!bizVisit.getVisitorId().equals(userId)){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
boolean result = bizVisitService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
public R<?> save(@RequestBody @Valid BizVisit param){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
String userId = wxUser.getSysUserId(); |
||||
|
SysUser sysUser = sysUserService.getById(userId); |
||||
|
param.setVisitorId(userId); |
||||
|
param.setVisitorName(sysUser.getName()); |
||||
|
boolean result = bizVisitService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
public R<?> deleteById(@PathVariable("id") Long id){ |
||||
|
WxUser wxUser = wxUserService.getCurrentWxUser(); |
||||
|
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
String userId = wxUser.getSysUserId(); |
||||
|
BizVisit bizVisit = bizVisitService.getById(id); |
||||
|
if(!bizVisit.getVisitorId().equals(userId)){ |
||||
|
return R.ok(); |
||||
|
} |
||||
|
boolean result = bizVisitService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,97 @@ |
|||||
|
package com.qs.serve.modules.biz.entity; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
||||
|
import lombok.Data; |
||||
|
import org.apache.ibatis.type.JdbcType; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* 拜访日志 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("biz_visit") |
||||
|
public class BizVisit implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 图片 */ |
||||
|
@TableField(typeHandler = SplitStringTypeHandler.class,jdbcType= JdbcType.VARCHAR) |
||||
|
private String[] photos; |
||||
|
|
||||
|
/** 纬度 */ |
||||
|
@Length(max = 255,message = "纬度长度不能超过255字") |
||||
|
private String localX; |
||||
|
|
||||
|
/** 经度 */ |
||||
|
@Length(max = 255,message = "经度长度不能超过255字") |
||||
|
private String localY; |
||||
|
|
||||
|
/** 地址 */ |
||||
|
@Length(max = 512,message = "地址长度不能超过512字") |
||||
|
private String address; |
||||
|
|
||||
|
/** 类型:单选 【潜在客户签到;培训会议;其他定点签到;在家办公 】 */ |
||||
|
@Length(max = 255,message = "类型:单选 【潜在客户签到;培训会议;其他定点签到;在家办公 】长度不能超过255字") |
||||
|
private String signType; |
||||
|
|
||||
|
/** 拜访人id */ |
||||
|
@Length(max = 32,message = "拜访人id长度不能超过32字") |
||||
|
private String visitorId; |
||||
|
|
||||
|
/** 拜访人 */ |
||||
|
@Length(max = 32,message = "拜访人长度不能超过32字") |
||||
|
private String visitorName; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@Length(max = 255,message = "备注长度不能超过255字") |
||||
|
private String remark; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
/** 最后更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
/** 所属租户 */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 逻辑删除标记(0:显示;1:隐藏) */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.biz.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.biz.entity.BizVisit; |
||||
|
|
||||
|
/** |
||||
|
* 拜访日志 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-26 |
||||
|
*/ |
||||
|
public interface BizVisitMapper extends BaseMapper<BizVisit> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.biz.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.biz.entity.BizVisit; |
||||
|
|
||||
|
/** |
||||
|
* 拜访日志 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-26 |
||||
|
*/ |
||||
|
public interface BizVisitService extends IService<BizVisit> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.biz.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.biz.entity.BizVisit; |
||||
|
import com.qs.serve.modules.biz.service.BizVisitService; |
||||
|
import com.qs.serve.modules.biz.mapper.BizVisitMapper; |
||||
|
|
||||
|
/** |
||||
|
* 拜访日志 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-26 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class BizVisitServiceImpl extends ServiceImpl<BizVisitMapper,BizVisit> implements BizVisitService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,8 @@ |
|||||
|
package com.qs.serve.modules.oms.entity.dto; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2022/10/26 |
||||
|
*/ |
||||
|
public class ShoppingCartsCheckResult { |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
package com.qs.serve.modules.sys.controller.api; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import com.qs.serve.modules.sys.entity.SysDict; |
||||
|
import com.qs.serve.modules.sys.service.SysDictService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* API系统 字典 |
||||
|
* @author YenHex |
||||
|
* @since 2022-05-20 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("api/dict") |
||||
|
public class SysDictApi { |
||||
|
|
||||
|
private SysDictService sysDictService; |
||||
|
|
||||
|
/** |
||||
|
* 列表查询 |
||||
|
* @param group 分组key |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/list") |
||||
|
public R<?> getList(String group){ |
||||
|
if(StringUtils.hasEmpty(group)){ |
||||
|
return R.error("查询参数为空"); |
||||
|
} |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<SysDict> dictWrapper = new LambdaQueryWrapper<>(); |
||||
|
dictWrapper.eq(SysDict::getGroupKey,group); |
||||
|
dictWrapper.orderByDesc(SysDict::getSort); |
||||
|
List<SysDict> list = sysDictService.list(dictWrapper); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,26 @@ |
|||||
|
package com.qs.serve.modules.sys.entity.bo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2022/10/25 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysRelateSuppliersParam2 { |
||||
|
|
||||
|
/** |
||||
|
* 用户ID。当user==null,为清楚客户绑定 |
||||
|
*/ |
||||
|
String userId; |
||||
|
|
||||
|
/** |
||||
|
* 供应商id列表 |
||||
|
*/ |
||||
|
@NotNull |
||||
|
Long supplierId; |
||||
|
|
||||
|
} |
Loading…
Reference in new issue