Commit af344345 by HlQ

[add]

1.添加权限相关内容
2.添加合同相关内容
1 parent c0cb71fe
Showing 69 changed files with 1846 additions and 41 deletions
......@@ -55,6 +55,11 @@
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.37.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -8,7 +8,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import vion.ding.DingMod;
import vion.third.DingMod;
@SpringBootApplication
@MapperScan("vion.mapper")
......
package vion;
import vion.model.User;
import vion.vo.UserVO;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
......@@ -11,5 +11,5 @@ public class Global {
public static final String STORE_URL = "/api/store";
public static final String WORK_URL = "/api/work";
public static final String INSPECT_URL = "/api/inspect";
public static final Map<String, User> USERNAME_MAP = new ConcurrentHashMap<>();
public static final Map<String, UserVO> USERNAME_MAP = new ConcurrentHashMap<>();
}
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -19,16 +20,19 @@ public class AccountController {
private final IAccountService accountService;
@GetMapping("/accounts")
@SaCheckPermission(value = "account:list", orRole="admin")
public Page<Account> getAccountList(BaseDTO dto) {
return accountService.page(Page.of(dto.getPageNum(), dto.getPageSize()));
}
@GetMapping("/account")
@SaCheckPermission(value = "account:query", orRole="admin")
public Account getProductByID(Integer id) {
return accountService.getById(id);
}
@PostMapping("/accounts")
@SaCheckPermission(value = "account:editAndSave", orRole="admin")
public Account saveOrUpdate(@RequestBody Account data) {
accountService.save(data);
return data;
......
package vion.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vion.service.IContractInfoService;
/**
* 合同管理
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class ContractInfoController {
private final IContractInfoService contractInfoService;
}
package vion.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vion.service.IContractPaymentInfoService;
/**
* 合同收款方式
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class ContractPaymentInfoController {
private final IContractPaymentInfoService contractPaymentInfoService;
}
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -24,35 +25,40 @@ public class DictionaryController {
private final Converter converter;
@GetMapping("/dictionarys")
@SaCheckPermission(value = "dict:list", orRole="admin")
public Page<Dictionary> getDictionaryList(DictionaryDTO data) {
return dictionaryService.lambdaQuery(converter.convert(data, new Dictionary()))
.page(Page.of(data.getPageNum(), data.getPageSize()));
}
@GetMapping("/dictionary")
@SaCheckPermission(value = "dict:query", orRole="admin")
public Object getDictionaryByID(@RequestParam(name = "id") Integer id) {
return dictionaryService.getById(id);
}
@PostMapping("/dictionary")
@SaCheckPermission(value = "dict:editAndSave", orRole="admin")
public String saveOrUpdateDictionary(@RequestBody DictionaryDTO data) {
Dictionary dictionary = converter.convert(data, new Dictionary());
return dictionaryService.saveOrUpdate(dictionary) ? "成功" : "失败";
}
@GetMapping("/dictionaryTypes")
@SaCheckPermission("dict:type:list")
public Page<DictionaryType> getDictionaryTypeList(DictionaryTypeDTO data) {
return dictionaryTypeService.lambdaQuery(converter.convert(data, new DictionaryType()))
.page(Page.of(data.getPageNum(), data.getPageSize()));
}
@GetMapping("/dictionaryType")
@SaCheckPermission("dict:type:query")
public Object getDictionaryTypeByID(@RequestParam Integer id) {
return dictionaryTypeService.getById(id);
}
@PostMapping("/dictionaryType")
@SaCheckPermission("dict:type:editAndSave")
public String saveOrUpdateDictionaryType(@RequestBody DictionaryTypeDTO data) {
DictionaryType dictionaryType = converter.convert(data, new DictionaryType());
return dictionaryTypeService.saveOrUpdate(dictionaryType) ? "成功" : "失败";
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -22,22 +23,26 @@ public class InspectController {
private final Converter converter;
@GetMapping("/inspects")
@SaCheckPermission(value = "inspect:list", orRole="admin")
public Page<Inspect> getInspectList(InspectDTO data) {
return inspectService.getInspectList(data);
}
@GetMapping("/inspect")
public Inspect getProductByID(@RequestParam(name = "id") Integer id) {
@SaCheckPermission(value = "inspect:query", orRole="admin")
public Inspect getProductById(@RequestParam(name = "id") Integer id) {
return inspectService.getById(id);
}
@PostMapping("/inspects")
@SaCheckPermission(value = "inspect:editAndSave", orRole="admin")
public String saveOrUpdate(@RequestBody InspectDTO data) {
Inspect inspect = converter.convert(data, new Inspect());
return inspectService.saveOrUpdate(inspect) ? "成功" : "失败";
}
@PostMapping("/updateInspectStatus")
@SaCheckPermission(value = "inspect:editStatus", orRole="admin")
public String UpdateStatus(@RequestBody InspectDTO data) {
boolean result = inspectService.lambdaUpdate()
.eq(Inspect::getId, data.getId())
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -21,16 +22,19 @@ public class ProductController {
private final Converter converter;
@GetMapping("/products")
@SaCheckPermission(value = "product:list", orRole="admin")
public Page<ProductVO> getProductList(ProductDTO productDTO) {
return productService.getProductList(productDTO);
}
@GetMapping("/product")
@SaCheckPermission(value = "product:query", orRole="admin")
public Product getProductByID(@RequestParam Long projectId) {
return productService.getById(projectId);
}
@PostMapping("/products")
@SaCheckPermission(value = "product:editAndSave", orRole="admin")
public String saveOrUpdate(@RequestBody ProductDTO productDTO) {
Product data = converter.convert(productDTO, new Product());
return productService.saveOrUpdate(data) ? "成功" : "失败";
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vion.dto.RRoleResourceDTO;
import vion.model.RRoleResource;
import vion.service.IRRoleResourceService;
import java.util.Arrays;
/**
* 角色资源关联表
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class RRoleResourceController {
private final IRRoleResourceService roleResourceService;
@PostMapping("/rRoleRes")
@SaCheckPermission("role:resource:edit")
public String saveOrUpdateRUserRole(@RequestBody RRoleResourceDTO dto) {
roleResourceService.lambdaUpdate().eq(RRoleResource::getRoleId, dto.getRoleId()).remove();
Arrays.stream(dto.getResourceIds()).map(resourceId -> {
RRoleResource roleResource = new RRoleResource();
roleResource.setRoleId(resourceId);
roleResource.setResourceId(dto.getRoleId());
return roleResource;
}).forEach(roleResourceService::save);
return "创建成功";
}
}
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vion.dto.RUserRoleDTO;
import vion.model.RUserRole;
import vion.service.IRUserRoleService;
import java.util.Arrays;
/**
* 用户角色表
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class RUserRoleController {
private final IRUserRoleService rUserRoleService;
@PostMapping("/rUserRole")
@SaCheckPermission("user:role:edit")
public String saveOrUpdateRUserRole(@RequestBody RUserRoleDTO dto) {
rUserRoleService.lambdaUpdate().eq(RUserRole::getUserId, dto.getUserId()).remove();
Arrays.stream(dto.getRoleIds()).map(roleId -> {
RUserRole rUserRole = new RUserRole();
rUserRole.setUserId(dto.getUserId());
rUserRole.setRoleId(roleId);
return rUserRole;
}).forEach(rUserRoleService::save);
return "创建成功";
}
}
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.ResourceDTO;
import vion.dto.RoleDTO;
import vion.model.Resource;
import vion.service.IResourceService;
import vion.vo.ResourceVO;
/**
* 资源管理
*
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class ResourceController {
private final IResourceService resourceService;
private final Converter converter;
@GetMapping("/resource")
@SaCheckPermission(value = "resource:list", orRole="admin")
public Page<ResourceVO> list(ResourceDTO dto) {
return resourceService.list(dto);
}
@GetMapping("/resource/{id}")
@SaCheckPermission(value = "resource:query", orRole="admin")
public ResourceVO getRoleById(@PathVariable Long id) {
Resource resource = resourceService.getById(id);
return converter.convert(resource, new ResourceVO());
}
@PostMapping("/resource")
@SaCheckPermission(value = "resource:save", orRole="admin")
private String save(@RequestBody ResourceDTO dto) {
Resource resource = converter.convert(dto, new Resource());
return resourceService.save(resource) ? "创建成功" : "创建失败";
}
@PostMapping("/resource/{id}")
@SaCheckPermission(value = "resource:edit", orRole="admin")
private String update(@PathVariable Long id, @RequestBody RoleDTO dto) {
Resource resource = converter.convert(dto, new Resource());
resource.setId(id);
return resourceService.updateById(resource) ? "更新成功" : "更新失败";
}
@DeleteMapping("/resource/{id}")
@SaCheckPermission(value = "resource:remove", orRole="admin")
private String remove(@PathVariable Long id) {
return resourceService.removeById(id) ? "删除成功" : "删除失败";
}
}
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.RoleDTO;
import vion.model.Role;
import vion.service.IRoleService;
import vion.vo.RoleVO;
/**
* 角色管理
*
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class RoleController {
private final IRoleService roleService;
private final Converter converter;
@GetMapping("/role")
@SaCheckPermission(value = "role:list", orRole="admin")
public Page<RoleVO> list(RoleDTO dto) {
return roleService.list(dto);
}
@GetMapping("/role/{id}")
@SaCheckPermission(value = "role:query", orRole="admin")
public RoleVO getRoleById(@PathVariable Long id) {
Role role = roleService.getById(id);
return converter.convert(role, new RoleVO());
}
@PostMapping("/role")
@SaCheckPermission(value = "role:save", orRole="admin")
private String save(@RequestBody RoleDTO dto) {
Role role = converter.convert(dto, new Role());
return roleService.save(role) ? "创建成功" : "创建失败";
}
@PostMapping("/role/{id}")
@SaCheckPermission(value = "role:edit", orRole="admin")
private String update(@PathVariable Long id, @RequestBody RoleDTO dto) {
Role role = converter.convert(dto, new Role());
role.setId(id);
return roleService.updateById(role) ? "更新成功" : "更新失败";
}
@DeleteMapping("/role/{id}")
@SaCheckPermission(value = "role:remove", orRole="admin")
private String remove(@PathVariable Long id) {
return roleService.removeById(id) ? "删除成功" : "删除失败";
}
}
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import io.github.linpeilie.Converter;
......@@ -32,11 +33,13 @@ public class ServiceOrderController {
private final Converter converter;
@GetMapping("/order/{id}")
@SaCheckPermission(value = "order:query", orRole="admin")
public ServiceOrder getOrderById(@PathVariable Long id) {
return serviceOrderService.getById(id);
}
@PostMapping("/order")
@SaCheckPermission(value = "order:save", orRole="admin")
private Object save(@RequestBody ServiceOrderDTO serviceOrderDTO) {
Long count = serviceOrderService.lambdaQuery().eq(ServiceOrder::getTaskId, serviceOrderDTO.getTaskId()).count();
Assert.isFalse(count > 0, "该工单已存在服务单,不能重复创建!");
......@@ -46,6 +49,7 @@ public class ServiceOrderController {
}
@PostMapping("/order/{id}")
@SaCheckPermission(value = "order:edit", orRole="admin")
private String update(@PathVariable Long id, @RequestBody ServiceOrderDTO serviceOrderDTO) {
ServiceOrder serviceOrder = converter.convert(serviceOrderDTO, new ServiceOrder());
serviceOrder.setId(id);
......@@ -53,6 +57,7 @@ public class ServiceOrderController {
}
@DeleteMapping("/order/{id}")
@SaCheckPermission(value = "order:remove", orRole="admin")
private String remove(@PathVariable Long id) {
return serviceOrderService.removeById(id) ? "删除成功" : "删除失败";
}
......@@ -82,6 +87,7 @@ public class ServiceOrderController {
}
@GetMapping("/order/pushWechat")
@SaCheckPermission(value = "order:wechatPush", orRole="admin")
public String sendOrder(Long id) {
return serviceOrderService.sendOrder(id);
}
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -9,9 +10,9 @@ import vion.Global;
import vion.dto.StatusDTO;
import vion.dto.StoreDTO;
import vion.model.Store;
import vion.model.User;
import vion.service.IStoreService;
import vion.vo.StoreVO;
import vion.vo.UserVO;
import java.util.List;
......@@ -26,17 +27,20 @@ public class StoreController {
@GetMapping("/stores")
@SaCheckPermission(value = "store:list", orRole="admin")
public Page<StoreVO> getStoreList(StoreDTO data) {
return storeService.getStoreList(data);
}
@GetMapping("/store")
public StoreVO getStoreByID(@RequestParam(name = "id") Integer id) {
@SaCheckPermission(value = "store:query", orRole="admin")
public StoreVO getStoreById(@RequestParam Integer id) {
Store store = storeService.getById(id);
return converter.convert(store, StoreVO.class);
}
@GetMapping("/storeList")
@SaCheckPermission(value = "store:list1", orRole="admin")
public List<StoreVO> getStoreList(Integer accountId) {
List<Store> storeList = storeService.lambdaQuery()
.eq(accountId != null, Store::getAccountId, accountId)
......@@ -45,8 +49,9 @@ public class StoreController {
}
@PostMapping("/stores")
@SaCheckPermission(value = "store:editAndSave", orRole="admin")
public String saveOrUpdate(@RequestBody StoreDTO data, @RequestHeader String token) {
User user = Global.USERNAME_MAP.get(token);
UserVO user = Global.USERNAME_MAP.get(token);
Store store = converter.convert(data, Store.class);
if (data.getId() != null) {
......@@ -58,6 +63,7 @@ public class StoreController {
}
@PostMapping("/updateStoreStatus")
@SaCheckPermission(value = "store:editStatus", orRole="admin")
public Object updateStoreStage(StatusDTO statusDTO, @RequestHeader String token) {
return storeService.updateStoreStage(statusDTO, token);
}
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -23,21 +24,25 @@ public class TaskController {
private final IFaultLogService faultLogService;
@GetMapping("/tasks")
@SaCheckPermission(value = "task:list", orRole="admin")
public Page<TaskVO> getTaskList(TaskDTO data) {
return taskService.getTaskList(data);
}
@GetMapping("/task")
@SaCheckPermission(value = "task:query", orRole="admin")
public TaskVO getTaskById(Long taskId) {
return taskService.getTaskById(taskId);
}
@PostMapping("/tasks")
@SaCheckPermission(value = "task:editAndSave", orRole="admin")
public Long saveOrUpdate(TaskDTO data, @RequestHeader String token) {
return taskService.circTask(data, token);
}
@GetMapping("/faultLogs")
@SaCheckPermission("task:log:list")
public List<FaultLog> getFaultLogById(Integer storeId, Integer taskId) {
return faultLogService.lambdaQuery()
.eq(FaultLog::getStoreId, storeId)
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.ding.WechatMod;
import vion.third.WechatMod;
import vion.dto.TaskTempDTO;
import vion.model.TaskTemp;
import vion.service.ITaskTempService;
......@@ -29,16 +30,19 @@ public class TaskTempController {
private final Converter converter;
@GetMapping("/taskTemps")
@SaCheckPermission(value = "taskTemp:list", orRole="admin")
public Page<TaskTempVO> getTaskTempList(TaskTempDTO data) {
return taskTempService.getTaskTempList(data);
}
@GetMapping("/taskTemp")
@SaCheckPermission(value = "taskTemp:query", orRole="admin")
public TaskTempVO getTaskTempById(Long id) {
return taskTempService.getTaskTempById(id);
}
@PostMapping("/taskTemp")
@SaCheckPermission(value = "taskTemp:editAndSave", orRole="admin")
public Object saveOrUpdateTaskTemp(TaskTempDTO data) {
return taskTempService.saveOrUpdTaskTemp(data);
}
......@@ -47,7 +51,7 @@ public class TaskTempController {
public Object wechatCallback(String code, HttpServletResponse res) throws IOException {
Object obj = wechatMod.wechatCallback(code);
if (obj instanceof String) {
res.sendRedirect("https://yunwei.vionyun.com:8443/wap/?openid=" + obj);
res.sendRedirect("https://yunwei.vionyun.com/wap/?openid=" + obj);
} else {
return obj;
}
......@@ -55,6 +59,7 @@ public class TaskTempController {
}
@PostMapping("/taskTemp/{id}")
@SaCheckPermission(value = "taskTemp:edit", orRole="admin")
public String upd(@PathVariable(name = "id") Long id, TaskTempDTO data) {
TaskTemp taskTemp = converter.convert(data, new TaskTemp());
taskTemp.setId(id);
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -8,14 +9,15 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import vion.Global;
import vion.ding.DingMod;
import vion.ding.WechatMod;
import vion.third.DingMod;
import vion.third.WechatMod;
import vion.dto.BaseDTO;
import vion.dto.DingDTO;
import vion.model.TaskTemp;
import vion.model.User;
import vion.service.ITaskTempService;
import vion.service.IUserService;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -33,25 +35,30 @@ public class UserController {
private final WechatMod wechatMod;
@GetMapping("/users")
@SaCheckPermission(value = "user:list", orRole="admin")
public Page<User> getUserList(BaseDTO dto) {
return userService.page(Page.of(dto.getPageNum(), dto.getPageSize()));
}
@GetMapping("/user")
@SaCheckPermission(value = "user:query", orRole="admin")
public User getUserByID(@RequestParam(name = "id") Integer id) {
return userService.getById(id);
}
@PostMapping("/user")
@SaCheckPermission(value = "user:edit", orRole="admin")
public String update(@RequestBody List<User> data) {
return Opt.ofEmptyAble(data).map(userService::updateBatchById).orElse(false) ? "更新成功" : "更新失败";
}
@GetMapping("/user/{token}")
public User getUserByToken(@PathVariable String token) {
@SaCheckPermission("user:token:query")
public UserVO getUserByToken(@PathVariable String token) {
return Global.USERNAME_MAP.get(token);
}
@GetMapping("/orgTree")
@SaCheckPermission(value = "user:orgTree", orRole="admin")
public List<Tree<String>> getOrgTree(String deptId) {
return userService.getOrgTree(deptId);
}
......
......@@ -8,7 +8,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vion.ding.DingMod;
import vion.third.DingMod;
import vion.model.Task;
import vion.model.User;
import vion.service.ITaskService;
......
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
public class ContractDTO extends BaseDTO {
private Long id;
/**
* 合同名称
*/
private String name;
/**
* 合同编号
*/
private String contractNo;
/**
* 合同类型:1-维保合同 2-框架合同 3-集成合同 4-供货合同 5-供货施工合同 0-其他
*/
private Integer type;
/**
* 合同签订日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date signDate;
/**
* 合同维保开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date maintainSdate;
/**
* 合同维保结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date maintainEdate;
/**
* 合同进度:1-签订 2-发货 3-货到 4-安装 5-验收 6-质保
*/
private Integer status;
/**
* 合同总金额
*/
private BigDecimal totalAmount;
/**
* 合同已收金额:人工编辑
*/
private BigDecimal paidAmount;
/**
* 合同应收金额:
* 根据【合同进度】,由系统判断出应该收到的金额
*/
private BigDecimal receivableAmount;
/**
* 合同未收金额:total-(paid+receivable)
*/
private BigDecimal outstandingAmount;
/**
* 合同签订主体
*/
private String subject;
/**
* 合同甲方名称
*/
private String customerName;
/**
* 销售人员名称
*/
private String saleName;
/**
* 备注
*/
private String remark;
/**
* 记录创建者
*/
private Long createUser;
/**
* 记录最后一次修改者
*/
private Long modifyUser;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}
\ No newline at end of file
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
public class ContractPaymentDTO {
private Long id;
/**
* 合同ID
*/
private Long contractId;
/**
* 付款方式:1-签订 2-发货 3-货到 4-安装 5-验收 6-质保
*/
private Integer paymentType;
/**
* 付款比例
*/
private BigDecimal paymentRatios;
/**
* 创建者
*/
private Integer createUser;
/**
* 记录最后一次修改者
*/
private Integer modifyUser;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}
\ No newline at end of file
package vion.dto;
import lombok.Getter;
import lombok.Setter;
/**
* @author HlQ
* @date 2023/11/28
*/
@Getter
@Setter
public class RRoleResourceDTO extends BaseDTO {
private Long id;
/**
* 角色id
*/
private Long roleId;
/**
* 资源id
*/
private Long resourceId;
private Long[] resourceIds;
}
\ No newline at end of file
package vion.dto;
import lombok.Getter;
import lombok.Setter;
/**
* @author HlQ
* @date 2023/11/28
*/
@Getter
@Setter
public class RUserRoleDTO extends BaseDTO {
/**
* 用户id
*/
private Long userId;
/**
* 角色id
*/
private Long roleId;
private Long[] roleIds;
}
\ No newline at end of file
package vion.dto;
import lombok.Getter;
import lombok.Setter;
/**
* @author HlQ
* @date 2023/11/28
*/
@Getter
@Setter
public class ResourceDTO extends BaseDTO {
private Long id;
/**
* 名称
*/
private String name;
/**
* 父id
*/
private Long parentId;
/**
* 路径
*/
private String path;
/**
* 组件
*/
private String component;
/**
* 权限标识符
*/
private String perm;
/**
* 类型 M:菜单,B:按钮
*/
private String type;
/**
* 排序
*/
private Integer sortCode;
/**
* 备注
*/
private String remark;
}
\ No newline at end of file
package vion.dto;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/28
*/
@Getter
@Setter
public class RoleDTO extends BaseDTO {
private Long id;
/**
* 角色名称
*/
private String name;
/**
* 角色编码
*/
private String code;
/**
* 状态
*/
private Integer status;
/**
* 备注
*/
private String remark;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endDate;
}
......@@ -6,7 +6,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.User;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -22,7 +22,7 @@ public class Interceptor implements HandlerInterceptor {
return true;
}
User user = Opt.ofBlankAble(request.getHeader("token")).map(Global.USERNAME_MAP::get).orElse(null);
UserVO user = Opt.ofBlankAble(request.getHeader("token")).map(Global.USERNAME_MAP::get).orElse(null);
if (user == null) {
response.reset();
response.setCharacterEncoding("UTF-8");
......
package vion.interceptor;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
......@@ -14,7 +16,9 @@ public class InterceptorConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(interceptor)
registry.addInterceptor(new SaInterceptor(handle -> {
StpUtil.checkLogin();
}))
.addPathPatterns("/api/**")
.excludePathPatterns("/api/upLoadFile", "/api/ding/callback/**", "/api/wechat/**", "/error")
.excludePathPatterns("/api/order/sign/*")
......
package vion.interceptor;
import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpUtil;
import org.springframework.stereotype.Component;
import vion.vo.RoleVO;
import vion.vo.UserVO;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author HlQ
* @date 2023/11/28
*/
@Component
public class StpInterfaceImpl implements StpInterface {
@Override
public List<String> getPermissionList(Object loginId, String loginType) {
UserVO userVO = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
return userVO.getPermCodeList();
}
@Override
public List<String> getRoleList(Object loginId, String loginType) {
UserVO userVO = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
List<RoleVO> roleVOList = userVO.getRoleVOList();
return roleVOList.stream().map(RoleVO::getCode).collect(Collectors.toList());
}
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.ContractInfo;
/**
* @author HlQ
* @date 2023/11/29
*/
public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
}
\ No newline at end of file
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.ContractPaymentInfo;
/**
* @author HlQ
* @date 2023/11/29
*/
public interface ContractPaymentInfoMapper extends BaseMapper<ContractPaymentInfo> {
}
\ No newline at end of file
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.RContractStore;
/**
* @author HlQ
* @date 2023/11/29
*/
public interface RContractStoreMapper extends BaseMapper<RContractStore> {
}
\ No newline at end of file
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.RRoleResource;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface RRoleResourceMapper extends BaseMapper<RRoleResource> {
}
\ No newline at end of file
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.RUserRole;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface RUserRoleMapper extends BaseMapper<RUserRole> {
}
\ No newline at end of file
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.Resource;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface ResourceMapper extends BaseMapper<Resource> {
}
\ No newline at end of file
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.Role;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface RoleMapper extends BaseMapper<Role> {
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.ContractDTO;
import vion.vo.ContractVO;
import java.math.BigDecimal;
import java.util.Date;
/**
* 合同
*/
@Data
@TableName(value = "tbl_contract_info")
@AutoMappers({
@AutoMapper(target = ContractVO.class),
@AutoMapper(target = ContractDTO.class),
})
public class Contract {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 合同名称
*/
@TableField(value = "\"name\"")
private String name;
/**
* 合同编号
*/
@TableField(value = "contract_no")
private String contractNo;
/**
* 合同类型:1-维保合同 2-框架合同 3-集成合同 4-供货合同 5-供货施工合同 0-其他
*/
@TableField(value = "\"type\"")
private Integer type;
/**
* 合同签订日期
*/
@TableField(value = "sign_date")
private Date signDate;
/**
* 合同维保开始日期
*/
@TableField(value = "maintain_sdate")
private Date maintainSdate;
/**
* 合同维保结束日期
*/
@TableField(value = "maintain_edate")
private Date maintainEdate;
/**
* 合同进度:1-签订 2-发货 3-货到 4-安装 5-验收 6-质保
*/
@TableField(value = "\"status\"")
private Integer status;
/**
* 合同总金额
*/
@TableField(value = "total_amount")
private BigDecimal totalAmount;
/**
* 合同已收金额:人工编辑
*/
@TableField(value = "paid_amount")
private BigDecimal paidAmount;
/**
* 合同应收金额:
* 根据【合同进度】,由系统判断出应该收到的金额
*/
@TableField(value = "receivable_amount")
private BigDecimal receivableAmount;
/**
* 合同未收金额:total-(paid+receivable)
*/
@TableField(value = "outstanding_amount")
private BigDecimal outstandingAmount;
/**
* 合同签订主体
*/
@TableField(value = "subject")
private String subject;
/**
* 合同甲方名称
*/
@TableField(value = "customer_name")
private String customerName;
/**
* 销售人员名称
*/
@TableField(value = "sale_name")
private String saleName;
/**
* 备注
*/
@TableField(value = "remark")
private String remark;
/**
* 记录创建者
*/
@TableField(value = "create_user")
private Long createUser;
/**
* 记录最后一次修改者
*/
@TableField(value = "modify_user")
private Long modifyUser;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
private Date modifyTime;
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.ContractPaymentDTO;
import java.math.BigDecimal;
import java.util.Date;
/**
* 合同收款方式
*/
@Data
@TableName(value = "tbl_contract_payment_info")
@AutoMappers({
@AutoMapper(target = ContractPaymentVO.class),
@AutoMapper(target = ContractPaymentDTO.class),
})
public class ContractPayment {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 合同ID
*/
@TableField(value = "contract_id")
private Long contractId;
/**
* 付款方式:1-签订 2-发货 3-货到 4-安装 5-验收 6-质保
*/
@TableField(value = "payment_type")
private Integer paymentType;
/**
* 付款比例
*/
@TableField(value = "payment_ratios")
private BigDecimal paymentRatios;
/**
* 创建者
*/
@TableField(value = "create_user")
private Integer createUser;
/**
* 记录最后一次修改者
*/
@TableField(value = "modify_user")
private Integer modifyUser;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
private Date modifyTime;
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 合同项目关联
*/
@Data
@TableName(value = "r_contract_store")
public class RContractStore {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 合同ID
*/
@TableField(value = "contract_id")
private Long contractId;
/**
* 项目ID
*/
@TableField(value = "store_id")
private Long storeId;
/**
* 记录创建者
*/
@TableField(value = "create_user")
private Long createUser;
/**
* 记录最后一次修改者
*/
@TableField(value = "modify_user")
private Long modifyUser;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 修改时间
*/
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.RRoleResourceDTO;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/28
*/
@Data
@TableName(value = "r_role_resource")
@AutoMappers({
@AutoMapper(target = RRoleResourceDTO.class),
})
public class RRoleResource {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 角色id
*/
@TableField(value = "role_id")
private Long roleId;
/**
* 资源id
*/
@TableField(value = "resource_id")
private Long resourceId;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.RUserRoleDTO;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/28
*/
@Data
@TableName(value = "r_user_role")
@AutoMappers({
@AutoMapper(target = RUserRoleDTO.class),
})
public class RUserRole {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
@TableField(value = "user_id")
private Long userId;
/**
* 角色id
*/
@TableField(value = "role_id")
private Long roleId;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.ResourceDTO;
import vion.vo.ResourceVO;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/28
*/
@Data
@TableName(value = "tbl_resource")
@AutoMappers({
@AutoMapper(target = ResourceVO.class),
@AutoMapper(target = ResourceDTO.class),
})
public class Resource {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 名称
*/
@TableField(value = "\"name\"")
private String name;
/**
* 父id
*/
@TableField(value = "parent_id")
private Long parentId;
/**
* 路径
*/
@TableField(value = "\"path\"")
private String path;
/**
* 组件
*/
@TableField(value = "component")
private String component;
/**
* 权限标识符
*/
@TableField(value = "perm")
private String perm;
/**
* 类型 M:菜单,B:按钮
*/
@TableField(value = "\"type\"")
private String type;
/**
* 排序
*/
@TableField(value = "sort_code")
private Integer sortCode;
/**
* 备注
*/
@TableField(value = "remark")
private String remark;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.RoleDTO;
import vion.vo.RoleVO;
import java.util.Date;
/**
* 角色表
*/
@Data
@TableName(value = "tbl_role")
@AutoMappers({
@AutoMapper(target = RoleVO.class),
@AutoMapper(target = RoleDTO.class),
})
public class Role {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 角色名称
*/
@TableField(value = "\"name\"")
private String name;
/**
* 角色编码
*/
@TableField(value = "code")
private String code;
/**
* 状态
*/
@TableField(value = "status")
private Integer status;
/**
* 备注
*/
@TableField(value = "remark")
private String remark;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
/**
* @author HlQ
* @date 2023/11/28
*/
......@@ -2,7 +2,10 @@ package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.vo.UserVO;
import java.util.Date;
......@@ -11,6 +14,9 @@ import java.util.Date;
*/
@Data
@TableName(value="tbl_user_info")
@AutoMappers({
@AutoMapper(target = UserVO.class),
})
public class User {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
......@@ -36,6 +42,4 @@ public class User {
/* 状态 0:正常 1:禁用 */
private Integer status;
@TableField(exist = false)
private String token;
}
\ No newline at end of file
package vion.service;
import vion.model.ContractInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author HlQ
* @date 2023/11/29
*/
public interface IContractInfoService extends IService<ContractInfo>{
}
package vion.service;
import vion.model.ContractPaymentInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author HlQ
* @date 2023/11/29
*/
public interface IContractPaymentInfoService extends IService<ContractPaymentInfo>{
}
package vion.service;
import vion.model.RRoleResource;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface IRRoleResourceService extends IService<RRoleResource>{
}
package vion.service;
import vion.model.RUserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface IRUserRoleService extends IService<RUserRole>{
}
package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.ResourceDTO;
import vion.model.Resource;
import vion.vo.ResourceVO;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface IResourceService extends IService<Resource>{
Page<ResourceVO> list(ResourceDTO dto);
}
package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.RoleDTO;
import vion.model.Role;
import vion.vo.RoleVO;
/**
* @author HlQ
* @date 2023/11/28
*/
public interface IRoleService extends IService<Role>{
Page<RoleVO> list(RoleDTO dto);
}
package vion.service;
import vion.model.RContractStore;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author HlQ
* @date 2023/11/29
*/
public interface RContractStoreService extends IService<RContractStore>{
}
package vion.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vion.mapper.ContractInfoMapper;
import vion.model.ContractInfo;
import vion.service.IContractInfoService;
/**
* @author HlQ
* @date 2023/11/29
*/
@Service
public class ContractInfoServiceImpl extends ServiceImpl<ContractInfoMapper, ContractInfo> implements IContractInfoService {
}
package vion.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vion.model.ContractPaymentInfo;
import vion.mapper.ContractPaymentInfoMapper;
import vion.service.IContractPaymentInfoService;
/**
* @author HlQ
* @date 2023/11/29
*/
@Service
public class ContractPaymentInfoServiceImpl extends ServiceImpl<ContractPaymentInfoMapper, ContractPaymentInfo> implements IContractPaymentInfoService {
}
package vion.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vion.mapper.RContractStoreMapper;
import vion.model.RContractStore;
import vion.service.RContractStoreService;
/**
* @author HlQ
* @date 2023/11/29
*/
@Service
public class RContractStoreServiceImpl extends ServiceImpl<RContractStoreMapper, RContractStore> implements RContractStoreService{
}
package vion.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vion.mapper.RRoleResourceMapper;
import vion.model.RRoleResource;
import vion.service.IRRoleResourceService;
/**
* @author HlQ
* @date 2023/11/28
*/
@Service
public class RRoleResourceServiceImpl extends ServiceImpl<RRoleResourceMapper, RRoleResource> implements IRRoleResourceService {
}
package vion.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vion.mapper.RUserRoleMapper;
import vion.model.RUserRole;
import vion.service.IRUserRoleService;
/**
* @author HlQ
* @date 2023/11/28
*/
@Service
public class RUserRoleServiceImpl extends ServiceImpl<RUserRoleMapper, RUserRole> implements IRUserRoleService {
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import vion.dto.ResourceDTO;
import vion.mapper.ResourceMapper;
import vion.model.Resource;
import vion.service.IResourceService;
import vion.vo.ResourceVO;
import java.util.List;
/**
* @author HlQ
* @date 2023/11/28
*/
@Service
@RequiredArgsConstructor
public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> implements IResourceService {
private final Converter converter;
@Override
public Page<ResourceVO> list(ResourceDTO dto) {
Page<Resource> resourcePage = this
.lambdaQuery(converter.convert(dto, new Resource()))
.page(Page.of(dto.getPageNum(), dto.getPageSize()));
List<ResourceVO> resourceVOList = converter.convert(resourcePage.getRecords(), ResourceVO.class);
return Page.<ResourceVO>of(resourcePage.getCurrent(), resourcePage.getSize(), resourcePage.getTotal()).setRecords(resourceVOList);
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import vion.dto.RoleDTO;
import vion.mapper.RoleMapper;
import vion.model.Role;
import vion.service.IRoleService;
import vion.vo.RoleVO;
import java.util.List;
/**
* @author HlQ
* @date 2023/11/28
*/
@Service
@RequiredArgsConstructor
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
private final Converter converter;
@Override
public Page<RoleVO> list(RoleDTO dto) {
Page<Role> rolePage = this
.lambdaQuery(converter.convert(dto, new Role()))
.between(dto.getStartDate() != null && dto.getEndDate() != null, Role::getCreateTime, dto.getStartDate(), dto.getEndDate())
.page(Page.of(dto.getPageNum(), dto.getPageSize()));
List<RoleVO> roleVOList = converter.convert(rolePage.getRecords(), RoleVO.class);
return Page.<RoleVO>of(rolePage.getCurrent(), rolePage.getSize(), rolePage.getTotal()).setRecords(roleVOList);
}
}
......@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import org.springframework.stereotype.Service;
import vion.ding.WechatMod;
import vion.third.WechatMod;
import vion.mapper.ServiceOrderMapper;
import vion.model.ServiceOrder;
import vion.model.Task;
......
......@@ -20,8 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vion.Global;
import vion.ding.DingMod;
import vion.ding.WechatMod;
import vion.third.DingMod;
import vion.third.WechatMod;
import vion.dto.TaskDTO;
import vion.mapper.ServiceOrderMapper;
import vion.mapper.TaskMapper;
......@@ -29,6 +29,7 @@ import vion.model.Dictionary;
import vion.model.*;
import vion.service.*;
import vion.vo.TaskVO;
import vion.vo.UserVO;
import java.io.File;
import java.io.IOException;
......@@ -99,7 +100,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
@Override
@Transactional(rollbackFor = Exception.class)
public Long circTask(TaskDTO data, String token) {
User user = Global.USERNAME_MAP.get(token);
UserVO user = Global.USERNAME_MAP.get(token);
Task task = converter.convert(data, Task.class);
if (task.getId() == null) {
......
......@@ -15,8 +15,8 @@ import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import vion.ding.DingMod;
import vion.ding.WechatMod;
import vion.third.DingMod;
import vion.third.WechatMod;
import vion.dto.TaskTempDTO;
import vion.mapper.TaskTempMapper;
import vion.model.FileInfo;
......
package vion.ding;
package vion.third;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import cn.hutool.core.codec.Base64;
......@@ -18,16 +19,17 @@ import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import vion.Global;
import vion.dto.DingDTO;
import vion.model.Dept;
import vion.model.User;
import vion.service.IDeptService;
import vion.service.IUserService;
import vion.model.*;
import vion.service.*;
import vion.vo.RoleVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
......@@ -35,6 +37,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author HlQ
......@@ -51,7 +54,12 @@ public class DingMod {
private String appSecret;
private final IUserService userService;
private final IRoleService roleService;
private final IResourceService resourceService;
private final IRUserRoleService userRoleService;
private final IRRoleResourceService roleResourceService;
private final IDeptService deptService;
private final Converter converter;
private final TimedCache<String, String> timedCache = CacheUtil.newTimedCache(7000 * 1000);
/**
......@@ -191,8 +199,8 @@ public class DingMod {
* 钉钉回调接口
*
* @param target login,inside 区分是钉钉扫码登录还是钉钉内打开链接
* @param dto dto
* @param res httpServletResponse
* @param dto dto
* @param res httpServletResponse
* @return java.lang.Object
*/
public Object dingCallback(String target, DingDTO dto, HttpServletResponse res) {
......@@ -226,11 +234,38 @@ public class DingMod {
}
String userid = useridObj.getJSONObject("result").getStr("userid");
User user = userService.lambdaQuery().select(User::getId, User::getUserid, User::getUsername, User::getPhone, User::getStatus).eq(User::getUserid, userid).one();
if (user.getStatus() == 1) {
UserVO userVO = converter.convert(user, new UserVO());
if (userVO.getStatus() == 1) {
return "该用户禁止登录系统,请联系管理员!";
}
user.setToken(accessToken);
Global.USERNAME_MAP.put(accessToken, user);
Long id = userVO.getId();
List<RUserRole> userRoleList = userRoleService.lambdaQuery().eq(RUserRole::getUserId, id).list();
Opt.ofEmptyAble(userRoleList)
.map(urList -> urList.stream().map(RUserRole::getRoleId).collect(Collectors.toList()))
.map(roleIdList -> {
// 获取用户关联的角色
List<Role> roles = roleService.listByIds(roleIdList);
List<RoleVO> roleVOS = converter.convert(roles, RoleVO.class);
userVO.setRoleVOList(roleVOS);
return roleResourceService.lambdaQuery().select(RRoleResource::getResourceId).in(RRoleResource::getRoleId, roleIdList).list();
})
.map(rrList -> rrList.stream().map(RRoleResource::getResourceId).collect(Collectors.toList()))
.ifPresent(resourceIdList -> {
// 获取角色关联的资源
List<Resource> resourceList = resourceService.listByIds(resourceIdList);
List<String> permCodeList = resourceList.stream().map(Resource::getPerm).collect(Collectors.toList());
userVO.setPermCodeList(permCodeList);
});
StpUtil.login(id);
String token = StpUtil.getTokenValue();
userVO.setToken(token);
StpUtil.getTokenSession().set("curLoginUser", userVO);
Global.USERNAME_MAP.put(token, userVO);
// todo 返回权限码合集
return user;
} else if (StrUtil.equals(target, "inside")) {
String response = HttpUtil.post(buildSignUrl(), "{\"tmp_auth_code\":\"" + dto.getCode() + "\"}");
......@@ -248,10 +283,12 @@ public class DingMod {
return useridObj;
}
String userid = useridObj.getJSONObject("result").getStr("userid");
User user = userService.lambdaQuery().select(User::getId, User::getUserid, User::getUsername, User::getPhone).eq(User::getUserid, userid).one();
User user = userService.lambdaQuery().select(User::getId, User::getUserid, User::getUsername, User::getPhone, User::getStatus).eq(User::getUserid, userid).one();
UserVO userVO = converter.convert(user, new UserVO());
String token = IdUtil.simpleUUID();
user.setToken(token);
Global.USERNAME_MAP.put(token, user);
userVO.setToken(token);
Global.USERNAME_MAP.put(token, userVO);
try {
if (ObjUtil.isAllNotEmpty(dto.getStoreId(), dto.getTaskId())) {
res.sendRedirect("https://yunwei.vionyun.com:8443/wap/workflow-process?token=" + token + "&storeId=" + dto.getStoreId() + "&taskId=" + dto.getTaskId());
......
package vion.ding;
package vion.third;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
......
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
/**
* 合同收款方式
*/
@Getter
@Setter
public class ContractPaymentVO {
private Long id;
/**
* 合同ID
*/
private Long contractId;
/**
* 付款方式:1-签订 2-发货 3-货到 4-安装 5-验收 6-质保
*/
private Integer paymentType;
/**
* 付款比例
*/
private BigDecimal paymentRatios;
/**
* 创建者
*/
private Integer createUser;
/**
* 记录最后一次修改者
*/
private Integer modifyUser;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}
\ No newline at end of file
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
public class ContractVO {
private Long id;
/**
* 合同名称
*/
private String name;
/**
* 合同编号
*/
private String contractNo;
/**
* 合同类型:1-维保合同 2-框架合同 3-集成合同 4-供货合同 5-供货施工合同 0-其他
*/
private Integer type;
/**
* 合同签订日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date signDate;
/**
* 合同维保开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date maintainSdate;
/**
* 合同维保结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date maintainEdate;
/**
* 合同进度:1-签订 2-发货 3-货到 4-安装 5-验收 6-质保
*/
private Integer status;
/**
* 合同总金额
*/
private BigDecimal totalAmount;
/**
* 合同已收金额:人工编辑
*/
private BigDecimal paidAmount;
/**
* 合同应收金额:
* 根据【合同进度】,由系统判断出应该收到的金额
*/
private BigDecimal receivableAmount;
/**
* 合同未收金额:total-(paid+receivable)
*/
private BigDecimal outstandingAmount;
/**
* 合同签订主体
*/
private String subject;
/**
* 合同甲方名称
*/
private String customerName;
/**
* 销售人员名称
*/
private String saleName;
/**
* 备注
*/
private String remark;
/**
* 记录创建者
*/
private Long createUser;
/**
* 记录最后一次修改者
*/
private Long modifyUser;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}
\ No newline at end of file
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/28
*/
@Getter
@Setter
public class ResourceVO {
private Long id;
/**
* 名称
*/
private String name;
/**
* 父id
*/
private Long parentId;
/**
* 路径
*/
private String path;
/**
* 组件
*/
private String component;
/**
* 权限标识符
*/
private String perm;
/**
* 类型 M:菜单,B:按钮
*/
private String type;
/**
* 排序
*/
private Integer sortCode;
/**
* 备注
*/
private String remark;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/28
*/
@Getter
@Setter
public class RoleVO {
private Long id;
private String name;
private String code;
private Integer status;
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
@Getter
@Setter
public class UserVO {
private Long id;
private String userid;
private String username;
private String password;
private String phone;
private Long deptId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
private String remark;
/** 是否是预工单处理人 0:不是 1:是 */
private Integer preWorkOrder;
/** 员工状态 2:试用期 3:正式 5:待离职 -1:无状态 */
private Integer employeeStatus;
/* 状态 0:正常 1:禁用 */
private Integer status;
private String token;
/** 权限码列表 */
private List<String> permCodeList;
private List<RoleVO> roleVOList;
}
\ No newline at end of file
......@@ -9,4 +9,4 @@ fileUrl=D:/pic
#fileurl=/nas-data/work-order
appkey=dingkrzwks0jpi2di3uo
appsecret=Ul5UTZqIost_kEAdfZXidvLoZhzvraYurm_g7PCHg-IrDMLHT7mdSgRS1iCHrDPt
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
......@@ -16,4 +16,9 @@ spring:
wx:
mp:
appid: wx96d05a0e5749f058
secret: 6033fa4f99d855cb914ec1fe2ecc77bd
\ No newline at end of file
secret: 6033fa4f99d855cb914ec1fe2ecc77bd
sa-token:
token-name: token
timeout: 3600
token-style: simple-uuid
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!