采购配置相关

20230922-ljl-fixBug
wangchaoxu 1 year ago
parent 71fd49ead1
commit e28a4784f9

@ -0,0 +1,7 @@
package com.ms.api.dto.order;
import lombok.Data;
@Data
public class GetPurchaseSettingResponseDTO {
}

@ -0,0 +1,51 @@
package com.ms.api.dto.order;
import lombok.Data;
@Data
public class PurchaseSettingDTO {
/**
*
*/
private int isAppendShopRemark;
/**
*
*/
private String appendShopRemarkTpl;
/**
*
*/
private int isAppendShopNote;
/**
*
*/
private String appendShopNoteTpl;
/**
*
*/
private int shopRemarkFlag;
/**
*
*/
private int isAutoFillRemark;
/**
*
*/
private String autoFillRemarkTpl;
/**
*
*/
private int isAutoFillOrderMemo;
/**
*
*/
private String autoFillOrderMemoTpl;
}

@ -4,11 +4,16 @@ import java.util.HashMap;
import cn.hutool.core.util.ObjectUtil;
import com.ms.api.consts.DsOrderConst;
import com.ms.api.consts.PurchaseOrderConst;
import com.ms.api.consts.TblConst;
import com.ms.api.dto.order.PurchaseSettingDTO;
import com.ms.api.dto.order.SearchDsOrderFilterDTO;
import com.ms.api.service.PurchaseOrderService;
import com.ms.api.tool.PurchaseTool;
import com.ms.dal.entity.PurchaseOrder;
import com.ms.dal.entity.PurchaseSetting;
import com.ms.dal.mapper.PurchaseOrderMapper;
import com.ms.dal.mapper.PurchaseSettingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,6 +26,9 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
@Autowired
private PurchaseOrderMapper purchaseOrderMapper;
@Autowired
private PurchaseSettingMapper purchaseSettingMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return purchaseOrderMapper.deleteByPrimaryKey(id);
@ -101,6 +109,62 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
}
}
public PurchaseSettingDTO getPurchaseSetting(Long shopId) {
PurchaseSetting purchaseSetting = purchaseSettingMapper.selectByShopId(shopId);
// boolean isNewestVersion = purchaseSetting.version = PurchaseOrderConst.CURRENT_PURCHASE_SETTING_VERSION;
Integer isAppendShopRemark;
Integer isAppendShopNote;
Integer isAutoFillRemark;
Integer isAutoFillOrderMemo;
String appendShopRemarkTpl;
String appendShopNoteTpl;
String autoFillRemarkTpl;
String autoFillOrderMemoTpl;
if (purchaseSetting == null) {
isAppendShopRemark = 1;
isAppendShopNote = 1;
isAutoFillRemark = 0;
isAutoFillOrderMemo = 0;
appendShopRemarkTpl = PurchaseTool.getDefaultAppendVenderRemarkTpl();
appendShopNoteTpl = PurchaseTool.getDefaultAppendVenderRemarkTpl();
autoFillRemarkTpl = null;
autoFillOrderMemoTpl = null;
} else {
isAppendShopRemark = purchaseSetting.getIsAppendShopRemark();
isAppendShopNote = purchaseSetting.getIsAppendShopNote();
isAutoFillRemark = purchaseSetting.getIsAutoFillRemark();
isAutoFillOrderMemo = purchaseSetting.getIsAutoFillOrderMemo();
appendShopRemarkTpl = PurchaseTool.removeRemarkMobileTplHashTag(purchaseSetting.getAppendShopRemarkTpl());
appendShopNoteTpl = PurchaseTool.removeRemarkMobileTplHashTag(purchaseSetting.getAppendShopNoteTpl());
autoFillRemarkTpl = purchaseSetting.getAutoFillRemarkTpl();
autoFillOrderMemoTpl = purchaseSetting.getAutoFillOrderMemoTpl();
}
PurchaseSettingDTO purchaseSettingDTO = new PurchaseSettingDTO();
purchaseSettingDTO.setIsAppendShopRemark(isAppendShopRemark);
purchaseSettingDTO.setIsAppendShopNote(isAppendShopNote);
purchaseSettingDTO.setIsAutoFillRemark(isAutoFillRemark);
purchaseSettingDTO.setIsAutoFillOrderMemo(isAutoFillOrderMemo);
purchaseSettingDTO.setAppendShopRemarkTpl(appendShopRemarkTpl);
purchaseSettingDTO.setAppendShopNoteTpl(appendShopNoteTpl);
purchaseSettingDTO.setAutoFillRemarkTpl(autoFillRemarkTpl);
purchaseSettingDTO.setAutoFillOrderMemoTpl(autoFillOrderMemoTpl);
if (purchaseSetting == null) {
savePurchaseSetting(shopId, purchaseSettingDTO);
}
return purchaseSettingDTO;
}
public boolean savePurchaseSetting(Long shopId, PurchaseSettingDTO purchaseSettingDTO) {
// todo:
return false;
}
}

