优化客户菜单
This commit is contained in:
parent
247ab3f00f
commit
693b8a60e9
|
|
@ -46,8 +46,6 @@ public class CustomerController {
|
|||
@Resource
|
||||
private CustomerService customerService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建客户")
|
||||
@PreAuthorize("@ss.hasPermission('oms:customer:create')")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ public class CustomerPageReqVO extends PageParam {
|
|||
@Schema(description = "ID", example = "21486")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "编码", example = "21486")
|
||||
private String number;
|
||||
|
||||
@Schema(description = "名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@ public class CustomerRespVO {
|
|||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户ID", example = "12355")
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "编码", example = "12355")
|
||||
@ExcelProperty("编码")
|
||||
private String number;
|
||||
|
||||
@Schema(description = "名称", example = "赵六")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ public class CustomerSaveReqVO {
|
|||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "编码", example = "XXXXX")
|
||||
private String number;
|
||||
|
||||
@Schema(description = "名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,9 +148,8 @@ public class SaleOrderController {
|
|||
*/
|
||||
@GetMapping("/download")
|
||||
@PermitAll
|
||||
public void downloadPdf(HttpServletResponse response) throws Exception {
|
||||
String htmlContent = saleOrderService.generateHtmlContent();
|
||||
saleOrderService.generatePdf(response, htmlContent);
|
||||
public void downloadPdf(HttpServletResponse response) throws Exception{
|
||||
saleOrderService.generatePdf(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,6 +27,10 @@ public class CustomerDO extends BaseDO {
|
|||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 客户编码
|
||||
*/
|
||||
private String number;
|
||||
/**
|
||||
* 系统用户Id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class SaleContractDO extends BaseDO {
|
|||
/**
|
||||
* 客户id
|
||||
*/
|
||||
private String customerId;
|
||||
private Long customerId;
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
|
|||
|
||||
default PageResult<CustomerDO> selectPage(CustomerPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerDO>()
|
||||
.eqIfPresent(CustomerDO::getId, reqVO.getId())
|
||||
.eqIfPresent(CustomerDO::getNumber, reqVO.getNumber())
|
||||
.likeIfPresent(CustomerDO::getName, reqVO.getName())
|
||||
.likeIfPresent(CustomerDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(CustomerDO::getType, reqVO.getType())
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
package cn.hangtag.module.oms.service.customer;
|
||||
|
||||
import cn.hangtag.framework.common.exception.ServiceException;
|
||||
import cn.hangtag.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||
import cn.hangtag.framework.common.util.FuncUtil;
|
||||
import cn.hangtag.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.produceorder.ProduceOrderDO;
|
||||
import cn.hangtag.module.oms.serialnumber.CodingRulesUtils;
|
||||
import cn.hangtag.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.hangtag.module.system.service.permission.PermissionService;
|
||||
import cn.hangtag.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -30,6 +39,7 @@ import static cn.hangtag.module.oms.enums.ErrorCodeConstants.*;
|
|||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class CustomerServiceImpl implements CustomerService {
|
||||
|
||||
@Value("${sys.user.init-password:hangtagyuanma}")
|
||||
|
|
@ -51,6 +61,12 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
public Long createCustomer(CustomerSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CustomerDO customer = BeanUtils.toBean(createReqVO, CustomerDO.class);
|
||||
String number = customer.getNumber();
|
||||
if(FuncUtil.isNotEmpty(number)){
|
||||
checkCode(customer.getId(),number);
|
||||
}else {
|
||||
customer.setNumber(getNewCode());
|
||||
}
|
||||
|
||||
//新增用户账号
|
||||
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
||||
|
|
@ -82,31 +98,54 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateCustomer(CustomerSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCustomerExists(updateReqVO.getId());
|
||||
CustomerDO customerDO = validateCustomerExists(updateReqVO.getId());
|
||||
|
||||
if(StringUtils.isNotBlank(updateReqVO.getNumber()) && !customerDO.getNumber().equals(updateReqVO.getNumber())){//编码不一致
|
||||
checkCode(customerDO.getId(),updateReqVO.getNumber());
|
||||
}else {
|
||||
updateReqVO.setNumber(customerDO.getNumber());
|
||||
}
|
||||
|
||||
// 更新
|
||||
CustomerDO updateObj = BeanUtils.toBean(updateReqVO, CustomerDO.class);
|
||||
customerMapper.updateById(updateObj);
|
||||
|
||||
// 更新子表
|
||||
updateCustomerAddressList(updateReqVO.getId(), updateReqVO.getCustomerAddresss());
|
||||
|
||||
|
||||
//更新用户表状态
|
||||
if(!customerDO.getStatus().equals(updateObj.getStatus())){//状态不一致
|
||||
if("0".equals(customerDO.getStatus())){//禁用
|
||||
userService.updateUserStatus(customerDO.getUserId(), 1);
|
||||
}else {//启用
|
||||
userService.updateUserStatus(customerDO.getUserId(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteCustomer(Long id) {
|
||||
// 校验存在
|
||||
validateCustomerExists(id);
|
||||
CustomerDO customerDO = validateCustomerExists(id);
|
||||
|
||||
// 删除
|
||||
customerMapper.deleteById(id);
|
||||
|
||||
// 删除子表
|
||||
deleteCustomerAddressByCustomerId(id);
|
||||
|
||||
// 删除用户表
|
||||
userService.deleteUser(customerDO.getUserId());
|
||||
|
||||
}
|
||||
|
||||
private void validateCustomerExists(Long id) {
|
||||
if (customerMapper.selectById(id) == null) {
|
||||
private CustomerDO validateCustomerExists(Long id) {
|
||||
CustomerDO customerDO = customerMapper.selectById(id);
|
||||
if (customerDO == null) {
|
||||
throw exception(CUSTOMER_NOT_EXISTS);
|
||||
}else {
|
||||
return customerDO;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,4 +187,47 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
customerAddressMapper.deleteByCustomerId(customerId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private String getNewCode() {
|
||||
String s = "";
|
||||
int count = 10;
|
||||
while (true){
|
||||
count --;
|
||||
try {
|
||||
s = CodingRulesUtils.generateCode(3L, false);
|
||||
checkCode(null,s);
|
||||
return s;
|
||||
}catch (ServiceException e){
|
||||
log.warn("重复或者下一个编码");
|
||||
if(count < 0){
|
||||
log.error("编码获取失败");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCode(Long id,String code){
|
||||
if(FuncUtil.isNotEmpty(code)){
|
||||
LambdaQueryWrapper<CustomerDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CustomerDO::getId,CustomerDO::getNumber, BaseDO::getDeleted);
|
||||
lambdaQueryWrapper.eq(CustomerDO::getNumber, code);
|
||||
lambdaQueryWrapper.eq(CustomerDO::getDeleted,false);
|
||||
List<CustomerDO> dos = customerMapper.selectList(lambdaQueryWrapper);
|
||||
if(FuncUtil.isEmpty(id) && FuncUtil.isNotEmpty(dos)){
|
||||
throw exception(GlobalErrorCodeConstants.DATA_DUPLICATE);
|
||||
}
|
||||
if (FuncUtil.isNotEmpty(id) && FuncUtil.isNotEmpty(dos)) {
|
||||
for (CustomerDO aDo : dos) {
|
||||
// 出现重复并当前id 不一致
|
||||
if(!FuncUtil.equals(aDo.getId(), id)){
|
||||
throw exception(GlobalErrorCodeConstants.DATA_DUPLICATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ public class ProduceOrderServiceImpl implements ProduceOrderService {
|
|||
while (true){
|
||||
count --;
|
||||
try {
|
||||
s = CodingRulesUtils.generateCode(3L, false);
|
||||
s = CodingRulesUtils.generateCode(5L, false);
|
||||
checkCode(null,s);
|
||||
return s;
|
||||
}catch (ServiceException e){
|
||||
|
|
|
|||
|
|
@ -74,9 +74,7 @@ public interface SaleOrderService {
|
|||
|
||||
void generateProduceOrder(List<Long> ids);
|
||||
|
||||
String generateHtmlContent();
|
||||
|
||||
void generatePdf(HttpServletResponse response, String htmlContent) throws IOException;
|
||||
void generatePdf(HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 交易订单销售额对照
|
||||
|
|
|
|||
|
|
@ -2,20 +2,28 @@ package cn.hangtag.module.oms.service.saleorder;
|
|||
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.util.object.BeanUtils;
|
||||
import cn.hangtag.module.oms.common.utils.NumberChineseFormatterUtils;
|
||||
import cn.hangtag.module.oms.common.utils.WKHtmlToPdfUtil;
|
||||
import cn.hangtag.module.oms.controller.admin.common.vo.DataComparisonRespVO;
|
||||
import cn.hangtag.module.oms.controller.admin.produceorder.vo.ProduceOrderSaveReqVO;
|
||||
import cn.hangtag.module.oms.common.utils.NumberChineseFormatterUtils;
|
||||
import cn.hangtag.module.oms.controller.admin.salecontract.vo.SaleContractSaveReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderPageReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderSaveReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.trade.vo.TradeOrderSummaryRespVO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.customer.CustomerDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.productinfo.ProductInfoDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.salecontract.SaleContractDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.salecontractentry.SaleContractEntryDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleorder.SaleOrderDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleorderentry.SaleOrderEntryDO;
|
||||
import cn.hangtag.module.oms.dal.mysql.saleorder.SaleOrderMapper;
|
||||
import cn.hangtag.module.oms.dal.mysql.saleorderentry.SaleOrderEntryMapper;
|
||||
import cn.hangtag.module.oms.enums.common.BillStatusEnum;
|
||||
import cn.hangtag.module.oms.enums.saleorder.SaleOrderStatusEnum;
|
||||
import cn.hangtag.module.oms.service.customer.CustomerService;
|
||||
import cn.hangtag.module.oms.service.produceorder.ProduceOrderService;
|
||||
import cn.hangtag.module.oms.service.productinfo.ProductInfoService;
|
||||
import cn.hangtag.module.oms.service.salecontract.SaleContractService;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
|
|
@ -23,6 +31,7 @@ import cn.hutool.core.io.IoUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -60,6 +69,12 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
private SaleOrderEntryMapper saleOrderEntryMapper;
|
||||
@Resource
|
||||
private ProduceOrderService produceOrderService;
|
||||
@Resource
|
||||
private ProductInfoService productInfoService;
|
||||
@Resource
|
||||
private SaleContractService saleContractService;
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
|
||||
@Resource
|
||||
private TemplateEngine templateEngine;
|
||||
|
|
@ -174,46 +189,56 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateHtmlContent() {
|
||||
private String generateHtmlContent(Long saleContractId) {
|
||||
SaleContractDO saleContract = saleContractService.getSaleContract(saleContractId);
|
||||
List<SaleContractEntryDO> saleContractEntrys = saleContractService.getSaleContractEntryListByParentId(saleContractId);
|
||||
CustomerDO customer = customerService.getCustomer(saleContract.getCustomerId());
|
||||
Context context = new Context();
|
||||
context.setVariable("title", "销售合约");
|
||||
context.setVariable("partyACompany", "甲方(买方)公司");
|
||||
context.setVariable("contractNo", "合约编号XXXXXXX");
|
||||
context.setVariable("partyAAddress", "甲方地址XXXXXXXXXXXX");
|
||||
context.setVariable("bizDate", DateUtil.date().toDateStr());
|
||||
context.setVariable("customerNo", "托尼");
|
||||
context.setVariable("headUserName", "美特斯");
|
||||
context.setVariable("partyBCompany", "乙方(卖方)公司");
|
||||
context.setVariable("phone", "17198644317");
|
||||
context.setVariable("partyACompany", saleContract.getPartyA());
|
||||
context.setVariable("contractNo", saleContract.getBillno());
|
||||
context.setVariable("partyAAddress", customer.getCompanyAddress());
|
||||
context.setVariable("bizDate", DateUtil.date(saleContract.getBizdate()).toDateStr());
|
||||
context.setVariable("customerNo", customer.getNumber());
|
||||
context.setVariable("headUserName", saleContract.getHead());
|
||||
context.setVariable("partyBCompany", "乙方公司");
|
||||
context.setVariable("partyBAddress", "乙方地址XXXXXXXXXXX");
|
||||
context.setVariable("fax", "CCCCCCCCCCCCC");
|
||||
context.setVariable("clerk", "李四");
|
||||
context.setVariable("saleOrderNo", "订单编号XXXXXXXXXX");
|
||||
context.setVariable("totalAmount", "1891.98");
|
||||
context.setVariable("phone", saleContract.getPhone());
|
||||
context.setVariable("fax", saleContract.getFax());
|
||||
context.setVariable("clerk", saleContract.getClerk());
|
||||
context.setVariable("saleOrderNo", saleContract.getCustomerBuyNo());
|
||||
context.setVariable("totalAmount", saleContract.getAmount());
|
||||
context.setVariable("zhTotalAmount", "合共人民币"+NumberChineseFormatterUtils.convertToChinese(saleContract.getAmount())+"整");
|
||||
|
||||
for (int i = 0; i < saleContractEntrys.size(); i++) {
|
||||
SaleContractEntryDO saleContractEntryDO = saleContractEntrys.get(i);
|
||||
ProductInfoDO productInfo = productInfoService.getProductInfo(saleContractEntryDO.getProductId());
|
||||
//产品信息
|
||||
String code = productInfo.getCode();
|
||||
String name = productInfo.getName();
|
||||
String details = productInfo.getDetails();
|
||||
|
||||
context.setVariable("zhTotalAmount", "合共人民币"+NumberChineseFormatterUtils.convertToChinese(new BigDecimal("1891.98"))+"整");
|
||||
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
context.setVariable("item"+i, i+"");
|
||||
context.setVariable("explain"+i, "AXXX"+i);
|
||||
context.setVariable("qty"+i, "1233PCS");
|
||||
context.setVariable("price"+i, "8.12");
|
||||
context.setVariable("discount"+i, "0");
|
||||
context.setVariable("amount"+i, "123");
|
||||
context.setVariable("deliverydate"+i, "2024-09-15");
|
||||
context.setVariable("explain"+i+"1", "11111111");
|
||||
context.setVariable("explain"+i+"2", "22222222222222");
|
||||
context.setVariable("explain"+i+"3", "3333333333333333");
|
||||
int j = i+1;
|
||||
context.setVariable("item"+j, j+"");
|
||||
context.setVariable("explain"+j, code);
|
||||
context.setVariable("qty"+j, saleContractEntryDO.getQty());
|
||||
context.setVariable("price"+j, saleContractEntryDO.getPrice());
|
||||
context.setVariable("discount"+j, saleContractEntryDO.getDiscount());
|
||||
context.setVariable("amount"+j, saleContractEntryDO.getAmount());
|
||||
context.setVariable("deliverydate"+j, saleContractEntryDO.getDeliveryDate());
|
||||
context.setVariable("explain"+j+"1", name);
|
||||
context.setVariable("explain"+j+"2", details);
|
||||
context.setVariable("explain"+j+"3", "");
|
||||
}
|
||||
|
||||
return templateEngine.process("pdf_template", context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generatePdf(HttpServletResponse response, String htmlContent) throws IOException {
|
||||
public void generatePdf(HttpServletResponse response) throws IOException {
|
||||
|
||||
String htmlContent = generateHtmlContent(0L);
|
||||
|
||||
|
||||
// 设置响应类型
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=generated.pdf");
|
||||
|
|
@ -233,7 +258,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
IoUtil.copy(inputStream, response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
// 异常处理
|
||||
log.info("导出电子病历写入流失败,{}", e.getMessage());
|
||||
log.info("导出销售合约写入流失败,{}", e.getMessage());
|
||||
}
|
||||
|
||||
// 导出完删除
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package cn.hangtag.module.system.controller.admin.auth;
|
||||
|
||||
import cn.hangtag.framework.common.util.json.JsonUtils;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hangtag.framework.common.enums.CommonStatusEnum;
|
||||
import cn.hangtag.framework.common.enums.UserTypeEnum;
|
||||
|
|
@ -19,11 +21,13 @@ import cn.hangtag.module.system.service.permission.PermissionService;
|
|||
import cn.hangtag.module.system.service.permission.RoleService;
|
||||
import cn.hangtag.module.system.service.social.SocialClientService;
|
||||
import cn.hangtag.module.system.service.user.AdminUserService;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -31,6 +35,7 @@ import javax.annotation.Resource;
|
|||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
@ -111,8 +116,14 @@ public class AuthController {
|
|||
List<MenuDO> menuList = menuService.getMenuList(menuIds);
|
||||
menuList.removeIf(menu -> !CommonStatusEnum.ENABLE.getStatus().equals(menu.getStatus())); // 移除禁用的菜单
|
||||
|
||||
AuthPermissionInfoRespVO convert = AuthConvert.INSTANCE.convert(user, roles, menuList);
|
||||
if(user.getDeptId()==999999L){//当前账号等于客户类型
|
||||
String customerMenuJson = ResourceUtil.readUtf8Str("json/customer_menu.json");
|
||||
List<AuthPermissionInfoRespVO.MenuVO> list = JSONUtil.toList(customerMenuJson, AuthPermissionInfoRespVO.MenuVO.class);
|
||||
convert.setMenus(list);
|
||||
}
|
||||
// 2. 拼接结果返回
|
||||
return success(AuthConvert.INSTANCE.convert(user, roles, menuList));
|
||||
return success(convert);
|
||||
}
|
||||
|
||||
// ========== 短信登录相关 ==========
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
|
||||
.inIfPresent(AdminUserDO::getDeptId, deptIds)
|
||||
.neIfPresent(AdminUserDO::getDeptId, 999999L)//不等于客户
|
||||
.orderByDesc(AdminUserDO::getId));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
[
|
||||
{
|
||||
"id": 2804,
|
||||
"parentId": 0,
|
||||
"name": "订单管理",
|
||||
"path": "/order",
|
||||
"component": "",
|
||||
"componentName": "",
|
||||
"icon": "ep:edit",
|
||||
"visible": true,
|
||||
"keepAlive": true,
|
||||
"alwaysShow": true,
|
||||
"children": [
|
||||
{
|
||||
"id": 2818,
|
||||
"parentId": 2804,
|
||||
"name": "创建订单",
|
||||
"path": "createorder",
|
||||
"component": "oms/order/createorder/index",
|
||||
"componentName": "CreateOrder",
|
||||
"icon": "",
|
||||
"visible": true,
|
||||
"keepAlive": true,
|
||||
"alwaysShow": true,
|
||||
"children": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -40,6 +40,12 @@ spring:
|
|||
redis:
|
||||
time-to-live: 1h # 设置过期时间为 1 小时
|
||||
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
mode: HTML
|
||||
encoding: UTF-8
|
||||
cache: false
|
||||
--- #################### 接口文档配置 ####################
|
||||
|
||||
springdoc:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ import request from '@/config/axios'
|
|||
|
||||
// 客户 VO
|
||||
export interface CustomerVO {
|
||||
id: number // 编码
|
||||
number: string // 编码
|
||||
name: string // 名称
|
||||
userId: number // 用户id
|
||||
company: string // 公司
|
||||
companyAddress: string // 公司
|
||||
email: string // 邮箱
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export const ProduceOrderApi = {
|
|||
return await request.download({ url: `/oms/produce-order/export-excel`, params })
|
||||
},
|
||||
|
||||
importTemplate: async (params) => {
|
||||
importTemplate: async () => {
|
||||
return request.download({ url: '/oms/produce-order/get-import-template' })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ const loginData = reactive({
|
|||
captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE,
|
||||
tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE,
|
||||
loginForm: {
|
||||
tenantName: '芋道源码',
|
||||
tenantName: '',
|
||||
username: '',
|
||||
password: '',
|
||||
captchaVerification: '',
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@
|
|||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="编码" prop="number">
|
||||
<div class="flex w-full">
|
||||
<el-input v-model="formData.number" :placeholder="formData.id==null?'编码为空时自动生成':''" :disabled="!inputCode" />
|
||||
<el-button @click=" inputCode = true">手动输入</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
|
|
@ -61,7 +67,7 @@
|
|||
</el-form>
|
||||
<!-- 子表的表单 -->
|
||||
<el-tabs v-model="subTabsName">
|
||||
<el-tab-pane label="用户地址" name="customerAddress">
|
||||
<el-tab-pane label="客户地址" name="customerAddress">
|
||||
<CustomerAddressForm ref="customerAddressFormRef" :customer-id="formData.id" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
|
@ -89,6 +95,7 @@ const areaList = ref([]) // 地区列表
|
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
number: undefined,
|
||||
name: undefined,
|
||||
company: undefined,
|
||||
companyAddress: undefined,
|
||||
|
|
@ -128,11 +135,15 @@ const formRef = ref() // 表单 Ref
|
|||
const subTabsName = ref('customerAddress')
|
||||
const customerAddressFormRef = ref()
|
||||
|
||||
|
||||
const inputCode = ref(false)
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
inputCode.value = false
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
|
|
@ -185,6 +196,7 @@ const submitForm = async () => {
|
|||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
number: undefined,
|
||||
name: undefined,
|
||||
company: undefined,
|
||||
companyAddress: undefined,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="ID" prop="id">
|
||||
<el-form-item label="编码" prop="number">
|
||||
<el-input
|
||||
v-model="queryParams.id"
|
||||
placeholder="请输入ID"
|
||||
v-model="queryParams.number"
|
||||
placeholder="请输入编码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
>
|
||||
<Icon icon="ep:delete" class="mr-5px" /> 删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-col>-->
|
||||
</el-row>
|
||||
</ContentWrap>
|
||||
|
||||
|
|
@ -108,7 +108,8 @@
|
|||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column width="30" label="选择" type="selection" />
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="ID" align="center" v-if="false" prop="id" />
|
||||
<el-table-column label="编码" align="center" prop="number" />
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="公司" align="center" prop="company" />
|
||||
<el-table-column label="邮箱" align="center" prop="email" />
|
||||
|
|
@ -134,7 +135,7 @@
|
|||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" width="180px">
|
||||
<el-table-column label="操作" align="center" width="320px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
|
|
@ -149,6 +150,7 @@
|
|||
preIcon="ep:basketball"
|
||||
title="品牌权限"
|
||||
type="primary"
|
||||
v-hasPermi="['oms:customer:assign-customer-brand']"
|
||||
@click="openAssignBrandForm(scope.row)"
|
||||
>
|
||||
品牌权限
|
||||
|
|
@ -161,6 +163,32 @@
|
|||
>
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
<el-dropdown
|
||||
@command="(command) => handleCommand(command, scope.row)"
|
||||
v-hasPermi="[
|
||||
'oms:customer:delete',
|
||||
'oms:customer:update-password',
|
||||
]"
|
||||
>
|
||||
<el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<!-- <el-dropdown-item
|
||||
command="handleDelete"
|
||||
v-if="checkPermi(['oms:customer:delete'])"
|
||||
>
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-dropdown-item>-->
|
||||
<el-dropdown-item
|
||||
command="handleResetPwd"
|
||||
v-if="checkPermi(['oms:customer:update-password'])"
|
||||
>
|
||||
<Icon icon="ep:key" />重置密码
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -180,13 +208,16 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import {DICT_TYPE, getStrDictOptions} from '@/utils/dict'
|
||||
import {dateFormatter} from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { CustomerApi, CustomerVO } from '@/api/oms/customer'
|
||||
import {CustomerApi, CustomerVO} from '@/api/oms/customer'
|
||||
import CustomerForm from './CustomerForm.vue'
|
||||
import CustomerAssignBrandForm from './CustomerAssignBrandForm.vue'
|
||||
import RoleAssignMenuForm from "@/views/system/role/RoleAssignMenuForm.vue";
|
||||
import {checkPermi} from "@/utils/permission"
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
|
||||
/** 客户 列表 */
|
||||
defineOptions({ name: 'Customer' })
|
||||
|
||||
|
|
@ -200,6 +231,7 @@ const queryParams = reactive({
|
|||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
number: undefined,
|
||||
name: undefined,
|
||||
company: undefined,
|
||||
type: undefined,
|
||||
|
|
@ -240,7 +272,7 @@ const openForm = (type: string, id?: number) => {
|
|||
|
||||
/** 菜单权限操作 */
|
||||
const assignBrandFormRef = ref()
|
||||
const openAssignBrandForm = async (row: RoleApi.RoleVO) => {
|
||||
const openAssignBrandForm = async (row: CustomerVO) => {
|
||||
assignBrandFormRef.value.open(row)
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +286,7 @@ const handleDelete = async (id: number) => {
|
|||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id))
|
||||
//selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id))
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
|
@ -279,6 +311,38 @@ const handleSelectionChange = (rows: CustomerVO[]) => {
|
|||
selectionList.value = rows
|
||||
}
|
||||
|
||||
|
||||
/** 重置密码 */
|
||||
const handleResetPwd = async (row: CustomerVO) => {
|
||||
try {
|
||||
// 重置的二次确认
|
||||
const result = await message.prompt(
|
||||
'请输入"' + row.name + '"的新密码',
|
||||
t('common.reminder')
|
||||
)
|
||||
const password = result.value
|
||||
debugger
|
||||
// 发起重置
|
||||
await UserApi.resetUserPwd(row.userId, password)
|
||||
message.success('修改成功,新密码是:' + password)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 操作分发 */
|
||||
const handleCommand = (command: string,row: CustomerVO) => {
|
||||
switch (command) {
|
||||
case 'handleDelete':
|
||||
handleDelete(row.id)
|
||||
break
|
||||
case 'handleResetPwd':
|
||||
handleResetPwd(row)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
|
|
|||
Loading…
Reference in New Issue