parent
4c4360bf45
commit
0f60d33ea8
Binary file not shown.
@ -0,0 +1,7 @@ |
||||
package cn.toesbieya.jxc.constant; |
||||
|
||||
public interface DocConstant { |
||||
String UPDATE_DOC_LOCK_KEY = "UPDATE_DOC"; |
||||
String[] DOC_TYPE = {"CGDD", "CGRK", "CGTH", "XSDD", "XSCK", "XSTH"}; |
||||
String DOC_TYPE_REDIS_KEY = "DOC_ID"; |
||||
} |
||||
@ -1,7 +0,0 @@ |
||||
package cn.toesbieya.jxc.constant; |
||||
|
||||
public interface DocumentConstant { |
||||
String UPDATE_DOCUMENTS_LOCK_KEY = "UPDATE_DOCUMENTS"; |
||||
String[] DOCUMENT_TYPE = {"CGDD", "CGRK", "CGTH", "XSDD", "XSCK", "XSTH"}; |
||||
String DOCUMENT_TYPE_REDIS_KEY = "documentsID"; |
||||
} |
||||
@ -1,25 +0,0 @@ |
||||
package cn.toesbieya.jxc.controller; |
||||
|
||||
import cn.toesbieya.jxc.model.vo.search.DocumentHistorySearch; |
||||
import cn.toesbieya.jxc.service.BizDocumentHistoryService; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@RestController |
||||
@RequestMapping("document/history") |
||||
public class BizDocumentHistoryController { |
||||
@Resource |
||||
private BizDocumentHistoryService service; |
||||
|
||||
@GetMapping("get") |
||||
public Result get(@RequestParam("pid") String pid) { |
||||
return Result.success(service.getByPid(pid)); |
||||
} |
||||
|
||||
@PostMapping("search") |
||||
public Result search(@RequestBody DocumentHistorySearch vo) { |
||||
return Result.success(service.search(vo)); |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
package cn.toesbieya.jxc.controller.doc; |
||||
|
||||
import cn.toesbieya.jxc.model.vo.search.DocHistorySearch; |
||||
import cn.toesbieya.jxc.service.doc.BizDocHistoryService; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@RestController |
||||
@RequestMapping("doc/history") |
||||
public class HistoryController { |
||||
@Resource |
||||
private BizDocHistoryService service; |
||||
|
||||
@PostMapping("search") |
||||
public Result search(@RequestBody DocHistorySearch vo) { |
||||
return Result.success(service.search(vo)); |
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@ |
||||
package cn.toesbieya.jxc.controller.msg; |
||||
|
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import cn.toesbieya.jxc.model.vo.UserVo; |
||||
import cn.toesbieya.jxc.model.vo.search.MsgPersonalSearch; |
||||
import cn.toesbieya.jxc.service.msg.MsgUserService; |
||||
import cn.toesbieya.jxc.utils.SessionUtil; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@RestController("msgUserController") |
||||
@RequestMapping("message/user") |
||||
public class UserController { |
||||
@Resource |
||||
private MsgUserService service; |
||||
|
||||
@PostMapping("search") |
||||
public Result searchPersonal(@RequestBody MsgPersonalSearch vo) { |
||||
UserVo user = SessionUtil.get(); |
||||
vo.setUid(user.getId()); |
||||
vo.setCtime(user.getCtime()); |
||||
return Result.success(service.search(vo)); |
||||
} |
||||
|
||||
@GetMapping("read") |
||||
public Result read(@RequestParam Integer id) { |
||||
return service.read(SessionUtil.get(), id); |
||||
} |
||||
|
||||
@GetMapping("readAll") |
||||
public Result readAll() { |
||||
return service.readAll(SessionUtil.get()); |
||||
} |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizDocHistory; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
public interface BizDocHistoryMapper extends BaseMapper<BizDocHistory> { |
||||
|
||||
} |
||||
@ -1,15 +0,0 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizDocumentHistory; |
||||
import cn.toesbieya.jxc.model.vo.search.DocumentHistorySearch; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizDocumentHistoryMapper { |
||||
List<BizDocumentHistory> getByPid(@Param("pid") String pid); |
||||
|
||||
List<BizDocumentHistory> search(DocumentHistorySearch vo); |
||||
|
||||
int insert(BizDocumentHistory history); |
||||
} |
||||
@ -1,33 +1,14 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseInbound; |
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseInboundSub; |
||||
import cn.toesbieya.jxc.model.vo.search.PurchaseInboundSearch; |
||||
import cn.toesbieya.jxc.model.vo.export.PurchaseInboundExport; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizPurchaseInboundMapper { |
||||
BizPurchaseInbound getById(@Param("id") String id); |
||||
|
||||
List<BizPurchaseInboundSub> getSubById(@Param("id") String id); |
||||
|
||||
List<BizPurchaseInbound> search(PurchaseInboundSearch vo); |
||||
|
||||
List<PurchaseInboundExport> export(PurchaseInboundSearch vo); |
||||
|
||||
int insert(BizPurchaseInbound param); |
||||
|
||||
void addSub(List<BizPurchaseInboundSub> list); |
||||
|
||||
int update(BizPurchaseInbound param); |
||||
|
||||
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||
|
||||
int reject(@Param("id") String id); |
||||
|
||||
int del(@Param("id") String id); |
||||
|
||||
void delSubByPid(@Param("pid") String pid); |
||||
public interface BizPurchaseInboundMapper extends BaseMapper<BizPurchaseInbound> { |
||||
List<PurchaseInboundExport> export(@Param(Constants.WRAPPER) Wrapper<BizPurchaseInbound> wrapper); |
||||
} |
||||
|
||||
@ -0,0 +1,10 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseInboundSub; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizPurchaseInboundSubMapper extends BaseMapper<BizPurchaseInboundSub> { |
||||
void insertBatch(List<BizPurchaseInboundSub> list); |
||||
} |
||||
@ -1,38 +1,14 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseOrder; |
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseOrderSub; |
||||
import cn.toesbieya.jxc.model.vo.export.PurchaseOrderExport; |
||||
import cn.toesbieya.jxc.model.vo.search.PurchaseOrderSearch; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
public interface BizPurchaseOrderMapper { |
||||
BizPurchaseOrder getById(@Param("id") String id); |
||||
|
||||
List<BizPurchaseOrderSub> getSubById(@Param("id") String id); |
||||
|
||||
List<BizPurchaseOrder> search(PurchaseOrderSearch vo); |
||||
|
||||
List<PurchaseOrderExport> export(PurchaseOrderSearch vo); |
||||
|
||||
int insert(BizPurchaseOrder param); |
||||
|
||||
void addSub(List<BizPurchaseOrderSub> list); |
||||
|
||||
int update(BizPurchaseOrder param); |
||||
|
||||
int updateSubRemainNum(@Param("id") Integer id, @Param("remain_num") BigDecimal remain_num); |
||||
|
||||
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||
|
||||
int reject(@Param("id") String id); |
||||
|
||||
int del(@Param("id") String id); |
||||
|
||||
void delSubByPid(@Param("pid") String pid); |
||||
|
||||
int updateFinish(@Param("id") String id, @Param("finish") Integer finish, @Param("ftime") Long ftime); |
||||
public interface BizPurchaseOrderMapper extends BaseMapper<BizPurchaseOrder> { |
||||
List<PurchaseOrderExport> export(@Param(Constants.WRAPPER) Wrapper<BizPurchaseOrder> wrapper); |
||||
} |
||||
|
||||
@ -0,0 +1,10 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseOrderSub; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizPurchaseOrderSubMapper extends BaseMapper<BizPurchaseOrderSub> { |
||||
void insertBatch(List<BizPurchaseOrderSub> list); |
||||
} |
||||
@ -1,38 +1,14 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizSellOrder; |
||||
import cn.toesbieya.jxc.model.entity.BizSellOrderSub; |
||||
import cn.toesbieya.jxc.model.vo.export.SellOrderExport; |
||||
import cn.toesbieya.jxc.model.vo.search.SellOrderSearch; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
public interface BizSellOrderMapper { |
||||
BizSellOrder getById(@Param("id") String id); |
||||
|
||||
List<BizSellOrderSub> getSubById(@Param("id") String id); |
||||
|
||||
List<BizSellOrder> search(SellOrderSearch vo); |
||||
|
||||
List<SellOrderExport> export(SellOrderSearch vo); |
||||
|
||||
int insert(BizSellOrder param); |
||||
|
||||
void addSub(List<BizSellOrderSub> list); |
||||
|
||||
int update(BizSellOrder param); |
||||
|
||||
int updateSubRemainNum(@Param("id") Integer id, @Param("remain_num") BigDecimal remainNum); |
||||
|
||||
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||
|
||||
int reject(@Param("id") String id); |
||||
|
||||
int del(@Param("id") String id); |
||||
|
||||
void delSubByPid(@Param("pid") String pid); |
||||
|
||||
int updateFinish(@Param("id") String id, @Param("finish") Integer finish, @Param("ftime") Long ftime); |
||||
public interface BizSellOrderMapper extends BaseMapper<BizSellOrder> { |
||||
List<SellOrderExport> export(@Param(Constants.WRAPPER) Wrapper<BizSellOrder> wrapper); |
||||
} |
||||
|
||||
@ -0,0 +1,10 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizSellOrderSub; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizSellOrderSubMapper extends BaseMapper<BizSellOrderSub> { |
||||
void insertBatch(List<BizSellOrderSub> list); |
||||
} |
||||
@ -1,33 +1,14 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizSellOutboundSub; |
||||
import cn.toesbieya.jxc.model.entity.BizSellOutbound; |
||||
import cn.toesbieya.jxc.model.vo.export.SellOutboundExport; |
||||
import cn.toesbieya.jxc.model.vo.search.SellOutboundSearch; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizSellOutboundMapper { |
||||
BizSellOutbound getById(@Param("id") String id); |
||||
|
||||
List<BizSellOutboundSub> getSubById(@Param("id") String id); |
||||
|
||||
List<BizSellOutbound> search(SellOutboundSearch vo); |
||||
|
||||
List<SellOutboundExport> export(SellOutboundSearch vo); |
||||
|
||||
int insert(BizSellOutbound param); |
||||
|
||||
void addSub(List<BizSellOutboundSub> list); |
||||
|
||||
int update(BizSellOutbound param); |
||||
|
||||
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||
|
||||
int reject(@Param("id") String id); |
||||
|
||||
int del(@Param("id") String id); |
||||
|
||||
void delSubByPid(@Param("pid") String pid); |
||||
public interface BizSellOutboundMapper extends BaseMapper<BizSellOutbound> { |
||||
List<SellOutboundExport> export(@Param(Constants.WRAPPER) Wrapper<BizSellOutbound> wrapper); |
||||
} |
||||
|
||||
@ -0,0 +1,10 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizSellOutboundSub; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface BizSellOutboundSubMapper extends BaseMapper<BizSellOutboundSub> { |
||||
void insertBatch(List<BizSellOutboundSub> list); |
||||
} |
||||
@ -0,0 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.MsgState; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
public interface MsgStateMapper extends BaseMapper<MsgState> { |
||||
} |
||||
@ -1,20 +1,10 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.RecAttachment; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface RecAttachmentMapper { |
||||
List<RecAttachment> getByPid(@Param("pid") String pid); |
||||
|
||||
List<String> getUrlByPid(@Param("pid") String pid); |
||||
|
||||
int add(List<RecAttachment> list); |
||||
|
||||
int del(RecAttachment attachment); |
||||
|
||||
int delByPid(@Param("pid") String pid); |
||||
|
||||
int delByUrls(List<String> list); |
||||
public interface RecAttachmentMapper extends BaseMapper<RecAttachment> { |
||||
int insertBatch(List<RecAttachment> list); |
||||
} |
||||
|
||||
@ -1,12 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.RecLoginHistory; |
||||
import cn.toesbieya.jxc.model.vo.search.LoginHistorySearch; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface RecLoginHistoryMapper { |
||||
int insert(RecLoginHistory history); |
||||
|
||||
List<RecLoginHistory> search(LoginHistorySearch vo); |
||||
public interface RecLoginHistoryMapper extends BaseMapper<RecLoginHistory> { |
||||
} |
||||
|
||||
@ -1,12 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.RecUserAction; |
||||
import cn.toesbieya.jxc.model.vo.search.UserActionSearch; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface RecUserActionMapper { |
||||
void insert(RecUserAction action); |
||||
|
||||
List<RecUserAction> search(UserActionSearch vo); |
||||
public interface RecUserActionMapper extends BaseMapper<RecUserAction> { |
||||
} |
||||
|
||||
@ -1,27 +1,9 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysCategory; |
||||
import cn.toesbieya.jxc.model.vo.search.CategorySearch; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface SysCategoryMapper { |
||||
List<SysCategory> getAll(); |
||||
|
||||
List<SysCategory> search(CategorySearch vo); |
||||
|
||||
SysCategory getById(@Param("id") int id); |
||||
|
||||
int add(SysCategory sysCategory); |
||||
|
||||
int update(SysCategory sysCategory); |
||||
|
||||
int del(@Param("id") int id); |
||||
|
||||
boolean hasChildren(@Param("id") int id); |
||||
|
||||
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||
|
||||
public interface SysCategoryMapper extends BaseMapper<SysCategory> { |
||||
boolean checkIsUse(@Param("cid") Integer cid); |
||||
} |
||||
|
||||
@ -0,0 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysRegion; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
public interface SysRegionMapper extends BaseMapper<SysRegion> { |
||||
} |
||||
@ -1,15 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysResource; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface SysResourceMapper { |
||||
List<SysResource> get(); |
||||
|
||||
List<SysResource> getAll(); |
||||
|
||||
List<SysResource> getByRole(int role); |
||||
|
||||
int update(SysResource resource); |
||||
public interface SysResourceMapper extends BaseMapper<SysResource> { |
||||
} |
||||
|
||||
@ -1,25 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysRole; |
||||
import cn.toesbieya.jxc.model.vo.search.RoleSearch; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface SysRoleMapper { |
||||
SysRole selectById(@Param("id") int id); |
||||
|
||||
List<SysRole> get(); |
||||
|
||||
List<SysRole> getAll(); |
||||
|
||||
List<SysRole> search(RoleSearch vo); |
||||
|
||||
int insert(SysRole role); |
||||
|
||||
int update(SysRole role); |
||||
|
||||
int del(int id); |
||||
|
||||
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||
public interface SysRoleMapper extends BaseMapper<SysRole> { |
||||
} |
||||
|
||||
@ -1,29 +1,7 @@ |
||||
package cn.toesbieya.jxc.mapper; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysUser; |
||||
import cn.toesbieya.jxc.model.vo.PasswordUpdateParam; |
||||
import cn.toesbieya.jxc.model.vo.UserVo; |
||||
import cn.toesbieya.jxc.model.vo.search.UserSearch; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface SysUserMapper { |
||||
SysUser getByNameAndPwd(@Param("name") String name, @Param("pwd") String pwd); |
||||
|
||||
List<UserVo> search(UserSearch vo); |
||||
|
||||
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||
|
||||
int insert(SysUser user); |
||||
|
||||
int update(SysUser user); |
||||
|
||||
int deleteById(@Param("id") Integer id); |
||||
|
||||
int resetPwd(@Param("id") Integer id, @Param("pwd") String pwd); |
||||
|
||||
int updatePwd(PasswordUpdateParam vo); |
||||
|
||||
int updateAvatar(@Param("id") Integer id, @Param("avatar") String avatar); |
||||
public interface SysUserMapper extends BaseMapper<SysUser> { |
||||
} |
||||
|
||||
@ -0,0 +1,20 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysCustomer; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class CustomerVo extends SysCustomer { |
||||
private String regionName; |
||||
|
||||
public CustomerVo(SysCustomer parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseInbound; |
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseInboundSub; |
||||
import cn.toesbieya.jxc.model.entity.RecAttachment; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@NoArgsConstructor |
||||
public class PurchaseInboundVo extends BizPurchaseInbound { |
||||
private List<BizPurchaseInboundSub> data; |
||||
private List<RecAttachment> imageList; |
||||
private List<RecAttachment> uploadImageList; |
||||
private List<String> deleteImageList; |
||||
|
||||
public PurchaseInboundVo(BizPurchaseInbound parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseOrder; |
||||
import cn.toesbieya.jxc.model.entity.BizPurchaseOrderSub; |
||||
import cn.toesbieya.jxc.model.entity.RecAttachment; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@NoArgsConstructor |
||||
public class PurchaseOrderVo extends BizPurchaseOrder { |
||||
private List<BizPurchaseOrderSub> data; |
||||
private List<RecAttachment> imageList; |
||||
private List<RecAttachment> uploadImageList; |
||||
private List<String> deleteImageList; |
||||
|
||||
public PurchaseOrderVo(BizPurchaseOrder parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysResource; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class ResourceVo extends SysResource { |
||||
private String fullname; |
||||
|
||||
public ResourceVo(SysResource parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizSellOrder; |
||||
import cn.toesbieya.jxc.model.entity.BizSellOrderSub; |
||||
import cn.toesbieya.jxc.model.entity.RecAttachment; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@NoArgsConstructor |
||||
public class SellOrderVo extends BizSellOrder { |
||||
private List<BizSellOrderSub> data; |
||||
private List<RecAttachment> imageList; |
||||
private List<RecAttachment> uploadImageList; |
||||
private List<String> deleteImageList; |
||||
|
||||
public SellOrderVo(BizSellOrder parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizSellOutbound; |
||||
import cn.toesbieya.jxc.model.entity.BizSellOutboundSub; |
||||
import cn.toesbieya.jxc.model.entity.RecAttachment; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@NoArgsConstructor |
||||
public class SellOutboundVo extends BizSellOutbound { |
||||
private List<BizSellOutboundSub> data; |
||||
private List<RecAttachment> imageList; |
||||
private List<RecAttachment> uploadImageList; |
||||
private List<String> deleteImageList; |
||||
|
||||
public SellOutboundVo(BizSellOutbound parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
package cn.toesbieya.jxc.model.vo; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysSupplier; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.NoArgsConstructor; |
||||
import lombok.ToString; |
||||
import org.springframework.beans.BeanUtils; |
||||
|
||||
@Data |
||||
@NoArgsConstructor |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class SupplierVo extends SysSupplier { |
||||
private String regionName; |
||||
|
||||
public SupplierVo(SysSupplier parent) { |
||||
BeanUtils.copyProperties(parent, this); |
||||
} |
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
package cn.toesbieya.jxc.model.vo.search; |
||||
|
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.ToString; |
||||
|
||||
@Data |
||||
@ToString(callSuper = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class DocHistorySearch extends BaseSearch{ |
||||
private String pid; |
||||
private String type; |
||||
private String uid; |
||||
private String uname; |
||||
} |
||||
@ -1,11 +0,0 @@ |
||||
package cn.toesbieya.jxc.model.vo.search; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class DocumentHistorySearch { |
||||
private String pid; |
||||
private String type; |
||||
private String uid; |
||||
private String uname; |
||||
} |
||||
@ -1,23 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.BizDocumentHistory; |
||||
import cn.toesbieya.jxc.model.vo.search.DocumentHistorySearch; |
||||
import cn.toesbieya.jxc.mapper.BizDocumentHistoryMapper; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class BizDocumentHistoryService { |
||||
@Resource |
||||
private BizDocumentHistoryMapper historyMapper; |
||||
|
||||
public List<BizDocumentHistory> search(DocumentHistorySearch vo) { |
||||
return historyMapper.search(vo); |
||||
} |
||||
|
||||
public List<BizDocumentHistory> getByPid(String pid) { |
||||
return historyMapper.getByPid(pid); |
||||
} |
||||
} |
||||
@ -1,79 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.annoation.Lock; |
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.model.entity.SysCategory; |
||||
import cn.toesbieya.jxc.model.vo.search.CategorySearch; |
||||
import cn.toesbieya.jxc.mapper.SysCategoryMapper; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class SysCategoryService { |
||||
@Resource |
||||
private SysCategoryMapper categoryMapper; |
||||
|
||||
public List<SysCategory> getAll() { |
||||
return categoryMapper.getAll(); |
||||
} |
||||
|
||||
public List<SysCategory> search(CategorySearch vo) { |
||||
return categoryMapper.search(vo); |
||||
} |
||||
|
||||
@UserAction("'添加分类:'+#category.name") |
||||
@Lock("'category'+#category.pid") |
||||
public Result add(SysCategory category) { |
||||
String err = check(category); |
||||
if (err != null) return Result.fail("添加失败," + err); |
||||
|
||||
int rows = categoryMapper.add(category); |
||||
return rows > 0 ? Result.success("添加成功") : Result.fail("添加失败"); |
||||
} |
||||
|
||||
@UserAction("'修改分类:'+#category.name") |
||||
@Lock("'category'+#category.id") |
||||
public Result update(SysCategory category) { |
||||
String err = check(category); |
||||
if (err != null) return Result.fail("修改失败," + err); |
||||
|
||||
int rows = categoryMapper.update(category); |
||||
return rows > 0 ? Result.success("修改成功") : Result.fail("修改失败,请刷新后重试"); |
||||
} |
||||
|
||||
@UserAction("'删除分类:'+#category.name") |
||||
@Lock("'category'+#category.id") |
||||
public Result del(SysCategory category) { |
||||
Integer cid = category.getId(); |
||||
if (categoryMapper.hasChildren(cid)) { |
||||
return Result.fail("请先删除该分类下的子节点"); |
||||
} |
||||
if (categoryMapper.checkIsUse(cid)) { |
||||
return Result.fail("该分类已在业务中使用,不可删除"); |
||||
} |
||||
int rows = categoryMapper.del(cid); |
||||
return rows > 0 ? Result.success("删除成功") : Result.fail("删除失败,请刷新后重试"); |
||||
} |
||||
|
||||
private String check(SysCategory category) { |
||||
if (category.getPid() != 0) { |
||||
SysCategory parent = categoryMapper.getById(category.getPid()); |
||||
if (parent == null || parent.getType() == 1) { |
||||
return "父节点状态变更,请刷新后重试"; |
||||
} |
||||
} |
||||
if (categoryMapper.isNameExist(category.getName(), category.getId())) { |
||||
return String.format("分类【%s】已存在",category.getName()); |
||||
} |
||||
|
||||
if (category.getId() != null && category.getType() == 1) { |
||||
if (categoryMapper.hasChildren(category.getId())) { |
||||
return "该分类下存在子节点,不能改为实体类型"; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
@ -1,58 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.model.entity.SysCustomer; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.result.RegionValueResult; |
||||
import cn.toesbieya.jxc.model.vo.search.CustomerSearch; |
||||
import com.github.pagehelper.PageHelper; |
||||
import cn.toesbieya.jxc.mapper.SysCustomerMapper; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class SysCustomerService { |
||||
@Resource |
||||
private SysCustomerMapper customerMapper; |
||||
|
||||
public List<RegionValueResult> getLimitRegion() { |
||||
return customerMapper.getLimitRegion(); |
||||
} |
||||
|
||||
public List<SysCustomer> get() { |
||||
return customerMapper.get(); |
||||
} |
||||
|
||||
public PageResult<SysCustomer> search(CustomerSearch vo) { |
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
List<SysCustomer> SysCustomers = customerMapper.search(vo); |
||||
return new PageResult<>(SysCustomers); |
||||
} |
||||
|
||||
@UserAction("'添加客户:'+ #customer.name") |
||||
public Result add(SysCustomer customer) { |
||||
if (customerMapper.isNameExist(customer.getName(), null)) { |
||||
return Result.fail("添加失败,客户【" + customer.getName() + "】已存在"); |
||||
} |
||||
int rows = customerMapper.add(customer); |
||||
return rows > 0 ? Result.success("添加成功") : Result.fail("添加失败"); |
||||
} |
||||
|
||||
@UserAction("'修改客户:'+ #customer.name") |
||||
public Result update(SysCustomer customer) { |
||||
if (customerMapper.isNameExist(customer.getName(), customer.getId())) { |
||||
return Result.fail("修改失败,客户【" + customer.getName() + "】已存在"); |
||||
} |
||||
int rows = customerMapper.update(customer); |
||||
return rows > 0 ? Result.success("修改成功") : Result.fail("修改失败,请刷新重试"); |
||||
} |
||||
|
||||
@UserAction("删除客户:'+ #customer.name") |
||||
public Result del(SysCustomer customer) { |
||||
int rows = customerMapper.del(customer.getId()); |
||||
return rows > 0 ? Result.success("删除成功") : Result.fail("删除失败,请刷新重试"); |
||||
} |
||||
} |
||||
@ -1,71 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.model.entity.SysResource; |
||||
import cn.toesbieya.jxc.mapper.SysResourceMapper; |
||||
import cn.toesbieya.jxc.module.request.RequestModule; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.StringUtils; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class SysResourceService { |
||||
@Resource |
||||
private SysResourceMapper resourceMapper; |
||||
|
||||
public List<SysResource> get() { |
||||
List<SysResource> list = resourceMapper.get(); |
||||
completeNode(list); |
||||
return list; |
||||
} |
||||
|
||||
public List<SysResource> getAll() { |
||||
List<SysResource> list = resourceMapper.getAll(); |
||||
completeNode(list); |
||||
return list; |
||||
} |
||||
|
||||
public List<SysResource> getByRole(int role) { |
||||
List<SysResource> list = resourceMapper.getByRole(role); |
||||
completeNode(list); |
||||
return list; |
||||
} |
||||
|
||||
public Result update(SysResource resource) { |
||||
int rows = resourceMapper.update(resource); |
||||
if (rows > 0) { |
||||
RequestModule.updateRate(resource.getUrl(), resource.getTotalRate(), resource.getIpRate()); |
||||
} |
||||
return Result.success("修改成功"); |
||||
} |
||||
|
||||
private void completeNode(List<SysResource> list) { |
||||
HashMap<Integer, String> url = new HashMap<>(128); |
||||
HashMap<Integer, String> name = new HashMap<>(128); |
||||
|
||||
for (SysResource resource : list) { |
||||
//pid为0时跳过
|
||||
if (resource.getPid() == 0) { |
||||
url.put(resource.getId(), resource.getUrl()); |
||||
name.put(resource.getId(), resource.getName()); |
||||
resource.setFullname(resource.getName()); |
||||
continue; |
||||
} |
||||
|
||||
//获取父节点进行拼接
|
||||
String parentUrl = url.get(resource.getPid()); |
||||
String parentName = name.get(resource.getPid()); |
||||
assert !StringUtils.isEmpty(parentUrl) && !StringUtils.isEmpty(parentName); |
||||
|
||||
resource.setUrl(parentUrl + resource.getUrl()); |
||||
resource.setFullname(parentName + " - " + resource.getName()); |
||||
url.put(resource.getId(), resource.getUrl()); |
||||
name.put(resource.getId(), resource.getFullname()); |
||||
} |
||||
} |
||||
} |
||||
@ -1,56 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.model.entity.SysRole; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.search.RoleSearch; |
||||
import com.github.pagehelper.PageHelper; |
||||
import cn.toesbieya.jxc.mapper.SysRoleMapper; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class SysRoleService { |
||||
@Resource |
||||
private SysRoleMapper roleMapper; |
||||
|
||||
public List<SysRole> get() { |
||||
return roleMapper.get(); |
||||
} |
||||
|
||||
public List<SysRole> getAll() { |
||||
return roleMapper.getAll(); |
||||
} |
||||
|
||||
public PageResult<SysRole> search(RoleSearch vo) { |
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
return new PageResult<>(roleMapper.search(vo)); |
||||
} |
||||
|
||||
@UserAction("'添加角色:'+#role.name") |
||||
public Result add(SysRole role) { |
||||
if (roleMapper.isNameExist(role.getName(), null)) { |
||||
return Result.fail("添加失败,角色名称重复"); |
||||
} |
||||
int rows = roleMapper.insert(role); |
||||
return rows > 0 ? Result.success("添加成功") : Result.fail("添加失败"); |
||||
} |
||||
|
||||
@UserAction("'修改角色:'+#role.name") |
||||
public Result update(SysRole role) { |
||||
if (roleMapper.isNameExist(role.getName(), role.getId())) { |
||||
return Result.fail("修改失败,角色名称重复"); |
||||
} |
||||
roleMapper.update(role); |
||||
return Result.success("修改成功"); |
||||
} |
||||
|
||||
@UserAction("'删除角色:'+#role.name") |
||||
public Result del(SysRole role) { |
||||
int rows = roleMapper.del(role.getId()); |
||||
return rows > 0 ? Result.success("删除成功") : Result.fail("删除失败,请刷新重试"); |
||||
} |
||||
} |
||||
@ -1,58 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.model.entity.SysSupplier; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.result.RegionValueResult; |
||||
import cn.toesbieya.jxc.model.vo.search.SupplierSearch; |
||||
import com.github.pagehelper.PageHelper; |
||||
import cn.toesbieya.jxc.mapper.SysSupplierMapper; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class SysSupplierService { |
||||
@Resource |
||||
private SysSupplierMapper supplierMapper; |
||||
|
||||
public List<RegionValueResult> getLimitRegion() { |
||||
return supplierMapper.getLimitRegion(); |
||||
} |
||||
|
||||
public List<SysSupplier> get() { |
||||
return supplierMapper.get(); |
||||
} |
||||
|
||||
public PageResult<SysSupplier> search(SupplierSearch vo) { |
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
List<SysSupplier> sysSuppliers = supplierMapper.search(vo); |
||||
return new PageResult<>(sysSuppliers); |
||||
} |
||||
|
||||
@UserAction("'添加供应商:'+ #supplier.name") |
||||
public Result add(SysSupplier supplier) { |
||||
if (supplierMapper.isNameExist(supplier.getName(), null)) { |
||||
return Result.fail("添加失败,供应商【" + supplier.getName() + "】已存在"); |
||||
} |
||||
int rows = supplierMapper.add(supplier); |
||||
return rows > 0 ? Result.success("添加成功") : Result.fail("添加失败"); |
||||
} |
||||
|
||||
@UserAction("'修改供应商:'+ #supplier.name") |
||||
public Result update(SysSupplier supplier) { |
||||
if (supplierMapper.isNameExist(supplier.getName(), supplier.getId())) { |
||||
return Result.fail("修改失败,供应商【" + supplier.getName() + "】已存在"); |
||||
} |
||||
int rows = supplierMapper.update(supplier); |
||||
return rows > 0 ? Result.success("修改成功") : Result.fail("修改失败,请刷新重试"); |
||||
} |
||||
|
||||
@UserAction("删除供应商:'+ #supplier.name") |
||||
public Result del(SysSupplier supplier) { |
||||
int rows = supplierMapper.del(supplier.getId()); |
||||
return rows > 0 ? Result.success("删除成功") : Result.fail("删除失败,请刷新重试"); |
||||
} |
||||
} |
||||
@ -1,95 +0,0 @@ |
||||
package cn.toesbieya.jxc.service; |
||||
|
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.model.entity.SysUser; |
||||
import cn.toesbieya.jxc.model.vo.UserVo; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.search.UserSearch; |
||||
import cn.toesbieya.jxc.utils.Util; |
||||
import cn.toesbieya.jxc.utils.WebSocketUtil; |
||||
import com.github.pagehelper.PageHelper; |
||||
import cn.toesbieya.jxc.mapper.SysUserMapper; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.util.DigestUtils; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.stream.Collectors; |
||||
|
||||
@Service |
||||
public class SysUserService { |
||||
private static final String DEFAULT_PWD = DigestUtils.md5DigestAsHex("123456".getBytes()); |
||||
@Resource |
||||
private SysUserMapper userMapper; |
||||
|
||||
public PageResult<UserVo> search(UserSearch vo) { |
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
|
||||
List<UserVo> users = userMapper.search(vo); |
||||
|
||||
//当前在线的用户id
|
||||
Set<Integer> onlineUserIds = WebSocketUtil.getOnlineUserIds(); |
||||
|
||||
//设置在线情况
|
||||
for (UserVo user : users) { |
||||
user.setOnline(Util.some(onlineUserIds, i -> user.getId().equals(i))); |
||||
} |
||||
|
||||
return new PageResult<>(users); |
||||
} |
||||
|
||||
@UserAction("'添加用户:'+#user.name") |
||||
public Result add(SysUser user) { |
||||
if (userMapper.isNameExist(user.getName(), null)) { |
||||
return Result.fail("该用户名称已存在"); |
||||
} |
||||
|
||||
user.setCtime(System.currentTimeMillis()); |
||||
user.setPwd(DEFAULT_PWD); |
||||
|
||||
userMapper.insert(user); |
||||
return Result.success("添加成功"); |
||||
} |
||||
|
||||
@UserAction("'修改用户:'+#user.name") |
||||
public Result update(SysUser user) { |
||||
if (userMapper.isNameExist(user.getName(), user.getId())) { |
||||
return Result.fail("该用户名称已存在"); |
||||
} |
||||
|
||||
userMapper.update(user); |
||||
|
||||
return Result.success("修改成功"); |
||||
} |
||||
|
||||
@UserAction("'删除用户:'+#user.name") |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public Result del(SysUser user) { |
||||
int rows = userMapper.deleteById(user.getId()); |
||||
WebSocketUtil.sendLogoutEvent(Collections.singletonList(user.getId()), "该用户已删除"); |
||||
return rows > 0 ? Result.success("删除成功") : Result.fail("删除失败,请刷新后重试"); |
||||
} |
||||
|
||||
@UserAction |
||||
public Result kick(List<SysUser> users) { |
||||
WebSocketUtil.sendLogoutEvent( |
||||
users |
||||
.stream() |
||||
.map(SysUser::getId) |
||||
.collect(Collectors.toList()), |
||||
"你已被强制下线,请重新登陆" |
||||
); |
||||
|
||||
return Result.success("踢出成功"); |
||||
} |
||||
|
||||
@UserAction("'重置用户密码:'+#user.name") |
||||
public Result resetPwd(SysUser user) { |
||||
int rows = userMapper.resetPwd(user.getId(), DEFAULT_PWD); |
||||
return rows > 0 ? Result.success() : Result.fail("重置失败,未匹配到用户"); |
||||
} |
||||
} |
||||
@ -0,0 +1,36 @@ |
||||
package cn.toesbieya.jxc.service.doc; |
||||
|
||||
import cn.toesbieya.jxc.mapper.BizDocHistoryMapper; |
||||
import cn.toesbieya.jxc.model.entity.BizDocHistory; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.search.DocHistorySearch; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.github.pagehelper.PageHelper; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.StringUtils; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@Service |
||||
public class BizDocHistoryService { |
||||
@Resource |
||||
private BizDocHistoryMapper mapper; |
||||
|
||||
public PageResult<BizDocHistory> search(DocHistorySearch vo) { |
||||
String pid=vo.getPid(); |
||||
String type = vo.getType(); |
||||
String uid = vo.getUid(); |
||||
String uname = vo.getUname(); |
||||
|
||||
Wrapper<BizDocHistory> wrapper = Wrappers.lambdaQuery(BizDocHistory.class) |
||||
.eq(!StringUtils.isEmpty(pid), BizDocHistory::getPid, pid) |
||||
.inSql(!StringUtils.isEmpty(type), BizDocHistory::getType, type) |
||||
.inSql(!StringUtils.isEmpty(uid), BizDocHistory::getUid, uid) |
||||
.like(!StringUtils.isEmpty(uname), BizDocHistory::getUname, uname) |
||||
.orderByDesc(BizDocHistory::getId); |
||||
|
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
return new PageResult<>(mapper.selectList(wrapper)); |
||||
} |
||||
} |
||||
@ -0,0 +1,71 @@ |
||||
package cn.toesbieya.jxc.service.msg; |
||||
|
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.mapper.MsgMapper; |
||||
import cn.toesbieya.jxc.mapper.MsgStateMapper; |
||||
import cn.toesbieya.jxc.model.entity.Msg; |
||||
import cn.toesbieya.jxc.model.entity.MsgState; |
||||
import cn.toesbieya.jxc.model.entity.SysUser; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import cn.toesbieya.jxc.model.vo.result.PageResult; |
||||
import cn.toesbieya.jxc.model.vo.search.MsgPersonalSearch; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.github.pagehelper.PageHelper; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class MsgUserService { |
||||
@Resource |
||||
private MsgMapper msgMapper; |
||||
@Resource |
||||
private MsgStateMapper msgStateMapper; |
||||
|
||||
public PageResult<Msg> search(MsgPersonalSearch vo) { |
||||
PageHelper.startPage(vo.getPage(), vo.getPageSize()); |
||||
List<Msg> list = vo.isUnread() ? msgMapper.getUnreadByUser(vo) : msgMapper.getReadByUser(vo); |
||||
return new PageResult<>(list); |
||||
} |
||||
|
||||
public Result read(SysUser user, int id) { |
||||
//如果该消息已读,直接返回
|
||||
if (!msgStateMapper |
||||
.selectCount( |
||||
Wrappers.lambdaQuery(MsgState.class) |
||||
.eq(MsgState::getId, id) |
||||
.eq(MsgState::getMid, user.getId()) |
||||
) |
||||
.equals(0)) { |
||||
return Result.success(); |
||||
} |
||||
|
||||
MsgState state = new MsgState(); |
||||
state.setMid(id); |
||||
state.setUid(user.getId()); |
||||
state.setTime(System.currentTimeMillis()); |
||||
|
||||
return Result.success(msgStateMapper.insert(state)); |
||||
} |
||||
|
||||
@UserAction("'清空所有未读消息'") |
||||
public Result readAll(SysUser user) { |
||||
MsgPersonalSearch vo = new MsgPersonalSearch(); |
||||
vo.setUid(user.getId()); |
||||
vo.setCtime(user.getCtime()); |
||||
|
||||
MsgState state = new MsgState(); |
||||
state.setUid(user.getId()); |
||||
state.setTime(System.currentTimeMillis()); |
||||
|
||||
List<Msg> list = msgMapper.getUnreadByUser(vo); |
||||
|
||||
for (Msg msg : list) { |
||||
state.setMid(msg.getId()); |
||||
msgStateMapper.insert(state); |
||||
} |
||||
|
||||
return Result.success(); |
||||
} |
||||
} |
||||
@ -0,0 +1,121 @@ |
||||
package cn.toesbieya.jxc.service.sys; |
||||
|
||||
import cn.toesbieya.jxc.annoation.Lock; |
||||
import cn.toesbieya.jxc.annoation.UserAction; |
||||
import cn.toesbieya.jxc.mapper.SysCategoryMapper; |
||||
import cn.toesbieya.jxc.model.entity.SysCategory; |
||||
import cn.toesbieya.jxc.model.vo.Result; |
||||
import cn.toesbieya.jxc.model.vo.search.CategorySearch; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.StringUtils; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class SysCategoryService { |
||||
@Resource |
||||
private SysCategoryMapper mapper; |
||||
|
||||
public List<SysCategory> getAll() { |
||||
return mapper.selectList(null); |
||||
} |
||||
|
||||
public List<SysCategory> search(CategorySearch vo) { |
||||
Integer id = vo.getId(); |
||||
String ids = vo.getIds(); |
||||
Integer pid = vo.getPid(); |
||||
String pids = vo.getPids(); |
||||
String name = vo.getName(); |
||||
Integer type = vo.getType(); |
||||
Long startTime = vo.getStartTime(); |
||||
Long endTime = vo.getEndTime(); |
||||
|
||||
return mapper.selectList( |
||||
Wrappers.lambdaQuery(SysCategory.class) |
||||
.eq(id != null, SysCategory::getId, id) |
||||
.inSql(!StringUtils.isEmpty(ids), SysCategory::getId, ids) |
||||
.eq(pid != null, SysCategory::getPid, pid) |
||||
.inSql(!StringUtils.isEmpty(pids), SysCategory::getPid, pids) |
||||
.like(!StringUtils.isEmpty(name), SysCategory::getName, name) |
||||
.eq(type != null, SysCategory::getType, type) |
||||
.ge(startTime != null, SysCategory::getCtime, startTime) |
||||
.le(endTime != null, SysCategory::getCtime, endTime) |
||||
.orderByDesc(SysCategory::getCtime) |
||||
); |
||||
} |
||||
|
||||
@UserAction("'添加分类:'+#category.name") |
||||
@Lock("'category'+#category.pid") |
||||
public Result add(SysCategory category) { |
||||
String err = check(category); |
||||
if (err != null) return Result.fail("添加失败," + err); |
||||
|
||||
int rows = mapper.insert(category); |
||||
return rows > 0 ? Result.success("添加成功") : Result.fail("添加失败"); |
||||
} |
||||
|
||||
@UserAction("'修改分类:'+#category.name") |
||||
@Lock("'category'+#category.id") |
||||
public Result update(SysCategory category) { |
||||
String err = check(category); |
||||
if (err != null) return Result.fail("修改失败," + err); |
||||
|
||||
int rows = mapper.update( |
||||
null, |
||||
Wrappers.lambdaUpdate(SysCategory.class) |
||||
.set(SysCategory::getPid, category.getPid()) |
||||
.set(SysCategory::getName, category.getName()) |
||||
.set(SysCategory::getType, category.getType()) |
||||
.eq(SysCategory::getId, category.getId()) |
||||
); |
||||
return rows > 0 ? Result.success("修改成功") : Result.fail("修改失败,请刷新后重试"); |
||||
} |
||||
|
||||
@UserAction("'删除分类:'+#category.name") |
||||
@Lock("'category'+#category.id") |
||||
public Result del(SysCategory category) { |
||||
Integer cid = category.getId(); |
||||
if (hasChildren(cid)) { |
||||
return Result.fail("请先删除该分类下的子节点"); |
||||
} |
||||
if (mapper.checkIsUse(cid)) { |
||||
return Result.fail("该分类已在业务中使用,不可删除"); |
||||
} |
||||
int rows = mapper.deleteById(cid); |
||||
return rows > 0 ? Result.success("删除成功") : Result.fail("删除失败,请刷新后重试"); |
||||
} |
||||
|
||||
private String check(SysCategory category) { |
||||
//当该分类不是顶级节点时,判断其父节点是否允许有下级
|
||||
if (!category.getPid().equals(0)) { |
||||
SysCategory parent = mapper.selectById(category.getPid()); |
||||
if (parent == null || parent.getType().equals(1)) { |
||||
return "父节点状态变更,请刷新后重试"; |
||||
} |
||||
} |
||||
Integer id = category.getId(); |
||||
Integer exist = mapper.selectCount( |
||||
Wrappers.lambdaQuery(SysCategory.class) |
||||
.eq(SysCategory::getName, category.getName()) |
||||
.ne(id != null, SysCategory::getId, id) |
||||
); |
||||
if (exist != null && exist > 0) { |
||||
return String.format("分类【%s】已存在", category.getName()); |
||||
} |
||||
if (id != null && category.getType().equals(1) && hasChildren(id)) { |
||||
return "该分类下存在子节点,不能改为实体类型"; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private boolean hasChildren(Integer id) { |
||||
Integer checkNum = mapper.selectCount( |
||||
Wrappers.lambdaQuery(SysCategory.class) |
||||
.eq(SysCategory::getPid, id) |
||||
); |
||||
|
||||
return checkNum != null && checkNum > 0; |
||||
} |
||||
} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue