xinyb
2024-06-18 4c9e286973bed3bea00280a999500d2bb1cb8817
微信小程序订单调整和售后换新和预约安装
6个文件已修改
234 ■■■■ 已修改文件
src/com/yc/sdk/shopping/action/Order.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/shopping/entity/SettingEntity.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/shopping/service/SettingImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/weixincp3rd/action/AfterSales.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/weixincp3rd/service/AfterSalesIfc.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/weixincp3rd/service/AfterSalesImpl.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/shopping/action/Order.java
@@ -1,19 +1,5 @@
package com.yc.sdk.shopping.action;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.yc.action.BaseAction;
@@ -21,13 +7,7 @@
import com.yc.multiData.MultiDataSource;
import com.yc.multiData.SpObserver;
import com.yc.sdk.shopping.action.api.ShopCcCode;
import com.yc.sdk.shopping.entity.CurrencyEntity;
import com.yc.sdk.shopping.entity.CustomerEntity;
import com.yc.sdk.shopping.entity.GroupBuyingEntity;
import com.yc.sdk.shopping.entity.OrderDetailEntity;
import com.yc.sdk.shopping.entity.OrderEntity;
import com.yc.sdk.shopping.entity.SettingEntity;
import com.yc.sdk.shopping.entity.ShopCcCodeEntity;
import com.yc.sdk.shopping.entity.*;
import com.yc.sdk.shopping.service.CartIfc;
import com.yc.sdk.shopping.service.CurrencyIfc;
import com.yc.sdk.shopping.service.SettingIfc;
@@ -37,6 +17,18 @@
import com.yc.sdk.shopping.util.SettingKey;
import com.yc.sdk.shopping.util.StringReplaceUtil;
import com.yc.utils.SessionKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.List;
@Controller
@Scope("prototype")
@@ -224,7 +216,12 @@
                   orderEntityJsonObject.addProperty("CcName", orderEntity.getCcName());
                   orderEntityJsonObject.addProperty("SumTotalMoney2",orderEntity.getSumTotalMoney2());  //优惠前订单总金额 
                   //orderEntityJsonObject.addProperty("SumTotalMoney3",orderEntity.getSumTotalMoney3());  //优惠后订单总金额 ,由 PayableAmount 代替
                   orderEntityJsonObject.addProperty("PayableAmount",orderEntity.getPayableAmount());  //优惠后订单总金额
//                   orderEntityJsonObject.addProperty("PayableAmount",orderEntity.getPayableAmount());  //优惠后订单总金额
                if (orderEntity.getFormId() == 120230 || orderEntity.getFormId() == 120234) {
                    orderEntityJsonObject.addProperty("PayableAmount", orderEntity.getPayableAmount());  //优惠后订单总金额
                } else {
                    orderEntityJsonObject.addProperty("PayableAmount", (orderEntity.getSumTotalMoney2() - orderEntity.getReduceMoney()));  //优惠后订单总金额
                }
                   orderEntityJsonObject.addProperty("ReduceMoney",orderEntity.getReduceMoney());  //优惠金额 
                   orderEntityJsonObject.addProperty("TransCosts",orderEntity.getTransCosts());  //运费 
                   orderEntityJsonObject.addProperty("HandlingCharges",orderEntity.getHandlingCharges());  //搬运费
@@ -395,7 +392,7 @@
                        &&orderEntity.getIsAllowPayable()!=null&&orderEntity.getIsAllowPayable().equals(1)?true:false);
                   //是否显示:取消订单按钮 
                   orderEntityJsonObject.addProperty("isShowCancelButton",settingEntity.isAllowReturnOrder()&& cltCode.equals(orderEntity.getCltCode()) && orderEntity.getDocStatus()!=null&&(orderEntity.getDocStatus().equals(100)||orderEntity.getDocStatus().equals(0)) && (orderEntity.getFaHuoStatus()==null || orderEntity.getFaHuoStatus().equals(""))?true:false);
                   orderEntityJsonObject.addProperty("isShowCancelButton",settingEntity.isAllowReturnOrder()&& cltCode.equals(orderEntity.getCltCode()) && orderEntity.getDocStatus()!=null&&(orderEntity.getDocStatus().equals(100)||orderEntity.getDocStatus().equals(0)) && (orderEntity.getFaHuoStatus()==null || orderEntity.getFaHuoStatus().equals("")) && (orderEntity.getFormId() == 120230 || orderEntity.getFormId() == 120234)?true:false);
                   
                   //是否显示:查看物流按钮
                   boolean isShowLogisticsButton = (orderEntity.getDocStatus()!=null&&orderEntity.getDocStatus().equals(100)&& orderEntity.getLogisticsCode()!=null && !orderEntity.getLogisticsCode().equals("")?true:false);
