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

需求 #14165

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