Commit 2794ff73 authored by 张永's avatar 张永

需求 #14165

parent 2f56f603
......@@ -193,7 +193,7 @@ public class GoodsController {
@ApiOperation("查询库存价格")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "uid", dataType = "String", required = true, value = "商品唯一标识"),
@ApiImplicitParam(paramType = "query", name = "uid", dataType = "String", required = true, value = "商品唯一标识 合同号1:商品ID1,合同号2:商品ID2,"),
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "orgNo", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name = "agentID", dataType = "String", required = true),
......
......@@ -44,6 +44,7 @@ public class PageController {
})
@RequestMapping(value = "/queryBanner",method=RequestMethod.GET)
public String queryBanner(HttpServletRequest request) {
System.out.println("------------------------");
String custNo = request.getParameter("custNo");
String orgNO = request.getParameter("orgNo");
String adTypeID = request.getParameter("adTypeID");
......
......@@ -66,6 +66,9 @@ public class PromoController {
String statusDesc = "正常活动";
Date now = new Date();
Map<String, Object> promoMap = service.getPromoDetail(promoPaperNO,agentID);
if (promoMap == null) {
return Rjx.jsonErr().setMessage("活动不存在");
}
Date dPromoBeginDate = (Date)promoMap.get("dPromoBeginDate");
Date dPromoEndDate = (Date)promoMap.get("dPromoEndDate");
Integer nTag = ((Number)promoMap.get("nTag")).intValue();
......
......@@ -71,8 +71,8 @@ public class PageServiceImpl implements PageService {
+ " LayoutTypeID = b.sLayoutTypeID,LayoutType = b.sLayoutType,JumpTypeID = b.sJumpTypeID,JumpType = b.sJumpType,JumpList = b.sJumpList,Idx = b.nIdx,ImagePath = b.sImagePath,"
+ " LinkPath = b.sLinkPath "
+ " from tBannerAd b , tCustomer c "
+ " WHERE sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = c.nAgentID and c.nTag&2 = 2 and c.sCustNO = ? ";
+ " WHERE b.sOrgNO = ? AND sAdPositionTypeID = ? AND b.dStartTime <=getdate() AND b.dEndTime >= getdate() AND b.nTag&2 = 2 and b.nAgentID = c.nAgentID and c.nTag&2 = 2 and c.sCustNO = ? ";
System.out.println(sql);
return jdbcTemplate.limit(sql, page, orgNO, adTypeID,custNo);
}
......
......@@ -111,7 +111,11 @@ public class PromoServiceImpl implements PromoService {
@Override
public Map<String, Object> getPromoDetail(String promoPaperNO,String agentID) {
return jdbcTemplate.queryForMap("select * from tPromo where sPromoPaperNO = ? and nTag&3 = 2 and nAgentID = ? ", promoPaperNO,agentID);
try {
return jdbcTemplate.queryForMap("select * from tPromo where sPromoPaperNO = ? and nTag&3 = 2 and nAgentID = ? ", promoPaperNO,agentID);
} catch (Exception e) {
return null;
}
}
}
package com.egolm.shop.schedules.qiyewx;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.api.service.QiyeWxService.WxMessage.MiniprogramNotice;
import com.egolm.shop.bean.TSalesOrder;
@Component
public class QiyeWxMsgTask {
@Autowired
QiyeWxService wxService;
@Autowired
JdbcTemplate jdbcTemplate;
@Scheduled(cron="${qiyewx.msg.timer}")
public void execute() {
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nID, sSMS from tSMS where sSendType = '2' and sChannelID = 'qywx' and sSendGroup = '6'");
if(list.size() > 0) {
List<String> ids = list.stream().map(o -> (String)o.get("sSMS")).collect(Collectors.toList());
List<Map<String, Object>> subOrderList = jdbcTemplate.queryForList("select * from tSalesOrderSub where sSubOrderID in (" + StringUtil.join("', '", "'", "'", "''", ids) + ")");
Map<String, Map<String, Object>> mm = Util.listToMM(list, "sSMS");
for(Map<String, Object> subOrderMap : subOrderList) {
Map<String, Object> msg = mm.get(subOrderMap.get("sSubOrderID"));
Number msgId = (Number)msg.get("nId");
String errMsg = "";
try {
this.sendMessage(subOrderMap);
} catch (Exception e) {
e.printStackTrace();
errMsg = e.getMessage();
} finally {
jdbcTemplate.executeMutil("exec up_UpdateSMS ?, ?", msgId, errMsg);
}
}
}
}
private void sendMessage(Map<String, Object> subOrderMap) {
String dateString = DateUtil.format(new Date());
String sSubOrderID = (String)subOrderMap.get("sSubOrderID");
String sSalesOrderID = (String)subOrderMap.get("sSalesOrderID");
TSalesOrder order = jdbcTemplate.queryForBean("select * from tSalesOrder where sSalesOrderID = ?", TSalesOrder.class, sSalesOrderID);
String salesmanNo = order.getsSalesmanNO();
String shopNo = order.getsShopNO();
BigDecimal totalAmount = order.getnTotalSaleAmount();
BigDecimal totalSaleQty = order.getnTotalSaleQty();
String payType = order.getsSalesOrderPayType();
Map<String, Object> salesman = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNo);
Map<String, Object> shop = jdbcTemplate.queryForMap("select * from tShop where sShopNO = ?", shopNo);
String custNo = (String)shop.get("sCustNO");
String shopMemo = (String)shop.get("sMemo");
Map<String, Object> cust = jdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo);;
String custName = (String)cust.get("sCustName");
String sCompanyAccountID = (String)salesman.get("sCompanyAccountID");
WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice);
notice.setTitle("客户订单通知");
notice.setDescription(dateString);
notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSubOrderID + "&isActive=1");
Map<Object, Object> params = new LinkedHashMap<Object, Object>();
params.put("订单状态", "已发货");
params.put("客户", custName);
params.put("订单金额", totalAmount);
params.put("商品数量", totalSaleQty);
params.put("支付方式", payType);
params.put("订单时间", dateString);
params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo);
notice.setContent_item(params);
wxService.sendMessage(wxMessage);
}
}
package com.egolm.shop.schedules.qiyewx;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.Util;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.api.service.QiyeWxService.WxMessage.MiniprogramNotice;
import com.egolm.shop.bean.TSalesOrder;
@Component
public class QiyeWxMsgTask {
@Autowired
QiyeWxService wxService;
@Autowired
JdbcTemplate jdbcTemplate;
/* @Scheduled(cron="${qiyewx.msg.timer}")*/
public void execute() {
List<Map<String, Object>> list = jdbcTemplate.queryForList("select nID, sSMS from tSMS where sSendType = '2' and sChannelID = 'qywx' and sSendGroup = '6'");
if(list.size() > 0) {
List<String> ids = list.stream().map(o -> (String)o.get("sSMS")).collect(Collectors.toList());
List<Map<String, Object>> subOrderList = jdbcTemplate.queryForList("select * from tSalesOrderSub where sSubOrderID in (" + StringUtil.join("', '", "'", "'", "''", ids) + ")");
Map<String, Map<String, Object>> mm = Util.listToMM(list, "sSMS");
for(Map<String, Object> subOrderMap : subOrderList) {
Map<String, Object> msg = mm.get(subOrderMap.get("sSubOrderID"));
Number msgId = (Number)msg.get("nId");
String errMsg = "";
try {
this.sendMessage(subOrderMap);
} catch (Exception e) {
e.printStackTrace();
errMsg = e.getMessage();
} finally {
jdbcTemplate.executeMutil("exec up_UpdateSMS ?, ?", msgId, errMsg);
}
}
}
}
private void sendMessage(Map<String, Object> subOrderMap) {
String dateString = DateUtil.format(new Date());
String sSubOrderID = (String)subOrderMap.get("sSubOrderID");
String sSalesOrderID = (String)subOrderMap.get("sSalesOrderID");
TSalesOrder order = jdbcTemplate.queryForBean("select * from tSalesOrder where sSalesOrderID = ?", TSalesOrder.class, sSalesOrderID);
String salesmanNo = order.getsSalesmanNO();
String shopNo = order.getsShopNO();
BigDecimal totalAmount = order.getnTotalSaleAmount();
BigDecimal totalSaleQty = order.getnTotalSaleQty();
String payType = order.getsSalesOrderPayType();
Map<String, Object> salesman = jdbcTemplate.queryForMap("select * from tSalesman where sSalesmanNO = ?", salesmanNo);
Map<String, Object> shop = jdbcTemplate.queryForMap("select * from tShop where sShopNO = ?", shopNo);
String custNo = (String)shop.get("sCustNO");
String shopMemo = (String)shop.get("sMemo");
Map<String, Object> cust = jdbcTemplate.queryForMap("select * from tCustomer where sCustNO = ?", custNo);;
String custName = (String)cust.get("sCustName");
String sCompanyAccountID = (String)salesman.get("sCompanyAccountID");
WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice);
notice.setTitle("客户订单通知");
notice.setDescription(dateString);
notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSubOrderID + "&isActive=1");
Map<Object, Object> params = new LinkedHashMap<Object, Object>();
params.put("订单状态", "已发货");
params.put("客户", custName);
params.put("订单金额", totalAmount);
params.put("商品数量", totalSaleQty);
params.put("支付方式", payType);
params.put("订单时间", dateString);
params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo);
notice.setContent_item(params);
wxService.sendMessage(wxMessage);
}
}
package com.egolm.shop.schedules.search;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.FileUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(tags={"搜索引擎更新工具"})
@RestController
@RequestMapping("util/search/goods")
public class GoodsCollectTask extends AbstractSolrApi{
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private HttpSolrClient solrClient;
@Value("${solr.goods.offset-minute-for-day}")
private Long offsetMinuteForDay;
@Value("${solr.goods.offset-minute-for-minute}")
private Long offsetMinuteForMinute;
@Value("${sql.goods.create-index-query}")
private String createIndexQueryFilePath;
@Value("${sql.goods.delete-index-query}")
private String deleteIndexQueryFilePath;
@Value("${sql.goods.update-index-query}")
private String updateIndexQueryFilePath;
private String createIndexQuerySql;
private String updateIndexQuerySql;
private String deleteIndexQuerySql;
@PostConstruct
@ApiOperation("更新查询语句")
@PostMapping("updateQuerySql")
public String init() {
createIndexQuerySql = FileUtil.fileToString(createIndexQueryFilePath);
updateIndexQuerySql = FileUtil.fileToString(updateIndexQueryFilePath);
deleteIndexQuerySql = FileUtil.fileToString(deleteIndexQueryFilePath);
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新全量索引")
@PostMapping("updateFullIndex")
public String updateFullIndex() {
this.createIndex();
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新当天索引")
@PostMapping("updateTodayIndex")
public String updateTodayIndex() {
this.dayExecute();
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新最新索引")
@PostMapping("updateLastedIndex")
public String updateLastedIndex() {
this.minuteExecute();
return Rjx.jsonOk().toJson();
}
@Scheduled(cron="${solr.goods.cron-for-day}")
public void dayExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForDay*60L*1000L));
this.updateIndex(date);
}
@Scheduled(cron="${solr.goods.cron-for-minute}")
public void minuteExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForMinute*60L*1000L));
this.updateIndex(date);
}
public void createIndex() {
this.clear();
List<Map<String, Object>> orgList = jdbcTemplate.queryForList("select sOrgNO, sOrgDesc from tOrg where nTag&1 = 0 and sOrgTypeID = 4");
for(Map<String, Object> orgMap : orgList) {
String sOrgNO = (String)orgMap.get("sOrgNO");
this.deleteByQuery("sOrgNO:" + sOrgNO);
List<Map<String, Object>> list = jdbcTemplate.limitAll(createIndexQuerySql, new Page(1L, 1000L, "sOrgNO", "sAgentContractNO", "sGoodsNO"), sOrgNO);
for(Map<String, Object> map : list) {
map.remove("RowNumber");
}
this.update(list);
}
}
public void updateIndex(Date date) {
this.deleteById(jdbcTemplate.queryForList(deleteIndexQuerySql, date).stream().map(o -> String.valueOf(o.get("id"))).collect(Collectors.toList()));
this.update(jdbcTemplate.queryForList(updateIndexQuerySql, date));
}
@Override
public HttpSolrClient getSolrClient() {
return solrClient;
}
}
package com.egolm.shop.schedules.search;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.FileUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(tags={"搜索引擎更新工具"})
@RestController
@RequestMapping("util/search/goods")
public class GoodsCollectTask extends AbstractSolrApi{
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private HttpSolrClient solrClient;
@Value("${solr.goods.offset-minute-for-day}")
private Long offsetMinuteForDay;
@Value("${solr.goods.offset-minute-for-minute}")
private Long offsetMinuteForMinute;
@Value("${sql.goods.create-index-query}")
private String createIndexQueryFilePath;
@Value("${sql.goods.delete-index-query}")
private String deleteIndexQueryFilePath;
@Value("${sql.goods.update-index-query}")
private String updateIndexQueryFilePath;
private String createIndexQuerySql;
private String updateIndexQuerySql;
private String deleteIndexQuerySql;
@PostConstruct
@ApiOperation("更新查询语句")
@PostMapping("updateQuerySql")
public String init() {
createIndexQuerySql = FileUtil.fileToString(createIndexQueryFilePath);
updateIndexQuerySql = FileUtil.fileToString(updateIndexQueryFilePath);
deleteIndexQuerySql = FileUtil.fileToString(deleteIndexQueryFilePath);
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新全量索引")
@PostMapping("updateFullIndex")
public String updateFullIndex() {
this.createIndex();
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新当天索引")
@PostMapping("updateTodayIndex")
public String updateTodayIndex() {
this.dayExecute();
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新最新索引")
@PostMapping("updateLastedIndex")
public String updateLastedIndex() {
this.minuteExecute();
return Rjx.jsonOk().toJson();
}
/* @Scheduled(cron="${solr.goods.cron-for-day}")*/
public void dayExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForDay*60L*1000L));
this.updateIndex(date);
}
/*@Scheduled(cron="${solr.goods.cron-for-minute}")*/
public void minuteExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForMinute*60L*1000L));
this.updateIndex(date);
}
public void createIndex() {
this.clear();
List<Map<String, Object>> orgList = jdbcTemplate.queryForList("select sOrgNO, sOrgDesc from tOrg where nTag&1 = 0 and sOrgTypeID = 4");
for(Map<String, Object> orgMap : orgList) {
String sOrgNO = (String)orgMap.get("sOrgNO");
this.deleteByQuery("sOrgNO:" + sOrgNO);
List<Map<String, Object>> list = jdbcTemplate.limitAll(createIndexQuerySql, new Page(1L, 1000L, "sOrgNO", "sAgentContractNO", "sGoodsNO"), sOrgNO);
for(Map<String, Object> map : list) {
map.remove("RowNumber");
}
this.update(list);
}
}
public void updateIndex(Date date) {
this.deleteById(jdbcTemplate.queryForList(deleteIndexQuerySql, date).stream().map(o -> String.valueOf(o.get("id"))).collect(Collectors.toList()));
this.update(jdbcTemplate.queryForList(updateIndexQuerySql, date));
}
@Override
public HttpSolrClient getSolrClient() {
return solrClient;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment