Merge pull request #177 from LQYBill/feat/shippingInvoiceRemark

feat: shipping invoice remark
pull/8547/head
Qiuyi LI 2025-06-30 12:16:25 +02:00 committed by GitHub
commit 712a3bdc02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 366 additions and 9 deletions

View File

@ -29,11 +29,8 @@ import org.jeecg.modules.business.domain.api.shouman.OrderCreationRequest;
import org.jeecg.modules.business.domain.api.shouman.OrderCreationRequestBody;
import org.jeecg.modules.business.domain.api.shouman.ShoumanOrderRequest;
import org.jeecg.modules.business.domain.job.ThrottlingExecutorService;
import org.jeecg.modules.business.entity.Client;
import org.jeecg.modules.business.entity.PlatformOrder;
import org.jeecg.modules.business.entity.PlatformOrderContent;
import org.jeecg.modules.business.entity.*;
import org.jeecg.modules.business.entity.Shouman.ShoumanOrder;
import org.jeecg.modules.business.entity.ShoumanOrderContent;
import org.jeecg.modules.business.mapper.PlatformOrderContentMapper;
import org.jeecg.modules.business.mapper.PlatformOrderMapper;
import org.jeecg.modules.business.service.*;
@ -104,6 +101,8 @@ public class PlatformOrderController {
@Autowired
private IShopService shopService;
@Autowired
private IShopOptionsService shopOptionsService;
@Autowired
private ISecurityService securityService;
@Autowired
private ISysMessageService sysMessageService;
@ -669,15 +668,30 @@ public class PlatformOrderController {
@PostMapping("/editOrdersRemark")
public Result<?> editOrdersRemark(@RequestBody InvoiceOrdersEditParam param) {
boolean isEmployee = securityService.checkIsEmployee();
String userId = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
if(param.getInvoicingMethod() == PRESHIPPING) {
boolean hasRemarkInShippingInvoice = false;
List<ShopOptions> options = shopOptionsService.getByInvoiceNumber(param.getInvoiceNumber());
for (ShopOptions option : options) {
if (option.getHasShippingInvoiceRemark()) {
hasRemarkInShippingInvoice = true;
break;
}
}
if((param.getInvoicingMethod() != null && param.getInvoicingMethod() == PRESHIPPING) || (hasRemarkInShippingInvoice && param.getInvoicingMethod() == null)) {
ResponsesWithMsg<String> mabangResponses = platformOrderMabangService.editOrdersRemark(param.getInvoiceNumber());
if(!mabangResponses.getFailures().isEmpty())
sysMessageService.sendProgress(userId, HttpStatus.BAD_REQUEST.value(),mabangResponses.getFailures(), "websocket.mabang.editOrdersRemarkError", "editOrdersRemark");
else sysMessageService.sendProgress(userId, HttpStatus.OK.value(), null,"websocket.mabang.editOrdersRemarkSuccess", "editOrdersRemark");
if(isEmployee) {
if (!mabangResponses.getFailures().isEmpty())
sysMessageService.sendProgress(userId, HttpStatus.BAD_REQUEST.value(), mabangResponses.getFailures(), "websocket.mabang.editOrdersRemarkError", "editOrdersRemark");
else
sysMessageService.sendProgress(userId, HttpStatus.OK.value(), null, "websocket.mabang.editOrdersRemarkSuccess", "editOrdersRemark");
}
return Result.OK(mabangResponses);
}
sysMessageService.pushProgress(userId, "Method not supported");
if(!hasRemarkInShippingInvoice && param.getInvoicingMethod() == null) {
return Result.OK();
}
if (isEmployee) sysMessageService.pushProgress(userId, "Method not supported");
return Result.error(HttpStatus.NOT_FOUND.value(), "Invoicing method not supported");
}
}

View File

@ -0,0 +1,156 @@
package org.jeecg.modules.business.controller.admin;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.business.entity.ShopOptions;
import org.jeecg.modules.business.service.IShopOptionsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-06-12
* @Version: V1.0
*/
@Api(tags="客户选项列表")
@RestController
@RequestMapping("/shopOptions")
@Slf4j
public class ShopOptionsController extends JeecgController<ShopOptions, IShopOptionsService> {
@Autowired
private IShopOptionsService shopOptionsService;
/**
*
*
* @param shopOptions
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "客户选项列表-分页列表查询")
@ApiOperation(value="客户选项列表-分页列表查询", notes="客户选项列表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<ShopOptions>> queryPageList(ShopOptions shopOptions,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<ShopOptions> queryWrapper = QueryGenerator.initQueryWrapper(shopOptions, req.getParameterMap());
Page<ShopOptions> page = new Page<ShopOptions>(pageNo, pageSize);
IPage<ShopOptions> pageList = shopOptionsService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
*
*
* @param shopOptions
* @return
*/
@AutoLog(value = "客户选项列表-添加")
@ApiOperation(value="客户选项列表-添加", notes="客户选项列表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ShopOptions shopOptions) {
shopOptionsService.save(shopOptions);
return Result.OK("添加成功!");
}
/**
*
*
* @param shopOptions
* @return
*/
@AutoLog(value = "客户选项列表-编辑")
@ApiOperation(value="客户选项列表-编辑", notes="客户选项列表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ShopOptions shopOptions) {
shopOptionsService.updateById(shopOptions);
return Result.OK("编辑成功!");
}
/**
* id
*
* @param id
* @return
*/
@AutoLog(value = "客户选项列表-通过id删除")
@ApiOperation(value="客户选项列表-通过id删除", notes="客户选项列表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
shopOptionsService.removeById(id);
return Result.OK("删除成功!");
}
/**
*
*
* @param ids
* @return
*/
@AutoLog(value = "客户选项列表-批量删除")
@ApiOperation(value="客户选项列表-批量删除", notes="客户选项列表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.shopOptionsService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* id
*
* @param id
* @return
*/
//@AutoLog(value = "客户选项列表-通过id查询")
@ApiOperation(value="客户选项列表-通过id查询", notes="客户选项列表-通过id查询")
@GetMapping(value = "/queryById")
public Result<ShopOptions> queryById(@RequestParam(name="id",required=true) String id) {
ShopOptions shopOptions = shopOptionsService.getById(id);
if(shopOptions==null) {
return Result.error("未找到对应数据");
}
return Result.OK(shopOptions);
}
/**
* excel
*
* @param request
* @param shopOptions
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ShopOptions shopOptions) {
return super.exportXls(request, shopOptions, ShopOptions.class, "客户选项列表");
}
/**
* excel
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, ShopOptions.class);
}
}

View File

@ -0,0 +1,113 @@
package org.jeecg.modules.business.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-06-12
* @Version: V1.0
*/
@Data
@TableName("shop_options")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="shop_options对象", description="客户选项列表")
public class ShopOptions implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**店铺ID*/
@Excel(name = "shop id", width = 15, dictTable = "shop", dicText = "erp_code", dicCode = "id")
@ApiModelProperty(value = "店铺ID")
@Dict(dictTable = "shop", dicText = "erp_code", dicCode = "id")
private java.lang.String shopId;
/**是否用余额*/
@Excel(name = "是否使用余额", width = 15)
@ApiModelProperty(value = "是否使用余额")
private java.lang.Boolean useBalance;
/**是否可发票上显示账户余额*/
@Excel(name = "是否可发票上显示账户余额", width = 15)
@ApiModelProperty(value = "是否可发票上显示账户余额")
private java.lang.Boolean showBalance;
/**余额阈值 default: -1.00 no limit, 0.00 if balance must be positive*/
@Excel(name = "余额阈值", width = 15)
@ApiModelProperty(value = "余额阈值")
private java.lang.Integer balanceThreshold;
/**是否定时自动开票*/
@Excel(name = "是否定时自动开票", width = 15)
@ApiModelProperty(value = "是否定时自动开票")
private java.lang.Boolean isAutoInvoice;
/**是否按订单时间顺序自动开票, only if threshhold >= 0*/
@Excel(name = "是否按订单时间顺序自动开票", width = 15)
@ApiModelProperty(value = "是否按订单时间顺序自动开票")
private java.lang.Boolean isChronologicalOrder;
/**是否每周五 系统统一开票*/
@Excel(name = "是否每周五系统统一开票", width = 15)
@ApiModelProperty(value = "是否每周五系统统一开票")
private java.lang.Boolean isBreakdownInvoice;
/**星期五自动开票是否开P+L, default: 0 = no only L,1 = P+L*/
@Excel(name = "星期五自动开票是否开P+L, default: 0 = no only L,1 = P+L", width = 15)
@ApiModelProperty(value = "星期五自动开票是否开P+L, default: 0 = no only L,1 = P+L")
private java.lang.Boolean isCompleteInvoice;
/**是否客户可以自己开票*/
@Excel(name = "是否客户可以自己开票", width = 15)
@ApiModelProperty(value = "是否客户可以自己开票")
private java.lang.Boolean canSelfInvoice;
/**是否可以开P票*/
@Excel(name = "是否可以开P票", width = 15)
@ApiModelProperty(value = "是否可以开P票")
private java.lang.Boolean canSelfP;
/**是否可以开L票*/
@Excel(name = "是否可以开L票", width = 15)
@ApiModelProperty(value = "是否可以开L票")
private java.lang.Boolean canSelfL;
/**是否可以开P+L票*/
@Excel(name = "是否可以开P+L票", width = 15)
@ApiModelProperty(value = "是否可以开P+L票")
private java.lang.Boolean canSelfPL;
/**是否忽略库存数(7xxxx)*/
@Excel(name = "是否忽略库存数(7xxxx)", width = 15)
@ApiModelProperty(value = "是否忽略库存数(7xxxx)")
private java.lang.Boolean isSelfIgnoreStock;
/**是否客户做库存*/
@Excel(name = "是否客户做库存", width = 15)
@ApiModelProperty(value = "是否客户做库存")
private java.lang.Boolean hasStock;
/**是否开物流票写备注*/
@Excel(name = "是否开物流票写备注", width = 15)
@ApiModelProperty(value = "是否开物流票写备注")
private java.lang.Boolean hasShippingInvoiceRemark;
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.business.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.business.entity.ShopOptions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-06-12
* @Version: V1.0
*/
@Repository
public interface ShopOptionsMapper extends BaseMapper<ShopOptions> {
List<ShopOptions> getByInvoiceNumber(@Param("invoiceNumber") String invoiceNumber);
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.business.mapper.ShopOptionsMapper">
<select id="getByInvoiceNumber" resultType="org.jeecg.modules.business.entity.ShopOptions">
SELECT DISTINCT * FROM shop_options so
JOIN platform_order po ON so.shop_id = po.shop_id
WHERE po.shipping_invoice_number = #{invoiceNumber} OR po.purchase_invoice_number = #{invoiceNumber};
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.business.service;
import org.jeecg.modules.business.entity.ShopOptions;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-06-12
* @Version: V1.0
*/
public interface IShopOptionsService extends IService<ShopOptions> {
List<ShopOptions> getByInvoiceNumber(String invoiceNumber);
}

View File

@ -119,6 +119,7 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
log.error("Shipping invoice {} is older than {}, client is not allowed to cancel it", invoiceNumber, CANCEL_DAYS_LIMIT);
return false;
}
platformOrderMabangService.deleteOrderRemark(invoiceNumber);
platformOrderContentService.cancelInvoice(invoiceNumber, clientId);
platformOrderService.cancelInvoice(invoiceNumber, clientId);
shippingInvoiceService.cancelInvoice(id);

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.business.service.impl;
import org.jeecg.modules.business.entity.ShopOptions;
import org.jeecg.modules.business.mapper.ShopOptionsMapper;
import org.jeecg.modules.business.service.IShopOptionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-06-12
* @Version: V1.0
*/
@Service
public class ShopOptionsServiceImpl extends ServiceImpl<ShopOptionsMapper, ShopOptions> implements IShopOptionsService {
@Autowired
private ShopOptionsMapper shopOptionsMapper;
@Override
public List<ShopOptions> getByInvoiceNumber(String invoiceNumber) {
return shopOptionsMapper.getByInvoiceNumber(invoiceNumber);
}
}