采购配置相关

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 cn.hutool.core.util.ObjectUtil;
import com.ms.api.consts.DsOrderConst; import com.ms.api.consts.DsOrderConst;
import com.ms.api.consts.PurchaseOrderConst;
import com.ms.api.consts.TblConst; import com.ms.api.consts.TblConst;
import com.ms.api.dto.order.PurchaseSettingDTO;
import com.ms.api.dto.order.SearchDsOrderFilterDTO; import com.ms.api.dto.order.SearchDsOrderFilterDTO;
import com.ms.api.service.PurchaseOrderService; import com.ms.api.service.PurchaseOrderService;
import com.ms.api.tool.PurchaseTool;
import com.ms.dal.entity.PurchaseOrder; import com.ms.dal.entity.PurchaseOrder;
import com.ms.dal.entity.PurchaseSetting;
import com.ms.dal.mapper.PurchaseOrderMapper; import com.ms.dal.mapper.PurchaseOrderMapper;
import com.ms.dal.mapper.PurchaseSettingMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,6 +26,9 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
@Autowired @Autowired
private PurchaseOrderMapper purchaseOrderMapper; private PurchaseOrderMapper purchaseOrderMapper;
@Autowired
private PurchaseSettingMapper purchaseSettingMapper;
@Override @Override
public int deleteByPrimaryKey(Long id) { public int deleteByPrimaryKey(Long id) {
return purchaseOrderMapper.deleteByPrimaryKey(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); return R.ok(params);
} }
public int getPurchaseSetting(Long operateShopId) {
return 0;
}
} }

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

@ -32,12 +32,15 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from purchase_setting from purchase_setting
where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT} 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> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from purchase_setting delete from purchase_setting
where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT} where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT}
</delete> </delete>
<insert id="insert" keyColumn="purchase_setting_id" keyProperty="purchaseSettingId" parameterType="com.ms.dal.entity.PurchaseSetting" useGeneratedKeys="true"> <insert id="insert" keyColumn="purchase_setting_id" keyProperty="purchaseSettingId" parameterType="com.ms.dal.entity.PurchaseSetting" useGeneratedKeys="true">
insert into purchase_setting insert into purchase_setting
@ -125,11 +128,11 @@
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if> </if>
</set> </set>
where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT} where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.ms.dal.entity.PurchaseSetting"> <update id="updateByPrimaryKey" parameterType="com.ms.dal.entity.PurchaseSetting">
update purchase_setting update purchase_setting
set set
shop_id = #{shopId,jdbcType=BIGINT}, shop_id = #{shopId,jdbcType=BIGINT},
is_append_shop_remark = #{isAppendShopRemark,jdbcType=BOOLEAN}, is_append_shop_remark = #{isAppendShopRemark,jdbcType=BOOLEAN},
append_shop_remark_tpl = #{appendShopRemarkTpl,jdbcType=VARCHAR}, append_shop_remark_tpl = #{appendShopRemarkTpl,jdbcType=VARCHAR},
@ -142,6 +145,6 @@
auto_fill_order_memo_tpl = #{autoFillOrderMemoTpl,jdbcType=VARCHAR}, auto_fill_order_memo_tpl = #{autoFillOrderMemoTpl,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT} where purchase_setting_id = #{purchaseSettingId,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>

Loading…
Cancel
Save