@@ -622,7 +619,7 @@
               //是否显示:取消订单按钮 
            //json.addProperty("isShowCancelButton", orderEntity.getDocStatus()!=null&&orderEntity.getDocStatus().equals(100)&&orderEntity.getIsAllowPayable()!=null&&orderEntity.getIsAllowPayable().intValue() == 2 &&(orderEntity.getFaHuoStatus()==null || orderEntity.getFaHuoStatus().equals(""))?true:false);
            json.addProperty("isShowCancelButton",settingEntity.isAllowReturnOrder()&&cltCode.equals(orderEntity.getCltCode()) &&  orderEntity.getDocStatus()!=null&&(orderEntity.getDocStatus().equals(100)||orderEntity.getDocStatus().equals(0)) && (orderEntity.getFaHuoStatus()==null || orderEntity.getFaHuoStatus().equals(""))?true:false);
            json.addProperty("isShowCancelButton",settingEntity.isAllowReturnOrder()&&cltCode.equals(orderEntity.getCltCode()) &&  orderEntity.getDocStatus()!=null&&(orderEntity.getDocStatus().equals(100)||orderEntity.getDocStatus().equals(0)) && (orderEntity.getFaHuoStatus()==null || orderEntity.getFaHuoStatus().equals("")) && (orderEntity.getFormId() == 120230 || orderEntity.getFormId() == 120234)?true:false);
               //是否显示:查看物流按钮
               boolean isShowLogisticsButton = (orderEntity.getDocStatus()!=null&&orderEntity.getDocStatus().equals(100)&& orderEntity.getLogisticsCode()!=null && ! orderEntity.getLogisticsCode().equals("")?true:false);
               json.addProperty("isShowLogisticsButton",(cltCode.equals(orderEntity.getCltCode())||isShopGuide)&&isShowLogisticsButton &&orderEntity.getShipperCode()!=null&& !orderEntity.getShipperCode().equals("") );
src/com/yc/sdk/shopping/entity/SettingEntity.java
@@ -141,6 +141,8 @@
    private boolean isShowSurvey = false;   //显示满意度调查表
    private boolean isShowRepairRequest = false;   //显示报修表
    private boolean isShowFeedBack = false;   //显示投诉表
    private boolean isShowInstallationService = false;   //显示预约安装
    private boolean isShowReplacementService = false;   //显示换新服务
    private boolean isModifyContact = false;  //显示联系我们
    private boolean isModifyReturn = false;  //允许退换服务
    private boolean isModifyAttention;   //允许关注我们
@@ -569,6 +571,22 @@
        isShowFeedBack = showFeedBack;
    }
    public boolean isShowInstallationService() {
        return isShowInstallationService;
    }
    public void setShowInstallationService(boolean showInstallationService) {
        isShowInstallationService = showInstallationService;
    }
    public boolean isShowReplacementService() {
        return isShowReplacementService;
    }
    public void setShowReplacementService(boolean showReplacementService) {
        isShowReplacementService = showReplacementService;
    }
    public String getReceiverForSalesOrder() {
        return receiverForSalesOrder;
    }
src/com/yc/sdk/shopping/service/SettingImpl.java
@@ -144,7 +144,7 @@
                + " a.isStartupPriceSubsystem,a.PriceSubsystemMemberLevels,a.isStartupBalancePay,\n"
                + " a.isShowBuyingButton,a.isShowElectronicVoucherButton,a.PersonalAuthenticationAmount,a.PaymentCountdown, \n"
                + " a.FeeRateForWxPay,a.PlatformOperatorCommissionRatio,a.WithdrawalExpiryHours,a.HelpUrl,a.isShowPreSendDate,a.ShowKeFuTelephone, \n"
                + " a.isShowSurvey,a.isShowRepairRequest,a.isShowFeedBack \n"
                + " a.isShowSurvey,a.isShowRepairRequest,a.isShowFeedBack,a.isShowInstallationService,a.isShowReplacementService \n"
                + " from t714001 a left join t110601 b on a.DefaultShopCcCode = b.CcCode  \n"
                + " left join t714030 c on a.CountryId = c.CountryId \n"
                + " left join t110202 d on a.ProvinceZoneId = d.ZoneId \n" 