@ -0,0 +1,21 @@
package com.ms.api.spi.order;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.order.GetPurchaseSettingResponseDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ExtensionService("getPurchaseSetting")
@Slf4j
@AllArgsConstructor
public class GetPurchaseSettingService extends SPIBaseService implements ExtensionServiceHandler<Void, GetPurchaseSettingResponseDTO> {
@Override
public BaseResponse<GetPurchaseSettingResponseDTO> handle(BaseRequest<Void> req) {
// GetPurchaseSettingRequestDTO requestDTO = req.getData();
return null;
}
}

@ -0,0 +1,31 @@
package com.ms.api.tool;
import com.ms.api.consts.PurchaseOrderConst;
public class PurchaseTool {
/**
*
* <span contenteditable="false" data-field="receiver_mobile">13366667777</span>
* @param tpl
* @return
*/
public static String removeRemarkMobileTplHashTag(String tpl) {
// String tpl = "asdasdas<span contenteditable=\"false\" data-field=\"receiver_mobile\">#+861222352531#</span>afafafafafafaf";
return tpl.replaceAll("<span contenteditable=\"false\" data-field=\"receiver_mobile\">#(?:[^#]+)#</span>", "");
}
/**
*
* @return
*/
public static String getDefaultAppendVenderRemarkTpl() {
String[] arr = {
String.format("<span contenteditable=\"false\" data-field=\"%s\">#%s#</span>", PurchaseOrderConst.PURCHASE_PLATFORM2_FIELD, "采购平台").toString(),
String.format("<span contenteditable=\"false\" data-field=\"%s\">#%s#</span>", PurchaseOrderConst.PURCHASE_ORDER_SN_FIELD, "采购单号").toString(),
String.format("<span contenteditable=\"false\" data-field=\"%s\">#%s#</span>", PurchaseOrderConst.LOGISTICS_INFO_FIELD, "快递及运单号").toString(),
String.format("<span contenteditable=\"false\" data-field=\"%s\">#%s#</span>", PurchaseOrderConst.PURCHASE_ORDER_BUYER, "采购账号").toString(),
};
return String.join("#", arr);
}
}

@ -218,4 +218,8 @@ public class PurchaseOrderUtil {
return R.ok(params);
}
public int getPurchaseSetting(Long operateShopId) {
return 0;
}
}

@ -1,5 +1,6 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.OpOrder;
import com.ms.dal.entity.PurchaseSetting;
import org.apache.ibatis.annotations.Mapper;
@ -21,4 +22,5 @@ public interface PurchaseSettingMapper {
int updateByPrimaryKey(PurchaseSetting record);
PurchaseSetting selectByShopId(Long shopId);
}

@ -34,6 +34,9 @@
from purchase_setting
where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT}
</select>
<select id="selectByShopId" resultType="com.ms.dal.entity.PurchaseSetting">
select * from purchase_setting where shop_id = #{shopId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from purchase_setting

Loading…
Cancel
Save