|
|
@@ -61,6 +61,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.core.StatementCallback;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
@@ -96,6 +97,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ProductStoreStatusDao productStoreStatusDao;
|
|
|
|
|
|
@@ -699,8 +703,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResultMap matchNonStandardProduct(){
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
+ public ResultMap matchNonStandardProduct() {
|
|
|
final Long uu = SystemSession.getUser().getUserUU();
|
|
|
final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
ProductStoreStatus status = productStoreStatusDao.findByEnuu(enUU);
|
|
|
@@ -727,25 +730,16 @@ public class ProductServiceImpl implements ProductService {
|
|
|
status = productStoreStatusDao.save(storeStatus);
|
|
|
}
|
|
|
|
|
|
- int total = productDao.getCountByEnuuAndStatusAndEnabled(enUU, ShortConstant.NO_SHORT, IntegerConstant.YES_SHORT);
|
|
|
+// int total = productDao.getCountByEnuuAndStatusAndEnabled(enUU, ShortConstant.NO_SHORT, IntegerConstant.YES_SHORT);
|
|
|
+ int total = productDao.getCountByEnuuAndStatus(enUU, ShortConstant.NO_SHORT);
|
|
|
int success = 0;
|
|
|
int fail = 0;
|
|
|
-
|
|
|
- String sql = "/*#mycat:db_type=master*/ call PRODUCT_MATCHES_V1(%s, %s, @out); select @out";
|
|
|
- final String formatSql = String.format(sql, enUU, uu);
|
|
|
- success = jdbcTemplate.execute(new StatementCallback<Integer>() {
|
|
|
- @Override
|
|
|
- public Integer doInStatement(Statement statement) throws SQLException, DataAccessException {
|
|
|
- statement.execute(formatSql);
|
|
|
- ResultSet rs = statement.getResultSet();
|
|
|
- if (null != rs) {
|
|
|
- rs.next();
|
|
|
- return rs.getInt(1);
|
|
|
- }
|
|
|
- return 0;
|
|
|
- }
|
|
|
- });
|
|
|
- fail = total - success;
|
|
|
+ Map<String, Long> queryMap = new HashMap<>();
|
|
|
+ queryMap.put("enUU", enUU);
|
|
|
+ String successUrl = "http://192.168.253.129:8099/product/match/nonProduct";
|
|
|
+ String result = restTemplate.postForEntity(successUrl, queryMap, String.class).getBody();
|
|
|
+ ModelMap map = FastjsonUtils.fromJson(result, ModelMap.class);
|
|
|
+ fail = total - (int) map.get("success");
|
|
|
|
|
|
status.setStatus(Status.FINISH.value());
|
|
|
productStoreStatusDao.save(status);
|