@@ -433,6 +433,8 @@
            set.setShowSurvey(map.get("isShowSurvey") == null||((Integer)map.get("isShowSurvey")).equals(0)  ? false :true);
            set.setShowRepairRequest(map.get("isShowRepairRequest") == null||((Integer)map.get("isShowRepairRequest")).equals(0)  ? false :true);
            set.setShowFeedBack(map.get("isShowFeedBack") == null||((Integer)map.get("isShowFeedBack")).equals(0)  ? false :true);
            set.setShowInstallationService(map.get("isShowInstallationService") == null||((Integer)map.get("isShowInstallationService")).equals(0)  ? false :true);
            set.setShowReplacementService(map.get("isShowReplacementService") == null||((Integer)map.get("isShowReplacementService")).equals(0)  ? false :true);
            //取小程序订单提醒消息
            sql = " set nocount on \n"
src/com/yc/sdk/weixincp3rd/action/AfterSales.java
@@ -61,7 +61,7 @@
    ShoppingImageDataIfc imgData;
    /**
     * 报修和投诉提交保存
     * 报修和投诉和预约安装和换新提交保存
     *
     * @param param
     * @param request
@@ -106,6 +106,22 @@
                    return msg;
                }
                afterSalesIfc.saveComplain(param);
            }else if(param.getAcceptSource().toLowerCase().equals("pre")){//预约安装
                if (param.getSeq() == null) {
                    msg.setError("缺少地址信息,请检查。");
                    return msg;
                }
                if (StringUtils.isBlank(param.getPreSendDate())) {
                    msg.setError("预约安装时间不能为空。");
                    return msg;
                }
                afterSalesIfc.savePreInstallation(param);
            }else if(param.getAcceptSource().toLowerCase().equals("new")){//预约安装
                if (param.getSeq() == null) {
                    msg.setError("缺少地址信息,请检查。");
                    return msg;
                }
                afterSalesIfc.saveRenewal(param);
            }
            msg.setSuccess("提交成功");
        } catch (Exception e) {
@@ -145,6 +161,8 @@
                list = afterSalesIfc.getUpkeepList(docStatus, openId);
            } else if (acceptSource.toLowerCase().equals("complain")) {//投诉单列表
                list = afterSalesIfc.getComplainList(docStatus, openId);
            }else if (acceptSource.toLowerCase().equals("pre")) {//预约单列表
                list = afterSalesIfc.getPreInstallation(docStatus, openId);
            }
            msg.setSuccess(list);
        } catch (Exception e) {
@@ -178,6 +196,8 @@
                afterSales = afterSalesIfc.getUpkeepInfo(docCode);
            } else if (acceptSource.toLowerCase().equals("complain")) {//投诉单详情
                afterSales = afterSalesIfc.getComplainInfo(docCode);
            }else if (acceptSource.toLowerCase().equals("pre")) {//预约单详情
                afterSales = afterSalesIfc.getPreInstallationInfo(docCode);
            }
            if (afterSales != null && StringUtils.isNotBlank(afterSales.getUnIdSeq())) {
                String[] unIdSeq = afterSales.getUnIdSeq().split(";");
src/com/yc/sdk/weixincp3rd/service/AfterSalesIfc.java
@@ -52,6 +52,32 @@
     */
    AfterSalesEntity getComplainInfo(String docCode);
    /**
     * 预约安装提交保存
     * @param parameters
     * @throws Exception
     */
    void savePreInstallation(AfterSalesParameters parameters) throws Exception;
    /**
     * 预约安装单列表
     * @param docStatus 状态
     * @return
     */
    List<Map<String,Object>> getPreInstallation(Integer docStatus,String openId);
    /**
     * 预约安装单详情
     * @param docCode
     * @return
     */
    AfterSalesEntity getPreInstallationInfo(String docCode);
    /**
     * 换新提交保存
     * @param parameters
     * @throws Exception
     */
    void saveRenewal(AfterSalesParameters parameters) throws Exception;
    /**
     * 满意度提交保存
     * @param parameters
     */
src/com/yc/sdk/weixincp3rd/service/AfterSalesImpl.java
@@ -221,6 +221,125 @@
    }
    @Override
    public void savePreInstallation(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50) = '',@cltName varchar(100) = ''," +
                    "@companyId varchar(10),@companyName varchar(100),@seq int =" + param.getSeq() + "," +
                    "@ccCode varchar(50),@ccName varchar(50),"+
                    "@Longitude varchar(50),@Latitude varchar(50),@FullAddressName varchar(200)," +
                    "@FullAddress varchar(300),@Street varchar(200)\n";
            if (StringUtils.isNotBlank(param.getOpenId())) {
                sql += "select @cltCode=cltCode,@cltName=cltName,@ccCode=ccCode,@ccName=ccName," +
                        "@companyId=companyId,@companyName=companyName from t110203 where MiniAppOpenId=" + GridUtils.prossSqlParm(param.getOpenId()) + "\n";
                sql += " if isnull(@cltCode,'') = ''  \n " +
                        " begin \n" +
                        "  raiserror('系统未绑定微信用户ID,请绑定后再执行',16,1) \n" +
                        " return \n" +
                        " end \n";
            }
            sql += "select @cltCode=cltCode,@cltName=cltName,@Longitude = Longitude,@Latitude=Latitude,@FullAddressName=FullAddressName," +
                    "@FullAddress=isnull(FullAddress,'')+''+isnull(FullAddressName,'')+''+isnull(Street,'')," +
                    "@Street=Street from t110209 " +
                    "where seq=@seq";
            sql += " exec sp_newdoccode 640210,'SYSTEM',@docCode output\n";
            sql += "insert into t640210H(docCode,formId,docDate,periodID,ccCode,ccName,DocStatus,LastDocStatus,PostCode,PostName,companyId,companyName,AcceptSource,cltCode,cltName,tel," +
                    "PropertyAddress,PreSendDate,Memo,enterDate,UploadFiles,seq,Longitude,Latitude,FullAddressName,Street)" +
                    " values (@docCode," + param.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),@ccCode,@ccName,0,0,'system','小程序端',@companyId,@companyName,'预约',@cltCode," +
                    "@cltName," + GridUtils.prossSqlParm(param.getTel()) + ",@FullAddress," +
                    GridUtils.prossSqlParm(param.getPreSendDate()) + "," +
                    GridUtils.prossSqlParm(param.getMemo()) + ",getdate()," + GridUtils.prossSqlParm(param.getUploadFiles()) + "," +
                    "@seq,@Longitude,@Latitude,@FullAddressName,@Street) \n";
            sql+=" exec dbo.p640210post 'SYSTEM','系统管理员',@docCode,640210,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
    @Override
    public List<Map<String, Object>> getPreInstallation(Integer docStatus, String openId) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.acceptSource,a.docCode,a.enterDate,a.preSendDate,a.cltCode,a.cltName," +
                    "(case when isnull(a.DocStatus,0) <100 then 1\n" +
                    " when isnull(a.DocStatus,0)=100 then 3 \n" +
                    " else 1 end) docStatus,isnull(a.lastDocStatus,0) lastDocStatus,a.memo \n" +
                    "from t640210H a join t110203 b on a.CltCode=b.CltCode and b.MiniAppOpenId=" + GridUtils.prossSqlParm(openId) + "\n" +
                    "where a.AcceptSource='预约' ";
            if (docStatus == 1) {
                sql += "  and isnull(a.DocStatus,0) < 100";
            } else if (docStatus == 3) {
                sql += "  and isnull(a.DocStatus,0) = 100";
            }
            sql += " order by a.enterDate desc";
            return jdbcTemplate.queryForList(sql);
        } catch (Exception e) {
            throw e;
        }
    }
    @Override
    public AfterSalesEntity getPreInstallationInfo(String docCode) {
        String sql = "set nocount on\n";
        try {
            sql += "select a.topic,a.id,a.inserttime,a.curStatus,a.ActionCode,a.ActionName,a.ActionTel,\n" +
                    "b.acceptSource,b.docCode,b.formId,b.PaiGongDocCode,b.PaiGongFormId,b.enterDate,b.preSendDate,b.uploadFiles,b.cltCode,b.cltName,b.tel," +
                    "isnull(b.propertyAddress,'') as propertyAddress," +
                    "isnull(b.docStatus,0) docStatus,isnull(b.LastDocStatus,0) lastDocStatus,b.memo,b.longitude,b.latitude,b.fullAddressName \n" +
                    "from t640210D2 a right join t640210h b on a.SODocCode=b.docCode where b.docCode= " + GridUtils.prossSqlParm(docCode) + " order by id desc";
            return AfterSalesEntity.setAfterSalesEntity(jdbcTemplate.queryForList(sql));
        } catch (Exception e) {
            throw e;
        }
    }
    @Override
    public void saveRenewal(AfterSalesParameters param) throws Exception {
        String sql = "set nocount on\n";
        try {
            sql += "declare @docCode varchar(50) ,@cltCode varchar(50) = '',@cltName varchar(100) = ''," +
                    "@companyId varchar(10),@companyName varchar(100),@seq int =" + param.getSeq() + "," +
                    "@ccCode varchar(50),@ccName varchar(50),"+
                    "@Longitude varchar(50),@Latitude varchar(50),@FullAddressName varchar(200)," +
                    "@FullAddress varchar(300),@Street varchar(200)\n";
            if (StringUtils.isNotBlank(param.getOpenId())) {
                sql += "select @cltCode=cltCode,@cltName=cltName,@ccCode=ccCode,@ccName=ccName," +
                        "@companyId=companyId,@companyName=companyName from t110203 where MiniAppOpenId=" + GridUtils.prossSqlParm(param.getOpenId()) + "\n";
                sql += " if isnull(@cltCode,'') = ''  \n " +
                        " begin \n" +
                        "  raiserror('系统未绑定微信用户ID,请绑定后再执行',16,1) \n" +
                        " return \n" +
                        " end \n";
            }
            sql += "select @Longitude = Longitude,@Latitude=Latitude,@FullAddressName=FullAddressName," +
                    "@FullAddress=isnull(FullAddress,'')+''+isnull(FullAddressName,'')+''+isnull(Street,'')," +
                    "@Street=Street from t110209 " +
                    "where seq=@seq";
            sql += " exec sp_newdoccode 640210,'SYSTEM',@docCode output\n";
            sql += "insert into t640210H(docCode,formId,docDate,periodID,ccCode,ccName,DocStatus,LastDocStatus,PostCode,PostName,companyId,companyName,AcceptSource,cltCode,cltName,tel," +
                    "PropertyAddress,PreSendDate,Memo,enterDate,UploadFiles,seq,Longitude,Latitude,FullAddressName,Street)" +
                    " values (@docCode," + param.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),@ccCode,@ccName,0,0,'system','小程序端',@companyId,@companyName,'换新',@cltCode," +
                    GridUtils.prossSqlParm(param.getCltName()) + "," + GridUtils.prossSqlParm(param.getTel()) + ",@FullAddress," +
                    GridUtils.prossSqlParm(param.getPreSendDate()) + "," +
                    GridUtils.prossSqlParm(param.getMemo()) + ",getdate()," + GridUtils.prossSqlParm(param.getUploadFiles()) + "," +
                    "@seq,@Longitude,@Latitude,@FullAddressName,@Street) \n";
            sql+=" exec dbo.p640210post 'SYSTEM','系统管理员',@docCode,640210,0,'提交','','','' \n";
            if(StringUtils.isNotBlank(param.getUploadFiles())){
                String unId=param.getUploadFiles().split(";")[0];//0元素必定是unId值
                sql+="update _sys_Attachment set docCode=@docCode where UNID='"+unId+"'";
            }
            jdbcTemplate.update(sql);
        } catch (Exception e) {
            throw e;
        }
    }
    @Override
    public Integer deleteFile(String unId, Integer seq) {
        String sql = "set nocount on\n";
        try {