采购配置相关

20230922-ljl-fixBug
wangchaoxu 1 year ago
parent 8514490790
commit dcb6c27e9b

@ -44,6 +44,8 @@ public interface PurchaseOrderService {
boolean saveDsPurchaseSetting(Long shopId, DsPurchaseSettingDTO dsPurchaseSettingDTO); boolean saveDsPurchaseSetting(Long shopId, DsPurchaseSettingDTO dsPurchaseSettingDTO);
boolean saveDsAutoPurchaseAgreement(Long shopId);
List<PurchaseOrder> selectByConditions(PurchaseOrder build); List<PurchaseOrder> selectByConditions(PurchaseOrder build);
ApiResult checkAllowDsAutoPurchase(Long shopId, String orderId, DsPurchaseSettingDTO autoPurchaseSetting, int orderStatus, Date orderGmtPayTime, Boolean isDsOpOrder); ApiResult checkAllowDsAutoPurchase(Long shopId, String orderId, DsPurchaseSettingDTO autoPurchaseSetting, int orderStatus, Date orderGmtPayTime, Boolean isDsOpOrder);

@ -85,6 +85,9 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
@Autowired @Autowired
private DsAutoPurchaseSwitchLogMapper dsAutoPurchaseSwitchLogMapper; private DsAutoPurchaseSwitchLogMapper dsAutoPurchaseSwitchLogMapper;
@Autowired
private DsAutoPurchaseAgreementMapper dsAutoPurchaseAgreementMapper;
@Autowired @Autowired
private ShopService shopService; private ShopService shopService;
@ -614,6 +617,27 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
return rows.stream().collect(Collectors.toMap(PurchaseOrderSetting::getPurchaseOrderId, x -> x)); return rows.stream().collect(Collectors.toMap(PurchaseOrderSetting::getPurchaseOrderId, x -> x));
} }
public boolean saveDsAutoPurchaseAgreement(Long shopId) {
DsAutoPurchaseAgreement obj = new DsAutoPurchaseAgreement();
obj.setShopId(shopId);
// 之前版本都是从session取这边后续处理 todo:
obj.setOperateShopId(shopId);
// obj.setOperateIp("");
// obj.setOperateMemberId("");
obj.setGmtModified(new Date());
DsAutoPurchaseAgreement row = dsAutoPurchaseAgreementMapper.getByShopId(shopId);
int affRow;
if (row == null) {
obj.setGmtCreate(new Date());
affRow = dsAutoPurchaseAgreementMapper.insertSelective(obj);
} else {
obj.setDsAutoPurchaseAgreementId(row.getDsAutoPurchaseAgreementId());
affRow = dsAutoPurchaseAgreementMapper.updateByPrimaryKeySelective(obj);
}
return affRow > 0;
}
public PurchaseSettingDTO getPurchaseSetting(Long shopId) { public PurchaseSettingDTO getPurchaseSetting(Long shopId) {
PurchaseSetting purchaseSetting = purchaseSettingMapper.selectByShopId(shopId); PurchaseSetting purchaseSetting = purchaseSettingMapper.selectByShopId(shopId);
// boolean isNewestVersion = purchaseSetting.version = PurchaseOrderConst.CURRENT_PURCHASE_SETTING_VERSION; // boolean isNewestVersion = purchaseSetting.version = PurchaseOrderConst.CURRENT_PURCHASE_SETTING_VERSION;

@ -4,22 +4,38 @@ import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R;
import com.ms.api.common.Ret; import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService; import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.order.SaveDsAutoPurchaseAgreementRequestDTO; import com.ms.api.dto.order.SaveDsAutoPurchaseAgreementRequestDTO;
import com.ms.api.service.PurchaseOrderService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ExtensionService("saveDsAutoPurchaseAgreement") @ExtensionService("saveDsAutoPurchaseAgreement")
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class SaveDsAutoPurchaseAgreementService extends SPIBaseService implements ExtensionServiceHandler<SaveDsAutoPurchaseAgreementRequestDTO, Ret> { public class SaveDsAutoPurchaseAgreementService extends SPIBaseService implements ExtensionServiceHandler<SaveDsAutoPurchaseAgreementRequestDTO, Ret> {
@Autowired
private PurchaseOrderService purchaseOrderService;
@Override @Override
public BaseResponse<Ret> handle(BaseRequest<SaveDsAutoPurchaseAgreementRequestDTO> req) { public BaseResponse<Ret> handle(BaseRequest<SaveDsAutoPurchaseAgreementRequestDTO> req) {
initHandle(req); initHandle(req);
Long shopId = Long.valueOf(this.shopId); Long shopId = Long.valueOf(this.shopId);
return null; SaveDsAutoPurchaseAgreementRequestDTO requestDTO = req.getData();
if (requestDTO.getIsCheckedAgreement() == null || requestDTO.getIsCheckedAgreement() == 0) {
return R.ok(Ret.fail("未勾选使用协议"));
}
if (!purchaseOrderService.saveDsAutoPurchaseAgreement(shopId)) {
return R.ok(Ret.fail("保存用户协议失败"));
}
return R.ok(Ret.success());
} }
} }

@ -21,4 +21,5 @@ public interface DsAutoPurchaseAgreementMapper {
int updateByPrimaryKey(DsAutoPurchaseAgreement record); int updateByPrimaryKey(DsAutoPurchaseAgreement record);
DsAutoPurchaseAgreement getByShopId(Long shopId);
} }

@ -26,6 +26,11 @@
from ds_auto_purchase_agreement from ds_auto_purchase_agreement
where ds_auto_purchase_agreement_id = #{dsAutoPurchaseAgreementId,jdbcType=BIGINT} where ds_auto_purchase_agreement_id = #{dsAutoPurchaseAgreementId,jdbcType=BIGINT}
</select> </select>
<select id="selectByShopId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ds_auto_purchase_agreement where shop_id = #{shopId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ds_auto_purchase_agreement delete from ds_auto_purchase_agreement
@ -43,22 +48,22 @@
<insert id="insertSelective" keyColumn="ds_auto_purchase_agreement_id" keyProperty="dsAutoPurchaseAgreementId" parameterType="com.ms.dal.entity.DsAutoPurchaseAgreement" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="ds_auto_purchase_agreement_id" keyProperty="dsAutoPurchaseAgreementId" parameterType="com.ms.dal.entity.DsAutoPurchaseAgreement" useGeneratedKeys="true">
insert into ds_auto_purchase_agreement insert into ds_auto_purchase_agreement
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dsAutoPurchaseAgreementId != null">dsAutoPurchaseAgreementId,</if> <if test="dsAutoPurchaseAgreementId != null">ds_auto_purchase_agreement_id,</if>
<if test="shopId != null">shopId,</if> <if test="shopId != null">shop_id,</if>
<if test="operateShopId != null">operateShopId,</if> <if test="operateShopId != null">operate_shop_id,</if>
<if test="operateIp != null">operateIp,</if> <if test="operateIp != null">operate_ip,</if>
<if test="operateMemberId != null">operateMemberId,</if> <if test="operateMemberId != null">operate_member_id,</if>
<if test="gmtCreate != null">gmtCreate,</if> <if test="gmtCreate != null">gmt_create,</if>
<if test="gmtModified != null">gmtModified,</if> <if test="gmtModified != null">gmt_modified,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dsAutoPurchaseAgreementId != null">ds_auto_purchase_agreement_id = #{dsAutoPurchaseAgreementId,jdbcType=BIGINT},</if> <if test="dsAutoPurchaseAgreementId != null">#{dsAutoPurchaseAgreementId,jdbcType=BIGINT},</if>
<if test="shopId != null">shop_id = #{shopId,jdbcType=BIGINT},</if> <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
<if test="operateShopId != null">operate_shop_id = #{operateShopId,jdbcType=BIGINT},</if> <if test="operateShopId != null">#{operateShopId,jdbcType=BIGINT},</if>
<if test="operateIp != null">operate_ip = #{operateIp,jdbcType=VARCHAR},</if> <if test="operateIp != null">#{operateIp,jdbcType=VARCHAR},</if>
<if test="operateMemberId != null">operate_member_id = #{operateMemberId,jdbcType=VARCHAR},</if> <if test="operateMemberId != null">#{operateMemberId,jdbcType=VARCHAR},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},</if> <if test="gmtCreate != null">#{gmtCreate,jdbcType=TIMESTAMP},</if>
<if test="gmtModified != null">gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},</if> <if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.ms.dal.entity.DsAutoPurchaseAgreement"> <update id="updateByPrimaryKeySelective" parameterType="com.ms.dal.entity.DsAutoPurchaseAgreement">

Loading…
Cancel
Save