42 changed files with 1098 additions and 59 deletions
@ -0,0 +1,136 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
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.Assert; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
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.bms.entity.so.BmsSupplierContactsSo; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSupplierContactsBo; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierContacts; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierContactsService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 供应商联系人 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplierContacts") |
|||
public class BmsSupplierContactsController { |
|||
|
|||
private BmsSupplierContactsService bmsSupplierContactsService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public R<List<BmsSupplierContacts>> getList(BmsSupplierContactsSo param){ |
|||
BmsSupplierContacts entity = CopierUtil.copy(param,new BmsSupplierContacts()); |
|||
LambdaQueryWrapper<BmsSupplierContacts> lqw = new LambdaQueryWrapper<>(entity); |
|||
PageUtil.startPage(); |
|||
List<BmsSupplierContacts> list = bmsSupplierContactsService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BmsSupplierContacts>> getPage(BmsSupplierContactsSo param){ |
|||
BmsSupplierContacts entity = CopierUtil.copy(param,new BmsSupplierContacts()); |
|||
LambdaQueryWrapper<BmsSupplierContacts> lqw = new LambdaQueryWrapper<>(entity); |
|||
PageUtil.startPage(); |
|||
List<BmsSupplierContacts> list = bmsSupplierContactsService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BmsSupplierContacts> getById(@PathVariable("id") String id){ |
|||
BmsSupplierContacts bmsSupplierContacts = bmsSupplierContactsService.getById(id); |
|||
return R.ok(bmsSupplierContacts); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商联系人", biz = BizType.UPDATE) |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplierContactsBo param){ |
|||
BmsSupplierContacts entity = CopierUtil.copy(param,new BmsSupplierContacts()); |
|||
if(StrUtil.isEmpty(param.getContactsName())&&StrUtil.isEmpty(param.getContactsPost())){ |
|||
Assert.throwEx("姓名和职务至少填一个"); |
|||
} |
|||
BmsSupplier supplier = bmsSupplierService.getById(param.getSupplierId()); |
|||
entity.setSupplierCode(supplier.getCode()); |
|||
entity.setSupplierName(supplier.getName()); |
|||
boolean result = bmsSupplierContactsService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商联系人", biz = BizType.INSERT) |
|||
public R<BmsSupplierContacts> save(@RequestBody @Valid BmsSupplierContactsBo param){ |
|||
BmsSupplierContacts entity = CopierUtil.copy(param,new BmsSupplierContacts()); |
|||
if(StrUtil.isEmpty(param.getContactsName())&&StrUtil.isEmpty(param.getContactsPost())){ |
|||
Assert.throwEx("姓名和职务至少填一个"); |
|||
} |
|||
BmsSupplier supplier = bmsSupplierService.getById(param.getSupplierId()); |
|||
entity.setSupplierCode(supplier.getCode()); |
|||
entity.setSupplierName(supplier.getName()); |
|||
bmsSupplierContactsService.save(entity); |
|||
return R.ok(entity); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商联系人", biz = BizType.DELETE) |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = bmsSupplierContactsService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,115 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
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 2023-04-19 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_supplier_contacts") |
|||
public class BmsSupplierContacts implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 经销商id */ |
|||
private Long supplierId; |
|||
|
|||
/** 经销商名称 */ |
|||
@Length(max = 255,message = "经销商名称长度不能超过255字") |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String supplierName; |
|||
|
|||
/** 经销商编码 */ |
|||
@Length(max = 255,message = "经销商编码长度不能超过255字") |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String supplierCode; |
|||
|
|||
/** 联系号码 */ |
|||
@Length(max = 255,message = "联系号码长度不能超过255字") |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String contactsNumber; |
|||
|
|||
/** 联系名称 */ |
|||
@Length(max = 255,message = "联系名称长度不能超过255字") |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String contactsName; |
|||
|
|||
/** 联系岗位 */ |
|||
@Length(max = 255,message = "联系岗位长度不能超过255字") |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String contactsPost; |
|||
|
|||
/** 备注 */ |
|||
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; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@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; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
|
|||
public static BmsSupplierContacts toNewObject(BmsSupplierContacts source){ |
|||
BmsSupplierContacts supplierContacts = new BmsSupplierContacts(); |
|||
supplierContacts.setId(source.getId()); |
|||
supplierContacts.setSupplierId(source.getSupplierId()); |
|||
supplierContacts.setSupplierName(source.getSupplierName()); |
|||
supplierContacts.setSupplierCode(source.getSupplierCode()); |
|||
supplierContacts.setContactsNumber(source.getContactsNumber()); |
|||
supplierContacts.setContactsName(source.getContactsName()); |
|||
supplierContacts.setContactsPost(source.getContactsPost()); |
|||
supplierContacts.setCreateTime(source.getCreateTime()); |
|||
supplierContacts.setCreateBy(source.getCreateBy()); |
|||
supplierContacts.setUpdateTime(source.getUpdateTime()); |
|||
supplierContacts.setUpdateBy(source.getUpdateBy()); |
|||
supplierContacts.setTenantId(source.getTenantId()); |
|||
supplierContacts.setDelFlag(source.getDelFlag()); |
|||
return supplierContacts; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,50 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 供应商联系人 Bo |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierContactsBo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
|
|||
/** 经销商id */ |
|||
private Long supplierId; |
|||
|
|||
/** 联系号码 */ |
|||
@Length(max = 255,message = "联系号码长度不能超过255字") |
|||
private String contactsNumber; |
|||
|
|||
/** 联系名称 */ |
|||
@Length(max = 255,message = "联系名称长度不能超过255字") |
|||
private String contactsName; |
|||
|
|||
/** 联系岗位 */ |
|||
@Length(max = 255,message = "联系岗位长度不能超过255字") |
|||
private String contactsPost; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
} |
|||
|
@ -0,0 +1,45 @@ |
|||
package com.qs.serve.modules.bms.entity.so; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
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 2023-04-19 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierContactsSo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 经销商名称 */ |
|||
private String supplierName; |
|||
|
|||
/** 经销商编码 */ |
|||
private String supplierCode; |
|||
|
|||
/** 联系号码 */ |
|||
private String contactsNumber; |
|||
|
|||
/** 联系名称 */ |
|||
private String contactsName; |
|||
|
|||
/** 联系岗位 */ |
|||
private String contactsPost; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierContacts; |
|||
|
|||
/** |
|||
* 供应商联系人 Mapper |
|||
* @author YenHex |
|||
* @date 2023-04-19 |
|||
*/ |
|||
public interface BmsSupplierContactsMapper extends BaseMapper<BmsSupplierContacts> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierContacts; |
|||
|
|||
/** |
|||
* 供应商联系人 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-04-19 |
|||
*/ |
|||
public interface BmsSupplierContactsService extends IService<BmsSupplierContacts> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.bms.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.bms.entity.BmsSupplierContacts; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierContactsService; |
|||
import com.qs.serve.modules.bms.mapper.BmsSupplierContactsMapper; |
|||
|
|||
/** |
|||
* 供应商联系人 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BmsSupplierContactsServiceImpl extends ServiceImpl<BmsSupplierContactsMapper,BmsSupplierContacts> implements BmsSupplierContactsService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,94 @@ |
|||
package com.qs.serve.modules.third; |
|||
|
|||
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.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.wx.entity.WxFormPushUser; |
|||
import com.qs.serve.modules.wx.entity.WxUser; |
|||
import com.qs.serve.modules.wx.entity.bo.WxFormPushBo; |
|||
import com.qs.serve.modules.wx.entity.dto.sms.WxSmsNewForm; |
|||
import com.qs.serve.modules.wx.entity.vo.WxPushResultVo; |
|||
import com.qs.serve.modules.wx.service.WxFormPushUserService; |
|||
import com.qs.serve.modules.wx.service.WxPushService; |
|||
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 com.qs.serve.modules.wx.entity.WxFormPush; |
|||
import com.qs.serve.modules.wx.service.WxFormPushService; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.validation.Valid; |
|||
import java.time.LocalDateTime; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 【第三方接口】 表单推送 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("thirty/formPush") |
|||
public class PortalFormPushController { |
|||
|
|||
private WxFormPushService wxFormPushService; |
|||
private WxFormPushUserService wxFormPushUserService; |
|||
private WxUserService wxUserService; |
|||
private WxPushService wxPushService; |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/publish") |
|||
public R<?> save(@RequestBody @Valid WxFormPushBo param, HttpServletRequest request){ |
|||
ThirdTokenUtil.checkToken(request); |
|||
WxFormPush entity = CopierUtil.copy(param,new WxFormPush()); |
|||
wxFormPushService.save(entity); |
|||
List<String> userCodes = param.getUserCodes().stream().distinct().collect(Collectors.toList()); |
|||
LambdaQueryWrapper<WxUser> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(WxUser::getAppId,param.getAppId()); |
|||
lqw.in(WxUser::getSysUserCode,userCodes); |
|||
List<WxUser> wxUserList = wxUserService.list(lqw); |
|||
List<String> userCodes2 = wxUserList.stream().map(WxUser::getSysUserCode).distinct().collect(Collectors.toList()); |
|||
List<WxFormPushUser> pushUserList = new ArrayList<>(); |
|||
for (WxUser wxUser : wxUserList) { |
|||
if(wxUser.getOpenId().equals("0")){ |
|||
continue; |
|||
} |
|||
WxSmsNewForm wxSmsNewForm = new WxSmsNewForm(); |
|||
wxSmsNewForm.setTitle(param.getTitle()); |
|||
wxSmsNewForm.setUserName(wxUser.getEmpName()); |
|||
wxSmsNewForm.setBizType(param.getBusinessType()==null?"通知":param.getBusinessType()); |
|||
wxSmsNewForm.setBitTime(LocalDateTime.now().toString().replace("T"," ")); |
|||
wxSmsNewForm.setRemark(param.getRemark()); |
|||
wxPushService.sendWxMsg(wxUser,"表单通知",wxSmsNewForm,true,entity.getId()); |
|||
WxFormPushUser pushUser = new WxFormPushUser(); |
|||
pushUser.setFormPushId(entity.getId()); |
|||
pushUser.setUserId(wxUser.getSysUserId()); |
|||
pushUser.setUserCode(wxUser.getSysUserCode()); |
|||
pushUser.setUserName(wxUser.getEmpName()); |
|||
pushUserList.add(pushUser); |
|||
} |
|||
wxFormPushUserService.saveBatch(pushUserList); |
|||
List<String> userCodes3 = userCodes.stream().filter(a->!userCodes2.contains(a)).collect(Collectors.toList()); |
|||
WxPushResultVo resultVo = new WxPushResultVo(); |
|||
resultVo.setNotBindUserCodeList(userCodes3); |
|||
return R.ok(resultVo); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,120 @@ |
|||
package com.qs.serve.modules.wx.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 com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
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.wx.entity.bo.WxFormPushBo; |
|||
import com.qs.serve.modules.wx.entity.WxFormPush; |
|||
import com.qs.serve.modules.wx.service.WxFormPushService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 微信 表单推送 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("wx/formPush") |
|||
public class WxFormPushController { |
|||
|
|||
private WxFormPushService wxFormPushService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
//@GetMapping("/list")
|
|||
@PreAuthorize("hasRole('wx:formPush:query')") |
|||
public R<List<WxFormPush>> getList(WxFormPush param){ |
|||
LambdaQueryWrapper<WxFormPush> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<WxFormPush> list = wxFormPushService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<WxFormPush>> getPage(WxFormPush param){ |
|||
LambdaQueryWrapper<WxFormPush> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<WxFormPush> list = wxFormPushService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.QUERY) |
|||
public R<WxFormPush> getById(@PathVariable("id") String id){ |
|||
WxFormPush wxFormPush = wxFormPushService.getById(id); |
|||
return R.ok(wxFormPush); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
//@PostMapping("/updateById")
|
|||
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('wx:formPush:update')") |
|||
public R<?> updateById(@RequestBody @Valid WxFormPushBo param){ |
|||
WxFormPush entity = CopierUtil.copy(param,new WxFormPush()); |
|||
boolean result = wxFormPushService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
//@PostMapping("/save")
|
|||
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('wx:formPush:insert')") |
|||
public R<?> save(@RequestBody @Valid WxFormPushBo param){ |
|||
WxFormPush entity = CopierUtil.copy(param,new WxFormPush()); |
|||
boolean result = wxFormPushService.save(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.Verification, title = "表单推送", biz = BizType.DELETE) |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = wxFormPushService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,96 @@ |
|||
package com.qs.serve.modules.wx.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
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 2023-04-19 |
|||
*/ |
|||
@Data |
|||
@TableName("wx_form_push") |
|||
public class WxFormPush implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.ASSIGN_UUID) |
|||
private String id; |
|||
|
|||
/** 标题 */ |
|||
@Length(max = 255,message = "标题长度不能超过255字") |
|||
private String title; |
|||
|
|||
/** 表单内容 */ |
|||
private String formContext; |
|||
|
|||
/** 表单值 */ |
|||
private String formContextValue; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 600,message = "备注长度不能超过600字") |
|||
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; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static WxFormPush toNewObject(WxFormPush source){ |
|||
WxFormPush formPush = new WxFormPush(); |
|||
formPush.setId(source.getId()); |
|||
formPush.setTitle(source.getTitle()); |
|||
formPush.setFormContext(source.getFormContext()); |
|||
formPush.setFormContextValue(source.getFormContextValue()); |
|||
formPush.setRemark(source.getRemark()); |
|||
formPush.setCreateTime(source.getCreateTime()); |
|||
formPush.setUpdateTime(source.getUpdateTime()); |
|||
formPush.setTenantId(source.getTenantId()); |
|||
formPush.setCreateBy(source.getCreateBy()); |
|||
formPush.setUpdateBy(source.getUpdateBy()); |
|||
formPush.setDelFlag(source.getDelFlag()); |
|||
return formPush; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,102 @@ |
|||
package com.qs.serve.modules.wx.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
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 2023-04-19 |
|||
*/ |
|||
@Data |
|||
@TableName("wx_form_push_user") |
|||
public class WxFormPushUser implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** */ |
|||
private String formPushId; |
|||
|
|||
/** */ |
|||
@Length(max = 64,message = "长度不能超过64字") |
|||
private String userId; |
|||
|
|||
/** */ |
|||
@Length(max = 255,message = "长度不能超过255字") |
|||
private String userCode; |
|||
|
|||
/** */ |
|||
@Length(max = 255,message = "长度不能超过255字") |
|||
private String userName; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 600,message = "备注长度不能超过600字") |
|||
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; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static WxFormPushUser toNewObject(WxFormPushUser source){ |
|||
WxFormPushUser formPushUser = new WxFormPushUser(); |
|||
formPushUser.setId(source.getId()); |
|||
formPushUser.setFormPushId(source.getFormPushId()); |
|||
formPushUser.setUserId(source.getUserId()); |
|||
formPushUser.setUserCode(source.getUserCode()); |
|||
formPushUser.setUserName(source.getUserName()); |
|||
formPushUser.setRemark(source.getRemark()); |
|||
formPushUser.setCreateTime(source.getCreateTime()); |
|||
formPushUser.setUpdateTime(source.getUpdateTime()); |
|||
formPushUser.setTenantId(source.getTenantId()); |
|||
formPushUser.setCreateBy(source.getCreateBy()); |
|||
formPushUser.setUpdateBy(source.getUpdateBy()); |
|||
formPushUser.setDelFlag(source.getDelFlag()); |
|||
return formPushUser; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,48 @@ |
|||
package com.qs.serve.modules.wx.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
/** |
|||
* 表单推送 实体类 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Data |
|||
public class WxFormPushBo implements Serializable { |
|||
|
|||
/** APPID */ |
|||
@NotNull(message = "appId不能为空") |
|||
private String appId; |
|||
|
|||
/** 标题 */ |
|||
@NotNull(message = "标题不能为空") |
|||
private String title; |
|||
|
|||
/** 表单内容 */ |
|||
@NotNull(message = "表单内容不能为空") |
|||
private String formContext; |
|||
|
|||
/** 业务类型,默认:通知 */ |
|||
private String businessType; |
|||
|
|||
/** 表单值 */ |
|||
private String formContextValue; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
/** 工号列表 */ |
|||
@NotNull(message = "工号列表不能为空") |
|||
private List<String> userCodes; |
|||
|
|||
} |
|||
|
@ -0,0 +1,19 @@ |
|||
package com.qs.serve.modules.wx.entity.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/4/19 |
|||
*/ |
|||
@Data |
|||
public class WxPushResultVo { |
|||
|
|||
/** |
|||
* 未绑定的用户列表 |
|||
*/ |
|||
List<String> notBindUserCodeList; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.wx.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.wx.entity.WxFormPush; |
|||
|
|||
/** |
|||
* 表单推送 Mapper |
|||
* @author YenHex |
|||
* @date 2023-04-19 |
|||
*/ |
|||
public interface WxFormPushMapper extends BaseMapper<WxFormPush> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.wx.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.wx.entity.WxFormPushUser; |
|||
|
|||
/** |
|||
* 表单推送用户 Mapper |
|||
* @author YenHex |
|||
* @date 2023-04-19 |
|||
*/ |
|||
public interface WxFormPushUserMapper extends BaseMapper<WxFormPushUser> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.wx.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.wx.entity.WxFormPush; |
|||
|
|||
/** |
|||
* 表单推送 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-04-19 |
|||
*/ |
|||
public interface WxFormPushService extends IService<WxFormPush> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.wx.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.wx.entity.WxFormPushUser; |
|||
|
|||
/** |
|||
* 表单推送用户 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-04-19 |
|||
*/ |
|||
public interface WxFormPushUserService extends IService<WxFormPushUser> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.wx.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.wx.entity.WxFormPush; |
|||
import com.qs.serve.modules.wx.service.WxFormPushService; |
|||
import com.qs.serve.modules.wx.mapper.WxFormPushMapper; |
|||
|
|||
/** |
|||
* 表单推送 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class WxFormPushServiceImpl extends ServiceImpl<WxFormPushMapper,WxFormPush> implements WxFormPushService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.wx.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.wx.entity.WxFormPushUser; |
|||
import com.qs.serve.modules.wx.service.WxFormPushUserService; |
|||
import com.qs.serve.modules.wx.mapper.WxFormPushUserMapper; |
|||
|
|||
/** |
|||
* 表单推送用户 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-04-19 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class WxFormPushUserServiceImpl extends ServiceImpl<WxFormPushUserMapper,WxFormPushUser> implements WxFormPushUserService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue