Commit d0ac668d by xinlaa

Merge branch 'master' of https://gitee.com/LinkWeChat/link-wechat into master

2 parents 9319251c 186251c9
Showing 42 changed files with 1120 additions and 987 deletions
...@@ -33,8 +33,8 @@ public class WeCategoryController extends BaseController { ...@@ -33,8 +33,8 @@ public class WeCategoryController extends BaseController {
@PreAuthorize("@ss.hasPermi('wechat:category:list')") @PreAuthorize("@ss.hasPermi('wechat:category:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("类目树") @ApiOperation("类目树")
public List<? extends Tree<?>> list(@RequestParam("mediaType") String mediaType) { public AjaxResult list(@RequestParam("mediaType") String mediaType) {
return weCategoryService.findWeCategoryByMediaType(mediaType); return AjaxResult.success(weCategoryService.findWeCategoryByMediaType(mediaType));
} }
/** /**
......
...@@ -58,11 +58,11 @@ public class WeCustomerController extends BaseController ...@@ -58,11 +58,11 @@ public class WeCustomerController extends BaseController
* @return * @return
*/ */
@PreAuthorize("@ss.hasPermi('customerManage:customer:list')") @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping("/getCustomersByUserId/{userId}") @GetMapping("/getCustomersByUserId/{externalUserid}")
public AjaxResult getCustomersByUserId(@PathVariable String userId){ public AjaxResult getCustomersByUserId(@PathVariable String externalUserid){
return AjaxResult.success(weCustomerService.getCustomersByUserId(userId)); return AjaxResult.success(weCustomerService.getCustomersByUserId(externalUserid));
} }
/** /**
......
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.ListUtil;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.service.IWeEmpleCodeService; import com.linkwechat.wecom.service.IWeEmpleCodeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 员工活码Controller * 员工活码Controller
...@@ -26,28 +23,28 @@ public class WeEmpleCodeController extends BaseController ...@@ -26,28 +23,28 @@ public class WeEmpleCodeController extends BaseController
@Autowired @Autowired
private IWeEmpleCodeService weEmpleCodeService; private IWeEmpleCodeService weEmpleCodeService;
/** // /**
* 查询员工活码列表 // * 查询员工活码列表
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:code:list')") // @PreAuthorize("@ss.hasPermi('wecom:code:list')")
@GetMapping("/list") // @GetMapping("/list")
public TableDataInfo list(WeEmpleCode weEmpleCode) // public TableDataInfo list(WeEmpleCode weEmpleCode)
{ // {
startPage(); // startPage();
List<WeEmpleCode> list = weEmpleCodeService.selectWeEmpleCodeList(weEmpleCode); // List<WeEmpleCode> list = weEmpleCodeService.selectWeEmpleCodeList(weEmpleCode);
return getDataTable(list); // return getDataTable(list);
} // }
//
//
/** // /**
* 获取员工活码详细信息 // * 获取员工活码详细信息
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:code:query')") // @PreAuthorize("@ss.hasPermi('wecom:code:query')")
@GetMapping(value = "/{id}") // @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) // public AjaxResult getInfo(@PathVariable("id") Long id)
{ // {
return AjaxResult.success(weEmpleCodeService.selectWeEmpleCodeById(id)); // return AjaxResult.success(weEmpleCodeService.selectWeEmpleCodeById(id));
} // }
/** /**
* 新增员工活码 * 新增员工活码
...@@ -57,7 +54,8 @@ public class WeEmpleCodeController extends BaseController ...@@ -57,7 +54,8 @@ public class WeEmpleCodeController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WeEmpleCode weEmpleCode) public AjaxResult add(@RequestBody WeEmpleCode weEmpleCode)
{ {
return toAjax(weEmpleCodeService.insertWeEmpleCode(weEmpleCode)); weEmpleCodeService.insertWeEmpleCode(weEmpleCode);
return AjaxResult.success();
} }
/** /**
...@@ -68,17 +66,19 @@ public class WeEmpleCodeController extends BaseController ...@@ -68,17 +66,19 @@ public class WeEmpleCodeController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WeEmpleCode weEmpleCode) public AjaxResult edit(@RequestBody WeEmpleCode weEmpleCode)
{ {
return toAjax(weEmpleCodeService.updateWeEmpleCode(weEmpleCode)); weEmpleCodeService.updateWeEmpleCode(weEmpleCode);
}
/** return AjaxResult.success();
* 删除员工活码
*/
@PreAuthorize("@ss.hasPermi('wecom:code:remove')")
@Log(title = "员工活码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(weEmpleCodeService.batchRemoveWeEmpleCodeIds(ListUtil.toList(ids)));
} }
// /**
// * 删除员工活码
// */
// @PreAuthorize("@ss.hasPermi('wecom:code:remove')")
// @Log(title = "员工活码", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable String[] ids)
// {
// return toAjax(weEmpleCodeService.batchRemoveWeEmpleCodeIds(ListUtil.toList(ids)));
// }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import java.util.List;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.linkwechat.wecom.domain.WeGroupCodeActual; import com.linkwechat.wecom.domain.WeGroupCodeActual;
import com.linkwechat.wecom.service.IWeGroupCodeActualService; import com.linkwechat.wecom.service.IWeGroupCodeActualService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/** /**
* 实际群码Controller * 实际群码Controller
...@@ -33,40 +23,40 @@ public class WeGroupCodeActualController extends BaseController ...@@ -33,40 +23,40 @@ public class WeGroupCodeActualController extends BaseController
@Autowired @Autowired
private IWeGroupCodeActualService weGroupCodeActualService; private IWeGroupCodeActualService weGroupCodeActualService;
/** // /**
* 查询实际群码列表 // * 查询实际群码列表
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:actual:list')") // @PreAuthorize("@ss.hasPermi('wecom:actual:list')")
@GetMapping("/list") // @GetMapping("/list")
public TableDataInfo list(WeGroupCodeActual weGroupCodeActual) // public TableDataInfo list(WeGroupCodeActual weGroupCodeActual)
{ // {
startPage(); // startPage();
List<WeGroupCodeActual> list = weGroupCodeActualService.selectWeGroupCodeActualList(weGroupCodeActual); // List<WeGroupCodeActual> list = weGroupCodeActualService.selectWeGroupCodeActualList(weGroupCodeActual);
return getDataTable(list); // return getDataTable(list);
} // }
//
/** // /**
* 导出实际群码列表 // * 导出实际群码列表
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:actual:export')") // @PreAuthorize("@ss.hasPermi('wecom:actual:export')")
@Log(title = "实际群码", businessType = BusinessType.EXPORT) // @Log(title = "实际群码", businessType = BusinessType.EXPORT)
@GetMapping("/export") // @GetMapping("/export")
public AjaxResult export(WeGroupCodeActual weGroupCodeActual) // public AjaxResult export(WeGroupCodeActual weGroupCodeActual)
{ // {
List<WeGroupCodeActual> list = weGroupCodeActualService.selectWeGroupCodeActualList(weGroupCodeActual); // List<WeGroupCodeActual> list = weGroupCodeActualService.selectWeGroupCodeActualList(weGroupCodeActual);
ExcelUtil<WeGroupCodeActual> util = new ExcelUtil<WeGroupCodeActual>(WeGroupCodeActual.class); // ExcelUtil<WeGroupCodeActual> util = new ExcelUtil<WeGroupCodeActual>(WeGroupCodeActual.class);
return util.exportExcel(list, "actual"); // return util.exportExcel(list, "actual");
} // }
//
/** // /**
* 获取实际群码详细信息 // * 获取实际群码详细信息
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:actual:query')") // @PreAuthorize("@ss.hasPermi('wecom:actual:query')")
@GetMapping(value = "/{id}") // @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) // public AjaxResult getInfo(@PathVariable("id") Long id)
{ // {
return AjaxResult.success(weGroupCodeActualService.selectWeGroupCodeActualById(id)); // return AjaxResult.success(weGroupCodeActualService.selectWeGroupCodeActualById(id));
} // }
/** /**
* 新增实际群码 * 新增实际群码
...@@ -76,7 +66,8 @@ public class WeGroupCodeActualController extends BaseController ...@@ -76,7 +66,8 @@ public class WeGroupCodeActualController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WeGroupCodeActual weGroupCodeActual) public AjaxResult add(@RequestBody WeGroupCodeActual weGroupCodeActual)
{ {
return toAjax(weGroupCodeActualService.insertWeGroupCodeActual(weGroupCodeActual)); weGroupCodeActualService.save(weGroupCodeActual);
return AjaxResult.success();
} }
/** /**
...@@ -87,17 +78,18 @@ public class WeGroupCodeActualController extends BaseController ...@@ -87,17 +78,18 @@ public class WeGroupCodeActualController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual) public AjaxResult edit(@RequestBody WeGroupCodeActual weGroupCodeActual)
{ {
return toAjax(weGroupCodeActualService.updateWeGroupCodeActual(weGroupCodeActual)); weGroupCodeActualService.updateById(weGroupCodeActual);
return AjaxResult.success();
} }
/** // /**
* 删除实际群码 // * 删除实际群码
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:actual:remove')") // @PreAuthorize("@ss.hasPermi('wecom:actual:remove')")
@Log(title = "实际群码", businessType = BusinessType.DELETE) // @Log(title = "实际群码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") // @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) // public AjaxResult remove(@PathVariable Long[] ids)
{ // {
return toAjax(weGroupCodeActualService.deleteWeGroupCodeActualByIds(ids)); // return toAjax(weGroupCodeActualService.deleteWeGroupCodeActualByIds(ids));
} // }
} }
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import java.util.List;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.linkwechat.wecom.domain.WeGroupCode; import com.linkwechat.wecom.domain.WeGroupCode;
import com.linkwechat.wecom.service.IWeGroupCodeService; import com.linkwechat.wecom.service.IWeGroupCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/** /**
...@@ -35,40 +24,40 @@ public class WeGroupCodeController extends BaseController ...@@ -35,40 +24,40 @@ public class WeGroupCodeController extends BaseController
@Autowired @Autowired
private IWeGroupCodeService weGroupCodeService; private IWeGroupCodeService weGroupCodeService;
/** // /**
* 查询客户群活码列表 // * 查询客户群活码列表
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:code:list')") // @PreAuthorize("@ss.hasPermi('wecom:code:list')")
@GetMapping("/list") // @GetMapping("/list")
public TableDataInfo list(WeGroupCode weGroupCode) // public TableDataInfo list(WeGroupCode weGroupCode)
{ // {
startPage(); // startPage();
List<WeGroupCode> list = weGroupCodeService.selectWeGroupCodeList(weGroupCode); // List<WeGroupCode> list = weGroupCodeService.selectWeGroupCodeList(weGroupCode);
return getDataTable(list); // return getDataTable(list);
} // }
//
// /**
// * 导出客户群活码列表
// */
// @PreAuthorize("@ss.hasPermi('wecom:code:export')")
// @Log(title = "客户群活码", businessType = BusinessType.EXPORT)
// @GetMapping("/export")
// public AjaxResult export(WeGroupCode weGroupCode)
// {
// List<WeGroupCode> list = weGroupCodeService.selectWeGroupCodeList(weGroupCode);
// ExcelUtil<WeGroupCode> util = new ExcelUtil<WeGroupCode>(WeGroupCode.class);
// return util.exportExcel(list, "code");
// }
/** // /**
* 导出客户群活码列表 // * 获取客户群活码详细信息
*/ // */
@PreAuthorize("@ss.hasPermi('wecom:code:export')") // @PreAuthorize("@ss.hasPermi('wecom:code:query')")
@Log(title = "客户群活码", businessType = BusinessType.EXPORT) // @GetMapping(value = "/{id}")
@GetMapping("/export") // public AjaxResult getInfo(@PathVariable("id") Long id)
public AjaxResult export(WeGroupCode weGroupCode) // {
{ // return AjaxResult.success(weGroupCodeService.selectWeGroupCodeById(id));
List<WeGroupCode> list = weGroupCodeService.selectWeGroupCodeList(weGroupCode); // }
ExcelUtil<WeGroupCode> util = new ExcelUtil<WeGroupCode>(WeGroupCode.class);
return util.exportExcel(list, "code");
}
/**
* 获取客户群活码详细信息
*/
@PreAuthorize("@ss.hasPermi('wecom:code:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(weGroupCodeService.selectWeGroupCodeById(id));
}
/** /**
* 新增客户群活码 * 新增客户群活码
...@@ -78,7 +67,8 @@ public class WeGroupCodeController extends BaseController ...@@ -78,7 +67,8 @@ public class WeGroupCodeController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WeGroupCode weGroupCode) public AjaxResult add(@RequestBody WeGroupCode weGroupCode)
{ {
return toAjax(weGroupCodeService.insertWeGroupCode(weGroupCode)); weGroupCodeService.insertWeGroupCode(weGroupCode);
return AjaxResult.success();
} }
/** /**
...@@ -89,17 +79,19 @@ public class WeGroupCodeController extends BaseController ...@@ -89,17 +79,19 @@ public class WeGroupCodeController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody WeGroupCode weGroupCode) public AjaxResult edit(@RequestBody WeGroupCode weGroupCode)
{ {
return toAjax(weGroupCodeService.updateWeGroupCode(weGroupCode)); weGroupCodeService.updateWeGroupCode(weGroupCode);
}
/** return AjaxResult.success();
* 删除客户群活码
*/
@PreAuthorize("@ss.hasPermi('wecom:code:remove')")
@Log(title = "客户群活码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(weGroupCodeService.deleteWeGroupCodeByIds(ids));
} }
// /**
// * 删除客户群活码
// */
// @PreAuthorize("@ss.hasPermi('wecom:code:remove')")
// @Log(title = "客户群活码", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(weGroupCodeService.deleteWeGroupCodeByIds(ids));
// }
} }
...@@ -6,9 +6,11 @@ import com.linkwechat.common.core.domain.AjaxResult; ...@@ -6,9 +6,11 @@ import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeMaterial; import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.ResetCategoryDto;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO; import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
import com.linkwechat.wecom.service.IWeMaterialService; import com.linkwechat.wecom.service.IWeMaterialService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -35,9 +37,10 @@ public class WeMaterialController extends BaseController { ...@@ -35,9 +37,10 @@ public class WeMaterialController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('wecom:material:list')") @PreAuthorize("@ss.hasPermi('wecom:material:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(@RequestParam(value = "categoryId", required = false) String categoryId, @RequestParam(value = "search", required = false) String search) { public TableDataInfo list(@RequestParam(value = "categoryId", required = false) String categoryId
, @RequestParam(value = "search", required = false) String search,@RequestParam(value = "mediaType") String mediaType) {
startPage(); startPage();
List<WeMaterial> list = materialService.findWeMaterials(categoryId, search); List<WeMaterial> list = materialService.findWeMaterials(categoryId, search,mediaType);
return getDataTable(list); return getDataTable(list);
} }
...@@ -91,9 +94,22 @@ public class WeMaterialController extends BaseController { ...@@ -91,9 +94,22 @@ public class WeMaterialController extends BaseController {
@Log(title = "上传素材信息", businessType = BusinessType.OTHER) @Log(title = "上传素材信息", businessType = BusinessType.OTHER)
@PostMapping("/upload") @PostMapping("/upload")
@ApiOperation("上传素材信息") @ApiOperation("上传素材信息")
public AjaxResult upload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "type") String type) { public AjaxResult upload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "mediaType") String mediaType) {
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, type); WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, mediaType);
return AjaxResult.success(weMaterialFileVO); return AjaxResult.success(weMaterialFileVO);
} }
/**
* 更换分组
*/
@PreAuthorize("@ss.hasPermi('wechat:material:resetCategory')")
@Log(title = "更换分组", businessType = BusinessType.OTHER)
@PutMapping("/resetCategory")
@ApiOperation("更换分组")
public AjaxResult resetCategory(@RequestBody ResetCategoryDto resetCategoryDto) {
materialService.resetCategory(resetCategoryDto.getCategoryId(), resetCategoryDto.getMaterials());
return AjaxResult.success();
}
} }
...@@ -17,7 +17,7 @@ public class Tree<T> { ...@@ -17,7 +17,7 @@ public class Tree<T> {
* 名称 * 名称
*/ */
@ApiModelProperty(name = "label", value = "名称") @ApiModelProperty(name = "label", value = "名称")
private String label; private String name;
/** /**
* 父的叶子信息 * 父的叶子信息
......
...@@ -19,8 +19,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -19,8 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileUploadUtils public class FileUploadUtils {
{
/** /**
* 默认大小 50M * 默认大小 50M
*/ */
...@@ -36,13 +35,11 @@ public class FileUploadUtils ...@@ -36,13 +35,11 @@ public class FileUploadUtils
*/ */
private static String defaultBaseDir = RuoYiConfig.getProfile(); private static String defaultBaseDir = RuoYiConfig.getProfile();
public static void setDefaultBaseDir(String defaultBaseDir) public static void setDefaultBaseDir(String defaultBaseDir) {
{
FileUploadUtils.defaultBaseDir = defaultBaseDir; FileUploadUtils.defaultBaseDir = defaultBaseDir;
} }
public static String getDefaultBaseDir() public static String getDefaultBaseDir() {
{
return defaultBaseDir; return defaultBaseDir;
} }
...@@ -53,14 +50,26 @@ public class FileUploadUtils ...@@ -53,14 +50,26 @@ public class FileUploadUtils
* @return 文件名称 * @return 文件名称
* @throws Exception * @throws Exception
*/ */
public static final String upload(MultipartFile file) throws IOException public static final String upload(MultipartFile file) throws IOException {
{ try {
try
{
return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (Exception e) {
throw new IOException(e.getMessage(), e);
} }
catch (Exception e) }
{
/**
* 以默认配置进行文件上传
*
* @param file 上传的文件
* @return 文件名称
* @throws Exception
*/
public static final String uploadFile(MultipartFile file) throws IOException {
try {
return uploadFile(getDefaultBaseDir(), file);
} catch (Exception e) {
throw new IOException(e.getMessage(), e); throw new IOException(e.getMessage(), e);
} }
} }
...@@ -69,18 +78,14 @@ public class FileUploadUtils ...@@ -69,18 +78,14 @@ public class FileUploadUtils
* 根据文件路径上传 * 根据文件路径上传
* *
* @param baseDir 相对应用的基目录 * @param baseDir 相对应用的基目录
* @param file 上传的文件 * @param file 上传的文件
* @return 文件名称 * @return 文件名称
* @throws IOException * @throws IOException
*/ */
public static final String upload(String baseDir, MultipartFile file) throws IOException public static final String upload(String baseDir, MultipartFile file) throws IOException {
{ try {
try
{
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} } catch (Exception e) {
catch (Exception e)
{
throw new IOException(e.getMessage(), e); throw new IOException(e.getMessage(), e);
} }
} }
...@@ -88,22 +93,20 @@ public class FileUploadUtils ...@@ -88,22 +93,20 @@ public class FileUploadUtils
/** /**
* 文件上传 * 文件上传
* *
* @param baseDir 相对应用的基目录 * @param baseDir 相对应用的基目录
* @param file 上传的文件 * @param file 上传的文件
* @param allowedExtension 上传文件类型 * @param allowedExtension 上传文件类型
* @return 返回上传成功的文件名 * @return 返回上传成功的文件名
* @throws FileSizeLimitExceededException 如果超出最大大小 * @throws FileSizeLimitExceededException 如果超出最大大小
* @throws FileNameLengthLimitExceededException 文件名太长 * @throws FileNameLengthLimitExceededException 文件名太长
* @throws IOException 比如读写文件出错时 * @throws IOException 比如读写文件出错时
* @throws InvalidExtensionException 文件校验异常 * @throws InvalidExtensionException 文件校验异常
*/ */
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException InvalidExtensionException {
{
int fileNamelength = file.getOriginalFilename().length(); int fileNamelength = file.getOriginalFilename().length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
{
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
} }
...@@ -117,34 +120,45 @@ public class FileUploadUtils ...@@ -117,34 +120,45 @@ public class FileUploadUtils
return pathFileName; return pathFileName;
} }
public static final String uploadFile(String baseDir, MultipartFile file)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException {
int fileNamelength = file.getOriginalFilename().length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
}
String fileName = extractFilename(file);
File desc = getAbsoluteFile(baseDir, fileName);
file.transferTo(desc);
String pathFileName = getPathFileName(baseDir, fileName);
return pathFileName;
}
/** /**
* 编码文件名 * 编码文件名
*/ */
public static final String extractFilename(MultipartFile file) public static final String extractFilename(MultipartFile file) {
{
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String extension = getExtension(file); String extension = getExtension(file);
fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
return fileName; return fileName;
} }
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
{
File desc = new File(uploadDir + File.separator + fileName); File desc = new File(uploadDir + File.separator + fileName);
if (!desc.getParentFile().exists()) if (!desc.getParentFile().exists()) {
{
desc.getParentFile().mkdirs(); desc.getParentFile().mkdirs();
} }
if (!desc.exists()) if (!desc.exists()) {
{
desc.createNewFile(); desc.createNewFile();
} }
return desc; return desc;
} }
private static final String getPathFileName(String uploadDir, String fileName) throws IOException private static final String getPathFileName(String uploadDir, String fileName) throws IOException {
{
int dirLastIndex = RuoYiConfig.getProfile().length() + 1; int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex); String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
...@@ -160,35 +174,25 @@ public class FileUploadUtils ...@@ -160,35 +174,25 @@ public class FileUploadUtils
* @throws InvalidExtensionException * @throws InvalidExtensionException
*/ */
public static final void assertAllowed(MultipartFile file, String[] allowedExtension) public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException throws FileSizeLimitExceededException, InvalidExtensionException {
{
long size = file.getSize(); long size = file.getSize();
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) {
{
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
} }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String extension = getExtension(file); String extension = getExtension(file);
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
{ if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
{
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
fileName); fileName);
} } else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
{
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
fileName); fileName);
} } else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
{
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
fileName); fileName);
} } else {
else
{
throw new InvalidExtensionException(allowedExtension, extension, fileName); throw new InvalidExtensionException(allowedExtension, extension, fileName);
} }
} }
...@@ -202,12 +206,9 @@ public class FileUploadUtils ...@@ -202,12 +206,9 @@ public class FileUploadUtils
* @param allowedExtension * @param allowedExtension
* @return * @return
*/ */
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
{ for (String str : allowedExtension) {
for (String str : allowedExtension) if (str.equalsIgnoreCase(extension)) {
{
if (str.equalsIgnoreCase(extension))
{
return true; return true;
} }
} }
...@@ -220,11 +221,9 @@ public class FileUploadUtils ...@@ -220,11 +221,9 @@ public class FileUploadUtils
* @param file 表单文件 * @param file 表单文件
* @return 后缀名 * @return 后缀名
*/ */
public static final String getExtension(MultipartFile file) public static final String getExtension(MultipartFile file) {
{
String extension = FilenameUtils.getExtension(file.getOriginalFilename()); String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension)) if (StringUtils.isEmpty(extension)) {
{
extension = MimeTypeUtils.getExtension(file.getContentType()); extension = MimeTypeUtils.getExtension(file.getContentType());
} }
return extension; return extension;
......
...@@ -32,7 +32,7 @@ public class MimeTypeUtils ...@@ -32,7 +32,7 @@ public class MimeTypeUtils
// 压缩文件 // 压缩文件
"rar", "zip", "gz", "bz2", "rar", "zip", "gz", "bz2",
// pdf // pdf
"pdf" }; "pdf" ,"wav","amr","mp4"};
public static String getExtension(String prefix) public static String getExtension(String prefix)
{ {
......
...@@ -26,7 +26,7 @@ public class WeAllocateGroup ...@@ -26,7 +26,7 @@ public class WeAllocateGroup
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
private Long id= SnowFlakeUtil.nextId();; private Long id= SnowFlakeUtil.nextId();
/** 分配的群id */ /** 分配的群id */
private String chatId; private String chatId;
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Data; import lombok.Data;
...@@ -14,7 +16,8 @@ import java.util.List; ...@@ -14,7 +16,8 @@ import java.util.List;
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Data @Data
public class WeEmpleCode extends BaseEntity @TableName("we_emple_code")
public class WeEmpleCode
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -34,6 +37,7 @@ public class WeEmpleCode extends BaseEntity ...@@ -34,6 +37,7 @@ public class WeEmpleCode extends BaseEntity
private String welcomeMsg; private String welcomeMsg;
/** 素材的id */ /** 素材的id */
@TableField(exist = false)
private Long mediaId; private Long mediaId;
/** 0:正常;1:删除; */ /** 0:正常;1:删除; */
...@@ -41,10 +45,12 @@ public class WeEmpleCode extends BaseEntity ...@@ -41,10 +45,12 @@ public class WeEmpleCode extends BaseEntity
/** 使用员工 */ /** 使用员工 */
@TableField(exist = false)
private List<WeEmpleCodeUseScop> weEmpleCodeUseScops; private List<WeEmpleCodeUseScop> weEmpleCodeUseScops;
/** 扫码标签 */ /** 扫码标签 */
@TableField(exist = false)
private List<WeEmpleCodeTag> weEmpleCodeTags; private List<WeEmpleCodeTag> weEmpleCodeTags;
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Data; import lombok.Data;
...@@ -12,11 +15,13 @@ import lombok.Data; ...@@ -12,11 +15,13 @@ import lombok.Data;
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Data @Data
public class WeEmpleCodeTag extends BaseEntity @TableName("we_emple_code_tag")
public class WeEmpleCodeTag
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
@TableId
private Long id= SnowFlakeUtil.nextId(); private Long id= SnowFlakeUtil.nextId();
/** 标签id */ /** 标签id */
...@@ -29,6 +34,7 @@ public class WeEmpleCodeTag extends BaseEntity ...@@ -29,6 +34,7 @@ public class WeEmpleCodeTag extends BaseEntity
private Integer delFlag=new Integer(0); private Integer delFlag=new Integer(0);
/** 标签名 */ /** 标签名 */
@TableField(exist = false)
private String tagName; private String tagName;
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* 员工活码使用人对象 we_emple_code_use_scop * 员工活码使用人对象 we_emple_code_use_scop
...@@ -12,23 +17,27 @@ import lombok.Data; ...@@ -12,23 +17,27 @@ import lombok.Data;
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Data @Data
public class WeEmpleCodeUseScop extends BaseEntity @TableName("we_emple_code_use_scop")
public class WeEmpleCodeUseScop
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
@TableId
private Long id = SnowFlakeUtil.nextId(); private Long id = SnowFlakeUtil.nextId();
/** 员工活码id */ /** 员工活码id */
private Long empleCodeId; private Long empleCodeId;
/** 活码类型下业务使用人的id */ /** 活码类型下业务使用人的id */
private Long useUserId; private Long businessId;
/** 0:正常;2:删除; */ /** 0:正常;2:删除; */
private Integer delFlag=new Integer(0); private Integer delFlag=new Integer(0);
/** 活码使用人员名称 */ /** 活码使用人员名称 */
@TableField(exist = false)
private String userUserName; private String userUserName;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
...@@ -12,12 +17,14 @@ import lombok.Data; ...@@ -12,12 +17,14 @@ import lombok.Data;
* @date 2020-10-07 * @date 2020-10-07
*/ */
@Data @Data
public class WeGroupCode extends BaseEntity @TableName("we_group_code")
public class WeGroupCode
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
private Long id; @TableId
private Long id= SnowFlakeUtil.nextId();
/** 活动头像 */ /** 活动头像 */
private String activityHeadUrl; private String activityHeadUrl;
...@@ -43,4 +50,8 @@ public class WeGroupCode extends BaseEntity ...@@ -43,4 +50,8 @@ public class WeGroupCode extends BaseEntity
/** 0:正常;2:删除; */ /** 0:正常;2:删除; */
private Long delFlag; private Long delFlag;
@TableField(exist = false)
private List<WeGroupCodeActual> actualList;
} }
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Data;
/** /**
...@@ -11,12 +16,15 @@ import com.linkwechat.common.core.domain.BaseEntity; ...@@ -11,12 +16,15 @@ import com.linkwechat.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
public class WeGroupCodeActual extends BaseEntity @Data
@TableName("we_group_code_actual")
public class WeGroupCodeActual
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
private Long id; @TableId
private Long id=SnowFlakeUtil.nextId();
/** 实际群码 */ /** 实际群码 */
private String actualGroupQrCode; private String actualGroupQrCode;
......
...@@ -46,4 +46,9 @@ public class WeMaterial extends BaseEntity { ...@@ -46,4 +46,9 @@ public class WeMaterial extends BaseEntity {
*/ */
private String coverUrl; private String coverUrl;
/**
* 音频时长
*/
private String audioTime;
} }
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
/**
* 更换分组传输对象
*/
@Data
public class ResetCategoryDto {
/**
*类目id
*/
private String categoryId;
/**
* 素材id列表,通过逗号拼接
*/
private String materials;
}
...@@ -66,8 +66,8 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer> ...@@ -66,8 +66,8 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
/** /**
* 根据员工ID获取客户 * 根据员工ID获取客户
* @param userId * @param externalUserid
* @return * @return
*/ */
public List<WeUser> getCustomersByUserId(@Param("userId") String userId); public List<WeUser> getCustomersByUserId(@Param("externalUserid") String externalUserid);
} }
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -10,7 +12,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -10,7 +12,7 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
public interface WeEmpleCodeMapper public interface WeEmpleCodeMapper extends BaseMapper<WeEmpleCode>
{ {
/** /**
* 查询员工活码 * 查询员工活码
......
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeEmpleCodeTag; import com.linkwechat.wecom.domain.WeEmpleCodeTag;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -10,7 +12,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -10,7 +12,7 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
public interface WeEmpleCodeTagMapper public interface WeEmpleCodeTagMapper extends BaseMapper<WeEmpleCodeTag>
{ {
/** /**
* 查询员工活码标签 * 查询员工活码标签
......
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeEmpleCodeUseScop; import com.linkwechat.wecom.domain.WeEmpleCodeUseScop;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -11,7 +12,7 @@ import java.util.List; ...@@ -11,7 +12,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
public interface WeEmpleCodeUseScopMapper public interface WeEmpleCodeUseScopMapper extends BaseMapper<WeEmpleCodeUseScop>
{ {
/** /**
* 查询员工活码使用人 * 查询员工活码使用人
......
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeGroupCodeActual; import com.linkwechat.wecom.domain.WeGroupCodeActual;
/** /**
...@@ -9,7 +11,7 @@ import com.linkwechat.wecom.domain.WeGroupCodeActual; ...@@ -9,7 +11,7 @@ import com.linkwechat.wecom.domain.WeGroupCodeActual;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
public interface WeGroupCodeActualMapper public interface WeGroupCodeActualMapper extends BaseMapper<WeGroupCodeActual>
{ {
/** /**
* 查询实际群码 * 查询实际群码
......
package com.linkwechat.wecom.mapper; package com.linkwechat.wecom.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeGroupCode; import com.linkwechat.wecom.domain.WeGroupCode;
/** /**
...@@ -9,7 +11,7 @@ import com.linkwechat.wecom.domain.WeGroupCode; ...@@ -9,7 +11,7 @@ import com.linkwechat.wecom.domain.WeGroupCode;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
public interface WeGroupCodeMapper public interface WeGroupCodeMapper extends BaseMapper<WeGroupCode>
{ {
/** /**
* 查询客户群活码 * 查询客户群活码
......
...@@ -59,8 +59,19 @@ public interface WeMaterialMapper { ...@@ -59,8 +59,19 @@ public interface WeMaterialMapper {
* *
* @param categoryId 类目id * @param categoryId 类目id
* @param search 搜索值 * @param search 搜索值
* @param mediaType 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本
* @return {@link WeMaterial}s * @return {@link WeMaterial}s
*/ */
List<WeMaterial> findWeMaterials(@Param("categoryId") String categoryId, @Param("search") String search); List<WeMaterial> findWeMaterials(@Param("categoryId") String categoryId, @Param("search") String search, @Param("mediaType") String mediaType);
/**
* 更换分组
*
* @param categoryId 类目id
* @param material 素材id
* @return int
*/
int resetCategory(@Param("categoryId") String categoryId, @Param("material") String material);
} }
...@@ -72,8 +72,8 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -72,8 +72,8 @@ public interface IWeCustomerService extends IService<WeCustomer>
/** /**
* 根据员工ID获取客户 * 根据员工ID获取客户
* @param userId * @param externalUserid
* @return * @return
*/ */
public List<WeUser> getCustomersByUserId(String userId); public List<WeUser> getCustomersByUserId(String externalUserid);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import java.util.List; import java.util.List;
...@@ -10,19 +11,19 @@ import java.util.List; ...@@ -10,19 +11,19 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
public interface IWeEmpleCodeService public interface IWeEmpleCodeService extends IService<WeEmpleCode>
{ {
/** // /**
* 查询员工活码 // * 查询员工活码
* // *
* @param id 员工活码ID // * @param id 员工活码ID
* @return 员工活码 // * @return 员工活码
*/ // */
public WeEmpleCode selectWeEmpleCodeById(Long id); // public WeEmpleCode selectWeEmpleCodeById(Long id);
//
/** /**
* 查询员工活码列表 * 查询员工活码列表
* *
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 员工活码集合 * @return 员工活码集合
*/ */
...@@ -34,7 +35,7 @@ public interface IWeEmpleCodeService ...@@ -34,7 +35,7 @@ public interface IWeEmpleCodeService
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public int insertWeEmpleCode(WeEmpleCode weEmpleCode); public void insertWeEmpleCode(WeEmpleCode weEmpleCode);
/** /**
* 修改员工活码 * 修改员工活码
...@@ -42,33 +43,33 @@ public interface IWeEmpleCodeService ...@@ -42,33 +43,33 @@ public interface IWeEmpleCodeService
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 结果 * @return 结果
*/ */
public int updateWeEmpleCode(WeEmpleCode weEmpleCode); public void updateWeEmpleCode(WeEmpleCode weEmpleCode);
/**
* 批量删除员工活码
*
* @param ids 需要删除的员工活码ID
* @return 结果
*/
public int deleteWeEmpleCodeByIds(Long[] ids);
/** // /**
* 删除员工活码信息 // * 批量删除员工活码
* // *
* @param id 员工活码ID // * @param ids 需要删除的员工活码ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeEmpleCodeById(Long id); // public int deleteWeEmpleCodeByIds(Long[] ids);
//
// /**
// * 删除员工活码信息
/** // *
* 批量逻辑删除员工活码 // * @param id 员工活码ID
* // * @return 结果
* @param ids 需要删除的数据ID // */
* @return 结果 // public int deleteWeEmpleCodeById(Long id);
*/ //
public int batchRemoveWeEmpleCodeIds(List<String> ids); //
//
// /**
// * 批量逻辑删除员工活码
// *
// * @param ids 需要删除的数据ID
// * @return 结果
// */
// public int batchRemoveWeEmpleCodeIds(List<String> ids);
......
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeEmpleCodeTag; import com.linkwechat.wecom.domain.WeEmpleCodeTag;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -11,68 +12,68 @@ import java.util.List; ...@@ -11,68 +12,68 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
public interface IWeEmpleCodeTagService public interface IWeEmpleCodeTagService extends IService<WeEmpleCodeTag>
{ {
/** // /**
* 查询员工活码标签 // * 查询员工活码标签
* // *
* @param id 员工活码标签ID // * @param id 员工活码标签ID
* @return 员工活码标签 // * @return 员工活码标签
*/ // */
public WeEmpleCodeTag selectWeEmpleCodeTagById(Long id); // public WeEmpleCodeTag selectWeEmpleCodeTagById(Long id);
//
/** // /**
* 查询员工活码标签列表 // * 查询员工活码标签列表
* // *
* @param empleCodeId 员工活码id // * @param empleCodeId 员工活码id
* @return 员工活码标签集合 // * @return 员工活码标签集合
*/ // */
public List<WeEmpleCodeTag> selectWeEmpleCodeTagListById(Long empleCodeId); // public List<WeEmpleCodeTag> selectWeEmpleCodeTagListById(Long empleCodeId);
//
/** // /**
* 新增员工活码标签 // * 新增员工活码标签
* // *
* @param weEmpleCodeTag 员工活码标签 // * @param weEmpleCodeTag 员工活码标签
* @return 结果 // * @return 结果
*/ // */
public int insertWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag); // public int insertWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag);
//
/** // /**
* 修改员工活码标签 // * 修改员工活码标签
* // *
* @param weEmpleCodeTag 员工活码标签 // * @param weEmpleCodeTag 员工活码标签
* @return 结果 // * @return 结果
*/ // */
public int updateWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag); // public int updateWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag);
//
/** // /**
* 批量删除员工活码标签 // * 批量删除员工活码标签
* // *
* @param ids 需要删除的员工活码标签ID // * @param ids 需要删除的员工活码标签ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeEmpleCodeTagByIds(Long[] ids); // public int deleteWeEmpleCodeTagByIds(Long[] ids);
//
/** // /**
* 删除员工活码标签信息 // * 删除员工活码标签信息
* // *
* @param id 员工活码标签ID // * @param id 员工活码标签ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeEmpleCodeTagById(Long id); // public int deleteWeEmpleCodeTagById(Long id);
//
/** // /**
* 批量保存标签 // * 批量保存标签
* @param weEmpleCodeTags // * @param weEmpleCodeTags
* @return // * @return
*/ // */
public int batchInsetWeEmpleCodeTag(List<WeEmpleCodeTag> weEmpleCodeTags); // public int batchInsetWeEmpleCodeTag(List<WeEmpleCodeTag> weEmpleCodeTags);
//
//
/** // /**
* 批量逻辑删除 // * 批量逻辑删除
* @param ids // * @param ids
* @return // * @return
*/ // */
public int batchRemoveWeEmpleCodeTagIds(List<Long> ids); // public int batchRemoveWeEmpleCodeTagIds(List<Long> ids);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeEmpleCodeUseScop; import com.linkwechat.wecom.domain.WeEmpleCodeUseScop;
/** /**
...@@ -9,68 +11,68 @@ import com.linkwechat.wecom.domain.WeEmpleCodeUseScop; ...@@ -9,68 +11,68 @@ import com.linkwechat.wecom.domain.WeEmpleCodeUseScop;
* @author ruoyi * @author ruoyi
* @date 2020-10-04 * @date 2020-10-04
*/ */
public interface IWeEmpleCodeUseScopService public interface IWeEmpleCodeUseScopService extends IService<WeEmpleCodeUseScop>
{ {
/** // /**
* 查询员工活码使用人 // * 查询员工活码使用人
* // *
* @param id 员工活码使用人ID // * @param id 员工活码使用人ID
* @return 员工活码使用人 // * @return 员工活码使用人
*/ // */
public WeEmpleCodeUseScop selectWeEmpleCodeUseScopById(Long id); // public WeEmpleCodeUseScop selectWeEmpleCodeUseScopById(Long id);
//
/** // /**
* 查询员工活码使用人列表 // * 查询员工活码使用人列表
* // *
* @param empleCodeId // * @param empleCodeId
* @return 员工活码使用人集合 // * @return 员工活码使用人集合
*/ // */
public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListById(Long empleCodeId); // public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListById(Long empleCodeId);
//
/** // /**
* 新增员工活码使用人 // * 新增员工活码使用人
* // *
* @param weEmpleCodeUseScop 员工活码使用人 // * @param weEmpleCodeUseScop 员工活码使用人
* @return 结果 // * @return 结果
*/ // */
public int insertWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop); // public int insertWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop);
//
/** // /**
* 修改员工活码使用人 // * 修改员工活码使用人
* // *
* @param weEmpleCodeUseScop 员工活码使用人 // * @param weEmpleCodeUseScop 员工活码使用人
* @return 结果 // * @return 结果
*/ // */
public int updateWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop); // public int updateWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop);
//
/** // /**
* 批量删除员工活码使用人 // * 批量删除员工活码使用人
* // *
* @param ids 需要删除的员工活码使用人ID // * @param ids 需要删除的员工活码使用人ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeEmpleCodeUseScopByIds(Long[] ids); // public int deleteWeEmpleCodeUseScopByIds(Long[] ids);
//
/** // /**
* 删除员工活码使用人信息 // * 删除员工活码使用人信息
* // *
* @param id 员工活码使用人ID // * @param id 员工活码使用人ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeEmpleCodeUseScopById(Long id); // public int deleteWeEmpleCodeUseScopById(Long id);
//
/** // /**
* 批量保存 // * 批量保存
* @param weEmpleCodeUseScops // * @param weEmpleCodeUseScops
* @return // * @return
*/ // */
public int batchInsetWeEmpleCodeUseScop(List<WeEmpleCodeUseScop> weEmpleCodeUseScops); // public int batchInsetWeEmpleCodeUseScop(List<WeEmpleCodeUseScop> weEmpleCodeUseScops);
//
//
/** // /**
* 批量物理删除 // * 批量物理删除
* @param ids // * @param ids
* @return // * @return
*/ // */
public int batchRemoveWeEmpleCodeUseScopIds(List<Long> ids); // public int batchRemoveWeEmpleCodeUseScopIds(List<Long> ids);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import java.util.List; import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeGroupCodeActual; import com.linkwechat.wecom.domain.WeGroupCodeActual;
/** /**
...@@ -9,53 +9,53 @@ import com.linkwechat.wecom.domain.WeGroupCodeActual; ...@@ -9,53 +9,53 @@ import com.linkwechat.wecom.domain.WeGroupCodeActual;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
public interface IWeGroupCodeActualService public interface IWeGroupCodeActualService extends IService<WeGroupCodeActual>
{ {
/** // /**
* 查询实际群码 // * 查询实际群码
* // *
* @param id 实际群码ID // * @param id 实际群码ID
* @return 实际群码 // * @return 实际群码
*/ // */
public WeGroupCodeActual selectWeGroupCodeActualById(Long id); // public WeGroupCodeActual selectWeGroupCodeActualById(Long id);
//
// /**
// * 查询实际群码列表
// *
// * @param weGroupCodeActual 实际群码
// * @return 实际群码集合
// */
// public List<WeGroupCodeActual> selectWeGroupCodeActualList(WeGroupCodeActual weGroupCodeActual);
/** // /**
* 查询实际群码列表 // * 新增实际群码
* // *
* @param weGroupCodeActual 实际群码 // * @param weGroupCodeActual 实际群码
* @return 实际群码集合 // * @return 结果
*/ // */
public List<WeGroupCodeActual> selectWeGroupCodeActualList(WeGroupCodeActual weGroupCodeActual); // public int insertWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual);
//
// /**
// * 修改实际群码
// *
// * @param weGroupCodeActual 实际群码
// * @return 结果
// */
// public int updateWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual);
/** // /**
* 新增实际群码 // * 批量删除实际群码
* // *
* @param weGroupCodeActual 实际群码 // * @param ids 需要删除的实际群码ID
* @return 结果 // * @return 结果
*/ // */
public int insertWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual); // public int deleteWeGroupCodeActualByIds(Long[] ids);
//
/** // /**
* 修改实际群码 // * 删除实际群码信息
* // *
* @param weGroupCodeActual 实际群码 // * @param id 实际群码ID
* @return 结果 // * @return 结果
*/ // */
public int updateWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual); // public int deleteWeGroupCodeActualById(Long id);
/**
* 批量删除实际群码
*
* @param ids 需要删除的实际群码ID
* @return 结果
*/
public int deleteWeGroupCodeActualByIds(Long[] ids);
/**
* 删除实际群码信息
*
* @param id 实际群码ID
* @return 结果
*/
public int deleteWeGroupCodeActualById(Long id);
} }
package com.linkwechat.wecom.service; package com.linkwechat.wecom.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeGroupCode; import com.linkwechat.wecom.domain.WeGroupCode;
/** /**
...@@ -9,23 +11,23 @@ import com.linkwechat.wecom.domain.WeGroupCode; ...@@ -9,23 +11,23 @@ import com.linkwechat.wecom.domain.WeGroupCode;
* @author ruoyi * @author ruoyi
* @date 2020-10-07 * @date 2020-10-07
*/ */
public interface IWeGroupCodeService public interface IWeGroupCodeService extends IService<WeGroupCode>
{ {
/** // /**
* 查询客户群活码 // * 查询客户群活码
* // *
* @param id 客户群活码ID // * @param id 客户群活码ID
* @return 客户群活码 // * @return 客户群活码
*/ // */
public WeGroupCode selectWeGroupCodeById(Long id); // public WeGroupCode selectWeGroupCodeById(Long id);
//
/** // /**
* 查询客户群活码列表 // * 查询客户群活码列表
* // *
* @param weGroupCode 客户群活码 // * @param weGroupCode 客户群活码
* @return 客户群活码集合 // * @return 客户群活码集合
*/ // */
public List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode); // public List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode);
/** /**
* 新增客户群活码 * 新增客户群活码
...@@ -33,7 +35,7 @@ public interface IWeGroupCodeService ...@@ -33,7 +35,7 @@ public interface IWeGroupCodeService
* @param weGroupCode 客户群活码 * @param weGroupCode 客户群活码
* @return 结果 * @return 结果
*/ */
public int insertWeGroupCode(WeGroupCode weGroupCode); public void insertWeGroupCode(WeGroupCode weGroupCode);
/** /**
* 修改客户群活码 * 修改客户群活码
...@@ -41,21 +43,21 @@ public interface IWeGroupCodeService ...@@ -41,21 +43,21 @@ public interface IWeGroupCodeService
* @param weGroupCode 客户群活码 * @param weGroupCode 客户群活码
* @return 结果 * @return 结果
*/ */
public int updateWeGroupCode(WeGroupCode weGroupCode); public void updateWeGroupCode(WeGroupCode weGroupCode);
/** // /**
* 批量删除客户群活码 // * 批量删除客户群活码
* // *
* @param ids 需要删除的客户群活码ID // * @param ids 需要删除的客户群活码ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeGroupCodeByIds(Long[] ids); // public int deleteWeGroupCodeByIds(Long[] ids);
//
/** // /**
* 删除客户群活码信息 // * 删除客户群活码信息
* // *
* @param id 客户群活码ID // * @param id 客户群活码ID
* @return 结果 // * @return 结果
*/ // */
public int deleteWeGroupCodeById(Long id); // public int deleteWeGroupCodeById(Long id);
} }
...@@ -2,6 +2,8 @@ package com.linkwechat.wecom.service; ...@@ -2,6 +2,8 @@ package com.linkwechat.wecom.service;
import com.linkwechat.wecom.domain.WeMaterial; import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO; import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
...@@ -70,6 +72,15 @@ public interface IWeMaterialService { ...@@ -70,6 +72,15 @@ public interface IWeMaterialService {
* @param search 搜索值 * @param search 搜索值
* @return {@link WeMaterial}s * @return {@link WeMaterial}s
*/ */
List<WeMaterial> findWeMaterials(String categoryId, String search); List<WeMaterial> findWeMaterials(String categoryId, String search,String mediaType);
/**
* 更换分组
*
* @param categoryId 类目id
* @param materials 素材id
* @return int
*/
void resetCategory(String categoryId, String materials);
} }
...@@ -63,7 +63,7 @@ public class WeCategoryServiceImpl implements IWeCategoryService { ...@@ -63,7 +63,7 @@ public class WeCategoryServiceImpl implements IWeCategoryService {
weCategories.forEach(c -> { weCategories.forEach(c -> {
WeCategoryVo weCategoryVo = new WeCategoryVo(); WeCategoryVo weCategoryVo = new WeCategoryVo();
weCategoryVo.setId(c.getId()); weCategoryVo.setId(c.getId());
weCategoryVo.setLabel(c.getName()); weCategoryVo.setName(c.getName());
weCategoryVo.setParentId(c.getParentId()); weCategoryVo.setParentId(c.getParentId());
weCategoryVos.add(weCategoryVo); weCategoryVos.add(weCategoryVo);
}); });
......
...@@ -463,12 +463,12 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -463,12 +463,12 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
/** /**
* 根据员工ID获取客户 * 根据员工ID获取客户
* *
* @param userId * @param externalUserid
* @return * @return
*/ */
@Override @Override
public List<WeUser> getCustomersByUserId(String userId) { public List<WeUser> getCustomersByUserId(String externalUserid) {
return this.baseMapper.getCustomersByUserId(userId); return this.baseMapper.getCustomersByUserId(externalUserid);
} }
......
...@@ -6,6 +6,7 @@ import java.util.stream.Collectors; ...@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.client.WeExternalContactClient; import com.linkwechat.wecom.client.WeExternalContactClient;
...@@ -29,10 +30,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -29,10 +30,10 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Service @Service
public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper,WeEmpleCode> implements IWeEmpleCodeService
{ {
@Autowired // @Autowired
private WeEmpleCodeMapper weEmpleCodeMapper; // private WeEmpleCodeMapper weEmpleCodeMapper;
@Autowired @Autowired
...@@ -43,41 +44,41 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService ...@@ -43,41 +44,41 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService
private IWeEmpleCodeUseScopService iWeEmpleCodeUseScopService; private IWeEmpleCodeUseScopService iWeEmpleCodeUseScopService;
@Autowired // @Autowired
private WeExternalContactClient weExternalContactClient; // private WeExternalContactClient weExternalContactClient;
/** // /**
* 查询员工活码 // * 查询员工活码
* // *
* @param id 员工活码ID // * @param id 员工活码ID
* @return 员工活码 // * @return 员工活码
*/ // */
@Override // @Override
public WeEmpleCode selectWeEmpleCodeById(Long id) // public WeEmpleCode selectWeEmpleCodeById(Long id)
{ // {
WeEmpleCode weEmpleCode = weEmpleCodeMapper.selectWeEmpleCodeById(id); //// WeEmpleCode weEmpleCode = weEmpleCodeMapper.selectWeEmpleCodeById(id);
if(null != weEmpleCode){ //// if(null != weEmpleCode){
weEmpleCode.setWeEmpleCodeTags( //// weEmpleCode.setWeEmpleCodeTags(
weEmpleCodeTagService.selectWeEmpleCodeTagListById(id) //// weEmpleCodeTagService.selectWeEmpleCodeTagListById(id)
); //// );
weEmpleCode.setWeEmpleCodeUseScops( //// weEmpleCode.setWeEmpleCodeUseScops(
iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListById(id) //// iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListById(id)
); //// );
//
} //// }
return weEmpleCode; //// return weEmpleCode;
} // }
/** /**
* 查询员工活码列表 * 查询员工活码列表
* *
* @param weEmpleCode 员工活码 * @param weEmpleCode 员工活码
* @return 员工活码 * @return 员工活码
*/ */
@Override @Override
public List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode) public List<WeEmpleCode> selectWeEmpleCodeList(WeEmpleCode weEmpleCode)
{ {
return weEmpleCodeMapper.selectWeEmpleCodeList(weEmpleCode); return this.baseMapper.selectWeEmpleCodeList(weEmpleCode);
} }
/** /**
...@@ -87,72 +88,22 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService ...@@ -87,72 +88,22 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public int insertWeEmpleCode(WeEmpleCode weEmpleCode) public void insertWeEmpleCode(WeEmpleCode weEmpleCode)
{ {
int returnCode = weEmpleCodeMapper.insertWeEmpleCode(weEmpleCode);
if(returnCode>0){
List<WeEmpleCodeUseScop> weEmpleCodeUseScops = weEmpleCode.getWeEmpleCodeUseScops();
if(CollectionUtil.isNotEmpty(weEmpleCodeUseScops)){
weEmpleCodeUseScops.stream().forEach(v->v.setEmpleCodeId(weEmpleCode.getId()));
//批量保存使用员工
iWeEmpleCodeUseScopService.batchInsetWeEmpleCodeUseScop(weEmpleCodeUseScops);
// List<WeEmpleCodeTag> weEmpleCodeTags = weEmpleCode.getWeEmpleCodeTags().stream().filter(v->v.getTagId()!=null).collect(Collectors.toList());
// if(CollectionUtil.isNotEmpty(weEmpleCodeTags)){
// //批量保存标签
// weEmpleCodeTags.stream().forEach(v->v.setEmpleCodeId(weEmpleCode.getId()));
// weEmpleCodeTagService.batchInsetWeEmpleCodeTag(weEmpleCodeTags);
// }
if(!weEmpleCode.getCodeType().equals(WeConstans.BATCH_SINGLE_EMPLE_CODE_TYPE)){
//
WeExternalContactDto.WeContactWay weContactWay = new WeExternalContactDto.WeContactWay( weEmpleCode.getCodeType(),
WeConstans.SMALL_ROUTINE_EMPLE_CODE_SCENE,weEmpleCode.getIsJoinConfirmFriends());
if(weEmpleCode.getCodeType().equals(WeConstans.SINGLE_EMPLE_CODE_TYPE)){
weContactWay.setUser(
ArrayUtil.toArray(weEmpleCodeUseScops.stream().map(WeEmpleCodeUseScop::getUseUserId)
.map(x -> String.valueOf(x))
.collect(Collectors.toList()), String.class)
);//设置员工id
}else if(weEmpleCode.getCodeType().equals(WeConstans.SINGLE_EMPLE_CODE_TYPE)){
weContactWay.setParty(ArrayUtil.toArray(weEmpleCodeUseScops.stream().map(WeEmpleCodeUseScop::getUseUserId)
.collect(Collectors.toList()), Long.class)); //设置部门id
}
//生成员工活码
WeExternalContactDto weExternalContactDto = weExternalContactClient.addContactWay(
weContactWay
);
System.out.println(weExternalContactDto.toString());
// if(weExternalContactDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)){
// //二维码等数据入库
//
// }
}
}
if(this.save(weEmpleCode)){
List<WeEmpleCodeUseScop> weEmpleCodeUseScops = weEmpleCode.getWeEmpleCodeUseScops();
if(CollectionUtil.isNotEmpty(weEmpleCodeUseScops)){
iWeEmpleCodeUseScopService.saveBatch(weEmpleCodeUseScops);
//根据类型生成相应的活码农
}
weEmpleCodeTagService.saveBatch(weEmpleCode.getWeEmpleCodeTags());
}
}
return returnCode;
} }
/** /**
...@@ -162,69 +113,55 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService ...@@ -162,69 +113,55 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateWeEmpleCode(WeEmpleCode weEmpleCode) public void updateWeEmpleCode(WeEmpleCode weEmpleCode)
{ {
int returnCode = weEmpleCodeMapper.updateWeEmpleCode(weEmpleCode);
if(returnCode>0){
List<WeEmpleCodeTag> weEmpleCodeTags = weEmpleCode.getWeEmpleCodeTags();
if(CollectionUtil.isNotEmpty(weEmpleCodeTags)){
//删除原有的
weEmpleCodeTagService.batchRemoveWeEmpleCodeTagIds(ListUtil.toList(weEmpleCode.getId()));
//保存新的
weEmpleCodeTagService.batchInsetWeEmpleCodeTag(weEmpleCodeTags);
} if(this.updateById(weEmpleCode)){
List<WeEmpleCodeUseScop> weEmpleCodeUseScops = weEmpleCode.getWeEmpleCodeUseScops(); List<WeEmpleCodeUseScop> weEmpleCodeUseScops = weEmpleCode.getWeEmpleCodeUseScops();
if(CollectionUtil.isNotEmpty(weEmpleCodeUseScops)){ if(CollectionUtil.isNotEmpty(weEmpleCodeUseScops)){
//删除原有的 iWeEmpleCodeUseScopService.updateBatchById(weEmpleCodeUseScops);
iWeEmpleCodeUseScopService.batchRemoveWeEmpleCodeUseScopIds(ListUtil.toList(weEmpleCode.getId()));
//保存新的
iWeEmpleCodeUseScopService.batchInsetWeEmpleCodeUseScop(weEmpleCodeUseScops);
//根据类型生成相应的活码农
} }
weEmpleCodeTagService.updateBatchById(weEmpleCode.getWeEmpleCodeTags());
} }
return returnCode;
}
/**
* 批量删除员工活码
*
* @param ids 需要删除的员工活码ID
* @return 结果
*/
@Override
public int deleteWeEmpleCodeByIds(Long[] ids)
{
return weEmpleCodeMapper.deleteWeEmpleCodeByIds(ids);
}
/**
* 删除员工活码信息
*
* @param id 员工活码ID
* @return 结果
*/
@Override
public int deleteWeEmpleCodeById(Long id)
{
return weEmpleCodeMapper.deleteWeEmpleCodeById(id);
} }
// /**
/** // * 批量删除员工活码
* 批量逻辑删除员工活码 // *
* // * @param ids 需要删除的员工活码ID
* @param ids 需要删除的数据ID // * @return 结果
* @return 结果 // */
*/ // @Override
@Override // public int deleteWeEmpleCodeByIds(Long[] ids)
public int batchRemoveWeEmpleCodeIds(List<String> ids) { // {
// return weEmpleCodeMapper.deleteWeEmpleCodeByIds(ids);
return weEmpleCodeMapper.batchRemoveWeEmpleCodeIds(ids); // }
} //
// /**
// * 删除员工活码信息
// *
// * @param id 员工活码ID
// * @return 结果
// */
// @Override
// public int deleteWeEmpleCodeById(Long id)
// {
// return weEmpleCodeMapper.deleteWeEmpleCodeById(id);
// }
//
//
// /**
// * 批量逻辑删除员工活码
// *
// * @param ids 需要删除的数据ID
// * @return 结果
// */
// @Override
// public int batchRemoveWeEmpleCodeIds(List<String> ids) {
//
// return weEmpleCodeMapper.batchRemoveWeEmpleCodeIds(ids);
// }
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeEmpleCodeTagMapper; import com.linkwechat.wecom.mapper.WeEmpleCodeTagMapper;
...@@ -14,104 +16,104 @@ import com.linkwechat.wecom.service.IWeEmpleCodeTagService; ...@@ -14,104 +16,104 @@ import com.linkwechat.wecom.service.IWeEmpleCodeTagService;
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Service @Service
public class WeEmpleCodeTagServiceImpl implements IWeEmpleCodeTagService public class WeEmpleCodeTagServiceImpl extends ServiceImpl<WeEmpleCodeTagMapper,WeEmpleCodeTag> implements IWeEmpleCodeTagService
{ {
@Autowired // @Autowired
private WeEmpleCodeTagMapper weEmpleCodeTagMapper; // private WeEmpleCodeTagMapper weEmpleCodeTagMapper;
//
/** // /**
* 查询员工活码标签 // * 查询员工活码标签
* // *
* @param id 员工活码标签ID // * @param id 员工活码标签ID
* @return 员工活码标签 // * @return 员工活码标签
*/ // */
@Override // @Override
public WeEmpleCodeTag selectWeEmpleCodeTagById(Long id) // public WeEmpleCodeTag selectWeEmpleCodeTagById(Long id)
{ // {
return weEmpleCodeTagMapper.selectWeEmpleCodeTagById(id); // return weEmpleCodeTagMapper.selectWeEmpleCodeTagById(id);
} // }
//
/** // /**
* 查询员工活码标签列表 // * 查询员工活码标签列表
* // *
* @param empleCodeId 员工活码id // * @param empleCodeId 员工活码id
* @return 员工活码标签 // * @return 员工活码标签
*/ // */
@Override // @Override
public List<WeEmpleCodeTag> selectWeEmpleCodeTagListById(Long empleCodeId) // public List<WeEmpleCodeTag> selectWeEmpleCodeTagListById(Long empleCodeId)
{ // {
return weEmpleCodeTagMapper.selectWeEmpleCodeTagListById(empleCodeId); // return weEmpleCodeTagMapper.selectWeEmpleCodeTagListById(empleCodeId);
} // }
//
/** // /**
* 新增员工活码标签 // * 新增员工活码标签
* // *
* @param weEmpleCodeTag 员工活码标签 // * @param weEmpleCodeTag 员工活码标签
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int insertWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag) // public int insertWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag)
{ // {
return weEmpleCodeTagMapper.insertWeEmpleCodeTag(weEmpleCodeTag); // return weEmpleCodeTagMapper.insertWeEmpleCodeTag(weEmpleCodeTag);
} // }
//
/** // /**
* 修改员工活码标签 // * 修改员工活码标签
* // *
* @param weEmpleCodeTag 员工活码标签 // * @param weEmpleCodeTag 员工活码标签
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int updateWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag) // public int updateWeEmpleCodeTag(WeEmpleCodeTag weEmpleCodeTag)
{ // {
return weEmpleCodeTagMapper.updateWeEmpleCodeTag(weEmpleCodeTag); // return weEmpleCodeTagMapper.updateWeEmpleCodeTag(weEmpleCodeTag);
} // }
//
/** // /**
* 批量删除员工活码标签 // * 批量删除员工活码标签
* // *
* @param ids 需要删除的员工活码标签ID // * @param ids 需要删除的员工活码标签ID
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int deleteWeEmpleCodeTagByIds(Long[] ids) // public int deleteWeEmpleCodeTagByIds(Long[] ids)
{ // {
return weEmpleCodeTagMapper.deleteWeEmpleCodeTagByIds(ids); // return weEmpleCodeTagMapper.deleteWeEmpleCodeTagByIds(ids);
} // }
//
/** // /**
* 删除员工活码标签信息 // * 删除员工活码标签信息
* // *
* @param id 员工活码标签ID // * @param id 员工活码标签ID
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int deleteWeEmpleCodeTagById(Long id) // public int deleteWeEmpleCodeTagById(Long id)
{ // {
return weEmpleCodeTagMapper.deleteWeEmpleCodeTagById(id); // return weEmpleCodeTagMapper.deleteWeEmpleCodeTagById(id);
} // }
//
//
/** // /**
* 批量保存标签 // * 批量保存标签
* @param weEmpleCodeTags // * @param weEmpleCodeTags
* @return // * @return
*/ // */
@Override // @Override
public int batchInsetWeEmpleCodeTag(List<WeEmpleCodeTag> weEmpleCodeTags) { // public int batchInsetWeEmpleCodeTag(List<WeEmpleCodeTag> weEmpleCodeTags) {
return weEmpleCodeTagMapper.batchInsetWeEmpleCodeTag(weEmpleCodeTags); // return weEmpleCodeTagMapper.batchInsetWeEmpleCodeTag(weEmpleCodeTags);
} // }
//
//
//
//
/** // /**
* 批量逻辑删除 // * 批量逻辑删除
* @param ids // * @param ids
* @return // * @return
*/ // */
@Override // @Override
public int batchRemoveWeEmpleCodeTagIds(List<Long> ids) { // public int batchRemoveWeEmpleCodeTagIds(List<Long> ids) {
return weEmpleCodeTagMapper.batchRemoveWeEmpleCodeTagIds(ids); // return weEmpleCodeTagMapper.batchRemoveWeEmpleCodeTagIds(ids);
} // }
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeEmpleCodeUseScopMapper; import com.linkwechat.wecom.mapper.WeEmpleCodeUseScopMapper;
...@@ -14,101 +16,101 @@ import com.linkwechat.wecom.service.IWeEmpleCodeUseScopService; ...@@ -14,101 +16,101 @@ import com.linkwechat.wecom.service.IWeEmpleCodeUseScopService;
* @date 2020-10-04 * @date 2020-10-04
*/ */
@Service @Service
public class WeEmpleCodeUseScopServiceImpl implements IWeEmpleCodeUseScopService public class WeEmpleCodeUseScopServiceImpl extends ServiceImpl<WeEmpleCodeUseScopMapper,WeEmpleCodeUseScop> implements IWeEmpleCodeUseScopService
{ {
@Autowired // @Autowired
private WeEmpleCodeUseScopMapper weEmpleCodeUseScopMapper; // private WeEmpleCodeUseScopMapper weEmpleCodeUseScopMapper;
//
/** // /**
* 查询员工活码使用人 // * 查询员工活码使用人
* // *
* @param id 员工活码使用人ID // * @param id 员工活码使用人ID
* @return 员工活码使用人 // * @return 员工活码使用人
*/ // */
@Override // @Override
public WeEmpleCodeUseScop selectWeEmpleCodeUseScopById(Long id) // public WeEmpleCodeUseScop selectWeEmpleCodeUseScopById(Long id)
{ // {
return weEmpleCodeUseScopMapper.selectWeEmpleCodeUseScopById(id); // return weEmpleCodeUseScopMapper.selectWeEmpleCodeUseScopById(id);
} // }
//
/** // /**
* 查询员工活码使用人列表 // * 查询员工活码使用人列表
* // *
* @param empleCodeId // * @param empleCodeId
* @return 员工活码使用人 // * @return 员工活码使用人
*/ // */
@Override // @Override
public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListById( Long empleCodeId) // public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListById( Long empleCodeId)
{ // {
return weEmpleCodeUseScopMapper.selectWeEmpleCodeUseScopListById(empleCodeId); // return weEmpleCodeUseScopMapper.selectWeEmpleCodeUseScopListById(empleCodeId);
} // }
//
/** // /**
* 新增员工活码使用人 // * 新增员工活码使用人
* // *
* @param weEmpleCodeUseScop 员工活码使用人 // * @param weEmpleCodeUseScop 员工活码使用人
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int insertWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop) // public int insertWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop)
{ // {
return weEmpleCodeUseScopMapper.insertWeEmpleCodeUseScop(weEmpleCodeUseScop); // return weEmpleCodeUseScopMapper.insertWeEmpleCodeUseScop(weEmpleCodeUseScop);
} // }
//
/** // /**
* 修改员工活码使用人 // * 修改员工活码使用人
* // *
* @param weEmpleCodeUseScop 员工活码使用人 // * @param weEmpleCodeUseScop 员工活码使用人
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int updateWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop) // public int updateWeEmpleCodeUseScop(WeEmpleCodeUseScop weEmpleCodeUseScop)
{ // {
return weEmpleCodeUseScopMapper.updateWeEmpleCodeUseScop(weEmpleCodeUseScop); // return weEmpleCodeUseScopMapper.updateWeEmpleCodeUseScop(weEmpleCodeUseScop);
} // }
//
/** // /**
* 批量删除员工活码使用人 // * 批量删除员工活码使用人
* // *
* @param ids 需要删除的员工活码使用人ID // * @param ids 需要删除的员工活码使用人ID
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int deleteWeEmpleCodeUseScopByIds(Long[] ids) // public int deleteWeEmpleCodeUseScopByIds(Long[] ids)
{ // {
return weEmpleCodeUseScopMapper.deleteWeEmpleCodeUseScopByIds(ids); // return weEmpleCodeUseScopMapper.deleteWeEmpleCodeUseScopByIds(ids);
} // }
//
/** // /**
* 删除员工活码使用人信息 // * 删除员工活码使用人信息
* // *
* @param id 员工活码使用人ID // * @param id 员工活码使用人ID
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int deleteWeEmpleCodeUseScopById(Long id) // public int deleteWeEmpleCodeUseScopById(Long id)
{ // {
return weEmpleCodeUseScopMapper.deleteWeEmpleCodeUseScopById(id); // return weEmpleCodeUseScopMapper.deleteWeEmpleCodeUseScopById(id);
} // }
//
//
/** // /**
* 批量保存 // * 批量保存
* @param weEmpleCodeUseScops // * @param weEmpleCodeUseScops
* @return // * @return
*/ // */
@Override // @Override
public int batchInsetWeEmpleCodeUseScop(List<WeEmpleCodeUseScop> weEmpleCodeUseScops) { // public int batchInsetWeEmpleCodeUseScop(List<WeEmpleCodeUseScop> weEmpleCodeUseScops) {
return weEmpleCodeUseScopMapper.batchInsetWeEmpleCodeUseScop(weEmpleCodeUseScops); // return weEmpleCodeUseScopMapper.batchInsetWeEmpleCodeUseScop(weEmpleCodeUseScops);
} // }
//
/** // /**
* 批量物理删除 // * 批量物理删除
* @param ids // * @param ids
* @return // * @return
*/ // */
@Override // @Override
public int batchRemoveWeEmpleCodeUseScopIds(List<Long> ids) { // public int batchRemoveWeEmpleCodeUseScopIds(List<Long> ids) {
return weEmpleCodeUseScopMapper.batchRemoveWeEmpleCodeUseScopIds(ids); // return weEmpleCodeUseScopMapper.batchRemoveWeEmpleCodeUseScopIds(ids);
} // }
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeGroupCodeActualMapper; import com.linkwechat.wecom.mapper.WeGroupCodeActualMapper;
...@@ -14,80 +16,81 @@ import com.linkwechat.wecom.service.IWeGroupCodeActualService; ...@@ -14,80 +16,81 @@ import com.linkwechat.wecom.service.IWeGroupCodeActualService;
* @date 2020-10-07 * @date 2020-10-07
*/ */
@Service @Service
public class WeGroupCodeActualServiceImpl implements IWeGroupCodeActualService public class WeGroupCodeActualServiceImpl extends ServiceImpl<WeGroupCodeActualMapper,WeGroupCodeActual> implements IWeGroupCodeActualService
{ {
@Autowired // @Autowired
private WeGroupCodeActualMapper weGroupCodeActualMapper; // private WeGroupCodeActualMapper weGroupCodeActualMapper;
/**
* 查询实际群码
*
* @param id 实际群码ID
* @return 实际群码
*/
@Override
public WeGroupCodeActual selectWeGroupCodeActualById(Long id)
{
return weGroupCodeActualMapper.selectWeGroupCodeActualById(id);
}
/**
* 查询实际群码列表
*
* @param weGroupCodeActual 实际群码
* @return 实际群码
*/
@Override
public List<WeGroupCodeActual> selectWeGroupCodeActualList(WeGroupCodeActual weGroupCodeActual)
{
return weGroupCodeActualMapper.selectWeGroupCodeActualList(weGroupCodeActual);
}
/**
* 新增实际群码
*
* @param weGroupCodeActual 实际群码
* @return 结果
*/
@Override
public int insertWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual)
{
return weGroupCodeActualMapper.insertWeGroupCodeActual(weGroupCodeActual);
}
/** // /**
* 修改实际群码 // * 查询实际群码
* // *
* @param weGroupCodeActual 实际群码 // * @param id 实际群码ID
* @return 结果 // * @return 实际群码
*/ // */
@Override // @Override
public int updateWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual) // public WeGroupCodeActual selectWeGroupCodeActualById(Long id)
{ // {
return weGroupCodeActualMapper.updateWeGroupCodeActual(weGroupCodeActual); // return weGroupCodeActualMapper.selectWeGroupCodeActualById(id);
} // }
//
// /**
// * 查询实际群码列表
// *
// * @param weGroupCodeActual 实际群码
// * @return 实际群码
// */
// @Override
// public List<WeGroupCodeActual> selectWeGroupCodeActualList(WeGroupCodeActual weGroupCodeActual)
// {
// return weGroupCodeActualMapper.selectWeGroupCodeActualList(weGroupCodeActual);
// }
/** // /**
* 批量删除实际群码 // * 新增实际群码
* // *
* @param ids 需要删除的实际群码ID // * @param weGroupCodeActual 实际群码
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int deleteWeGroupCodeActualByIds(Long[] ids) // public int insertWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual)
{ // {
return weGroupCodeActualMapper.deleteWeGroupCodeActualByIds(ids); // this.sa
} // return this.baseMapper.insertWeGroupCodeActual(weGroupCodeActual);
// }
//
// /**
// * 修改实际群码
// *
// * @param weGroupCodeActual 实际群码
// * @return 结果
// */
// @Override
// public int updateWeGroupCodeActual(WeGroupCodeActual weGroupCodeActual)
// {
// return this.baseMapper.updateWeGroupCodeActual(weGroupCodeActual);
// }
/** // /**
* 删除实际群码信息 // * 批量删除实际群码
* // *
* @param id 实际群码ID // * @param ids 需要删除的实际群码ID
* @return 结果 // * @return 结果
*/ // */
@Override // @Override
public int deleteWeGroupCodeActualById(Long id) // public int deleteWeGroupCodeActualByIds(Long[] ids)
{ // {
return weGroupCodeActualMapper.deleteWeGroupCodeActualById(id); // return weGroupCodeActualMapper.deleteWeGroupCodeActualByIds(ids);
} // }
//
// /**
// * 删除实际群码信息
// *
// * @param id 实际群码ID
// * @return 结果
// */
// @Override
// public int deleteWeGroupCodeActualById(Long id)
// {
// return weGroupCodeActualMapper.deleteWeGroupCodeActualById(id);
// }
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.util.List; import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeGroupCodeActual;
import com.linkwechat.wecom.service.IWeGroupCodeActualService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeGroupCodeMapper; import com.linkwechat.wecom.mapper.WeGroupCodeMapper;
...@@ -14,34 +19,37 @@ import com.linkwechat.wecom.service.IWeGroupCodeService; ...@@ -14,34 +19,37 @@ import com.linkwechat.wecom.service.IWeGroupCodeService;
* @date 2020-10-07 * @date 2020-10-07
*/ */
@Service @Service
public class WeGroupCodeServiceImpl implements IWeGroupCodeService public class WeGroupCodeServiceImpl extends ServiceImpl<WeGroupCodeMapper,WeGroupCode> implements IWeGroupCodeService
{ {
@Autowired
private WeGroupCodeMapper weGroupCodeMapper;
/**
* 查询客户群活码
*
* @param id 客户群活码ID
* @return 客户群活码
*/
@Override
public WeGroupCode selectWeGroupCodeById(Long id)
{
return weGroupCodeMapper.selectWeGroupCodeById(id);
}
/** @Autowired
* 查询客户群活码列表 private IWeGroupCodeActualService iWeGroupCodeActualService;
* // @Autowired
* @param weGroupCode 客户群活码 // private WeGroupCodeMapper weGroupCodeMapper;
* @return 客户群活码 //
*/ // /**
@Override // * 查询客户群活码
public List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode) // *
{ // * @param id 客户群活码ID
return weGroupCodeMapper.selectWeGroupCodeList(weGroupCode); // * @return 客户群活码
} // */
// @Override
// public WeGroupCode selectWeGroupCodeById(Long id)
// {
// return weGroupCodeMapper.selectWeGroupCodeById(id);
// }
//
// /**
// * 查询客户群活码列表
// *
// * @param weGroupCode 客户群活码
// * @return 客户群活码
// */
// @Override
// public List<WeGroupCode> selectWeGroupCodeList(WeGroupCode weGroupCode)
// {
// return weGroupCodeMapper.selectWeGroupCodeList(weGroupCode);
// }
/** /**
* 新增客户群活码 * 新增客户群活码
...@@ -50,44 +58,56 @@ public class WeGroupCodeServiceImpl implements IWeGroupCodeService ...@@ -50,44 +58,56 @@ public class WeGroupCodeServiceImpl implements IWeGroupCodeService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertWeGroupCode(WeGroupCode weGroupCode) public void insertWeGroupCode(WeGroupCode weGroupCode)
{ {
return weGroupCodeMapper.insertWeGroupCode(weGroupCode);
}
/** if(this.save(weGroupCode)){
* 修改客户群活码 List<WeGroupCodeActual> actualList = weGroupCode.getActualList();
* if(CollectionUtil.isNotEmpty(actualList)){
* @param weGroupCode 客户群活码 iWeGroupCodeActualService.saveBatch(actualList);
* @return 结果 }
*/ }
@Override
public int updateWeGroupCode(WeGroupCode weGroupCode)
{
return weGroupCodeMapper.updateWeGroupCode(weGroupCode);
}
/**
* 批量删除客户群活码
*
* @param ids 需要删除的客户群活码ID
* @return 结果
*/
@Override
public int deleteWeGroupCodeByIds(Long[] ids)
{
return weGroupCodeMapper.deleteWeGroupCodeByIds(ids);
} }
/** /**
* 删除客户群活码信息 * 修改客户群活码
* *
* @param id 客户群活码ID * @param weGroupCode 客户群活码
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteWeGroupCodeById(Long id) public void updateWeGroupCode(WeGroupCode weGroupCode)
{ {
return weGroupCodeMapper.deleteWeGroupCodeById(id); if(this.updateById(weGroupCode)){
List<WeGroupCodeActual> actualList = weGroupCode.getActualList();
if(CollectionUtil.isNotEmpty(actualList)){
iWeGroupCodeActualService.updateBatchById(actualList);
}
}
} }
//
// /**
// * 批量删除客户群活码
// *
// * @param ids 需要删除的客户群活码ID
// * @return 结果
// */
// @Override
// public int deleteWeGroupCodeByIds(Long[] ids)
// {
// return weGroupCodeMapper.deleteWeGroupCodeByIds(ids);
// }
//
// /**
// * 删除客户群活码信息
// *
// * @param id 客户群活码ID
// * @return 结果
// */
// @Override
// public int deleteWeGroupCodeById(Long id)
// {
// return weGroupCodeMapper.deleteWeGroupCodeById(id);
// }
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.config.ServerConfig; import com.linkwechat.common.config.ServerConfig;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.enums.MediaType; import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUploadUtils; import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.wecom.domain.WeMaterial; import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.vo.WeMaterialFileVO; import com.linkwechat.wecom.domain.vo.WeMaterialFileVO;
...@@ -16,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -44,18 +48,25 @@ public class WeMaterialServiceImpl implements IWeMaterialService { ...@@ -44,18 +48,25 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
//上传文件到文件服务器 //上传文件到文件服务器
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称 String fileName = "";
String fileName = FileUploadUtils.upload(filePath, file); if (MediaType.FILE.getType().equals(type)) {
fileName = FileUploadUtils.uploadFile(file);
} else {
// 上传并返回新文件名称
fileName = FileUploadUtils.upload(filePath, file);
}
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
//上传临时素材 //上传临时素材
Optional<MediaType> mediaType = MediaType.of(type); Optional<MediaType> mediaType = MediaType.of(type);
if (!mediaType.isPresent()) { if (!mediaType.isPresent()) {
throw new WeComException("媒体类型出错!"); throw new WeComException("媒体类型出错!");
} }
//构造返回结果 //构造返回结果
return WeMaterialFileVO.builder().materialUrl(url).materialName(file.getOriginalFilename()).build(); return WeMaterialFileVO.builder().materialUrl(url).materialName(file.getOriginalFilename()).build();
} catch (Exception e) { } catch (Exception e) {
throw new WeComException("临时素材上传失败!"); throw new WeComException(e.getMessage());
} }
} }
...@@ -89,8 +100,20 @@ public class WeMaterialServiceImpl implements IWeMaterialService { ...@@ -89,8 +100,20 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
} }
@Override @Override
public List<WeMaterial> findWeMaterials(String categoryId, String search) { public List<WeMaterial> findWeMaterials(String categoryId, String search, String mediaType) {
return weMaterialMapper.findWeMaterials(categoryId, search); return weMaterialMapper.findWeMaterials(categoryId, search, mediaType);
} }
@Override
public void resetCategory(String categoryId, String materials) {
List<String> materialList = Arrays.asList(StringUtils.splitByWholeSeparatorPreserveAllTokens(materials, WeConstans.COMMA));
if (CollectionUtil.isNotEmpty(materialList)) {
materialList.forEach(s -> {
weMaterialMapper.resetCategory(categoryId, s);
});
}
}
} }
...@@ -171,9 +171,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -171,9 +171,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="getCustomersByUserId" resultType="com.linkwechat.wecom.domain.WeUser"> <select id="getCustomersByUserId" resultMap="WeCustomerResult">
SELECT SELECT
wc.external_userid, wc.external_userid,
wc.`name`, wc.`name`,
wc.avatar, wc.avatar,
wc.type, wc.type,
...@@ -182,12 +182,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -182,12 +182,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.birthday, wc.birthday,
wc.corp_name, wc.corp_name,
wc.corp_full_name, wc.corp_full_name,
wc.position wc.position,
FROM wfcr.id as wfcrId,
`we_flower_customer_rel` wfcr wfcr.user_id,
LEFT JOIN we_customer wc ON wc.external_userid = wfcr.external_userid wfcr.remark,
WHERE wfcr.description,
wfcr.user_id = #{userId} wfcr.create_time,
wfcr.remark_corp_name,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wu.user_name,
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.external_userid=wfcr.external_userid
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
WHERE wc.external_userid=#{externalUserid}
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="audioTime" column="audio_time"/>
</resultMap> </resultMap>
<insert id="insertWeMaterial"> <insert id="insertWeMaterial">
...@@ -53,7 +54,10 @@ ...@@ -53,7 +54,10 @@
update_by, update_by,
</if> </if>
<if test="updateTime!=null"> <if test="updateTime!=null">
update_time update_time,
</if>
<if test="audioTime!=null">
audio_time
</if> </if>
</trim> </trim>
VALUES VALUES
...@@ -89,7 +93,10 @@ ...@@ -89,7 +93,10 @@
#{updateBy}, #{updateBy},
</if> </if>
<if test="updateTime!=null"> <if test="updateTime!=null">
#{updateTime} #{updateTime},
</if>
<if test="audioTime!=null">
#{audioTime}
</if> </if>
</trim> </trim>
</insert> </insert>
...@@ -127,8 +134,25 @@ ...@@ -127,8 +134,25 @@
update_by=#{updateBy}, update_by=#{updateBy},
</if> </if>
<if test="updateTime!=null"> <if test="updateTime!=null">
update_time=#{updateTime} update_time=#{updateTime},
</if> </if>
<if test="audioTime!=null">
audio_time=#{audioTime}
</if>
<where>
<if test="id!=null">
id=#{id}
</if>
</where>
</update>
<update id="resetCategory">
UPDATE we_material
<set>
category_id=#{categoryId}
</set>
<where>
id=#{material}
</where>
</update> </update>
<delete id="deleteWeMaterialById"> <delete id="deleteWeMaterialById">
...@@ -161,21 +185,24 @@ ...@@ -161,21 +185,24 @@
<select id="findWeMaterials" resultMap="materialMap"> <select id="findWeMaterials" resultMap="materialMap">
SELECT SELECT
<include refid="material"/> wm.id,wm.category_id,wm.material_url,wm.content,wm.material_name,wm.digest,wm.cover_url,wm.create_by,wm.create_time,wm.update_by,wm.update_time,wm.audio_time
FROM we_material FROM we_material wm LEFT JOIN we_category wc ON wm.category_id=wc.id
<where> <where>
del_flag=0 wm.del_flag=0
<if test="categoryId!=null and categoryId!=''"> <if test="categoryId!=null and categoryId!=''">
AND category_id=#{categoryId} AND wm.category_id=#{categoryId}
</if> </if>
<if test="search!=null and search!=''"> <if test="search!=null and search!=''">
AND (material_name LIKE CONCAT('%',#{search},'%') OR content LIKE CONCAT('%',#{search},'%')) AND (wm.material_name LIKE CONCAT('%',#{search},'%') OR wm.content LIKE CONCAT('%',#{search},'%'))
</if>
<if test="mediaType!=null">
AND wc.media_type=#{mediaType}
</if> </if>
</where> </where>
</select> </select>
<sql id="material"> <sql id="material">
id,category_id,material_url,content,material_name,digest,cover_url,create_by,create_time,update_by,update_time id,category_id,material_url,content,material_name,digest,cover_url,create_by,create_time,update_by,update_time,audio_time
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!